From ae9b4026a956f2ece490a10497b3ff7e4435de9e Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 26 Feb 2021 23:25:35 -0600 Subject: fixed error message typo (#401) * fixed missed closing of a dataset * fixed missed closing of a dataset * fixed typo in error return --- src/H5L.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5L.c b/src/H5L.c index 171c128..982813b 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -1763,7 +1763,7 @@ H5Literate2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t /* Iterate over links synchronously */ if ((ret_value = H5L__iterate_api_common(group_id, idx_type, order, idx_p, op, op_data, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "asynchronous link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "synchronous link iteration failed") done: FUNC_LEAVE_API(ret_value) -- cgit v0.12 From f2a15528228f9e67ed3bc8121ac888bf2b962823 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 1 Mar 2021 08:24:59 -0600 Subject: H5TS_win32_thread_exit (#396) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int --- .github/CODEOWNERS | 8 ++-- src/H5TS.c | 81 +++++++++++++++++++++++++++------------ tools/src/h5ls/h5ls.c | 5 +-- tools/test/h5dump/h5dumpgentest.c | 2 +- 4 files changed, 62 insertions(+), 34 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 97b7428..c807e75 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,7 +13,7 @@ CMakeTests.* @byrnHDF @derobins /bin/ @lrknox @derobins @qkoziol -/c++/ @bmribler @byrnHDF +/c++/ @bmribler @byrnHDF @derobins /config/ @lrknox @derobins @qkoziol @byrnHDF @@ -23,7 +23,7 @@ CMakeTests.* @byrnHDF @derobins /fortran/ @brtnfld @epourmal -/hl/ @bmribler @byrnHDF +/hl/ @bmribler @byrnHDF @derobins /java/ @jhendersonHDF @byrnHDF @@ -37,6 +37,6 @@ CMakeTests.* @byrnHDF @derobins /testpar/ @jhendersonHDF @rawarren @jrmainzer @qkoziol -/tools/ @byrnHDF @bmribler +/tools/ @byrnHDF @bmribler @derobins -/utils/ @lrknox @byrnHDF +/utils/ @lrknox @byrnHDF @derobins diff --git a/src/H5TS.c b/src/H5TS.c index 90b1244..258c9df 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -12,13 +12,13 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: This file contains the framework for ensuring that the global - * library lock is held when an API routine is called. This + * Purpose: This file contains the framework for ensuring that the global + * library lock is held when an API routine is called. This * framework works in concert with the FUNC_ENTER_API / FUNC_LEAVE_API - * macros defined in H5private.h. + * macros defined in H5private.h. * - * Note: Because this threadsafety framework operates outside the library, - * it does not use the error stack and only uses the "namecheck only" + * Note: Because this threadsafety framework operates outside the library, + * it does not use the error stack and only uses the "namecheck only" * FUNC_ENTER_* / FUNC_LEAVE_* macros. */ @@ -70,23 +70,45 @@ static herr_t H5TS__mutex_unlock(H5TS_mutex_t *mutex, unsigned int *lock_count); /* Global variable definitions */ #ifdef H5_HAVE_WIN_THREADS H5TS_once_t H5TS_first_init_g; -#else /* H5_HAVE_WIN_THREADS */ -H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT; -#endif /* H5_HAVE_WIN_THREADS */ +#else +H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT; +#endif /* Thread-local keys, used by other interfaces */ -H5TS_key_t H5TS_errstk_key_g; /* Error stack */ +/* Error stack */ +#ifdef H5_HAVE_WIN_THREADS +H5TS_key_t H5TS_errstk_key_g = TLS_OUT_OF_INDEXES; +#else +H5TS_key_t H5TS_errstk_key_g; +#endif + #ifdef H5_HAVE_CODESTACK -H5TS_key_t H5TS_funcstk_key_g; /* Function stack */ -#endif /* H5_HAVE_CODESTACK */ -H5TS_key_t H5TS_apictx_key_g; /* API context */ +/* Function stack */ +#ifdef H5_HAVE_WIN_THREADS +H5TS_key_t H5TS_funcstk_key_g = TLS_OUT_OF_INDEXES; +#else +H5TS_key_t H5TS_funcstk_key_g; +#endif +#endif /* H5_HAVE_CODESTACK */ + +/* API context */ +#ifdef H5_HAVE_WIN_THREADS +H5TS_key_t H5TS_apictx_key_g = TLS_OUT_OF_INDEXES; +#else +H5TS_key_t H5TS_apictx_key_g; +#endif /*******************/ /* Local Variables */ /*******************/ /* Thread-local keys, used in this module */ -static H5TS_key_t H5TS_cancel_key_s; /* Thread cancellation state */ +/* Thread cancellation state */ +#ifdef H5_HAVE_WIN_THREADS +static H5TS_key_t H5TS_cancel_key_s = TLS_OUT_OF_INDEXES; +#else +static H5TS_key_t H5TS_cancel_key_s; +#endif #ifndef H5_HAVE_WIN_THREADS @@ -871,11 +893,14 @@ H5TS_win32_process_exit(void) DeleteCriticalSection(&H5_g.init_lock.CriticalSection); /* Clean up per-process thread local storage */ - TlsFree(H5TS_errstk_key_g); + if (H5TS_errstk_key_g != TLS_OUT_OF_INDEXES) + TlsFree(H5TS_errstk_key_g); #ifdef H5_HAVE_CODESTACK - TlsFree(H5TS_funcstk_key_g); + if (H5TS_funcstk_key_g != TLS_OUT_OF_INDEXES) + TlsFree(H5TS_funcstk_key_g); #endif /* H5_HAVE_CODESTACK */ - TlsFree(H5TS_apictx_key_g); + if (H5TS_apictx_key_g != TLS_OUT_OF_INDEXES) + TlsFree(H5TS_apictx_key_g); FUNC_LEAVE_NOAPI_VOID_NAMECHECK_ONLY } /* H5TS_win32_process_exit() */ @@ -909,19 +934,25 @@ H5TS_win32_thread_exit(void) */ /* Clean up per-thread thread local storage */ - lpvData = TlsGetValue(H5TS_errstk_key_g); - if (lpvData) - LocalFree((HLOCAL)lpvData); + if (H5TS_errstk_key_g != TLS_OUT_OF_INDEXES) { + lpvData = TlsGetValue(H5TS_errstk_key_g); + if (lpvData) + LocalFree((HLOCAL)lpvData); + } #ifdef H5_HAVE_CODESTACK - lpvData = TlsGetValue(H5TS_funcstk_key_g); - if (lpvData) - LocalFree((HLOCAL)lpvData); + if (H5TS_funcstk_key_g != TLS_OUT_OF_INDEXES) { + lpvData = TlsGetValue(H5TS_funcstk_key_g); + if (lpvData) + LocalFree((HLOCAL)lpvData); + } #endif /* H5_HAVE_CODESTACK */ - lpvData = TlsGetValue(H5TS_apictx_key_g); - if (lpvData) - LocalFree((HLOCAL)lpvData); + if (H5TS_apictx_key_g != TLS_OUT_OF_INDEXES) { + lpvData = TlsGetValue(H5TS_apictx_key_g); + if (lpvData) + LocalFree((HLOCAL)lpvData); + } FUNC_LEAVE_NOAPI_NAMECHECK_ONLY(ret_value) } /* H5TS_win32_thread_exit() */ diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 64003e7..09bc323 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -530,10 +530,7 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind) h5tools_str_append(buffer, "native hbool_t"); } else { - if (H5T_FLOAT == H5Tget_class(type)) - return print_float_type(buffer, type, ind); - else - return print_int_type(buffer, type, ind); + return print_int_type(buffer, type, ind); } } else { diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 15d3eef..5507ede 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -6356,7 +6356,7 @@ gent_ldouble_scalar(void) if ((sid = H5Screate(H5S_SCALAR)) < 0) goto error; - if ((tid = H5Tarray_create(H5T_NATIVE_LDOUBLE, 1, dims)) < 0) + if ((tid = H5Tarray_create2(H5T_NATIVE_LDOUBLE, 1, dims)) < 0) goto error; if (H5Tget_size(tid) == 0) -- cgit v0.12 From fab95ce7b309e3cb43cc9dc25c08da986f5d0e58 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 4 Mar 2021 06:29:10 -0600 Subject: Changes found during merge to 1.12 (#414) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup --- c++/src/H5AbstractDs.h | 6 +++--- c++/src/H5CommonFG.h | 6 +++--- c++/src/H5Group.h | 6 +++--- c++/src/H5IdComponent.h | 6 +++--- config/cmake/HDF5PluginCache.cmake | 2 +- config/gnu-cxxflags | 2 +- config/gnu-fflags | 2 +- fortran/src/H5match_types.c | 4 ++-- hl/src/hdf5_hl.h | 7 ++++--- java/src/jni/exceptionImp.h | 6 +++--- java/src/jni/h5Imp.h | 6 +++--- java/src/jni/h5aImp.h | 6 +++--- java/src/jni/h5dImp.h | 6 +++--- java/src/jni/h5eImp.h | 6 +++--- java/src/jni/h5fImp.h | 6 +++--- java/src/jni/h5gImp.h | 6 +++--- java/src/jni/h5iImp.h | 6 +++--- java/src/jni/h5jni.h | 6 +++--- java/src/jni/h5lImp.h | 6 +++--- java/src/jni/h5oImp.h | 6 +++--- java/src/jni/h5pACPLImp.h | 6 +++--- java/src/jni/h5pDAPLImp.h | 6 +++--- java/src/jni/h5pDCPLImp.h | 6 +++--- java/src/jni/h5pDXPLImp.h | 6 +++--- java/src/jni/h5pFAPLImp.h | 6 +++--- java/src/jni/h5pFCPLImp.h | 6 +++--- java/src/jni/h5pGAPLImp.h | 6 +++--- java/src/jni/h5pGCPLImp.h | 6 +++--- java/src/jni/h5pImp.h | 6 +++--- java/src/jni/h5pLAPLImp.h | 6 +++--- java/src/jni/h5pLCPLImp.h | 6 +++--- java/src/jni/h5pOCPLImp.h | 6 +++--- java/src/jni/h5pOCpyPLImp.h | 6 +++--- java/src/jni/h5pStrCPLImp.h | 6 +++--- java/src/jni/h5plImp.h | 6 +++--- java/src/jni/h5rImp.h | 6 +++--- java/src/jni/h5sImp.h | 6 +++--- java/src/jni/h5tImp.h | 6 +++--- java/src/jni/h5vlImp.h | 6 +++--- java/src/jni/h5zImp.h | 6 +++--- java/src/jni/nativeData.h | 6 +++--- release_docs/RELEASE.txt | 8 ++++++++ src/H5ACprivate.h | 2 +- src/H5Bpkg.h | 30 +++++++++++++++--------------- src/H5Cprivate.h | 2 +- src/H5Dpkg.h | 2 +- src/H5Epublic.h | 10 +++++----- src/H5FDmulti.c | 2 +- src/H5FDprivate.h | 2 +- src/H5FDstdio.c | 2 +- src/H5Gpkg.h | 26 +++++++++++++------------- src/H5Gprivate.h | 8 ++++---- src/H5Ipkg.h | 2 +- src/H5Mpkg.h | 2 +- src/H5PBprivate.h | 2 +- src/H5PLpublic.h | 4 +++- src/H5SMprivate.h | 2 +- src/H5Spkg.h | 2 +- test/cache_common.h | 6 +++--- test/external_common.h | 6 +++--- test/external_fname.h | 6 +++--- test/null_vol_connector.h | 6 +++--- test/swmr_common.h | 6 +++--- tools/lib/h5diff.h | 6 +++--- tools/lib/h5tools.h | 6 +++--- tools/lib/h5tools_dump.h | 6 +++--- tools/lib/h5tools_error.h | 6 +++--- tools/lib/h5tools_ref.h | 4 ++-- tools/lib/h5tools_str.h | 6 +++--- tools/lib/h5tools_utils.h | 6 +++--- tools/lib/h5trav.h | 6 +++--- tools/lib/io_timer.h | 6 +++--- tools/lib/ph5diff.h | 6 +++--- tools/src/h5diff/h5diff_common.h | 6 +++--- tools/src/h5dump/h5dump.h | 6 +++--- tools/src/h5dump/h5dump_ddl.h | 6 +++--- tools/src/h5dump/h5dump_defines.h | 6 +++--- tools/src/h5dump/h5dump_extern.h | 6 +++--- tools/src/h5dump/h5dump_xml.h | 6 +++--- tools/src/h5import/h5import.h | 6 +++--- tools/src/h5repack/h5repack.h | 6 +++--- tools/test/perform/pio_perf.h | 6 +++--- tools/test/perform/pio_standalone.h | 4 ++-- tools/test/perform/sio_perf.h | 6 +++--- tools/test/perform/sio_standalone.h | 4 ++-- 85 files changed, 254 insertions(+), 243 deletions(-) diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index fe6e033c..cb43c73 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __AbstractDs_H -#define __AbstractDs_H +#ifndef AbstractDs_H +#define AbstractDs_H namespace H5 { @@ -81,4 +81,4 @@ class H5_DLLCPP AbstractDs { }; // end of AbstractDs } // namespace H5 -#endif // __AbstractDs_H +#endif // AbstractDs_H diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 2e5ccf3..368883b 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __CommonFG_H -#define __CommonFG_H +#ifndef CommonFG_H +#define CommonFG_H namespace H5 { @@ -83,7 +83,7 @@ class H5_DLLCPP CommonFG { }; // end of CommonFG } // namespace H5 -#endif // __CommonFG_H +#endif // CommonFG_H /*************************************************************************** Design Note diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index ae5bb4a..2a0f18e 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __Group_H -#define __Group_H +#ifndef Group_H +#define Group_H namespace H5 { @@ -83,4 +83,4 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { }; // end of Group } // namespace H5 -#endif // __Group_H +#endif // Group_H diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index b756a3d..4f75849 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __IdComponent_H -#define __IdComponent_H +#ifndef IdComponent_H +#define IdComponent_H namespace H5 { @@ -113,4 +113,4 @@ class H5_DLLCPP IdComponent { }; // end class IdComponent } // namespace H5 -#endif // __IdComponent_H +#endif // IdComponent_H diff --git a/config/cmake/HDF5PluginCache.cmake b/config/cmake/HDF5PluginCache.cmake index 2b9e48c..3b085dd 100644 --- a/config/cmake/HDF5PluginCache.cmake +++ b/config/cmake/HDF5PluginCache.cmake @@ -20,7 +20,7 @@ set (HDF5_REPACK_EXECUTABLE $ CACHE STRING "hdf5 h5 set (H5PL_ALLOW_EXTERNAL_SUPPORT "${HDF5_ALLOW_EXTERNAL_SUPPORT}" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) -set (H5PL_GIT_URL "https://git@bitbucket.hdfgroup.org/scm/test/h5plugin.git" CACHE STRING "Use plugins from HDF repository" FORCE) +set (H5PL_GIT_URL "https://github.com/HDFGroup/hdf5_plugins.git" CACHE STRING "Use plugins from HDF repository" FORCE) set (H5PL_GIT_BRANCH "master" CACHE STRING "" FORCE) set (H5PL_TGZ_NAME "${PLUGIN_TGZ_NAME}" CACHE STRING "Use plugins from compressed file" FORCE) diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 3fe13d8..cba8298 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -148,7 +148,7 @@ if test "X-g++" = "X-$cxx_vendor"; then # Enhanced Diagnostics # ######################## - if test $cc_vers_major -ge 10; then + if test $cxx_vers_major -ge 10; then NO_DIAGS_CXXFLAGS="-fdiagnostics-urls=never -fno-diagnostics-color" fi DIAGS_CXXFLAGS= diff --git a/config/gnu-fflags b/config/gnu-fflags index d4f876d..ec4fcab 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -109,7 +109,7 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # Enhanced Diagnostics # ######################## - if test $cc_vers_major -ge 10; then + if test $f9x_vers_major -ge 10; then NO_DIAGS_FCFLAGS="-fdiagnostics-urls=never -fno-diagnostics-color" fi DIAGS_FCFLAGS= diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 10d873e..017bab4 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -70,8 +70,8 @@ initCfile(void) * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\ \n\n\ -#ifndef _H5f90i_gen_H\n\ -#define _H5f90i_gen_H\n\ +#ifndef H5f90i_gen_H\n\ +#define H5f90i_gen_H\n\ \n\ /* This file is automatically generated by H5match_types.c at build time. */\n\ \n\ diff --git a/hl/src/hdf5_hl.h b/hl/src/hdf5_hl.h index 580c09a..9960b97 100644 --- a/hl/src/hdf5_hl.h +++ b/hl/src/hdf5_hl.h @@ -17,8 +17,9 @@ * fill this file with lots of gunk... */ -#ifndef _HDF5_HL_H -#define _HDF5_HL_H +#ifndef HDF5_HL_H +#define HDF5_HL_H + #include "hdf5.h" /* hdf5 main library */ #include "H5DOpublic.h" /* dataset optimization */ #include "H5DSpublic.h" /* dimension scales */ @@ -28,4 +29,4 @@ #include "H5PTpublic.h" /* packet table */ #include "H5LDpublic.h" /* lite dataset */ -#endif /*H5_INCLUDE_HL*/ +#endif /*HDF5_HL_H*/ diff --git a/java/src/jni/exceptionImp.h b/java/src/jni/exceptionImp.h index 72edf4c..38469df 100644 --- a/java/src/jni/exceptionImp.h +++ b/java/src/jni/exceptionImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_exception */ -#ifndef _Included_hdf_hdf5lib_H5_exception -#define _Included_hdf_hdf5lib_H5_exception +#ifndef Included_hdf_hdf5lib_H5_exception +#define Included_hdf_hdf5lib_H5_exception #ifdef __cplusplus extern "C" { @@ -67,4 +67,4 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMi } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_exception */ +#endif /* Included_hdf_hdf5lib_H5_exception */ diff --git a/java/src/jni/h5Imp.h b/java/src/jni/h5Imp.h index 776f295..8ab7662 100644 --- a/java/src/jni/h5Imp.h +++ b/java/src/jni/h5Imp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5 */ -#ifndef _Included_hdf_hdf5lib_H5_H5 -#define _Included_hdf_hdf5lib_H5_H5 +#ifndef Included_hdf_hdf5lib_H5_H5 +#define Included_hdf_hdf5lib_H5_H5 #ifdef __cplusplus extern "C" { @@ -82,4 +82,4 @@ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe(JNIEnv } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5 */ +#endif /* Included_hdf_hdf5lib_H5_H5 */ diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h index 3d9a230..aee0e40 100644 --- a/java/src/jni/h5aImp.h +++ b/java/src/jni/h5aImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5A */ -#ifndef _Included_hdf_hdf5lib_H5_H5A -#define _Included_hdf_hdf5lib_H5_H5A +#ifndef Included_hdf_hdf5lib_H5_H5A +#define Included_hdf_hdf5lib_H5_H5A #ifdef __cplusplus extern "C" { @@ -375,4 +375,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name(JNIEnv *, jclass } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5A */ +#endif /* Included_hdf_hdf5lib_H5_H5A */ diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h index 61dfeaa..e339dad 100644 --- a/java/src/jni/h5dImp.h +++ b/java/src/jni/h5dImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5D */ -#ifndef _Included_hdf_hdf5lib_H5_H5D -#define _Included_hdf_hdf5lib_H5_H5D +#ifndef Included_hdf_hdf5lib_H5_H5D +#define Included_hdf_hdf5lib_H5_H5D #ifdef __cplusplus extern "C" { @@ -322,4 +322,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Drefresh(JNIEnv *, jclass, jlong); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5D */ +#endif /* Included_hdf_hdf5lib_H5_H5D */ diff --git a/java/src/jni/h5eImp.h b/java/src/jni/h5eImp.h index 3133ca9..95e43fa 100644 --- a/java/src/jni/h5eImp.h +++ b/java/src/jni/h5eImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5E */ -#ifndef _Included_hdf_hdf5lib_H5_H5E -#define _Included_hdf_hdf5lib_H5_H5E +#ifndef Included_hdf_hdf5lib_H5_H5E +#define Included_hdf_hdf5lib_H5_H5E #ifdef __cplusplus extern "C" { @@ -144,4 +144,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2(JNIEnv *, jclass, jlong, jlo } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5E */ +#endif /* Included_hdf_hdf5lib_H5_H5E */ diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h index d7e3ded..bf2f199 100644 --- a/java/src/jni/h5fImp.h +++ b/java/src/jni/h5fImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5F */ -#ifndef _Included_hdf_hdf5lib_H5_H5F -#define _Included_hdf_hdf5lib_H5_H5F +#ifndef Included_hdf_hdf5lib_H5_H5F +#define Included_hdf_hdf5lib_H5_H5F #ifdef __cplusplus extern "C" { @@ -236,4 +236,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds(JNIEnv *, jcla } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5F */ +#endif /* Included_hdf_hdf5lib_H5_H5F */ diff --git a/java/src/jni/h5gImp.h b/java/src/jni/h5gImp.h index 4b0cb4d..b7130ed 100644 --- a/java/src/jni/h5gImp.h +++ b/java/src/jni/h5gImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5G */ -#ifndef _Included_hdf_hdf5lib_H5_H5G -#define _Included_hdf_hdf5lib_H5_H5G +#ifndef Included_hdf_hdf5lib_H5_H5G +#define Included_hdf_hdf5lib_H5_H5G #ifdef __cplusplus extern "C" { @@ -96,4 +96,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Grefresh(JNIEnv *, jclass, jlong); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5G */ +#endif /* Included_hdf_hdf5lib_H5_H5G */ diff --git a/java/src/jni/h5iImp.h b/java/src/jni/h5iImp.h index ed54303..08d5fa1 100644 --- a/java/src/jni/h5iImp.h +++ b/java/src/jni/h5iImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5I */ -#ifndef _Included_hdf_hdf5lib_H5_H5I -#define _Included_hdf_hdf5lib_H5_H5I +#ifndef Included_hdf_hdf5lib_H5_H5I +#define Included_hdf_hdf5lib_H5_H5I #ifdef __cplusplus extern "C" { @@ -130,4 +130,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Idestroy_1type(JNIEnv *, jclass, ji } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5I */ +#endif /* Included_hdf_hdf5lib_H5_H5I */ diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h index 2ec30da..2c93846 100644 --- a/java/src/jni/h5jni.h +++ b/java/src/jni/h5jni.h @@ -21,8 +21,8 @@ #include #include "H5private.h" -#ifndef _Included_h5jni -#define _Included_h5jni +#ifndef Included_h5jni +#define Included_h5jni #ifdef __cplusplus #define ENVPTR (env) @@ -344,4 +344,4 @@ extern jobject create_H5O_token_t(JNIEnv *env, const H5O_token_t *token, hbool_t } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_h5jni */ +#endif /* Included_h5jni */ diff --git a/java/src/jni/h5lImp.h b/java/src/jni/h5lImp.h index 134ed17..85aff03 100644 --- a/java/src/jni/h5lImp.h +++ b/java/src/jni/h5lImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5_H5L */ -#ifndef _Included_hdf_hdf5lib_H5_H5L -#define _Included_hdf_hdf5lib_H5_H5L +#ifndef Included_hdf_hdf5lib_H5_H5L +#define Included_hdf_hdf5lib_H5_H5L #ifdef __cplusplus extern "C" { @@ -170,4 +170,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lunregister(JNIEnv *, jclass, jint) } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5L */ +#endif /* Included_hdf_hdf5lib_H5_H5L */ diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h index 2abb0d9..a7d7f31 100644 --- a/java/src/jni/h5oImp.h +++ b/java/src/jni/h5oImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5_H5O */ -#ifndef _Included_hdf_hdf5lib_H5_H5O -#define _Included_hdf_hdf5lib_H5_H5O +#ifndef Included_hdf_hdf5lib_H5_H5O +#define Included_hdf_hdf5lib_H5_H5O #ifdef __cplusplus extern "C" { @@ -217,4 +217,4 @@ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled(JN } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5O */ +#endif /* Included_hdf_hdf5lib_H5_H5O */ diff --git a/java/src/jni/h5pACPLImp.h b/java/src/jni/h5pACPLImp.h index 8d9bf7d..15fcf33 100644 --- a/java/src/jni/h5pACPLImp.h +++ b/java/src/jni/h5pACPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PACPL -#define _Included_hdf_hdf5lib_H5_H5PACPL +#ifndef Included_hdf_hdf5lib_H5_H5PACPL +#define Included_hdf_hdf5lib_H5_H5PACPL #include @@ -23,4 +23,4 @@ extern "C" { } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PACPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PACPL */ diff --git a/java/src/jni/h5pDAPLImp.h b/java/src/jni/h5pDAPLImp.h index 353f652..bf11fef 100644 --- a/java/src/jni/h5pDAPLImp.h +++ b/java/src/jni/h5pDAPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PDAPL -#define _Included_hdf_hdf5lib_H5_H5PDAPL +#ifndef Included_hdf_hdf5lib_H5_H5PDAPL +#define Included_hdf_hdf5lib_H5_H5PDAPL #include @@ -93,4 +93,4 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap(JNIEnv } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PDAPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PDAPL */ diff --git a/java/src/jni/h5pDCPLImp.h b/java/src/jni/h5pDCPLImp.h index 302019f..46d1cc3 100644 --- a/java/src/jni/h5pDCPLImp.h +++ b/java/src/jni/h5pDCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PDCPL -#define _Included_hdf_hdf5lib_H5_H5PDCPL +#ifndef Included_hdf_hdf5lib_H5_H5PDCPL +#define Included_hdf_hdf5lib_H5_H5PDCPL #include @@ -320,4 +320,4 @@ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix(JNIEnv *, } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PDCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PDCPL */ diff --git a/java/src/jni/h5pDXPLImp.h b/java/src/jni/h5pDXPLImp.h index 250c3f8..21c40c4 100644 --- a/java/src/jni/h5pDXPLImp.h +++ b/java/src/jni/h5pDXPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PDXPL -#define _Included_hdf_hdf5lib_H5_H5PDXPL +#ifndef Included_hdf_hdf5lib_H5_H5PDXPL +#define Included_hdf_hdf5lib_H5_H5PDXPL #include @@ -181,4 +181,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios(JNIEnv *, jclas } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PDXPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PDXPL */ diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h index 4bb48e2..3c5988f 100644 --- a/java/src/jni/h5pFAPLImp.h +++ b/java/src/jni/h5pFAPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PFAPL -#define _Included_hdf_hdf5lib_H5_H5PFAPL +#ifndef Included_hdf_hdf5lib_H5_H5PFAPL +#define Included_hdf_hdf5lib_H5_H5PFAPL #include @@ -476,4 +476,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds(JNIEnv *, jcla } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PFAPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PFAPL */ diff --git a/java/src/jni/h5pFCPLImp.h b/java/src/jni/h5pFCPLImp.h index 0fe3944..94411d6 100644 --- a/java/src/jni/h5pFCPLImp.h +++ b/java/src/jni/h5pFCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PFCPL -#define _Included_hdf_hdf5lib_H5_H5PFCPL +#ifndef Included_hdf_hdf5lib_H5_H5PFCPL +#define Included_hdf_hdf5lib_H5_H5PFCPL #include @@ -170,4 +170,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change(J } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PFCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PFCPL */ diff --git a/java/src/jni/h5pGAPLImp.h b/java/src/jni/h5pGAPLImp.h index 478402a..9091ff8 100644 --- a/java/src/jni/h5pGAPLImp.h +++ b/java/src/jni/h5pGAPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PGAPL -#define _Included_hdf_hdf5lib_H5_H5PGAPL +#ifndef Included_hdf_hdf5lib_H5_H5PGAPL +#define Included_hdf_hdf5lib_H5_H5PGAPL #include @@ -23,4 +23,4 @@ extern "C" { } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PGAPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PGAPL */ diff --git a/java/src/jni/h5pGCPLImp.h b/java/src/jni/h5pGCPLImp.h index 6a40908..5090c3a 100644 --- a/java/src/jni/h5pGCPLImp.h +++ b/java/src/jni/h5pGCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PGCPL -#define _Included_hdf_hdf5lib_H5_H5PGCPL +#ifndef Included_hdf_hdf5lib_H5_H5PGCPL +#define Included_hdf_hdf5lib_H5_H5PGCPL #include @@ -79,4 +79,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change(JNIEnv *, } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PGCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PGCPL */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index b80ce46..189e9d7 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -12,8 +12,8 @@ /* Header for class hdf_hdf5lib_H5_H5_H5P */ -#ifndef _Included_hdf_hdf5lib_H5_H5P -#define _Included_hdf_hdf5lib_H5_H5P +#ifndef Included_hdf_hdf5lib_H5_H5P +#define Included_hdf_hdf5lib_H5_H5P #include @@ -210,4 +210,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Pclose_1class(JNIEnv *, jclass, j } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5P */ +#endif /* Included_hdf_hdf5lib_H5_H5P */ diff --git a/java/src/jni/h5pLAPLImp.h b/java/src/jni/h5pLAPLImp.h index 46adc0c..8ddc8d2 100644 --- a/java/src/jni/h5pLAPLImp.h +++ b/java/src/jni/h5pLAPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PLAPL -#define _Included_hdf_hdf5lib_H5_H5PLAPL +#ifndef Included_hdf_hdf5lib_H5_H5PLAPL +#define Included_hdf_hdf5lib_H5_H5PLAPL #include @@ -87,4 +87,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags(JNIEnv *, j } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PLAPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PLAPL */ diff --git a/java/src/jni/h5pLCPLImp.h b/java/src/jni/h5pLCPLImp.h index 7601adb..4cdf6cd 100644 --- a/java/src/jni/h5pLCPLImp.h +++ b/java/src/jni/h5pLCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PLCPL -#define _Included_hdf_hdf5lib_H5_H5PLCPL +#ifndef Included_hdf_hdf5lib_H5_H5PLCPL +#define Included_hdf_hdf5lib_H5_H5PLCPL #include @@ -23,4 +23,4 @@ extern "C" { } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PLCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PLCPL */ diff --git a/java/src/jni/h5pOCPLImp.h b/java/src/jni/h5pOCPLImp.h index c16f1be..94d397b 100644 --- a/java/src/jni/h5pOCPLImp.h +++ b/java/src/jni/h5pOCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5POCPL -#define _Included_hdf_hdf5lib_H5_H5POCPL +#ifndef Included_hdf_hdf5lib_H5_H5POCPL +#define Included_hdf_hdf5lib_H5_H5POCPL #include @@ -80,4 +80,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order(JNIEnv } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5POCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5POCPL */ diff --git a/java/src/jni/h5pOCpyPLImp.h b/java/src/jni/h5pOCpyPLImp.h index d8682cb..50ee972 100644 --- a/java/src/jni/h5pOCpyPLImp.h +++ b/java/src/jni/h5pOCpyPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5POCpyPL -#define _Included_hdf_hdf5lib_H5_H5POCpyPL +#ifndef Included_hdf_hdf5lib_H5_H5POCpyPL +#define Included_hdf_hdf5lib_H5_H5POCpyPL #include @@ -53,4 +53,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1copy_1object(JNIEnv *, jclass } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5POCpyPL */ +#endif /* Included_hdf_hdf5lib_H5_H5POCpyPL */ diff --git a/java/src/jni/h5pStrCPLImp.h b/java/src/jni/h5pStrCPLImp.h index 8a56494..c0a7ec2 100644 --- a/java/src/jni/h5pStrCPLImp.h +++ b/java/src/jni/h5pStrCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PStrCPL -#define _Included_hdf_hdf5lib_H5_H5PStrCPL +#ifndef Included_hdf_hdf5lib_H5_H5PStrCPL +#define Included_hdf_hdf5lib_H5_H5PStrCPL #include @@ -37,4 +37,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding(JNIEnv *, jcla } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PStrCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PStrCPL */ diff --git a/java/src/jni/h5plImp.h b/java/src/jni/h5plImp.h index b809efa..410a34f 100644 --- a/java/src/jni/h5plImp.h +++ b/java/src/jni/h5plImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5PL */ -#ifndef _Included_hdf_hdf5lib_H5_H5PL -#define _Included_hdf_hdf5lib_H5_H5PL +#ifndef Included_hdf_hdf5lib_H5_H5PL +#define Included_hdf_hdf5lib_H5_H5PL #ifdef __cplusplus extern "C" { @@ -87,4 +87,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5PLsize(JNIEnv *, jclass); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PL */ +#endif /* Included_hdf_hdf5lib_H5_H5PL */ diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h index 582b837..cdfdd8e 100644 --- a/java/src/jni/h5rImp.h +++ b/java/src/jni/h5rImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5R */ -#ifndef _Included_hdf_hdf5lib_H5_H5R -#define _Included_hdf_hdf5lib_H5_H5R +#ifndef Included_hdf_hdf5lib_H5_H5R +#define Included_hdf_hdf5lib_H5_H5R #ifdef __cplusplus extern "C" { @@ -174,4 +174,4 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *, jclass, jlong } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5R */ +#endif /* Included_hdf_hdf5lib_H5_H5R */ diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h index 1ceaf3f..a758d5a 100644 --- a/java/src/jni/h5sImp.h +++ b/java/src/jni/h5sImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5S */ -#ifndef _Included_hdf_hdf5lib_H5_H5S -#define _Included_hdf_hdf5lib_H5_H5S +#ifndef Included_hdf_hdf5lib_H5_H5S +#define Included_hdf_hdf5lib_H5_H5S #ifdef __cplusplus extern "C" { @@ -321,4 +321,4 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Scombine_1select(JNIEnv *, jclass, } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5S */ +#endif /* Included_hdf_hdf5lib_H5_H5S */ diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h index 3faeb00..e671456 100644 --- a/java/src/jni/h5tImp.h +++ b/java/src/jni/h5tImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5T */ -#ifndef _Included_hdf_hdf5lib_H5_H5T -#define _Included_hdf_hdf5lib_H5_H5T +#ifndef Included_hdf_hdf5lib_H5_H5T +#define Included_hdf_hdf5lib_H5_H5T #ifdef __cplusplus extern "C" { @@ -505,4 +505,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Trefresh(JNIEnv *, jclass, jlong); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5T */ +#endif /* Included_hdf_hdf5lib_H5_H5T */ diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h index bf467af..a17807f 100644 --- a/java/src/jni/h5vlImp.h +++ b/java/src/jni/h5vlImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5VL */ -#ifndef _Included_hdf_hdf5lib_H5_H5VL -#define _Included_hdf_hdf5lib_H5_H5VL +#ifndef Included_hdf_hdf5lib_H5_H5VL +#define Included_hdf_hdf5lib_H5_H5VL #ifdef __cplusplus extern "C" { @@ -97,4 +97,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5VLunregister_1connector(JNIEnv *, j } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5VL */ +#endif /* Included_hdf_hdf5lib_H5_H5VL */ diff --git a/java/src/jni/h5zImp.h b/java/src/jni/h5zImp.h index 4e8982e..3092ae6 100644 --- a/java/src/jni/h5zImp.h +++ b/java/src/jni/h5zImp.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_H5_H5Z */ -#ifndef _Included_hdf_hdf5lib_H5_H5Z -#define _Included_hdf_hdf5lib_H5_H5Z +#ifndef Included_hdf_hdf5lib_H5_H5Z +#define Included_hdf_hdf5lib_H5_H5Z #ifdef __cplusplus extern "C" { @@ -46,4 +46,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zget_1filter_1info(JNIEnv *, jclass } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5Z */ +#endif /* Included_hdf_hdf5lib_H5_H5Z */ diff --git a/java/src/jni/nativeData.h b/java/src/jni/nativeData.h index 0150c75..9bf313f 100644 --- a/java/src/jni/nativeData.h +++ b/java/src/jni/nativeData.h @@ -13,8 +13,8 @@ #include /* Header for class hdf_hdf5lib_HDFNativeData */ -#ifndef _Included_hdf_hdf5lib_HDFNativeData -#define _Included_hdf_hdf5lib_HDFNativeData +#ifndef Included_hdf_hdf5lib_HDFNativeData +#define Included_hdf_hdf5lib_HDFNativeData #ifdef __cplusplus extern "C" { @@ -97,4 +97,4 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToByte__B(JNIEnv } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_HDFNativeData */ +#endif /* Included_hdf_hdf5lib_HDFNativeData */ diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 64faa29..c5efb6f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -697,6 +697,14 @@ Bug Fixes since HDF5-1.12.0 release =================================== Library ------- + - Remove underscores on header file guards + + Header file guards used a variety of underscores at the beginning the define. + + Removed all leading (some trailing) underscores from header file guards. + + (ADB - 2021/03/03, #361) + - Fixed issue with MPI communicator and info object not being copied into new FAPL retrieved from H5F_get_access_plist diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 12e5bb2..283989d 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -458,4 +458,4 @@ H5_DLL hbool_t H5AC_get_serialization_in_progress(H5F_t *f); H5_DLL hbool_t H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring); #endif /* NDEBUG */ /* end debugging functions */ -#endif /* !_H5ACprivate_H */ +#endif /* H5ACprivate_H */ diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index ac28ee6..0a79628 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, May 15, 2003 + * Programmer: Quincey Koziol + * Thursday, May 15, 2003 * - * Purpose: This file contains declarations which are visible only within - * the H5B package. Source files outside the H5B package should - * include H5Bprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5B package. Source files outside the H5B package should + * include H5Bprivate.h instead. */ #if !(defined H5B_FRIEND || defined H5B_MODULE) #error "Do not include this file outside the H5B package!" @@ -30,7 +30,7 @@ #include "H5Bprivate.h" /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5FLprivate.h" /* Free Lists */ /**************************/ @@ -49,20 +49,20 @@ typedef struct H5B_t { H5AC_info_t cache_info; /* Information for H5AC cache functions */ /* _must_ be first field in structure */ - H5UC_t * rc_shared; /*ref-counted shared info */ - unsigned level; /*node level */ - unsigned nchildren; /*number of child pointers */ - haddr_t left; /*address of left sibling */ - haddr_t right; /*address of right sibling */ + H5UC_t * rc_shared; /*ref-counted shared info */ + unsigned level; /*node level */ + unsigned nchildren; /*number of child pointers */ + haddr_t left; /*address of left sibling */ + haddr_t right; /*address of right sibling */ uint8_t *native; /*array of keys in native format */ - haddr_t *child; /*2k child pointers */ + haddr_t *child; /*2k child pointers */ } H5B_t; /* Callback info for loading a B-tree node into the cache */ typedef struct H5B_cache_ud_t { H5F_t * f; /* File that B-tree node is within */ - const struct H5B_class_t *type; /* Type of tree */ - H5UC_t * rc_shared; /* Ref-counted shared info */ + const struct H5B_class_t *type; /* Type of tree */ + H5UC_t * rc_shared; /* Ref-counted shared info */ } H5B_cache_ud_t; /*****************************/ @@ -86,4 +86,4 @@ H5_DLL herr_t H5B__node_dest(H5B_t *bt); herr_t H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata); #endif -#endif /*_H5Bpkg_H*/ +#endif /*H5Bpkg_H*/ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 623e52f..fb5c3ea 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -2321,4 +2321,4 @@ H5_DLL herr_t H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_c H5_DLL herr_t H5C_validate_index_list(H5C_t *cache_ptr); #endif /* NDEBUG */ -#endif /* !_H5Cprivate_H */ +#endif /* H5Cprivate_H */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index de04ac9..61b1a87 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -739,4 +739,4 @@ H5_DLL herr_t H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type); H5_DLL herr_t H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused); #endif /* H5D_TESTING */ -#endif /*_H5Dpkg_H*/ +#endif /*H5Dpkg_H*/ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 1deef04..cf3167f 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -32,8 +32,8 @@ typedef enum H5E_type_t { H5E_MAJOR, H5E_MINOR } H5E_type_t; /* Information about an error; element of error stack */ typedef struct H5E_error2_t { hid_t cls_id; /*class ID */ - hid_t maj_num; /*major error ID */ - hid_t min_num; /*minor error number */ + hid_t maj_num; /*major error ID */ + hid_t min_num; /*minor error number */ unsigned line; /*line in file where error occurs */ const char *func_name; /*function in which error occurred */ const char *file_name; /*file in which error occurred */ @@ -61,12 +61,12 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; * trying something that's likely or expected to fail. The code to try can * be nested between calls to H5Eget_auto() and H5Eset_auto(), but it's * easier just to use this macro like: - * H5E_BEGIN_TRY { - * ...stuff here that's likely to fail... + * H5E_BEGIN_TRY { + * ...stuff here that's likely to fail... * } H5E_END_TRY; * * Warning: don't break, return, or longjmp() from the body of the loop or - * the error reporting won't be properly restored! + * the error reporting won't be properly restored! * * These two macros still use the old API functions for backward compatibility * purpose. diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index e468554..68440d0 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -2002,7 +2002,7 @@ open_members(H5FD_multi_t *file) } H5_GCC_DIAG_ON("format-nonliteral") -#ifdef _H5private_H +#ifdef H5private_H /* * This is not related to the functionality of the driver code. * It is added here to trigger warning if HDF5 private definitions are included diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 2d5f5fa..10d8069 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -159,4 +159,4 @@ H5_DLL int H5FD_mpi_get_size(const H5FD_t *file); H5_DLL MPI_Comm H5FD_mpi_get_comm(const H5FD_t *_file); #endif /* H5_HAVE_PARALLEL */ -#endif /* !_H5FDprivate_H */ +#endif /* H5FDprivate_H */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index efc1802..b395127 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -1201,7 +1201,7 @@ H5FD_stdio_unlock(H5FD_t *_file) return 0; } /* end H5FD_stdio_unlock() */ -#ifdef _H5private_H +#ifdef H5private_H /* * This is not related to the functionality of the driver code. * It is added here to trigger warning if HDF5 private definitions are included diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index bebbfe6..86b6e1b 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -30,12 +30,12 @@ #include "H5Gprivate.h" /* Other private headers needed by this file */ -#include "H5B2private.h" /* v2 B-trees */ +#include "H5B2private.h" /* v2 B-trees */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5HFprivate.h" /* Fractal heaps */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip lists */ +#include "H5HFprivate.h" /* Fractal heaps */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ @@ -66,10 +66,10 @@ * symbol table entry. */ typedef enum H5G_cache_type_t { - H5G_CACHED_ERROR = -1, /*force enum to be signed */ + H5G_CACHED_ERROR = -1, /*force enum to be signed */ H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */ H5G_CACHED_STAB = 1, /*symbol table, `stab' */ - H5G_CACHED_SLINK = 2, /*symbolic link */ + H5G_CACHED_SLINK = 2, /*symbolic link */ H5G_NCACHED /*THIS MUST BE LAST */ } H5G_cache_type_t; @@ -88,7 +88,7 @@ typedef union H5G_cache_t { } stab; struct { - size_t lval_offset; /*link value offset */ + size_t lval_offset; /*link value offset */ } slink; } H5G_cache_t; @@ -157,7 +157,7 @@ typedef struct { typedef struct H5G_bt_common_t { /* downward */ const char *name; /*points to temporary memory */ - H5HL_t * heap; /*symbol table heap */ + H5HL_t * heap; /*symbol table heap */ } H5G_bt_common_t; /* @@ -204,10 +204,10 @@ typedef struct H5G_bt_lkp_t { */ typedef struct H5G_bt_it_it_t { /* downward */ - H5HL_t * heap; /*symbol table heap */ - hsize_t skip; /*initial entries to skip */ - H5G_lib_iterate_t op; /*iteration operator */ - void * op_data; /*user-defined operator data */ + H5HL_t * heap; /*symbol table heap */ + hsize_t skip; /*initial entries to skip */ + H5G_lib_iterate_t op; /*iteration operator */ + void * op_data; /*user-defined operator data */ /* upward */ hsize_t *final_ent; /*final entry looked at */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index b9f83c4..409d790 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -29,9 +29,9 @@ #include "H5Gpublic.h" /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5Bprivate.h" /* B-trees */ -#include "H5Fprivate.h" /* File access */ +#include "H5private.h" /* Generic Functions */ +#include "H5Bprivate.h" /* B-trees */ +#include "H5Fprivate.h" /* File access */ #include "H5RSprivate.h" /* Reference-counted strings */ /* @@ -42,7 +42,7 @@ ((sizeof_size) + /*offset of name into heap */ \ (sizeof_addr) + /*address of object header */ \ 4 + /*entry type */ \ - 4 + /*reserved */ \ + 4 + /*reserved */ \ H5G_SIZEOF_SCRATCH) /*scratch pad space */ #define H5G_SIZEOF_ENTRY_FILE(F) H5G_SIZEOF_ENTRY(H5F_SIZEOF_ADDR(F), H5F_SIZEOF_SIZE(F)) diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 4cec8c6..0a7215b 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -116,4 +116,4 @@ H5_DLL H5I_id_info_t *H5I__find_id(hid_t id); H5_DLL ssize_t H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached); #endif /* H5I_TESTING */ -#endif /*_H5Ipkg_H*/ +#endif /*H5Ipkg_H*/ diff --git a/src/H5Mpkg.h b/src/H5Mpkg.h index b31beeb..be6749b 100644 --- a/src/H5Mpkg.h +++ b/src/H5Mpkg.h @@ -44,4 +44,4 @@ /* Package Private Prototypes */ /******************************/ -#endif /*_H5Dpkg_H*/ +#endif /*H5Dpkg_H*/ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index e152193..e0197bf 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -98,4 +98,4 @@ H5_DLL herr_t H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2], unsig unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]); H5_DLL herr_t H5PB_print_stats(const H5PB_t *page_buf); -#endif /* !_H5PBprivate_H */ +#endif /* H5PBprivate_H */ diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index 9ab2b17..c3555bc 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -100,7 +100,9 @@ H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask); * A plugin bit set to 1 (one) indicates that that the dynamic plugin type is * enabled.\n * If the value of \p plugin_control_mask is negative, all dynamic plugin - * types are enabled.\n If the value of \p plugin_control_mask is 0 (zero), all dynamic plugins are disabled. + * types are enabled.\n + * If the value of \p plugin_control_mask is 0 (zero), all dynamic plugins + * are disabled. * \return \herr_t * * \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugins diff --git a/src/H5SMprivate.h b/src/H5SMprivate.h index f425074..efe9355 100644 --- a/src/H5SMprivate.h +++ b/src/H5SMprivate.h @@ -66,4 +66,4 @@ H5_DLL herr_t H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int i H5_DLL herr_t H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidth, haddr_t table_addr); -#endif /*_H5SMprivate_H*/ +#endif /*H5SMprivate_H*/ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 33d1ede..ae6efcb 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -420,4 +420,4 @@ H5_DLL herr_t H5S__get_diminfo_status_test(hid_t space_id, H5S_diminfo_valid_t * H5_DLL htri_t H5S__internal_consistency_test(hid_t space_id); #endif /* H5S_TESTING */ -#endif /*_H5Spkg_H*/ +#endif /*H5Spkg_H*/ diff --git a/test/cache_common.h b/test/cache_common.h index bc9f33b..126a8b3 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -17,8 +17,8 @@ * This file contains common #defines, type definitions, and * externs for tests of the cache implemented in H5C.c */ -#ifndef _CACHE_COMMON_H -#define _CACHE_COMMON_H +#ifndef CACHE_COMMON_H +#define CACHE_COMMON_H #define H5C_FRIEND /*suppress error about including H5Cpkg */ #define H5F_FRIEND /*suppress error about including H5Fpkg */ @@ -694,4 +694,4 @@ H5TEST_DLL void dump_LRU(H5F_t * file_ptr); } #endif -#endif /* _CACHE_COMMON_H */ +#endif /* CACHE_COMMON_H */ diff --git a/test/external_common.h b/test/external_common.h index d338a70..6215be9 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -17,8 +17,8 @@ * * Purpose: Private function for external.c and external_env.c */ -#ifndef _EXTERNAL_COMMON_H -#define _EXTERNAL_COMMON_H +#ifndef EXTERNAL_COMMON_H +#define EXTERNAL_COMMON_H /* Include test header files */ #include "h5test.h" @@ -41,4 +41,4 @@ H5TEST_DLL herr_t reset_raw_data_files(hbool_t is_env); } #endif -#endif /* _EXTERNAL_COMMON_H */ +#endif /* EXTERNAL_COMMON_H */ diff --git a/test/external_fname.h b/test/external_fname.h index 2545547..c2cd059 100644 --- a/test/external_fname.h +++ b/test/external_fname.h @@ -17,8 +17,8 @@ * * Purpose: Private declaration for external.c and external_env.c */ -#ifndef _EXTERNAL_FNAME_H -#define _EXTERNAL_FNAME_H +#ifndef EXTERNAL_FNAME_H +#define EXTERNAL_FNAME_H /* Include test header files */ #include "h5test.h" @@ -26,4 +26,4 @@ static const char *EXT_FNAME[] = {"extern_1", "extern_2", "extern_3", "extern_4", "extern_dir/file_1", "extern_5", NULL}; -#endif /* _EXTERNAL_FNAME_H */ +#endif /* EXTERNAL_FNAME_H */ diff --git a/test/null_vol_connector.h b/test/null_vol_connector.h index 0e48e75..8fe9abe 100644 --- a/test/null_vol_connector.h +++ b/test/null_vol_connector.h @@ -15,10 +15,10 @@ * (registration, etc.). */ -#ifndef _null_vol_connector_H -#define _null_vol_connector_H +#ifndef NULL_VOL_CONNECTOR_H +#define NULL_VOL_CONNECTOR_H #define NULL_VOL_CONNECTOR_VALUE ((H5VL_class_value_t)160) #define NULL_VOL_CONNECTOR_NAME "null_vol_connector" -#endif /* _null_vol_connector_H */ +#endif /* NULL_VOL_CONNECTOR_H */ diff --git a/test/swmr_common.h b/test/swmr_common.h index e342580..d0d829d 100644 --- a/test/swmr_common.h +++ b/test/swmr_common.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _SWMR_COMMON_H -#define _SWMR_COMMON_H +#ifndef SWMR_COMMON_H +#define SWMR_COMMON_H /***********/ /* Headers */ @@ -75,4 +75,4 @@ H5TEST_DLL int print_metadata_retries_info(hid_t fid); } #endif -#endif /* _SWMR_COMMON_H */ +#endif /* SWMR_COMMON_H */ diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 9fcf821..7b41538 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DIFF_H__ -#define H5DIFF_H__ +#ifndef H5DIFF_H +#define H5DIFF_H #include "hdf5.h" #include "h5tools.h" @@ -160,4 +160,4 @@ int print_objname(diff_opt_t *opts, hsize_t nfound); void do_print_objname(const char *OBJ, const char *path1, const char *path2, diff_opt_t *opts); void do_print_attrname(const char *attr, const char *path1, const char *path2); -#endif /* H5DIFF_H__ */ +#endif /* H5DIFF_H */ diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index aa8a989..a972fd9 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -17,8 +17,8 @@ * * Purpose: Support functions for the various tools. */ -#ifndef H5TOOLS_H__ -#define H5TOOLS_H__ +#ifndef H5TOOLS_H +#define H5TOOLS_H #include "hdf5.h" #include "h5tools_error.h" @@ -708,4 +708,4 @@ H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_for } #endif -#endif /* H5TOOLS_H__ */ +#endif /* H5TOOLS_H */ diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h index d49187d..901b38e 100644 --- a/tools/lib/h5tools_dump.h +++ b/tools/lib/h5tools_dump.h @@ -14,8 +14,8 @@ /* * Purpose: Support h5dump functions for the various tools. */ -#ifndef H5TOOLS_DUMP_H__ -#define H5TOOLS_DUMP_H__ +#ifndef H5TOOLS_DUMP_H +#define H5TOOLS_DUMP_H #include "h5tools_utils.h" @@ -94,4 +94,4 @@ H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer /*in,out*/, hid } #endif -#endif /* H5TOOLS_DUMP_H__ */ +#endif /* H5TOOLS_DUMP_H */ diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index b8e5339..8fd33bb 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -14,8 +14,8 @@ /* * Header file for error values, etc. */ -#ifndef H5TOOLS_ERROR_H_ -#define H5TOOLS_ERROR_H_ +#ifndef H5TOOLS_ERROR_H +#define H5TOOLS_ERROR_H #include "H5Epublic.h" #include "H5Eprivate.h" /* Error handling */ @@ -250,4 +250,4 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; H5_LEAVE(ret_val) \ } while (0) -#endif /* H5TOOLS_ERROR_H_ */ +#endif /* H5TOOLS_ERROR_H */ diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h index b4819ef..9feaeb1 100644 --- a/tools/lib/h5tools_ref.h +++ b/tools/lib/h5tools_ref.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5TOOLS_REF_H__ -#define H5TOOLS_REF_H__ +#ifndef H5TOOLS_REF_H +#define H5TOOLS_REF_H #include "hdf5.h" diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index 9853498..c207a83 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -15,8 +15,8 @@ * Programmer: Bill Wendling * Monday, 19. February 2001 */ -#ifndef H5TOOLS_STR_H__ -#define H5TOOLS_STR_H__ +#ifndef H5TOOLS_STR_H +#define H5TOOLS_STR_H typedef struct h5tools_str_t { char * s; /*allocate string */ @@ -46,4 +46,4 @@ H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t * hid_t type, void *vp, h5tools_context_t *ctx); H5TOOLS_DLL char *h5tools_str_replace(const char *string, const char *substr, const char *replacement); -#endif /* H5TOOLS_STR_H__ */ +#endif /* H5TOOLS_STR_H */ diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 316b007..307ce20 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -17,8 +17,8 @@ * * Purpose: Support functions for the various tools. */ -#ifndef H5TOOLS_UTILS_H__ -#define H5TOOLS_UTILS_H__ +#ifndef H5TOOLS_UTILS_H +#define H5TOOLS_UTILS_H #include "hdf5.h" @@ -191,4 +191,4 @@ H5TOOLS_DLL herr_t h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int deli } #endif -#endif /* H5TOOLS_UTILS_H__ */ +#endif /* H5TOOLS_UTILS_H */ diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index c45b07a..c7b9db7 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5TRAV_H__ -#define H5TRAV_H__ +#ifndef H5TRAV_H +#define H5TRAV_H #include "hdf5.h" @@ -189,4 +189,4 @@ H5TOOLS_DLL void trav_table_free(trav_table_t *table); H5TOOLS_DLL void trav_table_addflags(unsigned *flags, char *objname, h5trav_type_t type, trav_table_t *table); -#endif /* H5TRAV_H__ */ +#endif /* H5TRAV_H */ diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 96ea05e..0269b93 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef IO_TIMER__ -#define IO_TIMER__ +#ifndef IO_TIMER +#define IO_TIMER #include "hdf5.h" @@ -88,4 +88,4 @@ H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t); } #endif /* __cplusplus */ -#endif /* IO_TIMER__ */ +#endif /* IO_TIMER */ diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h index 8e884dd..7dce495 100644 --- a/tools/lib/ph5diff.h +++ b/tools/lib/ph5diff.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _PH5DIFF_H__ -#define _PH5DIFF_H__ +#ifndef PH5DIFF_H +#define PH5DIFF_H /* Send from manager to workers */ #define MPI_TAG_ARGS 1 @@ -40,4 +40,4 @@ struct diffs_found { int not_cmp; }; -#endif /* _PH5DIFF_H__ */ +#endif /* PH5DIFF_H */ diff --git a/tools/src/h5diff/h5diff_common.h b/tools/src/h5diff/h5diff_common.h index 6594478..83f4255 100644 --- a/tools/src/h5diff/h5diff_common.h +++ b/tools/src/h5diff/h5diff_common.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DIFFCOMMON_H__ -#define H5DIFFCOMMON_H__ +#ifndef H5DIFFCOMMON_H +#define H5DIFFCOMMON_H #include "h5tools.h" /* Name of tool */ @@ -32,4 +32,4 @@ void print_info(diff_opt_t *opts); } #endif -#endif /* H5DIFFCOMMON_H__ */ +#endif /* H5DIFFCOMMON_H */ diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h index 60422ad..a53d1ba 100644 --- a/tools/src/h5dump/h5dump.h +++ b/tools/src/h5dump/h5dump.h @@ -10,8 +10,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_H__ -#define H5DUMP_H__ +#ifndef H5DUMP_H +#define H5DUMP_H #include "hdf5.h" #include "H5private.h" @@ -112,4 +112,4 @@ const dump_functions *dump_function_table; } #endif -#endif /* !H5DUMP_H__ */ +#endif /* H5DUMP_H */ diff --git a/tools/src/h5dump/h5dump_ddl.h b/tools/src/h5dump/h5dump_ddl.h index 6d65796..8487270 100644 --- a/tools/src/h5dump/h5dump_ddl.h +++ b/tools/src/h5dump/h5dump_ddl.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_DDL_H__ -#define H5DUMP_DDL_H__ +#ifndef H5DUMP_DDL_H +#define H5DUMP_DDL_H #ifdef __cplusplus extern "C" { @@ -50,4 +50,4 @@ void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, in } #endif -#endif /* !H5DUMP_DDL_H__ */ +#endif /* H5DUMP_DDL_H */ diff --git a/tools/src/h5dump/h5dump_defines.h b/tools/src/h5dump/h5dump_defines.h index 0fb8def..21a31dd 100644 --- a/tools/src/h5dump/h5dump_defines.h +++ b/tools/src/h5dump/h5dump_defines.h @@ -10,8 +10,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_DEFINES_H__ -#define H5DUMP_DEFINES_H__ +#ifndef H5DUMP_DEFINES_H +#define H5DUMP_DEFINES_H #define H5DUMP_MAX_RANK H5S_MAX_RANK @@ -50,4 +50,4 @@ #define H5_SZIP_MSB_OPTION_MASK 16 #define H5_SZIP_RAW_OPTION_MASK 128 -#endif /* !H5DUMP_DEFINES_H__ */ +#endif /* H5DUMP_DEFINES_H */ diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h index 8fbb5af..308f602 100644 --- a/tools/src/h5dump/h5dump_extern.h +++ b/tools/src/h5dump/h5dump_extern.h @@ -10,8 +10,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_EXTERN_H__ -#define H5DUMP_EXTERN_H__ +#ifndef H5DUMP_EXTERN_H +#define H5DUMP_EXTERN_H #include "hdf5.h" #include "H5private.h" @@ -109,4 +109,4 @@ ssize_t table_list_visited(unsigned long file_no); } #endif -#endif /* !H5DUMP_EXTERN_H__ */ +#endif /* H5DUMP_EXTERN_H */ diff --git a/tools/src/h5dump/h5dump_xml.h b/tools/src/h5dump/h5dump_xml.h index 9ff22ed..d69f6d5 100644 --- a/tools/src/h5dump/h5dump_xml.h +++ b/tools/src/h5dump/h5dump_xml.h @@ -10,8 +10,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_XML_H__ -#define H5DUMP_XML_H__ +#ifndef H5DUMP_XML_H +#define H5DUMP_XML_H extern const char *xmlnsprefix; @@ -34,4 +34,4 @@ void xml_dump_data(hid_t, int, struct subset_t *, int); } #endif -#endif /* !H5DUMP_XML_H__ */ +#endif /* H5DUMP_XML_H */ diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h index 2192f4a..efd40e1 100644 --- a/tools/src/h5import/h5import.h +++ b/tools/src/h5import/h5import.h @@ -17,8 +17,8 @@ * */ -#ifndef H5IMPORT_H__ -#define H5IMPORT_H__ +#ifndef H5IMPORT_H +#define H5IMPORT_H /* * state table tokens @@ -189,4 +189,4 @@ void help(char *); hid_t createOutputDataType(struct Input *in); hid_t createInputDataType(struct Input *in); -#endif /* H5IMPORT_H__ */ +#endif /* H5IMPORT_H */ diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index 7f4e8f2..0838c21 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5REPACK_H__ -#define H5REPACK_H__ +#ifndef H5REPACK_H +#define H5REPACK_H #include "H5private.h" #include "hdf5.h" @@ -224,4 +224,4 @@ obj_list_t *parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, obj_list_t *parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about object */ pack_opt_t *options); -#endif /* H5REPACK_H__ */ +#endif /* H5REPACK_H */ diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h index 027b553..24621da 100644 --- a/tools/test/perform/pio_perf.h +++ b/tools/test/perform/pio_perf.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef PIO_PERF_H__ -#define PIO_PERF_H__ +#ifndef PIO_PERF_H +#define PIO_PERF_H #ifndef STANDALONE #include "io_timer.h" @@ -97,4 +97,4 @@ extern results do_pio(parameters param); } #endif /* __cplusplus */ -#endif /* PIO_PERF_H__ */ +#endif /* PIO_PERF_H */ diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 721addf..09454a9 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef PIO_STANDALONE_H__ -#define PIO_PERF_H__ +#ifndef PIO_STANDALONE_H +#define PIO_STANDALONE_H /* Header file for building h5perf by standalone mode. * Created: Christian Chilan, 2005/5/18. diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h index acdb801..6242782 100644 --- a/tools/test/perform/sio_perf.h +++ b/tools/test/perform/sio_perf.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef SIO_PERF_H__ -#define SIO_PERF_H__ +#ifndef SIO_PERF_H +#define SIO_PERF_H #ifndef STANDALONE #include "io_timer.h" @@ -101,4 +101,4 @@ extern void do_sio(parameters param, results *res); } #endif /* __cplusplus */ -#endif /* PIO_PERF_H__ */ +#endif /* SIO_PERF_H */ diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index d0e5452..a85f93e 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef SIO_STANDALONE_H__ -#define SIO_PERF_H__ +#ifndef SIO_STANDALONE_H +#define SIO_STANDALONE_H /* Header file for building h5perf by standalone mode. * Created: Christian Chilan, 2005/5/18. -- cgit v0.12 From fb210fc4fd70ce68b95a08f91eee2580552b6d21 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 4 Mar 2021 11:04:41 -0500 Subject: Use do-while trick to force H5Epush_ret() to require trailing semi (#380) * Use do-while trick to force H5Epush_ret() to require trailing semi Fixed ensuing compiler errors. * Commit format changes from running clang-format with clang version 10.0.1. * Use do-while trick to force H5Epush_ret() to require trailing semi Fixed ensuing compiler errors. Updated RELEASE.txt. This change was made to allow clang-format to correctly format the code. Co-authored-by: Larry Knox --- release_docs/RELEASE.txt | 10 +++ src/H5Epublic.h | 4 +- src/H5FDmulti.c | 214 +++++++++++++++++++++++++---------------------- src/H5FDstdio.c | 141 ++++++++++++++++--------------- 4 files changed, 195 insertions(+), 174 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c5efb6f..95ff9c5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -384,6 +384,16 @@ New Features Library: -------- + - H5Epush_ret() now requires a trailing semi-colon + + H5Epush_ret() is a function-like macro that has been changed to + contain a `do {} while(0)` loop. Consequently, a trailing semi-colon + is now required to end the `while` statement. Previously, a trailing + semi would work, but was not mandatory. This change was made to allow + clang-format to correctly format the source code. + + (SAM - 2021/03-03) + - Improved performance of H5Sget_select_elem_pointlist Modified library to cache the point after the last block of points diff --git a/src/H5Epublic.h b/src/H5Epublic.h index cf3167f..a2554d5 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -124,10 +124,10 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; /* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in */ /* And return after pushing error onto stack */ #define H5Epush_ret(func, cls, maj, min, str, ret) \ - { \ + do { \ H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, cls, maj, min, str); \ return (ret); \ - } + } while (0) /* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in * And goto a label after pushing error onto stack. diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 68440d0..a024ace 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -436,12 +436,12 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f /* Check arguments and supply default values */ if (H5I_GENPROP_LST != H5Iget_type(fapl_id) || TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "not an access list", -1) if (!memb_map) - { - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) - _memb_map[mt] = H5FD_MEM_DEFAULT; - memb_map = _memb_map; - } + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "not an access list", -1); + if (!memb_map) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) + _memb_map[mt] = H5FD_MEM_DEFAULT; + memb_map = _memb_map; + } if (!memb_fapl) { for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) _memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS); @@ -465,19 +465,20 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f /* Map usage type */ mmt = memb_map[mt]; if (mmt < 0 || mmt >= H5FD_MEM_NTYPES) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", - -1) if (H5FD_MEM_DEFAULT == mmt) mmt = mt; + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1); + if (H5FD_MEM_DEFAULT == mmt) + mmt = mt; /* * All members of MEMB_FAPL must be either defaults or actual file * access property lists. */ if (H5P_DEFAULT != memb_fapl[mmt] && TRUE != H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1); - /* All names must be defined */ - if (!memb_name[mmt] || !memb_name[mmt][0]) H5Epush_ret( - func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1) + /* All names must be defined */ + if (!memb_name[mmt] || !memb_name[mmt][0]) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1); } /* @@ -529,13 +530,14 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl H5Eclear2(H5E_DEFAULT); if (H5I_GENPROP_LST != H5Iget_type(fapl_id) || TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", - -1) if (H5FD_MULTI != H5Pget_driver(fapl_id)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", - -1) if (NULL == (fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id))) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1) - - if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t)); + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", -1); + if (H5FD_MULTI != H5Pget_driver(fapl_id)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1); + if (NULL == (fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id))) + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1); + + if (memb_map) + memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t)); if (memb_fapl) { for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { if (fa->memb_fapl[mt] >= 0) @@ -672,10 +674,10 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out } END_MEMBERS; if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen * 2, buf + 8, NULL, H5P_DEFAULT) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1); - /* Encode all name templates */ - p = buf + 8 + nseen * 2 * 8; + /* Encode all name templates */ + p = buf + 8 + nseen * 2 * 8; UNIQUE_MEMBERS(file->fa.memb_map, mt) { size_t n = strlen(file->fa.memb_name[mt]) + 1; @@ -730,15 +732,15 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) /* Make sure the name/version number is correct */ if (strcmp(name, "NCSAmult")) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1); - /* Set default values */ - ALL_MEMBERS(mt) - { - memb_addr[mt] = HADDR_UNDEF; - memb_eoa[mt] = HADDR_UNDEF; - memb_name[mt] = NULL; - } + /* Set default values */ + ALL_MEMBERS(mt) + { + memb_addr[mt] = HADDR_UNDEF; + memb_eoa[mt] = HADDR_UNDEF; + memb_name[mt] = NULL; + } END_MEMBERS; /* @@ -761,9 +763,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) memcpy(x, buf, (nseen * 2 * 8)); buf += nseen * 2 * 8; if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen * 2, x, NULL, H5P_DEFAULT) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) - ap = (haddr_t *)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning - - 2019/07/05, QAK */ + H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1); + ap = (haddr_t *)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning - + 2019/07/05, QAK */ UNIQUE_MEMBERS(map, mt) { memb_addr[_unmapped] = *ap++; @@ -818,23 +820,23 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) } END_MEMBERS; if (compute_next(file) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1); - /* Open all necessary files */ - if (open_members(file) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1) + /* Open all necessary files */ + if (open_members(file) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1); - /* Set the EOA marker for all open files */ - UNIQUE_MEMBERS(file->fa.memb_map, mt) - { - if (file->memb[mt]) - if (H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt]) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1) + /* Set the EOA marker for all open files */ + UNIQUE_MEMBERS(file->fa.memb_map, mt) + { + if (file->memb[mt]) + if (H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt]) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1); - /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa) - */ - file->memb_eoa[mt] = memb_eoa[mt]; - } + /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa) + */ + file->memb_eoa[mt] = memb_eoa[mt]; + } END_MEMBERS; return 0; @@ -925,7 +927,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) } END_MEMBERS; free(new_fa); - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't release object on error", NULL) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't release object on error", NULL); } return new_fa; } @@ -957,8 +959,9 @@ H5FD_multi_fapl_free(void *_fa) { if (fa->memb_fapl[mt] >= 0) if (H5Idec_ref(fa->memb_fapl[mt]) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", - -1) if (fa->memb_name[mt]) free(fa->memb_name[mt]); + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1); + if (fa->memb_name[mt]) + free(fa->memb_name[mt]); } END_MEMBERS; free(fa); @@ -996,24 +999,23 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Check arguments */ if (!name || !*name) - H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", - NULL) if (0 == maxaddr || HADDR_UNDEF == maxaddr) - H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL) + H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL); + if (0 == maxaddr || HADDR_UNDEF == maxaddr) + H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL); - /* - * Initialize the file from the file access properties, using default - * values if necessary. Make sure to use CALLOC here because the code - * in H5FD_multi_set_eoa depends on the proper initialization of memb_eoa - * in H5FD_multi_t. - */ - if (NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t)))) H5Epush_ret( - func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", - NULL) if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MULTI != H5Pget_driver(fapl_id)) - { - close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0) - H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) - } + /* + * Initialize the file from the file access properties, using default + * values if necessary. Make sure to use CALLOC here because the code + * in H5FD_multi_set_eoa depends on the proper initialization of memb_eoa + * in H5FD_multi_t. + */ + if (NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t)))) + H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL); + if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MULTI != H5Pget_driver(fapl_id)) { + close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0) + H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) + } fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); assert(fa); ALL_MEMBERS(mt) @@ -1110,16 +1112,16 @@ H5FD_multi_close(H5FD_t *_file) } END_MEMBERS; if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1); - /* Clean up other stuff */ - ALL_MEMBERS(mt) - { - if (file->fa.memb_fapl[mt] >= 0) - (void)H5Idec_ref(file->fa.memb_fapl[mt]); - if (file->fa.memb_name[mt]) - free(file->fa.memb_name[mt]); - } + /* Clean up other stuff */ + ALL_MEMBERS(mt) + { + if (file->fa.memb_fapl[mt] >= 0) + (void)H5Idec_ref(file->fa.memb_fapl[mt]); + if (file->fa.memb_name[mt]) + free(file->fa.memb_name[mt]); + } END_MEMBERS; free(file->name); @@ -1277,7 +1279,9 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) if (HADDR_UNDEF == memb_eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", - HADDR_UNDEF) if (memb_eoa > 0) memb_eoa += file->fa.memb_addr[mt]; + HADDR_UNDEF); + if (memb_eoa > 0) + memb_eoa += file->fa.memb_addr[mt]; } else if (file->fa.relax) { /* @@ -1288,7 +1292,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) assert(HADDR_UNDEF != memb_eoa); } else { - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF); } if (memb_eoa > eoa) @@ -1308,7 +1312,9 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) if (HADDR_UNDEF == eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", - HADDR_UNDEF) if (eoa > 0) eoa += file->fa.memb_addr[mmt]; + HADDR_UNDEF); + if (eoa > 0) + eoa += file->fa.memb_addr[mmt]; } else if (file->fa.relax) { /* @@ -1319,7 +1325,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) assert(HADDR_UNDEF != eoa); } else { - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF); } } @@ -1382,9 +1388,9 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) H5E_BEGIN_TRY { status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); } H5E_END_TRY; if (status < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1); - return 0; + return 0; } /* end H5FD_multi_set_eoa() */ /*------------------------------------------------------------------------- @@ -1426,7 +1432,9 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) if (HADDR_UNDEF == tmp_eof) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", - HADDR_UNDEF) if (tmp_eof > 0) tmp_eof += file->fa.memb_addr[mt]; + HADDR_UNDEF); + if (tmp_eof > 0) + tmp_eof += file->fa.memb_addr[mt]; } else if (file->fa.relax) { /* @@ -1437,7 +1445,7 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) assert(HADDR_UNDEF != tmp_eof); } else { - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF); } if (tmp_eof > eof) eof = tmp_eof; @@ -1457,7 +1465,9 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) if (HADDR_UNDEF == eof) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", - HADDR_UNDEF) if (eof > 0) eof += file->fa.memb_addr[mmt]; + HADDR_UNDEF); + if (eof > 0) + eof += file->fa.memb_addr[mmt]; } else if (file->fa.relax) { /* @@ -1468,7 +1478,7 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) assert(HADDR_UNDEF != eof); } else { - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF); } } return eof; @@ -1496,9 +1506,10 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) /* Get data type for multi driver */ if (H5Pget_multi_type(fapl, &type) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't get data type for multi driver", - -1) if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1) mmt = - file->fa.memb_map[type]; + -1); + if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1); + mmt = file->fa.memb_map[type]; if (H5FD_MEM_DEFAULT == mmt) mmt = type; @@ -1542,8 +1553,8 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) } if (HADDR_UNDEF == (addr = H5FDalloc(file->memb[mmt], mmt, dxpl_id, size))) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF) - addr += file->fa.memb_addr[mmt]; + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF); + addr += file->fa.memb_addr[mmt]; /*#ifdef TMP if ( addr + size > file->eoa ) { @@ -1551,7 +1562,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) if ( H5FD_multi_set_eoa(_file, addr + size) < 0 ) { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, \ - "can't set eoa", HADDR_UNDEF) + "can't set eoa", HADDR_UNDEF); } } #else @@ -1756,9 +1767,9 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) } } if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1); - return 0; + return 0; } /*------------------------------------------------------------------------- @@ -1797,9 +1808,9 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) } } if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error truncating member files", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error truncating member files", -1); - return 0; + return 0; } /* end H5FD_multi_truncate() */ /*------------------------------------------------------------------------- @@ -1860,7 +1871,8 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) } /* end if */ if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "error locking member files", -1) return 0; + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "error locking member files", -1); + return 0; } /* H5FD_multi_lock() */ @@ -1897,9 +1909,9 @@ H5FD_multi_unlock(H5FD_t *_file) END_MEMBERS; if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "error unlocking member files", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "error unlocking member files", -1); - return 0; + return 0; } /* H5FD_multi_unlock() */ /*------------------------------------------------------------------------- @@ -1996,9 +2008,9 @@ open_members(H5FD_multi_t *file) } END_MEMBERS; if (nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1); - return 0; + return 0; } H5_GCC_DIAG_ON("format-nonliteral") diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index b395127..3d0332f 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -300,9 +300,9 @@ H5Pset_fapl_stdio(hid_t fapl_id) H5Eclear2(H5E_DEFAULT); if (0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1); - return H5Pset_driver(fapl_id, H5FD_STDIO, NULL); + return H5Pset_driver(fapl_id, H5FD_STDIO, NULL); } /* end H5Pset_fapl_stdio() */ /*------------------------------------------------------------------------- @@ -353,14 +353,15 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Check arguments */ if (!name || !*name) - H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", - NULL) if (0 == maxaddr || HADDR_UNDEF == maxaddr) - H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", - NULL) if (ADDR_OVERFLOW(maxaddr)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL) - - /* Tentatively open file in read-only mode, to check for existence */ - if (flags & H5F_ACC_RDWR) f = fopen(name, "rb+"); + H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL); + if (0 == maxaddr || HADDR_UNDEF == maxaddr) + H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL); + if (ADDR_OVERFLOW(maxaddr)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL); + + /* Tentatively open file in read-only mode, to check for existence */ + if (flags & H5F_ACC_RDWR) + f = fopen(name, "rb+"); else f = fopen(name, "rb"); @@ -373,14 +374,14 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr } else H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, - "file doesn't exist and CREAT wasn't specified", NULL) + "file doesn't exist and CREAT wasn't specified", NULL); } else if (flags & H5F_ACC_EXCL) { /* File exists, but EXCL is passed. Fail. */ assert(flags & H5F_ACC_CREAT); fclose(f); H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FILEEXISTS, - "file exists but CREAT and EXCL were specified", NULL) + "file exists but CREAT and EXCL were specified", NULL); } else if (flags & H5F_ACC_RDWR) { if (flags & H5F_ACC_TRUNC) @@ -391,14 +392,13 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * as the tentative open will work */ if (!f) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL); - /* Build the return value */ - if (NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t)))) - { - fclose(f); - H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL) - } /* end if */ + /* Build the return value */ + if (NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t)))) { + fclose(f); + H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL); + } /* end if */ file->fp = f; file->op = H5FD_STDIO_OP_SEEK; file->pos = HADDR_UNDEF; @@ -462,7 +462,7 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr if (fstat(file->fd, &sb) < 0) { free(file); fclose(f); - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADFILE, "unable to fstat file", NULL) + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADFILE, "unable to fstat file", NULL); } /* end if */ file->device = sb.st_dev; file->inode = sb.st_ino; @@ -496,9 +496,9 @@ H5FD_stdio_close(H5FD_t *_file) H5Eclear2(H5E_DEFAULT); if (fclose(file->fp) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1); - free(file); + free(file); return 0; } /* end H5FD_stdio_close() */ @@ -769,9 +769,9 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t /*UNUSED*/ fapl, void **file_handle) *file_handle = &(file->fp); if (*file_handle == NULL) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "get handle failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "get handle failed", -1); - return 0; + return 0; } /* end H5FD_stdio_get_handle() */ /*------------------------------------------------------------------------- @@ -808,12 +808,13 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl /* Check for overflow */ if (HADDR_UNDEF == addr) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", - -1) if (REGION_OVERFLOW(addr, size)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1); + if (REGION_OVERFLOW(addr, size)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1); - /* Check easy cases */ - if (0 == size) return 0; + /* Check easy cases */ + if (0 == size) + return 0; if ((haddr_t)addr >= file->eof) { memset(buf, 0, size); return 0; @@ -824,7 +825,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) { file->op = H5FD_STDIO_OP_UNKNOWN; file->pos = HADDR_UNDEF; - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1); } file->pos = addr; } @@ -856,7 +857,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl if (0 == bytes_read && ferror(file->fp)) { /* error */ file->op = H5FD_STDIO_OP_UNKNOWN; file->pos = HADDR_UNDEF; - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_READERROR, "fread failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_READERROR, "fread failed", -1); } /* end if */ if (0 == bytes_read && feof(file->fp)) { @@ -910,20 +911,19 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp /* Check for overflow conditions */ if (HADDR_UNDEF == addr) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", - -1) if (REGION_OVERFLOW(addr, size)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1) - - /* Seek to the correct file position. */ - if ((file->op != H5FD_STDIO_OP_WRITE && file->op != H5FD_STDIO_OP_SEEK) || file->pos != addr) - { - if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) { - file->op = H5FD_STDIO_OP_UNKNOWN; - file->pos = HADDR_UNDEF; - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1) - } - file->pos = addr; + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1); + if (REGION_OVERFLOW(addr, size)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1); + + /* Seek to the correct file position. */ + if ((file->op != H5FD_STDIO_OP_WRITE && file->op != H5FD_STDIO_OP_SEEK) || file->pos != addr) { + if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) { + file->op = H5FD_STDIO_OP_UNKNOWN; + file->pos = HADDR_UNDEF; + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1); } + file->pos = addr; + } /* Write the buffer. On successful return, the file position will be * advanced by the number of bytes read. On failure, the file position is @@ -945,7 +945,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp if (bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(file->fp))) { /* error */ file->op = H5FD_STDIO_OP_UNKNOWN; file->pos = HADDR_UNDEF; - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1); } /* end if */ assert(bytes_wrote > 0); @@ -999,11 +999,11 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t closing) if (file->write_access) { if (!closing) { if (fflush(file->fp) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1); - /* Reset last file I/O information */ - file->pos = HADDR_UNDEF; - file->op = H5FD_STDIO_OP_UNKNOWN; + /* Reset last file I/O information */ + file->pos = HADDR_UNDEF; + file->op = H5FD_STDIO_OP_UNKNOWN; } /* end if */ } /* end if */ @@ -1068,13 +1068,13 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/ if (INVALID_SET_FILE_POINTER == dwPtrLow) { dwError = GetLastError(); if (dwError != NO_ERROR) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_FILEOPEN, "unable to set file pointer", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_FILEOPEN, "unable to set file pointer", -1); } bError = SetEndOfFile(file->hFile); if (0 == bError) H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, - "unable to truncate/extend file properly", -1) + "unable to truncate/extend file properly", -1); #else /* H5_HAVE_WIN32_API */ /* Reset seek offset to beginning of file, so that file isn't re-extended later */ rewind(file->fp); @@ -1082,11 +1082,11 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/ /* Truncate file to proper length */ if (-1 == file_ftruncate(file->fd, (file_offset_t)file->eoa)) H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, - "unable to truncate/extend file properly", -1) + "unable to truncate/extend file properly", -1); #endif /* H5_HAVE_WIN32_API */ - /* Update the eof value */ - file->eof = file->eoa; + /* Update the eof value */ + file->eof = file->eoa; /* Reset last file I/O information */ file->pos = HADDR_UNDEF; @@ -1096,7 +1096,7 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/ else { /* Double-check for problems */ if (file->eoa > file->eof) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_TRUNCATED, "eoa > eof!", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_TRUNCATED, "eoa > eof!", -1); } /* end else */ return 0; @@ -1141,16 +1141,16 @@ H5FD_stdio_lock(H5FD_t *_file, hbool_t rw) */ errno = 0; else - H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "file lock failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "file lock failed", -1); } /* end if */ /* Flush the stream */ if (fflush(file->fp) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1); #endif /* H5_HAVE_FLOCK */ - return 0; + return 0; } /* end H5FD_stdio_lock() */ /*------------------------------------------------------------------------- @@ -1182,19 +1182,18 @@ H5FD_stdio_unlock(H5FD_t *_file) /* Flush the stream */ if (fflush(file->fp) < 0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1) - - /* Place a non-blocking lock on the file */ - if (flock(file->fd, LOCK_UN) < 0) - { - if (file->ignore_disabled_file_locks && ENOSYS == errno) - /* When errno is set to ENOSYS, the file system does not support - * locking, so ignore it. - */ - errno = 0; - else - H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "file unlock failed", -1) - } /* end if */ + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1); + + /* Place a non-blocking lock on the file */ + if (flock(file->fd, LOCK_UN) < 0) { + if (file->ignore_disabled_file_locks && ENOSYS == errno) + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + else + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "file unlock failed", -1); + } /* end if */ #endif /* H5_HAVE_FLOCK */ -- cgit v0.12 From 580008d5bb39e3a9a4a92aefe06dce6941cd485b Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 4 Mar 2021 16:06:30 -0500 Subject: More warning fixes (#400) * Fixed -Wunused-local-typedef warning * Fixed -Wformat warnings In one case also removed a `z` character. There was a `z%d` that I think was supposed to be `%zd` * Fixed -Wshorten-64-to-32 warnings * Fixed -Wself-assign warnings * Fixed -Wreserved-id-macro warnings * Commit format changes from clang-format, clang version 10.0.1. * Fixed -Wself-assign warnings * Fixed -Wunused-local-typedef warning * Fixed -Wformat warnings In two cases also removed a `z` character. There was a `z%d` that was supposed to be `%zd`. * Fixed -Wshorten-64-to-32 warnings * Fixed -Wreserved-id-macro warnings * Fixed -Wself-assign warnings * Format source. * Remove blank lines to pass format check. Co-authored-by: Larry Knox --- c++/src/H5AbstractDs.h | 6 ++--- c++/src/H5CommonFG.h | 6 ++--- c++/src/H5Group.h | 6 ++--- c++/src/H5IdComponent.h | 6 ++--- c++/test/tarray.cpp | 27 +++++++++++--------- c++/test/tattr.cpp | 54 +++++++++++++++++++-------------------- examples/h5_attribute.c | 2 +- examples/h5_group.c | 10 ++++---- hl/c++/test/ptableTest.cpp | 4 +-- hl/src/H5IM.c | 5 ++++ hl/src/H5LT.c | 8 ++++++ hl/test/test_ds.c | 24 ++++++++--------- test/cache.c | 8 +++--- test/dtypes.c | 2 +- test/filter_plugin2_dsets.c | 2 +- test/filter_plugin4_groups.c | 2 +- test/tarray.c | 43 ++++++++++++++++--------------- tools/test/h5copy/dynlib_copy.c | 2 +- tools/test/h5diff/dynlib_diff.c | 2 +- tools/test/h5dump/dynlib_dump.c | 2 +- tools/test/h5dump/h5dumpgentest.c | 2 +- tools/test/h5ls/dynlib_ls.c | 2 +- 22 files changed, 122 insertions(+), 103 deletions(-) diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index cb43c73..b84867b 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef AbstractDs_H -#define AbstractDs_H +#ifndef H5AbstractDs_H +#define H5AbstractDs_H namespace H5 { @@ -81,4 +81,4 @@ class H5_DLLCPP AbstractDs { }; // end of AbstractDs } // namespace H5 -#endif // AbstractDs_H +#endif // H5AbstractDs_H diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 368883b..d87f9ca 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef CommonFG_H -#define CommonFG_H +#ifndef H5CommonFG_H +#define H5CommonFG_H namespace H5 { @@ -83,7 +83,7 @@ class H5_DLLCPP CommonFG { }; // end of CommonFG } // namespace H5 -#endif // CommonFG_H +#endif // H5CommonFG_H /*************************************************************************** Design Note diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 2a0f18e..6e82e21 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef Group_H -#define Group_H +#ifndef H5Group_H +#define H5Group_H namespace H5 { @@ -83,4 +83,4 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { }; // end of Group } // namespace H5 -#endif // Group_H +#endif // H5Group_H diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 4f75849..383d42d 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef IdComponent_H -#define IdComponent_H +#ifndef H5IdComponent_H +#define H5IdComponent_H namespace H5 { @@ -113,4 +113,4 @@ class H5_DLLCPP IdComponent { }; // end class IdComponent } // namespace H5 -#endif // IdComponent_H +#endif // H5IdComponent_H diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index ba71da8..ab66174 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -85,7 +85,7 @@ test_array_compound_array() // Initialize array data to write for (idxi = 0; idxi < SPACE1_DIM1; idxi++) for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { - wdata[idxi][idxj].i = idxi * 10 + idxj; + wdata[idxi][idxj].i = static_cast(idxi * 10 + idxj); for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) { float temp = idxi * 10.0 + idxj * 2.5 + idxk; wdata[idxi][idxj].f[idxk] = temp; @@ -182,8 +182,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -200,8 +201,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -250,8 +252,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -266,9 +269,9 @@ test_array_compound_array() for (idxi = 0; idxi < SPACE1_DIM1; idxi++) { for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) { - TestErrPrintf( - "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", - idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i); + TestErrPrintf("Array data information doesn't match!, wdata[%lld][%lld].i=%d, " + "rdata[%lld][%lld].i=%d\n", + idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i); continue; } // end if } // end for @@ -387,7 +390,7 @@ test_array_info() // Initialize array data to write for (idxi = 0; idxi < SPACE1_DIM1; idxi++) for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { - wdata[idxi][idxj].i = idxi * 10 + idxj; + wdata[idxi][idxj].i = static_cast(idxi * 10 + idxj); for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) { float temp = idxi * 10.0 + idxj * 2.5 + idxk; wdata[idxi][idxj].f[idxk] = temp; @@ -459,7 +462,7 @@ test_array_info() for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, + "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=z%llu\n", ii, rdims1[ii], ii, tdims1[ii]); continue; } // end if diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index e308a3a..047d360 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -173,8 +173,8 @@ test_attr_basic_write() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Create two more attributes for this dataset, but only write to one. Attribute ds_attr2 = dataset.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, att_space); @@ -189,7 +189,7 @@ test_attr_basic_write() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1a[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); // Close both attributes @@ -452,8 +452,8 @@ test_attr_rename() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Close attribute attr1.close(); @@ -476,7 +476,7 @@ test_attr_rename() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1a[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); // Close attribute @@ -541,7 +541,7 @@ test_attr_basic_read() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d, read_data1[%llu]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); /* @@ -572,9 +572,9 @@ test_attr_basic_read() for (i = 0; i < ATTR2_DIM1; i++) for (j = 0; j < ATTR2_DIM2; j++) if (attr_data2[i][j] != read_data2[i][j]) { - TestErrPrintf( - "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", - __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); + TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, " + "read_data2[%llu][%llu]=%d\n", + __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); } PASSED(); } // end try block @@ -776,15 +776,15 @@ test_attr_compound_read() for (ii = 0; ii < ATTR4_DIM1; ii++) for (jj = 0; jj < ATTR4_DIM2; jj++) if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct))) { - TestErrPrintf( - "%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", - __LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i); - TestErrPrintf( - "%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", - __LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d); - TestErrPrintf( - "%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", - __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c); + TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].i=%d, " + "read_data4[%llu][%llu].i=%d\n", + __LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i); + TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].d=%f, " + "read_data4[%llu][%llu].d=%f\n", + __LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d); + TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].c=%c, " + "read_data4[%llu][%llu].c=%c\n", + __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c); } /* end if */ // Verify name @@ -1048,7 +1048,7 @@ test_attr_mult_read() hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions int ndims = space.getSimpleExtentDims(dims); if ((long)dims[0] != (long)ATTR1_DIM1) - TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n", __LINE__, + TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %llu\n", __LINE__, (int)dims[0], ATTR1_DIM1); /* Verify Datatype */ @@ -1076,8 +1076,8 @@ test_attr_mult_read() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Verify Name H5std_string attr_name = attr.getName(); @@ -1131,9 +1131,9 @@ test_attr_mult_read() for (i = 0; i < ATTR2_DIM1; i++) for (j = 0; j < ATTR2_DIM2; j++) if (attr_data2[i][j] != read_data2[i][j]) - TestErrPrintf( - "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", - __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); + TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, " + "read_data2[%llu][%llu]=%d\n", + __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); // Verify Name attr_name = attr.getName(); @@ -1186,8 +1186,8 @@ test_attr_mult_read() for (j = 0; j < ATTR3_DIM2; j++) for (k = 0; k < ATTR3_DIM3; k++) if (attr_data3[i][j][k] != read_data3[i][j][k]) - TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, " - "read_data3[%d][%d][%d]=%f\n", + TestErrPrintf("%d: attribute data different: attr_data3[%llu][%llu][%llu]=%f, " + "read_data3[%llu][%llu][%llu]=%f\n", __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]); // Verify Name diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index 3400151..97be7f5 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -235,7 +235,7 @@ attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata) float * float_array; /* Pointer to the array attribute. */ /* avoid warnings */ - opdata = opdata; + (void)opdata; /* * Open the attribute using its name. diff --git a/examples/h5_group.c b/examples/h5_group.c index 4b489f0..40acafe 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -171,9 +171,9 @@ static herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { /* avoid compiler warnings */ - loc_id = loc_id; - opdata = opdata; - linfo = linfo; + (void)loc_id; + (void)opdata; + (void)linfo; /* * Display group name. The name is passed to the function by @@ -198,8 +198,8 @@ group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdat int rank_chunk; /* avoid warnings */ - opdata = opdata; - linfo = linfo; + (void)opdata; + (void)linfo; /* * Open the datasets using their names. diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index bf60402..900f8a9 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -616,11 +616,11 @@ TestHDFFV_9758() s1_t s1[NUM_PACKETS]; for (hsize_t i = 0; i < NUM_PACKETS; i++) { - s1[i].a = i; + s1[i].a = static_cast(i); s1[i].b = 1.f * static_cast(i * i); s1[i].c = 1. / (i + 1); HDsprintf(s1[i].d, "string%d", (int)i); - s1[i].e = 100 + i; + s1[i].e = static_cast(100 + i); } printf("Testing %-62s", "data corruption in packed structs (HDFFV-9758)"); diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 310d665..ff10d57 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -169,6 +169,11 @@ find_palette(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const if (name == NULL) return -1; + /* Shut compiler up */ + (void)loc_id; + (void)ainfo; + (void)op_data; + /* Define a positive value for return value if the attribute was found. This will * cause the iterator to immediately return that positive value, * indicating short-circuit success diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 6478a96..d1d3648 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1309,6 +1309,10 @@ find_dataset(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const if (name == NULL) return ret; + /* Shut the compiler up */ + (void)loc_id; + (void)linfo; + /* Define a positive value for return value if the dataset was found. This will * cause the iterator to immediately return that positive value, * indicating short-circuit success @@ -1847,6 +1851,10 @@ find_attr(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const H5 if (name == NULL) return H5_ITER_CONT; + /* Shut compiler up */ + (void)loc_id; + (void)ainfo; + /* Define a positive value for return value if the attribute was found. This will * cause the iterator to immediately return that positive value, * indicating short-circuit success diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 90110a4..20e3e82 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -3554,9 +3554,9 @@ verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) int ret = 0; /* unused */ - dset = dset; - dim = dim; - visitor_data = visitor_data; + (void)dset; + (void)dim; + (void)visitor_data; /* define a positive value for return value. This will cause the iterator to immediately return that positive value, indicating short-circuit success @@ -3602,8 +3602,8 @@ read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) char * data = (char *)visitor_data; /* unused */ - dset = dset; - dim = dim; + (void)dset; + (void)dim; /* get space */ if ((sid = H5Dget_space(scale_id)) < 0) @@ -3691,7 +3691,7 @@ match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor_data) hsize_t storage_size; /* Stop compiler from whining about "unused parameters" */ - visitor_data = visitor_data; + (void)visitor_data; /*------------------------------------------------------------------------- * get DID (dataset) space info @@ -3766,9 +3766,9 @@ static herr_t op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) { /* Stop compiler from whining about "unused parameters" */ - dset = dset; - dim = dim; - scale_id = scale_id; + (void)dset; + (void)dim; + (void)scale_id; if (visitor_data != NULL) { (*(int *)visitor_data)++; @@ -3799,9 +3799,9 @@ static herr_t op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) { /* Stop compiler from whining about "unused parameters" */ - dset = dset; - dim = dim; - scale_id = scale_id; + (void)dset; + (void)dim; + (void)scale_id; if (visitor_data != NULL) { (*(int *)visitor_data)++; diff --git a/test/cache.c b/test/cache.c index 767bae0..b88b30e 100644 --- a/test/cache.c +++ b/test/cache.c @@ -27297,7 +27297,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) /* Fill out the rest of the cache with entries */ /* Verify expected status of entries after each insertion */ - for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) { + for (; entry_idx < 50; entry_idx++) { if (fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ @@ -27431,7 +27431,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) * After each insertion, verify the expected status of the * entries in the cache. */ - for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) { + for (; entry_idx < 100; entry_idx++) { if (fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ @@ -33243,7 +33243,7 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) /* Fill out the rest of the cache with entries */ /* Verify expected status of entries after each insertion */ - for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) { + for (; entry_idx < 50; entry_idx++) { if (fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ @@ -33304,7 +33304,7 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) if (pass) { /* Insert 50 more entries (indices 50-99) into the cache. */ - for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) { + for (; entry_idx < 100; entry_idx++) { if (fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ diff --git a/test/dtypes.c b/test/dtypes.c index 27d31d4..c0fe764 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1434,7 +1434,7 @@ test_compound_8(void) int b; } s1; - typedef struct s2 { + struct s2 { char c; s1 d; } s2; diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c index 08be78c..4a881aa 100644 --- a/test/filter_plugin2_dsets.c +++ b/test/filter_plugin2_dsets.c @@ -73,7 +73,7 @@ mult_div_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_valu return 0; /* Assignment to eliminate unused parameter warning */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /* READ - Divide the original value by MULTIPLIER */ diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c index 237642d..c948491 100644 --- a/test/filter_plugin4_groups.c +++ b/test/filter_plugin4_groups.c @@ -74,7 +74,7 @@ append_to_group_name(unsigned int flags, size_t cd_nelmts, const unsigned int *c return 0; /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /* READ - Remove the suffix from the group name */ diff --git a/test/tarray.c b/test/tarray.c index a63ebd7..089360d 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -157,8 +157,8 @@ test_array_atomic_1d(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -484,8 +484,8 @@ test_array_array_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims1; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -662,8 +662,8 @@ test_array_compound_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -883,8 +883,8 @@ test_array_compound_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -945,8 +945,9 @@ test_array_compound_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Nested array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf( + "Nested array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1204,8 +1205,8 @@ test_array_vlen_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1434,8 +1435,8 @@ test_array_vlen_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1466,8 +1467,8 @@ test_array_vlen_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -2075,8 +2076,9 @@ test_compat(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -2122,8 +2124,9 @@ test_compat(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", - (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, + rdims1[i], i, tdims1[i]); continue; } /* end if */ diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index 57de3bc..56be5a6 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 4568ca1..cebe53c 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index 4568ca1..cebe53c 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 5507ede..162dabe 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -10921,7 +10921,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 4568ca1..cebe53c 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ -- cgit v0.12 From e84e5ee4672e22753a4d3d600dca2d5291953d78 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 4 Mar 2021 20:30:09 -0800 Subject: Fixes various warnings noticed on Windows (#425) * Fixes various warnings noticed on Windows - Adds a prototype for our implementation of vasprintf - Return type of H5_get_utf16_str() is now non-const - Fixes possible uninitialized return type in Wremove_utf8 - Better isolation of fork() code in accum.c:test_swmr_write_big() - Better isolation of non-zlib code in dsets.c:test_filter_delete() - Removed unused variable in trefer.c:test_reference_cmpnd_obj() * Fixes clang-format issues --- src/H5private.h | 12 +++++++----- src/H5system.c | 8 ++++---- src/H5win32defs.h | 7 ++++--- test/accum.c | 25 ++++++++++--------------- test/dsets.c | 10 +++++++--- test/trefer.c | 2 +- 6 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index 741214f..64ab988 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -675,11 +675,6 @@ typedef struct { #ifndef HDacos #define HDacos(X) acos(X) #endif /* HDacos */ -#ifndef HDvasprintf -#ifdef H5_HAVE_VASPRINTF -#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) -#endif /* H5_HAVE_VASPRINTF */ -#endif /* HDvasprintf */ #ifndef HDalarm #ifdef H5_HAVE_ALARM #define HDalarm(N) alarm(N) @@ -1647,6 +1642,13 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #ifndef HDutime #define HDutime(S, T) utime(S, T) #endif /* HDutime */ +#ifndef HDvasprintf +#ifdef H5_HAVE_VASPRINTF +#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) +#else +H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); +#endif /* H5_HAVE_VASPRINTF */ +#endif /* HDvasprintf */ #ifndef HDva_arg #define HDva_arg(A, T) va_arg(A, T) #endif /* HDva_arg */ diff --git a/src/H5system.c b/src/H5system.c index 2ac3f93..53307a8 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -66,7 +66,7 @@ /* Track whether tzset routine was called */ static hbool_t H5_ntzset = FALSE; -#ifndef HDvasprintf +#ifndef H5_HAVE_VASPRINTF /* HDvasprintf provides vasprintf-like function on targets where it is * unavailable. */ @@ -94,7 +94,7 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap) } return -1; } -#endif +#endif /* H5_HAVE_VASPRINTF */ /*------------------------------------------------------------------------- * Function: HDstrtoll @@ -737,7 +737,7 @@ Wroundf(float arg) * *------------------------------------------------------------------------- */ -const wchar_t * +wchar_t * H5_get_utf16_str(const char *s) { int nwchars = -1; /* Length of the UTF-16 buffer */ @@ -833,7 +833,7 @@ int Wremove_utf8(const char *path) { wchar_t *wpath = NULL; /* UTF-16 version of the path */ - int ret; + int ret = -1; /* Convert the input UTF-8 path to UTF-16 */ if (NULL == (wpath = H5_get_utf16_str(path))) diff --git a/src/H5win32defs.h b/src/H5win32defs.h index b4b253f..8f3947a 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -176,9 +176,10 @@ H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...); H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap); H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); -H5_DLL const wchar_t *H5_get_utf16_str(const char *s); -H5_DLL int Wopen_utf8(const char *path, int oflag, ...); -H5_DLL int Wremove_utf8(const char *path); +H5_DLL wchar_t *H5_get_utf16_str(const char *s); +H5_DLL int Wopen_utf8(const char *path, int oflag, ...); +H5_DLL int Wremove_utf8(const char *path); +H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); /* Round functions only needed for VS2012 and earlier. * They are always built to ensure they don't go stale and diff --git a/test/accum.c b/test/accum.c index e9542cf..08fe926 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2092,6 +2092,7 @@ error: unsigned test_swmr_write_big(hbool_t newest_format) { +#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_UNISTD_H) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ H5F_t * rf = NULL; /* File pointer */ @@ -2099,26 +2100,16 @@ test_swmr_write_big(hbool_t newest_format) uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ uint8_t wbuf[1024]; /* Buffer for reading & writing */ unsigned u; /* Local index variable */ -#ifdef H5_HAVE_UNISTD_H - pid_t pid; /* Process ID */ -#endif /* H5_HAVE_UNISTD_H */ - int status; /* Status returned from child process */ - char * driver = NULL; /* VFD string (from env variable) */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + pid_t pid; /* Process ID */ + int status; /* Status returned from child process */ + char * driver = NULL; /* VFD string (from env variable) */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (newest_format) TESTING("SWMR write of large metadata: with latest format") else TESTING("SWMR write of large metadata: with non-latest-format") -#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) - - SKIPPED(); - HDputs(" Test skipped due to fork or waitpid not defined."); - return 0; - -#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */ - /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ @@ -2296,7 +2287,11 @@ error: return 1; -#endif +#else + SKIPPED(); + HDputs(" Test skipped due to fork, waitpid, or pid_t not defined."); + return 0; +#endif /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_UNISTD_H) */ } /* end test_swmr_write_big() */ diff --git a/test/dsets.c b/test/dsets.c index 5dcdbce..8600d75 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -6976,6 +6976,7 @@ error: static herr_t test_filter_delete(hid_t file) { +#ifdef H5_HAVE_FILTER_DEFLATE H5Z_filter_t filtn; /* filter identification number */ hid_t dsid = -1; /* dataset ID */ hid_t sid = -1; /* dataspace ID */ @@ -6987,6 +6988,7 @@ test_filter_delete(hid_t file) unsigned flags; /* flags for filter */ herr_t ret; /* generic return value */ int i; +#endif TESTING("filter deletion"); @@ -7088,9 +7090,7 @@ test_filter_delete(hid_t file) goto error; PASSED(); -#else - SKIPPED(); -#endif + return SUCCEED; error: @@ -7103,6 +7103,10 @@ error: } H5E_END_TRY; return FAIL; +#else + SKIPPED(); + return SUCCEED; +#endif } /* end test_filter_delete() */ /*------------------------------------------------------------------------- diff --git a/test/trefer.c b/test/trefer.c index 0d6ae75..6422a1b 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -832,7 +832,7 @@ test_reference_cmpnd_obj(void) hsize_t cmpnd_dims[] = {1}; hid_t dapl_id; /* Dataset access property list */ unsigned * ibuf, *obuf; - unsigned i, j; /* Counters */ + unsigned i; /* Counter */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ s2_t cmpnd_wbuf, cmpnd_rbuf; -- cgit v0.12 From f4e87791e1543d672dba07f7211cc01509b940b6 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 5 Mar 2021 09:50:42 -0500 Subject: Fixed clang-tidy readability-misleading-indentation warnings (#427) * Fixed clang-tidy readability-misleading-indentation warnings * Reformatted src/H5Zscaleoffset.c with clang v10.0.1. Co-authored-by: Larry Knox --- src/H5Oalloc.c | 6 +- src/H5Oint.c | 10 +- src/H5Zscaleoffset.c | 303 ++++++++++++++++++++--------------------- tools/test/perform/perf_meta.c | 4 +- 4 files changed, 164 insertions(+), 159 deletions(-) diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 98bbf0b..bad89ae 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -1234,10 +1234,10 @@ H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx) /* Keep first one found */ if (found_null < 0) found_null = (ssize_t)idx; - else - /* Check for better fit */ - if (oh->mesg[idx].raw_size < oh->mesg[found_null].raw_size) + /* Check for better fit */ + else if (oh->mesg[idx].raw_size < oh->mesg[found_null].raw_size) { found_null = (ssize_t)idx; + } else { /* If they are the same size, choose the one in the earliest chunk */ if (oh->mesg[idx].raw_size == oh->mesg[found_null].raw_size) { diff --git a/src/H5Oint.c b/src/H5Oint.c index 5fa9c6a..f24d0bb 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -449,12 +449,16 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init #if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T if (size_hint > 4294967295UL) oh->flags |= H5O_HDR_CHUNK0_8; - else -#endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */ - if (size_hint > 65535) + else if (size_hint > 65535) oh->flags |= H5O_HDR_CHUNK0_4; else if (size_hint > 255) oh->flags |= H5O_HDR_CHUNK0_2; +#else + if (size_hint > 65535) + oh->flags |= H5O_HDR_CHUNK0_4; + else if (size_hint > 255) + oh->flags |= H5O_HDR_CHUNK0_2; +#endif } else { /* Reset unused time fields */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 3f26623..b8033fe 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -198,7 +198,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Set the fill value parameter in cd_values[] for unsigned integer type */ #define H5Z_scaleoffset_set_filval_1(type, dcpl_plist, dt, cd_values, need_convert) \ - { \ + do { \ type fill_val; \ \ /* Get dataset fill value */ \ @@ -209,11 +209,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ \ H5Z_scaleoffset_save_filval(type, cd_values, fill_val) \ - } + } while (0) /* Set the fill value parameter in cd_values[] for signed integer type */ #define H5Z_scaleoffset_set_filval_2(type, dcpl_plist, dt, cd_values, need_convert) \ - { \ + do { \ type fill_val; \ \ /* Get dataset fill value */ \ @@ -224,11 +224,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ \ H5Z_scaleoffset_save_filval(unsigned type, cd_values, fill_val) \ - } + } while (0) /* Set the fill value parameter in cd_values[] for character integer type */ #define H5Z_scaleoffset_set_filval_3(type, dcpl_plist, dt, cd_values, need_convert) \ - { \ + do { \ type fill_val; \ \ /* Get dataset fill value */ \ @@ -237,11 +237,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ /* Store the fill value as the last entry in cd_values[] */ \ (cd_values)[H5Z_SCALEOFFSET_PARM_FILVAL] = (unsigned)((unsigned char)fill_val); \ - } + } while (0) /* Set the fill value parameter in cd_values[] for floating-point type */ #define H5Z_scaleoffset_set_filval_4(type, dcpl_plist, dt, cd_values, need_convert) \ - { \ + do { \ type fill_val; \ \ /* Get dataset fill value */ \ @@ -252,7 +252,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ \ H5Z_scaleoffset_save_filval(type, cd_values, fill_val) \ - } + } while (0) /* Get the fill value for integer type */ #define H5Z_scaleoffset_get_filval_1(type, cd_values, fill_val) \ @@ -451,7 +451,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Precompress for unsigned integer type */ #define H5Z_scaleoffset_precompress_1(type, data, d_nelmts, filavail, cd_values, minbits, minval) \ - { \ + do { \ type * buf = (type *)data, min = 0, max = 0, span, filval = 0; \ unsigned i; \ \ @@ -484,11 +484,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ for (i = 0; i < d_nelmts; i++) buf[i] = (type)(buf[i] - min); \ } \ *minval = min; \ - } + } while (0) /* Precompress for signed integer type */ #define H5Z_scaleoffset_precompress_2(type, data, d_nelmts, filavail, cd_values, minbits, minval) \ - { \ + do { \ type * buf = (type *)data, min = 0, max = 0, filval = 0; \ unsigned type span; \ unsigned i; \ @@ -522,7 +522,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ for (i = 0; i < d_nelmts; i++) buf[i] = (type)(buf[i] - min); \ } \ *minval = (unsigned long long)min; \ - } + } while (0) /* Modify values of data in precompression if fill value defined for floating-point type */ #define H5Z_scaleoffset_modify_1(i, type, pow_fun, abs_fun, lround_fun, llround_fun, buf, d_nelmts, filval, \ @@ -596,7 +596,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Precompress for floating-point type using variable-minimum-bits method */ #define H5Z_scaleoffset_precompress_3(type, pow_fun, abs_fun, round_fun, lround_fun, llround_fun, data, \ d_nelmts, filavail, cd_values, minbits, minval, D_val) \ - { \ + do { \ type * buf = (type *)data, min = 0, max = 0, filval = 0; \ unsigned long long span; \ unsigned i; \ @@ -626,11 +626,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ D_val) \ } \ H5Z_scaleoffset_save_min(i, type, minval, min) \ - } + } while (0) /* Postdecompress for unsigned integer type */ #define H5Z_scaleoffset_postdecompress_1(type, data, d_nelmts, filavail, cd_values, minbits, minval) \ - { \ + do { \ type * buf = (type *)data, filval = 0; \ unsigned i; \ \ @@ -641,11 +641,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ else /* fill value undefined */ \ for (i = 0; i < d_nelmts; i++) \ buf[i] = (type)(buf[i] + (type)(minval)); \ - } + } while (0) /* Postdecompress for signed integer type */ #define H5Z_scaleoffset_postdecompress_2(type, data, d_nelmts, filavail, cd_values, minbits, minval) \ - { \ + do { \ type * buf = (type *)data, filval = 0; \ unsigned i; \ \ @@ -657,7 +657,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ else /* fill value undefined */ \ for (i = 0; i < d_nelmts; i++) \ buf[i] = (type)(buf[i] + (type)(minval)); \ - } + } while (0) /* Retrive minimum value of floating-point type */ #define H5Z_scaleoffset_get_min(type, minval, min) \ @@ -721,7 +721,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Postdecompress for floating-point type using variable-minimum-bits method */ #define H5Z_scaleoffset_postdecompress_3(type, pow_fun, data, d_nelmts, filavail, cd_values, minbits, \ minval, D_val) \ - { \ + do { \ type * buf = (type *)data, filval = 0, min = 0; \ unsigned i; \ \ @@ -734,7 +734,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } \ else /* fill value undefined */ \ H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \ - } + } while (0) /*------------------------------------------------------------------------- * Function: H5Z__can_apply_scaleoffset @@ -884,35 +884,32 @@ H5Z__scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, H5T_t *type, enum FUNC_ENTER_STATIC if (scale_type == t_uchar) - H5Z_scaleoffset_set_filval_3(unsigned char, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_ushort) - H5Z_scaleoffset_set_filval_1(unsigned short, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_uint) - H5Z_scaleoffset_set_filval_1(unsigned int, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_ulong) - H5Z_scaleoffset_set_filval_1(unsigned long, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_ulong_long) - H5Z_scaleoffset_set_filval_1(unsigned long long, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_schar) - H5Z_scaleoffset_set_filval_3(signed char, dcpl_plist, type, cd_values, - need_convertd) else if (scale_type == t_short) - H5Z_scaleoffset_set_filval_2(short, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_int) - H5Z_scaleoffset_set_filval_2(int, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_long) - H5Z_scaleoffset_set_filval_2(long, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == - t_long_long) - H5Z_scaleoffset_set_filval_2( - long long, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_float) - H5Z_scaleoffset_set_filval_4( - float, dcpl_plist, type, cd_values, - need_convert) else if (scale_type == t_double) - H5Z_scaleoffset_set_filval_4(double, dcpl_plist, type, - cd_values, need_convert) - - done : FUNC_LEAVE_NOAPI(ret_value) + H5Z_scaleoffset_set_filval_3(unsigned char, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_ushort) + H5Z_scaleoffset_set_filval_1(unsigned short, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_uint) + H5Z_scaleoffset_set_filval_1(unsigned int, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_ulong) + H5Z_scaleoffset_set_filval_1(unsigned long, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_ulong_long) + H5Z_scaleoffset_set_filval_1(unsigned long long, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_schar) + H5Z_scaleoffset_set_filval_3(signed char, dcpl_plist, type, cd_values, need_convertd); + else if (scale_type == t_short) + H5Z_scaleoffset_set_filval_2(short, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_int) + H5Z_scaleoffset_set_filval_2(int, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_long) + H5Z_scaleoffset_set_filval_2(long, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_long_long) + H5Z_scaleoffset_set_filval_2(long long, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_float) + H5Z_scaleoffset_set_filval_4(float, dcpl_plist, type, cd_values, need_convert); + else if (scale_type == t_double) + H5Z_scaleoffset_set_filval_4(double, dcpl_plist, type, cd_values, need_convert); + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__scaleoffset_set_parms_fillval() */ /*------------------------------------------------------------------------- @@ -1443,76 +1440,75 @@ H5Z__scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffs const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval) { if (type == t_uchar) - H5Z_scaleoffset_precompress_1(unsigned char, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_ushort) - H5Z_scaleoffset_precompress_1(unsigned short, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_uint) - H5Z_scaleoffset_precompress_1(unsigned int, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_ulong) - H5Z_scaleoffset_precompress_1(unsigned long, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_ulong_long) - H5Z_scaleoffset_precompress_1(unsigned long long, data, d_nelmts, filavail, cd_values, - minbits, minval) else if (type == t_schar) - { - signed char * buf = (signed char *)data, min = 0, max = 0, filval = 0; - unsigned char span; - unsigned i; - - if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ - H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval); - if (*minbits == - H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ - H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, - min) if ((unsigned char)(max - min) > - (unsigned char)(~(unsigned char)0 - 2)) - { - *minbits = sizeof(signed char) * 8; - return; - } - span = (unsigned char)(max - min + 1); - *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1)); + H5Z_scaleoffset_precompress_1(unsigned char, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_ushort) + H5Z_scaleoffset_precompress_1(unsigned short, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_uint) + H5Z_scaleoffset_precompress_1(unsigned int, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_ulong) + H5Z_scaleoffset_precompress_1(unsigned long, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_ulong_long) + H5Z_scaleoffset_precompress_1(unsigned long long, data, d_nelmts, filavail, cd_values, minbits, + minval); + else if (type == t_schar) { + signed char * buf = (signed char *)data, min = 0, max = 0, filval = 0; + unsigned char span; + unsigned i; + + if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ + H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval); + if (*minbits == + H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ + H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, + min) if ((unsigned char)(max - min) > + (unsigned char)(~(unsigned char)0 - 2)) + { + *minbits = sizeof(signed char) * 8; + return; } - else /* minbits already set, only calculate min */ - H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, - min) if (*minbits != - sizeof(signed char) * - 8) /* change values if minbits != full precision */ - for (i = 0; i < d_nelmts; i++) buf[i] = - (signed char)((buf[i] == filval) ? (((unsigned char)1 << *minbits) - 1) - : (buf[i] - min)); + span = (unsigned char)(max - min + 1); + *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1)); } - else { /* fill value undefined */ - if (*minbits == - H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ - H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, - min) if ((unsigned char)(max - min) > - (unsigned char)(~(unsigned char)0 - 2)) - { - *minbits = sizeof(signed char) * 8; - *minval = (unsigned long long)min; - return; - } - span = (unsigned char)(max - min + 1); - *minbits = H5Z__scaleoffset_log2((unsigned long long)span); + else /* minbits already set, only calculate min */ + H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, + min) if (*minbits != + sizeof(signed char) * + 8) /* change values if minbits != full precision */ + for (i = 0; i < d_nelmts; i++) buf[i] = + (signed char)((buf[i] == filval) ? (((unsigned char)1 << *minbits) - 1) + : (buf[i] - min)); + } + else { /* fill value undefined */ + if (*minbits == + H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ + H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, + min) if ((unsigned char)(max - min) > + (unsigned char)(~(unsigned char)0 - 2)) + { + *minbits = sizeof(signed char) * 8; + *minval = (unsigned long long)min; + return; } - else /* minbits already set, only calculate min */ - H5Z_scaleoffset_min_2(i, d_nelmts, buf, - min) if (*minbits != - sizeof(signed char) * - 8) /* change values if minbits != full precision */ - for (i = 0; i < d_nelmts; i++) buf[i] = (signed char)(buf[i] - min); + span = (unsigned char)(max - min + 1); + *minbits = H5Z__scaleoffset_log2((unsigned long long)span); } - *minval = (unsigned long long)min; + else /* minbits already set, only calculate min */ + H5Z_scaleoffset_min_2(i, d_nelmts, buf, + min) if (*minbits != + sizeof(signed char) * + 8) /* change values if minbits != full precision */ + for (i = 0; i < d_nelmts; i++) buf[i] = (signed char)(buf[i] - min); } + *minval = (unsigned long long)min; + } else if (type == t_short) - H5Z_scaleoffset_precompress_2(short, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_int) - H5Z_scaleoffset_precompress_2(int, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_long) - H5Z_scaleoffset_precompress_2(long, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_long_long) - H5Z_scaleoffset_precompress_2(long long, data, d_nelmts, filavail, cd_values, minbits, - minval) + H5Z_scaleoffset_precompress_2(short, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_int) + H5Z_scaleoffset_precompress_2(int, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_long) + H5Z_scaleoffset_precompress_2(long, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_long_long) + H5Z_scaleoffset_precompress_2(long long, data, d_nelmts, filavail, cd_values, minbits, minval); } /* postdecompress for integer type */ @@ -1524,39 +1520,38 @@ H5Z__scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleo long long sminval = *(long long *)&minval; /* for signed integer types */ if (type == t_uchar) - H5Z_scaleoffset_postdecompress_1(unsigned char, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_ushort) - H5Z_scaleoffset_postdecompress_1(unsigned short, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_uint) - H5Z_scaleoffset_postdecompress_1(unsigned int, data, d_nelmts, filavail, cd_values, minbits, - minval) else if (type == t_ulong) - H5Z_scaleoffset_postdecompress_1(unsigned long, data, d_nelmts, filavail, cd_values, - minbits, minval) else if (type == t_ulong_long) - H5Z_scaleoffset_postdecompress_1(unsigned long long, data, d_nelmts, filavail, - cd_values, minbits, minval) else if (type == t_schar) - { - signed char *buf = (signed char *)data, filval = 0; - unsigned i; - - if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ - H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval) for (i = 0; i < d_nelmts; i++) - buf[i] = - (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval - : (buf[i] + sminval)); - } - else /* fill value undefined */ - for (i = 0; i < d_nelmts; i++) - buf[i] = (signed char)(buf[i] + sminval); + H5Z_scaleoffset_postdecompress_1(unsigned char, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_ushort) + H5Z_scaleoffset_postdecompress_1(unsigned short, data, d_nelmts, filavail, cd_values, minbits, + minval); + else if (type == t_uint) + H5Z_scaleoffset_postdecompress_1(unsigned int, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_ulong) + H5Z_scaleoffset_postdecompress_1(unsigned long, data, d_nelmts, filavail, cd_values, minbits, minval); + else if (type == t_ulong_long) + H5Z_scaleoffset_postdecompress_1(unsigned long long, data, d_nelmts, filavail, cd_values, minbits, + minval); + else if (type == t_schar) { + signed char *buf = (signed char *)data, filval = 0; + unsigned i; + + if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ + H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval) for (i = 0; i < d_nelmts; + i++) buf[i] = + (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval : (buf[i] + sminval)); } + else /* fill value undefined */ + for (i = 0; i < d_nelmts; i++) + buf[i] = (signed char)(buf[i] + sminval); + } else if (type == t_short) - H5Z_scaleoffset_postdecompress_2(short, data, d_nelmts, filavail, cd_values, minbits, - sminval) else if (type == t_int) - H5Z_scaleoffset_postdecompress_2(int, data, d_nelmts, filavail, cd_values, minbits, - sminval) else if (type == t_long) - H5Z_scaleoffset_postdecompress_2(long, data, d_nelmts, filavail, cd_values, minbits, - sminval) else if (type == t_long_long) - H5Z_scaleoffset_postdecompress_2(long long, data, d_nelmts, filavail, cd_values, minbits, - sminval) + H5Z_scaleoffset_postdecompress_2(short, data, d_nelmts, filavail, cd_values, minbits, sminval); + else if (type == t_int) + H5Z_scaleoffset_postdecompress_2(int, data, d_nelmts, filavail, cd_values, minbits, sminval); + else if (type == t_long) + H5Z_scaleoffset_postdecompress_2(long, data, d_nelmts, filavail, cd_values, minbits, sminval); + else if (type == t_long_long) + H5Z_scaleoffset_postdecompress_2(long long, data, d_nelmts, filavail, cd_values, minbits, sminval); } /* precompress for floating-point type, variable-minimum-bits method @@ -1572,11 +1567,13 @@ H5Z__scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoff if (type == t_float) H5Z_scaleoffset_precompress_3(float, HDpowf, HDfabsf, HDroundf, HDlroundf, HDllroundf, data, d_nelmts, - filavail, cd_values, minbits, minval, D_val) else if (type == t_double) - H5Z_scaleoffset_precompress_3(double, HDpow, HDfabs, HDround, HDlround, HDllround, data, d_nelmts, - filavail, cd_values, minbits, minval, D_val) + filavail, cd_values, minbits, minval, D_val); + else if (type == t_double) + H5Z_scaleoffset_precompress_3(double, HDpow, HDfabs, HDround, HDlround, HDllround, data, d_nelmts, + filavail, cd_values, minbits, minval, D_val); - done : FUNC_LEAVE_NOAPI(ret_value) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* postdecompress for floating-point type, variable-minimum-bits method @@ -1593,11 +1590,13 @@ H5Z__scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scale if (type == t_float) H5Z_scaleoffset_postdecompress_3(float, HDpowf, data, d_nelmts, filavail, cd_values, minbits, sminval, - D_val) else if (type == t_double) - H5Z_scaleoffset_postdecompress_3(double, HDpow, data, d_nelmts, filavail, cd_values, minbits, - sminval, D_val) + D_val); + else if (type == t_double) + H5Z_scaleoffset_postdecompress_3(double, HDpow, data, d_nelmts, filavail, cd_values, minbits, sminval, + D_val); - done : FUNC_LEAVE_NOAPI(ret_value) +done: + FUNC_LEAVE_NOAPI(ret_value) } static void diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c index a93d673..d8ed9ec 100644 --- a/tools/test/perform/perf_meta.c +++ b/tools/test/perform/perf_meta.c @@ -818,8 +818,10 @@ main(int argc, char **argv) goto error; #ifdef H5_HAVE_PARALLEL if (facc_type != FACC_DEFAULT && MAINPROCESS) -#endif /*H5_HAVE_PARALLEL*/ printf("All metadata performance tests passed.\n"); +#else + printf("All metadata performance tests passed.\n"); +#endif /*H5_HAVE_PARALLEL*/ return 0; -- cgit v0.12 From 6794428d232236e1c4605e8ca0face915f01286b Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 5 Mar 2021 09:51:01 -0500 Subject: Fixed clang-tidy readability-redundant-control-flow warnings (#428) * Fixed clang-tidy readability-redundant-control-flow warnings Just removed useless trailing return statements. * Removed blank lines from h5diffgentest.c with clang-format v10.0.1. Co-authored-by: Larry Knox --- src/H5.c | 3 -- src/H5C.c | 3 -- src/H5Cdbg.c | 2 -- test/cache.c | 34 ---------------------- test/cache_common.c | 60 --------------------------------------- test/cache_image.c | 10 ------- test/genall5.c | 25 ---------------- test/h5test.c | 8 ------ test/set_extent.c | 2 -- test/tarray.c | 1 - test/tmisc.c | 3 -- test/ttsafe.c | 2 -- test/tvlstr.c | 6 ---- tools/lib/h5diff_array.c | 2 -- tools/src/h5import/h5import.c | 2 -- tools/test/h5diff/h5diffgentest.c | 4 --- tools/test/h5dump/h5dumpgentest.c | 3 -- 17 files changed, 170 deletions(-) diff --git a/src/H5.c b/src/H5.c index 16adbe0..b7c6eb5 100644 --- a/src/H5.c +++ b/src/H5.c @@ -807,9 +807,6 @@ H5__debug_mask(const char *s) s++; } /* end if-else */ } /* end while */ - - return; - } /* end H5__debug_mask() */ #ifdef H5_HAVE_PARALLEL diff --git a/src/H5C.c b/src/H5C.c index 9369506..551a2b2 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -689,9 +689,6 @@ H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, HDfprintf(stdout, "%sAuto cache resize -- unknown status code.\n", cache_ptr->prefix); break; } - - return; - } /* H5C_def_auto_resize_rpt_fcn() */ /*------------------------------------------------------------------------- diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 478cc1d..e59012c 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -832,8 +832,6 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED *cache_ptr) #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ #endif /* H5C_COLLECT_CACHE_STATS */ - - return; } /* H5C_stats__reset() */ /*------------------------------------------------------------------------- diff --git a/test/cache.c b/test/cache.c index b88b30e..3f2a404 100644 --- a/test/cache.c +++ b/test/cache.c @@ -3210,8 +3210,6 @@ check_flush_cache__empty_cache(H5F_t *file_ptr) "flush with flags = 0x10 failed on empty cache.\n") } - return; - } /* check_flush_cache__empty_cache() */ /*------------------------------------------------------------------------- @@ -4413,8 +4411,6 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } - return; - } /* check_flush_cache__multi_entry() */ /*------------------------------------------------------------------------- @@ -4599,8 +4595,6 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u++; } - return; - } /* check_flush_cache__multi_entry_test() */ /*------------------------------------------------------------------------- @@ -4794,8 +4788,6 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i u++; } - return; - } /* check_flush_cache__pe_multi_entry_test() */ /*------------------------------------------------------------------------- @@ -7991,8 +7983,6 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) /* finally finish up with the flush ops eviction test */ check_flush_cache__flush_op_eviction_test(file_ptr); - return; - } /* check_flush_cache__flush_ops() */ /*------------------------------------------------------------------------- @@ -8394,8 +8384,6 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i++; } - return; - } /* check_flush_cache__flush_op_test() */ /*------------------------------------------------------------------------- @@ -10546,8 +10534,6 @@ check_flush_cache__flush_op_eviction_test(H5F_t *file_ptr) reset_entries(); } - return; - } /* check_flush_cache__flush_op_eviction_test() */ /*------------------------------------------------------------------------- @@ -12171,8 +12157,6 @@ check_flush_cache__single_entry(H5F_t *file_ptr) } } - return; - } /* check_flush_cache__single_entry() */ /*------------------------------------------------------------------------- @@ -12312,8 +12296,6 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty } } - return; - } /* check_flush_cache__single_entry_test() */ /*------------------------------------------------------------------------- @@ -12489,8 +12471,6 @@ check_flush_cache__pinned_single_entry_test(H5F_t *file_ptr, int test_num, int e } } - return; - } /* check_flush_cache__pinned_single_entry_test() */ /*------------------------------------------------------------------------- @@ -13639,8 +13619,6 @@ check_move_entry__run_test(H5F_t *file_ptr, unsigned test_num, struct move_entry /* put the entry back where it started from */ move_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, TRUE); - return; - } /* check_move_entry__run_test() */ /*------------------------------------------------------------------------- @@ -33880,8 +33858,6 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr) /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - return; - } /* cedds__expunge_dirty_entry_in_flush_test() */ /*------------------------------------------------------------------------- @@ -34240,8 +34216,6 @@ cedds__H5C_make_space_in_cache(H5F_t *file_ptr) /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - return; - } /* cedds__H5C_make_space_in_cache() */ /*------------------------------------------------------------------------- @@ -34638,8 +34612,6 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr) /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - return; - } /* cedds__H5C__autoadjust__ageout__evict_aged_out_entries() */ /*------------------------------------------------------------------------- @@ -35016,8 +34988,6 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t *file_ptr) /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - return; - } /* cedds__H5C_flush_invalidate_cache__bucket_scan() */ /*------------------------------------------------------------------------- @@ -35480,8 +35450,6 @@ check_stats__smoke_check_1(H5F_t *file_ptr) /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - return; - } /* check_stats__smoke_check_1() */ #endif /* H5C_COLLECT_CACHE_STATS */ @@ -35889,8 +35857,6 @@ takedown_cache(H5F_t *file_ptr, hbool_t dump_stats, hbool_t dump_detailed_stats) } } - return; - } /* takedown_cache() */ /*------------------------------------------------------------------------- diff --git a/test/cache_common.c b/test/cache_common.c index 0d6136e..54b1cc5 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -434,8 +434,6 @@ addr_to_type_and_index(haddr_t addr, int32_t *type_ptr, int32_t *index_ptr) *type_ptr = type; *index_ptr = idx; - return; - } /* addr_to_type_and_index() */ /* Call back functions: */ @@ -1515,8 +1513,6 @@ add_flush_op(int target_type, int target_idx, int op_code, int type, int idx, hb (target_entry_ptr->flush_ops)[i].order_ptr = order_ptr; } - return; - } /* add_flush_op() */ /*------------------------------------------------------------------------- @@ -1586,8 +1582,6 @@ create_pinned_entry_dependency(H5F_t *file_ptr, int pinning_type, int pinning_id (pinned_entry_ptr->pinning_ref_count)++; } - return; - } /* create_pinned_entry_dependency() */ /*------------------------------------------------------------------------- @@ -1660,8 +1654,6 @@ dirty_entry(H5F_t *file_ptr, int32_t type, int32_t idx, hbool_t dirty_pin) } } - return; - } /* dirty_entry() */ /*------------------------------------------------------------------------- @@ -1805,8 +1797,6 @@ execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_o } } - return; - } /* execute_flush_op() */ /*------------------------------------------------------------------------- @@ -2032,8 +2022,6 @@ free_entry_arrays(void) HDfree(notify_entries); HDfree(orig_notify_entries); - return; - } /* free_entry_arrays() */ /*------------------------------------------------------------------------- @@ -2177,8 +2165,6 @@ reset_entries(void) } /* end for */ } /* end else */ - return; - } /* reset_entries() */ /*------------------------------------------------------------------------- @@ -2270,8 +2256,6 @@ resize_entry(H5F_t *file_ptr, int32_t type, int32_t idx, size_t new_size, hbool_ } } - return; - } /* resize_entry() */ /*------------------------------------------------------------------------- @@ -2323,8 +2307,6 @@ verify_clean(void) } } - return; - } /* verify_clean() */ /*------------------------------------------------------------------------- @@ -2621,8 +2603,6 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_ i++; } /* while */ - return; - } /* verify_entry_status() */ /*------------------------------------------------------------------------- @@ -2676,8 +2656,6 @@ verify_unprotected(void) } } - return; - } /* verify_unprotected() */ /*------------------------------------------------------------------------- @@ -2741,8 +2719,6 @@ expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx) } } - return; - } /* expunge_entry() */ /*------------------------------------------------------------------------- @@ -2816,8 +2792,6 @@ flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_ } } - return; - } /* flush_cache() */ /*------------------------------------------------------------------------- @@ -2985,8 +2959,6 @@ insert_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags) HDassert(((entry_ptr->header).type)->id == type); } /* end if */ - return; - } /* insert_entry() */ /*------------------------------------------------------------------------- @@ -3046,8 +3018,6 @@ mark_entry_dirty(int32_t type, int32_t idx) HDassert(((entry_ptr->header).type)->id == type); } - return; - } /* mark_entry_dirty() */ /*------------------------------------------------------------------------- @@ -3146,8 +3116,6 @@ move_entry(H5C_t *cache_ptr, int32_t type, int32_t idx, hbool_t main_addr) HDassert(entry_ptr->is_dirty); } - return; - } /* move_entry() */ /*------------------------------------------------------------------------- @@ -3314,8 +3282,6 @@ protect_entry_ro(H5F_t *file_ptr, int32_t type, int32_t idx) HDassert(((entry_ptr->header).type)->id == type); } - return; - } /* protect_entry_ro() */ /*------------------------------------------------------------------------- @@ -3372,8 +3338,6 @@ pin_entry(int32_t type, int32_t idx) } } /* end if */ - return; - } /* pin_entry() */ /*------------------------------------------------------------------------- @@ -3431,8 +3395,6 @@ unpin_entry(int32_t type, int32_t idx) HDassert(((entry_ptr->header).type)->id == type); } - return; - } /* unpin_entry() */ /*------------------------------------------------------------------------- @@ -3542,8 +3504,6 @@ unprotect_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags) HDassert(entry_ptr->header.ro_ref_count == entry_ptr->ro_ref_count); } - return; - } /* unprotect_entry() */ /*------------------------------------------------------------------------- @@ -3972,8 +3932,6 @@ hl_row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, h H5C_stats(cache_ptr, "test cache", display_detailed_stats); } - return; - } /* hl_row_major_scan_forward() */ /*------------------------------------------------------------------------- @@ -4234,8 +4192,6 @@ row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t H5C_stats(cache_ptr, "test cache", display_detailed_stats); } - return; - } /* row_major_scan_backward() */ /*------------------------------------------------------------------------- @@ -4328,8 +4284,6 @@ hl_row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, H5C_stats(cache_ptr, "test cache", display_detailed_stats); } - return; - } /* hl_row_major_scan_backward() */ /*------------------------------------------------------------------------- @@ -4422,8 +4376,6 @@ col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t H5C_stats(cache_ptr, "test cache", display_detailed_stats); } - return; - } /* col_major_scan_forward() */ /*------------------------------------------------------------------------- @@ -4527,8 +4479,6 @@ hl_col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, h H5C_stats(cache_ptr, "test cache", display_detailed_stats); } - return; - } /* hl_col_major_scan_forward() */ /*------------------------------------------------------------------------- @@ -4633,8 +4583,6 @@ col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t if (verbose) HDfprintf(stdout, "%s: exiting.\n", FUNC); - return; - } /* col_major_scan_backward() */ /*------------------------------------------------------------------------- @@ -4738,8 +4686,6 @@ hl_col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, H5C_stats(cache_ptr, "test cache", display_detailed_stats); } - return; - } /* hl_col_major_scan_backward() */ /*------------------------------------------------------------------------- @@ -5108,8 +5054,6 @@ check_and_validate_cache_hit_rate(hid_t file_id, double *hit_rate_ptr, hbool_t d failure_mssg = "Unexpectedly low hit rate."; } - return; - } /* check_and_validate_cache_hit_rate() */ /*------------------------------------------------------------------------- @@ -5227,8 +5171,6 @@ check_and_validate_cache_size(hid_t file_id, size_t *max_size_ptr, size_t *min_c (long)min_clean_size, (long)cur_size, (long)cur_num_entries); } - return; - } /* check_and_validate_cache_size() */ H5_ATTR_PURE hbool_t @@ -5389,8 +5331,6 @@ validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t } } - return; - } /* validate_mdc_config() */ #if 0 /* debugging functions -- normally commented out */ diff --git a/test/cache_image.c b/test/cache_image.c index ecb8c05..9c8f855 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -387,8 +387,6 @@ create_datasets(hid_t file_id, int min_dset, int max_dset) } } - return; - } /* create_datasets() */ /*------------------------------------------------------------------------- @@ -460,8 +458,6 @@ delete_datasets(hid_t file_id, int min_dset, int max_dset) if (show_progress) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); - return; - } /* delete_datasets() */ /*------------------------------------------------------------------------- @@ -850,8 +846,6 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, hbool_t read_onl if (show_progress) HDfprintf(stdout, "%s: cp = %d -- exiting.\n", fcn_name, cp++); - return; - } /* open_hdf5_file() */ /*------------------------------------------------------------------------- @@ -960,8 +954,6 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, const hbool_t set_mdci_fa if (show_progress) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); - return; - } /* attempt_swmr_open_hdf5_file() */ /*------------------------------------------------------------------------- @@ -1199,8 +1191,6 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) } } - return; - } /* verify_datasets() */ /****************************************************************************/ diff --git a/test/genall5.c b/test/genall5.c index b5ff862..a6331f6 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -103,8 +103,6 @@ ns_grp_0(hid_t fid, const char *group_name) HDassert(ret >= 0); } - return; - } /* ns_grp_0 */ /*------------------------------------------------------------------------- @@ -222,7 +220,6 @@ vrfy_ns_grp_0(hid_t fid, const char *group_name) HDassert(ret >= 0); } - return; } /* vrfy_ns_grp_0() */ /*------------------------------------------------------------------------- @@ -363,8 +360,6 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(ret >= 0); } - return; - } /* ns_grp_c() */ /*------------------------------------------------------------------------- @@ -640,7 +635,6 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(ret >= 0); } - return; } /* vrfy_ns_grp_c() */ /*------------------------------------------------------------------------- @@ -776,7 +770,6 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) HDassert(ret >= 0); } - return; } /* ns_grp_d() */ /*------------------------------------------------------------------------- @@ -1050,8 +1043,6 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) HDassert(ret >= 0); } - return; - } /* vrfy_ns_grp_d() */ /*------------------------------------------------------------------------- @@ -1140,7 +1131,6 @@ os_grp_0(hid_t fid, const char *group_name) } } - return; } /* os_grp_0() */ /*------------------------------------------------------------------------- @@ -1257,7 +1247,6 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) HDassert(ret >= 0); } - return; } /* vrfy_os_grp_0() */ /*------------------------------------------------------------------------- @@ -1377,7 +1366,6 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } } - return; } /* os_grp_n() */ /*------------------------------------------------------------------------- @@ -1603,7 +1591,6 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) HDassert(ret >= 0); } - return; } /* vrfy_os_grp_n() */ /*------------------------------------------------------------------------- @@ -1700,7 +1687,6 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) HDassert(ret >= 0); } - return; } /* ds_ctg_i */ /*------------------------------------------------------------------------- @@ -1919,8 +1905,6 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) HDassert(ret >= 0); } - return; - } /* vrfy_ds_ctg_i() */ /*------------------------------------------------------------------------- @@ -2047,7 +2031,6 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) HDassert(ret >= 0); } - return; } /* ds_chk_i */ /*------------------------------------------------------------------------- @@ -2281,7 +2264,6 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) HDassert(ret >= 0); } - return; } /* vrfy_ds_chk_i() */ /*------------------------------------------------------------------------- @@ -2409,8 +2391,6 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) HDassert(ret >= 0); } - return; - } /* ds_cpt_i() */ /*------------------------------------------------------------------------- @@ -2624,7 +2604,6 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) HDassert(ret >= 0); } - return; } /* vrfy_ds_cpt_i() */ /*------------------------------------------------------------------------- @@ -2773,7 +2752,6 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) HDassert(ret >= 0); } - return; } /* ds_ctg_v() */ /*------------------------------------------------------------------------- @@ -3038,7 +3016,6 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) HDassert(ret >= 0); } - return; } /* vrfy_ds_ctg_v() */ /*------------------------------------------------------------------------- @@ -3266,7 +3243,6 @@ create_zoo(hid_t fid, const char *base_path, int proc_num) vrfy_ds_ctg_v(fid, full_path, TRUE); } - return; } /* create_zoo() */ /*------------------------------------------------------------------------- @@ -3414,5 +3390,4 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num) vrfy_ds_ctg_v(fid, full_path, TRUE); } - return; } /* validate_zoo() */ diff --git a/test/h5test.c b/test/h5test.c index 49df75ef..6526c94 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -171,8 +171,6 @@ h5_clean_files(const char *base_name[], hid_t fapl) /* Close the FAPL used to access the file */ H5Pclose(fapl); - - return; } /* end h5_clean_files() */ /*------------------------------------------------------------------------- @@ -249,7 +247,6 @@ h5_delete_test_file(const char *base_name, hid_t fapl) HDremove(filename); } /* end driver selection tree */ - return; } /* end h5_delete_test_file() */ H5_GCC_DIAG_ON("format-nonliteral") @@ -282,7 +279,6 @@ h5_delete_all_test_files(const char *base_name[], hid_t fapl) h5_delete_test_file(base_name[i], fapl); } /* end for */ - return; } /* end h5_delete_all_test_files() */ /*------------------------------------------------------------------------- @@ -341,8 +337,6 @@ h5_test_shutdown(void) /* Restore the original error reporting routine */ h5_restore_err(); - - return; } /* end h5_test_shutdown() */ /*------------------------------------------------------------------------- @@ -449,8 +443,6 @@ h5_test_init(void) HDassert(err_func == NULL); H5Eget_auto2(H5E_DEFAULT, &err_func, NULL); H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); - - return; } /* end h5_test_init() */ /*------------------------------------------------------------------------- diff --git a/test/set_extent.c b/test/set_extent.c index 31fc5d9..6d639ad 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -2677,6 +2677,4 @@ test_random_rank4_dump(unsigned ndim_sets, hsize_t dim_log[][4], hsize_t cdims[4 (unsigned)dim_log[i][1], (unsigned)dim_log[i][2], (unsigned)dim_log[i][3]); if (j >= 0) HDprintf(" First incorrect value read: ( %d, %d, %d, %d )\n", j, k, l, m); - - return; } /* end test_random_rank4_dump */ diff --git a/test/tarray.c b/test/tarray.c index 089360d..0ea86e22 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1087,7 +1087,6 @@ test_array_free_custom(void *_mem, void *info) HDfree(mem); } /* end if */ - return; } /* end test_array_free_custom() */ /*------------------------------------------------------------------------- diff --git a/test/tmisc.c b/test/tmisc.c index 68fa06a..99cce68 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -517,7 +517,6 @@ test_misc2_write_attribute(void) HDfree(string_att1); HDfree(string_att2); - return; } static void @@ -563,8 +562,6 @@ test_misc2_read_attribute(const char *filename, const char *att_name) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - - return; } /**************************************************************** ** diff --git a/test/ttsafe.c b/test/ttsafe.c index 7b9a375..067a715 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -70,8 +70,6 @@ tts_is_threadsafe(void) if (is_ts != should_be) TestErrPrintf("Thread-safety value incorrect - test failed\n"); - - return; } /* Routine to generate attribute names for numeric values */ diff --git a/test/tvlstr.c b/test/tvlstr.c index 77b55a3..0503e62 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -659,8 +659,6 @@ test_write_vl_string_attribute(void) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - - return; } /**************************************************************** @@ -739,8 +737,6 @@ test_read_vl_string_attribute(void) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - - return; } /* Helper routine for test_vl_rewrite() */ @@ -864,8 +860,6 @@ test_vl_rewrite(void) ret = H5Fclose(file2); CHECK(ret, FAIL, "H5Fclose"); - - return; } /* end test_vl_rewrite() */ /**************************************************************** diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index f97ef50..23abea5 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -3536,8 +3536,6 @@ get_member_types(hid_t tid, mcomp_t *members) get_member_types(members->ids[u], members->m[u]); } } - - return; } /*------------------------------------------------------------------------- diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 471af51..2dc02bc 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -5097,7 +5097,6 @@ help(char *name) (void)HDfprintf(stdout, "\t data-set will be compressed using GZIP and a compression level \n"); (void)HDfprintf(stdout, "\t of 7.\n"); (void)HDfprintf(stdout, "\t The dataset will be stored at \"/Second-set\"\n\n"); - return; } void @@ -5107,5 +5106,4 @@ usage(char *name) (void)HDfprintf(stdout, "\t%s -c[onfig] \ [ -c[config] ...] -o[utfile] \n\n", name); - return; } diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index b2f4e9e..cf60a6a 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -5009,8 +5009,6 @@ error: H5Tclose(tid2); } H5E_END_TRY; - - return; } static hid_t @@ -8058,8 +8056,6 @@ error: H5Fclose(fid2); } H5E_END_TRY; - - return; } /*------------------------------------------------------------------------- diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 162dabe..903fdf6 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -6548,7 +6548,6 @@ out: H5Fclose(fid); } H5E_END_TRY; - return; } /*------------------------------------------------------------------------- @@ -6734,7 +6733,6 @@ out: H5Fclose(fid); } H5E_END_TRY; - return; } /*------------------------------------------------------------------------- @@ -6994,7 +6992,6 @@ out: H5Fclose(fid); } H5E_END_TRY; - return; } /*------------------------------------------------------------------------- -- cgit v0.12 From 150fb83345bbf9ff6659231ba3f5bcdd536fb35c Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Sat, 6 Mar 2021 03:34:25 +0100 Subject: fix block coordinate printing example (#437) --- examples/h5_vds.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/h5_vds.c b/examples/h5_vds.c index 6bef06f..e036204 100644 --- a/examples/h5_vds.c +++ b/examples/h5_vds.c @@ -60,7 +60,7 @@ main(void) hsize_t start_out[2], stride_out[2], count_out[2], block_out[2]; int wdata[DIM0], /* Write buffer for source dataset */ rdata[VDSDIM0][VDSDIM1], /* Read buffer for virtual dataset */ - i, j, k, l; + i, j, k, l, block_inc; int fill_value = -1; /* Fill value for VDS */ H5D_layout_t layout; /* Storage layout */ size_t num_map; /* Number of mappings */ @@ -178,13 +178,14 @@ main(void) buf = (hsize_t *)malloc(sizeof(hsize_t) * 2 * RANK2 * nblocks); status = H5Sget_select_hyper_blocklist(vspace, (hsize_t)0, nblocks, buf); for (l = 0; l < nblocks; l++) { + block_inc = 2 * RANK2 * l; printf("("); for (k = 0; k < RANK2 - 1; k++) - printf("%d,", (int)buf[k]); - printf("%d ) - (", (int)buf[k]); + printf("%d,", (int)buf[block_inc + k]); + printf("%d) - (", (int)buf[block_inc + k]); for (k = 0; k < RANK2 - 1; k++) - printf("%d,", (int)buf[RANK2 + k]); - printf("%d)\n", (int)buf[RANK2 + k]); + printf("%d,", (int)buf[block_inc + RANK2 + k]); + printf("%d)\n", (int)buf[block_inc + RANK2 + k]); } /* We also can use new APIs to get start, stride, count and block */ if (H5Sis_regular_hyperslab(vspace)) { -- cgit v0.12 From 5f376ccb3e8d242329a431b89bb4103500b1ad38 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 8 Mar 2021 09:26:58 -0500 Subject: Removed bad function pointer casts (#434) * Removed bad function pointer casts In one case fixed the actual function signature to be correct. * Reformat source with clang v10.0.1. Co-authored-by: Larry Knox --- c++/test/dsets.cpp | 14 +++++++------- c++/test/tfilter.cpp | 36 ++++++++++++++++++------------------ test/filter_plugin1_dsets.c | 16 ++++++++-------- test/filter_plugin2_dsets.c | 16 ++++++++-------- test/filter_plugin3_dsets.c | 16 ++++++++-------- test/filter_plugin4_groups.c | 16 ++++++++-------- tools/test/h5copy/dynlib_copy.c | 14 +++++++------- tools/test/h5diff/dynlib_diff.c | 14 +++++++------- tools/test/h5dump/dynlib_dump.c | 14 +++++++------- tools/test/h5dump/h5dumpgentest.c | 14 +++++++------- tools/test/h5ls/dynlib_ls.c | 14 +++++++------- tools/test/h5repack/dynlib_rpk.c | 14 +++++++------- tools/test/h5repack/dynlib_vrpk.c | 14 +++++++------- 13 files changed, 106 insertions(+), 106 deletions(-) diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 65949b6..03e4927 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -398,13 +398,13 @@ test_tconv(H5File &file) /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version number */ - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, /* Encode and decode enabled */ - "bogus", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)filter_bogus, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version number */ + H5Z_FILTER_BOGUS, /* Filter id number */ + 1, 1, /* Encode and decode enabled */ + "bogus", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 1ded033..2df88b2 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -49,20 +49,18 @@ static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl, /* Temporary filter IDs used for testing */ const int H5Z_FILTER_BOGUS = 305; -#if 0 // H5_ATTR_UNUSED variables caused warning, so duplicated below with NULL instead -static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); -#endif -static size_t filter_bogus(size_t nbytes); +static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf); + /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "bogus", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)filter_bogus, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- @@ -79,13 +77,15 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ *------------------------------------------------------------------------- */ static size_t -#if 0 // H5_ATTR_UNUSED variables caused warning, so duplicated below with NULL instead -filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, - const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, - size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) -#endif -filter_bogus(size_t nbytes) +filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) { + (void)flags; + (void)cd_nelmts; + (void)cd_values; + (void)buf_size; + (void)buf; + return nbytes; } diff --git a/test/filter_plugin1_dsets.c b/test/filter_plugin1_dsets.c index 7f9a664..5d6c1ef 100644 --- a/test/filter_plugin1_dsets.c +++ b/test/filter_plugin1_dsets.c @@ -26,14 +26,14 @@ static size_t add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned /* Filter class struct */ const H5Z_class2_t FILTER_INFO[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER1_ID, /* Filter ID number */ - 1, /* Encoding enabled */ - 1, /* Decoding enabled */ - "test filter plugin 1", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)add_sub_value, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER1_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 1", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + add_sub_value, /* The actual filter function */ }}; H5PL_type_t diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c index 4a881aa..d2011d4 100644 --- a/test/filter_plugin2_dsets.c +++ b/test/filter_plugin2_dsets.c @@ -27,14 +27,14 @@ static size_t mult_div_value(unsigned int flags, size_t cd_nelmts, const unsigne /* Filter class struct */ const H5Z_class2_t FILTER_INFO[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER2_ID, /* Filter ID number */ - 1, /* Encoding enabled */ - 1, /* Decoding enabled */ - "test filter plugin 2", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)mult_div_value, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER2_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + mult_div_value, /* The actual filter function */ }}; H5PL_type_t diff --git a/test/filter_plugin3_dsets.c b/test/filter_plugin3_dsets.c index 5d8d57f..618ce06 100644 --- a/test/filter_plugin3_dsets.c +++ b/test/filter_plugin3_dsets.c @@ -30,14 +30,14 @@ static size_t add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const uns /* Filter class struct */ const H5Z_class2_t FILTER_INFO[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER3_ID, /* Filter ID number */ - 1, /* Encoding enabled */ - 1, /* Decoding enabled */ - "test filter plugin 3", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)add_sub_value_hdf5, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER3_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 3", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + add_sub_value_hdf5, /* The actual filter function */ }}; H5PL_type_t diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c index c948491..630dcd6 100644 --- a/test/filter_plugin4_groups.c +++ b/test/filter_plugin4_groups.c @@ -29,14 +29,14 @@ static size_t append_to_group_name(unsigned int flags, size_t cd_nelmts, const u /* Filter class struct */ const H5Z_class2_t FILTER_INFO[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER4_ID, /* Filter ID number */ - 1, /* Encoding enabled */ - 1, /* Decoding enabled */ - "test filter plugin 4", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)append_to_group_name, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER4_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 4", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + append_to_group_name, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index 56be5a6..b954a22 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -25,13 +25,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index cebe53c..433522d 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -25,13 +25,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index cebe53c..433522d 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -25,13 +25,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 903fdf6..5178f25 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -154,13 +154,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; /* A UD link traversal function. Shouldn't actually be called. */ diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index cebe53c..433522d 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -25,13 +25,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c index e64e67b..b228344 100644 --- a/tools/test/h5repack/dynlib_rpk.c +++ b/tools/test/h5repack/dynlib_rpk.c @@ -27,13 +27,13 @@ static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const uns /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIB1[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB1, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib1", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB1, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib1", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlib1, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5repack/dynlib_vrpk.c b/tools/test/h5repack/dynlib_vrpk.c index 2db97da..5eac4f2 100644 --- a/tools/test/h5repack/dynlib_vrpk.c +++ b/tools/test/h5repack/dynlib_vrpk.c @@ -27,13 +27,13 @@ static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, const uns /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIB4[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB4, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib4", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB4, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib4", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlib4, /* The actual filter function */ }}; H5PL_type_t -- cgit v0.12 From c41a1cb2094ae0cc5fb40671181ce4e9f73ba9dc Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 9 Mar 2021 11:59:44 -0500 Subject: =?UTF-8?q?Applied=20clang-tidy=20readability-non-const-parameter?= =?UTF-8?q?=20warning=20fixes=20auto=E2=80=A6=20(#429)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Automatically applied clang-tidy readability-avoid-const-params-in-decls fixes Removes useless const declarations. * Fixed most readability-non-const-parameter warnings These changes were made automatically by clang-tidy, but I manually reverted the changes related to the H5Z_func_t signature. * Reformat source with clang v10.0.1. Co-authored-by: Larry Knox --- hl/test/test_file_image.c | 2 +- hl/test/test_ld.c | 5 +++-- hl/tools/gif2h5/gif.h | 6 +++--- hl/tools/gif2h5/gifread.c | 2 +- hl/tools/gif2h5/hdfgifwr.c | 4 ++-- hl/tools/h5watch/h5watch.c | 4 ++-- src/H5Dchunk.c | 2 +- src/H5Dpkg.h | 3 ++- src/H5Tbit.c | 2 +- src/H5Tpkg.h | 3 ++- src/H5Znbit.c | 36 ++++++++++++++++++----------------- src/H5Zscaleoffset.c | 14 +++++++------- src/H5Ztrans.c | 3 +-- test/chunk_info.c | 10 +++++----- test/dt_arith.c | 7 ++++--- test/dtransform.c | 8 ++++---- test/fillval.c | 2 +- test/tselect.c | 2 +- test/vfd.c | 4 ++-- tools/lib/h5diff_attr.c | 2 +- tools/lib/h5tools.c | 6 +++--- tools/lib/h5tools.h | 7 ++++--- tools/lib/h5tools_dump.c | 12 ++++++------ tools/lib/h5tools_str.c | 2 +- tools/lib/h5tools_str.h | 2 +- tools/lib/h5trav.c | 2 +- tools/lib/h5trav.h | 3 ++- tools/src/h5repack/h5repack.h | 14 +++++++------- tools/src/h5repack/h5repack_copy.c | 6 +++--- tools/src/h5repack/h5repack_filters.c | 14 +++++++------- 30 files changed, 98 insertions(+), 91 deletions(-) diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index c20112f..f820568 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -51,7 +51,7 @@ *------------------------------------------------------------------------- */ static int -test_file_image(size_t open_images, size_t nflags, unsigned *flags) +test_file_image(size_t open_images, size_t nflags, const unsigned *flags) { hid_t * file_id, *dset_id, file_space, plist; /* HDF5 ids */ hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */ diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c index 06cb600..02a56f4 100644 --- a/hl/test/test_ld.c +++ b/hl/test/test_ld.c @@ -157,7 +157,8 @@ static herr_t test_LD_elmts_invalid(const char *file); static herr_t test_LD_elmts_one(const char *file, const char *dname, const char *fields); static herr_t test_LD_elmts_two(const char *file, const char *dname, const char *fields); -static herr_t verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf); +static herr_t verify_elmts_two(int type, const hsize_t *ext_dims, const hsize_t *prev_dims, void *_ldbuf, + void *_buf); /* data structures for compound data type */ typedef struct sub22_t { @@ -1135,7 +1136,7 @@ error: ************************************************************************************** */ static herr_t -verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf) +verify_elmts_two(int type, const hsize_t *ext_dims, const hsize_t *prev_dims, void *_ldbuf, void *_buf) { int k, m; /* Local index variable */ diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h index 2b4a344..1a8cfe4 100644 --- a/hl/tools/gif2h5/gif.h +++ b/hl/tools/gif2h5/gif.h @@ -157,8 +157,8 @@ int ReadGifApplication(GIFAPPLICATION *, GIFBYTE **); int ReadGifComment(GIFCOMMENT *, GIFBYTE **); /* HDFGIFWR.C */ -int hdfWriteGIF(FILE *fp, GIFBYTE *pic, int ptype, int w, int h, GIFBYTE *rmap, GIFBYTE *gmap, GIFBYTE *bmap, - GIFBYTE *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel); +int hdfWriteGIF(FILE *fp, GIFBYTE *pic, int ptype, int w, int h, const GIFBYTE *rmap, const GIFBYTE *gmap, + const GIFBYTE *bmap, const GIFBYTE *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel); /* WRITEHDF.C */ int WriteHDF(GIFTOMEM, GIFCHAR *); @@ -176,7 +176,7 @@ int ReadHDF(GIFBYTE **data, GIFBYTE palette[256][3], hsize_t *image_size, GIFCHA GIFCHAR *dset_name, GIFCHAR *pal_name); GIFBYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *); -GIFBYTE GetByte(GIFBYTE *); +GIFBYTE GetByte(const GIFBYTE *); GIFWORD GetWord(GIFBYTE *); void cleanup(GIFBYTE *); diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index b88264b..ef2bdd4 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -38,7 +38,7 @@ GetWord(GIFBYTE *MemGif) } GIFBYTE -GetByte(GIFBYTE *MemGif) { return *MemGif; } +GetByte(const GIFBYTE *MemGif) { return *MemGif; } /* * Read a GIF image GIFBYTE Header. diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c index 8068829..21b14d1 100644 --- a/hl/tools/gif2h5/hdfgifwr.c +++ b/hl/tools/gif2h5/hdfgifwr.c @@ -135,8 +135,8 @@ static int EOFCode; /*************************************************************/ int -hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, byte *gmap, byte *bmap, byte *pc2ncmap, - int numcols, int colorstyle, int BitsPerPixel) +hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, const byte *rmap, const byte *gmap, + const byte *bmap, const byte *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel) { int InitCodeSize; int i; diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c index 8d7f4ec..a5e82ca 100644 --- a/hl/tools/h5watch/h5watch.c +++ b/hl/tools/h5watch/h5watch.c @@ -43,7 +43,7 @@ static unsigned g_retry = DEFAULT_RETRY; /* # of times to try opening the file static hbool_t g_display_hex = FALSE; /* display data in hexadecimal format : LATER */ static hbool_t g_user_interrupt = FALSE; /* Flag to indicate that user interrupted execution */ -static herr_t doprint(hid_t did, hsize_t *start, hsize_t *block, int rank); +static herr_t doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank); static herr_t slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims, hsize_t *start, hsize_t *block, int rank, int subrank); static herr_t monitor_dataset(hid_t fid, char *dsetname); @@ -95,7 +95,7 @@ static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no *------------------------------------------------------------------------- */ static herr_t -doprint(hid_t did, hsize_t *start, hsize_t *block, int rank) +doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank) { h5tools_context_t ctx; /* print context */ h5tool_format_t info; /* Format info for the tools library */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 9d47a4a..b6f1e8b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4258,7 +4258,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]) +H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const hsize_t old_dim[]) { const H5D_t * dset = io_info->dset; /* the dataset pointer */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 61b1a87..64f2c7a 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -631,7 +631,8 @@ H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage); H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset); H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata); H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes); -H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); +H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, + const hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled); H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]); diff --git a/src/H5Tbit.c b/src/H5Tbit.c index c35a530..e2ca4b9 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -388,7 +388,7 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) *------------------------------------------------------------------------- */ ssize_t -H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value) +H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value) { ssize_t base = (ssize_t)offset; ssize_t idx, i; diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 0fe4f50..51ecaca 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -852,7 +852,8 @@ H5_DLL herr_t H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, H5_DLL void H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value); H5_DLL uint64_t H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size); H5_DLL void H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val); -H5_DLL ssize_t H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value); +H5_DLL ssize_t H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, + hbool_t value); H5_DLL hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size); H5_DLL hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size); H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size); diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 2b6f277..b696085 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -52,17 +52,19 @@ static herr_t H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index, static herr_t H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[], hbool_t *need_not_compress); -static void H5Z__nbit_next_byte(size_t *j, size_t *buf_len); -static void H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, +static void H5Z__nbit_next_byte(size_t *j, size_t *buf_len); +static void H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, + unsigned begin_i, unsigned end_i, const unsigned char *buffer, + size_t *j, size_t *buf_len, const parms_atomic *p, + size_t datatype_len); +static void H5Z__nbit_compress_one_byte(const unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p, size_t datatype_len); -static void H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, - unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, - const parms_atomic *p, size_t datatype_len); -static void H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, - size_t *j, size_t *buf_len, unsigned size); -static void H5Z__nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, - size_t *j, size_t *buf_len, const parms_atomic *p); +static void H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, + const unsigned char *buffer, size_t *j, size_t *buf_len, + unsigned size); +static void H5Z__nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, + size_t *j, size_t *buf_len, const parms_atomic *p); static herr_t H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index); @@ -71,8 +73,8 @@ static herr_t H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data const unsigned parms[], unsigned *parms_index); static herr_t H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, const unsigned parms[]); -static void H5Z__nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, - size_t *j, size_t *buf_len, unsigned size); +static void H5Z__nbit_compress_one_nooptype(const unsigned char *data, size_t data_offset, + unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size); static void H5Z__nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index); @@ -1026,7 +1028,7 @@ H5Z__nbit_next_byte(size_t *j, size_t *buf_len) static void H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, - unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, + unsigned end_i, const unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p, size_t datatype_len) { size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */ @@ -1075,8 +1077,8 @@ H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned } static void -H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, - size_t *buf_len, unsigned size) +H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, const unsigned char *buffer, + size_t *j, size_t *buf_len, unsigned size) { unsigned i; /* index */ size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */ @@ -1341,7 +1343,7 @@ done: } static void -H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, +H5Z__nbit_compress_one_byte(const unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p, size_t datatype_len) { @@ -1383,8 +1385,8 @@ H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, } static void -H5Z__nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, - size_t *buf_len, unsigned size) +H5Z__nbit_compress_one_nooptype(const unsigned char *data, size_t data_offset, unsigned char *buffer, + size_t *j, size_t *buf_len, unsigned size) { unsigned i; /* index */ size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index b8033fe..3a08a07 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -73,9 +73,9 @@ static herr_t H5Z__scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, uint32_t minbits, unsigned long long minval, double D_val); static void H5Z__scaleoffset_next_byte(size_t *j, unsigned *buf_len); static void H5Z__scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, - unsigned begin_i, unsigned char *buffer, size_t *j, + unsigned begin_i, const unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p, unsigned dtype_len); -static void H5Z__scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, +static void H5Z__scaleoffset_compress_one_byte(const unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p, unsigned dtype_len); static void H5Z__scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, @@ -1608,8 +1608,8 @@ H5Z__scaleoffset_next_byte(size_t *j, unsigned *buf_len) static void H5Z__scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, - unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p, - unsigned dtype_len) + const unsigned char *buffer, size_t *j, unsigned *buf_len, + parms_atomic p, unsigned dtype_len) { unsigned dat_len; /* dat_len is the number of bits to be copied in each data byte */ unsigned char val; /* value to be copied in each data byte */ @@ -1694,9 +1694,9 @@ H5Z__scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned cha } static void -H5Z__scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, - unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p, - unsigned dtype_len) +H5Z__scaleoffset_compress_one_byte(const unsigned char *data, size_t data_offset, unsigned k, + unsigned begin_i, unsigned char *buffer, size_t *j, unsigned *buf_len, + parms_atomic p, unsigned dtype_len) { unsigned dat_len; /* dat_len is the number of bits to be copied in each data byte */ unsigned char val; /* value to be copied in each data byte */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index ef7d801..7d55efd 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -90,8 +90,7 @@ static void H5Z__do_op(H5Z_node *tree); static hbool_t H5Z__op_is_numbs(H5Z_node *_tree); static hbool_t H5Z__op_is_numbs2(H5Z_node *_tree); static hid_t H5Z__xform_find_type(const H5T_t *type); -static herr_t H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type, - H5Z_result *res); +static herr_t H5Z__xform_eval_full(H5Z_node *tree, size_t array_size, hid_t array_type, H5Z_result *res); static void H5Z__xform_destroy_parse_tree(H5Z_node *tree); static void * H5Z__xform_parse(const char *expression, H5Z_datval_ptrs *dat_val_pointers); static void * H5Z__xform_copy_tree(H5Z_node *tree, H5Z_datval_ptrs *dat_val_pointers, diff --git a/test/chunk_info.c b/test/chunk_info.c index 0298db4..6f71cb2 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -127,7 +127,7 @@ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size); static int verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks); static int verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, - hsize_t *exp_offset, unsigned exp_flt_msk); + const hsize_t *exp_offset, unsigned exp_flt_msk); static int verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size, unsigned exp_flt_msk); static int verify_empty_chunk_info(hid_t dset, hsize_t *offset); @@ -169,8 +169,8 @@ reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size) *------------------------------------------------------------------------- */ static int -verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset, - unsigned exp_flt_msk) +verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, + const hsize_t *exp_offset, unsigned exp_flt_msk) { unsigned read_flt_msk = 0; /* Read filter mask */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ @@ -302,7 +302,7 @@ index_type_str(H5D_chunk_index_t idx_type) *------------------------------------------------------------------------- */ static int -verify_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end) +verify_selected_chunks(hid_t dset, hid_t plist, const hsize_t *start, const hsize_t *end) { int read_buf[CHUNK_NX][CHUNK_NY]; int expected_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Expected data */ @@ -364,7 +364,7 @@ error: *------------------------------------------------------------------------- */ static int -write_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end, unsigned flt_msk) +write_selected_chunks(hid_t dset, hid_t plist, const hsize_t *start, const hsize_t *end, unsigned flt_msk) { int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */ hsize_t offset[2]; /* Offset coordinates of a chunk */ diff --git a/test/dt_arith.c b/test/dt_arith.c index de2e4c3..81b4b46 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -397,8 +397,8 @@ static int without_hardware_g = 0; void some_dummy_func(float x); static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits); static int my_isnan(dtype_t type, void *val); -static int my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, - size_t esize); +static int my_isinf(int endian, const unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, + size_t esize); /*------------------------------------------------------------------------- * Function: fpe_handler @@ -2853,7 +2853,8 @@ my_isnan(dtype_t type, void *val) *------------------------------------------------------------------------- */ static int -my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize) +my_isinf(int endian, const unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, + size_t esize) { unsigned char *bits; int retval = 0; diff --git a/test/dtransform.c b/test/dtransform.c index 23d09ac..e78f857 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -18,12 +18,12 @@ #define FLOAT_TOL 0.0001F static int init_test(hid_t file_id); -static int test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy); -static int test_trivial(const hid_t dxpl_id_simple); -static int test_poly(const hid_t dxpl_id_polynomial); +static int test_copy(hid_t dxpl_id_c_to_f_copy, hid_t dxpl_id_polynomial_copy); +static int test_trivial(hid_t dxpl_id_simple); +static int test_poly(hid_t dxpl_id_polynomial); static int test_specials(hid_t file); static int test_set(void); -static int test_getset(const hid_t dxpl_id_simple); +static int test_getset(hid_t dxpl_id_simple); /* These are needed for multiple tests, so are declared here globally and are init'ed in init_test */ hid_t dset_id_int = -1; diff --git a/test/fillval.c b/test/fillval.c index 80d8f9a..8a9b41f 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -1586,7 +1586,7 @@ test_extend_release_cmpd_vl(void *_elmt) *------------------------------------------------------------------------- */ static int -test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, hsize_t *ch_size, hsize_t *start_size, +test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, const hsize_t *ch_size, hsize_t *start_size, hsize_t *max_size, hid_t dtype, void *fillval) { hid_t fspace = -1, mspace = -1; /* File & memory dataspaces */ diff --git a/test/tselect.c b/test/tselect.c index 8ecbf48..c5d779f 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -2561,7 +2561,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist) static void test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, unsigned tgt_n_cube_rank, unsigned edge_size, unsigned checker_edge_size, - unsigned sel_rank, hsize_t sel_start[]) + unsigned sel_rank, const hsize_t sel_start[]) { hbool_t first_selection = TRUE; unsigned n_cube_offset; diff --git a/test/vfd.c b/test/vfd.c index 6e1cb31..19b119e 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -99,7 +99,7 @@ static int splitter_create_single_file_at(const char *filename, hid_t fapl_id, const struct splitter_dataset_def *data); static int splitter_compare_expected_data(hid_t file_id, const struct splitter_dataset_def *data); static int run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_errors, - hbool_t provide_logfile_path, hid_t sub_fapl_ids[2]); + hbool_t provide_logfile_path, const hid_t sub_fapl_ids[2]); static int splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id); static int splitter_tentative_open_test(hid_t child_fapl_id); static int file_exists(const char *filename, hid_t fapl_id); @@ -2336,7 +2336,7 @@ done: */ static int run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_errors, - hbool_t provide_logfile_path, hid_t sub_fapl_ids[2]) + hbool_t provide_logfile_path, const hid_t sub_fapl_ids[2]) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index c5966da..5c1777a 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -104,7 +104,7 @@ table_attrs_free(table_attrs_t *table) * Date: March 15, 2011 *------------------------------------------------------------------------*/ static void -table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *table) +table_attr_mark_exist(const unsigned *exist, char *name, table_attrs_t *table) { if (table->nattrs == table->size) { match_attr_t *new_attrs; diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 3b78491..4d19f1f 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1609,7 +1609,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools *------------------------------------------------------------------------- */ void -init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx) +init_acc_pos(unsigned ndims, const hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx) { int i; unsigned j; @@ -1642,7 +1642,7 @@ init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *------------------------------------------------------------------------- */ hsize_t -calc_acc_pos(unsigned ndims, hsize_t elmtno, hsize_t *acc, hsize_t *pos) +calc_acc_pos(unsigned ndims, hsize_t elmtno, const hsize_t *acc, hsize_t *pos) { int i; hsize_t curr_pos = elmtno; @@ -1913,7 +1913,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t */ int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container, unsigned ndims, - hid_t type_id, hsize_t nblocks, hsize_t *ptdata) + hid_t type_id, hsize_t nblocks, const hsize_t *ptdata) { hsize_t *dims1 = NULL; hsize_t *start = NULL; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index a972fd9..9d065f3 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -672,8 +672,9 @@ H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type); H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid); H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid); H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2); -H5TOOLS_DLL void init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx); -H5TOOLS_DLL hsize_t calc_acc_pos(unsigned ndims, hsize_t elemtno, hsize_t *acc, hsize_t *pos); +H5TOOLS_DLL void init_acc_pos(unsigned ndims, const hsize_t *dims, hsize_t *acc, hsize_t *pos, + hsize_t *p_min_idx); +H5TOOLS_DLL hsize_t calc_acc_pos(unsigned ndims, hsize_t elemtno, const hsize_t *acc, hsize_t *pos); H5TOOLS_DLL hbool_t h5tools_is_zero(const void *_mem, size_t size); H5TOOLS_DLL int h5tools_canreadf(const char *name, hid_t dcpl_id); H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn); @@ -687,7 +688,7 @@ H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_ H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts); H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, - hsize_t *ptdata); + const hsize_t *ptdata); H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index d31490c..9725cf6 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1257,12 +1257,12 @@ done: static herr_t h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type, hid_t f_space, hsize_t hyperslab_count, - hsize_t * temp_start, /* start inside offset count loop */ - hsize_t * temp_count, /* count inside offset count loop */ - hsize_t * temp_block, /* block size used in loop */ - hsize_t * temp_stride, /* stride size used in loop */ - hsize_t * total_size, /* total size of dataset */ - unsigned int row_dim) /* index of row_counter dimension */ + hsize_t * temp_start, /* start inside offset count loop */ + hsize_t * temp_count, /* count inside offset count loop */ + hsize_t * temp_block, /* block size used in loop */ + hsize_t * temp_stride, /* stride size used in loop */ + const hsize_t *total_size, /* total size of dataset */ + unsigned int row_dim) /* index of row_counter dimension */ { size_t i; /* counters */ size_t j; /* counters */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 6eaded2..d509c54 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -323,7 +323,7 @@ h5tools_str_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t *info, h */ char * h5tools_str_region_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t *info, hsize_t elmtno, - hsize_t *ptdata, h5tools_context_t *ctx) + const hsize_t *ptdata, h5tools_context_t *ctx) { size_t i = 0; diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index c207a83..eee87c9 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -36,7 +36,7 @@ H5TOOLS_DLL char * h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t * new functions needed to display region reference data */ H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, hsize_t elmtno, - hsize_t *ptdata, h5tools_context_t *ctx); + const hsize_t *ptdata, h5tools_context_t *ctx); H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx); H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 042288c..41dcd6b 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -731,7 +731,7 @@ trav_table_addlink(trav_table_t *table, const H5O_token_t *obj_token, const char *------------------------------------------------------------------------- */ void -trav_table_addflags(unsigned *flags, char *name, h5trav_type_t type, trav_table_t *table) +trav_table_addflags(const unsigned *flags, char *name, h5trav_type_t type, trav_table_t *table) { size_t new_obj; diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index c7b9db7..7a8a63d 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -187,6 +187,7 @@ H5TOOLS_DLL void trav_table_init(hid_t fid, trav_table_t **table); H5TOOLS_DLL void trav_table_free(trav_table_t *table); -H5TOOLS_DLL void trav_table_addflags(unsigned *flags, char *objname, h5trav_type_t type, trav_table_t *table); +H5TOOLS_DLL void trav_table_addflags(const unsigned *flags, char *objname, h5trav_type_t type, + trav_table_t *table); #endif /* H5TRAV_H */ diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index 0838c21..74525f4 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -195,13 +195,13 @@ void init_packobject(pack_info_t *obj); *------------------------------------------------------------------------- */ -int apply_filters(const char *name, /* object name from traverse list */ - int rank, /* rank of dataset */ - hsize_t * dims, /* dimensions of dataset */ - size_t msize, /* size of type */ - hid_t dcpl_id, /* dataset creation property list */ - pack_opt_t *options, /* repack options */ - int * has_filter); /* (OUT) object NAME has a filter */ +int apply_filters(const char * name, /* object name from traverse list */ + int rank, /* rank of dataset */ + const hsize_t *dims, /* dimensions of dataset */ + size_t msize, /* size of type */ + hid_t dcpl_id, /* dataset creation property list */ + pack_opt_t * options, /* repack options */ + int * has_filter); /* (OUT) object NAME has a filter */ /*------------------------------------------------------------------------- * options table diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 0aef710..72e2147 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -37,7 +37,7 @@ * local functions *------------------------------------------------------------------------- */ -static int get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, +static int get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t *hslab_nbytes_p); static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr); static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options); @@ -406,8 +406,8 @@ done: *-----------------------------------------*/ int -get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], - hsize_t *hslab_nbytes_p) +get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t size_datum, + hsize_t dims_hslab[], hsize_t *hslab_nbytes_p) { int k; H5D_layout_t dset_layout; diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 66fdf45..32476ce 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -236,13 +236,13 @@ aux_assign_obj(const char * name, /* object name from traverse list */ */ int -apply_filters(const char *name, /* object name from traverse list */ - int rank, /* rank of dataset */ - hsize_t * dims, /* dimensions of dataset */ - size_t msize, /* size of type */ - hid_t dcpl_id, /* dataset creation property list */ - pack_opt_t *options, /* repack options */ - int * has_filter) /* (OUT) object NAME has a filter */ +apply_filters(const char * name, /* object name from traverse list */ + int rank, /* rank of dataset */ + const hsize_t *dims, /* dimensions of dataset */ + size_t msize, /* size of type */ + hid_t dcpl_id, /* dataset creation property list */ + pack_opt_t * options, /* repack options */ + int * has_filter) /* (OUT) object NAME has a filter */ { int nfilters; /* number of filters in DCPL */ hsize_t chsize[64]; /* chunk size in elements */ -- cgit v0.12 From 20c452fe5c0955a81ae1222d846632f1525f08f4 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 10 Mar 2021 12:51:45 -0500 Subject: Removed checks/workarounds for pre-C++89 compatibility (#449) After 30+ years, just assume that the following exist: - extension-less includes - namespaces - std:: - static_cast - bool --- CMakeLists.txt | 3 -- c++/examples/chunks.cpp | 4 --- c++/examples/compound.cpp | 4 --- c++/examples/create.cpp | 4 --- c++/examples/extend_ds.cpp | 4 --- c++/examples/h5group.cpp | 4 --- c++/examples/readdata.cpp | 4 --- c++/examples/testh5c++.sh.in | 36 ++++------------------- c++/examples/writedata.cpp | 4 --- c++/src/H5Attribute.cpp | 4 --- c++/src/H5DataSet.cpp | 4 --- c++/src/H5DataSpace.cpp | 4 --- c++/src/H5DataType.cpp | 4 --- c++/src/H5Exception.h | 4 --- c++/src/H5FaccProp.cpp | 4 --- c++/src/H5File.cpp | 4 --- c++/src/H5Group.cpp | 4 --- c++/src/H5Include.h | 13 --------- c++/src/H5PropList.cpp | 4 --- c++/test/dsets.cpp | 4 --- c++/test/h5cpputil.cpp | 4 --- c++/test/tarray.cpp | 4 --- c++/test/tattr.cpp | 4 --- c++/test/tcompound.cpp | 4 --- c++/test/tdspl.cpp | 4 --- c++/test/testhdf5.cpp | 4 --- c++/test/tfile.cpp | 4 --- c++/test/tfilter.cpp | 4 --- c++/test/th5s.cpp | 4 --- c++/test/titerate.cpp | 4 --- c++/test/tlinks.cpp | 4 --- c++/test/tobject.cpp | 4 --- c++/test/trefer.cpp | 4 --- c++/test/ttypes.cpp | 4 --- c++/test/tvlstr.cpp | 4 --- config/cmake_ext_mod/HDFCXXTests.cpp | 56 ------------------------------------ config/cmake_ext_mod/HDFUseCXX.cmake | 5 ---- 37 files changed, 6 insertions(+), 235 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04e34f1..9809339 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1107,9 +1107,6 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") include (${HDF_RESOURCES_EXT_DIR}/HDFUseCXX.cmake) include (${HDF_RESOURCES_DIR}/HDFCXXCompilerFlags.cmake) - if (CMAKE_NO_STD_NAMESPACE) - set (H5_NO_STD 1) - endif () add_subdirectory (c++) if (HDF5_BUILD_HL_LIB) if (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++") diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp index 365a7da..3717fcb 100644 --- a/c++/examples/chunks.cpp +++ b/c++/examples/chunks.cpp @@ -16,11 +16,7 @@ * We will read from the file created by extend.cpp */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp index 31a572a..8975845 100644 --- a/c++/examples/compound.cpp +++ b/c++/examples/compound.cpp @@ -17,11 +17,7 @@ * and read back fields' subsets. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp index ef2de36..e55230f 100644 --- a/c++/examples/create.cpp +++ b/c++/examples/create.cpp @@ -15,11 +15,7 @@ * This example writes a dataset to a new HDF5 file. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Cpp.h" diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp index e69c1c0..24f5f3e 100644 --- a/c++/examples/extend_ds.cpp +++ b/c++/examples/extend_ds.cpp @@ -18,11 +18,7 @@ * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include using std::cout; diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index 793ff8f..f9ec176 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -20,11 +20,7 @@ * the C version is used in this example. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp index 7441420..e247a8e 100644 --- a/c++/examples/readdata.cpp +++ b/c++/examples/readdata.cpp @@ -17,11 +17,7 @@ // information about the dataset in the SDS.h5 file is obtained. // -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/testh5c++.sh.in b/c++/examples/testh5c++.sh.in index 46fe5eb..44dc9e7 100644 --- a/c++/examples/testh5c++.sh.in +++ b/c++/examples/testh5c++.sh.in @@ -67,11 +67,7 @@ temp_FILES="a.out $applib" cat > $appmain < -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include "H5Cpp.h" @@ -95,19 +91,11 @@ EOF # generate prog1 cat > $prog1 < -#else - #include -#endif +#include #include -#ifndef H5_NO_NAMESPACE -#ifndef H5_NO_STD - using std::cout; - using std::endl; -#endif // H5_NO_STD -#endif +using std::cout; +using std::endl; int sub1(void) { cout << "in sub1" << endl; @@ -117,19 +105,11 @@ EOF # generate prog2 cat > $prog2 < -#else - #include -#endif +#include #include -#ifndef H5_NO_NAMESPACE -#ifndef H5_NO_STD - using std::cout; - using std::endl; -#endif // H5_NO_STD -#endif +using std::cout; +using std::endl; int sub2(void) { cout << "in sub2" << endl; @@ -142,11 +122,7 @@ EOF cat > $hdf5main < -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include "H5Cpp.h" diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp index ddd3460..f2b715a 100644 --- a/c++/examples/writedata.cpp +++ b/c++/examples/writedata.cpp @@ -20,11 +20,7 @@ * file is closed. Program reopens the file and reads and displays the result. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 81e656f..d893fec 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5private.h" // for HDfree diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 9027d79..5dc44b8 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5private.h" // for HDfree diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 9c997d1..0485530 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index a943a55..1689912 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 566c818..18974fc 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -18,11 +18,7 @@ #include namespace H5 { -#ifdef H5_NO_STD -#define H5std_string ::string -#else #define H5std_string std::string -#endif /*! \class Exception \brief Exception provides wrappers of HDF5 error handling functions. diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index c8c2b24..8166d05 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include using std::cerr; diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index cdc9b45..bbdcd6b 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 392f31a..2fc6899 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index 1f03150..e662d90 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -14,19 +14,6 @@ #include -// Define bool type for platforms that don't support bool yet -#ifdef BOOL_NOTDEFINED -#ifdef false -#undef false -#endif -#ifdef true -#undef true -#endif -typedef int bool; -const bool false = 0; -const bool true = 1; -#endif - // These are defined in H5Opkg.h, which should not be included in the C++ API, // so re-define them here for now. diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 3780220..c4eda5e 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 03e4927..93c266f 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -23,11 +23,7 @@ ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index e38b34a..d42fc8c 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -19,11 +19,7 @@ ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index ab66174..7525c5f 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -16,11 +16,7 @@ tarray.cpp - HDF5 C++ testing the array datatype functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 047d360..e659e8e 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -17,11 +17,7 @@ C attribute interface (H5A) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 641002e..4c5e3e0 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -16,11 +16,7 @@ tcompound.cpp - HDF5 C++ testing the compound data type functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index fc73a6a..257233e 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -17,11 +17,7 @@ list functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index da5e2a4..71428ce 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -38,11 +38,7 @@ GetTestNumErrs() -- Retrieve the number of testing errors ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index b082f0a..5e4e91b 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -20,11 +20,7 @@ h5_fileaccess() -- in h5test.c, returns a file access template ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 2df88b2..e89838c 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -16,11 +16,7 @@ tfilter.cpp - HDF5 C++ testing various filters and their combination. ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index e57ac04..a005170 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -19,11 +19,7 @@ EXTERNAL ROUTINES/VARIABLES: ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index 1fb2f57..17620ca 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -16,11 +16,7 @@ titerate.cpp - HDF5 C++ testing iterate related functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 231bff2..22e69da 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -16,11 +16,7 @@ C link interface (H5L) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 87abd43..5892f39 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -16,11 +16,7 @@ tobject.cpp - HDF5 C++ testing object related functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Cpp.h" // C++ API header file diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 5ec04cd..939b0ee 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -17,11 +17,7 @@ Reference interface (H5R) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index cf32b2b..5fc82a5 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -16,11 +16,7 @@ ttypes.cpp - HDF5 C++ testing the general datatype functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 5d671d1..780d1b9 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -18,11 +18,7 @@ EXTERNAL ROUTINES/VARIABLES: ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/config/cmake_ext_mod/HDFCXXTests.cpp b/config/cmake_ext_mod/HDFCXXTests.cpp index f05151b..08ccb34 100644 --- a/config/cmake_ext_mod/HDFCXXTests.cpp +++ b/config/cmake_ext_mod/HDFCXXTests.cpp @@ -10,62 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME - -#include - -int main(void) { return 0; } - -#endif - - -#ifdef HDF_NO_NAMESPACE - -namespace HDF { -int fnord; -} - -int main(void) { - using namespace HDF; - fnord = 37; - return 0; -} - -#endif - -#ifdef HDF_NO_STD - -#include - -using namespace std; - -int main(void) { - string myString("testing namespace std"); - return 0; -} - -#endif - -#ifdef BOOL_NOTDEFINED -int main(void) { - bool flag; - return 0; -} - -#endif - -#ifdef NO_STATIC_CAST - -int main(void) { - float test_float; - int test_int; - test_float = 37.0; - test_int = static_cast (test_float); - return 0; -} - -#endif - #ifdef CXX_HAVE_OFFSETOF #include diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake index 28e7f8a..580c409 100644 --- a/config/cmake_ext_mod/HDFUseCXX.cmake +++ b/config/cmake_ext_mod/HDFUseCXX.cmake @@ -103,11 +103,6 @@ endmacro () #----------------------------------------------------------------------------- if (CMAKE_CXX_COMPILER_LOADED) foreach (cxx_test - OLD_HEADER_FILENAME - HDF_NO_NAMESPACE - HDF_NO_STD - BOOL_NOTDEFINED - NO_STATIC_CAST CXX_HAVE_OFFSETOF ) HDF_CXX_FUNCTION_TEST (${cxx_test}) -- cgit v0.12 From 7501f96ab9605e11c58bc0c9e6412e4db30ba7db Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 10 Mar 2021 12:52:48 -0500 Subject: Added C++11 override keyword where appropriate (#433) Added H5_OVERRIDE macro for compatibility with both C++11 and older. --- c++/src/H5DataSpace.h | 8 ++++---- c++/src/H5Exception.h | 24 ++++++++++++------------ c++/src/H5File.h | 12 ++++++------ c++/src/H5Group.h | 14 +++++++------- c++/src/H5Include.h | 7 +++++++ c++/src/H5Object.h | 6 +++--- 6 files changed, 39 insertions(+), 32 deletions(-) diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index f16acfc..470de74 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -43,7 +43,7 @@ class H5_DLLCPP DataSpace : public IdComponent { DataSpace &operator=(const DataSpace &rhs); // Closes this dataspace. - virtual void close(); + virtual void close() H5_OVERRIDE; // Makes copy of an existing dataspace. void copy(const DataSpace &like_space); @@ -115,13 +115,13 @@ class H5_DLLCPP DataSpace : public IdComponent { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("DataSpace"); } // Gets the dataspace id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // Deletes the global constant static void deleteConstants(); @@ -133,7 +133,7 @@ class H5_DLLCPP DataSpace : public IdComponent { protected: // Sets the dataspace id. - virtual void p_setId(const hid_t new_id); + virtual void p_setId(const hid_t new_id) H5_OVERRIDE; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 18974fc..9970d22 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -90,84 +90,84 @@ class H5_DLLCPP FileIException : public Exception { public: FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); FileIException(); - virtual ~FileIException() throw(); + virtual ~FileIException() throw() H5_OVERRIDE; }; class H5_DLLCPP GroupIException : public Exception { public: GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); GroupIException(); - virtual ~GroupIException() throw(); + virtual ~GroupIException() throw() H5_OVERRIDE; }; class H5_DLLCPP DataSpaceIException : public Exception { public: DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSpaceIException(); - virtual ~DataSpaceIException() throw(); + virtual ~DataSpaceIException() throw() H5_OVERRIDE; }; class H5_DLLCPP DataTypeIException : public Exception { public: DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataTypeIException(); - virtual ~DataTypeIException() throw(); + virtual ~DataTypeIException() throw() H5_OVERRIDE; }; class H5_DLLCPP ObjHeaderIException : public Exception { public: ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ObjHeaderIException(); - virtual ~ObjHeaderIException() throw(); + virtual ~ObjHeaderIException() throw() H5_OVERRIDE; }; class H5_DLLCPP PropListIException : public Exception { public: PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); PropListIException(); - virtual ~PropListIException() throw(); + virtual ~PropListIException() throw() H5_OVERRIDE; }; class H5_DLLCPP DataSetIException : public Exception { public: DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSetIException(); - virtual ~DataSetIException() throw(); + virtual ~DataSetIException() throw() H5_OVERRIDE; }; class H5_DLLCPP AttributeIException : public Exception { public: AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); AttributeIException(); - virtual ~AttributeIException() throw(); + virtual ~AttributeIException() throw() H5_OVERRIDE; }; class H5_DLLCPP ReferenceException : public Exception { public: ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ReferenceException(); - virtual ~ReferenceException() throw(); + virtual ~ReferenceException() throw() H5_OVERRIDE; }; class H5_DLLCPP LibraryIException : public Exception { public: LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LibraryIException(); - virtual ~LibraryIException() throw(); + virtual ~LibraryIException() throw() H5_OVERRIDE; }; class H5_DLLCPP LocationException : public Exception { public: LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LocationException(); - virtual ~LocationException() throw(); + virtual ~LocationException() throw() H5_OVERRIDE; }; class H5_DLLCPP IdComponentException : public Exception { public: IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); IdComponentException(); - virtual ~IdComponentException() throw(); + virtual ~IdComponentException() throw() H5_OVERRIDE; }; // end of IdComponentException } // namespace H5 diff --git a/c++/src/H5File.h b/c++/src/H5File.h index d287031..6126eec 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -39,7 +39,7 @@ class H5_DLLCPP H5File : public Group { const FileAccPropList &access_plist = FileAccPropList::DEFAULT); // Close this file. - virtual void close(); + virtual void close() H5_OVERRIDE; // Gets a copy of the access property list of this file. FileAccPropList getAccessPlist() const; @@ -96,16 +96,16 @@ class H5_DLLCPP H5File : public Group { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("H5File"); } // Throw file exception. - virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const; + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE; // For CommonFG to get the file id. - virtual hid_t getLocId() const; + virtual hid_t getLocId() const H5_OVERRIDE; // Default constructor H5File(); @@ -114,7 +114,7 @@ class H5_DLLCPP H5File : public Group { H5File(const H5File &original); // Gets the HDF5 file id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // H5File destructor. virtual ~H5File(); @@ -122,7 +122,7 @@ class H5_DLLCPP H5File : public Group { protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the HDF5 file id. - virtual void p_setId(const hid_t new_id); + virtual void p_setId(const hid_t new_id) H5_OVERRIDE; #endif // DOXYGEN_SHOULD_SKIP_THIS private: diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 6e82e21..b5f7e51 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -24,20 +24,20 @@ namespace H5 { class H5_DLLCPP Group : public H5Object, public CommonFG { public: // Close this group. - virtual void close(); + virtual void close() H5_OVERRIDE; ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("Group"); } // Throw group exception. - virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const; + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE; // for CommonFG to get the file id. - virtual hid_t getLocId() const; + virtual hid_t getLocId() const H5_OVERRIDE; // Creates a group by way of dereference. Group(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT, @@ -63,10 +63,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { Group(const Group &original); // Gets the group id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // Destructor - virtual ~Group(); + virtual ~Group() H5_OVERRIDE; // Creates a copy of an existing group using its id. Group(const hid_t group_id); @@ -74,7 +74,7 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the group id. - virtual void p_setId(const hid_t new_id); + virtual void p_setId(const hid_t new_id) H5_OVERRIDE; #endif // DOXYGEN_SHOULD_SKIP_THIS private: diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index e662d90..0dc930d 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -24,3 +24,10 @@ * magic number as prefix and checksum as suffix for all chunks. */ #define H5O_VERSION_2 2 + +// Define H5_OVERRIDE to override for C++11. +#if defined(__cplusplus) && (201103L <= __cplusplus) +#define H5_OVERRIDE override +#else +#define H5_OVERRIDE +#endif diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 868f63f..bc2f14a 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -106,7 +106,7 @@ class H5_DLLCPP H5Object : public H5Location { void removeAttr(const H5std_string &name) const; // Returns an identifier. - virtual hid_t getId() const = 0; + virtual hid_t getId() const H5_OVERRIDE = 0; // Gets the name of this HDF5 object, i.e., Group, DataSet, or // DataType. @@ -122,10 +122,10 @@ class H5_DLLCPP H5Object : public H5Location { // Sets the identifier of this object to a new value. - this one // doesn't increment reference count - virtual void p_setId(const hid_t new_id) = 0; + virtual void p_setId(const hid_t new_id) H5_OVERRIDE = 0; // Noop destructor. - virtual ~H5Object(); + virtual ~H5Object() H5_OVERRIDE; #endif // DOXYGEN_SHOULD_SKIP_THIS -- cgit v0.12 From a7a013782f0af93f511142b5d167c2bc8ca8505d Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 10 Mar 2021 13:41:34 -0500 Subject: Various clang tidy warning fixes (#448) * Fixed clang-tidy bugprone-reserved-identifier warnings * Fixed clang-tidy bugprone-assert-side-effect warnings * Fixed clang-tidy bugprone-copy-constructor-init warning * Fixed clang-tidy readability-redundant-preprocessor warning For error_test.c the removed code was already dead, because it was in the else of an `#if H5_USE_16_API` block. Based on H5Location.h, I think p_get_ref_obj_type was meant to be in `#ifndef DOXYGEN_SHOULD_SKIP_THIS` and an `#endif` was missing. Similarly, in the header, getObjTypeByIdx is only in H5_NO_DEPRECATED_SYMBOLS, not DOXYGEN_SHOULD_SKIP_THIS. * Fixed clang-tidy readability-redundant-string-init warnings * Fixed some clang-tidy performance-type-promotion-in-math-fn warnings * Fixed clang-tidy performance-unnecessary-value-param warnings * Reformat source with clang v10.0.1. Co-authored-by: Larry Knox --- c++/src/H5Attribute.cpp | 2 +- c++/src/H5DcreatProp.cpp | 4 +-- c++/src/H5DcreatProp.h | 2 +- c++/src/H5DxferProp.cpp | 2 +- c++/src/H5Exception.cpp | 2 +- c++/src/H5File.cpp | 2 +- c++/src/H5Location.cpp | 11 ++++---- c++/src/H5Object.cpp | 2 +- c++/test/dsets.cpp | 2 +- c++/test/h5cpputil.cpp | 4 +-- c++/test/h5cpputil.h | 4 +-- src/H5Tconv.c | 4 +-- src/H5Zscaleoffset.c | 4 +-- test/cache_common.c | 4 +-- test/dsets.c | 38 ++++++++++++------------- test/earray.c | 50 ++++++++++++++++----------------- test/error_test.c | 5 ---- test/external.c | 6 ++-- test/ohdr.c | 6 ++-- tools/test/h5diff/h5diffgentest.c | 52 +++++++++++++++++------------------ tools/test/h5repack/h5repackgentest.c | 34 +++++++++++------------ tools/test/perform/sio_engine.c | 2 +- tools/test/perform/sio_perf.c | 2 +- 23 files changed, 119 insertions(+), 125 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index d893fec..b74349c 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -308,7 +308,7 @@ Attribute::getName(char *attr_name, size_t buf_size) const H5std_string Attribute::getName() const { - H5std_string attr_name(""); // attribute name to return + H5std_string attr_name; // attribute name to return // Preliminary call to get the size of the attribute name ssize_t name_size = H5Aget_name(id, static_cast(0), NULL); diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index d670b74..0ffcbf7 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -769,8 +769,8 @@ DSetCreatPropList::setVirtual(const DataSpace &vspace, const char *src_fname, co // Programmer Binh-Minh Ribler - Mar, 2017 //-------------------------------------------------------------------------- void -DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fname, - const H5std_string src_dsname, const DataSpace &sspace) const +DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string &src_fname, + const H5std_string &src_dsname, const DataSpace &sspace) const { setVirtual(vspace, src_fname.c_str(), src_dsname.c_str(), sspace); } diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index 3c032ee..820c0d1 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -123,7 +123,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { // Maps elements of a virtual dataset to elements of the source dataset. void setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname, const DataSpace &sspace) const; - void setVirtual(const DataSpace &vspace, const H5std_string src_fname, const H5std_string src_dsname, + void setVirtual(const DataSpace &vspace, const H5std_string &src_fname, const H5std_string &src_dsname, const DataSpace &sspace) const; ///\brief Returns this class name. diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index d9d7884..98e6214 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -306,7 +306,7 @@ DSetMemXferPropList::getDataTransform() const { // Initialize string to "", so that if there is no expression, the returned // string will be empty - H5std_string expression(""); + H5std_string expression; // Preliminary call to get the expression's length ssize_t exp_len = H5Pget_data_transform(id, NULL, (size_t)0); diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 1aa8ecc..8ea20ff 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -25,7 +25,7 @@ const char Exception::DEFAULT_MSG[] = "No detailed information provided"; ///\brief Default constructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::Exception() : detail_message(""), func_name("") {} +Exception::Exception() {} //-------------------------------------------------------------------------- // Function: Exception overloaded constructor diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index bbdcd6b..e40cafe 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -178,7 +178,7 @@ H5File::H5File(hid_t existing_id) : Group() ///\param original - IN: H5File instance to copy // December 2000 //-------------------------------------------------------------------------- -H5File::H5File(const H5File &original) : Group() +H5File::H5File(const H5File &original) : Group(original) { id = original.getId(); incRefCount(); // increment number of references to this id diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 2d14bfc..b136faa 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -346,7 +346,7 @@ H5Location::getComment(const char *name, size_t buf_size) const { // Initialize string to "", so that if there is no comment, the returned // string will be empty - H5std_string comment(""); + H5std_string comment; // Preliminary call to get the comment's length ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, (size_t)0, H5P_DEFAULT); @@ -398,6 +398,7 @@ H5Location::getComment(const H5std_string &name, size_t buf_size) const { return (getComment(name.c_str(), buf_size)); } + #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -646,6 +647,7 @@ H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const return (obj_type); } #endif // DOXYGEN_SHOULD_SKIP_THIS + #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- @@ -704,6 +706,7 @@ H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const } return (obj_type); } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::getRegion @@ -1816,7 +1819,7 @@ H5Location::getLinkval(const char *name, size_t size) const H5L_info2_t linkinfo; char * value_C; // value in C string size_t val_size = size; - H5std_string value = ""; + H5std_string value; herr_t ret_value; // if user doesn't provide buffer size, determine it @@ -2294,7 +2297,6 @@ H5Location::childObjVersion(const H5std_string &objname) const } #ifndef H5_NO_DEPRECATED_SYMBOLS -#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::getObjTypeByIdx ///\brief Returns the type of an object in this group, given the @@ -2372,7 +2374,6 @@ H5Location::getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const return (obj_type); } -#endif // DOXYGEN_SHOULD_SKIP_THIS #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- @@ -2433,6 +2434,4 @@ f_DataSpace_setId(DataSpace *dspace, hid_t new_id) //-------------------------------------------------------------------------- H5Location::~H5Location() {} -#endif // DOXYGEN_SHOULD_SKIP_THIS - } // namespace H5 diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 725d1da..c2eba8d 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -477,7 +477,7 @@ H5Object::getObjName(char *obj_name, size_t buf_size) const H5std_string H5Object::getObjName() const { - H5std_string obj_name(""); // object name to return + H5std_string obj_name; // object name to return // Preliminary call to get the size of the object name ssize_t name_size = H5Iget_name(getId(), NULL, static_cast(0)); diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 93c266f..0faf457 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1157,7 +1157,7 @@ const int RANK1 = 1; const H5std_string FILE_ACCPLIST("test_accplist.h5"); static herr_t -test_chunk_cache(FileAccPropList fapl) +test_chunk_cache(const FileAccPropList &fapl) { SUBTEST("DSetAccPropList::set/getChunkCache"); diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index d42fc8c..38f9300 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -212,7 +212,7 @@ InvalidActionException::InvalidActionException() : Exception() {} // func - IN: Name of the function where failure should occur // message - IN: Message //-------------------------------------------------------------------------- -InvalidActionException::InvalidActionException(const H5std_string func, const H5std_string message) +InvalidActionException::InvalidActionException(const H5std_string &func, const H5std_string &message) : Exception(func, message) { } @@ -237,7 +237,7 @@ TestFailedException::TestFailedException() : Exception() {} // func - IN: Name of the function where failure should occur // message - IN: Message //-------------------------------------------------------------------------- -TestFailedException::TestFailedException(const H5std_string func, const H5std_string message) +TestFailedException::TestFailedException(const H5std_string &func, const H5std_string &message) : Exception(func, message) { } diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 4439ae3..444bc68 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -48,14 +48,14 @@ void issue_fail_msg(const char *where, int line, const char *file_name, const ch class InvalidActionException : public Exception { public: - InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); + InvalidActionException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); InvalidActionException(); virtual ~InvalidActionException() throw(); }; class TestFailedException : public Exception { public: - TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); + TestFailedException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); TestFailedException(); virtual ~TestFailedException() throw(); }; diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 60ad627..8cc6ede 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -8477,7 +8477,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Allocate enough space for the buffer holding temporary * converted value */ - buf_size = (size_t)(HDpow((double)2.0f, (double)src.u.f.esize) / 8 + 1); + buf_size = (size_t)(HDpow(2.0, (double)src.u.f.esize) / 8 + 1); int_buf = (uint8_t *)H5MM_calloc(buf_size); /* Get conversion exception callback property */ @@ -9315,7 +9315,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } /* Check if the exponent is too big */ - expo_max = (hsize_t)(HDpow((double)2.0f, (double)dst.u.f.esize) - 1); + expo_max = (hsize_t)(HDpow(2.0, (double)dst.u.f.esize) - 1); if (expo > expo_max) { /*overflows*/ if (cb_struct.func) { /*user's exception handler. Reverse back source order*/ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 3a08a07..5310f7d 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.0f, -D_val)) \ + while (i < d_nelmts && HDfabs(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.0f, -D_val)) \ + if (HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ continue; /* ignore fill value */ \ if (buf[i] > max) \ max = buf[i]; \ diff --git a/test/cache_common.c b/test/cache_common.c index 54b1cc5..676b8d1 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1683,7 +1683,7 @@ execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_o HDassert(cache_ptr != NULL); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(entry_ptr != NULL); - HDassert(entry_ptr = entry_ptr->self); + HDassert(entry_ptr == entry_ptr->self); HDassert(entry_ptr->header.addr == entry_ptr->addr); HDassert((entry_ptr->flush_op_self_resize_in_progress) || (entry_ptr->header.size == entry_ptr->size)); HDassert(op_ptr != NULL); @@ -2243,7 +2243,7 @@ resize_entry(H5F_t *file_ptr, int32_t type, int32_t idx, size_t new_size, hbool_ } else { - HDassert(entry_ptr->size = (entry_ptr->header).size); + HDassert(entry_ptr->size == (entry_ptr->header).size); } } } diff --git a/test/dsets.c b/test/dsets.c index 8600d75..0905b4e 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -3181,7 +3181,7 @@ test_nbit_int(hid_t file) /* Initialize data, assuming size of long long >= size of int */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0f, (double)(precision - 1)); + power = HDpow(2.0, (double)(precision - 1)); orig_data[i][j] = (int)(((long long)HDrandom() % (long long)power) << offset); /* even-numbered values are negtive */ @@ -3558,7 +3558,7 @@ test_nbit_array(hid_t file) for (j = 0; j < (size_t)size[1]; j++) for (m = 0; m < (size_t)adims[0]; m++) for (n = 0; n < (size_t)adims[1]; n++) { - power = HDpow(2.0F, (double)precision); + power = HDpow(2.0, (double)precision); orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() % (long long)power) << offset); } /* end for */ @@ -3754,11 +3754,11 @@ test_nbit_compound(hid_t file) /* Initialize data, assuming size of long long >= size of member datatypes */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0F, (double)(precision[0] - 1)); + power = HDpow(2.0, (double)(precision[0] - 1)); orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); - power = HDpow(2.0F, (double)(precision[1] - 1)); + power = HDpow(2.0, (double)(precision[1] - 1)); orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0F, (double)(precision[2] - 1)); + power = HDpow(2.0, (double)(precision[2] - 1)); orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].f = float_val[i][j]; @@ -4036,32 +4036,32 @@ test_nbit_compound_2(hid_t file) /* Initialize data, assuming size of long long >= size of member datatypes */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0F, (double)(precision[0] - 1)); + power = HDpow(2.0, (double)(precision[0] - 1)); orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); - power = HDpow(2.0F, (double)(precision[1] - 1)); + power = HDpow(2.0, (double)(precision[1] - 1)); orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0F, (double)(precision[2] - 1)); + power = HDpow(2.0, (double)(precision[2] - 1)); orig_data[i][j].a.s = (short)(-(((long long)HDrandom() % (long long)power) << offset[2])); orig_data[i][j].a.f = float_val[i][j]; - power = HDpow(2.0F, (double)precision[3]); + power = HDpow(2.0, (double)precision[3]); orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]); for (m = 0; m < (size_t)array_dims[0]; m++) for (n = 0; n < (size_t)array_dims[1]; n++) { - power = HDpow(2.0F, (double)(precision[4] - 1)); + power = HDpow(2.0, (double)(precision[4] - 1)); orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]); } /* end for */ for (m = 0; m < (size_t)array_dims[0]; m++) for (n = 0; n < (size_t)array_dims[1]; n++) { - power = HDpow(2.0F, (double)(precision[0] - 1)); + power = HDpow(2.0, (double)(precision[0] - 1)); orig_data[i][j].d[m][n].i = (int)(-(((long long)HDrandom() % (long long)power) << offset[0])); - power = HDpow(2.0F, (double)(precision[1] - 1)); + power = HDpow(2.0, (double)(precision[1] - 1)); orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0F, (double)(precision[2] - 1)); + power = HDpow(2.0, (double)(precision[2] - 1)); orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].d[m][n].f = float_val[i][j]; @@ -4292,7 +4292,7 @@ test_nbit_compound_3(hid_t file) /* Initialize data */ for (i = 0; i < (size_t)size[0]; i++) { - power = HDpow(2.0F, 17.0F - 1.0F); + power = HDpow(2.0, 17.0 - 1.0); HDmemset(&orig_data[i], 0, sizeof(orig_data[i])); orig_data[i].i = (int)(HDrandom() % (long)power); HDstrcpy(orig_data[i].str, "fixed-length C string"); @@ -4481,7 +4481,7 @@ test_nbit_int_size(hid_t file) */ for (i = 0; i < DSET_DIM1; i++) for (j = 0; j < DSET_DIM2; j++) { - power = HDpow(2.0F, (double)(precision - 1)); + power = HDpow(2.0, (double)(precision - 1)); orig[i][j] = HDrandom() % (int)power << offset; } @@ -5145,7 +5145,7 @@ test_scaleoffset_float(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < (size_t)size[0]; i++) { for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0F, -3.0F)) { + if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0, -3.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -5291,7 +5291,7 @@ test_scaleoffset_float_2(hid_t file) /* Check that the values read are the same as the values written */ for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0F, -3.0F)) { + if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0, -3.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -5412,7 +5412,7 @@ test_scaleoffset_double(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < (size_t)size[0]; i++) { for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0F, -7.0F)) { + if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0, -7.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -5558,7 +5558,7 @@ test_scaleoffset_double_2(hid_t file) /* Check that the values read are the same as the values written */ for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0F, -7.0F)) { + if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0, -7.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); diff --git a/test/earray.c b/test/earray.c index 52908a7..bfd3d55 100644 --- a/test/earray.c +++ b/test/earray.c @@ -122,7 +122,7 @@ typedef struct earray_iter_t { hsize_t cnt); /* Initialize/allocate iterator private info */ hssize_t (*next)(void *info); /* Get the next element to test */ hssize_t (*max_elem)(const void *info); /* Get the max. element set */ - int (*state)(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, + int (*state)(void *in_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx); /* Get the state of the extensible array */ herr_t (*term)(void *info); /* Shutdown/free iterator private info */ } earray_iter_t; @@ -1290,9 +1290,9 @@ eiter_fw_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_para *------------------------------------------------------------------------- */ static hssize_t -eiter_fw_next(void *_eiter) +eiter_fw_next(void *in_eiter) { - eiter_fw_t *eiter = (eiter_fw_t *)_eiter; + eiter_fw_t *eiter = (eiter_fw_t *)in_eiter; hssize_t ret_val; /* Sanity check */ @@ -1318,9 +1318,9 @@ eiter_fw_next(void *_eiter) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hssize_t -eiter_fw_max(const void *_eiter) +eiter_fw_max(const void *in_eiter) { - const eiter_fw_t *eiter = (const eiter_fw_t *)_eiter; + const eiter_fw_t *eiter = (const eiter_fw_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1343,10 +1343,10 @@ eiter_fw_max(const void *_eiter) *------------------------------------------------------------------------- */ static int -eiter_fw_state(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, +eiter_fw_state(void *in_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx) { - eiter_fw_t *eiter = (eiter_fw_t *)_eiter; + eiter_fw_t *eiter = (eiter_fw_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1490,9 +1490,9 @@ eiter_rv_init(const H5EA_create_t *cparam, const earray_test_param_t *tparam, hs *------------------------------------------------------------------------- */ static hssize_t -eiter_rv_next(void *_eiter) +eiter_rv_next(void *in_eiter) { - eiter_rv_t *eiter = (eiter_rv_t *)_eiter; + eiter_rv_t *eiter = (eiter_rv_t *)in_eiter; hssize_t ret_val; /* Sanity check */ @@ -1518,9 +1518,9 @@ eiter_rv_next(void *_eiter) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hssize_t -eiter_rv_max(const void *_eiter) +eiter_rv_max(const void *in_eiter) { - const eiter_rv_t *eiter = (const eiter_rv_t *)_eiter; + const eiter_rv_t *eiter = (const eiter_rv_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1543,10 +1543,10 @@ eiter_rv_max(const void *_eiter) *------------------------------------------------------------------------- */ static int -eiter_rv_state(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, +eiter_rv_state(void *in_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx) { - eiter_rv_t *eiter = (eiter_rv_t *)_eiter; + eiter_rv_t *eiter = (eiter_rv_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1720,9 +1720,9 @@ eiter_rnd_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_par *------------------------------------------------------------------------- */ static hssize_t -eiter_rnd_next(void *_eiter) +eiter_rnd_next(void *in_eiter) { - eiter_rnd_t *eiter = (eiter_rnd_t *)_eiter; + eiter_rnd_t *eiter = (eiter_rnd_t *)in_eiter; hssize_t ret_val; /* Sanity check */ @@ -1753,9 +1753,9 @@ eiter_rnd_next(void *_eiter) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hssize_t -eiter_rnd_max(const void *_eiter) +eiter_rnd_max(const void *in_eiter) { - const eiter_rnd_t *eiter = (const eiter_rnd_t *)_eiter; + const eiter_rnd_t *eiter = (const eiter_rnd_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1778,9 +1778,9 @@ eiter_rnd_max(const void *_eiter) *------------------------------------------------------------------------- */ static int -eiter_rnd_term(void *_eiter) +eiter_rnd_term(void *in_eiter) { - eiter_rnd_t *eiter = (eiter_rnd_t *)_eiter; + eiter_rnd_t *eiter = (eiter_rnd_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1934,9 +1934,9 @@ eiter_cyc_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_par *------------------------------------------------------------------------- */ static hssize_t -eiter_cyc_next(void *_eiter) +eiter_cyc_next(void *in_eiter) { - eiter_cyc_t *eiter = (eiter_cyc_t *)_eiter; + eiter_cyc_t *eiter = (eiter_cyc_t *)in_eiter; hssize_t ret_val; /* Sanity check */ @@ -1969,9 +1969,9 @@ eiter_cyc_next(void *_eiter) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hssize_t -eiter_cyc_max(const void *_eiter) +eiter_cyc_max(const void *in_eiter) { - const eiter_cyc_t *eiter = (const eiter_cyc_t *)_eiter; + const eiter_cyc_t *eiter = (const eiter_cyc_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1994,9 +1994,9 @@ eiter_cyc_max(const void *_eiter) *------------------------------------------------------------------------- */ static int -eiter_cyc_term(void *_eiter) +eiter_cyc_term(void *in_eiter) { - eiter_cyc_t *eiter = (eiter_cyc_t *)_eiter; + eiter_cyc_t *eiter = (eiter_cyc_t *)in_eiter; /* Sanity check */ HDassert(eiter); diff --git a/test/error_test.c b/test/error_test.c index e294a43..9bbebec 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -129,13 +129,8 @@ test_error(hid_t file) TEST_ERROR; if (old_data != NULL) TEST_ERROR; -#ifdef H5_USE_16_API - if (old_func != (H5E_auto_t)H5Eprint) - TEST_ERROR; -#else /* H5_USE_16_API */ if (old_func != (H5E_auto2_t)H5Eprint2) TEST_ERROR; -#endif /* H5_USE_16_API */ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) TEST_ERROR; diff --git a/test/external.c b/test/external.c index 9109e75..0957a03 100644 --- a/test/external.c +++ b/test/external.c @@ -465,7 +465,7 @@ error: *------------------------------------------------------------------------- */ static int -__add_external_files(hid_t dcpl_id, unsigned int n_external_files, off_t offset, hsize_t max_ext_size) +add_external_files(hid_t dcpl_id, unsigned int n_external_files, off_t offset, hsize_t max_ext_size) { char exname[AEF_EXNAME_MAX_LEN + 1]; unsigned int i = 0; @@ -519,7 +519,7 @@ test_multiple_files(hid_t file) max_ext_size = (hsize_t)(sizeof(int) * max_size[0] / n_external_files); - if (__add_external_files(dcpl, n_external_files, 0, max_ext_size) < 0) { + if (add_external_files(dcpl, n_external_files, 0, max_ext_size) < 0) { FAIL_STACK_ERROR; } @@ -543,7 +543,7 @@ test_multiple_files(hid_t file) max_ext_size -= 1; - if (__add_external_files(dcpl, n_external_files, 0, max_ext_size) < 0) { + if (add_external_files(dcpl, n_external_files, 0, max_ext_size) < 0) { FAIL_STACK_ERROR; } diff --git a/test/ohdr.c b/test/ohdr.c index 54040e1..c586ff3 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -780,7 +780,7 @@ count_attributes(hid_t dset_id) * On success, stores size in `size_out` pointer. */ static herr_t -_oh_getsize(hid_t did, hsize_t *size_out) +oh_getsize(hid_t did, hsize_t *size_out) { H5O_native_info_t ninfo; @@ -803,9 +803,9 @@ oh_compare(hid_t did1, hid_t did2) hsize_t space1 = 0; hsize_t space2 = 0; - if (FAIL == _oh_getsize(did1, &space1)) + if (FAIL == oh_getsize(did1, &space1)) return -1; - if (FAIL == _oh_getsize(did2, &space2)) + if (FAIL == oh_getsize(did2, &space2)) return -2; if (space1 < space2) diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index cf60a6a..f03254e 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -465,15 +465,15 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) float data15[6]; float data16[6]; - data15[0] = (float)HDsqrt(-1.0F); + data15[0] = (float)HDsqrt(-1.0); data15[1] = 1.0F; - data15[2] = (float)HDsqrt(-1.0F); + data15[2] = (float)HDsqrt(-1.0); data15[3] = 1.0F; data15[4] = 1.0F; data15[5] = 1.0F; - data16[0] = (float)HDsqrt(-1.0F); - data16[1] = (float)HDsqrt(-1.0F); + data16[0] = (float)HDsqrt(-1.0); + data16[1] = (float)HDsqrt(-1.0); data16[2] = 1.0F; data16[3] = 1.0F; data16[4] = 1.0F; @@ -492,19 +492,19 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) double data17[6]; double data18[6]; - data17[0] = HDsqrt(-1.0F); - data17[1] = 1.0F; - data17[2] = HDsqrt(-1.0F); - data17[3] = 1.0F; - data17[4] = 1.0F; - data17[5] = 1.0F; + data17[0] = HDsqrt(-1.0); + data17[1] = 1.0; + data17[2] = HDsqrt(-1.0); + data17[3] = 1.0; + data17[4] = 1.0; + data17[5] = 1.0; - data18[0] = HDsqrt(-1.0F); - data18[1] = HDsqrt(-10000.0F); - data18[2] = 1.0F; - data18[3] = 1.0F; - data18[4] = 1.0F; - data18[5] = 1.0F; + data18[0] = HDsqrt(-1.0); + data18[1] = HDsqrt(-10000.0); + data18[2] = 1.0; + data18[3] = 1.0; + data18[4] = 1.0; + data18[5] = 1.0; write_dset(gid1, 1, dims1, "fp17", H5T_NATIVE_DOUBLE, data17); write_dset(gid1, 1, dims1, "fp18", H5T_NATIVE_DOUBLE, data18); @@ -519,11 +519,11 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) float data19[6]; double data20[6]; - data19[0] = data19[1] = data19[2] = (float)HDlog(0.0F); - data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0F); + data19[0] = data19[1] = data19[2] = (float)HDlog(0.0); + data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0); - data20[0] = data20[1] = data20[2] = HDlog(0.0F); - data20[3] = data20[4] = data20[5] = -HDlog(0.0F); + data20[0] = data20[1] = data20[2] = HDlog(0.0); + data20[3] = data20[4] = data20[5] = -HDlog(0.0); write_dset(gid1, 1, dims1, "fp19", H5T_NATIVE_FLOAT, data19); write_dset(gid1, 1, dims1, "fp19_COPY", H5T_NATIVE_FLOAT, data19); @@ -547,13 +547,13 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) size_t type_size; hid_t tid; - buf1[0].d = HDsqrt(-1.0F); - buf1[0].f = (float)HDsqrt(-1.0F); - buf2[0].d = HDsqrt(-1.0F); - buf2[0].f = (float)HDsqrt(-1.0F); + buf1[0].d = HDsqrt(-1.0); + buf1[0].f = (float)HDsqrt(-1.0); + buf2[0].d = HDsqrt(-1.0); + buf2[0].f = (float)HDsqrt(-1.0); - buf1[1].d = HDsqrt(-1.0F); - buf1[1].f = (float)HDsqrt(-1.0F); + buf1[1].d = HDsqrt(-1.0); + buf1[1].f = (float)HDsqrt(-1.0); buf2[1].d = 0.0F; buf2[1].f = 0.0F; diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 2b94422..576b1c7 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -72,8 +72,8 @@ struct external_def { * Returns 0 on success, -1 on failure. */ static int -__make_dataset(hid_t file_id, const char *dset_name, hid_t mem_type_id, hid_t space_id, hid_t dcpl_id, - void *wdata) +make_dataset(hid_t file_id, const char *dset_name, hid_t mem_type_id, hid_t space_id, hid_t dcpl_id, + void *wdata) { hid_t dset_id = H5I_INVALID_HID; int ret_value = 0; @@ -90,7 +90,7 @@ done: (void)H5Dclose(dset_id); return ret_value; -} /* end __make_dataset() */ +} /* end make_dataset() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Helper function to populate the DCPL external storage list. @@ -101,8 +101,8 @@ done: * Returns 0 on success, -1 on failure. */ static int -__set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_file, unsigned n_elts_total, - hsize_t elt_size) +set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_file, unsigned n_elts_total, + hsize_t elt_size) { char name[MAX_NAME_SIZE]; unsigned n_external_files = 0; @@ -123,7 +123,7 @@ __set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_f return -1; } return 0; -} /* end __set_dcpl_external_list() */ +} /* end set_dcpl_external_list() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Generalized utility function to write a file with the specified data and @@ -132,8 +132,8 @@ __set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_f * Returns 0 on success, -1 on failure. */ static int -__make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize_t rank, hsize_t *dims, - void *wdata) +make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize_t rank, hsize_t *dims, + void *wdata) { char filename[MAX_NAME_SIZE]; hid_t file_id = H5I_INVALID_HID; @@ -149,8 +149,8 @@ __make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize if (dcpl_id == H5I_INVALID_HID) H5REPACKGENTEST_OOPS; - if (__set_dcpl_external_list(dcpl_id, basename, ext->n_elts_per_file, ext->n_elts_total, - ext->type_size) < 0) + if (set_dcpl_external_list(dcpl_id, basename, ext->n_elts_per_file, ext->n_elts_total, + ext->type_size) < 0) H5REPACKGENTEST_OOPS; } @@ -162,13 +162,13 @@ __make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize if (file_id == H5I_INVALID_HID) H5REPACKGENTEST_OOPS; - if (__make_dataset(file_id, "dset", type_id, space_id, dcpl_id, wdata) < 0) + if (make_dataset(file_id, "dset", type_id, space_id, dcpl_id, wdata) < 0) H5REPACKGENTEST_OOPS; done: H5REPACKGENTEST_COMMON_CLEANUP(dcpl_id, file_id, space_id); return ret_value; -} /* end __make_file() */ +} /* end make_file() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Returns 0 on success, -1 on failure. @@ -190,7 +190,7 @@ generate_int32le_1d(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_INT32LE_1, def_ptr, H5T_STD_I32LE, 1, dims, wdata) < 0) + if (make_file(FILE_INT32LE_1, def_ptr, H5T_STD_I32LE, 1, dims, wdata) < 0) ret_value = -1; return ret_value; @@ -216,7 +216,7 @@ generate_int32le_2d(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_INT32LE_2, def_ptr, H5T_STD_I32LE, 2, dims, wdata) < 0) + if (make_file(FILE_INT32LE_2, def_ptr, H5T_STD_I32LE, 2, dims, wdata) < 0) ret_value = -1; return ret_value; @@ -249,7 +249,7 @@ generate_int32le_3d(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_INT32LE_3, def_ptr, H5T_STD_I32LE, 3, dims, wdata) < 0) + if (make_file(FILE_INT32LE_3, def_ptr, H5T_STD_I32LE, 3, dims, wdata) < 0) ret_value = -1; return ret_value; @@ -282,7 +282,7 @@ generate_uint8be(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_UINT8BE, def_ptr, H5T_STD_U8BE, 3, dims, wdata) < 0) + if (make_file(FILE_UINT8BE, def_ptr, H5T_STD_U8BE, 3, dims, wdata) < 0) ret_value = -1; return ret_value; @@ -312,7 +312,7 @@ generate_f32le(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_F32LE, def_ptr, H5T_IEEE_F32LE, 2, dims, wdata) < 0) + if (make_file(FILE_F32LE, def_ptr, H5T_IEEE_F32LE, 2, dims, wdata) < 0) ret_value = -1; return ret_value; diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index f8061d4..e5a0ec8 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -80,7 +80,7 @@ static int clean_file_g = -1; /*whether to cleanup temporary test */ /*0 is no cleanup; 1 is do cleanup */ /* the different types of file descriptors we can expect */ -typedef union _file_descr { +typedef union { int posixfd; /* POSIX file handle*/ hid_t h5fd; /* HDF5 file */ } file_descr; diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index 8463ffa..5b3a9e8 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -292,7 +292,7 @@ struct options { size_t page_size; }; -typedef struct _minmax { +typedef struct { double min; double max; double sum; -- cgit v0.12 From d7b40604ef43c0617ba93369983657d77d9e976a Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 10 Mar 2021 13:42:35 -0500 Subject: Fixed all clang-tidy bugprone-suspicious-string-compare warnings (#451) * Fixed all clang-tidy bugprone-suspicious-string-compare warnings This change was generated entirely by clang-tidy itself. * Reformat code with clang v10.0.1. Co-authored-by: Larry Knox --- c++/test/tattr.cpp | 2 +- c++/test/tcompound.cpp | 2 +- c++/test/th5s.cpp | 2 +- c++/test/tlinks.cpp | 2 +- c++/test/tvlstr.cpp | 2 +- hl/c++/test/ptableTest.cpp | 2 +- hl/test/test_lite.c | 34 +++-- hl/tools/gif2h5/gifread.c | 2 +- src/H5.c | 2 +- src/H5A.c | 2 +- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +- src/H5Bcache.c | 2 +- src/H5Cimage.c | 2 +- src/H5Dvirtual.c | 2 +- src/H5EAcache.c | 8 +- src/H5Eint.c | 4 +- src/H5FAcache.c | 4 +- src/H5FD.c | 4 +- src/H5FDmulti.c | 2 +- src/H5FScache.c | 4 +- src/H5Gcache.c | 2 +- src/H5HFcache.c | 6 +- src/H5HGcache.c | 2 +- src/H5HLcache.c | 2 +- src/H5Ocache.c | 2 +- src/H5SMcache.c | 4 +- src/H5T.c | 4 +- src/H5Tconv.c | 2 +- test/btree2.c | 4 +- test/cache_image.c | 4 +- test/cache_logging.c | 2 +- test/cmpd_dset.c | 2 +- test/dsets.c | 8 +- test/dtypes.c | 72 ++++----- test/error_test.c | 4 +- test/external.c | 2 +- test/fheap.c | 74 +++++----- test/filenotclosed.c | 2 +- test/fillval.c | 8 +- test/getname.c | 10 +- test/gheap.c | 4 +- test/istore.c | 2 +- test/lheap.c | 2 +- test/links.c | 262 ++++++++++++++++----------------- test/links_env.c | 2 +- test/mf.c | 79 +++++----- test/mount.c | 52 +++---- test/objcopy.c | 26 ++-- test/objcopy_ref.c | 8 +- test/ohdr.c | 8 +- test/set_extent.c | 2 +- test/stab.c | 4 +- test/swmr_generator.c | 2 +- test/swmr_start_write.c | 2 +- test/tattr.c | 46 +++--- test/tfile.c | 2 +- test/th5s.c | 2 +- test/titerate.c | 2 +- test/tmisc.c | 4 +- test/tselect.c | 18 +-- test/ttst.c | 10 +- test/tvlstr.c | 2 +- test/tvltypes.c | 122 +++++++-------- test/unlink.c | 2 +- test/vfd.c | 2 +- test/vol.c | 16 +- tools/lib/h5diff.c | 10 +- tools/lib/h5tools.c | 4 +- tools/lib/h5tools_ref.c | 2 +- tools/lib/h5tools_str.c | 2 +- tools/lib/h5trav.c | 2 +- tools/src/h5dump/h5dump.c | 2 +- tools/src/h5import/h5import.c | 4 +- tools/src/h5ls/h5ls.c | 2 +- tools/src/h5repack/h5repack_main.c | 2 +- tools/src/h5repack/h5repack_opttable.c | 2 +- tools/src/misc/h5delete.c | 2 +- 78 files changed, 518 insertions(+), 507 deletions(-) diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index e659e8e..adaa237 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -771,7 +771,7 @@ test_attr_compound_read() hsize_t ii, jj; for (ii = 0; ii < ATTR4_DIM1; ii++) for (jj = 0; jj < ATTR4_DIM2; jj++) - if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct))) { + if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct)) != 0) { TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].i=%d, " "read_data4[%llu][%llu].i=%d\n", __LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i); diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 4c5e3e0..82c21e8 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -487,7 +487,7 @@ test_compound_5() int_array.close(); /* Check results */ - if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || src[1].tdim != dst[1].tdim || + if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) != 0 || src[1].tdim != dst[1].tdim || src[1].coll_ids[0] != dst[1].coll_ids[0] || src[1].coll_ids[1] != dst[1].coll_ids[1] || src[1].coll_ids[2] != dst[1].coll_ids[2] || src[1].coll_ids[3] != dst[1].coll_ids[3]) { H5_FAILED(); diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index a005170..9952e68 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -512,7 +512,7 @@ test_h5s_compound_scalar_read() dataset.read(&rdata, type); // Verify read data - if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct))) { + if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct)) != 0) { cerr << "scalar data different: space4_data.c1=" << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl; cerr << "scalar data different: space4_data.u=" << space4_data.u << ", read_data4.u=" << rdata.u diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 22e69da..e8dad5b 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -589,7 +589,7 @@ visit_obj_cb(H5Object &obj, const H5std_string name, const H5O_info2_t *oinfo, v ovisit_ud_t *op_data = static_cast(_op_data); // Check for correct object information - if (strcmp(op_data->info[op_data->idx].path, name.c_str())) + if (strcmp(op_data->info[op_data->idx].path, name.c_str()) != 0) return (H5_ITER_ERROR); if (op_data->info[op_data->idx].type != oinfo->type) return (H5_ITER_ERROR); diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 780d1b9..b371518 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -861,7 +861,7 @@ read_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, cha dset.read(&data_read, type, space, space); dset.close(); - if (HDstrcmp(data, data_read)) + if (HDstrcmp(data, data_read) != 0) TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read); HDfree(data_read); diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 900f8a9..47c6562 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -690,7 +690,7 @@ TestHDFFV_9758() if (s2.a != s1[i].a || s2.e != s1[i].e) goto error; - else if (HDstrcmp(s2.d, s1[i].d)) + else if (HDstrcmp(s2.d, s1[i].d) != 0) goto error; } } // end of ptable block diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 52cda54..cae91ff 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1054,7 +1054,7 @@ test_integers(void) HDfree(dt_str); goto out; } - if (HDstrcmp(dt_str, "H5T_STD_I8BE")) { + if (HDstrcmp(dt_str, "H5T_STD_I8BE") != 0) { HDfree(dt_str); goto out; } @@ -1112,7 +1112,7 @@ test_fps(void) HDfree(dt_str); goto out; } - if (HDstrcmp(dt_str, "H5T_IEEE_F32BE")) { + if (HDstrcmp(dt_str, "H5T_IEEE_F32BE") != 0) { HDfree(dt_str); goto out; } @@ -1184,7 +1184,7 @@ test_strings(void) goto out; } if (HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET " - "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { + "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }") != 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; @@ -1219,7 +1219,7 @@ test_strings(void) goto out; } if (HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n " - "CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { + "CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }") != 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; @@ -1238,7 +1238,7 @@ test_strings(void) if (HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET " "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", - str_len - 1)) { + str_len - 1) != 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; @@ -1261,7 +1261,7 @@ test_strings(void) if (HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET " "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", - str_len)) { + str_len) != 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; @@ -1322,7 +1322,8 @@ test_opaques(void) } if (HDstrcmp( dt_str, - "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) { + "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }") != + 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; @@ -1376,7 +1377,7 @@ test_enums(void) if (H5Tenum_nameof(dtype, &value1, name1, size) < 0) goto out; - if (HDstrcmp(name1, "BLUE")) + if (HDstrcmp(name1, "BLUE") != 0) goto out; if (H5Tenum_valueof(dtype, name2, &value2) < 0) @@ -1399,8 +1400,9 @@ test_enums(void) HDfree(dt_str); goto out; } - if (HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" " - " 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { + if (HDstrcmp(dt_str, + "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" " + " 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }") != 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); @@ -1462,7 +1464,7 @@ test_variables(void) HDfree(dt_str); goto out; } - if (HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { + if (HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }") != 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; @@ -1526,7 +1528,7 @@ test_arrays(void) } if (HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n " " H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE " - "\"arr_compound_2\" : 1;\n }\n }\n }")) { + "\"arr_compound_2\" : 1;\n }\n }\n }") != 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; @@ -1586,7 +1588,7 @@ test_compounds(void) goto out; } if (HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE " - "\"two_field\" : 6;\n }")) { + "\"two_field\" : 6;\n }") != 0) { HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; @@ -1605,7 +1607,7 @@ test_compounds(void) if ((memb_name = H5Tget_member_name(dtype, 1)) == NULL) goto out; - if (HDstrcmp(memb_name, "i16_field")) { + if (HDstrcmp(memb_name, "i16_field") != 0) { H5free_memory(memb_name); goto out; } @@ -1683,7 +1685,7 @@ test_compound_bug(void) if ((memb_name = H5Tget_member_name(dtype, 2)) == NULL) goto out; - if (HDstrcmp(memb_name, "sub")) { + if (HDstrcmp(memb_name, "sub") != 0) { H5free_memory(memb_name); goto out; } @@ -1720,7 +1722,7 @@ test_compound_bug(void) if ((memb_name = H5Tget_member_name(dtype, 1)) == NULL) goto out; if (HDstrcmp(memb_name, "desc____________________________________________________________________________" - "_____________")) { + "_____________") != 0) { H5free_memory(memb_name); goto out; } diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index ef2bdd4..d2afbc4 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -62,7 +62,7 @@ ReadGifHeader(GIFHEAD * GifHead, /* Pointer to GIF header structure */ GifHead->HeaderDump[i] = *(*MemGif2)++; } - if (strncmp((const char *)GifHead->HeaderDump, "GIF", (size_t)3)) { + if (strncmp((const char *)GifHead->HeaderDump, "GIF", (size_t)3) != 0) { printf("The file does not appear to be a valid GIF file.\n"); exit(EXIT_FAILURE); } diff --git a/src/H5.c b/src/H5.c index b7c6eb5..14a65db 100644 --- a/src/H5.c +++ b/src/H5.c @@ -970,7 +970,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) HDstrncat(lib_str, "-", (size_t)1); HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1); } /* end if */ - if (HDstrcmp(lib_str, H5_lib_vers_info_g)) { + if (HDstrcmp(lib_str, H5_lib_vers_info_g) != 0) { HDfputs("Warning! Library version information error.\n" "The HDF5 library version information are not " "consistent in its source code.\nThis is NOT a fatal error " diff --git a/src/H5A.c b/src/H5A.c index a6b4350..aaf3383 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1541,7 +1541,7 @@ 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)) + if (HDstrcmp(old_name, new_name) != 0) /* 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) diff --git a/src/H5Aint.c b/src/H5Aint.c index f6b955e..8ec5463 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2661,7 +2661,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na FUNC_ENTER_PACKAGE /* Avoid thrashing things if the names are the same */ - if (HDstrcmp(old_attr_name, new_attr_name)) { + if (HDstrcmp(old_attr_name, new_attr_name) != 0) { /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; obj_loc.path = &obj_path; diff --git a/src/H5B2cache.c b/src/H5B2cache.c index d70816d..e333d61 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -250,7 +250,7 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header") /* Magic number */ - if (HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree header signature") image += H5_SIZEOF_MAGIC; @@ -648,7 +648,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void internal->shadow_epoch = udata->hdr->shadow_epoch; /* Magic number */ - if (HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node signature") image += H5_SIZEOF_MAGIC; @@ -1064,7 +1064,7 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void leaf->shadow_epoch = udata->hdr->shadow_epoch; /* Magic number */ - if (HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree leaf node signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 6ccdc11..ec7457f 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -166,7 +166,7 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses") /* magic number */ - if (HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5Cimage.c b/src/H5Cimage.c index b366a94..20d3b4d 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1773,7 +1773,7 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t * p = *buf; /* Check signature */ - if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN)) + if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature") p += H5C__MDCI_BLOCK_SIGNATURE_LEN; diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index ea38e0a..f582ec5 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -895,7 +895,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir HDassert(source_dset->dset_name); /* Check if we need to open the source file */ - if (HDstrcmp(source_dset->file_name, ".")) { + if (HDstrcmp(source_dset->file_name, ".") != 0) { unsigned intent; /* File access permissions */ /* Get the virtual dataset's file open flags ("intent") */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 550627e..2a3153c 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -307,7 +307,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, hdr->addr = udata->addr; /* Magic number */ - if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature") image += H5_SIZEOF_MAGIC; @@ -697,7 +697,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, iblock->addr = hdr->idx_blk_addr; /* Magic number */ - if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature") image += H5_SIZEOF_MAGIC; @@ -1100,7 +1100,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, sblock->addr = udata->sblk_addr; /* Magic number */ - if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature") image += H5_SIZEOF_MAGIC; @@ -1510,7 +1510,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, dblock->addr = udata->dblk_addr; /* Magic number */ - if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5Eint.c b/src/H5Eint.c index 7e46beb..3fd4099 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -218,7 +218,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) cls_ptr = maj_ptr->cls; /* Print error class header if new class */ - if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) { + if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) { /* update to the new class information */ if (cls_ptr->cls_name) eprint->cls.cls_name = cls_ptr->cls_name; @@ -346,7 +346,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) HGOTO_DONE(FAIL) /* Print error class header if new class */ - if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) { + if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) { /* update to the new class information */ if (cls_ptr->cls_name) eprint->cls.cls_name = cls_ptr->cls_name; diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 4e6c57d..1b127c7 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -252,7 +252,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, hdr->addr = udata->addr; /* Magic number */ - if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature") image += H5_SIZEOF_MAGIC; @@ -637,7 +637,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, dblock->addr = udata->dblk_addr; /* Magic number */ - if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5FD.c b/src/H5FD.c index c89c6be..efb8fbb 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -496,9 +496,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) /* Check if driver matches driver information saved. Unfortunately, we can't push this * function to each specific driver because we're checking if the driver is correct. */ - if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family")) + if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family") != 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used") - if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi")) + if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi") != 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used") /* Decode driver information */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index a024ace..7f65f11 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -731,7 +731,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) H5Eclear2(H5E_DEFAULT); /* Make sure the name/version number is correct */ - if (strcmp(name, "NCSAmult")) + if (strcmp(name, "NCSAmult") != 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1); /* Set default values */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 4212794..39f0333 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -248,7 +248,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len fspace->addr = udata->addr; /* Magic number */ - if (HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature") image += H5_SIZEOF_MAGIC; @@ -988,7 +988,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l H5_CHECKED_ASSIGN(old_sect_size, size_t, fspace->sect_size, hsize_t); /* Magic number */ - if (HDmemcmp(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5Gcache.c b/src/H5Gcache.c index eac7545..4713193 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -176,7 +176,7 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, hbool_ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* magic */ - if (HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "bad symbol table node signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 7d29ede..fde5a4f 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -209,7 +209,7 @@ H5HF__hdr_prefix_decode(H5HF_hdr_t *hdr, const uint8_t **image_ref) HDassert(image); /* Magic number */ - if (HDmemcmp(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "wrong fractal heap header signature") image += H5_SIZEOF_MAGIC; @@ -992,7 +992,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED HDassert(iblock->size == len); /* Magic number */ - if (HDmemcmp(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap indirect block signature") image += H5_SIZEOF_MAGIC; @@ -1831,7 +1831,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo image = dblock->blk; /* Magic number */ - if (HDmemcmp(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap direct block signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5HGcache.c b/src/H5HGcache.c index e0e1f2e..379e6f6 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -122,7 +122,7 @@ H5HG__hdr_deserialize(H5HG_heap_t *heap, const uint8_t *image, const H5F_t *f) HDassert(f); /* Magic number */ - if (HDmemcmp(image, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad global heap collection signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 05a45f1..b46280e 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -161,7 +161,7 @@ H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, H5HL_cache_prfx_ud_t * HDassert(udata); /* Check magic number */ - if (HDmemcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad local heap signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5Ocache.c b/src/H5Ocache.c index a903cc1..62dc2f2 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1335,7 +1335,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for magic # on chunks > 0 in later versions of the format */ else if (chunkno > 0 && oh->version > H5O_VERSION_1) { /* Magic number */ - if (HDmemcmp(chunk_image, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(chunk_image, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "wrong object header chunk signature") chunk_image += H5_SIZEOF_MAGIC; } /* end if */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 8a4c155..2ad467f 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -238,7 +238,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l HDassert(table->table_size == len); /* Check magic number */ - if (HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature") image += H5_SIZEOF_MAGIC; @@ -580,7 +580,7 @@ H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED le list->header = udata->header; /* Check magic number */ - if (HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM list signature") image += H5_SIZEOF_MAGIC; diff --git a/src/H5T.c b/src/H5T.c index d736d64..4b1d483 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2834,7 +2834,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c for (i = H5T_g.nsoft - 1; i >= 0; --i) { soft = H5T_g.soft + i; HDassert(soft); - if (name && *name && HDstrcmp(name, soft->name)) + if (name && *name && HDstrcmp(name, soft->name) != 0) continue; if (src && src->shared->type != soft->src) continue; @@ -2856,7 +2856,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c /* Not a match */ if (((H5T_PERS_SOFT == pers && path->is_hard) || (H5T_PERS_HARD == pers && !path->is_hard)) || - (name && *name && HDstrcmp(name, path->name)) || (src && H5T_cmp(src, path->src, FALSE)) || + (name && *name && HDstrcmp(name, path->name) != 0) || (src && H5T_cmp(src, path->src, FALSE)) || (dst && H5T_cmp(dst, path->dst, FALSE)) || (func && func != path->conv.u.app_func)) { /* * Notify all other functions to recalculate private data since some diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 8cc6ede..7b5fce1 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2699,7 +2699,7 @@ H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") for (i = 0, j = 0; i < src->shared->u.enumer.nmembs && j < dst->shared->u.enumer.nmembs; i++, j++) { while (j < dst->shared->u.enumer.nmembs && - HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j])) + HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j]) != 0) j++; if (j >= dst->shared->u.enumer.nmembs) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, diff --git a/test/btree2.c b/test/btree2.c index 25f0d07..cea6f78 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -8801,8 +8801,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); TEST_ERROR /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && - HDstrcmp(env_h5_drvr, "family")); + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0); if (single_file_vfd) { /* Make a copy of the file in memory, in order to speed up deletion testing */ diff --git a/test/cache_image.c b/test/cache_image.c index 9c8f855..5eee99d 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -7850,8 +7850,8 @@ main(void) HDprintf("=========================================\n"); /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && - HDstrcmp(env_h5_drvr, "family")); + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0); nerrs += check_cache_image_ctl_flow_1(single_file_vfd); nerrs += check_cache_image_ctl_flow_2(single_file_vfd); diff --git a/test/cache_logging.c b/test/cache_logging.c index 1ae908b..448e12b 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -76,7 +76,7 @@ test_logging_api(void) if (H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0) TEST_ERROR; if ((is_enabled != is_enabled_out) || (start_on_access != start_on_access_out) || - HDstrcmp(LOG_LOCATION, location)) + HDstrcmp(LOG_LOCATION, location) != 0) TEST_ERROR; /* Create a file */ diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 1008b60..e74b438 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2233,7 +2233,7 @@ main(int argc, char *argv[]) /* Turn off optimized compound converter? */ if (argc > 1) { - if (argc > 2 || HDstrcmp("--noopt", argv[1])) { + if (argc > 2 || HDstrcmp("--noopt", argv[1]) != 0) { HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]); HDexit(EXIT_FAILURE); } diff --git a/test/dsets.c b/test/dsets.c index 0905b4e..7ca076f 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -539,7 +539,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) TESTING("simple I/O"); /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */ - if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + if (HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0) { h5_fixname(FILENAME[4], fapl, filename, sizeof filename); /* Set up data array */ @@ -699,7 +700,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) TESTING("dataset offset with user block"); /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */ - if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + if (HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0) { h5_fixname(FILENAME[2], fapl, filename, sizeof filename); /* Set up data array */ @@ -15081,7 +15083,7 @@ main(void) envval = "nomatch"; /* Current VFD that does not support contigous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(envval, "split") != 0 && HDstrcmp(envval, "multi") != 0); /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); diff --git a/test/dtypes.c b/test/dtypes.c index c0fe764..fe76480 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1141,7 +1141,7 @@ test_compound_5(void) H5Tclose(int_array); /* Check results */ - if (HDmemcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || src[1].tdim != dst[1].tdim || + if (HDmemcmp(src[1].name, dst[1].name, sizeof(src[1].name)) != 0 || src[1].tdim != dst[1].tdim || src[1].coll_ids[0] != dst[1].coll_ids[0] || src[1].coll_ids[1] != dst[1].coll_ids[1] || src[1].coll_ids[2] != dst[1].coll_ids[2] || src[1].coll_ids[3] != dst[1].coll_ids[3]) { H5_FAILED(); @@ -1817,7 +1817,7 @@ test_compound_9(void) goto error; } /* end if */ - if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { + if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str) != 0) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); @@ -1891,7 +1891,7 @@ test_compound_9(void) goto error; } /* end if */ - if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { + if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str) != 0) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); @@ -2081,7 +2081,7 @@ test_compound_10(void) for (i = 0; i < ARRAY_DIM; i++) { if (rdata[i].i1 != wdata[i].i1 || rdata[i].i2 != wdata[i].i2 || - HDstrcmp(rdata[i].str, wdata[i].str)) { + HDstrcmp(rdata[i].str, wdata[i].str) != 0) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); @@ -2097,7 +2097,7 @@ test_compound_10(void) t1 = rdata[i].text.p; t2 = wdata[i].text.p; - if (HDstrcmp((char *)t1, (char *)t2)) { + if (HDstrcmp((char *)t1, (char *)t2) != 0) { H5_FAILED(); AT(); HDprintf("incorrect VL read data\n"); @@ -2282,7 +2282,7 @@ test_compound_11(void) ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) { + else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1) != 0) { HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u, ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR @@ -2333,7 +2333,7 @@ test_compound_11(void) ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) { + else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1) != 0) { HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u, ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR @@ -2374,7 +2374,7 @@ test_compound_11(void) ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) { + else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1) != 0) { HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u, ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR @@ -2956,14 +2956,14 @@ test_compound_14(void) goto error; } /* end if */ - if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) { + if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str) != 0) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); goto error; } /* end if */ - if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) || + if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) != 0 || rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 || rdata2.l4 != wdata2.l4) { H5_FAILED(); @@ -3054,14 +3054,14 @@ test_compound_14(void) goto error; } /* end if */ - if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) { + if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str) != 0) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); goto error; } /* end if */ - if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) || + if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) != 0 || rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 || rdata2.l4 != wdata2.l4) { H5_FAILED(); @@ -3885,7 +3885,7 @@ test_query(void) HDprintf("Can't get name for enum member\n"); goto error; } /* end if */ - if (HDstrcmp("YELLOW", enum_name)) { + if (HDstrcmp("YELLOW", enum_name) != 0) { H5_FAILED(); HDprintf("Incorrect name for enum member\n"); goto error; @@ -4504,14 +4504,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20)) { + if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" Truncated C-string test failed"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20)) { + if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" Extended C-string test failed"); goto error; @@ -4535,14 +4535,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) { + if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20) != 0) { H5_FAILED(); HDputs(" Truncated C buffer test failed"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) { + if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" Extended C buffer test failed"); goto error; @@ -4566,14 +4566,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) { + if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20) != 0) { H5_FAILED(); HDputs(" Truncated Fortran-string test failed"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcde abcde ", (size_t)20)) { + if (HDmemcmp(buf, "abcde abcde ", (size_t)20) != 0) { H5_FAILED(); HDputs(" Extended Fortran-string test failed"); goto error; @@ -4600,7 +4600,7 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) { + if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20) != 0) { H5_FAILED(); HDputs(" Non-terminated string test 1"); goto error; @@ -4611,7 +4611,7 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20)) { + if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20) != 0) { H5_FAILED(); HDputs(" Non-terminated string test 2"); goto error; @@ -4619,7 +4619,7 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", (size_t)20); if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) { + if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" Non-terminated string test 2"); goto error; @@ -4643,14 +4643,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20)) { + if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20) != 0) { H5_FAILED(); HDputs(" C string to Fortran test 1"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20)) { + if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" Fortran to C string test 1"); goto error; @@ -4662,14 +4662,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) { + if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" C string to Fortran test 2"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) { + if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" Fortran to C string test 2"); goto error; @@ -4685,14 +4685,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) { + if (HDmemcmp(buf, "abcd abcd ", (size_t)20) != 0) { H5_FAILED(); HDputs(" C string to Fortran test 3"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) { + if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20) != 0) { H5_FAILED(); HDputs(" Fortran to C string test 3"); goto error; @@ -4716,14 +4716,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) { + if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20) != 0) { H5_FAILED(); HDputs(" C buffer to Fortran test 1"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) { + if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20) != 0) { H5_FAILED(); HDputs(" Fortran to C buffer test 1"); goto error; @@ -4735,14 +4735,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) { + if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" C buffer to Fortran test 2"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) { + if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20) != 0) { H5_FAILED(); HDputs(" Fortran to C buffer test 2"); goto error; @@ -4758,14 +4758,14 @@ test_conv_str_1(void) HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) { + if (HDmemcmp(buf, "abcd abcd ", (size_t)20) != 0) { H5_FAILED(); HDputs(" C buffer to Fortran test 3"); goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) { + if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20) != 0) { H5_FAILED(); HDputs(" Fortran to C buffer test 3"); goto error; @@ -7193,7 +7193,7 @@ test_named_indirect_reopen(hid_t fapl) TEST_ERROR if (NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR - if (HDstrcmp(tag, tag_ret)) + if (HDstrcmp(tag, tag_ret) != 0) TEST_ERROR H5free_memory(tag_ret); tag_ret = NULL; @@ -7209,7 +7209,7 @@ test_named_indirect_reopen(hid_t fapl) TEST_ERROR if (NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR - if (HDstrcmp(tag, tag_ret)) + if (HDstrcmp(tag, tag_ret) != 0) TEST_ERROR H5free_memory(tag_ret); tag_ret = NULL; diff --git a/test/error_test.c b/test/error_test.c index 9bbebec..d7c7b8a 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -195,7 +195,7 @@ init_error(void) if (cls_size != H5Eget_class_name(ERR_CLS, cls_name, (size_t)cls_size) + 1) TEST_ERROR; - if (HDstrcmp(ERR_CLS_NAME, cls_name)) + if (HDstrcmp(ERR_CLS_NAME, cls_name) != 0) TEST_ERROR; if ((ERR_MAJ_TEST = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_TEST_MSG)) < 0) @@ -220,7 +220,7 @@ init_error(void) TEST_ERROR; if (msg_type != H5E_MINOR) TEST_ERROR; - if (HDstrcmp(msg, ERR_MIN_SUBROUTINE_MSG)) + if (HDstrcmp(msg, ERR_MIN_SUBROUTINE_MSG) != 0) TEST_ERROR; /* Register another class for later testing. */ diff --git a/test/external.c b/test/external.c index 0957a03..c2476b3 100644 --- a/test/external.c +++ b/test/external.c @@ -72,7 +72,7 @@ files_have_same_contents(const char *name1, const char *name2) break; } - if (HDmemcmp(buf1, buf2, (size_t)n1)) + if (HDmemcmp(buf1, buf2, (size_t)n1) != 0) break; } /* end while */ diff --git a/test/fheap.c b/test/fheap.c index 5e3251d..4dfda3a 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -424,7 +424,7 @@ add_obj(H5HF_t *fh, size_t obj_off, size_t obj_size, fheap_heap_state_t *state, TEST_ERROR if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(obj, shared_robj_g, obj_size)) + if (HDmemcmp(obj, shared_robj_g, obj_size) != 0) TEST_ERROR /* If the heap IDs are to be retained, append them to the list */ @@ -1192,7 +1192,7 @@ fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size, fheap_heap_state_t *s /* Check that object is correct */ wobj = &shared_wobj_g[*curr_off_ptr]; - if (HDmemcmp(wobj, shared_robj_g, *curr_len_ptr)) + if (HDmemcmp(wobj, shared_robj_g, *curr_len_ptr) != 0) TEST_ERROR /* Adjust object & ID pointers */ @@ -12698,7 +12698,7 @@ test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -12851,7 +12851,7 @@ test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert second object too large for managed heap blocks */ @@ -12881,7 +12881,7 @@ test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id2, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -13084,7 +13084,7 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert second object too large for managed heap blocks */ @@ -13114,7 +13114,7 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id2, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert third object too large for managed heap blocks */ @@ -13144,7 +13144,7 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id3, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -13395,7 +13395,7 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert second object too large for managed heap blocks */ @@ -13425,7 +13425,7 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id2, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert third object too large for managed heap blocks */ @@ -13455,7 +13455,7 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id3, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert fourth object small enough to fit into 'normal' heap blocks */ @@ -13492,7 +13492,7 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id4, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert fifth object small enough to fit into 'normal' heap blocks */ @@ -13530,7 +13530,7 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id5, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -13868,7 +13868,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -14019,7 +14019,7 @@ test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -14172,7 +14172,7 @@ test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert second object small enough to encode in heap ID */ @@ -14202,7 +14202,7 @@ test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id2, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -14418,14 +14418,14 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Check 'op' functionality on first huge object */ HDmemset(shared_robj_g, 0, obj_size); if (H5HF_op(fh, heap_id, op_memcpy, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert second object too large for managed heap blocks */ @@ -14455,14 +14455,14 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id2, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Check 'op' functionality on second huge object */ HDmemset(shared_robj_g, 0, obj_size); if (H5HF_op(fh, heap_id2, op_memcpy, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert third object too large for managed heap blocks */ @@ -14492,14 +14492,14 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id3, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Check 'op' functionality on third huge object */ HDmemset(shared_robj_g, 0, obj_size); if (H5HF_op(fh, heap_id3, op_memcpy, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert fourth object small enough to fit into 'normal' heap blocks */ @@ -14536,14 +14536,14 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id4, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Check 'op' functionality on fourth ('normal') object */ HDmemset(shared_robj_g, 0, obj_size); if (H5HF_op(fh, heap_id4, op_memcpy, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert fifth object small enough to fit into 'normal' heap blocks */ @@ -14581,14 +14581,14 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id5, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Check 'op' functionality on fifth ('normal') object */ HDmemset(shared_robj_g, 0, obj_size); if (H5HF_op(fh, heap_id5, op_memcpy, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert sixth object small enough to encode in heap ID */ @@ -14618,14 +14618,14 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id6, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Check 'op' functionality on sixth ('tiny') object */ HDmemset(shared_robj_g, 0, obj_size); if (H5HF_op(fh, heap_id6, op_memcpy, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Insert seventh object small enough to encode in heap ID */ @@ -14655,14 +14655,14 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id7, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Check 'op' functionality on seventh ('tiny') object */ HDmemset(shared_robj_g, 0, obj_size); if (H5HF_op(fh, heap_id7, op_memcpy, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -15032,7 +15032,7 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -15215,7 +15215,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id1, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Read in ('normal') object #2 */ @@ -15226,7 +15226,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa HDmemset(shared_robj_g, 0, obj_size); if (H5HF_read(fh, heap_id2, shared_robj_g) < 0) FAIL_STACK_ERROR - if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size)) + if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size) != 0) TEST_ERROR /* Delete individual objects, if we won't be deleting the entire heap later */ @@ -16032,7 +16032,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Compare data read in */ - if (HDmemcmp(rewrite_obj, shared_robj_g, obj_size)) + if (HDmemcmp(rewrite_obj, shared_robj_g, obj_size) != 0) TEST_ERROR /* Change size of data to write */ @@ -16081,7 +16081,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Compare data read in */ - if (HDmemcmp(rewrite_obj, shared_robj_g, obj_size)) + if (HDmemcmp(rewrite_obj, shared_robj_g, obj_size) != 0) TEST_ERROR /* Change size of data to write */ @@ -16340,7 +16340,7 @@ main(void) envval = "nomatch"; /* Current VFD that does not support contigous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(envval, "split") != 0 && HDstrcmp(envval, "multi") != 0); /* Reset library */ h5_reset(); diff --git a/test/filenotclosed.c b/test/filenotclosed.c index 519ccb1..b5def9b 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -77,7 +77,7 @@ main(void) * Further investigation is needed to resolve the test failure with the * split/multi driver. Please see HDFFV-10160. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (!contig_addr_vfd) { SKIPPED(); HDputs(" Temporary skipped for a spilt/multi driver"); diff --git a/test/fillval.c b/test/fillval.c index 8a9b41f..4c0361e 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -318,7 +318,7 @@ test_getset_vl(hid_t fapl) TEST_ERROR /* Verify that the fill value is the original value */ - if (HDstrcmp(f2, orig_fill_value)) + if (HDstrcmp(f2, orig_fill_value) != 0) TEST_ERROR /* Release the fill value retrieved */ @@ -360,7 +360,7 @@ test_getset_vl(hid_t fapl) TEST_ERROR /* Verify that the fill value is the original value */ - if (HDstrcmp(f2, orig_fill_value)) + if (HDstrcmp(f2, orig_fill_value) != 0) TEST_ERROR /* Release the fill value retrieved */ @@ -1529,8 +1529,8 @@ test_extend_verify_cmpd_vl(unsigned lineno, const hsize_t *offset, const void *_ (const comp_vl_datatype *)_compare_val; /* Value to compare against */ /* Verify value */ - if ((test_val->x != compare_val->x) || HDstrcmp(test_val->a, compare_val->a) || - HDstrcmp(test_val->b, compare_val->b) || (test_val->y != compare_val->y)) { + if ((test_val->x != compare_val->x) || HDstrcmp(test_val->a, compare_val->a) != 0 || + HDstrcmp(test_val->b, compare_val->b) != 0 || (test_val->y != compare_val->y)) { HDfprintf(stdout, "%u: Value read was not expected.\n", lineno); HDfprintf(stdout, " Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE diff --git a/test/getname.c b/test/getname.c index d90e1c1..b7c0d64 100644 --- a/test/getname.c +++ b/test/getname.c @@ -68,11 +68,11 @@ check_name(hid_t id, const char *chk_name, const char *chk_user_path) TEST_ERROR /* Check on name from H5Iget_name() */ - if (HDstrcmp(name, chk_name)) + if (HDstrcmp(name, chk_name) != 0) goto error; /* Check on user path */ - if (HDstrcmp(user_path, chk_user_path)) + if (HDstrcmp(user_path, chk_user_path) != 0) goto error; /* Check that if user path is hidden, the name from H5Iget_name() and the user path should be different */ @@ -1439,7 +1439,7 @@ test_main(hid_t file_id, hid_t fapl) /* Check that name is longer */ if (name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR - if (HDstrcmp(name2, "/")) + if (HDstrcmp(name2, "/") != 0) TEST_ERROR } @@ -1481,7 +1481,7 @@ test_main(hid_t file_id, hid_t fapl) TEST_ERROR /* Verify */ - if (HDstrcmp(name3, "/g17")) + if (HDstrcmp(name3, "/g17") != 0) TEST_ERROR *name3 = '\0'; @@ -1491,7 +1491,7 @@ test_main(hid_t file_id, hid_t fapl) TEST_ERROR /* Verify */ - if (HDstrcmp(name3, "/g")) + if (HDstrcmp(name3, "/g") != 0) TEST_ERROR HDfree(name3); diff --git a/test/gheap.c b/test/gheap.c index 1d3b730..728f282 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -129,7 +129,7 @@ test_1(hid_t fapl) HDputs(" Unable to read object"); nerrors++; } - else if (HDmemcmp(in, out, size)) { + else if (HDmemcmp(in, out, size) != 0) { H5_FAILED(); HDputs(" Value read doesn't match value written"); nerrors++; @@ -226,7 +226,7 @@ test_2(hid_t fapl) HDputs(" Unable to read object"); nerrors++; } - else if (HDmemcmp(in, out, size)) { + else if (HDmemcmp(in, out, size) != 0) { H5_FAILED(); HDputs(" Value read doesn't match value written"); nerrors++; diff --git a/test/istore.c b/test/istore.c index e634044..c75b8bf 100644 --- a/test/istore.c +++ b/test/istore.c @@ -376,7 +376,7 @@ test_extend(hid_t f, const char *prefix, size_t nx, size_t ny, size_t nz) HDfprintf(stderr, " Read failed: ctr=%lu\n", (unsigned long)ctr); goto error; } - if (HDmemcmp(buf, check, (size_t)nelmts)) { + if (HDmemcmp(buf, check, (size_t)nelmts) != 0) { H5_FAILED(); HDfprintf(stderr, " Read check failed: ctr=%lu\n", (unsigned long)ctr); HDfprintf(stderr, " Wrote:\n"); diff --git a/test/lheap.c b/test/lheap.c index 125081c..f249ade 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -155,7 +155,7 @@ main(void) goto error; } - if (HDstrcmp(s, buf)) { + if (HDstrcmp(s, buf) != 0) { H5_FAILED(); HDprintf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i])); HDprintf(" got: \"%s\"\n", s); diff --git a/test/links.c b/test/links.c index def3768..e519435 100644 --- a/test/links.c +++ b/test/links.c @@ -697,7 +697,7 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ if (H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if (HDstrcmp(linkval, "/d1")) { + if (HDstrcmp(linkval, "/d1") != 0) { H5_FAILED(); HDputs(" Soft link test failed. Wrong link value"); TEST_ERROR @@ -728,7 +728,7 @@ cklinks(hid_t fapl, hbool_t new_format) HDprintf(" %d: Can't retrieve link value\n", __LINE__); TEST_ERROR } /* end if */ - if (HDstrcmp(linkval, "foobar")) { + if (HDstrcmp(linkval, "foobar") != 0) { H5_FAILED(); HDputs(" Dangling link test failed. Wrong link value"); TEST_ERROR @@ -759,7 +759,7 @@ cklinks(hid_t fapl, hbool_t new_format) HDprintf(" %d: Can't retrieve link value\n", __LINE__); TEST_ERROR } /* end if */ - if (HDstrcmp(linkval, "/grp1/recursive")) { + if (HDstrcmp(linkval, "/grp1/recursive") != 0) { H5_FAILED(); HDputs(" Recursive link test failed. Wrong link value"); TEST_ERROR @@ -1058,7 +1058,7 @@ toomany(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/hard21")) + if (HDstrcmp(objname, "/hard21") != 0) TEST_ERROR /* Create object in hard-linked group */ @@ -1089,7 +1089,7 @@ toomany(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/soft16")) + if (HDstrcmp(objname, "/soft16") != 0) TEST_ERROR /* Create object using soft links */ @@ -1955,7 +1955,7 @@ test_deprec(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if (H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) FAIL_STACK_ERROR - if (HDstrcmp(tmpstr, "comment")) + if (HDstrcmp(tmpstr, "comment") != 0) TEST_ERROR /* Create links using H5Glink and H5Glink2 */ @@ -1971,7 +1971,7 @@ test_deprec(hid_t fapl, hbool_t new_format) /* Test getting the names for objects */ if (H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0) FAIL_STACK_ERROR - if (HDstrcmp(tmpstr, "link_to_group2")) + if (HDstrcmp(tmpstr, "link_to_group2") != 0) TEST_ERROR H5E_BEGIN_TRY { @@ -2008,7 +2008,7 @@ test_deprec(hid_t fapl, hbool_t new_format) if (H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno)) != 0) { H5_FAILED(); HDputs(" Hard link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -2021,7 +2021,7 @@ test_deprec(hid_t fapl, hbool_t new_format) if (H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno)) != 0) { H5_FAILED(); HDputs(" Hard link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -2038,7 +2038,7 @@ test_deprec(hid_t fapl, hbool_t new_format) if (H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, tmpstr) < 0) FAIL_STACK_ERROR - if (HDstrcmp("link_to_group1", tmpstr)) + if (HDstrcmp("link_to_group1", tmpstr) != 0) TEST_ERROR /* Test non-existing links with H5Gget_objinfo */ @@ -2059,7 +2059,7 @@ test_deprec(hid_t fapl, hbool_t new_format) if (H5Gget_linkval(group2_id, "dangle_soft_link", sb_soft2.linklen, tmpstr) < 0) FAIL_STACK_ERROR - if (HDstrcmp("dangle", tmpstr)) + if (HDstrcmp("dangle", tmpstr) != 0) TEST_ERROR /* Test H5Gmove and H5Gmove2 */ @@ -2200,7 +2200,7 @@ cklinks_deprec(hid_t fapl, hbool_t new_format) } /* end if */ if (H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if (HDstrcmp(linkval, "/d1")) { + if (HDstrcmp(linkval, "/d1") != 0) { H5_FAILED(); HDputs(" Soft link test failed. Wrong link value"); TEST_ERROR @@ -2231,7 +2231,7 @@ cklinks_deprec(hid_t fapl, hbool_t new_format) HDprintf(" %d: Can't retrieve link value\n", __LINE__); TEST_ERROR } /* end if */ - if (HDstrcmp(linkval, "foobar")) { + if (HDstrcmp(linkval, "foobar") != 0) { H5_FAILED(); HDputs(" Dangling link test failed. Wrong link value"); TEST_ERROR @@ -2262,7 +2262,7 @@ cklinks_deprec(hid_t fapl, hbool_t new_format) HDprintf(" %d: Can't retrieve link value\n", __LINE__); TEST_ERROR } /* end if */ - if (HDstrcmp(linkval, "/grp1/recursive")) { + if (HDstrcmp(linkval, "/grp1/recursive") != 0) { H5_FAILED(); HDputs(" Recursive link test failed. Wrong link value"); TEST_ERROR @@ -2799,12 +2799,12 @@ external_link_root_deprec(hid_t fapl, hbool_t new_format) TEST_ERROR if (H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR - if (HDstrcmp(file, filename1)) { + if (HDstrcmp(file, filename1) != 0) { H5_FAILED(); HDputs(" External link file name incorrect"); goto error; } - if (HDstrcmp(path, "/")) { + if (HDstrcmp(path, "/") != 0) { H5_FAILED(); HDputs(" External link path incorrect"); goto error; @@ -2827,12 +2827,12 @@ external_link_root_deprec(hid_t fapl, hbool_t new_format) TEST_ERROR if (H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR - if (HDstrcmp(file, filename1)) { + if (HDstrcmp(file, filename1) != 0) { H5_FAILED(); HDputs(" External link file name incorrect"); goto error; } - if (HDstrcmp(path, "/")) { + if (HDstrcmp(path, "/") != 0) { H5_FAILED(); HDputs(" External link path incorrect"); goto error; @@ -2851,7 +2851,7 @@ external_link_root_deprec(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/")) + if (HDstrcmp(objname, "/") != 0) TEST_ERROR /* Create object in external file */ @@ -2896,11 +2896,11 @@ external_link_root_deprec(hid_t fapl, hbool_t new_format) /* Check names */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/new_group")) + if (HDstrcmp(objname, "/new_group") != 0) TEST_ERROR if (H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/newer_group")) + if (HDstrcmp(objname, "/newer_group") != 0) TEST_ERROR /* Close opened objects */ @@ -3045,9 +3045,9 @@ external_link_query_deprec(hid_t fapl, hbool_t new_format) TEST_ERROR /* Compare the file and object names */ - if (HDstrcmp(file_name, filename2)) + if (HDstrcmp(file_name, filename2) != 0) TEST_ERROR - if (HDstrcmp(object_name, "/dst")) + if (HDstrcmp(object_name, "/dst") != 0) TEST_ERROR /* Query information about object that external link points to */ @@ -3241,7 +3241,7 @@ external_link_closing_deprec(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if (H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if (HDstrcmp(buf, "comment")) + if (HDstrcmp(buf, "comment") != 0) TEST_ERROR /* Test H5*open */ @@ -3658,7 +3658,7 @@ ud_hard_links_deprec(hid_t fapl) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/group")) + if (HDstrcmp(objname, "/group") != 0) TEST_ERROR /* Create object in group */ @@ -3678,7 +3678,7 @@ ud_hard_links_deprec(hid_t fapl) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/group/new_group")) + if (HDstrcmp(objname, "/group/new_group") != 0) TEST_ERROR /* Close opened object */ @@ -3841,7 +3841,7 @@ ud_link_reregister_deprec(hid_t fapl) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/" REREG_TARGET_NAME)) + if (HDstrcmp(objname, "/" REREG_TARGET_NAME) != 0) TEST_ERROR /* Create object in group */ @@ -3861,7 +3861,7 @@ ud_link_reregister_deprec(hid_t fapl) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/rereg_target/new_group")) + if (HDstrcmp(objname, "/rereg_target/new_group") != 0) TEST_ERROR /* Close opened object */ @@ -4205,7 +4205,7 @@ lapl_nlinks_deprec(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/soft17")) + if (HDstrcmp(objname, "/soft17") != 0) TEST_ERROR /* Create group using soft link */ @@ -4246,7 +4246,7 @@ lapl_nlinks_deprec(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/soft4")) + if (HDstrcmp(objname, "/soft4") != 0) TEST_ERROR /* Test other functions that should use a LAPL */ @@ -4861,7 +4861,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -4870,7 +4870,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR /* Don't test "native" order if there is no creation order index, since @@ -4900,7 +4900,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -4909,7 +4909,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR } /* end if */ @@ -4934,7 +4934,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -4943,7 +4943,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR /* Verify the link information for first link, in increasing link name order */ @@ -4966,7 +4966,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -4975,7 +4975,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR /* Don't test "native" order queries on link name order, since there's not @@ -5002,7 +5002,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -5011,7 +5011,7 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, h if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR /* Success */ @@ -5358,7 +5358,7 @@ link_info_by_idx_old_deprec(hid_t fapl) if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end else */ @@ -5366,7 +5366,7 @@ link_info_by_idx_old_deprec(hid_t fapl) if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR /* Verify link information (in native order - native is increasing) */ @@ -5381,7 +5381,7 @@ link_info_by_idx_old_deprec(hid_t fapl) if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end else */ @@ -5389,7 +5389,7 @@ link_info_by_idx_old_deprec(hid_t fapl) if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR /* Make link name for decreasing order queries */ @@ -5410,7 +5410,7 @@ link_info_by_idx_old_deprec(hid_t fapl) if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end else */ @@ -5418,7 +5418,7 @@ link_info_by_idx_old_deprec(hid_t fapl) if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -5644,7 +5644,7 @@ delete_by_idx_deprec(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -5718,7 +5718,7 @@ delete_by_idx_deprec(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -5797,7 +5797,7 @@ delete_by_idx_deprec(hid_t fapl) else HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -5831,7 +5831,7 @@ delete_by_idx_deprec(hid_t fapl) else HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -5998,7 +5998,7 @@ delete_by_idx_old_deprec(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -6072,7 +6072,7 @@ delete_by_idx_old_deprec(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); else HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -6106,7 +6106,7 @@ delete_by_idx_old_deprec(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); else HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -6188,7 +6188,7 @@ link_iterate_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); - if (HDstrcmp(link_name, objname)) + if (HDstrcmp(link_name, objname) != 0) return H5_ITER_ERROR; /* Check if we've visited this link before */ @@ -6685,7 +6685,7 @@ link_iterate_old_deprec_cb(hid_t group_id, const char *link_name, const H5L_info /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); - if (HDstrcmp(link_name, objname)) + if (HDstrcmp(link_name, objname) != 0) return H5_ITER_ERROR; /* Check if we've visited this link before */ @@ -7105,12 +7105,12 @@ external_link_root(hid_t fapl, hbool_t new_format) TEST_ERROR if (H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR - if (HDstrcmp(file, filename1)) { + if (HDstrcmp(file, filename1) != 0) { H5_FAILED(); HDputs(" External link file name incorrect"); goto error; } - if (HDstrcmp(path, "/")) { + if (HDstrcmp(path, "/") != 0) { H5_FAILED(); HDputs(" External link path incorrect"); goto error; @@ -7133,12 +7133,12 @@ external_link_root(hid_t fapl, hbool_t new_format) TEST_ERROR if (H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR - if (HDstrcmp(file, filename1)) { + if (HDstrcmp(file, filename1) != 0) { H5_FAILED(); HDputs(" External link file name incorrect"); goto error; } - if (HDstrcmp(path, "/")) { + if (HDstrcmp(path, "/") != 0) { H5_FAILED(); HDputs(" External link path incorrect"); goto error; @@ -7157,7 +7157,7 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/")) + if (HDstrcmp(objname, "/") != 0) TEST_ERROR /* Create object in external file */ @@ -7202,11 +7202,11 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check names */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/new_group")) + if (HDstrcmp(objname, "/new_group") != 0) TEST_ERROR if (H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/newer_group")) + if (HDstrcmp(objname, "/newer_group") != 0) TEST_ERROR /* Close opened objects */ @@ -7325,7 +7325,7 @@ external_link_path(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/A/B/C")) + if (HDstrcmp(objname, "/A/B/C") != 0) TEST_ERROR /* Create object in external file */ @@ -7355,7 +7355,7 @@ external_link_path(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/A/B/C/new_group")) + if (HDstrcmp(objname, "/A/B/C/new_group") != 0) TEST_ERROR /* Close opened object */ @@ -7497,7 +7497,7 @@ external_link_mult(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/A/B/C")) + if (HDstrcmp(objname, "/A/B/C") != 0) TEST_ERROR /* Create object in external file */ @@ -7527,7 +7527,7 @@ external_link_mult(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/A/B/C/new_group")) + if (HDstrcmp(objname, "/A/B/C/new_group") != 0) TEST_ERROR /* Close opened object */ @@ -7643,7 +7643,7 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/X")) + if (HDstrcmp(objname, "/X") != 0) TEST_ERROR /* Create object through external link */ @@ -7665,7 +7665,7 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/X/new_group")) + if (HDstrcmp(objname, "/X/new_group") != 0) TEST_ERROR /* Close opened object */ @@ -7850,7 +7850,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/final")) + if (HDstrcmp(objname, "/final") != 0) TEST_ERROR /* Create object in external file */ @@ -7880,7 +7880,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/final/new_group")) + if (HDstrcmp(objname, "/final/new_group") != 0) TEST_ERROR /* Close opened object */ @@ -8039,7 +8039,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/final")) + if (HDstrcmp(objname, "/final") != 0) TEST_ERROR /* Create object in external file */ @@ -9753,13 +9753,13 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group, cons set_elink_cb_t *op_data = (set_elink_cb_t *)_op_data; /* Verify file and object names are correct */ - if (HDstrcmp(parent_file, op_data->parent_file)) + if (HDstrcmp(parent_file, op_data->parent_file) != 0) return FAIL; - if (HDstrcmp(parent_group, "/group1")) + if (HDstrcmp(parent_group, "/group1") != 0) return FAIL; - if (HDstrcmp(target_file, op_data->target_file)) + if (HDstrcmp(target_file, op_data->target_file) != 0) return FAIL; - if (HDstrcmp(target_obj, "/")) + if (HDstrcmp(target_obj, "/") != 0) return FAIL; /* Set flags to be read-write */ @@ -10983,9 +10983,9 @@ external_link_query(hid_t fapl, hbool_t new_format) TEST_ERROR /* Compare the file and object names */ - if (HDstrcmp(file_name, filename2)) + if (HDstrcmp(file_name, filename2) != 0) TEST_ERROR - if (HDstrcmp(object_name, "/dst")) + if (HDstrcmp(object_name, "/dst") != 0) TEST_ERROR /* Query information about object that external link points to */ @@ -11382,7 +11382,7 @@ external_link_move(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if (HDstrcmp(objname, "/dst")) + if (HDstrcmp(objname, "/dst") != 0) TEST_ERROR /* Create object in external file */ @@ -11442,7 +11442,7 @@ external_link_move(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if (HDstrcmp(objname, "/dst")) + if (HDstrcmp(objname, "/dst") != 0) TEST_ERROR /* Create object in external file */ @@ -11489,7 +11489,7 @@ external_link_move(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if (HDstrcmp(objname, "/dst")) + if (HDstrcmp(objname, "/dst") != 0) TEST_ERROR /* Move external link back to original location */ @@ -11499,7 +11499,7 @@ external_link_move(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if (HDstrcmp(objname, "/dst")) + if (HDstrcmp(objname, "/dst") != 0) TEST_ERROR /* Create object in external file */ @@ -11673,7 +11673,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/dst")) + if (HDstrcmp(objname, "/dst") != 0) TEST_ERROR /* Create object in external file */ @@ -11722,7 +11722,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/dst")) + if (HDstrcmp(objname, "/dst") != 0) TEST_ERROR /* Create object in external file */ @@ -11915,7 +11915,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if (H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if (HDstrcmp(buf, "comment")) + if (HDstrcmp(buf, "comment") != 0) TEST_ERROR /* Test H5*open */ @@ -12258,7 +12258,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if (H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/A/B/C")) + if (HDstrcmp(objname, "/A/B/C") != 0) TEST_ERROR if (H5Gclose(gid2) < 0) TEST_ERROR @@ -13823,7 +13823,7 @@ ud_hard_links(hid_t fapl) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/group")) + if (HDstrcmp(objname, "/group") != 0) TEST_ERROR /* Create object in group */ @@ -13843,7 +13843,7 @@ ud_hard_links(hid_t fapl) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/group/new_group")) + if (HDstrcmp(objname, "/group/new_group") != 0) TEST_ERROR /* Close opened object */ @@ -14034,7 +14034,7 @@ ud_link_reregister(hid_t fapl) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/" REREG_TARGET_NAME)) + if (HDstrcmp(objname, "/" REREG_TARGET_NAME) != 0) TEST_ERROR /* Create object in group */ @@ -14054,7 +14054,7 @@ ud_link_reregister(hid_t fapl) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/rereg_target/new_group")) + if (HDstrcmp(objname, "/rereg_target/new_group") != 0) TEST_ERROR /* Close opened object */ @@ -14143,9 +14143,9 @@ UD_cb_create(const char *link_name, hid_t loc_group, const void *udata, size_t u if (lcpl_id < 0) TEST_ERROR - if (HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) + if (HDstrcmp(link_name, UD_CB_LINK_NAME) != 0 && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME) != 0) TEST_ERROR - if (HDstrcmp((const char *)udata, UD_CB_TARGET)) + if (HDstrcmp((const char *)udata, UD_CB_TARGET) != 0) TEST_ERROR if (udata_size != UD_CB_TARGET_LEN) TEST_ERROR @@ -14170,9 +14170,9 @@ UD_cb_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t if (udata_size > 0 && !udata) TEST_ERROR - if (HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) + if (HDstrcmp(link_name, UD_CB_LINK_NAME) != 0 && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME) != 0) TEST_ERROR - if (HDstrcmp((const char *)udata, UD_CB_TARGET)) + if (HDstrcmp((const char *)udata, UD_CB_TARGET) != 0) TEST_ERROR if (udata_size != UD_CB_TARGET_LEN) TEST_ERROR @@ -14197,9 +14197,9 @@ UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, size_t udata_ if (udata_size > 0 && !udata) TEST_ERROR - if (HDstrcmp(new_name, NEW_UD_CB_LINK_NAME)) + if (HDstrcmp(new_name, NEW_UD_CB_LINK_NAME) != 0) TEST_ERROR - if (HDstrcmp((const char *)udata, UD_CB_TARGET)) + if (HDstrcmp((const char *)udata, UD_CB_TARGET) != 0) TEST_ERROR if (udata_size != UD_CB_TARGET_LEN) TEST_ERROR @@ -14221,9 +14221,9 @@ UD_cb_delete(const char *link_name, hid_t file, const void *udata, size_t udata_ if (udata_size > 0 && !udata) TEST_ERROR - if (HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) + if (HDstrcmp(link_name, UD_CB_LINK_NAME) != 0 && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME) != 0) TEST_ERROR - if (HDstrcmp((const char *)udata, UD_CB_TARGET)) + if (HDstrcmp((const char *)udata, UD_CB_TARGET) != 0) TEST_ERROR if (udata_size != UD_CB_TARGET_LEN) TEST_ERROR @@ -14243,9 +14243,9 @@ UD_cb_query(const char *link_name, const void *udata, size_t udata_size, void *b if (udata_size > 0 && !udata) TEST_ERROR - if (HDstrcmp(link_name, UD_CB_LINK_NAME)) + if (HDstrcmp(link_name, UD_CB_LINK_NAME) != 0) TEST_ERROR - if (HDstrcmp((const char *)udata, UD_CB_TARGET)) + if (HDstrcmp((const char *)udata, UD_CB_TARGET) != 0) TEST_ERROR if (udata_size != UD_CB_TARGET_LEN) TEST_ERROR @@ -15077,7 +15077,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/soft17")) + if (HDstrcmp(objname, "/soft17") != 0) TEST_ERROR /* Create group using soft link */ @@ -15118,7 +15118,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* Check name */ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/soft4")) + if (HDstrcmp(objname, "/soft4") != 0) TEST_ERROR /* Test other functions that should use a LAPL */ @@ -15572,7 +15572,7 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info2_t lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; /* Check for correct link information */ - if (HDstrcmp(op_data->info[op_data->idx].path, name)) + if (HDstrcmp(op_data->info[op_data->idx].path, name) != 0) return (H5_ITER_ERROR); if (op_data->info[op_data->idx].type != linfo->type) return (H5_ITER_ERROR); @@ -15763,7 +15763,7 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info2_t ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; /* Check for correct object information */ - if (HDstrcmp(op_data->info[op_data->idx].path, name)) + if (HDstrcmp(op_data->info[op_data->idx].path, name) != 0) return (H5_ITER_ERROR); if (op_data->info[op_data->idx].type != oinfo->type) return (H5_ITER_ERROR); @@ -16297,13 +16297,13 @@ link_filters(hid_t fapl, hbool_t new_format) if (H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR - if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || + if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) != 0 || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR if (H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR - if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || + if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) != 0 || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR @@ -16314,7 +16314,7 @@ link_filters(hid_t fapl, hbool_t new_format) if (H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR - if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || + if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) != 0 || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR @@ -17753,7 +17753,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -17762,7 +17762,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR /* Don't test "native" order if there is no creation order index, since @@ -17792,7 +17792,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -17801,7 +17801,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR } /* end if */ @@ -17826,7 +17826,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -17835,7 +17835,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR /* Verify the link information for first link, in increasing link name order */ @@ -17858,7 +17858,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -17867,7 +17867,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR /* Don't test "native" order queries on link name order, since there's not @@ -17894,7 +17894,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end if */ @@ -17903,7 +17903,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(linkname, tmpname)) + if (HDstrcmp(linkname, tmpname) != 0) TEST_ERROR /* Success */ @@ -18260,7 +18260,7 @@ link_info_by_idx_old(hid_t fapl) if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end else */ @@ -18268,7 +18268,7 @@ link_info_by_idx_old(hid_t fapl) if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR /* Verify link information (in native order - native is increasing) */ @@ -18285,7 +18285,7 @@ link_info_by_idx_old(hid_t fapl) if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end else */ @@ -18293,7 +18293,7 @@ link_info_by_idx_old(hid_t fapl) if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR /* Make link name for decreasing order queries */ @@ -18316,7 +18316,7 @@ link_info_by_idx_old(hid_t fapl) if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(valname, tmpval)) + if (HDstrcmp(valname, tmpval) != 0) TEST_ERROR } /* end else */ @@ -18324,7 +18324,7 @@ link_info_by_idx_old(hid_t fapl) if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -18548,7 +18548,7 @@ delete_by_idx(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -18622,7 +18622,7 @@ delete_by_idx(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -18701,7 +18701,7 @@ delete_by_idx(hid_t fapl) else HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -18735,7 +18735,7 @@ delete_by_idx(hid_t fapl) else HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -18916,7 +18916,7 @@ delete_by_idx_old(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -18995,7 +18995,7 @@ delete_by_idx_old(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); else HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -19033,7 +19033,7 @@ delete_by_idx_old(hid_t fapl) HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); else HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if (HDstrcmp(objname, tmpname)) + if (HDstrcmp(objname, tmpname) != 0) TEST_ERROR } /* end for */ @@ -19119,7 +19119,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); - if (HDstrcmp(link_name, objname)) + if (HDstrcmp(link_name, objname) != 0) return H5_ITER_ERROR; /* Check if we've visited this link before */ @@ -19625,7 +19625,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info2_t *in /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); - if (HDstrcmp(link_name, objname)) + if (HDstrcmp(link_name, objname) != 0) return H5_ITER_ERROR; /* Check if we've visited this link before */ diff --git a/test/links_env.c b/test/links_env.c index 1a78ae2..1b4b80b 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -69,7 +69,7 @@ external_link_env(hid_t fapl, hbool_t new_format) if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL) envval = "nomatch"; - if (HDstrcmp(envval, ".:tmp_links_env")) + if (HDstrcmp(envval, ".:tmp_links_env") != 0) TEST_ERROR /* Set up name for main file:"extlinks_env0" */ diff --git a/test/mf.c b/test/mf.c index d6f9fb7..bbe99b1 100644 --- a/test/mf.c +++ b/test/mf.c @@ -230,7 +230,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -378,7 +378,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -665,7 +665,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -872,7 +872,8 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) TESTING("'temporary' file space allocation with old library format") /* Can't run this test with multi-file VFDs */ - if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + if (HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0) { char filename[FILENAME_LEN]; /* Filename to use */ H5F_t * f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -1998,7 +1999,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("A free-space section absorbs an aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2171,7 +2172,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2322,7 +2323,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 2"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2477,7 +2478,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator: test 3"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2642,7 +2643,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 4"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2788,7 +2789,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 5"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2923,7 +2924,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 6"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3094,7 +3095,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 7"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3262,7 +3263,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_extend() of meta/sdata aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3557,7 +3558,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3808,8 +3809,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")); + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0); if (have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4249,8 +4250,8 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")); + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0); if (have_alloc_vfd) { if ((file_size = h5_get_file_size(filename, new_fapl)) < 0) TEST_ERROR @@ -4452,8 +4453,8 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")); + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0); if (have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4711,8 +4712,8 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")); + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0); if (have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5053,8 +5054,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")); + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0); if (have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5363,8 +5364,8 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")); + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0); if (have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5578,8 +5579,8 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")); + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0); if (have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5845,8 +5846,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")); + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0); if (have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -6856,7 +6857,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) else TESTING("File's free-space is persistent with old library format") - if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if (HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0) { /* File creation property list template */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) @@ -7033,7 +7034,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) TESTING("File's free-space is going away with old library format") /* Current VFD that does not support contigous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { @@ -7224,7 +7225,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for TESTING("File space strategy/persisting/threshold with old library format") /* Current VFD that does not support contigous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -7394,7 +7395,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format TESTING("File space merge/shrink for section size < threshold with old library format") /* Current VFD that does not support contigous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -7956,7 +7957,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_shrink()"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { @@ -8085,8 +8086,8 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_extend() a small block"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && - HDstrcmp(env_h5_drvr, "family")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0); if (contig_addr_vfd) { @@ -8264,7 +8265,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_extend() a large block"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { @@ -8428,7 +8429,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: large allocations and de-allocations"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); if (contig_addr_vfd) { diff --git a/test/mount.c b/test/mount.c index 94d372e..1ed8f58 100644 --- a/test/mount.c +++ b/test/mount.c @@ -1547,7 +1547,7 @@ test_mount_after_close(hid_t fapl) *objname = '\0'; if (H5Iget_name(gidABMX, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if (HDstrcmp(objname, "/A/B/M/X")) + if (HDstrcmp(objname, "/A/B/M/X") != 0) TEST_ERROR /* Close object in mounted file */ @@ -1562,7 +1562,7 @@ test_mount_after_close(hid_t fapl) *objname = '\0'; if (H5Iget_name(gidABC, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if (HDstrcmp(objname, "/A/B/C")) + if (HDstrcmp(objname, "/A/B/C") != 0) TEST_ERROR /* Close object in mounted file */ @@ -1577,7 +1577,7 @@ test_mount_after_close(hid_t fapl) *objname = '\0'; if (H5Iget_name(gidABT, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if (HDstrcmp(objname, "/A/B/T")) + if (HDstrcmp(objname, "/A/B/T") != 0) TEST_ERROR /* Close object in original file */ @@ -1592,7 +1592,7 @@ test_mount_after_close(hid_t fapl) *objname = '\0'; if (H5Iget_name(didABMXYD, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if (HDstrcmp(objname, "/A/B/M/X/Y/D")) + if (HDstrcmp(objname, "/A/B/M/X/Y/D") != 0) TEST_ERROR /* Close object in mounted file */ @@ -1765,7 +1765,7 @@ test_mount_after_unmount(hid_t fapl) *objname = '\0'; if (H5Iget_name(gidAMXX, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/A/M/X/X")) + if (HDstrcmp(objname, "/A/M/X/X") != 0) TEST_ERROR /* Open group in mounted file #2 */ @@ -1785,7 +1785,7 @@ test_mount_after_unmount(hid_t fapl) *objname = '\0'; if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/A/M/X/M/Y")) + if (HDstrcmp(objname, "/A/M/X/M/Y") != 0) TEST_ERROR /* Unmount second file */ @@ -1796,7 +1796,7 @@ test_mount_after_unmount(hid_t fapl) *objname = '\0'; if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/X/M/Y")) + if (HDstrcmp(objname, "/X/M/Y") != 0) TEST_ERROR /* Rename object in file #3 that is "disconnected" from name hiearchy */ @@ -1816,7 +1816,7 @@ test_mount_after_unmount(hid_t fapl) *objname = '\0'; if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/X/M/Z")) + if (HDstrcmp(objname, "/X/M/Z") != 0) TEST_ERROR /* Mount fourth file */ @@ -1832,7 +1832,7 @@ test_mount_after_unmount(hid_t fapl) *objname = '\0'; if (H5Iget_name(gidBMZ, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(objname, "/B/M/Z")) + if (HDstrcmp(objname, "/B/M/Z") != 0) TEST_ERROR /* Unmount third file */ @@ -3080,7 +3080,7 @@ test_mult_mount(hid_t fapl) *name = '\0'; if (H5Iget_name(gidAMT, name, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(name, "/A/M/T")) + if (HDstrcmp(name, "/A/M/T") != 0) TEST_ERROR /* Create object in file #3 */ @@ -3098,7 +3098,7 @@ test_mult_mount(hid_t fapl) *name = '\0'; if (H5Iget_name(gidBS, name, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(name, "/B/S")) + if (HDstrcmp(name, "/B/S") != 0) TEST_ERROR /* Re-open object created in file #3 through file #1 mount path */ @@ -3279,7 +3279,7 @@ test_nested_survive(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/A/M")) + if (name_len == 0 || HDstrcmp(name, "/A/M") != 0) TEST_ERROR /* Unmount file #2 from file #1 */ @@ -3290,7 +3290,7 @@ test_nested_survive(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len != 0 || HDstrcmp(name, "")) + if (name_len != 0 || HDstrcmp(name, "") != 0) TEST_ERROR /* Open object in file #3 through file #1 mount path (should fail) */ @@ -3307,7 +3307,7 @@ test_nested_survive(hid_t fapl) *name = '\0'; if (H5Iget_name(gidMS, name, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(name, "/M/S")) + if (HDstrcmp(name, "/M/S") != 0) TEST_ERROR /* Close group in file #3 */ @@ -3326,7 +3326,7 @@ test_nested_survive(hid_t fapl) *name = '\0'; if (H5Iget_name(gidAMS, name, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if (HDstrcmp(name, "/A/M/S")) + if (HDstrcmp(name, "/A/M/S") != 0) TEST_ERROR /* Close group in file #3 */ @@ -3475,7 +3475,7 @@ test_close_parent(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/A/M")) + if (name_len == 0 || HDstrcmp(name, "/A/M") != 0) TEST_ERROR /* Unmount file #2 from file #1, closing file #1 */ @@ -3486,7 +3486,7 @@ test_close_parent(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/M")) + if (name_len == 0 || HDstrcmp(name, "/M") != 0) TEST_ERROR /* Just file #2's underlying shared file should be open still */ @@ -3753,7 +3753,7 @@ test_cut_graph(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/A/E/M")) + if (name_len == 0 || HDstrcmp(name, "/A/E/M") != 0) TEST_ERROR /* Open object in file #7 */ @@ -3764,7 +3764,7 @@ test_cut_graph(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/B/I/Q")) + if (name_len == 0 || HDstrcmp(name, "/B/I/Q") != 0) TEST_ERROR /* Close file #1 */ @@ -3821,7 +3821,7 @@ test_cut_graph(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidK, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/D/K")) + if (name_len == 0 || HDstrcmp(name, "/D/K") != 0) TEST_ERROR if (H5Gclose(gidK) < 0) @@ -3841,7 +3841,7 @@ test_cut_graph(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/B/H/O")) + if (name_len == 0 || HDstrcmp(name, "/B/H/O") != 0) TEST_ERROR if (H5Gclose(gidO) < 0) @@ -3851,14 +3851,14 @@ test_cut_graph(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/E/M")) + if (name_len == 0 || HDstrcmp(name, "/E/M") != 0) TEST_ERROR /* Check the name of "Q" is still defined */ *name = '\0'; if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/B/I/Q")) + if (name_len == 0 || HDstrcmp(name, "/B/I/Q") != 0) TEST_ERROR /* Check that all seven underlying files are still opened */ @@ -3883,7 +3883,7 @@ test_cut_graph(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/I/Q")) + if (name_len == 0 || HDstrcmp(name, "/I/Q") != 0) TEST_ERROR /* Open object in file #6 from file #7 */ @@ -3894,7 +3894,7 @@ test_cut_graph(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/H/O")) + if (name_len == 0 || HDstrcmp(name, "/H/O") != 0) TEST_ERROR if (H5Gclose(gidO) < 0) @@ -4060,7 +4060,7 @@ test_symlink(hid_t fapl) *name = '\0'; if ((name_len = H5Iget_name(gidL, name, (size_t)NAME_BUF_SIZE)) < 0) TEST_ERROR - if (name_len == 0 || HDstrcmp(name, "/L")) + if (name_len == 0 || HDstrcmp(name, "/L") != 0) TEST_ERROR /* Close file #1 */ diff --git a/test/objcopy.c b/test/objcopy.c index 717427a..4b076ba 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1103,7 +1103,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* Iterate over all elements, calling memcmp() for each */ for (elmt = 0; elmt < nelmts; elmt++) { - if (HDmemcmp(memb1, memb2, memb_size)) + if (HDmemcmp(memb1, memb2, memb_size) != 0) TEST_ERROR /* Update member pointers */ @@ -1325,7 +1325,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, else TEST_ERROR } /* end else */ - else if (HDmemcmp(buf1, buf2, (elmt_size * nelmts))) + else if (HDmemcmp(buf1, buf2, (elmt_size * nelmts)) != 0) TEST_ERROR /* Data should be the same. :-) */ @@ -1596,7 +1596,7 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if (H5Lget_name_by_idx(gid2, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(objname, objname2)) + if (HDstrcmp(objname, objname2) != 0) TEST_ERROR /* Get link info */ @@ -1710,7 +1710,7 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) TEST_ERROR /* Compare link data */ - if (HDmemcmp(linkval, linkval2, linfo.u.val_size)) + if (HDmemcmp(linkval, linkval2, linfo.u.val_size) != 0) TEST_ERROR } /* end else-if */ else { @@ -7025,7 +7025,7 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2) FAIL_STACK_ERROR if (HDstrlen(rbuf.v) != HDstrlen(rbuf2.v)) FAIL_STACK_ERROR - if (HDmemcmp(rbuf.v, rbuf2.v, HDstrlen(rbuf.v))) + if (HDmemcmp(rbuf.v, rbuf2.v, HDstrlen(rbuf.v)) != 0) FAIL_STACK_ERROR /* Reclaim vlen buffer */ @@ -11695,9 +11695,9 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap TEST_ERROR /* Verify that the references contain only "0" bytes */ - if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf))) + if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf)) != 0) TEST_ERROR - if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf))) + if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf)) != 0) TEST_ERROR /* Close datasets */ @@ -11740,9 +11740,9 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap TEST_ERROR /* Verify that the references contain only "0" bytes */ - if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf))) + if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf)) != 0) TEST_ERROR - if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf))) + if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf)) != 0) TEST_ERROR /* Close */ @@ -11902,9 +11902,9 @@ test_copy_null_ref_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds TEST_ERROR /* Verify that the references contain only "0" bytes */ - if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf))) + if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf)) != 0) TEST_ERROR - if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf))) + if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf)) != 0) TEST_ERROR /* Create destination file */ @@ -11947,9 +11947,9 @@ test_copy_null_ref_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds TEST_ERROR /* Verify that the references contain only "0" bytes */ - if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf))) + if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf)) != 0) TEST_ERROR - if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf))) + if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf)) != 0) TEST_ERROR /* Close */ diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index 22022f2..33f8900 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -887,7 +887,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* Iterate over all elements, calling memcmp() for each */ for (elmt = 0; elmt < nelmts; elmt++) { - if (HDmemcmp(memb1, memb2, memb_size)) + if (HDmemcmp(memb1, memb2, memb_size) != 0) TEST_ERROR /* Update member pointers */ @@ -1035,7 +1035,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, else TEST_ERROR } /* end else */ - else if (HDmemcmp(buf1, buf2, (elmt_size * nelmts))) + else if (HDmemcmp(buf1, buf2, (elmt_size * nelmts)) != 0) TEST_ERROR /* Data should be the same. :-) */ @@ -1306,7 +1306,7 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if (H5Lget_name_by_idx(gid2, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(objname, objname2)) + if (HDstrcmp(objname, objname2) != 0) TEST_ERROR /* Get link info */ @@ -1420,7 +1420,7 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) TEST_ERROR /* Compare link data */ - if (HDmemcmp(linkval, linkval2, linfo.u.val_size)) + if (HDmemcmp(linkval, linkval2, linfo.u.val_size) != 0) TEST_ERROR } /* end else-if */ else { diff --git a/test/ohdr.c b/test/ohdr.c index c586ff3..cc5d526 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -907,7 +907,7 @@ test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id) /* Read the data back and verify */ if (H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0) TEST_ERROR; - if (HDstrcmp(in_buf, out_buf)) + if (HDstrcmp(in_buf, out_buf) != 0) TEST_ERROR; /* modify the string attribute */ @@ -922,7 +922,7 @@ test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id) /* Read the data back and verify */ if (H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0) TEST_ERROR; - if (HDstrcmp(in_buf, out_buf)) + if (HDstrcmp(in_buf, out_buf) != 0) TEST_ERROR; /* Close */ @@ -1753,8 +1753,8 @@ main(void) env_h5_drvr = "nomatch"; /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && - HDstrcmp(env_h5_drvr, "family")); + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0); /* Reset library */ h5_reset(); diff --git a/test/set_extent.c b/test/set_extent.c index 6d639ad..c69a492 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -121,7 +121,7 @@ main(void) if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; /* Current VFD that does not support contigous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); /* Initialize random number seed */ HDsrandom((unsigned)HDtime(NULL)); diff --git a/test/stab.c b/test/stab.c index c40b518..5f9cad7 100644 --- a/test/stab.c +++ b/test/stab.c @@ -134,7 +134,7 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format) TEST_ERROR if (H5Oget_comment_by_name(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0) TEST_ERROR - if (HDstrcmp(comment, "hello world")) { + if (HDstrcmp(comment, "hello world") != 0) { H5_FAILED(); HDputs(" Read the wrong comment string from the group."); HDprintf(" got: \"%s\"\n ans: \"hello world\"\n", comment); @@ -1416,7 +1416,7 @@ main(void) env_h5_drvr = "nomatch"; /* VFD that does not support contigous address space */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); /* Reset library */ h5_reset(); diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 64056a1..2bff12c 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -286,7 +286,7 @@ main(int argc, const char *argv[]) /* Chunk index type */ case 'i': index_type = argv[u + 1]; - if (HDstrcmp(index_type, "ea") && HDstrcmp(index_type, "b2")) + if (HDstrcmp(index_type, "ea") != 0 && HDstrcmp(index_type, "b2") != 0) usage(); u += 2; break; diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c index 3514b28..2d25801 100644 --- a/test/swmr_start_write.c +++ b/test/swmr_start_write.c @@ -385,7 +385,7 @@ main(int argc, const char *argv[]) /* Chunk index type */ case 'i': index_type = argv[u + 1]; - if (HDstrcmp(index_type, "ea") && HDstrcmp(index_type, "b2")) + if (HDstrcmp(index_type, "ea") != 0 && HDstrcmp(index_type, "b2") != 0) usage(); u += 2; break; diff --git a/test/tattr.c b/test/tattr.c index 2b7a03b..06856d7 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -859,8 +859,8 @@ test_attr_compound_read(hid_t fapl) VERIFY(fields, 3, "H5Tget_nmembers"); for (i = 0; i < fields; i++) { fieldname = H5Tget_member_name(type, (unsigned)i); - if (!(HDstrcmp(fieldname, ATTR4_FIELDNAME1) || HDstrcmp(fieldname, ATTR4_FIELDNAME2) || - HDstrcmp(fieldname, ATTR4_FIELDNAME3))) + if (!(HDstrcmp(fieldname, ATTR4_FIELDNAME1) != 0 || HDstrcmp(fieldname, ATTR4_FIELDNAME2) != 0 || + HDstrcmp(fieldname, ATTR4_FIELDNAME3) != 0)) TestErrPrintf("invalid field name for field #%d: %s\n", i, fieldname); H5free_memory(fieldname); } /* end for */ @@ -907,7 +907,7 @@ test_attr_compound_read(hid_t fapl) /* Verify values read in */ for (i = 0; i < ATTR4_DIM1; i++) for (j = 0; j < ATTR4_DIM2; j++) - if (HDmemcmp(&attr_data4[i][j], &read_data4[i][j], sizeof(struct attr4_struct))) { + if (HDmemcmp(&attr_data4[i][j], &read_data4[i][j], sizeof(struct attr4_struct)) != 0) { HDprintf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i); HDprintf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", @@ -920,7 +920,7 @@ test_attr_compound_read(hid_t fapl) /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR4_NAME), "H5Aget_name"); - if (HDstrcmp(attr_name, ATTR4_NAME)) + if (HDstrcmp(attr_name, ATTR4_NAME) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR4_NAME); /* Close attribute datatype */ @@ -1279,7 +1279,7 @@ test_attr_mult_read(hid_t fapl) /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); - if (HDstrcmp(attr_name, ATTR1_NAME)) + if (HDstrcmp(attr_name, ATTR1_NAME) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR1_NAME); /* Verify Name with too small of a buffer */ @@ -1287,7 +1287,7 @@ test_attr_mult_read(hid_t fapl) VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); HDstrcpy(temp_name, ATTR1_NAME); /* make a copy of the name */ temp_name[HDstrlen(ATTR1_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ - if (HDstrcmp(attr_name, temp_name)) + if (HDstrcmp(attr_name, temp_name) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name); /* Close attribute */ @@ -1337,7 +1337,7 @@ test_attr_mult_read(hid_t fapl) /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name"); - if (HDstrcmp(attr_name, ATTR2_NAME)) + if (HDstrcmp(attr_name, ATTR2_NAME) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR2_NAME); /* Verify Name with too small of a buffer */ @@ -1345,7 +1345,7 @@ test_attr_mult_read(hid_t fapl) VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name"); HDstrcpy(temp_name, ATTR2_NAME); /* make a copy of the name */ temp_name[HDstrlen(ATTR2_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ - if (HDstrcmp(attr_name, temp_name)) + if (HDstrcmp(attr_name, temp_name) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name); /* Close attribute */ @@ -1399,7 +1399,7 @@ test_attr_mult_read(hid_t fapl) /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); - if (HDstrcmp(attr_name, ATTR3_NAME)) + if (HDstrcmp(attr_name, ATTR3_NAME) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME); /* Verify Name with too small of a buffer */ @@ -1407,7 +1407,7 @@ test_attr_mult_read(hid_t fapl) VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); HDstrcpy(temp_name, ATTR3_NAME); /* make a copy of the name */ temp_name[HDstrlen(ATTR3_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ - if (HDstrcmp(attr_name, temp_name)) + if (HDstrcmp(attr_name, temp_name) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name); /* Close attribute */ @@ -1436,19 +1436,19 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR switch (*count) { case 0: - if (HDstrcmp(name, ATTR1_NAME)) + if (HDstrcmp(name, ATTR1_NAME) != 0) TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR1_NAME); (*count)++; break; case 1: - if (HDstrcmp(name, ATTR2_NAME)) + if (HDstrcmp(name, ATTR2_NAME) != 0) TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR2_NAME); (*count)++; break; case 2: - if (HDstrcmp(name, ATTR3_NAME)) + if (HDstrcmp(name, ATTR3_NAME) != 0) TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR3_NAME); (*count)++; break; @@ -1590,7 +1590,7 @@ test_attr_delete(hid_t fapl) /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); - if (HDstrcmp(attr_name, ATTR1_NAME)) + if (HDstrcmp(attr_name, ATTR1_NAME) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR1_NAME); /* Close attribute */ @@ -1605,7 +1605,7 @@ test_attr_delete(hid_t fapl) /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); - if (HDstrcmp(attr_name, ATTR3_NAME)) + if (HDstrcmp(attr_name, ATTR3_NAME) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME); /* Close attribute */ @@ -1629,7 +1629,7 @@ test_attr_delete(hid_t fapl) /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); - if (HDstrcmp(attr_name, ATTR3_NAME)) + if (HDstrcmp(attr_name, ATTR3_NAME) != 0) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME); /* Close attribute */ @@ -2123,7 +2123,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) HDsprintf(attrname, "attr %02u", u); name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, check_name); VERIFY(name_len, HDstrlen(attrname), "H5Aget_name"); - if (HDstrcmp(check_name, attrname)) + if (HDstrcmp(check_name, attrname) != 0) TestErrPrintf("attribute name different: attrname = '%s', should be '%s'\n", check_name, attrname); @@ -5658,7 +5658,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t us ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if (HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname) != 0) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); /* Don't test "native" order if there is no creation order index, since @@ -5684,7 +5684,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t us ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if (HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname) != 0) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); } /* end if */ @@ -5705,7 +5705,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t us ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if (HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname) != 0) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); /* Verify the information for first attribute, in increasing name order */ @@ -5725,7 +5725,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t us ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if (HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname) != 0) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); /* Don't test "native" order queries on link name order, since there's not @@ -5749,7 +5749,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t us ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if (HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname) != 0) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); /* Retrieve current # of errors */ @@ -6782,7 +6782,7 @@ attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, vo /* Verify name of link */ HDsprintf(attrname, "attr %02u", (unsigned)my_info.corder); - if (HDstrcmp(attr_name, attrname)) + if (HDstrcmp(attr_name, attrname) != 0) return (H5_ITER_ERROR); /* Check if we've visited this link before */ diff --git a/test/tfile.c b/test/tfile.c index ae171d8..364c4f8 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3834,7 +3834,7 @@ test_filespace_info(const char *env_h5_drvr) MESSAGE(5, ("Testing file creation public routines: H5Pget/set_file_space_strategy & " "H5Pget/set_file_space_page_size\n")); - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); fapl = h5_fileaccess(); h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename); diff --git a/test/th5s.c b/test/th5s.c index 901d0e3..4cfe83b 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -2398,7 +2398,7 @@ test_h5s_compound_scalar_read(void) ret = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct))) { + if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct)) != 0) { HDprintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", space4_data.c1, rdata.c1); HDprintf("scalar data different: space4_data.u=%u, read_data4.u=%u\n", space4_data.u, rdata.u); HDprintf("scalar data different: space4_data.f=%f, read_data4.f=%f\n", (double)space4_data.f, diff --git a/test/titerate.c b/test/titerate.c index 52bd9c9..5252da4 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -570,7 +570,7 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link H5O_info2_t oinfo; herr_t ret; /* Generic return value */ - if (HDstrcmp(name, test_info->name)) { + if (HDstrcmp(name, test_info->name) != 0) { TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name); return (H5_ITER_ERROR); } /* end if */ diff --git a/test/tmisc.c b/test/tmisc.c index 99cce68..826f28a 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2083,11 +2083,11 @@ test_misc12(void) CHECK(ret, FAIL, "H5Dread"); for (i = 0; i < MISC12_SPACE1_DIM1; i++) - if (HDstrcmp(wdata[i], rdata[i])) + if (HDstrcmp(wdata[i], rdata[i]) != 0) TestErrPrintf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n", __LINE__, i, wdata[i], i, rdata[i]); for (; i < (MISC12_SPACE1_DIM1 + MISC12_APPEND_SIZE); i++) - if (HDstrcmp(wdata1[i - MISC12_SPACE1_DIM1], rdata[i])) + if (HDstrcmp(wdata1[i - MISC12_SPACE1_DIM1], rdata[i]) != 0) TestErrPrintf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n", __LINE__, i - MISC12_SPACE1_DIM1, wdata1[i - MISC12_SPACE1_DIM1], i, rdata[i]); diff --git a/test/tselect.c b/test/tselect.c index c5d779f..e3b3f54 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -1515,7 +1515,7 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if (HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) + if (HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12) != 0) TestErrPrintf("hyperslab values don't match! Line=%d\n", __LINE__); /* Close memory dataspace */ @@ -1658,7 +1658,7 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if (HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 2 * SPACE8_DIM3 * SPACE8_DIM2 * SPACE8_DIM1)) + if (HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 2 * SPACE8_DIM3 * SPACE8_DIM2 * SPACE8_DIM1) != 0) TestErrPrintf("Error: hyperslab values don't match!\n"); /* Close memory dataspace */ @@ -3765,7 +3765,7 @@ test_select_hyper_copy(void) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if (HDmemcmp(rbuf, rbuf2, sizeof(uint16_t) * SPACE3_DIM1 * SPACE3_DIM2)) + if (HDmemcmp(rbuf, rbuf2, sizeof(uint16_t) * SPACE3_DIM1 * SPACE3_DIM2) != 0) TestErrPrintf("hyperslab values don't match! Line=%d\n", __LINE__); /* Close memory dataspace */ @@ -3978,7 +3978,7 @@ test_select_point_copy(void) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if (HDmemcmp(rbuf, rbuf2, sizeof(uint16_t) * SPACE3_DIM1 * SPACE3_DIM2)) + if (HDmemcmp(rbuf, rbuf2, sizeof(uint16_t) * SPACE3_DIM1 * SPACE3_DIM2) != 0) TestErrPrintf("point values don't match!\n"); /* Close memory dataspace */ @@ -14220,18 +14220,18 @@ test_hyper_unlim_check(hid_t sid, hsize_t *dims, hssize_t enpoints, hssize_t enb /* Verify blocklist */ if (nblocks == (hssize_t)1) { - if (HDmemcmp(blocklist, eblock1, 6 * sizeof(eblock1[0]))) + if (HDmemcmp(blocklist, eblock1, 6 * sizeof(eblock1[0])) != 0) ERROR("H5Sget_select_hyper_blocklist"); } /* end if */ else { HDassert(nblocks == (hssize_t)2); - if (HDmemcmp(blocklist, eblock1, 6 * sizeof(eblock1[0]))) { - if (HDmemcmp(blocklist, eblock2, 6 * sizeof(eblock2[0]))) + if (HDmemcmp(blocklist, eblock1, 6 * sizeof(eblock1[0])) != 0) { + if (HDmemcmp(blocklist, eblock2, 6 * sizeof(eblock2[0])) != 0) ERROR("H5Sget_select_hyper_blocklist"); - if (HDmemcmp(&blocklist[6], eblock1, 6 * sizeof(eblock1[0]))) + if (HDmemcmp(&blocklist[6], eblock1, 6 * sizeof(eblock1[0])) != 0) ERROR("H5Sget_select_hyper_blocklist"); } /* end if */ - else if (HDmemcmp(&blocklist[6], eblock2, 6 * sizeof(eblock2[0]))) + else if (HDmemcmp(&blocklist[6], eblock2, 6 * sizeof(eblock2[0])) != 0) ERROR("H5Sget_select_hyper_blocklist"); } /* end else */ } /* end if */ diff --git a/test/ttst.c b/test/ttst.c index 53aab5e..07f118c 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -204,14 +204,14 @@ test_tst_insert(void) found = H5ST_find(tree, uniq_words[u]); CHECK_PTR(found, "H5ST_find"); - if (HDstrcmp((const char *)found->eqkid, uniq_words[u])) + if (HDstrcmp((const char *)found->eqkid, uniq_words[u]) != 0) TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n", __LINE__, (char *)found->eqkid, (unsigned)u, uniq_words[u]); obj = H5ST_locate(tree, uniq_words[u]); CHECK_PTR(obj, "H5ST_locate"); - if (HDstrcmp((const char *)obj, uniq_words[u])) + if (HDstrcmp((const char *)obj, uniq_words[u]) != 0) TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n", __LINE__, (char *)obj, (unsigned)u, uniq_words[u]); } /* end for */ @@ -262,7 +262,7 @@ test_tst_iterate(void) u = 0; do { /* Check that the strings in the TST are in the correct order */ - if (HDstrcmp((const char *)found->eqkid, sort_uniq_words[u])) + if (HDstrcmp((const char *)found->eqkid, sort_uniq_words[u]) != 0) TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n", __LINE__, (char *)found->eqkid, (unsigned)u, sort_uniq_words[u]); @@ -311,7 +311,7 @@ test_tst_remove(void) CHECK_PTR(obj, "H5ST_remove"); /* Check that the correct string was removed from TST */ - if (HDstrcmp((const char *)obj, rand_uniq_words[u])) + if (HDstrcmp((const char *)obj, rand_uniq_words[u]) != 0) TestErrPrintf("%d: TST node values don't match!, obj=%s, rand_uniq_words[%u]=%s\n", __LINE__, (char *)obj, (unsigned)u, rand_uniq_words[u]); @@ -333,7 +333,7 @@ test_tst_remove(void) CHECK_PTR(found, "H5ST_find"); /* Check that the correct object will be removed from TST */ - if (HDstrcmp((const char *)found->eqkid, rand_uniq_words[u])) + if (HDstrcmp((const char *)found->eqkid, rand_uniq_words[u]) != 0) TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, rand_uniq_words[%u]=%s\n", __LINE__, (char *)found->eqkid, (unsigned)u, rand_uniq_words[u]); diff --git a/test/tvlstr.c b/test/tvlstr.c index 0503e62..7e47c7b 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -773,7 +773,7 @@ read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, char *data) ret = H5Dclose(dset); CHECK(ret, FAIL, "H5Dclose"); - if (HDstrcmp(data, data_read)) + if (HDstrcmp(data, data_read) != 0) TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read); ret = H5Treclaim(type, space, H5P_DEFAULT, &data_read); diff --git a/test/tvltypes.c b/test/tvltypes.c index 8e2ab4a..e31c65f 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -1370,7 +1370,7 @@ test_vltypes_compound_vlstr(void) for (t1 = (s2 *)(wdata[i].v.p), t2 = (s2 *)(rdata[i].v.p), j = 0; j < rdata[i].v.len; j++, t1++, t2++) { - if (HDstrcmp(t1->string, t2->string)) { + if (HDstrcmp(t1->string, t2->string) != 0) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n", t1->string, t2->string); continue; @@ -1431,7 +1431,7 @@ test_vltypes_compound_vlstr(void) for (t1 = (s2 *)(wdata2[i].v.p), t2 = (s2 *)(rdata2[i].v.p), j = 0; j < rdata2[i].v.len; j++, t1++, t2++) { - if (HDstrcmp(t1->string, t2->string)) { + if (HDstrcmp(t1->string, t2->string) != 0) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n", t1->string, t2->string); continue; @@ -2804,10 +2804,10 @@ test_vltypes_fill_value(void) /* Compare data read in */ for (i = 0; i < dset_elmts; i++) { - if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") || - rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") || - HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") || - HDstrcmp(rbuf[i].str_unit, "meter")) { + if (HDstrcmp(rbuf[i].str_id, "foobar") != 0 || HDstrcmp(rbuf[i].str_name, "") != 0 || + rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") != 0 || + HDstrcmp(rbuf[i].str_stat, "dead") != 0 || HDstrcmp(rbuf[i].str_form, "liquid") != 0 || + HDstrcmp(rbuf[i].str_unit, "meter") != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i); continue; } /* end if */ @@ -2827,10 +2827,11 @@ test_vltypes_fill_value(void) /* Compare data read in */ for (i = 0; i < dset_elmts; i++) { if ((i % 2) == select_offset[0]) { - if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") || - rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") || - HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") || - HDstrcmp(rbuf[i].str_unit, "meter")) { + if (HDstrcmp(rbuf[i].str_id, "foobar") != 0 || HDstrcmp(rbuf[i].str_name, "") != 0 || + rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") != 0 || + HDstrcmp(rbuf[i].str_stat, "dead") != 0 || + HDstrcmp(rbuf[i].str_form, "liquid") != 0 || + HDstrcmp(rbuf[i].str_unit, "meter") != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i); continue; } /* end if */ @@ -2861,10 +2862,10 @@ test_vltypes_fill_value(void) /* Compare data read in */ for (i = 0; i < dset_elmts; i++) { - if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") || - rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") || - HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") || - HDstrcmp(rbuf[i].str_unit, "meter")) { + if (HDstrcmp(rbuf[i].str_id, "foobar") != 0 || HDstrcmp(rbuf[i].str_name, "") != 0 || + rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") != 0 || + HDstrcmp(rbuf[i].str_stat, "dead") != 0 || HDstrcmp(rbuf[i].str_form, "liquid") != 0 || + HDstrcmp(rbuf[i].str_unit, "meter") != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i); continue; } /* end if */ @@ -2884,10 +2885,11 @@ test_vltypes_fill_value(void) /* Compare data read in */ for (i = 0; i < dset_elmts; i++) { if ((i % 2) == select_offset[0]) { - if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") || - rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") || - HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") || - HDstrcmp(rbuf[i].str_unit, "meter")) { + if (HDstrcmp(rbuf[i].str_id, "foobar") != 0 || HDstrcmp(rbuf[i].str_name, "") != 0 || + rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") != 0 || + HDstrcmp(rbuf[i].str_stat, "dead") != 0 || + HDstrcmp(rbuf[i].str_form, "liquid") != 0 || + HDstrcmp(rbuf[i].str_unit, "meter") != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i); continue; } /* end if */ @@ -3002,21 +3004,22 @@ test_vltypes_fill_value(void) /* Compare data read in */ for (i = 0; i < dset_elmts; i++) { if (i == single_offset[0]) { - if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name || - HDstrcmp(rbuf[i].str_desc, wdata.str_desc) || - HDstrcmp(rbuf[i].str_orig, wdata.str_orig) || - HDstrcmp(rbuf[i].str_stat, wdata.str_stat) || - HDstrcmp(rbuf[i].str_form, wdata.str_form) || - HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) { + if (HDstrcmp(rbuf[i].str_id, wdata.str_id) != 0 || rbuf[i].str_name || + HDstrcmp(rbuf[i].str_desc, wdata.str_desc) != 0 || + HDstrcmp(rbuf[i].str_orig, wdata.str_orig) != 0 || + HDstrcmp(rbuf[i].str_stat, wdata.str_stat) != 0 || + HDstrcmp(rbuf[i].str_form, wdata.str_form) != 0 || + HDstrcmp(rbuf[i].str_unit, wdata.str_unit) != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i); continue; } /* end if */ } /* end if */ else { - if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") || - rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") || - HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") || - HDstrcmp(rbuf[i].str_unit, "meter")) { + if (HDstrcmp(rbuf[i].str_id, "foobar") != 0 || HDstrcmp(rbuf[i].str_name, "") != 0 || + rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") != 0 || + HDstrcmp(rbuf[i].str_stat, "dead") != 0 || + HDstrcmp(rbuf[i].str_form, "liquid") != 0 || + HDstrcmp(rbuf[i].str_unit, "meter") != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i); continue; } /* end if */ @@ -3037,22 +3040,23 @@ test_vltypes_fill_value(void) /* Compare data read in */ for (i = 0; i < dset_elmts; i++) { if (i == single_offset[0]) { - if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name || - HDstrcmp(rbuf[i].str_desc, wdata.str_desc) || - HDstrcmp(rbuf[i].str_orig, wdata.str_orig) || - HDstrcmp(rbuf[i].str_stat, wdata.str_stat) || - HDstrcmp(rbuf[i].str_form, wdata.str_form) || - HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) { + if (HDstrcmp(rbuf[i].str_id, wdata.str_id) != 0 || rbuf[i].str_name || + HDstrcmp(rbuf[i].str_desc, wdata.str_desc) != 0 || + HDstrcmp(rbuf[i].str_orig, wdata.str_orig) != 0 || + HDstrcmp(rbuf[i].str_stat, wdata.str_stat) != 0 || + HDstrcmp(rbuf[i].str_form, wdata.str_form) != 0 || + HDstrcmp(rbuf[i].str_unit, wdata.str_unit) != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i); continue; } /* end if */ } /* end if */ else { if ((i % 2) == select_offset[0]) { - if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") || - rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") || - HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") || - HDstrcmp(rbuf[i].str_unit, "meter")) { + if (HDstrcmp(rbuf[i].str_id, "foobar") != 0 || HDstrcmp(rbuf[i].str_name, "") != 0 || + rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") != 0 || + HDstrcmp(rbuf[i].str_stat, "dead") != 0 || + HDstrcmp(rbuf[i].str_form, "liquid") != 0 || + HDstrcmp(rbuf[i].str_unit, "meter") != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i); continue; } /* end if */ @@ -3088,21 +3092,22 @@ test_vltypes_fill_value(void) /* Compare data read in */ for (i = 0; i < dset_elmts; i++) { if (i == single_offset[0]) { - if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name || - HDstrcmp(rbuf[i].str_desc, wdata.str_desc) || - HDstrcmp(rbuf[i].str_orig, wdata.str_orig) || - HDstrcmp(rbuf[i].str_stat, wdata.str_stat) || - HDstrcmp(rbuf[i].str_form, wdata.str_form) || - HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) { + if (HDstrcmp(rbuf[i].str_id, wdata.str_id) != 0 || rbuf[i].str_name || + HDstrcmp(rbuf[i].str_desc, wdata.str_desc) != 0 || + HDstrcmp(rbuf[i].str_orig, wdata.str_orig) != 0 || + HDstrcmp(rbuf[i].str_stat, wdata.str_stat) != 0 || + HDstrcmp(rbuf[i].str_form, wdata.str_form) != 0 || + HDstrcmp(rbuf[i].str_unit, wdata.str_unit) != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i); continue; } /* end if */ } /* end if */ else { - if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") || - rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") || - HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") || - HDstrcmp(rbuf[i].str_unit, "meter")) { + if (HDstrcmp(rbuf[i].str_id, "foobar") != 0 || HDstrcmp(rbuf[i].str_name, "") != 0 || + rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") != 0 || + HDstrcmp(rbuf[i].str_stat, "dead") != 0 || + HDstrcmp(rbuf[i].str_form, "liquid") != 0 || + HDstrcmp(rbuf[i].str_unit, "meter") != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i); continue; } /* end if */ @@ -3123,22 +3128,23 @@ test_vltypes_fill_value(void) /* Compare data read in */ for (i = 0; i < dset_elmts; i++) { if (i == single_offset[0]) { - if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name || - HDstrcmp(rbuf[i].str_desc, wdata.str_desc) || - HDstrcmp(rbuf[i].str_orig, wdata.str_orig) || - HDstrcmp(rbuf[i].str_stat, wdata.str_stat) || - HDstrcmp(rbuf[i].str_form, wdata.str_form) || - HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) { + if (HDstrcmp(rbuf[i].str_id, wdata.str_id) != 0 || rbuf[i].str_name || + HDstrcmp(rbuf[i].str_desc, wdata.str_desc) != 0 || + HDstrcmp(rbuf[i].str_orig, wdata.str_orig) != 0 || + HDstrcmp(rbuf[i].str_stat, wdata.str_stat) != 0 || + HDstrcmp(rbuf[i].str_form, wdata.str_form) != 0 || + HDstrcmp(rbuf[i].str_unit, wdata.str_unit) != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i); continue; } /* end if */ } /* end if */ else { if ((i % 2) == select_offset[0]) { - if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") || - rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") || - HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") || - HDstrcmp(rbuf[i].str_unit, "meter")) { + if (HDstrcmp(rbuf[i].str_id, "foobar") != 0 || HDstrcmp(rbuf[i].str_name, "") != 0 || + rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") != 0 || + HDstrcmp(rbuf[i].str_stat, "dead") != 0 || + HDstrcmp(rbuf[i].str_form, "liquid") != 0 || + HDstrcmp(rbuf[i].str_unit, "meter") != 0) { TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i); continue; } /* end if */ diff --git a/test/unlink.c b/test/unlink.c index 3357e1c..c58e3ec 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -510,7 +510,7 @@ check_new_move(hid_t fapl) /* Check soft links */ if (H5Lget_val(file, "group2/soft", linkval, sizeof(linkval), H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if (HDstrcmp(linkval, "/group1/group_move")) + if (HDstrcmp(linkval, "/group1/group_move") != 0) FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value") /* Cleanup */ diff --git a/test/vfd.c b/test/vfd.c index 19b119e..710fda4 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -2304,7 +2304,7 @@ compare_splitter_config_info(hid_t fapl_id, H5FD_splitter_vfd_config_t *info) } } if ((HDstrlen(info->wo_path) != HDstrlen(fetched_info->wo_path)) || - HDstrncmp(info->wo_path, fetched_info->wo_path, H5FD_SPLITTER_PATH_MAX)) { + HDstrncmp(info->wo_path, fetched_info->wo_path, H5FD_SPLITTER_PATH_MAX) != 0) { HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info->wo_path); HEXPRINT(H5FD_SPLITTER_PATH_MAX, info->wo_path); HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info->wo_path); diff --git a/test/vol.c b/test/vol.c index 7da35ea..61ef621 100644 --- a/test/vol.c +++ b/test/vol.c @@ -399,8 +399,8 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for split / multi / family VFDs */ - if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && - HDstrcmp(env_h5_drvr, "family"))) { + if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -421,8 +421,8 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't retrieve VFD handle for split / multi / family VFDs */ - if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && - HDstrcmp(env_h5_drvr, "family"))) { + if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0)) { /* H5Fget_vfd_handle */ if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) TEST_ERROR; @@ -461,8 +461,8 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for split / multi / family VFDs */ - if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && - HDstrcmp(env_h5_drvr, "family"))) { + if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -476,8 +476,8 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for split / multi / family VFDs */ - if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && - HDstrcmp(env_h5_drvr, "family"))) { + if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "family") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) TEST_ERROR; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 19a19b0..57cfaf2 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -687,7 +687,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char /* if any object is specified */ if (objname1) { /* make the given object1 fullpath, start with "/" */ - if (HDstrncmp(objname1, "/", 1)) { + if (HDstrncmp(objname1, "/", 1) != 0) { #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if (HDasprintf(&obj1fullname, "/%s", objname1) < 0) @@ -706,7 +706,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char H5TOOLS_DEBUG("obj1fullname = %s", obj1fullname); /* make the given object2 fullpath, start with "/" */ - if (HDstrncmp(objname2, "/", 1)) { + if (HDstrncmp(objname2, "/", 1) != 0) { #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if (HDasprintf(&obj2fullname, "/%s", objname2) < 0) @@ -1013,7 +1013,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char parallel_print("\n"); /* if given objects is group under root */ - if (HDstrcmp(obj1fullname, "/") || HDstrcmp(obj2fullname, "/")) + if (HDstrcmp(obj1fullname, "/") != 0 || HDstrcmp(obj2fullname, "/") != 0) parallel_print("group1 group2\n"); else parallel_print("file1 file2\n"); @@ -1115,9 +1115,9 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, * if not root, prepare object name to be pre-appended to group path to * make full path */ - if (HDstrcmp(grp1, "/")) + if (HDstrcmp(grp1, "/") != 0) grp1_path = grp1; - if (HDstrcmp(grp2, "/")) + if (HDstrcmp(grp2, "/") != 0) grp2_path = grp2; /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 4d19f1f..ab868db 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -2221,12 +2221,12 @@ h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char H5O_info2_t oinfo1, oinfo2; hbool_t ret_val = FALSE; - if (name1 && HDstrcmp(name1, ".")) + if (name1 && HDstrcmp(name1, ".") != 0) H5Oget_info_by_name3(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); else H5Oget_info3(loc_id1, &oinfo1, H5O_INFO_BASIC); - if (name2 && HDstrcmp(name2, ".")) + if (name2 && HDstrcmp(name2, ".") != 0) H5Oget_info_by_name3(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); else H5Oget_info3(loc_id2, &oinfo2, H5O_INFO_BASIC); diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 4643466..50f283d 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -200,7 +200,7 @@ ref_path_table_lookup(const char *thepath, H5O_token_t *token) if ((thepath == NULL) || (HDstrlen(thepath) == 0)) return -1; /* Allow lookups on the root group, even though it doesn't have any link info */ - if (HDstrcmp(thepath, "/")) { + if (HDstrcmp(thepath, "/") != 0) { H5L_info2_t li; /* Check for external link first, so we don't return the OID of an object in another file */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index d509c54..5d6a90f 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -142,7 +142,7 @@ h5tools_str_append(h5tools_str_t *str /*in,out*/, const char *fmt, ...) /* failure, such as bad format */ return NULL; - if ((size_t)nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s")))) { + if ((size_t)nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s") != 0))) { /* Truncation return value as documented by C99, or zero return value with either of the * following conditions, each of which indicates that the proper C99 return value probably * should have been positive when the format string is diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 41dcd6b..d0c299f 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -357,7 +357,7 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id) H5O_info2_t oinfo; size_t idx = info->nused - 1; - if (info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".")) + if (info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".") != 0) H5Oget_info_by_name3(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); else H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC); diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 18bb1d1..9f526da 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1529,7 +1529,7 @@ main(int argc, const char *argv[]) } } else { - if (useschema_g && HDstrcmp(xmlnsprefix, "")) { + if (useschema_g && HDstrcmp(xmlnsprefix, "") != 0) { error_msg( "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 2dc02bc..2a65591 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -1570,7 +1570,7 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING STRSIZE %s found\n", temp); #endif - if (HDstrcmp("H5T_VARIABLE;", temp)) { + if (HDstrcmp("H5T_VARIABLE;", temp) != 0) { char *more = temp; ival = (int)HDstrtol(more, &more, 10); if (getInputSize(in, ival) == -1) { @@ -1896,7 +1896,7 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival); #endif } - while (HDstrcmp("}", temp)) { + while (HDstrcmp("}", temp) != 0) { if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 09bc323..94005ef 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -3088,7 +3088,7 @@ main(int argc, const char *argv[]) symlink_list.objs = NULL; /* Check for root group as object name */ - if (HDstrcmp(oname, root_name)) { + if (HDstrcmp(oname, root_name) != 0) { /* Check the type of link given */ if (H5Lget_info2(file_id, oname, &li, H5P_DEFAULT) < 0) { hsize_t curr_pos = 0; /* total data element position */ diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index c753e90..1f1b821 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -367,7 +367,7 @@ read_info(const char *filename, pack_opt_t *options) break; /* Info indicator must be for layout or filter */ - if (HDstrcmp(stype, "-l") && HDstrcmp(stype, "-f")) { + if (HDstrcmp(stype, "-l") != 0 && HDstrcmp(stype, "-f") != 0) { error_msg("bad file format for %s", filename); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 2fd39fd..167506f 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -339,7 +339,7 @@ options_get_object(const char *path, pack_opttbl_t *table) for (i = 0; i < table->nelems; i++) { /* make full path (start with "/") to compare correctly */ - if (HDstrncmp(table->objs[i].path, "/", 1)) { + if (HDstrncmp(table->objs[i].path, "/", 1) != 0) { HDstrcpy(tbl_path, "/"); HDstrcat(tbl_path, table->objs[i].path); } diff --git a/tools/src/misc/h5delete.c b/tools/src/misc/h5delete.c index 6240d59..607b25e 100644 --- a/tools/src/misc/h5delete.c +++ b/tools/src/misc/h5delete.c @@ -37,7 +37,7 @@ main(int argc, const char *argv[]) switch (argc) { case 3: - if (HDstrcmp(argv[1], "-f")) { + if (HDstrcmp(argv[1], "-f") != 0) { usage(); return EXIT_FAILURE; } -- cgit v0.12 From a78aae1150ffdfd44ef64c46da099c9412a7c3d0 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 11 Mar 2021 08:28:55 -0600 Subject: clang format push commit for develop (#453) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name --- .github/workflows/clang-format-check.yml | 3 ++- .github/workflows/clang-format-fix.yml | 25 +++++++++++++++++++++++++ .github/workflows/main.yml | 4 ++-- .github/workflows/pr-check.yml | 4 ++-- MANIFEST | 1 + 5 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/clang-format-fix.yml diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 230a341..4f696e7 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -1,5 +1,6 @@ name: clang-format Check -on: [workflow_dispatch, push, pull_request] +on: + pull_request: jobs: formatting-check: name: Formatting Check diff --git a/.github/workflows/clang-format-fix.yml b/.github/workflows/clang-format-fix.yml new file mode 100644 index 0000000..082d617 --- /dev/null +++ b/.github/workflows/clang-format-fix.yml @@ -0,0 +1,25 @@ +name: clang-format Check +on: + workflow_dispatch: + push: +jobs: + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'skip-ci')" + steps: + - uses: actions/checkout@v2 + - name: Run clang-format style check for C programs. + uses: DoozyX/clang-format-lint-action@v0.11 + with: + source: '.' + extensions: 'c,h,cpp,hpp' + clangFormatVersion: 10 + inplace: True + style: file + exclude: './config ./hl/src/H5LTanalyze.c ./hl/src/H5LTparse.c ./hl/src/H5LTparse.h ./src/H5Epubgen.h ./src/H5Einit.h ./src/H5Eterm.h ./src/H5Edefin.h ./src/H5version.h ./src/H5overflow.h' + - uses: EndBug/add-and-commit@v7 + with: + author_name: github-actions + author_email: 41898282+github-actions[bot]@users.noreply.github.com + message: 'Committing clang-format changes' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d0d3bb..78e1115 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,7 +82,7 @@ jobs: # Threadsafe runs - name: "Windows TS MSVC" artifact: "Windows-MSVCTS.tar.xz" - os: windows-latest + os: windows-2016 build_type: "Release" toolchain: "" cpp: OFF @@ -91,7 +91,7 @@ jobs: ts: ON hl: OFF parallel: OFF - generator: "-G \"Visual Studio 16 2019\" -A x64" + generator: "-G \"Visual Studio 15 2017 Win64\"" - name: "Ubuntu TS GCC" artifact: "LinuxTS.tar.xz" os: ubuntu-latest diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 8c3bb2c..b50bf59 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -77,7 +77,7 @@ jobs: # Threadsafe runs - name: "Windows TS MSVC" artifact: "Windows-MSVCTS.tar.xz" - os: windows-latest + os: windows-2016 build_type: "Release" toolchain: "" cpp: OFF @@ -86,7 +86,7 @@ jobs: ts: ON hl: OFF parallel: OFF - generator: "-G \"Visual Studio 16 2019\" -A x64" + generator: "-G \"Visual Studio 15 2017 Win64\"" - name: "Ubuntu TS GCC" artifact: "LinuxTS.tar.xz" os: ubuntu-latest diff --git a/MANIFEST b/MANIFEST index f386724..6605812 100644 --- a/MANIFEST +++ b/MANIFEST @@ -35,6 +35,7 @@ ./.clang-format ./.github/CODEOWNERS _DO_NOT_DISTRIBUTE_ +./.github/workflows/clang-format-fix.yml _DO_NOT_DISTRIBUTE_ ./.github/workflows/clang-format-check.yml _DO_NOT_DISTRIBUTE_ ./.github/workflows/main.yml _DO_NOT_DISTRIBUTE_ ./.github/workflows/pr-check.yml _DO_NOT_DISTRIBUTE_ -- cgit v0.12 From 6f760f200d6cb959c960b936af3fb2e68a55afde Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 11 Mar 2021 13:34:55 -0800 Subject: Replaces checks for fork, etc. with checks for unistd.h (#457) * Replaces checks for fork, etc. with H5_HAVE_UNISTD_H Code previously checked for individual POSIX API calls using H5_HAVE_FORK, etc. The calls we use have been standardized for decades and available via unistd.h. Some test messages that were missing when tests are skipped due to a lack of unistd.h were also added. The configure checks for individual POSIX API calls will be removed in a later commit. * Stupid formatter --- test/accum.c | 6 ++-- test/dt_arith.c | 12 ++++---- test/swmr.c | 68 ++++++++++++++++++++++++++++-------------- test/twriteorder.c | 10 +++---- test/use_append_chunk.c | 10 +++---- test/use_append_chunk_mirror.c | 10 +++---- test/use_append_mchunks.c | 10 +++---- test/use_common.c | 8 ++--- test/use_disable_mdc_flushes.c | 10 +++---- 9 files changed, 77 insertions(+), 67 deletions(-) diff --git a/test/accum.c b/test/accum.c index 08fe926..51a03c6 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2092,7 +2092,7 @@ error: unsigned test_swmr_write_big(hbool_t newest_format) { -#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_UNISTD_H) +#ifdef H5_HAVE_UNISTD_H hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ H5F_t * rf = NULL; /* File pointer */ @@ -2287,11 +2287,11 @@ error: return 1; -#else +#else /* H5_HAVE_UNISTD_H */ SKIPPED(); HDputs(" Test skipped due to fork, waitpid, or pid_t not defined."); return 0; -#endif /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_UNISTD_H) */ +#endif /* H5_HAVE_UNISTD_H */ } /* end test_swmr_write_big() */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 81b4b46..8658ccb 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -84,7 +84,7 @@ static int skip_overflow_tests_g = 0; * be allowed to continue (cf. Posix signals) so in order to recover from a * SIGFPE we run tests that might generate one in a child process. */ -#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) +#ifdef H5_HAVE_UNISTD_H #define HANDLE_SIGFPE #endif @@ -556,7 +556,7 @@ some_dummy_func(float x) static void generates_sigfpe(void) { -#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) +#ifdef H5_HAVE_UNISTD_H pid_t pid; int status; size_t i, j; @@ -592,12 +592,12 @@ generates_sigfpe(void) /* delete the core dump file that SIGFPE may have created */ HDunlink("core"); } -#else - HDputs("Cannot determine if floating-point overflows generate a SIGFPE;"); - HDputs("assuming yes."); +#else /* H5_HAVE_UNISTD_H */ + HDputs("Cannot determine if floating-point overflows generate a SIGFPE"); + HDputs("due to a lack of fork(2) - assuming yes."); HDputs("Overflow cases will not be tested."); skip_overflow_tests_g = TRUE; -#endif +#endif /* H5_HAVE_UNISTD_H */ } /*------------------------------------------------------------------------- diff --git a/test/swmr.c b/test/swmr.c index fd78117..2f90114 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -2341,17 +2341,24 @@ error: * (5) Parent: open a file with write access; enable SWMR writing mode * Child: concurrent open of the file with write and SWMR write access (fail) */ -#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) +#ifndef H5_HAVE_UNISTD_H static int -test_start_swmr_write_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t H5_ATTR_UNUSED new_format) +test_start_swmr_write_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format) { + if (new_format) { + TESTING("H5Fstart_swmr_write()--concurrent access for latest format"); + } + else { + TESTING("H5Fstart_swmr_write()--concurrent access for non-latest-format"); + } + SKIPPED(); - HDputs(" Test skipped due to fork or waitpid not defined."); + HDputs(" Test skipped due to a lack of unistd.h functionality."); return 0; } /* test_start_swmr_write_concur() */ -#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */ +#else /* H5_HAVE_UNISTD_H */ static int test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) @@ -2383,7 +2390,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) } else { TESTING("H5Fstart_swmr_write()--concurrent access for non-latest-format"); - } /* end if */ + } if ((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR @@ -2944,7 +2951,7 @@ error: return -1; } /* test_start_swmr_write_concur() */ -#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */ +#endif /* H5_HAVE_UNISTD_H */ /* * test_start_swmr_write_stress_ohdr(): @@ -4675,7 +4682,7 @@ error: ** This is for concurrent access. ** *****************************************************************/ -#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_FLOCK)) +#ifndef H5_HAVE_UNISTD_H static int test_file_lock_concur(hid_t H5_ATTR_UNUSED in_fapl) @@ -4683,12 +4690,12 @@ test_file_lock_concur(hid_t H5_ATTR_UNUSED in_fapl) /* Output message about test being performed */ TESTING("File open with different combinations of flags--concurrent access"); SKIPPED(); - HDputs(" Test skipped due to fork, waitpid, or flock not defined."); + HDputs(" Test skipped due to a lack of unistd.h functionality."); return 0; } /* end test_file_lock_concur() */ -#else +#else /* H5_HAVE_UNISTD_H */ static int test_file_lock_concur(hid_t in_fapl) @@ -5046,7 +5053,7 @@ error: } /* end test_file_lock_concur() */ -#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_FLOCK)) */ +#endif /* H5_HAVE_UNISTD_H */ /**************************************************************** ** @@ -5056,7 +5063,7 @@ error: ** This is for concurrent access. ** *****************************************************************/ -#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) +#ifndef H5_HAVE_UNISTD_H static int test_file_lock_swmr_concur(hid_t H5_ATTR_UNUSED in_fapl) @@ -5064,12 +5071,12 @@ test_file_lock_swmr_concur(hid_t H5_ATTR_UNUSED in_fapl) /* Output message about test being performed */ TESTING("File open with different combintations of flags + SWMR flags--concurrent access"); SKIPPED(); - HDputs(" Test skipped due to fork or waitpid not defined."); + HDputs(" Test skipped due to a lack of unistd.h functionality."); return 0; } /* end test_file_lock_swmr_concur() */ -#else +#else /* H5_HAVE_UNISTD_H */ static int test_file_lock_swmr_concur(hid_t in_fapl) @@ -6036,7 +6043,7 @@ error: } /* end test_file_lock_swmr_concur() */ -#endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */ +#endif /* H5_HAVE_UNISTD_H */ /**************************************************************** ** @@ -6048,11 +6055,19 @@ error: static int test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override) { -#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) +#ifndef H5_HAVE_UNISTD_H + if (turn_locking_on && env_var_override) + TESTING("File locking: ON w/ env var override") + else if (turn_locking_on && !env_var_override) + TESTING("File locking: ON") + else if (!turn_locking_on && env_var_override) + TESTING("File locking: OFF w/ env var override") + else + TESTING("File locking: OFF") SKIPPED(); - HDputs(" Test skipped due to fork or waitpid not defined."); + HDputs(" Test skipped due to a lack of unistd.h functionality."); return 0; -#else +#else /* H5_HAVE_UNISTD_H */ hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ char filename[NAME_BUF_SIZE]; /* file name */ @@ -6218,7 +6233,7 @@ error: return -1; -#endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */ +#endif /* H5_HAVE_UNISTD_H */ } /* end test_file_locking() */ @@ -6498,17 +6513,24 @@ error: * (7) Refresh the dataset * (8) Verify the dataset's dimension and data are correct */ -#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) +#ifndef H5_HAVE_UNISTD_H static int -test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t H5_ATTR_UNUSED new_format) +test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format) { + if (new_format) { + TESTING("H5Drefresh()--concurrent access for latest format"); + } + else { + TESTING("H5Drefresh()--concurrent access for non-latest-format"); + } + SKIPPED(); - HDputs(" Test skipped due to fork or waitpid not defined."); + HDputs(" Test skipped due to a lack of unistd.h functionality."); return 0; } /* test_refresh_concur() */ -#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */ +#else /* H5_HAVE_UNISTD_H */ static int test_refresh_concur(hid_t in_fapl, hbool_t new_format) @@ -6808,7 +6830,7 @@ error: return -1; } /* test_refresh_concur() */ -#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */ +#endif /* H5_HAVE_UNISTD_H */ /* * test_multiple_same(): diff --git a/test/twriteorder.c b/test/twriteorder.c index 9f4fee1..e792487 100644 --- a/test/twriteorder.c +++ b/test/twriteorder.c @@ -61,11 +61,9 @@ #include "h5test.h" /* This test uses many POSIX things that are not available on - * Windows. We're using a check for fork(2) here as a proxy for - * all POSIX/Unix/Linux things until this test can be made - * more platform-independent. + * Windows. */ -#ifdef H5_HAVE_FORK +#ifdef H5_HAVE_UNISTD_H #define DATAFILE "twriteorder.dat" /* #define READERS_MAX 10 */ /* max number of readers */ @@ -468,7 +466,7 @@ done: return ret_value; } -#else /* H5_HAVE_FORK */ +#else /* H5_HAVE_UNISTD_H */ int main(void) @@ -477,4 +475,4 @@ main(void) return EXIT_SUCCESS; } /* end main() */ -#endif /* H5_HAVE_FORK */ +#endif /* H5_HAVE_UNISTD_H */ diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c index 3699a56..107615a 100644 --- a/test/use_append_chunk.c +++ b/test/use_append_chunk.c @@ -61,11 +61,9 @@ #include "h5test.h" /* This test uses many POSIX things that are not available on - * Windows. We're using a check for fork(2) here as a proxy for - * all POSIX/Unix/Linux things until this test can be made - * more platform-independent. + * Windows. */ -#ifdef H5_HAVE_FORK +#ifdef H5_HAVE_UNISTD_H #include "use.h" @@ -272,7 +270,7 @@ done: return (ret_value); } -#else /* H5_HAVE_FORK */ +#else /* H5_HAVE_UNISTD_H */ int main(void) @@ -281,4 +279,4 @@ main(void) return EXIT_SUCCESS; } /* end main() */ -#endif /* H5_HAVE_FORK */ +#endif /* H5_HAVE_UNISTD_H */ diff --git a/test/use_append_chunk_mirror.c b/test/use_append_chunk_mirror.c index 59a7732..b19c510 100644 --- a/test/use_append_chunk_mirror.c +++ b/test/use_append_chunk_mirror.c @@ -91,11 +91,9 @@ #include "use.h" /* This test uses many POSIX things that are not available on - * Windows. We're using a check for fork(2) here as a proxy for - * all POSIX/Unix/Linux things until this test can be made - * more platform-independent. + * Windows. */ -#ifdef H5_HAVE_FORK +#ifdef H5_HAVE_UNISTD_H #ifdef H5_HAVE_MIRROR_VFD @@ -391,7 +389,7 @@ main(void) #endif /* H5_HAVE_MIRROR_VFD */ -#else /* H5_HAVE_FORK */ +#else /* H5_HAVE_UNISTD_H */ int main(void) @@ -400,4 +398,4 @@ main(void) return EXIT_SUCCESS; } /* end main() */ -#endif /* H5_HAVE_FORK */ +#endif /* H5_HAVE_UNISTD_H */ diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index 7c1971b..47c9f92 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -53,11 +53,9 @@ #include "h5test.h" /* This test uses many POSIX things that are not available on - * Windows. We're using a check for fork(2) here as a proxy for - * all POSIX/Unix/Linux things until this test can be made - * more platform-independent. + * Windows. */ -#ifdef H5_HAVE_FORK +#ifdef H5_HAVE_UNISTD_H #include "use.h" @@ -267,7 +265,7 @@ done: return (ret_value); } /* end main() */ -#else /* H5_HAVE_FORK */ +#else /* H5_HAVE_UNISTD_H */ int main(void) @@ -276,4 +274,4 @@ main(void) return EXIT_SUCCESS; } /* end main() */ -#endif /* H5_HAVE_FORK */ +#endif /* H5_HAVE_UNISTD_H */ diff --git a/test/use_common.c b/test/use_common.c index 4a878c7..0ea2c83 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -13,11 +13,9 @@ #include "h5test.h" /* This test uses many POSIX things that are not available on - * Windows. We're using a check for fork(2) here as a proxy for - * all POSIX/Unix/Linux things until this test can be made - * more platform-independent. + * Windows. */ -#ifdef H5_HAVE_FORK +#ifdef H5_HAVE_UNISTD_H #include "use.h" @@ -613,4 +611,4 @@ read_uc_file(hbool_t towait, options_t *opts) return 0; } /* end read_uc_file() */ -#endif /* H5_HAVE_FORK */ +#endif /* H5_HAVE_UNISTD_H */ diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index 1f2976f..f28e574 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -18,11 +18,9 @@ #include "h5test.h" /* This test uses many POSIX things that are not available on - * Windows. We're using a check for fork(2) here as a proxy for - * all POSIX/Unix/Linux things until this test can be made - * more platform-independent. + * Windows. */ -#ifdef H5_HAVE_FORK +#ifdef H5_HAVE_UNISTD_H #define H5D_FRIEND /*suppress error about including H5Dpkg */ #define H5D_TESTING @@ -539,7 +537,7 @@ done: return (ret_value); } -#else /* H5_HAVE_FORK */ +#else /* H5_HAVE_UNISTD_H */ int main(void) @@ -548,4 +546,4 @@ main(void) HDexit(EXIT_SUCCESS); } /* end main() */ -#endif /* H5_HAVE_FORK */ +#endif /* H5_HAVE_UNISTD_H */ -- cgit v0.12 From 748da20bbc42aa119305ee84f863361816e1517e Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 12 Mar 2021 07:47:47 -0600 Subject: develop JNI export references and java updates (#467) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- java/src/hdf/hdf5lib/H5.java | 27 +- java/src/hdf/hdf5lib/HDF5Constants.java | 10 +- java/src/hdf/hdf5lib/HDF5GroupInfo.java | 24 +- java/src/hdf/hdf5lib/HDFArray.java | 10 +- java/src/hdf/hdf5lib/structs/H5_ih_info_t.java | 6 +- java/src/jni/h5util.c | 543 +++++++++++++++++-------- java/src/jni/h5util.h | 14 +- java/test/CMakeLists.txt | 4 + java/test/TestH5.java | 119 +++++- java/test/TestH5D.java | 2 +- java/test/TestH5Rref.java | 2 +- java/test/TestH5T.java | 4 +- java/test/junit.sh.in | 2 + java/test/testfiles/JUnit-TestH5.txt | 4 +- src/H5Spkg.h | 10 +- tools/lib/h5diff_array.c | 4 +- 16 files changed, 559 insertions(+), 226 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 960c872..aef0ba1 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -512,8 +512,8 @@ public class H5 implements java.io.Serializable { * * @param file_export_name * The file name to export data into. - * @param file_name - * The name of the HDF5 file containing the dataset. + * @param file_id + * The identifier of the HDF5 file containing the dataset. * @param object_path * The full path of the dataset to be exported. * @param binary_order @@ -525,10 +525,31 @@ public class H5 implements java.io.Serializable { * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ - public synchronized static native void H5export_dataset(String file_export_name, String file_name, + public synchronized static native void H5export_dataset(String file_export_name, long file_id, String object_path, int binary_order) throws HDF5LibraryException; /** + * H5export_attribute is a utility function to save data in a file. + * + * @param file_export_name + * The file name to export data into. + * @param dataset_id + * The identifier of the dataset containing the attribute. + * @param attribute_name + * The attribute to be exported. + * @param binary_order + * 99 - export data as text. + * 1 - export data as binary Native Order. + * 2 - export data as binary Little Endian. + * 3 - export data as binary Big Endian. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5export_attribute(String file_export_name, long dataset_id, + String attribute_name, int binary_order) throws HDF5LibraryException; + + /** * H5is_library_threadsafe Checks to see if the library was built with thread-safety enabled. * * @return true if hdf5 library implements threadsafe diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 334abee..4125907 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -55,15 +55,15 @@ public class HDF5Constants { public static final int H5_INDEX_CRT_ORDER = H5_INDEX_CRT_ORDER(); /** indices on links, number of indices defined */ public static final int H5_INDEX_N = H5_INDEX_N(); - /** */ + /** Common iteration orders, Unknown order */ public static final int H5_ITER_UNKNOWN = H5_ITER_UNKNOWN(); - /** */ + /** Common iteration orders, Increasing order */ public static final int H5_ITER_INC = H5_ITER_INC(); - /** */ + /** Common iteration orders, Decreasing order */ public static final int H5_ITER_DEC = H5_ITER_DEC(); - /** */ + /** Common iteration orders, No particular order, whatever is fastest */ public static final int H5_ITER_NATIVE = H5_ITER_NATIVE(); - /** */ + /** Common iteration orders, Number of iteration orders */ public static final int H5_ITER_N = H5_ITER_N(); /** */ public static final int H5AC_CURR_CACHE_CONFIG_VERSION = H5AC_CURR_CACHE_CONFIG_VERSION(); diff --git a/java/src/hdf/hdf5lib/HDF5GroupInfo.java b/java/src/hdf/hdf5lib/HDF5GroupInfo.java index e08f991..4c31af7 100644 --- a/java/src/hdf/hdf5lib/HDF5GroupInfo.java +++ b/java/src/hdf/hdf5lib/HDF5GroupInfo.java @@ -90,32 +90,44 @@ public class HDF5GroupInfo { linklen = 0; } - /** fileno accessors */ + /** fileno accessors + * @return the file number if successful + */ public long[] getFileno() { return fileno; } - /** accessors */ + /** accessors + * @return the object number if successful + */ public long[] getObjno() { return objno; } - /** accessors */ + /** accessors + * @return type of group if successful + */ public int getType() { return type; } - /** accessors */ + /** accessors + * @return the number of links in the group if successful + */ public int getNlink() { return nlink; } - /** accessors */ + /** accessors + * @return the modified time value if successful + */ public long getMtime() { return mtime; } - /** accessors */ + /** accessors + * @return a length of link name if successful + */ public int getLinklen() { return linklen; } diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java index 385d71b..bb9357e 100644 --- a/java/src/hdf/hdf5lib/HDFArray.java +++ b/java/src/hdf/hdf5lib/HDFArray.java @@ -827,12 +827,10 @@ class ArrayDescriptor { else if (NT == 'S') { NTsize = 2; } - else if ((NT == 'I') - || (NT == 'F')) { + else if ((NT == 'I') || (NT == 'F')) { NTsize = 4; } - else if ((NT == 'J') - || (NT == 'D')) { + else if ((NT == 'J') || (NT == 'D')) { NTsize = 8; } else if (css.startsWith("Ljava.lang.Byte")) { @@ -925,8 +923,8 @@ class ArrayDescriptor { System.out.println("Type: " + theType); System.out.println("Class: " + theClass); System.out.println("NT: " + NT + " NTsize: " + NTsize); - System.out - .println("Array has " + dims + " dimensions (" + totalSize + " bytes, " + totalElements + " elements)"); + System.out.println("Array has " + dims + " dimensions (" + totalSize + + " bytes, " + totalElements + " elements)"); int i; for (i = 0; i <= dims; i++) { Class tc = objs[i].getClass(); diff --git a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java index eec50c2..0c6111b 100644 --- a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java @@ -20,9 +20,9 @@ import java.io.Serializable; */ public class H5_ih_info_t implements Serializable { private static final long serialVersionUID = -142238015615462707L; - /** */ - public long index_size; /* btree and/or list */ - /** */ + /** btree and/or list size of index */ + public long index_size; + /** btree and/or list size of hp */ public long heap_size; H5_ih_info_t (long index_size, long heap_size) diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 2e02e4d..8ba6cf2 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -52,6 +52,8 @@ void * edata; /* Local Prototypes */ /********************/ +int h5str_region_dataset(JNIEnv *env, h5str_t *out_str, H5R_ref_t *ref_vp, int expand_data); + static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj, int expand_data); static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj, @@ -1098,14 +1100,15 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i } case H5T_REFERENCE: { - if (H5Tequal(tid, H5T_STD_REF)) { - hid_t new_obj_id = H5I_INVALID_HID; - H5O_type_t obj_type = -1; /* Object type */ - H5R_type_t ref_type; /* Reference type */ + /* H5T_STD_REF */ + hid_t new_obj_id = H5I_INVALID_HID; + H5O_type_t obj_type = -1; /* Object type */ + H5R_type_t ref_type; /* Reference type */ - H5R_ref_t *ref_vp = (H5R_ref_t *)cptr; + H5R_ref_t *ref_vp = (H5R_ref_t *)cptr; - ref_type = H5Rget_type(ref_vp); + ref_type = H5Rget_type(ref_vp); + if (!h5str_is_zero(ref_vp, H5Tget_size(H5T_STD_REF))) { switch (ref_type) { case H5R_OBJECT1: if (H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type) >= 0) { @@ -1209,18 +1212,10 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i default: break; } /* end switch */ - - if (H5Rdestroy(ref_vp) < 0) - H5_LIBRARY_ERROR(ENVONLY); } - else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { - /* (H5R_DSET_REG_REF_BUF_SIZE == typeSize) */ - H5_LIBRARY_ERROR(ENVONLY); - } - else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { - /* (H5R_OBJ_REF_BUF_SIZE == typeSize) */ + + if (H5Rdestroy(ref_vp) < 0) H5_LIBRARY_ERROR(ENVONLY); - } break; } @@ -2240,39 +2235,31 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs } case H5T_REFERENCE: { - if (H5Tequal(tid, H5T_STD_REF)) { - hid_t region_id = H5I_INVALID_HID; - hid_t region_space = H5I_INVALID_HID; - H5S_sel_type region_type; - - /* Region data */ - for (block_index = 0; block_index < block_nelmts; block_index++) { - mem = ((unsigned char *)_mem) + block_index * size; - if ((region_id = H5Ropen_object((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) - continue; - if ((region_space = H5Ropen_region((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) { - region_type = H5Sget_select_type(region_space); - if (region_type == H5S_SEL_POINTS) - ret_value = render_bin_output_region_points(stream, region_space, region_id, - container); - else if (region_type == H5S_SEL_HYPERSLABS) - ret_value = render_bin_output_region_blocks(stream, region_space, region_id, - container); - } - H5Sclose(region_space); - } /* end if (region_space >= 0) */ - H5Dclose(region_id); + hid_t region_id = H5I_INVALID_HID; + hid_t region_space = H5I_INVALID_HID; + H5S_sel_type region_type; - if (ret_value < 0) - break; - } - } - else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { - ; - } - else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { - ; + /* Region data */ + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char *)_mem) + block_index * size; + if ((region_id = H5Ropen_object((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) + continue; + if ((region_space = H5Ropen_region((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) { + region_type = H5Sget_select_type(region_space); + if (region_type == H5S_SEL_POINTS) + ret_value = + render_bin_output_region_points(stream, region_space, region_id, container); + else if (region_type == H5S_SEL_HYPERSLABS) + ret_value = + render_bin_output_region_blocks(stream, region_space, region_id, container); + } + H5Sclose(region_space); + } /* end if (region_space >= 0) */ + H5Dclose(region_id); + + if (ret_value < 0) + break; } break; @@ -2762,11 +2749,11 @@ h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) size_t p_type_nbytes; /* size of memory type */ /* Stripmine info */ - unsigned char *sm_buf = NULL; /* buffer for raw data */ - hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ - hsize_t sm_nbytes; /* bytes per stripmine */ - hsize_t sm_nelmts; /* elements per stripmine */ - hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */ + void * sm_buf = NULL; /* buffer for raw data */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hsize_t sm_nelmts; /* elements per stripmine */ + hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */ /* Hyperslab info */ hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ @@ -2786,142 +2773,168 @@ h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) if ((f_type = H5Dget_type(dset)) < 0) H5_LIBRARY_ERROR(ENVONLY); - switch (binary_order) { - case 1: { - if ((p_type = h5str_get_native_type(f_type)) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + if ((f_space = H5Dget_space(dset)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - break; - } + if ((ndims = H5Sget_simple_extent_ndims(f_space)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - case 2: { - if ((p_type = h5str_get_little_endian_type(f_type)) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) + H5_LIBRARY_ERROR(ENVONLY); - break; - } + if (H5Tequal(f_type, H5T_STD_REF_DSETREG)) { + p_nelmts = H5Sget_simple_extent_npoints(f_space); + if (NULL == + (sm_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)p_nelmts))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_mem: failed to allocate sm_buf"); - case 3: { - if ((p_type = h5str_get_big_endian_type(f_type)) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + /* Read the data */ + if (H5Dread(dset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, sm_buf) < 0) + H5_LIBRARY_ERROR(ENVONLY); - break; + if (binary_order == 99) { + if (h5str_dump_simple_data(ENVONLY, stream, dset, H5T_STD_REF, sm_buf, p_nelmts) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } - - default: { - if ((p_type = H5Tcopy(f_type)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - break; + else { + if (h5str_render_bin_output(stream, dset, H5T_STD_REF, sm_buf, p_nelmts) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } } + else { + switch (binary_order) { + case 1: { + if ((p_type = h5str_get_native_type(f_type)) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - if ((f_space = H5Dget_space(dset)) < 0) - H5_LIBRARY_ERROR(ENVONLY); + break; + } - if ((ndims = H5Sget_simple_extent_ndims(f_space)) < 0) - H5_LIBRARY_ERROR(ENVONLY); + case 2: { + if ((p_type = h5str_get_little_endian_type(f_type)) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - if ((size_t)ndims <= (sizeof(sm_size) / sizeof(sm_size[0]))) { - if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) - H5_LIBRARY_ERROR(ENVONLY); + break; + } - /* Calculate the number of elements we're going to print */ - p_nelmts = 1; + case 3: { + if ((p_type = h5str_get_big_endian_type(f_type)) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - if (ndims > 0) { - for (i = 0; i < (size_t)ndims; i++) - p_nelmts *= total_size[i]; - } /* end if */ + break; + } + + default: { + if ((p_type = H5Tcopy(f_type)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (p_nelmts > 0) { - /* Check if we have VL data in the dataset's datatype */ - if (h5str_detect_vlen(p_type) != 0) - vl_data = 1; + break; + } + } - /* - * Determine the strip mine size and allocate a buffer. The strip mine is - * a hyperslab whose size is manageable. - */ - if (!(sm_nbytes = p_type_nbytes = H5Tget_size(p_type))) + if ((size_t)ndims <= (sizeof(sm_size) / sizeof(sm_size[0]))) { + if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) H5_LIBRARY_ERROR(ENVONLY); + /* Calculate the number of elements we're going to print */ + p_nelmts = 1; + if (ndims > 0) { - for (i = (size_t)ndims; i > 0; --i) { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ - size = 1; - sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size)); - sm_nbytes *= sm_size[i - 1]; + for (i = 0; i < (size_t)ndims; i++) + p_nelmts *= total_size[i]; + } /* end if */ + + if (p_nelmts > 0) { + /* Check if we have VL data in the dataset's datatype */ + if (h5str_detect_vlen(p_type) != 0) + vl_data = 1; + + /* + * Determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ + if (!(sm_nbytes = p_type_nbytes = H5Tget_size(p_type))) + H5_LIBRARY_ERROR(ENVONLY); + + if (ndims > 0) { + for (i = (size_t)ndims; i > 0; --i) { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size)); + sm_nbytes *= sm_size[i - 1]; + } } - } - if (sm_nbytes > 0) { - if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_dset: failed to allocate sm_buf"); + if (sm_nbytes > 0) { + if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_dset: failed to allocate sm_buf"); - sm_nelmts = sm_nbytes / p_type_nbytes; + sm_nelmts = sm_nbytes / p_type_nbytes; - if ((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if ((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + /* The stripmine loop */ + HDmemset(hs_offset, 0, sizeof hs_offset); + HDmemset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { + /* Calculate the hyperslab size */ + if (ndims > 0) { + for (i = 0, hs_nelmts = 1; i < (size_t)ndims; i++) { + hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) + ? (total_size[i] - hs_offset[i]) + : (sm_size[i])); + hs_nelmts *= hs_size[i]; + } + + if (H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < + 0) + H5_LIBRARY_ERROR(ENVONLY); - /* The stripmine loop */ - HDmemset(hs_offset, 0, sizeof hs_offset); - HDmemset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { - /* Calculate the hyperslab size */ - if (ndims > 0) { - for (i = 0, hs_nelmts = 1; i < (size_t)ndims; i++) { - hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) - ? (total_size[i] - hs_offset[i]) - : (sm_size[i])); - hs_nelmts *= hs_size[i]; + if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < + 0) + H5_LIBRARY_ERROR(ENVONLY); } + else { + if (H5Sselect_all(f_space) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if (H5Sselect_all(sm_space) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - H5_LIBRARY_ERROR(ENVONLY); - } - else { - if (H5Sselect_all(f_space) < 0) - H5_LIBRARY_ERROR(ENVONLY); + hs_nelmts = 1; + } - if (H5Sselect_all(sm_space) < 0) + /* Read the data */ + if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) H5_LIBRARY_ERROR(ENVONLY); - hs_nelmts = 1; - } - - /* Read the data */ - if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if (binary_order == 99) { - if (h5str_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - else { - if (h5str_render_bin_output(stream, dset, p_type, sm_buf, hs_nelmts) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } + if (binary_order == 99) { + if (h5str_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else { + if (h5str_render_bin_output(stream, dset, p_type, sm_buf, hs_nelmts) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } - /* Reclaim any VL memory, if necessary */ - if (vl_data) { - if (H5Treclaim(p_type, sm_space, H5P_DEFAULT, sm_buf) < 0) - H5_LIBRARY_ERROR(ENVONLY); - } + /* Reclaim any VL memory, if necessary */ + if (vl_data) { + if (H5Treclaim(p_type, sm_space, H5P_DEFAULT, sm_buf) < 0) + H5_LIBRARY_ERROR(ENVONLY); + } - /* Calculate the next hyperslab offset */ - for (i = (size_t)ndims, carry = 1; i > 0 && carry; --i) { - hs_offset[i - 1] += hs_size[i - 1]; + /* Calculate the next hyperslab offset */ + for (i = (size_t)ndims, carry = 1; i > 0 && carry; --i) { + hs_offset[i - 1] += hs_size[i - 1]; - if (hs_offset[i - 1] == total_size[i - 1]) - hs_offset[i - 1] = 0; - else - carry = 0; + if (hs_offset[i - 1] == total_size[i - 1]) + hs_offset[i - 1] = 0; + else + carry = 0; + } } } } @@ -2945,6 +2958,148 @@ done: return ret_value; } /* end h5str_dump_simple_dset */ +int +h5str_dump_simple_mem(JNIEnv *env, FILE *stream, hid_t attr_id, int binary_order) +{ + hid_t f_space = H5I_INVALID_HID; /* file data space */ + hsize_t alloc_size; + int ndims; /* rank of dataspace */ + unsigned i; /* counters */ + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + hsize_t p_nelmts; /* total selected elmts */ + + void * sm_buf = NULL; /* buffer for raw data */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + + int ret_value = 0; + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + hid_t p_type = H5I_INVALID_HID; + hid_t f_type = H5I_INVALID_HID; + + if (attr_id < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_dump_simple_mem: attr ID < 0"); + + if ((f_type = H5Aget_type(attr_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (H5I_INVALID_HID == (f_space = H5Aget_space(attr_id))) + H5_LIBRARY_ERROR(ENVONLY); + + if ((ndims = H5Sget_simple_extent_ndims(f_space)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (H5Tequal(f_type, H5T_STD_REF_DSETREG)) { + p_nelmts = H5Sget_simple_extent_npoints(f_space); + if (NULL == + (sm_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)p_nelmts))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_mem: failed to allocate sm_buf"); + + /* Read the data */ + if (H5Aread(attr_id, H5T_STD_REF, sm_buf) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (binary_order == 99) { + if (h5str_dump_simple_data(ENVONLY, stream, attr_id, H5T_STD_REF, sm_buf, p_nelmts) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else { + if (h5str_render_bin_output(stream, attr_id, H5T_STD_REF, sm_buf, p_nelmts) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + } + else { + switch (binary_order) { + case 1: { + if ((p_type = h5str_get_native_type(f_type)) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + break; + } + + case 2: { + if ((p_type = h5str_get_little_endian_type(f_type)) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + break; + } + + case 3: { + if ((p_type = h5str_get_big_endian_type(f_type)) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + break; + } + + default: { + if ((p_type = H5Tcopy(f_type)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + break; + } + } + + if ((size_t)ndims <= (sizeof(sm_size) / sizeof(sm_size[0]))) { + if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) + H5_LIBRARY_ERROR(ENVONLY); + /* Calculate the number of elements we're going to print */ + p_nelmts = 1; + + if (ndims > 0) { + for (i = 0; i < (size_t)ndims; i++) + p_nelmts *= total_size[i]; + } /* end if */ + + if (p_nelmts > 0) { + /* Check if we have VL data in the dataset's datatype */ + if (h5str_detect_vlen(p_type) != 0) + vl_data = 1; + + alloc_size = p_nelmts * H5Tget_size(p_type); + if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)alloc_size))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_mem: failed to allocate sm_buf"); + + /* Read the data */ + if (H5Aread(attr_id, p_type, sm_buf) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (binary_order == 99) { + if (h5str_dump_simple_data(ENVONLY, stream, attr_id, p_type, sm_buf, p_nelmts) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else { + if (h5str_render_bin_output(stream, attr_id, p_type, sm_buf, p_nelmts) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + + /* Reclaim any VL memory, if necessary */ + if (vl_data) { + if (H5Treclaim(p_type, f_space, H5P_DEFAULT, sm_buf) < 0) + H5_LIBRARY_ERROR(ENVONLY); + } + } + } + } + + ret_value = SUCCEED; + +done: + if (sm_buf) + HDfree(sm_buf); + if (f_space >= 0) + H5Sclose(f_space); + if (p_type >= 0) + H5Tclose(p_type); + if (f_type >= 0) + H5Tclose(f_type); + + return ret_value; +} + htri_t H5Tdetect_variable_str(hid_t tid) { @@ -3007,7 +3162,6 @@ h5str_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, v H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); } } - if (HDfprintf(stream, "%s", buffer.s) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); @@ -3577,18 +3731,16 @@ done: /* * Class: hdf_hdf5lib_H5 * Method: H5export_dataset - * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V + * Signature: (Ljava/lang/String;JLjava/lang/String;I)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_export_name, jstring file_name, +Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_export_name, jlong file_id, jstring object_path, jint binary_order) { const char *file_export = NULL; const char *object_name = NULL; - const char *fileName = NULL; jboolean isCopy; herr_t ret_val = FAIL; - hid_t file_id = H5I_INVALID_HID; hid_t dataset_id = H5I_INVALID_HID; FILE * stream = NULL; @@ -3597,17 +3749,9 @@ Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_exp if (NULL == file_export_name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_export_name is NULL"); - if (NULL == file_name) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_name is NULL"); - if (NULL == object_path) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: object_path is NULL"); - PIN_JAVA_STRING(ENVONLY, file_name, fileName, NULL, "H5export_dataset: file name not pinned"); - - if ((file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - PIN_JAVA_STRING(ENVONLY, object_path, object_name, &isCopy, "H5export_dataset: object_path not pinned"); if ((dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT)) < 0) @@ -3634,14 +3778,65 @@ done: UNPIN_JAVA_STRING(ENVONLY, file_export_name, file_export); if (object_name) UNPIN_JAVA_STRING(ENVONLY, object_path, object_name); - if (fileName) - UNPIN_JAVA_STRING(ENVONLY, file_name, fileName); if (dataset_id >= 0) H5Dclose(dataset_id); - if (file_id >= 0) - H5Fclose(file_id); } /* end Java_hdf_hdf5lib_H5_H5export_1dataset */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5export_attribute + * Signature: (Ljava/lang/String;JLjava/lang/String;I)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5export_1attribute(JNIEnv *env, jclass clss, jstring file_export_name, jlong dset_id, + jstring attribute_name, jint binary_order) +{ + const char *file_export = NULL; + const char *object_name = NULL; + jboolean isCopy; + herr_t ret_val = FAIL; + hid_t attr_id = H5I_INVALID_HID; + FILE * stream = NULL; + + UNUSED(clss); + + if (NULL == file_export_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_export_name is NULL"); + + if (NULL == attribute_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: object_path is NULL"); + + PIN_JAVA_STRING(ENVONLY, attribute_name, object_name, &isCopy, + "H5export_dataset: object_path not pinned"); + + if ((attr_id = H5Aopen(dset_id, object_name, H5P_DEFAULT)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + PIN_JAVA_STRING(ENVONLY, file_export_name, file_export, NULL, + "H5export_dataset: file_export name not pinned"); + + if (NULL == (stream = HDfopen(file_export, "w+"))) + H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed"); + + if ((ret_val = h5str_dump_simple_mem(ENVONLY, stream, attr_id, binary_order)) < 0) + H5_ASSERTION_ERROR(ENVONLY, "h5str_dump_simple_dset failed"); + + if (stream) { + HDfclose(stream); + stream = NULL; + } + +done: + if (stream) + HDfclose(stream); + if (file_export) + UNPIN_JAVA_STRING(ENVONLY, file_export_name, file_export); + if (object_name) + UNPIN_JAVA_STRING(ENVONLY, attribute_name, object_name); + if (attr_id >= 0) + H5Aclose(attr_id); +} /* end Java_hdf_hdf5lib_H5_H5export_1attribute */ + #ifdef __cplusplus } #endif diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h index a5e9607..6c568e1 100644 --- a/java/src/jni/h5util.h +++ b/java/src/jni/h5util.h @@ -46,6 +46,7 @@ extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_ int expand_data); extern void h5str_array_free(char **strs, size_t len); extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order); +extern int h5str_dump_simple_mem(JNIEnv *env, FILE *stream, hid_t attr, int binary_order); extern htri_t H5Tdetect_variable_str(hid_t tid); @@ -105,9 +106,16 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max(JNIEnv *, jcla /* * Class: hdf_hdf5lib_H5 * Method: H5export_dataset - * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V + * Signature: (Ljava/lang/String;JLjava/lang/String;I)V */ -JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *, jclass, jstring, jstring, jstring, - jint); +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *, jclass, jstring, jlong, jstring, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5export_attribute + * Signature: (Ljava/lang/String;JLjava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1attribute(JNIEnv *, jclass, jstring, jlong, jstring, + jint); #endif /* H5UTIL_H__ */ diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index c791c79..10f9d52 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -96,6 +96,8 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/tdatareg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list}) @@ -213,6 +215,8 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/${voltest}/tdatareg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/${voltest}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list}) diff --git a/java/test/TestH5.java b/java/test/TestH5.java index c4f298e..1f298f3 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -49,9 +49,13 @@ public class TestH5 { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testData.h5"; private static final String EXPORT_FILE = "testExport.txt"; - private static final String H5_DREG_FILE = "trefer_reg.h5"; - private static final String EXPORT_DREG_FILE = "testExportReg.txt"; - private static final String H5_AREG_FILE = "trefer_attr.h5"; + private static final String H5_REGION_FILE = "trefer_reg.h5"; + private static final String EXPORT_REGION_FILE = "testExportReg.txt"; + private static final String H5_ATTR_FILE = "trefer_attr.h5"; + private static final String EXPORT_ATTR_FILE = "testExportAttr.txt"; + private static final String H5_DREG_FILE = "tdatareg.h5"; + private static final String EXPORT_DREG_FILE = "testExportDReg.txt"; + private static final String H5_AREG_FILE = "tattrreg.h5"; private static final String EXPORT_AREG_FILE = "testExportAReg.txt"; private static final int DIM_X = 4; private static final int DIM_Y = 6; @@ -129,7 +133,7 @@ public class TestH5 { public void _openH5File(String filename, String dsetname) { try { H5fid = H5.H5Fopen(filename, - HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -162,6 +166,7 @@ public class TestH5 { @After public void closeH5File() throws HDF5LibraryException { _closeH5File(); + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); System.out.println(); } @@ -415,8 +420,10 @@ public class TestH5 { _closeH5File(); + _openH5File(H5_FILE, "/dset"); + try { - H5.H5export_dataset(EXPORT_FILE, H5_FILE, "/dset", 99); + H5.H5export_dataset(EXPORT_FILE, H5fid, "/dset", 99); } catch (HDF5LibraryException err) { err.printStackTrace(); @@ -454,6 +461,86 @@ public class TestH5 { } @Test + public void testH5export_region() { + int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, + 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171, + 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231, + 207, 66, 252, 48, 84, 96, 12, 14, 213, 99}; + int[] dset_indata = new int[DIM_BLKS+DIM_PNTS]; + String objName = "/Dataset1"; + + _openH5File(H5_REGION_FILE, objName); + + try { + H5.H5export_dataset(EXPORT_REGION_FILE, H5fid, objName, 99); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5export_dataset failed: " + err); + } + + File file = new File(EXPORT_REGION_FILE); + + try { + Reader reader = new FileReader(EXPORT_REGION_FILE); + StreamTokenizer streamTokenizer = new StreamTokenizer(reader); + int indx = 0; + while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ + if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + dset_indata[indx] = (int)streamTokenizer.nval; + indx++; + } + } + reader.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("read file failed: " + err); + } + for(int row = 0; row < DIM_X; row++) + assertTrue("testH5export_region: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + } + + @Test + public void testH5export_attribute() { + int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + int[] dset_indata = new int[DIM_ATTR]; + String objName = "/Dataset3"; + + _openH5File(H5_ATTR_FILE, objName); + + try { + H5.H5export_dataset(EXPORT_ATTR_FILE, H5did, objName, 99); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5export_dataset failed: " + err); + } + + File file = new File(EXPORT_ATTR_FILE); + + try { + Reader reader = new FileReader(EXPORT_ATTR_FILE); + StreamTokenizer streamTokenizer = new StreamTokenizer(reader); + int indx = 0; + int jndx = 0; + while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ + if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + dset_indata[indx] = (int)streamTokenizer.nval; + indx++; + } + } + reader.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("read file failed: " + err); + } + for(int row = 0; row < DIM_X; row++) + assertTrue("testH5export_attribute: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + } + + @Test public void testH5export_regdataset() { int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171, @@ -465,7 +552,7 @@ public class TestH5 { _openH5File(H5_DREG_FILE, objName); try { - H5.H5export_dataset(EXPORT_DREG_FILE, H5_DREG_FILE, objName, 99); + H5.H5export_dataset(EXPORT_DREG_FILE, H5fid, objName, 99); } catch (HDF5LibraryException err) { err.printStackTrace(); @@ -491,23 +578,27 @@ public class TestH5 { fail("read file failed: " + err); } for(int row = 0; row < DIM_X; row++) - assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + assertTrue("testH5export_regdataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); } @Test public void testH5export_attrdataset() { - int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; - int[] dset_indata = new int[DIM_ATTR]; - String objName = "/Dataset3"; + int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, + 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171, + 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231, + 207, 66, 252, 48, 84, 96, 12, 14, 213, 99}; + int[] dset_indata = new int[DIM_BLKS+DIM_PNTS]; + String dsetName = "/Dataset1"; + String objName = "Attribute1"; - _openH5File(H5_AREG_FILE, objName); + _openH5File(H5_AREG_FILE, dsetName); try { - H5.H5export_dataset(EXPORT_AREG_FILE, H5_AREG_FILE, objName, 99); + H5.H5export_attribute(EXPORT_AREG_FILE, H5did, objName, 99); } catch (HDF5LibraryException err) { err.printStackTrace(); - fail("H5export_dataset failed: " + err); + fail("H5export_attribute failed: " + err); } File file = new File(EXPORT_AREG_FILE); @@ -530,6 +621,6 @@ public class TestH5 { fail("read file failed: " + err); } for(int row = 0; row < DIM_X; row++) - assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + assertTrue("testH5export_attrdataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); } } diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java index 863ce79..dac3a9c 100644 --- a/java/test/TestH5D.java +++ b/java/test/TestH5D.java @@ -197,7 +197,7 @@ public class TestH5D { private final void _openH5file(String filename, String dsetname, long dapl) { try { H5fid = H5.H5Fopen(filename, - HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Rref.java b/java/test/TestH5Rref.java index aeec64f..cbdabdd 100644 --- a/java/test/TestH5Rref.java +++ b/java/test/TestH5Rref.java @@ -53,7 +53,7 @@ public class TestH5Rref { public void openH5file(String filename, String dsetname) { try { H5fid = H5.H5Fopen(filename, - HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java index c882f8e..ed4e2a9 100644 --- a/java/test/TestH5T.java +++ b/java/test/TestH5T.java @@ -206,7 +206,7 @@ public class TestH5T { @Test public void testH5Tenum_functions() { - long filetype_id =HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; String enum_type ="Enum_type"; byte[] enum_val = new byte[1]; String enum_name = null; @@ -398,7 +398,7 @@ public class TestH5T { @Test public void testH5Tcompound_functions() { - long filetype_id =HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; // Create a compound datatype try { diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 81ce13b..3774cbd 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -252,6 +252,8 @@ COPY_DATAFILES_TO_BLDDIR() $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO2.hdf $CP -f $TOOLS_TESTFILES/trefer_reg.h5 $BLDDIR/trefer_reg.h5 $CP -f $TOOLS_TESTFILES/trefer_attr.h5 $BLDDIR/trefer_attr.h5 + $CP -f $TOOLS_TESTFILES/tdatareg.h5 $BLDDIR/tdatareg.h5 + $CP -f $TOOLS_TESTFILES/tattrreg.h5 $BLDDIR/tattrreg.h5 } CLEAN_DATAFILES_AND_BLDDIR() diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt index 59765d9..fb50a57 100644 --- a/java/test/testfiles/JUnit-TestH5.txt +++ b/java/test/testfiles/JUnit-TestH5.txt @@ -1,4 +1,5 @@ JUnit version 4.11 +.testH5export_region .testH5get_libversion_null_param .testJ2C .testH5export_dataset @@ -7,6 +8,7 @@ JUnit version 4.11 .testH5garbage_collect .testH5error_off .testH5export_regdataset +.testH5export_attribute .serializeToDisk .testH5open .testH5check_version @@ -15,5 +17,5 @@ JUnit version 4.11 Time: XXXX -OK (13 tests) +OK (15 tests) diff --git a/src/H5Spkg.h b/src/H5Spkg.h index ae6efcb..c89b616 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 * - * Purpose: This file contains declarations which are visible only within - * the H5S package. Source files outside the H5S package should - * include H5Sprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5S package. Source files outside the H5S package should + * include H5Sprivate.h instead. */ #if !(defined H5S_FRIEND || defined H5S_MODULE) #error "Do not include this file outside the H5S package!" diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 23abea5..faee63f 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -3388,7 +3388,7 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u) H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - c:%ld b:%ld s:%ld", j, curr_pos, curr_idx, cnt_idx, blk_idx, str_idx); dim_size = opts->dims[j]; /* Current dimension size */ - // elmnt_cnt *= dim_size; /* Total number of elements in dimension */ + /* elmnt_cnt *= dim_size; /* Total number of elements in dimension */ H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld - (prev_dim_size:%ld - dim_size:%ld) " "- str_cnt:%ld", j, elmnt_cnt, prev_dim_size, dim_size, str_cnt); @@ -3411,7 +3411,7 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u) "(curr_idx:%ld - data_idx:%ld)", i, dim_size, str_cnt, curr_idx, data_idx); } - next_idx += dim_size * str_cnt; // + prev_dim_size; + next_idx += dim_size * str_cnt; H5TOOLS_DEBUG("... sset loop:%d with curr_idx:%ld (next_idx:%ld)", j, curr_idx, next_idx); str_cnt = 0; prev_str = str_idx; -- cgit v0.12 From 24c83cf73ebb80a58ce92463dac02713d3a4dbf8 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 12 Mar 2021 09:56:09 -0500 Subject: Removed workarounds for pre-standard inline keyword (#423) Fixes -Wreserved-identifier warnings due to multiple underscores in H5_HAVE___INLINE. --- src/H5Oshared.h | 16 ++++++++-------- src/H5VMprivate.h | 24 ++++++++++++------------ src/H5private.h | 17 ----------------- 3 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 0e774cf..f164db3 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -44,7 +44,7 @@ * *------------------------------------------------------------------------- */ -static H5_INLINE void * +static inline void * H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p) { @@ -103,7 +103,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE herr_t +static inline herr_t H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg) { const H5O_shared_t *sh_mesg = @@ -158,7 +158,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE size_t +static inline size_t H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg) { const H5O_shared_t *sh_mesg = @@ -211,7 +211,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE herr_t +static inline herr_t H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg) { H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */ @@ -262,7 +262,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE herr_t +static inline herr_t H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg) { H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */ @@ -312,7 +312,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE void * +static inline void * H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata) { @@ -375,7 +375,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE herr_t +static inline herr_t H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const void *mesg_src, H5O_loc_t *oloc_dst, void *mesg_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info) { @@ -445,7 +445,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE herr_t +static inline herr_t H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5O_shared_t *sh_mesg = diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index e24ce83..2fea2fc 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -143,7 +143,7 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s * *------------------------------------------------------------------------- */ -static H5_INLINE hsize_t H5_ATTR_UNUSED +static inline hsize_t H5_ATTR_UNUSED H5VM_vector_reduce_product(unsigned n, const hsize_t *v) { hsize_t ret_value = 1; @@ -179,7 +179,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE htri_t H5_ATTR_UNUSED +static inline htri_t H5_ATTR_UNUSED H5VM_vector_zerop_u(int n, const hsize_t *v) { htri_t ret_value = TRUE; /* Return value */ @@ -216,7 +216,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE htri_t H5_ATTR_UNUSED +static inline htri_t H5_ATTR_UNUSED H5VM_vector_zerop_s(int n, const hssize_t *v) { htri_t ret_value = TRUE; /* Return value */ @@ -255,7 +255,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE int H5_ATTR_UNUSED +static inline int H5_ATTR_UNUSED H5VM_vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2) { int ret_value = 0; /* Return value */ @@ -303,7 +303,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE int H5_ATTR_UNUSED +static inline int H5_ATTR_UNUSED H5VM_vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2) { int ret_value = 0; /* Return value */ @@ -346,7 +346,7 @@ done: * *------------------------------------------------------------------------- */ -static H5_INLINE void H5_ATTR_UNUSED +static inline void H5_ATTR_UNUSED H5VM_vector_inc(int n, hsize_t *v1, const hsize_t *v2) { while (n--) @@ -390,7 +390,7 @@ static const unsigned char LogTable256[] = { * *------------------------------------------------------------------------- */ -static H5_INLINE unsigned H5_ATTR_UNUSED +static inline unsigned H5_ATTR_UNUSED H5VM_log2_gen(uint64_t n) { unsigned r; /* r will be log2(n) */ @@ -439,7 +439,7 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14, * *------------------------------------------------------------------------- */ -static H5_INLINE H5_ATTR_PURE unsigned +static inline H5_ATTR_PURE unsigned H5VM_log2_of2(uint32_t n) { #ifndef NDEBUG @@ -463,7 +463,7 @@ H5VM_log2_of2(uint32_t n) * *------------------------------------------------------------------------- */ -static H5_INLINE H5_ATTR_CONST hsize_t +static inline H5_ATTR_CONST hsize_t H5VM_power2up(hsize_t n) { hsize_t ret_value = 1; /* Return value */ @@ -495,7 +495,7 @@ H5VM_power2up(hsize_t n) * *------------------------------------------------------------------------- */ -static H5_INLINE unsigned H5_ATTR_UNUSED +static inline unsigned H5_ATTR_UNUSED H5VM_limit_enc_size(uint64_t limit) { return (H5VM_log2_gen(limit) / 8) + 1; @@ -527,7 +527,7 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7, * *------------------------------------------------------------------------- */ -static H5_INLINE hbool_t H5_ATTR_UNUSED +static inline hbool_t H5_ATTR_UNUSED H5VM_bit_get(const unsigned char *buf, size_t offset) { /* Test the appropriate bit in the buffer */ @@ -557,7 +557,7 @@ H5VM_bit_get(const unsigned char *buf, size_t offset) * *------------------------------------------------------------------------- */ -static H5_INLINE void H5_ATTR_UNUSED +static inline void H5_ATTR_UNUSED H5VM_bit_set(unsigned char *buf, size_t offset, hbool_t val) { /* Set/reset the appropriate bit in the buffer */ diff --git a/src/H5private.h b/src/H5private.h index 64ab988..0d6377c 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -190,23 +190,6 @@ #endif /*H5_HAVE_WIN32_API*/ -/* Various ways that inline functions can be declared */ -#if defined(H5_HAVE___INLINE__) -/* GNU (alternative form) */ -#define H5_INLINE __inline__ -#elif defined(H5_HAVE___INLINE) -/* Visual Studio */ -#define H5_INLINE __inline -#elif defined(H5_HAVE_INLINE) -/* GNU, C++ - * Use "inline" as a last resort on the off-chance that there will - * be C++ problems. - */ -#define H5_INLINE inline -#else -#define H5_INLINE -#endif /* inline choices */ - #ifndef F_OK #define F_OK 00 #define W_OK 02 -- cgit v0.12 From f6d919a2ab0034a1ee76ca2d5f59f4d8114c4952 Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 15 Mar 2021 08:16:22 -0500 Subject: Simplified hl parsing (#399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Stop using global variables to share parse context with the lexer. The lexer uses an unconventional strategy for parsing lexical categories NUMBER (decimal numbers) and STRING (double-quoted strings) that involves sharing the parse context with the lexer using global variables. There are a couple of problems with that. First, the lexer is too complicated for the simple tokenization it performs—it's hard to tell if it is correct. Second, as @seanm points out, the shared global variables spill into the namespace shared by other libraries and application programs—e.g., VTK. * Regenerate source files from *.[yl]. * Replace strndup, which isn't available on Windows, with a custom routine, `trim_quotes`, that produces a copy of its `const char *` argument with leading and trailing double quotes ('"') removed. While I am here, remove the unnecessary statement `BEGIN INITIAL;`, which I should have deleted in a previous commit. * Regenerate .c from .l. * You haven't programmed in C until you have programmed in High-Definition (HD) C. * \#include "H5private.h" for HD* definitions. * Regenerate *.[ch] from *.[yl]. --- hl/src/H5LTanalyze.c | 980 ++++++++------------ hl/src/H5LTanalyze.l | 90 +- hl/src/H5LTparse.c | 2422 ++++++++++++++++++++++++++++---------------------- hl/src/H5LTparse.h | 174 ++-- hl/src/H5LTparse.y | 102 +-- 5 files changed, 1879 insertions(+), 1889 deletions(-) diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 6673f5f..1f23d3b 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -10,11 +10,11 @@ #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wstrict-overflow" #pragma GCC diagnostic ignored "-Wstrict-prototypes" -#if !defined (__clang__) +#if !defined (__clang__) #pragma GCC diagnostic ignored "-Wlarger-than=" #pragma GCC diagnostic ignored "-Wsuggest-attribute=const" #pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" -#endif +#endif #pragma GCC diagnostic ignored "-Wswitch-default" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-macros" @@ -28,9 +28,9 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -#line 2 "hl/src/H5LTanalyze.c" +#line 2 "hl/src//H5LTanalyze.c" -#line 4 "hl/src/H5LTanalyze.c" +#line 4 "hl/src//H5LTanalyze.c" #define YY_INT_ALIGNED short int @@ -58,7 +58,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 37 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -96,7 +96,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -104,7 +103,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -135,6 +133,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -405,13 +405,13 @@ static void yy_fatal_error (yyconst char msg[] ); */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - H5LTyyleng = (yy_size_t) (yy_cp - yy_bp); \ + H5LTyyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 66 -#define YY_END_OF_BUFFER 67 +#define YY_NUM_RULES 65 +#define YY_END_OF_BUFFER 66 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -419,120 +419,38 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_acclist[437] = +static yyconst flex_int16_t yy_accept[276] = { 0, - 64, 64, 64, 64, 67, 66, 64, 66, 64, 65, - 66, 56, 66, 55, 66, 62, 66, 63, 66, 66, - 66, 66, 66, 60, 66, 61, 66, 58, 66, 59, - 66, 57, 66, 57, 64, 66, 57, 64, 65, 66, - 55, 57, 66, 57, 62, 66, 57, 63, 66, 57, - 66, 57, 66, 57, 66, 57, 66, 57, 60, 66, - 57, 61, 66, 57, 58, 66, 57, 59, 66, 64, - 55, 57, 57, 64, 55, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 38, 38, 57, 57, - 57, 57, 57, 57, 39, 39, 57, 57, 57, 57, - - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 37, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 37, 57, 57, 54, 36, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 54, 57, 36, 57, 45, 49, - 51, 53, 57, 57, 57, 45, 57, 49, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 51, 57, 53, - 57, 50, 50, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 52, 35, 57, 57, - 57, 57, 57, 57, 52, 57, 57, 57, 57, 57, - - 57, 57, 57, 57, 35, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 48, - 1, 2, 9, 10, 47, 48, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 1, 57, 2, 57, 57, - 57, 57, 57, 57, 57, 9, 57, 10, 57, 57, - 57, 47, 57, 44, 3, 4, 5, 6, 7, 8, - 11, 12, 13, 14, 15, 16, 57, 44, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - - 57, 57, 57, 57, 57, 57, 57, 3, 57, 4, - 57, 5, 57, 6, 57, 7, 57, 8, 57, 11, - 57, 12, 57, 13, 57, 14, 57, 15, 57, 16, - 57, 57, 57, 57, 43, 46, 28, 29, 30, 31, - 22, 43, 57, 46, 57, 28, 57, 29, 57, 30, - 57, 31, 57, 57, 57, 57, 22, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 17, 24, 23, 41, 17, 57, 57, 57, 57, - 57, 24, 57, 57, 57, 57, 23, 57, 57, 57, - 57, 41, 57, 57, 57, 32, 26, 18, 20, 19, - - 25, 40, 42, 57, 32, 57, 57, 26, 57, 18, - 57, 20, 57, 19, 57, 57, 25, 57, 57, 40, - 57, 42, 57, 33, 27, 21, 33, 57, 57, 27, - 57, 21, 57, 34, 34, 57 - } ; - -static yyconst flex_int16_t yy_accept[546] = - { 0, - 1, 2, 3, 4, 5, 6, 7, 9, 12, 14, - 16, 18, 20, 21, 22, 23, 24, 26, 28, 30, - 32, 34, 37, 41, 44, 47, 50, 52, 54, 56, - 58, 61, 64, 67, 70, 71, 72, 72, 72, 72, - 72, 72, 73, 75, 77, 78, 79, 80, 81, 82, - 82, 82, 82, 82, 82, 83, 84, 85, 86, 87, - 88, 88, 88, 88, 88, 88, 90, 91, 92, 93, - 94, 95, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 96, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 112, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 129, 129, 129, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 147, 149, 149, 149, 149, 150, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 152, 153, 154, - 155, 156, 158, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 170, 172, 173, 173, 173, 173, 173, 173, - - 173, 173, 173, 173, 173, 173, 173, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 187, 187, 187, 187, 187, 187, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 189, 189, 189, 189, 190, - 191, 192, 193, 194, 195, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 207, 208, 209, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 231, - - 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, - 231, 231, 231, 231, 231, 231, 231, 232, 233, 233, - 233, 233, 233, 233, 233, 234, 235, 235, 235, 236, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 258, - 260, 261, 262, 263, 264, 265, 266, 268, 270, 271, - 272, 274, 274, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 287, 287, 287, 288, 290, 291, - - 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, 306, 307, 308, 310, 312, 314, - 316, 318, 320, 322, 324, 326, 328, 330, 332, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 341, 341, - 341, 342, 342, 342, 342, 342, 342, 342, 342, 342, - 342, 342, 342, 342, 342, 344, 346, 348, 350, 352, - 354, 355, 356, 357, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 373, - 373, 373, 373, 374, 374, 374, 374, 375, 375, 375, - 375, 376, 376, 376, 378, 379, 380, 381, 382, 384, - - 385, 386, 387, 389, 390, 391, 392, 394, 395, 396, - 396, 397, 397, 398, 399, 400, 401, 401, 402, 402, - 403, 404, 405, 407, 408, 410, 412, 414, 416, 417, - 419, 420, 422, 424, 425, 425, 426, 427, 429, 430, - 432, 434, 435, 437, 437 + 63, 63, 66, 65, 63, 63, 65, 55, 61, 62, + 65, 65, 65, 65, 59, 60, 57, 58, 63, 0, + 55, 0, 0, 0, 0, 0, 56, 0, 0, 0, + 0, 0, 38, 0, 0, 0, 0, 0, 39, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 54, 36, 0, 0, 0, 45, 49, 0, + 0, 0, 0, 0, 0, 0, 0, 51, 53, 50, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, + 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 0, 0, 0, 0, 0, 0, 9, 10, + 0, 0, 47, 0, 44, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 3, 4, 5, 6, 7, 8, 11, + 12, 13, 14, 15, 16, 0, 0, 0, 43, 46, + 28, 29, 30, 31, 0, 0, 0, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 17, 0, 0, 0, 0, 24, 0, 0, 0, + 23, 0, 0, 0, 41, 0, 0, 0, 32, 0, + 26, 18, 20, 19, 0, 25, 0, 40, 42, 33, + 0, 27, 21, 34, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -576,305 +494,173 @@ static yyconst flex_int32_t yy_meta[42] = 1 } ; -static yyconst flex_int16_t yy_base[547] = +static yyconst flex_int16_t yy_base[278] = { 0, - 0, 0, 41, 0, 610, 611, 81, 83, 611, 0, - 611, 611, 56, 599, 580, 575, 611, 611, 611, 611, - 0, 87, 89, 88, 0, 0, 70, 596, 577, 572, - 0, 0, 0, 0, 101, 0, 584, 567, 569, 571, - 569, 0, 103, 0, 579, 562, 564, 566, 564, 561, - 564, 552, 551, 79, 557, 560, 548, 547, 80, 611, - 566, 97, 87, 569, 560, 0, 563, 117, 90, 566, - 557, 611, 549, 99, 552, 550, 557, 560, 546, 541, - 118, 549, 556, 552, 533, 0, 538, 108, 541, 539, - 546, 549, 535, 530, 126, 538, 545, 541, 522, 527, - - 531, 536, 523, 520, 522, 532, 518, 534, 95, 518, - 528, 510, 524, 611, 525, 513, 517, 522, 509, 506, - 508, 518, 504, 520, 97, 504, 514, 496, 510, 0, - 511, 514, 500, 495, 520, 500, 492, 504, 499, 492, - 481, 106, 496, 492, 498, 611, 611, 501, 487, 482, - 507, 487, 479, 491, 486, 479, 468, 123, 483, 479, - 485, 0, 0, 468, 475, 462, 611, 611, 470, 460, - 464, 464, 126, 470, 126, 480, 611, 611, 459, 466, - 453, 0, 0, 461, 451, 455, 455, 130, 461, 129, - 471, 0, 0, 611, 452, 139, 469, 463, 463, 462, - - 158, 165, 459, 446, 450, 461, 0, 443, 141, 460, - 454, 454, 453, 172, 179, 450, 437, 441, 452, 441, - 435, 433, 438, 150, 424, 611, 451, 454, 451, 151, - 448, 451, 448, 165, 611, 432, 440, 430, 427, 421, - 419, 424, 157, 410, 0, 437, 440, 437, 170, 434, - 437, 434, 172, 0, 418, 426, 416, 421, 421, 417, - 397, 428, 425, 180, 177, 183, 186, 414, 413, 190, - 192, 193, 412, 411, 405, 411, 408, 408, 408, 404, - 384, 415, 412, 201, 196, 199, 206, 401, 400, 211, - 212, 213, 399, 398, 392, 398, 395, 611, 390, 400, - - 380, 215, 217, 388, 382, 384, 381, 220, 223, 225, - 387, 386, 385, 384, 383, 382, 611, 611, 381, 380, - 379, 378, 377, 376, 611, 611, 218, 375, 611, 0, - 370, 380, 360, 227, 236, 368, 362, 364, 361, 235, - 241, 244, 367, 366, 365, 364, 363, 362, 0, 0, - 361, 360, 359, 358, 357, 356, 0, 0, 237, 355, - 0, 350, 611, 366, 352, 351, 350, 349, 352, 333, - 338, 332, 336, 335, 335, 338, 332, 336, 331, 155, - 334, 611, 611, 611, 611, 611, 611, 611, 611, 611, - 611, 611, 611, 340, 335, 325, 329, 0, 345, 331, - - 330, 329, 328, 331, 312, 317, 311, 315, 314, 314, - 317, 311, 315, 310, 168, 313, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 319, 314, - 304, 611, 611, 611, 611, 611, 611, 301, 314, 314, - 611, 295, 301, 305, 310, 294, 308, 290, 294, 294, - 292, 300, 287, 301, 0, 0, 0, 0, 0, 0, - 285, 298, 298, 0, 279, 285, 289, 294, 278, 292, - 274, 278, 278, 276, 284, 271, 285, 611, 275, 266, - 281, 275, 611, 265, 262, 263, 611, 266, 270, 260, - 611, 264, 270, 0, 263, 254, 269, 263, 0, 253, - - 250, 251, 0, 254, 258, 247, 0, 249, 255, 253, - 611, 247, 611, 611, 611, 611, 249, 611, 234, 611, - 611, 245, 0, 233, 0, 0, 0, 0, 234, 0, - 222, 0, 0, 611, 207, 611, 611, 0, 186, 0, - 0, 611, 0, 611, 106, 275 + 0, 0, 304, 305, 40, 42, 0, 0, 305, 305, + 15, 293, 274, 269, 305, 305, 305, 305, 46, 296, + 0, 280, 263, 265, 267, 265, 305, 262, 265, 253, + 252, 22, 305, 271, 39, 20, 274, 265, 305, 257, + 30, 260, 258, 265, 268, 254, 249, 40, 257, 264, + 260, 241, 246, 250, 255, 242, 239, 241, 251, 237, + 253, 42, 237, 247, 229, 243, 305, 244, 247, 233, + 228, 253, 233, 225, 237, 232, 225, 214, 40, 229, + 225, 231, 305, 305, 214, 221, 208, 305, 305, 216, + 206, 210, 210, 44, 216, 45, 226, 305, 305, 305, + + 207, 53, 224, 218, 218, 217, 72, 79, 214, 201, + 205, 216, 205, 199, 197, 202, 81, 188, 305, 215, + 218, 215, 58, 212, 215, 212, 72, 305, 196, 204, + 194, 199, 199, 195, 175, 206, 203, 80, 77, 78, + 83, 192, 191, 90, 92, 93, 190, 189, 183, 189, + 186, 305, 181, 191, 171, 94, 96, 179, 173, 175, + 172, 97, 105, 102, 178, 177, 176, 175, 174, 173, + 305, 305, 172, 171, 170, 169, 168, 167, 305, 305, + 100, 166, 305, 161, 305, 177, 163, 162, 161, 160, + 163, 144, 149, 143, 147, 146, 146, 149, 143, 147, + + 142, 107, 145, 305, 305, 305, 305, 305, 305, 305, + 305, 305, 305, 305, 305, 151, 146, 136, 305, 305, + 305, 305, 305, 305, 133, 146, 146, 305, 127, 133, + 137, 142, 126, 140, 122, 126, 126, 124, 132, 119, + 133, 305, 123, 114, 129, 123, 305, 113, 110, 111, + 305, 114, 118, 108, 305, 111, 112, 110, 305, 99, + 305, 305, 305, 305, 84, 305, 63, 305, 305, 305, + 62, 305, 305, 305, 305, 134, 72 } ; -static yyconst flex_int16_t yy_def[547] = +static yyconst flex_int16_t yy_def[278] = { 0, - 544, 1, 544, 3, 544, 544, 544, 544, 544, 545, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 544, 545, 544, 544, 544, 544, - 544, 546, 546, 24, 546, 546, 546, 546, 546, 544, - 544, 544, 544, 544, 546, 546, 546, 546, 546, 544, - 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, - 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, - - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, - - 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, - - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, - - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, - - 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 544, 544, 544, 544, 546, 546, 546, - 546, 544, 546, 0, 544, 544 + 275, 1, 275, 275, 275, 275, 276, 277, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 276, + 277, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 0, 275, 275 } ; -static yyconst flex_int16_t yy_nxt[653] = +static yyconst flex_int16_t yy_nxt[347] = { 0, - 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, - 10, 10, 11, 12, 6, 6, 13, 6, 6, 6, - 6, 14, 6, 6, 6, 6, 15, 6, 6, 6, - 16, 6, 6, 6, 6, 6, 17, 18, 6, 19, - 20, 21, 22, 23, 9, 24, 24, 24, 24, 24, - 24, 24, 24, 25, 26, 21, 21, 27, 21, 21, - 21, 21, 28, 21, 21, 21, 21, 29, 21, 21, - 21, 30, 21, 21, 21, 21, 21, 31, 32, 21, - 33, 34, 35, 35, 35, 35, 37, 38, 43, 43, - 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, - - 45, 46, 35, 35, 43, 43, 64, 70, 36, 65, - 71, 73, 141, 74, 157, 75, 76, 82, 83, 77, - 96, 97, 78, 79, 142, 101, 158, 80, 174, 102, - 81, 87, 110, 88, 117, 89, 90, 103, 118, 91, - 126, 111, 92, 93, 175, 189, 119, 94, 201, 127, - 95, 204, 214, 221, 217, 240, 205, 262, 202, 218, - 263, 190, 215, 227, 282, 228, 268, 283, 229, 230, - 231, 222, 232, 241, 269, 233, 234, 246, 449, 247, - 273, 450, 248, 249, 250, 288, 251, 293, 274, 252, - 253, 472, 311, 289, 473, 294, 304, 305, 313, 306, - - 312, 315, 307, 308, 543, 319, 314, 321, 323, 316, - 309, 343, 310, 320, 345, 322, 324, 336, 337, 344, - 338, 347, 346, 339, 340, 542, 351, 353, 355, 348, - 365, 341, 367, 342, 352, 354, 356, 373, 366, 376, - 368, 378, 400, 374, 377, 394, 375, 379, 380, 395, - 401, 402, 408, 541, 540, 381, 539, 411, 409, 403, - 413, 410, 412, 538, 429, 537, 414, 415, 430, 536, - 535, 534, 533, 532, 416, 42, 531, 42, 530, 529, - 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, - 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, - - 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, - 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, - 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, - 478, 477, 476, 475, 474, 471, 470, 469, 468, 467, - 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, - 456, 455, 454, 453, 452, 451, 448, 447, 446, 445, - 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, - 434, 433, 432, 431, 428, 427, 426, 425, 424, 423, - 422, 421, 420, 419, 418, 417, 407, 406, 405, 404, - 399, 398, 397, 396, 393, 392, 391, 390, 389, 388, - - 387, 386, 385, 384, 383, 382, 372, 371, 370, 369, - 364, 363, 362, 361, 360, 359, 358, 357, 350, 349, - 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, - 325, 318, 317, 303, 302, 301, 300, 299, 298, 297, - 296, 295, 292, 291, 290, 287, 286, 285, 284, 281, - 280, 279, 278, 277, 276, 275, 272, 271, 270, 267, - 266, 265, 264, 261, 260, 259, 258, 257, 256, 255, - 254, 245, 244, 243, 242, 239, 238, 237, 236, 235, - 226, 225, 224, 223, 220, 219, 216, 213, 212, 211, - 210, 209, 208, 207, 206, 203, 200, 199, 198, 197, - - 196, 195, 194, 193, 192, 191, 188, 187, 186, 185, - 184, 183, 182, 181, 180, 179, 178, 177, 176, 173, - 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, - 162, 161, 160, 159, 156, 155, 154, 153, 152, 151, - 150, 149, 148, 147, 146, 145, 144, 143, 140, 139, - 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, - 128, 125, 124, 123, 122, 121, 120, 116, 115, 114, - 113, 112, 109, 108, 107, 106, 105, 104, 100, 99, - 98, 86, 85, 84, 72, 69, 68, 67, 66, 63, - 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, - - 52, 51, 50, 49, 48, 47, 41, 40, 39, 544, - 5, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544 + 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, + 8, 8, 9, 10, 4, 4, 11, 4, 4, 4, + 4, 12, 4, 4, 4, 4, 13, 4, 4, 4, + 14, 4, 4, 4, 4, 4, 15, 16, 4, 17, + 18, 19, 19, 19, 19, 22, 23, 19, 19, 37, + 49, 50, 38, 40, 63, 41, 54, 42, 43, 78, + 55, 44, 95, 64, 45, 46, 107, 114, 56, 47, + 110, 79, 48, 142, 21, 111, 108, 120, 96, 121, + 274, 143, 122, 123, 124, 115, 125, 147, 136, 126, + 127, 137, 165, 167, 273, 148, 158, 159, 169, 160, + + 166, 168, 161, 162, 272, 173, 170, 175, 177, 187, + 163, 189, 164, 174, 195, 176, 178, 188, 200, 190, + 196, 198, 271, 197, 201, 202, 199, 216, 270, 269, + 236, 217, 203, 237, 20, 268, 20, 267, 266, 265, + 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, + 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, + 244, 243, 242, 241, 240, 239, 238, 235, 234, 233, + 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, + 222, 221, 220, 219, 218, 215, 214, 213, 212, 211, + 210, 209, 208, 207, 206, 205, 204, 194, 193, 192, + + 191, 186, 185, 184, 183, 182, 181, 180, 179, 172, + 171, 157, 156, 155, 154, 153, 152, 151, 150, 149, + 146, 145, 144, 141, 140, 139, 138, 135, 134, 133, + 132, 131, 130, 129, 128, 119, 118, 117, 116, 113, + 112, 109, 106, 105, 104, 103, 102, 101, 100, 99, + 98, 97, 94, 93, 92, 91, 90, 89, 88, 87, + 86, 85, 84, 83, 82, 81, 80, 77, 76, 75, + 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, + 62, 61, 60, 59, 58, 57, 53, 52, 51, 39, + 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, + + 26, 25, 24, 275, 3, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275 } ; -static yyconst flex_int16_t yy_chk[653] = +static yyconst flex_int16_t yy_chk[347] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 7, 7, 8, 8, 13, 13, 22, 22, - 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, - - 27, 27, 35, 35, 43, 43, 54, 59, 545, 54, - 59, 62, 109, 62, 125, 62, 62, 63, 63, 62, - 69, 69, 62, 62, 109, 74, 125, 62, 142, 74, - 62, 68, 81, 68, 88, 68, 68, 74, 88, 68, - 95, 81, 68, 68, 142, 158, 88, 68, 173, 95, - 68, 175, 188, 196, 190, 209, 175, 224, 173, 190, - 224, 158, 188, 201, 243, 201, 230, 243, 201, 201, - 202, 196, 202, 209, 230, 202, 202, 214, 380, 214, - 234, 380, 214, 214, 215, 249, 215, 253, 234, 215, - 215, 415, 265, 249, 415, 253, 264, 264, 266, 264, - - 265, 267, 264, 264, 539, 270, 266, 271, 272, 267, - 264, 285, 264, 270, 286, 271, 272, 284, 284, 285, - 284, 287, 286, 284, 284, 535, 290, 291, 292, 287, - 302, 284, 303, 284, 290, 291, 292, 308, 302, 309, - 303, 310, 334, 308, 309, 327, 308, 310, 310, 327, - 334, 335, 340, 531, 529, 310, 524, 341, 340, 335, - 342, 340, 341, 522, 359, 519, 342, 342, 359, 517, - 512, 510, 509, 508, 342, 546, 506, 546, 505, 504, - 502, 501, 500, 498, 497, 496, 495, 493, 492, 490, - 489, 488, 486, 485, 484, 482, 481, 480, 479, 477, - - 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, - 466, 465, 463, 462, 461, 454, 453, 452, 451, 450, - 449, 448, 447, 446, 445, 444, 443, 442, 440, 439, - 438, 431, 430, 429, 416, 414, 413, 412, 411, 410, - 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, - 399, 397, 396, 395, 394, 381, 379, 378, 377, 376, - 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, - 365, 364, 362, 360, 356, 355, 354, 353, 352, 351, - 348, 347, 346, 345, 344, 343, 339, 338, 337, 336, - 333, 332, 331, 328, 324, 323, 322, 321, 320, 319, - - 316, 315, 314, 313, 312, 311, 307, 306, 305, 304, - 301, 300, 299, 297, 296, 295, 294, 293, 289, 288, - 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, - 273, 269, 268, 263, 262, 261, 260, 259, 258, 257, - 256, 255, 252, 251, 250, 248, 247, 246, 244, 242, - 241, 240, 239, 238, 237, 236, 233, 232, 231, 229, - 228, 227, 225, 223, 222, 221, 220, 219, 218, 217, - 216, 213, 212, 211, 210, 208, 206, 205, 204, 203, - 200, 199, 198, 197, 195, 191, 189, 187, 186, 185, - 184, 181, 180, 179, 176, 174, 172, 171, 170, 169, - - 166, 165, 164, 161, 160, 159, 157, 156, 155, 154, - 153, 152, 151, 150, 149, 148, 145, 144, 143, 141, - 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, - 129, 128, 127, 126, 124, 123, 122, 121, 120, 119, - 118, 117, 116, 115, 113, 112, 111, 110, 108, 107, - 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, - 96, 94, 93, 92, 91, 90, 89, 87, 85, 84, - 83, 82, 80, 79, 78, 77, 76, 75, 73, 71, - 70, 67, 65, 64, 61, 58, 57, 56, 55, 53, - 52, 51, 50, 49, 48, 47, 46, 45, 41, 40, - - 39, 38, 37, 30, 29, 28, 16, 15, 14, 5, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544 + 1, 5, 5, 6, 6, 11, 11, 19, 19, 32, + 36, 36, 32, 35, 48, 35, 41, 35, 35, 62, + 41, 35, 79, 48, 35, 35, 94, 102, 41, 35, + 96, 62, 35, 123, 277, 96, 94, 107, 79, 107, + 271, 123, 107, 107, 108, 102, 108, 127, 117, 108, + 108, 117, 139, 140, 267, 127, 138, 138, 141, 138, + + 139, 140, 138, 138, 265, 144, 141, 145, 146, 156, + 138, 157, 138, 144, 162, 145, 146, 156, 164, 157, + 162, 163, 260, 162, 164, 164, 163, 181, 258, 257, + 202, 181, 164, 202, 276, 256, 276, 254, 253, 252, + 250, 249, 248, 246, 245, 244, 243, 241, 240, 239, + 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, + 227, 226, 225, 218, 217, 216, 203, 201, 200, 199, + 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, + 188, 187, 186, 184, 182, 178, 177, 176, 175, 174, + 173, 170, 169, 168, 167, 166, 165, 161, 160, 159, + + 158, 155, 154, 153, 151, 150, 149, 148, 147, 143, + 142, 137, 136, 135, 134, 133, 132, 131, 130, 129, + 126, 125, 124, 122, 121, 120, 118, 116, 115, 114, + 113, 112, 111, 110, 109, 106, 105, 104, 103, 101, + 97, 95, 93, 92, 91, 90, 87, 86, 85, 82, + 81, 80, 78, 77, 76, 75, 74, 73, 72, 71, + 70, 69, 68, 66, 65, 64, 63, 61, 60, 59, + 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, + 47, 46, 45, 44, 43, 42, 40, 38, 37, 34, + 31, 30, 29, 28, 26, 25, 24, 23, 22, 20, + + 14, 13, 12, 3, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275 } ; +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + extern int H5LTyy_flex_debug; int H5LTyy_flex_debug = 0; -static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; -static char *yy_full_match; -static int yy_lp; -#define REJECT \ -{ \ -*yy_cp = (yy_hold_char); /* undo effects of setting up H5LTyytext */ \ -yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ -++(yy_lp); \ -goto find_rule; \ -} - +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *H5LTyytext; -#line 1 "hl/src/H5LTanalyze.l" +#line 1 "hl/src//H5LTanalyze.l" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -892,12 +678,16 @@ char *H5LTyytext; * If you make any changes to H5LTanalyze.l, please run bin/genparser to * recreate the output files. */ -#line 21 "hl/src/H5LTanalyze.l" +#line 21 "hl/src//H5LTanalyze.l" +#include #include #include #include + +#include "H5private.h" #include "H5LTparse.h" +static char *trim_quotes(const char *); int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) @@ -912,44 +702,9 @@ int my_yyinput(char *, int); extern char *myinput; extern size_t input_len; -#define STACK_SIZE 16 - -/*variables for compound type*/ -struct cmpd_info { - hid_t id; - hbool_t is_field; - hbool_t first_memb; -}; -extern struct cmpd_info cmpd_stack[STACK_SIZE]; -extern int csindex; - -/*variables for array type*/ -struct arr_info { - hsize_t dims[H5S_MAX_RANK]; - int ndim; - hbool_t is_dim; -}; -extern struct arr_info arr_stack[STACK_SIZE]; -extern int asindex; - -/*variables for enumerate type*/ -extern hbool_t is_enum; -extern hbool_t is_enum_memb; - -/*variables for string type*/ -extern hbool_t is_str_size; - -/*variables for opaque type*/ -extern hbool_t is_opq_size; -extern hbool_t is_opq_tag; - -hbool_t first_quote = 1; - - -#line 920 "hl/src/H5LTanalyze.c" +#line 676 "hl/src//H5LTanalyze.c" #define INITIAL 0 -#define TAG_STRING 1 #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * @@ -1028,7 +783,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout ) +#define ECHO do { if (fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1039,7 +794,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( H5LTyyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1121,10 +876,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 77 "hl/src/H5LTanalyze.l" +#line 46 "hl/src//H5LTanalyze.l" -#line 1098 "hl/src/H5LTanalyze.c" +#line 853 "hl/src//H5LTanalyze.c" if ( !(yy_init) ) { @@ -1134,12 +889,6 @@ YY_DECL YY_USER_INIT; #endif - /* Create the reject buffer large enough to save one state per allowed character. */ - if ( ! (yy_state_buf) ) - (yy_state_buf) = (yy_state_type *)H5LTyyalloc(YY_STATE_BUF_SIZE ); - if ( ! (yy_state_buf) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyylex()" ); - if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ @@ -1171,44 +920,33 @@ YY_DECL yy_bp = yy_cp; yy_current_state = (yy_start); - - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; - yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 545 ) + if ( yy_current_state >= 276 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *(yy_state_ptr)++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 611 ); + while ( yy_base[yy_current_state] != 305 ); yy_find_action: - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; -goto find_rule; /* Shut up GCC warning -Wall */ -find_rule: /* we branch to this label when backing up */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[(yy_lp)]; - { - (yy_full_match) = yy_cp; - break; - } - } - --yy_cp; - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; @@ -1217,368 +955,350 @@ do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + case 1: YY_RULE_SETUP -#line 79 "hl/src/H5LTanalyze.l" +#line 48 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_I8BE_TOKEN);} YY_BREAK case 2: YY_RULE_SETUP -#line 80 "hl/src/H5LTanalyze.l" +#line 49 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_I8LE_TOKEN);} YY_BREAK case 3: YY_RULE_SETUP -#line 81 "hl/src/H5LTanalyze.l" +#line 50 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_I16BE_TOKEN);} YY_BREAK case 4: YY_RULE_SETUP -#line 82 "hl/src/H5LTanalyze.l" +#line 51 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_I16LE_TOKEN);} YY_BREAK case 5: YY_RULE_SETUP -#line 83 "hl/src/H5LTanalyze.l" +#line 52 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_I32BE_TOKEN);} YY_BREAK case 6: YY_RULE_SETUP -#line 84 "hl/src/H5LTanalyze.l" +#line 53 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_I32LE_TOKEN);} YY_BREAK case 7: YY_RULE_SETUP -#line 85 "hl/src/H5LTanalyze.l" +#line 54 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_I64BE_TOKEN);} YY_BREAK case 8: YY_RULE_SETUP -#line 86 "hl/src/H5LTanalyze.l" +#line 55 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_I64LE_TOKEN);} YY_BREAK case 9: YY_RULE_SETUP -#line 88 "hl/src/H5LTanalyze.l" +#line 57 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_U8BE_TOKEN);} YY_BREAK case 10: YY_RULE_SETUP -#line 89 "hl/src/H5LTanalyze.l" +#line 58 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_U8LE_TOKEN);} YY_BREAK case 11: YY_RULE_SETUP -#line 90 "hl/src/H5LTanalyze.l" +#line 59 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_U16BE_TOKEN);} YY_BREAK case 12: YY_RULE_SETUP -#line 91 "hl/src/H5LTanalyze.l" +#line 60 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_U16LE_TOKEN);} YY_BREAK case 13: YY_RULE_SETUP -#line 92 "hl/src/H5LTanalyze.l" +#line 61 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_U32BE_TOKEN);} YY_BREAK case 14: YY_RULE_SETUP -#line 93 "hl/src/H5LTanalyze.l" +#line 62 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_U32LE_TOKEN);} YY_BREAK case 15: YY_RULE_SETUP -#line 94 "hl/src/H5LTanalyze.l" +#line 63 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_U64BE_TOKEN);} YY_BREAK case 16: YY_RULE_SETUP -#line 95 "hl/src/H5LTanalyze.l" +#line 64 "hl/src//H5LTanalyze.l" {return hid(H5T_STD_U64LE_TOKEN);} YY_BREAK case 17: YY_RULE_SETUP -#line 97 "hl/src/H5LTanalyze.l" +#line 66 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_CHAR_TOKEN);} YY_BREAK case 18: YY_RULE_SETUP -#line 98 "hl/src/H5LTanalyze.l" +#line 67 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_SCHAR_TOKEN);} YY_BREAK case 19: YY_RULE_SETUP -#line 99 "hl/src/H5LTanalyze.l" +#line 68 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_UCHAR_TOKEN);} YY_BREAK case 20: YY_RULE_SETUP -#line 100 "hl/src/H5LTanalyze.l" +#line 69 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_SHORT_TOKEN);} YY_BREAK case 21: YY_RULE_SETUP -#line 101 "hl/src/H5LTanalyze.l" +#line 70 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_USHORT_TOKEN);} YY_BREAK case 22: YY_RULE_SETUP -#line 102 "hl/src/H5LTanalyze.l" +#line 71 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_INT_TOKEN);} YY_BREAK case 23: YY_RULE_SETUP -#line 103 "hl/src/H5LTanalyze.l" +#line 72 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_UINT_TOKEN);} YY_BREAK case 24: YY_RULE_SETUP -#line 104 "hl/src/H5LTanalyze.l" +#line 73 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_LONG_TOKEN);} YY_BREAK case 25: YY_RULE_SETUP -#line 105 "hl/src/H5LTanalyze.l" +#line 74 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_ULONG_TOKEN);} YY_BREAK case 26: YY_RULE_SETUP -#line 106 "hl/src/H5LTanalyze.l" +#line 75 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_LLONG_TOKEN);} YY_BREAK case 27: YY_RULE_SETUP -#line 107 "hl/src/H5LTanalyze.l" +#line 76 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_ULLONG_TOKEN);} YY_BREAK case 28: YY_RULE_SETUP -#line 109 "hl/src/H5LTanalyze.l" +#line 78 "hl/src//H5LTanalyze.l" {return hid(H5T_IEEE_F32BE_TOKEN);} YY_BREAK case 29: YY_RULE_SETUP -#line 110 "hl/src/H5LTanalyze.l" +#line 79 "hl/src//H5LTanalyze.l" {return hid(H5T_IEEE_F32LE_TOKEN);} YY_BREAK case 30: YY_RULE_SETUP -#line 111 "hl/src/H5LTanalyze.l" +#line 80 "hl/src//H5LTanalyze.l" {return hid(H5T_IEEE_F64BE_TOKEN);} YY_BREAK case 31: YY_RULE_SETUP -#line 112 "hl/src/H5LTanalyze.l" +#line 81 "hl/src//H5LTanalyze.l" {return hid(H5T_IEEE_F64LE_TOKEN);} YY_BREAK case 32: YY_RULE_SETUP -#line 113 "hl/src/H5LTanalyze.l" +#line 82 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 33: YY_RULE_SETUP -#line 114 "hl/src/H5LTanalyze.l" +#line 83 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 34: YY_RULE_SETUP -#line 115 "hl/src/H5LTanalyze.l" +#line 84 "hl/src//H5LTanalyze.l" {return hid(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 35: YY_RULE_SETUP -#line 117 "hl/src/H5LTanalyze.l" +#line 86 "hl/src//H5LTanalyze.l" {return token(H5T_STRING_TOKEN);} YY_BREAK case 36: YY_RULE_SETUP -#line 118 "hl/src/H5LTanalyze.l" +#line 87 "hl/src//H5LTanalyze.l" {return token(STRSIZE_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP -#line 119 "hl/src/H5LTanalyze.l" +#line 88 "hl/src//H5LTanalyze.l" {return token(STRPAD_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP -#line 120 "hl/src/H5LTanalyze.l" +#line 89 "hl/src//H5LTanalyze.l" {return token(CSET_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP -#line 121 "hl/src/H5LTanalyze.l" +#line 90 "hl/src//H5LTanalyze.l" {return token(CTYPE_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP -#line 122 "hl/src/H5LTanalyze.l" +#line 91 "hl/src//H5LTanalyze.l" {return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP -#line 123 "hl/src/H5LTanalyze.l" +#line 92 "hl/src//H5LTanalyze.l" {return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP -#line 124 "hl/src/H5LTanalyze.l" +#line 93 "hl/src//H5LTanalyze.l" {return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP -#line 125 "hl/src/H5LTanalyze.l" +#line 94 "hl/src//H5LTanalyze.l" {return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP -#line 126 "hl/src/H5LTanalyze.l" +#line 95 "hl/src//H5LTanalyze.l" {return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP -#line 127 "hl/src/H5LTanalyze.l" +#line 96 "hl/src//H5LTanalyze.l" {return token(H5T_C_S1_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP -#line 128 "hl/src/H5LTanalyze.l" +#line 97 "hl/src//H5LTanalyze.l" {return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP -#line 129 "hl/src/H5LTanalyze.l" +#line 98 "hl/src//H5LTanalyze.l" {return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP -#line 131 "hl/src/H5LTanalyze.l" +#line 100 "hl/src//H5LTanalyze.l" {return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 132 "hl/src/H5LTanalyze.l" +#line 101 "hl/src//H5LTanalyze.l" {return token(H5T_ENUM_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 133 "hl/src/H5LTanalyze.l" +#line 102 "hl/src//H5LTanalyze.l" {return token(H5T_ARRAY_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP -#line 134 "hl/src/H5LTanalyze.l" +#line 103 "hl/src//H5LTanalyze.l" {return token(H5T_VLEN_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP -#line 136 "hl/src/H5LTanalyze.l" +#line 105 "hl/src//H5LTanalyze.l" {return token(H5T_OPAQUE_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP -#line 137 "hl/src/H5LTanalyze.l" +#line 106 "hl/src//H5LTanalyze.l" {return token(OPQ_SIZE_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP -#line 138 "hl/src/H5LTanalyze.l" +#line 107 "hl/src//H5LTanalyze.l" {return token(OPQ_TAG_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP -#line 140 "hl/src/H5LTanalyze.l" +#line 109 "hl/src//H5LTanalyze.l" { - if( is_str_size || (is_enum && is_enum_memb) || - is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || - (csindex>-1 && cmpd_stack[csindex].is_field) ) { - H5LTyylval.ival = atoi(H5LTyytext); - return NUMBER; - } else - REJECT; + H5LTyylval.ival = HDatoi(H5LTyytext); + return NUMBER; } YY_BREAK case 56: +/* rule 56 can match eol */ YY_RULE_SETUP -#line 150 "hl/src/H5LTanalyze.l" +#line 114 "hl/src//H5LTanalyze.l" { - /*if it's first quote, and is a compound field name or an enum symbol*/ - if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) - && first_quote) { - first_quote = 0; - BEGIN TAG_STRING; - } else /*if it's second quote*/ - first_quote = 1; - return token('"'); + H5LTyylval.sval = trim_quotes(H5LTyytext); + return STRING; } YY_BREAK case 57: -/* rule 57 can match eol */ YY_RULE_SETUP -#line 160 "hl/src/H5LTanalyze.l" -{ -#ifdef H5_HAVE_WIN32_API - H5LTyylval.sval = _strdup(H5LTyytext); -#else /* H5_HAVE_WIN32_API */ - H5LTyylval.sval = strdup(H5LTyytext); -#endif /* H5_HAVE_WIN32_API */ - BEGIN INITIAL; - return STRING; - } +#line 119 "hl/src//H5LTanalyze.l" +{return token('{');} YY_BREAK case 58: YY_RULE_SETUP -#line 170 "hl/src/H5LTanalyze.l" -{return token('{');} +#line 120 "hl/src//H5LTanalyze.l" +{return token('}');} YY_BREAK case 59: YY_RULE_SETUP -#line 171 "hl/src/H5LTanalyze.l" -{return token('}');} +#line 121 "hl/src//H5LTanalyze.l" +{return token('[');} YY_BREAK case 60: YY_RULE_SETUP -#line 172 "hl/src/H5LTanalyze.l" -{return token('[');} +#line 122 "hl/src//H5LTanalyze.l" +{return token(']');} YY_BREAK case 61: YY_RULE_SETUP -#line 173 "hl/src/H5LTanalyze.l" -{return token(']');} +#line 123 "hl/src//H5LTanalyze.l" +{return token(':');} YY_BREAK case 62: YY_RULE_SETUP -#line 174 "hl/src/H5LTanalyze.l" -{return token(':');} +#line 124 "hl/src//H5LTanalyze.l" +{return token(';');} YY_BREAK case 63: +/* rule 63 can match eol */ YY_RULE_SETUP -#line 175 "hl/src/H5LTanalyze.l" -{return token(';');} +#line 125 "hl/src//H5LTanalyze.l" +; YY_BREAK case 64: /* rule 64 can match eol */ YY_RULE_SETUP -#line 176 "hl/src/H5LTanalyze.l" -; - YY_BREAK -case 65: -/* rule 65 can match eol */ -YY_RULE_SETUP -#line 177 "hl/src/H5LTanalyze.l" +#line 126 "hl/src//H5LTanalyze.l" { return 0; } YY_BREAK -case 66: +case 65: YY_RULE_SETUP -#line 179 "hl/src/H5LTanalyze.l" +#line 128 "hl/src//H5LTanalyze.l" ECHO; YY_BREAK -#line 1549 "hl/src/H5LTanalyze.c" - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(TAG_STRING): - yyterminate(); +#line 1270 "hl/src//H5LTanalyze.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); case YY_END_OF_BUFFER: { @@ -1768,8 +1488,37 @@ static int yy_get_next_buffer (void) while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + H5LTyyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; } @@ -1828,20 +1577,21 @@ static int yy_get_next_buffer (void) yy_current_state = (yy_start); - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 545 ) + if ( yy_current_state >= 276 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *(yy_state_ptr)++ = yy_current_state; } return yy_current_state; @@ -1855,20 +1605,24 @@ static int yy_get_next_buffer (void) static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; - + register char *yy_cp = (yy_c_buf_p); + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 545 ) + if ( yy_current_state >= 276 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 544); - if ( ! yy_is_jam ) - *(yy_state_ptr)++ = yy_current_state; + yy_is_jam = (yy_current_state == 275); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) @@ -1956,7 +1710,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( H5LTyywrap( ) ) - return 0; + return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2092,10 +1846,6 @@ static void H5LTyy_load_buffer_state (void) H5LTyyfree((void *) b ); } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a H5LTyyrestart() or at EOF. @@ -2300,8 +2050,8 @@ YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to H5LTyylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -2309,7 +2059,8 @@ YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2454,11 +2205,6 @@ static int yy_init_globals (void) (yy_init) = 0; (yy_start) = 0; - (yy_state_buf) = 0; - (yy_state_ptr) = 0; - (yy_full_match) = 0; - (yy_lp) = 0; - /* Defined in main.c */ #ifdef YY_STDINIT H5LTyyin = stdin; @@ -2489,9 +2235,6 @@ int H5LTyylex_destroy (void) H5LTyyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; - H5LTyyfree ( (yy_state_buf) ); - (yy_state_buf) = NULL; - /* Reset the globals. This is important in a non-reentrant scanner so the next time * H5LTyylex() is called, initialization will occur. */ yy_init_globals( ); @@ -2547,21 +2290,40 @@ void H5LTyyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 179 "hl/src/H5LTanalyze.l" +#line 128 "hl/src//H5LTanalyze.l" + +/* Allocate a copy of `quoted` with the double quote character at + * the beginning and the one at the end both removed. The caller is + * responsible for free()ing the copy. + */ +static char * +trim_quotes(const char *quoted) +{ + size_t len = HDstrlen(quoted); + char *trimmed; + + HDassert(quoted[0] == '"' && quoted[len - 1] == '"'); + + trimmed = HDstrdup(quoted + 1); + trimmed[len - 2] = '\0'; + + return trimmed; +} + int my_yyinput(char *buf, int max_size) { int ret; - memcpy(buf, myinput, input_len); + HDmemcpy(buf, myinput, input_len); ret = (int)input_len; return ret; } int H5LTyyerror(const char *msg) { - printf("ERROR: %s before \"%s\".\n", msg, H5LTyytext); + HDprintf("ERROR: %s before \"%s\".\n", msg, H5LTyytext); return 0; } diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 49fc039..76d5800 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -18,11 +18,15 @@ */ %{ +#include #include #include #include + +#include "H5private.h" #include "H5LTparse.h" +static char *trim_quotes(const char *); int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) @@ -37,43 +41,8 @@ int my_yyinput(char *, int); extern char *myinput; extern size_t input_len; -#define STACK_SIZE 16 - -/*variables for compound type*/ -struct cmpd_info { - hid_t id; - hbool_t is_field; - hbool_t first_memb; -}; -extern struct cmpd_info cmpd_stack[STACK_SIZE]; -extern int csindex; - -/*variables for array type*/ -struct arr_info { - hsize_t dims[H5S_MAX_RANK]; - int ndim; - hbool_t is_dim; -}; -extern struct arr_info arr_stack[STACK_SIZE]; -extern int asindex; - -/*variables for enumerate type*/ -extern hbool_t is_enum; -extern hbool_t is_enum_memb; - -/*variables for string type*/ -extern hbool_t is_str_size; - -/*variables for opaque type*/ -extern hbool_t is_opq_size; -extern hbool_t is_opq_tag; - -hbool_t first_quote = 1; - %} -%s TAG_STRING - %% H5T_STD_I8BE {return hid(H5T_STD_I8BE_TOKEN);} @@ -138,32 +107,12 @@ OPQ_SIZE {return token(OPQ_SIZE_TOKEN);} OPQ_TAG {return token(OPQ_TAG_TOKEN);} [0-9]+ { - if( is_str_size || (is_enum && is_enum_memb) || - is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || - (csindex>-1 && cmpd_stack[csindex].is_field) ) { - H5LTyylval.ival = atoi(yytext); - return NUMBER; - } else - REJECT; + H5LTyylval.ival = HDatoi(yytext); + return NUMBER; } -"\"" { - /*if it's first quote, and is a compound field name or an enum symbol*/ - if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) - && first_quote) { - first_quote = 0; - BEGIN TAG_STRING; - } else /*if it's second quote*/ - first_quote = 1; - return token('"'); - } -[^\"]+ { -#ifdef H5_HAVE_WIN32_API - H5LTyylval.sval = _strdup(yytext); -#else /* H5_HAVE_WIN32_API */ - H5LTyylval.sval = strdup(yytext); -#endif /* H5_HAVE_WIN32_API */ - BEGIN INITIAL; +["][^\"]+["] { + H5LTyylval.sval = trim_quotes(yytext); return STRING; } @@ -177,18 +126,37 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} "\n" { return 0; } %% + +/* Allocate a copy of `quoted` with the double quote character at + * the beginning and the one at the end both removed. The caller is + * responsible for free()ing the copy. + */ +static char * +trim_quotes(const char *quoted) +{ + size_t len = HDstrlen(quoted); + char *trimmed; + + HDassert(quoted[0] == '"' && quoted[len - 1] == '"'); + + trimmed = HDstrdup(quoted + 1); + trimmed[len - 2] = '\0'; + + return trimmed; +} + int my_yyinput(char *buf, int max_size) { int ret; - memcpy(buf, myinput, input_len); + HDmemcpy(buf, myinput, input_len); ret = (int)input_len; return ret; } int H5LTyyerror(const char *msg) { - printf("ERROR: %s before \"%s\".\n", msg, yytext); + HDprintf("ERROR: %s before \"%s\".\n", msg, yytext); return 0; } diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 2ef133f..eec7c64 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -10,11 +10,11 @@ #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wstrict-overflow" #pragma GCC diagnostic ignored "-Wstrict-prototypes" -#if !defined (__clang__) +#if !defined (__clang__) #pragma GCC diagnostic ignored "-Wlarger-than=" #pragma GCC diagnostic ignored "-Wsuggest-attribute=const" #pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" -#endif +#endif #pragma GCC diagnostic ignored "-Wswitch-default" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-macros" @@ -28,23 +28,22 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -/* A Bison parser, made by GNU Bison 3.7.2. */ +/* A Bison parser, made by GNU Bison 2.7. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, - Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -57,17 +56,13 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ -/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, - especially those whose name start with YY_ or yy_. They are - private implementation details that can be changed or removed. */ - /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -79,7 +74,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.7.2" +#define YYBISON_VERSION "2.7" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -98,19 +93,22 @@ #define yyparse H5LTyyparse #define yylex H5LTyylex #define yyerror H5LTyyerror -#define yydebug H5LTyydebug -#define yynerrs H5LTyynerrs #define yylval H5LTyylval #define yychar H5LTyychar +#define yydebug H5LTyydebug +#define yynerrs H5LTyynerrs -/* First part of user prologue. */ -#line 20 "hl/src/H5LTparse.y" +/* Copy the first part of user declarations. */ +/* Line 371 of yacc.c */ +#line 20 "hl/src//H5LTparse.y" #include #include #include -extern int yylex(); +#include "H5private.h" + +extern int yylex(void); extern int yyerror(const char *); #define STACK_SIZE 16 @@ -123,13 +121,13 @@ struct cmpd_info { }; /*stack for nested compound type*/ -struct cmpd_info cmpd_stack[STACK_SIZE] = { +static struct cmpd_info cmpd_stack[STACK_SIZE] = { {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1} }; -int csindex = -1; /*pointer to the top of compound stack*/ +static int csindex = -1; /*pointer to the top of compound stack*/ /*structure for array type information*/ struct arr_info { @@ -138,244 +136,188 @@ struct arr_info { hbool_t is_dim; /*flag to lexer for dimension*/ }; /*stack for nested array type*/ -struct arr_info arr_stack[STACK_SIZE]; -int asindex = -1; /*pointer to the top of array stack*/ - -hbool_t is_str_size = 0; /*flag to lexer for string size*/ -hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ -H5T_str_t str_pad; /*variable for string padding*/ -H5T_cset_t str_cset; /*variable for string character set*/ -hbool_t is_variable = 0; /*variable for variable-length string*/ -size_t str_size; /*variable for string size*/ - -hid_t enum_id; /*type ID*/ -hbool_t is_enum = 0; /*flag to lexer for enum type*/ -hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ -char* enum_memb_symbol; /*enum member symbol string*/ +static struct arr_info arr_stack[STACK_SIZE]; +static int asindex = -1; /*pointer to the top of array stack*/ -hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ -hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ +static H5T_str_t str_pad; /*variable for string padding*/ +static H5T_cset_t str_cset; /*variable for string character set*/ +static hbool_t is_variable = 0; /*variable for variable-length string*/ +static size_t str_size; /*variable for string size*/ + +static hid_t enum_id; /*type ID*/ +static hbool_t is_enum = 0; /*flag to lexer for enum type*/ +static hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ +static char* enum_memb_symbol; /*enum member symbol string*/ -#line 131 "hl/src/H5LTparse.c" +/* Line 371 of yacc.c */ +#line 125 "hl/src//H5LTparse.c" -# ifndef YY_CAST -# ifdef __cplusplus -# define YY_CAST(Type, Val) static_cast (Val) -# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr # else -# define YY_CAST(Type, Val) ((Type) (Val)) -# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) -# endif -# endif -# ifndef YY_NULLPTR -# if defined __cplusplus -# if 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# else -# define YY_NULLPTR ((void*)0) +# define YY_NULL 0 # endif # endif -#include "H5LTparse.h" -/* Symbol kind. */ -enum yysymbol_kind_t -{ - YYSYMBOL_YYEMPTY = -2, - YYSYMBOL_YYEOF = 0, /* "end of file" */ - YYSYMBOL_YYerror = 1, /* error */ - YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ - YYSYMBOL_H5T_STD_I8BE_TOKEN = 3, /* H5T_STD_I8BE_TOKEN */ - YYSYMBOL_H5T_STD_I8LE_TOKEN = 4, /* H5T_STD_I8LE_TOKEN */ - YYSYMBOL_H5T_STD_I16BE_TOKEN = 5, /* H5T_STD_I16BE_TOKEN */ - YYSYMBOL_H5T_STD_I16LE_TOKEN = 6, /* H5T_STD_I16LE_TOKEN */ - YYSYMBOL_H5T_STD_I32BE_TOKEN = 7, /* H5T_STD_I32BE_TOKEN */ - YYSYMBOL_H5T_STD_I32LE_TOKEN = 8, /* H5T_STD_I32LE_TOKEN */ - YYSYMBOL_H5T_STD_I64BE_TOKEN = 9, /* H5T_STD_I64BE_TOKEN */ - YYSYMBOL_H5T_STD_I64LE_TOKEN = 10, /* H5T_STD_I64LE_TOKEN */ - YYSYMBOL_H5T_STD_U8BE_TOKEN = 11, /* H5T_STD_U8BE_TOKEN */ - YYSYMBOL_H5T_STD_U8LE_TOKEN = 12, /* H5T_STD_U8LE_TOKEN */ - YYSYMBOL_H5T_STD_U16BE_TOKEN = 13, /* H5T_STD_U16BE_TOKEN */ - YYSYMBOL_H5T_STD_U16LE_TOKEN = 14, /* H5T_STD_U16LE_TOKEN */ - YYSYMBOL_H5T_STD_U32BE_TOKEN = 15, /* H5T_STD_U32BE_TOKEN */ - YYSYMBOL_H5T_STD_U32LE_TOKEN = 16, /* H5T_STD_U32LE_TOKEN */ - YYSYMBOL_H5T_STD_U64BE_TOKEN = 17, /* H5T_STD_U64BE_TOKEN */ - YYSYMBOL_H5T_STD_U64LE_TOKEN = 18, /* H5T_STD_U64LE_TOKEN */ - YYSYMBOL_H5T_NATIVE_CHAR_TOKEN = 19, /* H5T_NATIVE_CHAR_TOKEN */ - YYSYMBOL_H5T_NATIVE_SCHAR_TOKEN = 20, /* H5T_NATIVE_SCHAR_TOKEN */ - YYSYMBOL_H5T_NATIVE_UCHAR_TOKEN = 21, /* H5T_NATIVE_UCHAR_TOKEN */ - YYSYMBOL_H5T_NATIVE_SHORT_TOKEN = 22, /* H5T_NATIVE_SHORT_TOKEN */ - YYSYMBOL_H5T_NATIVE_USHORT_TOKEN = 23, /* H5T_NATIVE_USHORT_TOKEN */ - YYSYMBOL_H5T_NATIVE_INT_TOKEN = 24, /* H5T_NATIVE_INT_TOKEN */ - YYSYMBOL_H5T_NATIVE_UINT_TOKEN = 25, /* H5T_NATIVE_UINT_TOKEN */ - YYSYMBOL_H5T_NATIVE_LONG_TOKEN = 26, /* H5T_NATIVE_LONG_TOKEN */ - YYSYMBOL_H5T_NATIVE_ULONG_TOKEN = 27, /* H5T_NATIVE_ULONG_TOKEN */ - YYSYMBOL_H5T_NATIVE_LLONG_TOKEN = 28, /* H5T_NATIVE_LLONG_TOKEN */ - YYSYMBOL_H5T_NATIVE_ULLONG_TOKEN = 29, /* H5T_NATIVE_ULLONG_TOKEN */ - YYSYMBOL_H5T_IEEE_F32BE_TOKEN = 30, /* H5T_IEEE_F32BE_TOKEN */ - YYSYMBOL_H5T_IEEE_F32LE_TOKEN = 31, /* H5T_IEEE_F32LE_TOKEN */ - YYSYMBOL_H5T_IEEE_F64BE_TOKEN = 32, /* H5T_IEEE_F64BE_TOKEN */ - YYSYMBOL_H5T_IEEE_F64LE_TOKEN = 33, /* H5T_IEEE_F64LE_TOKEN */ - YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 34, /* H5T_NATIVE_FLOAT_TOKEN */ - YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 35, /* H5T_NATIVE_DOUBLE_TOKEN */ - YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 36, /* H5T_NATIVE_LDOUBLE_TOKEN */ - YYSYMBOL_H5T_STRING_TOKEN = 37, /* H5T_STRING_TOKEN */ - YYSYMBOL_STRSIZE_TOKEN = 38, /* STRSIZE_TOKEN */ - YYSYMBOL_STRPAD_TOKEN = 39, /* STRPAD_TOKEN */ - YYSYMBOL_CSET_TOKEN = 40, /* CSET_TOKEN */ - YYSYMBOL_CTYPE_TOKEN = 41, /* CTYPE_TOKEN */ - YYSYMBOL_H5T_VARIABLE_TOKEN = 42, /* H5T_VARIABLE_TOKEN */ - YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 43, /* H5T_STR_NULLTERM_TOKEN */ - YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 44, /* H5T_STR_NULLPAD_TOKEN */ - YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 45, /* H5T_STR_SPACEPAD_TOKEN */ - YYSYMBOL_H5T_CSET_ASCII_TOKEN = 46, /* H5T_CSET_ASCII_TOKEN */ - YYSYMBOL_H5T_CSET_UTF8_TOKEN = 47, /* H5T_CSET_UTF8_TOKEN */ - YYSYMBOL_H5T_C_S1_TOKEN = 48, /* H5T_C_S1_TOKEN */ - YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 49, /* H5T_FORTRAN_S1_TOKEN */ - YYSYMBOL_H5T_OPAQUE_TOKEN = 50, /* H5T_OPAQUE_TOKEN */ - YYSYMBOL_OPQ_SIZE_TOKEN = 51, /* OPQ_SIZE_TOKEN */ - YYSYMBOL_OPQ_TAG_TOKEN = 52, /* OPQ_TAG_TOKEN */ - YYSYMBOL_H5T_COMPOUND_TOKEN = 53, /* H5T_COMPOUND_TOKEN */ - YYSYMBOL_H5T_ENUM_TOKEN = 54, /* H5T_ENUM_TOKEN */ - YYSYMBOL_H5T_ARRAY_TOKEN = 55, /* H5T_ARRAY_TOKEN */ - YYSYMBOL_H5T_VLEN_TOKEN = 56, /* H5T_VLEN_TOKEN */ - YYSYMBOL_STRING = 57, /* STRING */ - YYSYMBOL_NUMBER = 58, /* NUMBER */ - YYSYMBOL_59_ = 59, /* '{' */ - YYSYMBOL_60_ = 60, /* '}' */ - YYSYMBOL_61_ = 61, /* '[' */ - YYSYMBOL_62_ = 62, /* ']' */ - YYSYMBOL_63_ = 63, /* '"' */ - YYSYMBOL_64_ = 64, /* ':' */ - YYSYMBOL_65_ = 65, /* ';' */ - YYSYMBOL_YYACCEPT = 66, /* $accept */ - YYSYMBOL_start = 67, /* start */ - YYSYMBOL_ddl_type = 68, /* ddl_type */ - YYSYMBOL_atomic_type = 69, /* atomic_type */ - YYSYMBOL_integer_type = 70, /* integer_type */ - YYSYMBOL_fp_type = 71, /* fp_type */ - YYSYMBOL_compound_type = 72, /* compound_type */ - YYSYMBOL_73_1 = 73, /* $@1 */ - YYSYMBOL_memb_list = 74, /* memb_list */ - YYSYMBOL_memb_def = 75, /* memb_def */ - YYSYMBOL_76_2 = 76, /* $@2 */ - YYSYMBOL_field_name = 77, /* field_name */ - YYSYMBOL_field_offset = 78, /* field_offset */ - YYSYMBOL_offset = 79, /* offset */ - YYSYMBOL_array_type = 80, /* array_type */ - YYSYMBOL_81_3 = 81, /* $@3 */ - YYSYMBOL_dim_list = 82, /* dim_list */ - YYSYMBOL_dim = 83, /* dim */ - YYSYMBOL_84_4 = 84, /* $@4 */ - YYSYMBOL_85_5 = 85, /* $@5 */ - YYSYMBOL_dimsize = 86, /* dimsize */ - YYSYMBOL_vlen_type = 87, /* vlen_type */ - YYSYMBOL_opaque_type = 88, /* opaque_type */ - YYSYMBOL_89_6 = 89, /* $@6 */ - YYSYMBOL_90_7 = 90, /* @7 */ - YYSYMBOL_91_8 = 91, /* $@8 */ - YYSYMBOL_92_9 = 92, /* $@9 */ - YYSYMBOL_opaque_size = 93, /* opaque_size */ - YYSYMBOL_opaque_tag = 94, /* opaque_tag */ - YYSYMBOL_string_type = 95, /* string_type */ - YYSYMBOL_96_10 = 96, /* $@10 */ - YYSYMBOL_97_11 = 97, /* $@11 */ - YYSYMBOL_98_12 = 98, /* $@12 */ - YYSYMBOL_99_13 = 99, /* $@13 */ - YYSYMBOL_100_14 = 100, /* @14 */ - YYSYMBOL_strsize = 101, /* strsize */ - YYSYMBOL_strpad = 102, /* strpad */ - YYSYMBOL_cset = 103, /* cset */ - YYSYMBOL_ctype = 104, /* ctype */ - YYSYMBOL_enum_type = 105, /* enum_type */ - YYSYMBOL_106_15 = 106, /* $@15 */ - YYSYMBOL_enum_list = 107, /* enum_list */ - YYSYMBOL_enum_def = 108, /* enum_def */ - YYSYMBOL_109_16 = 109, /* $@16 */ - YYSYMBOL_enum_symbol = 110, /* enum_symbol */ - YYSYMBOL_enum_val = 111 /* enum_val */ -}; -typedef enum yysymbol_kind_t yysymbol_kind_t; +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "H5LTparse.h". */ +#ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED +# define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int H5LTyydebug; +#endif +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + H5T_STD_I8BE_TOKEN = 258, + H5T_STD_I8LE_TOKEN = 259, + H5T_STD_I16BE_TOKEN = 260, + H5T_STD_I16LE_TOKEN = 261, + H5T_STD_I32BE_TOKEN = 262, + H5T_STD_I32LE_TOKEN = 263, + H5T_STD_I64BE_TOKEN = 264, + H5T_STD_I64LE_TOKEN = 265, + H5T_STD_U8BE_TOKEN = 266, + H5T_STD_U8LE_TOKEN = 267, + H5T_STD_U16BE_TOKEN = 268, + H5T_STD_U16LE_TOKEN = 269, + H5T_STD_U32BE_TOKEN = 270, + H5T_STD_U32LE_TOKEN = 271, + H5T_STD_U64BE_TOKEN = 272, + H5T_STD_U64LE_TOKEN = 273, + H5T_NATIVE_CHAR_TOKEN = 274, + H5T_NATIVE_SCHAR_TOKEN = 275, + H5T_NATIVE_UCHAR_TOKEN = 276, + H5T_NATIVE_SHORT_TOKEN = 277, + H5T_NATIVE_USHORT_TOKEN = 278, + H5T_NATIVE_INT_TOKEN = 279, + H5T_NATIVE_UINT_TOKEN = 280, + H5T_NATIVE_LONG_TOKEN = 281, + H5T_NATIVE_ULONG_TOKEN = 282, + H5T_NATIVE_LLONG_TOKEN = 283, + H5T_NATIVE_ULLONG_TOKEN = 284, + H5T_IEEE_F32BE_TOKEN = 285, + H5T_IEEE_F32LE_TOKEN = 286, + H5T_IEEE_F64BE_TOKEN = 287, + H5T_IEEE_F64LE_TOKEN = 288, + H5T_NATIVE_FLOAT_TOKEN = 289, + H5T_NATIVE_DOUBLE_TOKEN = 290, + H5T_NATIVE_LDOUBLE_TOKEN = 291, + H5T_STRING_TOKEN = 292, + STRSIZE_TOKEN = 293, + STRPAD_TOKEN = 294, + CSET_TOKEN = 295, + CTYPE_TOKEN = 296, + H5T_VARIABLE_TOKEN = 297, + H5T_STR_NULLTERM_TOKEN = 298, + H5T_STR_NULLPAD_TOKEN = 299, + H5T_STR_SPACEPAD_TOKEN = 300, + H5T_CSET_ASCII_TOKEN = 301, + H5T_CSET_UTF8_TOKEN = 302, + H5T_C_S1_TOKEN = 303, + H5T_FORTRAN_S1_TOKEN = 304, + H5T_OPAQUE_TOKEN = 305, + OPQ_SIZE_TOKEN = 306, + OPQ_TAG_TOKEN = 307, + H5T_COMPOUND_TOKEN = 308, + H5T_ENUM_TOKEN = 309, + H5T_ARRAY_TOKEN = 310, + H5T_VLEN_TOKEN = 311, + STRING = 312, + NUMBER = 313 + }; +#endif +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ +/* Line 387 of yacc.c */ +#line 69 "hl/src//H5LTparse.y" -#ifdef short -# undef short -#endif + int ival; /*for integer token*/ + char *sval; /*for name string*/ + hid_t hid; /*for hid_t token*/ -/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure - and (if available) are included - so that the code can choose integer types of a good width. */ -#ifndef __PTRDIFF_MAX__ -# include /* INFRINGES ON USER NAME SPACE */ -# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_STDINT_H -# endif +/* Line 387 of yacc.c */ +#line 233 "hl/src//H5LTparse.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 #endif -/* Narrow types that promote to a signed type and that can represent a - signed or unsigned integer of at least N bits. In tables they can - save space and decrease cache pressure. Promoting to a signed type - helps avoid bugs in integer arithmetic. */ +extern YYSTYPE H5LTyylval; -#ifdef __INT_LEAST8_MAX__ -typedef __INT_LEAST8_TYPE__ yytype_int8; -#elif defined YY_STDINT_H -typedef int_least8_t yytype_int8; +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +hid_t H5LTyyparse (void *YYPARSE_PARAM); #else -typedef signed char yytype_int8; +hid_t H5LTyyparse (); #endif - -#ifdef __INT_LEAST16_MAX__ -typedef __INT_LEAST16_TYPE__ yytype_int16; -#elif defined YY_STDINT_H -typedef int_least16_t yytype_int16; +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +hid_t H5LTyyparse (void); #else -typedef short yytype_int16; +hid_t H5LTyyparse (); #endif +#endif /* ! YYPARSE_PARAM */ -#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST8_TYPE__ yytype_uint8; -#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST8_MAX <= INT_MAX) -typedef uint_least8_t yytype_uint8; -#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +#endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ + +/* Copy the second part of user declarations. */ + +/* Line 390 of yacc.c */ +#line 261 "hl/src//H5LTparse.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; #else -typedef short yytype_uint8; +typedef short int yytype_int8; #endif -#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST16_TYPE__ yytype_uint16; -#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST16_MAX <= INT_MAX) -typedef uint_least16_t yytype_uint16; -#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX -typedef unsigned short yytype_uint16; +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; #else -typedef int yytype_uint16; +typedef unsigned short int yytype_uint16; #endif -#ifndef YYPTRDIFF_T -# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ -# define YYPTRDIFF_T __PTRDIFF_TYPE__ -# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ -# elif defined PTRDIFF_MAX -# ifndef ptrdiff_t -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYPTRDIFF_T ptrdiff_t -# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX -# else -# define YYPTRDIFF_T long -# define YYPTRDIFF_MAXIMUM LONG_MAX -# endif +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; #endif #ifndef YYSIZE_T @@ -383,28 +325,16 @@ typedef int yytype_uint16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned +# define YYSIZE_T unsigned int # endif #endif -#define YYSIZE_MAXIMUM \ - YY_CAST (YYPTRDIFF_T, \ - (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ - ? YYPTRDIFF_MAXIMUM \ - : YY_CAST (YYSIZE_T, -1))) - -#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) - - -/* Stored state numbers (used for stacks). */ -typedef yytype_uint8 yy_state_t; - -/* State numbers in computations. */ -typedef int yy_state_fast_t; +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -418,23 +348,6 @@ typedef int yy_state_fast_t; # endif #endif - -#ifndef YY_ATTRIBUTE_PURE -# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) -# else -# define YY_ATTRIBUTE_PURE -# endif -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -# else -# define YY_ATTRIBUTE_UNUSED -# endif -#endif - /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -442,41 +355,25 @@ typedef int yy_state_fast_t; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(N) (N) #else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - -#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ -# define YY_IGNORE_USELESS_CAST_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") -# define YY_IGNORE_USELESS_CAST_END \ - _Pragma ("GCC diagnostic pop") +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; #endif -#ifndef YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_END +{ + return yyi; +} #endif - -#define YY_ASSERT(E) ((void) (0 && (E))) - -#if !defined yyoverflow +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -493,7 +390,8 @@ typedef int yy_state_fast_t; # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS @@ -505,8 +403,8 @@ typedef int yy_state_fast_t; # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -522,7 +420,7 @@ typedef int yy_state_fast_t; # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -530,37 +428,40 @@ typedef int yy_state_fast_t; # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* !defined yyoverflow */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - yy_state_t yyss_alloc; + yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -570,16 +471,16 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYPTRDIFF_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / YYSIZEOF (*yyptr); \ - } \ - while (0) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) #endif @@ -589,16 +490,16 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYPTRDIFF_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -606,38 +507,33 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 58 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 203 +#define YYLAST 197 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 66 +#define YYNTOKENS 65 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 46 +#define YYNNTS 43 /* YYNRULES -- Number of rules. */ -#define YYNRULES 95 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 143 +#define YYNRULES 92 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 134 -/* YYMAXUTOK -- Last valid token kind. */ +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 #define YYMAXUTOK 313 +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, with out-of-bounds checking. */ -#define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK \ - ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ - : YYSYMBOL_YYUNDEF) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex. */ -static const yytype_int8 yytranslate[] = +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 63, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 64, 65, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 63, 64, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -667,35 +563,72 @@ static const yytype_int8 yytranslate[] = }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_int16 yyrline[] = +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = { - 0, 105, 105, 106, 108, 109, 110, 111, 113, 114, - 115, 116, 117, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 149, 150, 151, 152, 153, 154, 155, 159, 158, 167, - 168, 170, 170, 207, 215, 216, 219, 221, 221, 230, - 231, 233, 234, 233, 241, 244, 250, 251, 256, 257, - 248, 265, 267, 271, 272, 280, 289, 296, 269, 320, - 321, 323, 324, 325, 327, 328, 330, 331, 335, 334, - 339, 340, 342, 342, 396, 398 + 0, 0, 3, 4, 6, 8, 10, 12, 14, 16, + 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, + 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, + 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, + 78, 80, 82, 84, 86, 88, 90, 92, 93, 99, + 100, 103, 104, 110, 112, 113, 116, 118, 119, 126, + 127, 130, 131, 132, 138, 140, 145, 146, 147, 159, + 161, 163, 164, 165, 166, 167, 187, 189, 191, 193, + 195, 197, 199, 201, 203, 205, 206, 214, 215, 218, + 219, 224, 226 }; -#endif -/** Accessing symbol of state STATE. */ -#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 66, 0, -1, -1, 67, -1, 68, -1, 71, -1, + 79, -1, 86, -1, 69, -1, 70, -1, 92, -1, + 101, -1, 87, -1, 3, -1, 4, -1, 5, -1, + 6, -1, 7, -1, 8, -1, 9, -1, 10, -1, + 11, -1, 12, -1, 13, -1, 14, -1, 15, -1, + 16, -1, 17, -1, 18, -1, 19, -1, 20, -1, + 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, + 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, + 31, -1, 32, -1, 33, -1, 34, -1, 35, -1, + 36, -1, -1, 53, 72, 59, 73, 60, -1, -1, + 73, 74, -1, -1, 67, 75, 76, 77, 64, -1, + 57, -1, -1, 63, 78, -1, 58, -1, -1, 55, + 80, 59, 81, 67, 60, -1, -1, 81, 82, -1, + -1, -1, 61, 83, 85, 84, 62, -1, 58, -1, + 56, 59, 67, 60, -1, -1, -1, 50, 59, 51, + 90, 64, 88, 52, 91, 64, 89, 60, -1, 58, + -1, 57, -1, -1, -1, -1, -1, 37, 59, 38, + 97, 64, 93, 39, 98, 64, 94, 40, 99, 64, + 95, 41, 100, 64, 96, 60, -1, 42, -1, 58, + -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, + -1, 48, -1, 49, -1, -1, 54, 59, 69, 64, + 102, 103, 60, -1, -1, 103, 104, -1, -1, 106, + 105, 107, 64, -1, 57, -1, 58, -1 +}; -#if YYDEBUG || 0 -/* The user-facing name of the symbol whose (internal) number is - YYSYMBOL. No bounds checking. */ -static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 102, 102, 103, 105, 106, 107, 108, 110, 111, + 112, 113, 114, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 146, 147, 148, 149, 150, 151, 152, 156, 155, 164, + 165, 167, 167, 204, 212, 213, 216, 218, 218, 227, + 228, 230, 231, 230, 238, 241, 248, 253, 245, 260, + 262, 267, 274, 283, 290, 264, 314, 315, 317, 318, + 319, 321, 322, 324, 325, 329, 328, 333, 334, 336, + 336, 386, 388 +}; +#endif +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "\"end of file\"", "error", "\"invalid token\"", "H5T_STD_I8BE_TOKEN", + "$end", "error", "$undefined", "H5T_STD_I8BE_TOKEN", "H5T_STD_I8LE_TOKEN", "H5T_STD_I16BE_TOKEN", "H5T_STD_I16LE_TOKEN", "H5T_STD_I32BE_TOKEN", "H5T_STD_I32LE_TOKEN", "H5T_STD_I64BE_TOKEN", "H5T_STD_I64LE_TOKEN", "H5T_STD_U8BE_TOKEN", "H5T_STD_U8LE_TOKEN", @@ -716,27 +649,21 @@ static const char *const yytname[] = "H5T_C_S1_TOKEN", "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN", "OPQ_SIZE_TOKEN", "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN", "H5T_ENUM_TOKEN", "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING", - "NUMBER", "'{'", "'}'", "'['", "']'", "'\"'", "':'", "';'", "$accept", - "start", "ddl_type", "atomic_type", "integer_type", "fp_type", - "compound_type", "$@1", "memb_list", "memb_def", "$@2", "field_name", - "field_offset", "offset", "array_type", "$@3", "dim_list", "dim", "$@4", - "$@5", "dimsize", "vlen_type", "opaque_type", "$@6", "@7", "$@8", "$@9", - "opaque_size", "opaque_tag", "string_type", "$@10", "$@11", "$@12", - "$@13", "@14", "strsize", "strpad", "cset", "ctype", "enum_type", "$@15", - "enum_list", "enum_def", "$@16", "enum_symbol", "enum_val", YY_NULLPTR + "NUMBER", "'{'", "'}'", "'['", "']'", "':'", "';'", "$accept", "start", + "ddl_type", "atomic_type", "integer_type", "fp_type", "compound_type", + "$@1", "memb_list", "memb_def", "$@2", "field_name", "field_offset", + "offset", "array_type", "$@3", "dim_list", "dim", "$@4", "$@5", + "dimsize", "vlen_type", "opaque_type", "@6", "$@7", "opaque_size", + "opaque_tag", "string_type", "$@8", "$@9", "$@10", "@11", "strsize", + "strpad", "cset", "ctype", "enum_type", "$@12", "enum_list", "enum_def", + "$@13", "enum_symbol", "enum_val", YY_NULL }; - -static const char * -yysymbol_name (yysymbol_kind_t yysymbol) -{ - return yytname[yysymbol]; -} #endif -#ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_int16 yytoknum[] = +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -744,221 +671,241 @@ static const yytype_int16 yytoknum[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 123, - 125, 91, 93, 34, 58, 59 + 125, 91, 93, 58, 59 }; -#endif - -#define YYPACT_NINF (-25) - -#define yypact_value_is_default(Yyn) \ - ((Yyn) == YYPACT_NINF) - -#define YYTABLE_NINF (-1) +# endif -#define yytable_value_is_error(Yyn) \ - 0 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 65, 66, 66, 67, 67, 67, 67, 68, 68, + 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 70, 70, 70, 70, 70, 70, 70, 72, 71, 73, + 73, 75, 74, 76, 77, 77, 78, 80, 79, 81, + 81, 83, 84, 82, 85, 86, 88, 89, 87, 90, + 91, 93, 94, 95, 96, 92, 97, 97, 98, 98, + 98, 99, 99, 100, 100, 102, 101, 103, 103, 105, + 104, 106, 107 +}; - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = { - 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -24, -20, -25, -15, -25, - -14, 49, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, 19, 45, 38, 168, 39, 114, -25, -25, - -25, -25, 34, -25, 40, -4, 43, 56, -25, -3, - -25, -25, -25, 37, -25, 42, -25, -25, -25, -25, - -25, 44, -25, -25, -25, 50, -23, 47, -25, 64, - 62, 51, -25, 58, -25, -25, -25, -2, -25, -25, - 89, -25, 90, 92, -25, -25, -25, 91, 94, 95, - -25, -25, -25, 98, 100, 96, 102, 122, -25, 103, - -25, -25, -25, -25, 133, 9, 134, -25, -25, -25, - 135, -25, -25, 105, 160, -25, 46, -25, -25, 137, - -25, 143, -25 + 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, + 2, 0, 5, 1, 0, 2, 1, 0, 6, 0, + 2, 0, 0, 5, 1, 4, 0, 0, 11, 1, + 1, 0, 0, 0, 0, 19, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 7, 0, 2, 0, + 4, 1, 1 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_int8 yydefact[] = +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = { 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, - 10, 11, 0, 0, 0, 0, 0, 0, 1, 73, - 66, 49, 0, 59, 0, 0, 0, 0, 88, 0, - 65, 79, 80, 0, 71, 0, 48, 51, 50, 90, - 61, 0, 60, 74, 67, 0, 0, 0, 58, 0, - 0, 0, 89, 0, 91, 64, 62, 0, 68, 53, - 0, 94, 0, 0, 81, 82, 83, 0, 0, 54, - 92, 63, 75, 0, 0, 0, 0, 0, 72, 0, - 56, 55, 52, 95, 0, 0, 0, 93, 84, 85, - 0, 69, 76, 0, 0, 70, 0, 86, 87, 0, - 77, 0, 78 + 10, 11, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 49, 0, 59, 0, 76, 77, 0, 69, 0, + 0, 85, 0, 65, 71, 66, 48, 51, 50, 87, + 61, 0, 60, 0, 0, 0, 0, 0, 58, 0, + 0, 53, 54, 91, 86, 88, 89, 64, 62, 78, + 79, 80, 0, 70, 0, 0, 0, 0, 0, 72, + 67, 56, 55, 52, 92, 0, 63, 0, 0, 90, + 0, 68, 81, 82, 0, 73, 0, 0, 83, 84, + 0, 74, 0, 75 }; - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = { - -25, -25, -21, -25, 108, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -1, 41, 42, 43, 44, 45, 46, 54, 70, 78, + 85, 92, 106, 112, 47, 56, 72, 82, 87, 108, + 98, 48, 49, 84, 118, 69, 104, 50, 83, 117, + 126, 132, 67, 102, 124, 130, 51, 79, 86, 95, + 107, 96, 115 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -25 +static const yytype_int16 yypact[] = +{ + 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25 + -25, -25, -25, -25, -25, -24, -22, -25, -13, -25, + -11, 49, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, 18, 45, 38, 168, 39, 114, -25, -4, + 41, -25, 36, -25, 42, -25, -25, 37, -25, 40, + 56, -25, -3, -25, -25, -25, -25, -25, -25, -25, + -25, 43, -25, 66, 55, 51, -21, 57, -25, 0, + 95, -25, 50, -25, -25, -25, -25, -25, -25, -25, + -25, -25, 89, -25, 90, 97, 92, 99, 52, -25, + -25, -25, -25, -25, -25, 94, -25, 119, 100, -25, + -6, -25, -25, -25, 98, -25, 120, 46, -25, -25, + 101, -25, 103, -25 }; - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = { - -1, 41, 42, 43, 44, 45, 46, 54, 67, 78, - 85, 100, 115, 121, 47, 56, 69, 82, 87, 103, - 96, 48, 49, 66, 90, 108, 133, 75, 119, 50, - 65, 89, 117, 134, 141, 73, 107, 130, 139, 51, - 79, 86, 94, 116, 102, 124 + -25, -25, -15, -25, 111, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 52, 64, 92, 71, 53, - 93, 104, 105, 106, 55, 57, 77, 36, 81, 58, - 37, 38, 39, 40, 72, 128, 129, 59, 80, 1, + 31, 32, 33, 34, 35, 52, 93, 53, 65, 94, + 122, 123, 64, 99, 100, 101, 55, 36, 57, 58, + 37, 38, 39, 40, 66, 77, 59, 81, 80, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 137, 138, 60, 61, 63, 68, - 70, 74, 83, 97, 88, 95, 36, 84, 99, 37, - 38, 39, 40, 91, 98, 101, 76, 1, 2, 3, + 32, 33, 34, 35, 128, 129, 60, 61, 63, 68, + 71, 74, 73, 88, 75, 89, 36, 90, 91, 37, + 38, 39, 40, 105, 116, 97, 76, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 109, 110, 111, 118, 112, 113, 120, 114, - 123, 122, 125, 62, 36, 135, 126, 37, 38, 39, + 34, 35, 103, 109, 110, 111, 113, 114, 119, 120, + 121, 127, 125, 133, 36, 131, 62, 37, 38, 39, 40, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 127, 131, - 132, 136, 140, 142 + 20, 21, 22, 23, 24, 25, 26, 27 }; -static const yytype_int8 yycheck[] = +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-25))) + +#define yytable_value_is_error(Yytable_value) \ + YYID (0) + +static const yytype_uint8 yycheck[] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 59, 57, 60, 42, 59, - 63, 43, 44, 45, 59, 59, 67, 50, 69, 0, - 53, 54, 55, 56, 58, 46, 47, 38, 61, 3, + 33, 34, 35, 36, 37, 59, 57, 59, 42, 60, + 46, 47, 57, 43, 44, 45, 59, 50, 59, 0, + 53, 54, 55, 56, 58, 70, 38, 72, 61, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 48, 49, 51, 59, 59, 65, - 60, 58, 65, 39, 60, 58, 50, 65, 57, 53, - 54, 55, 56, 63, 52, 57, 60, 3, 4, 5, + 34, 35, 36, 37, 48, 49, 51, 59, 59, 58, + 64, 64, 60, 60, 64, 39, 50, 52, 57, 53, + 54, 55, 56, 63, 62, 58, 60, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 63, 63, 62, 57, 65, 63, 58, 64, - 58, 65, 40, 55, 50, 60, 63, 53, 54, 55, + 36, 37, 57, 64, 64, 58, 64, 58, 64, 40, + 60, 41, 64, 60, 50, 64, 55, 53, 54, 55, 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 65, 65, - 65, 41, 65, 60 + 22, 23, 24, 25, 26, 27, 28, 29 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_int8 yystos[] = +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 50, 53, 54, 55, - 56, 67, 68, 69, 70, 71, 72, 80, 87, 88, - 95, 105, 59, 59, 73, 59, 81, 59, 0, 38, - 51, 59, 70, 59, 68, 96, 89, 74, 65, 82, - 60, 42, 58, 101, 58, 93, 60, 68, 75, 106, - 61, 68, 83, 65, 65, 76, 107, 84, 60, 97, - 90, 63, 60, 63, 108, 58, 86, 39, 52, 57, - 77, 57, 110, 85, 43, 44, 45, 102, 91, 63, - 63, 62, 65, 63, 64, 78, 109, 98, 57, 94, - 58, 79, 65, 58, 111, 40, 63, 65, 46, 47, - 103, 65, 65, 92, 99, 60, 41, 48, 49, 104, - 65, 100, 60 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_int8 yyr1[] = -{ - 0, 66, 67, 67, 68, 68, 68, 68, 69, 69, - 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 71, 71, 71, 71, 71, 71, 71, 73, 72, 74, - 74, 76, 75, 77, 78, 78, 79, 81, 80, 82, - 82, 84, 85, 83, 86, 87, 89, 90, 91, 92, - 88, 93, 94, 96, 97, 98, 99, 100, 95, 101, - 101, 102, 102, 102, 103, 103, 104, 104, 106, 105, - 107, 107, 109, 108, 110, 111 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_int8 yyr2[] = -{ - 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, - 2, 0, 7, 1, 0, 2, 1, 0, 6, 0, - 2, 0, 0, 5, 1, 4, 0, 0, 0, 0, - 15, 1, 1, 0, 0, 0, 0, 0, 20, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 7, - 0, 2, 0, 6, 1, 1 + 56, 66, 67, 68, 69, 70, 71, 79, 86, 87, + 92, 101, 59, 59, 72, 59, 80, 59, 0, 38, + 51, 59, 69, 59, 67, 42, 58, 97, 58, 90, + 73, 64, 81, 60, 64, 64, 60, 67, 74, 102, + 61, 67, 82, 93, 88, 75, 103, 83, 60, 39, + 52, 57, 76, 57, 60, 104, 106, 58, 85, 43, + 44, 45, 98, 57, 91, 63, 77, 105, 84, 64, + 64, 58, 78, 64, 58, 107, 62, 94, 89, 64, + 40, 60, 46, 47, 99, 64, 95, 41, 48, 49, + 100, 64, 96, 60 }; +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ + +#define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif -enum { YYENOMEM = -2 }; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) +#define YYRECOVERING() (!!yyerrstatus) -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 -#define YYRECOVERING() (!!yyerrstatus) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (0) - -/* Backward compatibility with an undocumented macro. - Use YYerror or YYUNDEF. */ -#define YYERRCODE YYUNDEF +/* YYLEX -- calling `yylex' with the right arguments. */ +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -968,65 +915,82 @@ enum { YYENOMEM = -2 }; # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -# ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif - - -# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Kind, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*-----------------------------------. -| Print this symbol's value on YYO. | -`-----------------------------------*/ - +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_value_print (FILE *yyo, - yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif { - FILE *yyoutput = yyo; - YYUSE (yyoutput); + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT - if (yykind < YYNTOKENS) - YYPRINT (yyo, yytoknum[yykind], *yyvaluep); + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); # endif - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yykind); - YY_IGNORE_MAYBE_UNINITIALIZED_END + switch (yytype) + { + default: + break; + } } -/*---------------------------. -| Print this symbol on YYO. | -`---------------------------*/ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_print (FILE *yyo, - yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif { - YYFPRINTF (yyo, "%s %s (", - yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - yy_symbol_value_print (yyo, yykind, yyvaluep); - YYFPRINTF (yyo, ")"); + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. @@ -1034,8 +998,16 @@ yy_symbol_print (FILE *yyo, | TOP (included). | `------------------------------------------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else static void -yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1046,56 +1018,63 @@ yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, - int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif { - int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", - yyrule - 1, yylno); + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), - &yyvsp[(yyi + 1) - (yynrhs)]); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) ((void) 0) -# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1111,77 +1090,363 @@ int yydebug; #endif +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULL; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else static void -yydestruct (const char *yymsg, - yysymbol_kind_t yykind, YYSTYPE *yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif { YYUSE (yyvaluep); + if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yykind); - YY_IGNORE_MAYBE_UNINITIALIZED_END + switch (yytype) + { + + default: + break; + } } -/* Lookahead token kind. */ + + +/* The lookahead symbol. */ int yychar; + +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); + /* Number of syntax errors so far. */ int yynerrs; - - /*----------. | yyparse. | `----------*/ +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +hid_t +yyparse (void *YYPARSE_PARAM) +#else +hid_t +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) hid_t yyparse (void) +#else +hid_t +yyparse () + +#endif +#endif { - yy_state_fast_t yystate = 0; + int yystate; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus = 0; + int yyerrstatus; - /* Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. - /* Their size. */ - YYPTRDIFF_T yystacksize = YYINITDEPTH; + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The state stack: array, bottom, top. */ - yy_state_t yyssa[YYINITDEPTH]; - yy_state_t *yyss = yyssa; - yy_state_t *yyssp = yyss; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The semantic value stack: array, bottom, top. */ + /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp = yyvs; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; int yyn; - /* The return value of yyparse. */ int yyresult; - /* Lookahead symbol kind. */ - yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; - +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1189,105 +1454,102 @@ yyparse (void) Keep to zero when no symbol should be popped. */ int yylen = 0; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; - /*------------------------------------------------------------. -| yynewstate -- push a new state, which is found in yystate. | +| yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ -yynewstate: + yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - -/*--------------------------------------------------------------------. -| yysetstate -- set current state (the top of the stack) to yystate. | -`--------------------------------------------------------------------*/ -yysetstate: - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - YY_IGNORE_USELESS_CAST_BEGIN - *yyssp = YY_CAST (yy_state_t, yystate); - YY_IGNORE_USELESS_CAST_END - YY_STACK_PRINT (yyss, yyssp); + yysetstate: + *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) -#if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; -#else { /* Get the current used size of the three stacks, in elements. */ - YYPTRDIFF_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; -# if defined yyoverflow +#ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - yy_state_t *yyss1 = yyss; - YYSTYPE *yyvs1 = yyvs; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * YYSIZEOF (*yyssp), - &yyvs1, yysize * YYSIZEOF (*yyvsp), - &yystacksize); - yyss = yyss1; - yyvs = yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } -# else /* defined YYSTACK_RELOCATE */ +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yy_state_t *yyss1 = yyss; - union yyalloc *yyptr = - YY_CAST (union yyalloc *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif +#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YY_IGNORE_USELESS_CAST_BEGIN - YYDPRINTF ((stderr, "Stack size increased to %ld\n", - YY_CAST (long, yystacksize))); - YY_IGNORE_USELESS_CAST_END + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } -#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; - /*-----------. | yybackup. | `-----------*/ yybackup: + /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1298,29 +1560,18 @@ yybackup: /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token\n")); - yychar = yylex (); + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; } if (yychar <= YYEOF) { - yychar = YYEOF; - yytoken = YYSYMBOL_YYEOF; + yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } - else if (yychar == YYerror) - { - /* The scanner already issued an error message, process directly - to error recovery. But do not keep the error token as - lookahead, it is too special and may lead us to an endless - loop in error recovery. */ - yychar = YYUNDEF; - yytoken = YYSYMBOL_YYerror; - goto yyerrlab1; - } else { yytoken = YYTRANSLATE (yychar); @@ -1348,13 +1599,15 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - /* Discard the shifted token. */ - yychar = YYEMPTY; goto yynewstate; @@ -1369,14 +1622,14 @@ yydefault: /*-----------------------------. -| yyreduce -- do a reduction. | +| yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. + `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1389,440 +1642,420 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: /* start: %empty */ -#line 105 "hl/src/H5LTparse.y" - { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } -#line 1366 "hl/src/H5LTparse.c" + case 2: +/* Line 1792 of yacc.c */ +#line 102 "hl/src//H5LTparse.y" + { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } break; - case 3: /* start: ddl_type */ -#line 106 "hl/src/H5LTparse.y" - { return (yyval.hid);} -#line 1372 "hl/src/H5LTparse.c" + case 3: +/* Line 1792 of yacc.c */ +#line 103 "hl/src//H5LTparse.y" + { return (yyval.hid);} break; - case 13: /* integer_type: H5T_STD_I8BE_TOKEN */ -#line 120 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } -#line 1378 "hl/src/H5LTparse.c" + case 13: +/* Line 1792 of yacc.c */ +#line 117 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } break; - case 14: /* integer_type: H5T_STD_I8LE_TOKEN */ -#line 121 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } -#line 1384 "hl/src/H5LTparse.c" + case 14: +/* Line 1792 of yacc.c */ +#line 118 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } break; - case 15: /* integer_type: H5T_STD_I16BE_TOKEN */ -#line 122 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } -#line 1390 "hl/src/H5LTparse.c" + case 15: +/* Line 1792 of yacc.c */ +#line 119 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } break; - case 16: /* integer_type: H5T_STD_I16LE_TOKEN */ -#line 123 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } -#line 1396 "hl/src/H5LTparse.c" + case 16: +/* Line 1792 of yacc.c */ +#line 120 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } break; - case 17: /* integer_type: H5T_STD_I32BE_TOKEN */ -#line 124 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } -#line 1402 "hl/src/H5LTparse.c" + case 17: +/* Line 1792 of yacc.c */ +#line 121 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } break; - case 18: /* integer_type: H5T_STD_I32LE_TOKEN */ -#line 125 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } -#line 1408 "hl/src/H5LTparse.c" + case 18: +/* Line 1792 of yacc.c */ +#line 122 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } break; - case 19: /* integer_type: H5T_STD_I64BE_TOKEN */ -#line 126 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } -#line 1414 "hl/src/H5LTparse.c" + case 19: +/* Line 1792 of yacc.c */ +#line 123 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } break; - case 20: /* integer_type: H5T_STD_I64LE_TOKEN */ -#line 127 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } -#line 1420 "hl/src/H5LTparse.c" + case 20: +/* Line 1792 of yacc.c */ +#line 124 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } break; - case 21: /* integer_type: H5T_STD_U8BE_TOKEN */ -#line 128 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } -#line 1426 "hl/src/H5LTparse.c" + case 21: +/* Line 1792 of yacc.c */ +#line 125 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } break; - case 22: /* integer_type: H5T_STD_U8LE_TOKEN */ -#line 129 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } -#line 1432 "hl/src/H5LTparse.c" + case 22: +/* Line 1792 of yacc.c */ +#line 126 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } break; - case 23: /* integer_type: H5T_STD_U16BE_TOKEN */ -#line 130 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } -#line 1438 "hl/src/H5LTparse.c" + case 23: +/* Line 1792 of yacc.c */ +#line 127 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } break; - case 24: /* integer_type: H5T_STD_U16LE_TOKEN */ -#line 131 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } -#line 1444 "hl/src/H5LTparse.c" + case 24: +/* Line 1792 of yacc.c */ +#line 128 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } break; - case 25: /* integer_type: H5T_STD_U32BE_TOKEN */ -#line 132 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } -#line 1450 "hl/src/H5LTparse.c" + case 25: +/* Line 1792 of yacc.c */ +#line 129 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } break; - case 26: /* integer_type: H5T_STD_U32LE_TOKEN */ -#line 133 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } -#line 1456 "hl/src/H5LTparse.c" + case 26: +/* Line 1792 of yacc.c */ +#line 130 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } break; - case 27: /* integer_type: H5T_STD_U64BE_TOKEN */ -#line 134 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } -#line 1462 "hl/src/H5LTparse.c" + case 27: +/* Line 1792 of yacc.c */ +#line 131 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } break; - case 28: /* integer_type: H5T_STD_U64LE_TOKEN */ -#line 135 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } -#line 1468 "hl/src/H5LTparse.c" + case 28: +/* Line 1792 of yacc.c */ +#line 132 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } break; - case 29: /* integer_type: H5T_NATIVE_CHAR_TOKEN */ -#line 136 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } -#line 1474 "hl/src/H5LTparse.c" + case 29: +/* Line 1792 of yacc.c */ +#line 133 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } break; - case 30: /* integer_type: H5T_NATIVE_SCHAR_TOKEN */ -#line 137 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } -#line 1480 "hl/src/H5LTparse.c" + case 30: +/* Line 1792 of yacc.c */ +#line 134 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } break; - case 31: /* integer_type: H5T_NATIVE_UCHAR_TOKEN */ -#line 138 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } -#line 1486 "hl/src/H5LTparse.c" + case 31: +/* Line 1792 of yacc.c */ +#line 135 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } break; - case 32: /* integer_type: H5T_NATIVE_SHORT_TOKEN */ -#line 139 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } -#line 1492 "hl/src/H5LTparse.c" + case 32: +/* Line 1792 of yacc.c */ +#line 136 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } break; - case 33: /* integer_type: H5T_NATIVE_USHORT_TOKEN */ -#line 140 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } -#line 1498 "hl/src/H5LTparse.c" + case 33: +/* Line 1792 of yacc.c */ +#line 137 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } break; - case 34: /* integer_type: H5T_NATIVE_INT_TOKEN */ -#line 141 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } -#line 1504 "hl/src/H5LTparse.c" + case 34: +/* Line 1792 of yacc.c */ +#line 138 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } break; - case 35: /* integer_type: H5T_NATIVE_UINT_TOKEN */ -#line 142 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } -#line 1510 "hl/src/H5LTparse.c" + case 35: +/* Line 1792 of yacc.c */ +#line 139 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } break; - case 36: /* integer_type: H5T_NATIVE_LONG_TOKEN */ -#line 143 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } -#line 1516 "hl/src/H5LTparse.c" + case 36: +/* Line 1792 of yacc.c */ +#line 140 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } break; - case 37: /* integer_type: H5T_NATIVE_ULONG_TOKEN */ -#line 144 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } -#line 1522 "hl/src/H5LTparse.c" + case 37: +/* Line 1792 of yacc.c */ +#line 141 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } break; - case 38: /* integer_type: H5T_NATIVE_LLONG_TOKEN */ -#line 145 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } -#line 1528 "hl/src/H5LTparse.c" + case 38: +/* Line 1792 of yacc.c */ +#line 142 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } break; - case 39: /* integer_type: H5T_NATIVE_ULLONG_TOKEN */ -#line 146 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } -#line 1534 "hl/src/H5LTparse.c" + case 39: +/* Line 1792 of yacc.c */ +#line 143 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } break; - case 40: /* fp_type: H5T_IEEE_F32BE_TOKEN */ -#line 149 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } -#line 1540 "hl/src/H5LTparse.c" + case 40: +/* Line 1792 of yacc.c */ +#line 146 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } break; - case 41: /* fp_type: H5T_IEEE_F32LE_TOKEN */ -#line 150 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } -#line 1546 "hl/src/H5LTparse.c" + case 41: +/* Line 1792 of yacc.c */ +#line 147 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } break; - case 42: /* fp_type: H5T_IEEE_F64BE_TOKEN */ -#line 151 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } -#line 1552 "hl/src/H5LTparse.c" + case 42: +/* Line 1792 of yacc.c */ +#line 148 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } break; - case 43: /* fp_type: H5T_IEEE_F64LE_TOKEN */ -#line 152 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } -#line 1558 "hl/src/H5LTparse.c" + case 43: +/* Line 1792 of yacc.c */ +#line 149 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } break; - case 44: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */ -#line 153 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } -#line 1564 "hl/src/H5LTparse.c" + case 44: +/* Line 1792 of yacc.c */ +#line 150 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } break; - case 45: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */ -#line 154 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } -#line 1570 "hl/src/H5LTparse.c" + case 45: +/* Line 1792 of yacc.c */ +#line 151 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } break; - case 46: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */ -#line 155 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } -#line 1576 "hl/src/H5LTparse.c" + case 46: +/* Line 1792 of yacc.c */ +#line 152 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } break; - case 47: /* $@1: %empty */ -#line 159 "hl/src/H5LTparse.y" - { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } -#line 1582 "hl/src/H5LTparse.c" + case 47: +/* Line 1792 of yacc.c */ +#line 156 "hl/src//H5LTparse.y" + { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } break; - case 48: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */ -#line 161 "hl/src/H5LTparse.y" - { (yyval.hid) = cmpd_stack[csindex].id; + case 48: +/* Line 1792 of yacc.c */ +#line 158 "hl/src//H5LTparse.y" + { (yyval.hid) = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; cmpd_stack[csindex].first_memb = 1; csindex--; } -#line 1592 "hl/src/H5LTparse.c" break; - case 51: /* $@2: %empty */ -#line 170 "hl/src/H5LTparse.y" - { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } -#line 1598 "hl/src/H5LTparse.c" + case 51: +/* Line 1792 of yacc.c */ +#line 167 "hl/src//H5LTparse.y" + { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } break; - case 52: /* memb_def: ddl_type $@2 '"' field_name '"' field_offset ';' */ -#line 172 "hl/src/H5LTparse.y" - { + case 52: +/* Line 1792 of yacc.c */ +#line 169 "hl/src//H5LTparse.y" + { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; /*Adjust size and insert member, consider both member size and offset.*/ if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ - new_size = H5Tget_size((yyvsp[-6].hid)) + (yyvsp[-1].ival); + new_size = H5Tget_size((yyvsp[(1) - (5)].hid)) + (yyvsp[(4) - (5)].ival); H5Tset_size(dtype_id, new_size); /*member name is saved in yylval.sval by lexer*/ - H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid)); + H5Tinsert(dtype_id, (yyvsp[(3) - (5)].sval), (yyvsp[(4) - (5)].ival), (yyvsp[(1) - (5)].hid)); cmpd_stack[csindex].first_memb = 0; } else { origin_size = H5Tget_size(dtype_id); - if((yyvsp[-1].ival) == 0) { - new_size = origin_size + H5Tget_size((yyvsp[-6].hid)); + if((yyvsp[(4) - (5)].ival) == 0) { + new_size = origin_size + H5Tget_size((yyvsp[(1) - (5)].hid)); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, (yyvsp[-3].sval), origin_size, (yyvsp[-6].hid)); + H5Tinsert(dtype_id, (yyvsp[(3) - (5)].sval), origin_size, (yyvsp[(1) - (5)].hid)); } else { - new_size = (yyvsp[-1].ival) + H5Tget_size((yyvsp[-6].hid)); + new_size = (yyvsp[(4) - (5)].ival) + H5Tget_size((yyvsp[(1) - (5)].hid)); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid)); + H5Tinsert(dtype_id, (yyvsp[(3) - (5)].sval), (yyvsp[(4) - (5)].ival), (yyvsp[(1) - (5)].hid)); } } - if((yyvsp[-3].sval)) { - free((yyvsp[-3].sval)); - (yyvsp[-3].sval) = NULL; + if((yyvsp[(3) - (5)].sval)) { + HDfree((yyvsp[(3) - (5)].sval)); + (yyvsp[(3) - (5)].sval) = NULL; } cmpd_stack[csindex].is_field = 0; - H5Tclose((yyvsp[-6].hid)); + H5Tclose((yyvsp[(1) - (5)].hid)); new_size = H5Tget_size(dtype_id); } -#line 1637 "hl/src/H5LTparse.c" break; - case 53: /* field_name: STRING */ -#line 208 "hl/src/H5LTparse.y" - { - (yyval.sval) = strdup(yylval.sval); - free(yylval.sval); + case 53: +/* Line 1792 of yacc.c */ +#line 205 "hl/src//H5LTparse.y" + { + (yyval.sval) = HDstrdup(yylval.sval); + HDfree(yylval.sval); yylval.sval = NULL; } -#line 1647 "hl/src/H5LTparse.c" break; - case 54: /* field_offset: %empty */ -#line 215 "hl/src/H5LTparse.y" - { (yyval.ival) = 0; } -#line 1653 "hl/src/H5LTparse.c" + case 54: +/* Line 1792 of yacc.c */ +#line 212 "hl/src//H5LTparse.y" + { (yyval.ival) = 0; } break; - case 55: /* field_offset: ':' offset */ -#line 217 "hl/src/H5LTparse.y" - { (yyval.ival) = yylval.ival; } -#line 1659 "hl/src/H5LTparse.c" + case 55: +/* Line 1792 of yacc.c */ +#line 214 "hl/src//H5LTparse.y" + { (yyval.ival) = yylval.ival; } break; - case 57: /* $@3: %empty */ -#line 221 "hl/src/H5LTparse.y" - { asindex++; /*pushd onto the stack*/ } -#line 1665 "hl/src/H5LTparse.c" + case 57: +/* Line 1792 of yacc.c */ +#line 218 "hl/src//H5LTparse.y" + { asindex++; /*pushd onto the stack*/ } break; - case 58: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */ -#line 223 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); + case 58: +/* Line 1792 of yacc.c */ +#line 220 "hl/src//H5LTparse.y" + { + (yyval.hid) = H5Tarray_create2((yyvsp[(5) - (6)].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; - H5Tclose((yyvsp[-1].hid)); + H5Tclose((yyvsp[(5) - (6)].hid)); } -#line 1676 "hl/src/H5LTparse.c" break; - case 61: /* $@4: %empty */ -#line 233 "hl/src/H5LTparse.y" - { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } -#line 1682 "hl/src/H5LTparse.c" + case 61: +/* Line 1792 of yacc.c */ +#line 230 "hl/src//H5LTparse.y" + { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } break; - case 62: /* $@5: %empty */ -#line 234 "hl/src/H5LTparse.y" - { unsigned ndims = arr_stack[asindex].ndims; + case 62: +/* Line 1792 of yacc.c */ +#line 231 "hl/src//H5LTparse.y" + { unsigned ndims = arr_stack[asindex].ndims; arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; arr_stack[asindex].is_dim = 0; } -#line 1692 "hl/src/H5LTparse.c" - break; - - case 65: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */ -#line 245 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1698 "hl/src/H5LTparse.c" break; - case 66: /* $@6: %empty */ -#line 250 "hl/src/H5LTparse.y" - { is_opq_size = 1; } -#line 1704 "hl/src/H5LTparse.c" + case 65: +/* Line 1792 of yacc.c */ +#line 242 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tvlen_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); } break; - case 67: /* @7: %empty */ -#line 251 "hl/src/H5LTparse.y" - { + case 66: +/* Line 1792 of yacc.c */ +#line 248 "hl/src//H5LTparse.y" + { size_t size = (size_t)yylval.ival; (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); - is_opq_size = 0; } -#line 1714 "hl/src/H5LTparse.c" - break; - - case 68: /* $@8: %empty */ -#line 256 "hl/src/H5LTparse.y" - { is_opq_tag = 1; } -#line 1720 "hl/src/H5LTparse.c" break; - case 69: /* $@9: %empty */ -#line 257 "hl/src/H5LTparse.y" - { - H5Tset_tag((yyvsp[-6].hid), yylval.sval); - free(yylval.sval); + case 67: +/* Line 1792 of yacc.c */ +#line 253 "hl/src//H5LTparse.y" + { + H5Tset_tag((yyvsp[(6) - (9)].hid), yylval.sval); + HDfree(yylval.sval); yylval.sval = NULL; - is_opq_tag = 0; } -#line 1731 "hl/src/H5LTparse.c" break; - case 70: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN $@6 opaque_size ';' @7 OPQ_TAG_TOKEN $@8 '"' opaque_tag '"' ';' $@9 '}' */ -#line 263 "hl/src/H5LTparse.y" - { (yyval.hid) = (yyvsp[-8].hid); } -#line 1737 "hl/src/H5LTparse.c" + case 68: +/* Line 1792 of yacc.c */ +#line 258 "hl/src//H5LTparse.y" + { (yyval.hid) = (yyvsp[(6) - (11)].hid); } break; - case 73: /* $@10: %empty */ -#line 271 "hl/src/H5LTparse.y" - { is_str_size = 1; } -#line 1743 "hl/src/H5LTparse.c" - break; - - case 74: /* $@11: %empty */ -#line 272 "hl/src/H5LTparse.y" - { - if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) + case 71: +/* Line 1792 of yacc.c */ +#line 267 "hl/src//H5LTparse.y" + { + if((yyvsp[(4) - (5)].ival) == H5T_VARIABLE_TOKEN) is_variable = 1; else str_size = yylval.ival; - is_str_size = 0; } -#line 1755 "hl/src/H5LTparse.c" break; - case 75: /* $@12: %empty */ -#line 280 "hl/src/H5LTparse.y" - { - if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) + case 72: +/* Line 1792 of yacc.c */ +#line 274 "hl/src//H5LTparse.y" + { + if((yyvsp[(8) - (9)].ival) == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; - else if((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN) + else if((yyvsp[(8) - (9)].ival) == H5T_STR_NULLPAD_TOKEN) str_pad = H5T_STR_NULLPAD; - else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) + else if((yyvsp[(8) - (9)].ival) == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } -#line 1768 "hl/src/H5LTparse.c" break; - case 76: /* $@13: %empty */ -#line 289 "hl/src/H5LTparse.y" - { - if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) + case 73: +/* Line 1792 of yacc.c */ +#line 283 "hl/src//H5LTparse.y" + { + if((yyvsp[(12) - (13)].ival) == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; - else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) + else if((yyvsp[(12) - (13)].ival) == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } -#line 1779 "hl/src/H5LTparse.c" break; - case 77: /* @14: %empty */ -#line 296 "hl/src/H5LTparse.y" - { - if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) + case 74: +/* Line 1792 of yacc.c */ +#line 290 "hl/src//H5LTparse.y" + { + if((yyvsp[(16) - (17)].hid) == H5T_C_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_C_S1); - else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) + else if((yyvsp[(16) - (17)].hid) == H5T_FORTRAN_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); } -#line 1790 "hl/src/H5LTparse.c" break; - case 78: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN $@10 strsize ';' $@11 STRPAD_TOKEN strpad ';' $@12 CSET_TOKEN cset ';' $@13 CTYPE_TOKEN ctype ';' @14 '}' */ -#line 303 "hl/src/H5LTparse.y" - { - hid_t str_id = (yyvsp[-1].hid); + case 75: +/* Line 1792 of yacc.c */ +#line 297 "hl/src//H5LTparse.y" + { + hid_t str_id = (yyvsp[(18) - (19)].hid); /*set string size*/ if(is_variable) { @@ -1837,87 +2070,83 @@ yyreduce: (yyval.hid) = str_id; } -#line 1811 "hl/src/H5LTparse.c" break; - case 79: /* strsize: H5T_VARIABLE_TOKEN */ -#line 320 "hl/src/H5LTparse.y" - {(yyval.ival) = H5T_VARIABLE_TOKEN;} -#line 1817 "hl/src/H5LTparse.c" + case 76: +/* Line 1792 of yacc.c */ +#line 314 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_VARIABLE_TOKEN;} break; - case 81: /* strpad: H5T_STR_NULLTERM_TOKEN */ -#line 323 "hl/src/H5LTparse.y" - {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} -#line 1823 "hl/src/H5LTparse.c" + case 78: +/* Line 1792 of yacc.c */ +#line 317 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} break; - case 82: /* strpad: H5T_STR_NULLPAD_TOKEN */ -#line 324 "hl/src/H5LTparse.y" - {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} -#line 1829 "hl/src/H5LTparse.c" + case 79: +/* Line 1792 of yacc.c */ +#line 318 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} break; - case 83: /* strpad: H5T_STR_SPACEPAD_TOKEN */ -#line 325 "hl/src/H5LTparse.y" - {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} -#line 1835 "hl/src/H5LTparse.c" + case 80: +/* Line 1792 of yacc.c */ +#line 319 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} break; - case 84: /* cset: H5T_CSET_ASCII_TOKEN */ -#line 327 "hl/src/H5LTparse.y" - {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} -#line 1841 "hl/src/H5LTparse.c" + case 81: +/* Line 1792 of yacc.c */ +#line 321 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} break; - case 85: /* cset: H5T_CSET_UTF8_TOKEN */ -#line 328 "hl/src/H5LTparse.y" - {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} -#line 1847 "hl/src/H5LTparse.c" + case 82: +/* Line 1792 of yacc.c */ +#line 322 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} break; - case 86: /* ctype: H5T_C_S1_TOKEN */ -#line 330 "hl/src/H5LTparse.y" - {(yyval.hid) = H5T_C_S1_TOKEN;} -#line 1853 "hl/src/H5LTparse.c" + case 83: +/* Line 1792 of yacc.c */ +#line 324 "hl/src//H5LTparse.y" + {(yyval.hid) = H5T_C_S1_TOKEN;} break; - case 87: /* ctype: H5T_FORTRAN_S1_TOKEN */ -#line 331 "hl/src/H5LTparse.y" - {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} -#line 1859 "hl/src/H5LTparse.c" + case 84: +/* Line 1792 of yacc.c */ +#line 325 "hl/src//H5LTparse.y" + {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} break; - case 88: /* $@15: %empty */ -#line 335 "hl/src/H5LTparse.y" - { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1865 "hl/src/H5LTparse.c" + case 85: +/* Line 1792 of yacc.c */ +#line 329 "hl/src//H5LTparse.y" + { is_enum = 1; enum_id = H5Tenum_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); } break; - case 89: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@15 enum_list '}' */ -#line 337 "hl/src/H5LTparse.y" - { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } -#line 1871 "hl/src/H5LTparse.c" + case 86: +/* Line 1792 of yacc.c */ +#line 331 "hl/src//H5LTparse.y" + { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } break; - case 92: /* $@16: %empty */ -#line 342 "hl/src/H5LTparse.y" - { + case 89: +/* Line 1792 of yacc.c */ +#line 336 "hl/src//H5LTparse.y" + { is_enum_memb = 1; /*indicate member of enum*/ -#ifdef H5_HAVE_WIN32_API - enum_memb_symbol = _strdup(yylval.sval); -#else /* H5_HAVE_WIN32_API */ enum_memb_symbol = strdup(yylval.sval); -#endif /* H5_HAVE_WIN32_API */ - free(yylval.sval); + HDfree(yylval.sval); yylval.sval = NULL; } -#line 1886 "hl/src/H5LTparse.c" break; - case 93: /* enum_def: '"' enum_symbol '"' $@16 enum_val ';' */ -#line 353 "hl/src/H5LTparse.y" - { + case 90: +/* Line 1792 of yacc.c */ +#line 343 "hl/src//H5LTparse.y" + { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; int int_val=(int)yylval.ival; @@ -1953,18 +2182,17 @@ yyreduce: } is_enum_memb = 0; - if(enum_memb_symbol) free(enum_memb_symbol); + if(enum_memb_symbol) HDfree(enum_memb_symbol); } H5Tclose(super); H5Tclose(native); } -#line 1933 "hl/src/H5LTparse.c" break; -#line 1937 "hl/src/H5LTparse.c" - +/* Line 1792 of yacc.c */ +#line 2166 "hl/src//H5LTparse.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1978,58 +2206,96 @@ yyreduce: case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; - /* Now 'shift' the result of the reduction. Determine what state + /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - { - const int yylhs = yyr1[yyn] - YYNTOKENS; - const int yyi = yypgoto[yylhs] + *yyssp; - yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp - ? yytable[yyi] - : yydefgoto[yylhs]); - } + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; +#if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif } + + if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -2041,12 +2307,14 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - /* Pacify compilers when the user code never invokes YYERROR and the - label yyerrorlab therefore never appears in user code. */ - if (0) - YYERROR; - /* Do not reclaim the symbols of the rule whose action triggered + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2059,30 +2327,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ - /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYSYMBOL_YYerror; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - YY_ACCESSING_SYMBOL (yystate), yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -2094,7 +2361,7 @@ yyerrlab1: /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -2107,7 +2374,6 @@ yyacceptlab: yyresult = 0; goto yyreturn; - /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2115,21 +2381,16 @@ yyabortlab: yyresult = 1; goto yyreturn; - -#if !defined yyoverflow +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; - goto yyreturn; + /* Fall through. */ #endif - -/*-------------------------------------------------------. -| yyreturn -- parsing is finished, clean up and return. | -`-------------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -2139,21 +2400,26 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } - /* Do not reclaim the symbols of the rule whose action triggered + /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } + diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index abff969..7169017 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -1,20 +1,19 @@ -/* A Bison parser, made by GNU Bison 3.7.2. */ +/* A Bison parser, made by GNU Bison 2.7. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, - Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -27,17 +26,13 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, - especially those whose name start with YY_ or yy_. They are - private implementation details that can be changed or removed. */ - #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -/* Debug traces. */ +/* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -45,96 +40,105 @@ extern int H5LTyydebug; #endif -/* Token kinds. */ +/* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - enum yytokentype - { - YYEMPTY = -2, - YYEOF = 0, /* "end of file" */ - YYerror = 256, /* error */ - YYUNDEF = 257, /* "invalid token" */ - H5T_STD_I8BE_TOKEN = 258, /* H5T_STD_I8BE_TOKEN */ - H5T_STD_I8LE_TOKEN = 259, /* H5T_STD_I8LE_TOKEN */ - H5T_STD_I16BE_TOKEN = 260, /* H5T_STD_I16BE_TOKEN */ - H5T_STD_I16LE_TOKEN = 261, /* H5T_STD_I16LE_TOKEN */ - H5T_STD_I32BE_TOKEN = 262, /* H5T_STD_I32BE_TOKEN */ - H5T_STD_I32LE_TOKEN = 263, /* H5T_STD_I32LE_TOKEN */ - H5T_STD_I64BE_TOKEN = 264, /* H5T_STD_I64BE_TOKEN */ - H5T_STD_I64LE_TOKEN = 265, /* H5T_STD_I64LE_TOKEN */ - H5T_STD_U8BE_TOKEN = 266, /* H5T_STD_U8BE_TOKEN */ - H5T_STD_U8LE_TOKEN = 267, /* H5T_STD_U8LE_TOKEN */ - H5T_STD_U16BE_TOKEN = 268, /* H5T_STD_U16BE_TOKEN */ - H5T_STD_U16LE_TOKEN = 269, /* H5T_STD_U16LE_TOKEN */ - H5T_STD_U32BE_TOKEN = 270, /* H5T_STD_U32BE_TOKEN */ - H5T_STD_U32LE_TOKEN = 271, /* H5T_STD_U32LE_TOKEN */ - H5T_STD_U64BE_TOKEN = 272, /* H5T_STD_U64BE_TOKEN */ - H5T_STD_U64LE_TOKEN = 273, /* H5T_STD_U64LE_TOKEN */ - H5T_NATIVE_CHAR_TOKEN = 274, /* H5T_NATIVE_CHAR_TOKEN */ - H5T_NATIVE_SCHAR_TOKEN = 275, /* H5T_NATIVE_SCHAR_TOKEN */ - H5T_NATIVE_UCHAR_TOKEN = 276, /* H5T_NATIVE_UCHAR_TOKEN */ - H5T_NATIVE_SHORT_TOKEN = 277, /* H5T_NATIVE_SHORT_TOKEN */ - H5T_NATIVE_USHORT_TOKEN = 278, /* H5T_NATIVE_USHORT_TOKEN */ - H5T_NATIVE_INT_TOKEN = 279, /* H5T_NATIVE_INT_TOKEN */ - H5T_NATIVE_UINT_TOKEN = 280, /* H5T_NATIVE_UINT_TOKEN */ - H5T_NATIVE_LONG_TOKEN = 281, /* H5T_NATIVE_LONG_TOKEN */ - H5T_NATIVE_ULONG_TOKEN = 282, /* H5T_NATIVE_ULONG_TOKEN */ - H5T_NATIVE_LLONG_TOKEN = 283, /* H5T_NATIVE_LLONG_TOKEN */ - H5T_NATIVE_ULLONG_TOKEN = 284, /* H5T_NATIVE_ULLONG_TOKEN */ - H5T_IEEE_F32BE_TOKEN = 285, /* H5T_IEEE_F32BE_TOKEN */ - H5T_IEEE_F32LE_TOKEN = 286, /* H5T_IEEE_F32LE_TOKEN */ - H5T_IEEE_F64BE_TOKEN = 287, /* H5T_IEEE_F64BE_TOKEN */ - H5T_IEEE_F64LE_TOKEN = 288, /* H5T_IEEE_F64LE_TOKEN */ - H5T_NATIVE_FLOAT_TOKEN = 289, /* H5T_NATIVE_FLOAT_TOKEN */ - H5T_NATIVE_DOUBLE_TOKEN = 290, /* H5T_NATIVE_DOUBLE_TOKEN */ - H5T_NATIVE_LDOUBLE_TOKEN = 291, /* H5T_NATIVE_LDOUBLE_TOKEN */ - H5T_STRING_TOKEN = 292, /* H5T_STRING_TOKEN */ - STRSIZE_TOKEN = 293, /* STRSIZE_TOKEN */ - STRPAD_TOKEN = 294, /* STRPAD_TOKEN */ - CSET_TOKEN = 295, /* CSET_TOKEN */ - CTYPE_TOKEN = 296, /* CTYPE_TOKEN */ - H5T_VARIABLE_TOKEN = 297, /* H5T_VARIABLE_TOKEN */ - H5T_STR_NULLTERM_TOKEN = 298, /* H5T_STR_NULLTERM_TOKEN */ - H5T_STR_NULLPAD_TOKEN = 299, /* H5T_STR_NULLPAD_TOKEN */ - H5T_STR_SPACEPAD_TOKEN = 300, /* H5T_STR_SPACEPAD_TOKEN */ - H5T_CSET_ASCII_TOKEN = 301, /* H5T_CSET_ASCII_TOKEN */ - H5T_CSET_UTF8_TOKEN = 302, /* H5T_CSET_UTF8_TOKEN */ - H5T_C_S1_TOKEN = 303, /* H5T_C_S1_TOKEN */ - H5T_FORTRAN_S1_TOKEN = 304, /* H5T_FORTRAN_S1_TOKEN */ - H5T_OPAQUE_TOKEN = 305, /* H5T_OPAQUE_TOKEN */ - OPQ_SIZE_TOKEN = 306, /* OPQ_SIZE_TOKEN */ - OPQ_TAG_TOKEN = 307, /* OPQ_TAG_TOKEN */ - H5T_COMPOUND_TOKEN = 308, /* H5T_COMPOUND_TOKEN */ - H5T_ENUM_TOKEN = 309, /* H5T_ENUM_TOKEN */ - H5T_ARRAY_TOKEN = 310, /* H5T_ARRAY_TOKEN */ - H5T_VLEN_TOKEN = 311, /* H5T_VLEN_TOKEN */ - STRING = 312, /* STRING */ - NUMBER = 313 /* NUMBER */ - }; - typedef enum yytokentype yytoken_kind_t; + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + H5T_STD_I8BE_TOKEN = 258, + H5T_STD_I8LE_TOKEN = 259, + H5T_STD_I16BE_TOKEN = 260, + H5T_STD_I16LE_TOKEN = 261, + H5T_STD_I32BE_TOKEN = 262, + H5T_STD_I32LE_TOKEN = 263, + H5T_STD_I64BE_TOKEN = 264, + H5T_STD_I64LE_TOKEN = 265, + H5T_STD_U8BE_TOKEN = 266, + H5T_STD_U8LE_TOKEN = 267, + H5T_STD_U16BE_TOKEN = 268, + H5T_STD_U16LE_TOKEN = 269, + H5T_STD_U32BE_TOKEN = 270, + H5T_STD_U32LE_TOKEN = 271, + H5T_STD_U64BE_TOKEN = 272, + H5T_STD_U64LE_TOKEN = 273, + H5T_NATIVE_CHAR_TOKEN = 274, + H5T_NATIVE_SCHAR_TOKEN = 275, + H5T_NATIVE_UCHAR_TOKEN = 276, + H5T_NATIVE_SHORT_TOKEN = 277, + H5T_NATIVE_USHORT_TOKEN = 278, + H5T_NATIVE_INT_TOKEN = 279, + H5T_NATIVE_UINT_TOKEN = 280, + H5T_NATIVE_LONG_TOKEN = 281, + H5T_NATIVE_ULONG_TOKEN = 282, + H5T_NATIVE_LLONG_TOKEN = 283, + H5T_NATIVE_ULLONG_TOKEN = 284, + H5T_IEEE_F32BE_TOKEN = 285, + H5T_IEEE_F32LE_TOKEN = 286, + H5T_IEEE_F64BE_TOKEN = 287, + H5T_IEEE_F64LE_TOKEN = 288, + H5T_NATIVE_FLOAT_TOKEN = 289, + H5T_NATIVE_DOUBLE_TOKEN = 290, + H5T_NATIVE_LDOUBLE_TOKEN = 291, + H5T_STRING_TOKEN = 292, + STRSIZE_TOKEN = 293, + STRPAD_TOKEN = 294, + CSET_TOKEN = 295, + CTYPE_TOKEN = 296, + H5T_VARIABLE_TOKEN = 297, + H5T_STR_NULLTERM_TOKEN = 298, + H5T_STR_NULLPAD_TOKEN = 299, + H5T_STR_SPACEPAD_TOKEN = 300, + H5T_CSET_ASCII_TOKEN = 301, + H5T_CSET_UTF8_TOKEN = 302, + H5T_C_S1_TOKEN = 303, + H5T_FORTRAN_S1_TOKEN = 304, + H5T_OPAQUE_TOKEN = 305, + OPQ_SIZE_TOKEN = 306, + OPQ_TAG_TOKEN = 307, + H5T_COMPOUND_TOKEN = 308, + H5T_ENUM_TOKEN = 309, + H5T_ARRAY_TOKEN = 310, + H5T_VLEN_TOKEN = 311, + STRING = 312, + NUMBER = 313 + }; #endif -/* Value type. */ + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -union YYSTYPE +typedef union YYSTYPE { -#line 72 "hl/src/H5LTparse.y" +/* Line 2058 of yacc.c */ +#line 69 "hl/src//H5LTparse.y" int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 128 "hl/src/H5LTparse.h" -}; -typedef union YYSTYPE YYSTYPE; +/* Line 2058 of yacc.c */ +#line 122 "hl/src//H5LTparse.h" +} YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif - extern YYSTYPE H5LTyylval; +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +hid_t H5LTyyparse (void *YYPARSE_PARAM); +#else +hid_t H5LTyyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus hid_t H5LTyyparse (void); +#else +hid_t H5LTyyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index 306d8c9..7c32772 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -22,7 +22,9 @@ #include #include -extern int yylex(); +#include "H5private.h" + +extern int yylex(void); extern int yyerror(const char *); #define STACK_SIZE 16 @@ -35,13 +37,13 @@ struct cmpd_info { }; /*stack for nested compound type*/ -struct cmpd_info cmpd_stack[STACK_SIZE] = { +static struct cmpd_info cmpd_stack[STACK_SIZE] = { {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1} }; -int csindex = -1; /*pointer to the top of compound stack*/ +static int csindex = -1; /*pointer to the top of compound stack*/ /*structure for array type information*/ struct arr_info { @@ -50,23 +52,18 @@ struct arr_info { hbool_t is_dim; /*flag to lexer for dimension*/ }; /*stack for nested array type*/ -struct arr_info arr_stack[STACK_SIZE]; -int asindex = -1; /*pointer to the top of array stack*/ +static struct arr_info arr_stack[STACK_SIZE]; +static int asindex = -1; /*pointer to the top of array stack*/ -hbool_t is_str_size = 0; /*flag to lexer for string size*/ -hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ -H5T_str_t str_pad; /*variable for string padding*/ -H5T_cset_t str_cset; /*variable for string character set*/ -hbool_t is_variable = 0; /*variable for variable-length string*/ -size_t str_size; /*variable for string size*/ +static H5T_str_t str_pad; /*variable for string padding*/ +static H5T_cset_t str_cset; /*variable for string character set*/ +static hbool_t is_variable = 0; /*variable for variable-length string*/ +static size_t str_size; /*variable for string size*/ -hid_t enum_id; /*type ID*/ -hbool_t is_enum = 0; /*flag to lexer for enum type*/ -hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ -char* enum_memb_symbol; /*enum member symbol string*/ - -hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ -hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ +static hid_t enum_id; /*type ID*/ +static hbool_t is_enum = 0; /*flag to lexer for enum type*/ +static hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ +static char* enum_memb_symbol; /*enum member symbol string*/ %} %union { @@ -99,7 +96,7 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ %token STRING %token NUMBER -%token '{' '}' '[' ']' '"' ':' ';' +%token '{' '}' '[' ']' ':' ';' %% start : { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } @@ -168,35 +165,35 @@ memb_list : | memb_list memb_def ; memb_def : ddl_type { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } - '"' field_name '"' field_offset ';' + field_name field_offset ';' { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; /*Adjust size and insert member, consider both member size and offset.*/ if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ - new_size = H5Tget_size($1) + $6; + new_size = H5Tget_size($1) + $4; H5Tset_size(dtype_id, new_size); /*member name is saved in yylval.sval by lexer*/ - H5Tinsert(dtype_id, $4, $6, $1); + H5Tinsert(dtype_id, $3, $4, $1); cmpd_stack[csindex].first_memb = 0; } else { origin_size = H5Tget_size(dtype_id); - if($6 == 0) { + if($4 == 0) { new_size = origin_size + H5Tget_size($1); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, $4, origin_size, $1); + H5Tinsert(dtype_id, $3, origin_size, $1); } else { - new_size = $6 + H5Tget_size($1); + new_size = $4 + H5Tget_size($1); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, $4, $6, $1); + H5Tinsert(dtype_id, $3, $4, $1); } } - if($4) { - free($4); - $4 = NULL; + if($3) { + HDfree($3); + $3 = NULL; } cmpd_stack[csindex].is_field = 0; H5Tclose($1); @@ -206,8 +203,8 @@ memb_def : ddl_type { cmpd_stack[csindex].is_field = 1; /*notify le ; field_name : STRING { - $$ = strdup(yylval.sval); - free(yylval.sval); + $$ = HDstrdup(yylval.sval); + HDfree(yylval.sval); yylval.sval = NULL; } ; @@ -247,20 +244,18 @@ vlen_type : H5T_VLEN_TOKEN '{' ddl_type '}' opaque_type : H5T_OPAQUE_TOKEN '{' - OPQ_SIZE_TOKEN { is_opq_size = 1; } opaque_size ';' + OPQ_SIZE_TOKEN opaque_size ';' { size_t size = (size_t)yylval.ival; $$ = H5Tcreate(H5T_OPAQUE, size); - is_opq_size = 0; } - OPQ_TAG_TOKEN { is_opq_tag = 1; } '"' opaque_tag '"' ';' + OPQ_TAG_TOKEN opaque_tag ';' { - H5Tset_tag($7, yylval.sval); - free(yylval.sval); + H5Tset_tag($6, yylval.sval); + HDfree(yylval.sval); yylval.sval = NULL; - is_opq_tag = 0; } - '}' { $$ = $7; } + '}' { $$ = $6; } ; opaque_size : NUMBER ; @@ -268,40 +263,39 @@ opaque_tag : STRING ; string_type : H5T_STRING_TOKEN '{' - STRSIZE_TOKEN { is_str_size = 1; } strsize ';' + STRSIZE_TOKEN strsize ';' { - if($5 == H5T_VARIABLE_TOKEN) + if($4 == H5T_VARIABLE_TOKEN) is_variable = 1; else str_size = yylval.ival; - is_str_size = 0; } STRPAD_TOKEN strpad ';' { - if($9 == H5T_STR_NULLTERM_TOKEN) + if($8 == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; - else if($9 == H5T_STR_NULLPAD_TOKEN) + else if($8 == H5T_STR_NULLPAD_TOKEN) str_pad = H5T_STR_NULLPAD; - else if($9 == H5T_STR_SPACEPAD_TOKEN) + else if($8 == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } CSET_TOKEN cset ';' { - if($13 == H5T_CSET_ASCII_TOKEN) + if($12 == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; - else if($13 == H5T_CSET_UTF8_TOKEN) + else if($12 == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } CTYPE_TOKEN ctype ';' { - if($17 == H5T_C_S1_TOKEN) + if($16 == H5T_C_S1_TOKEN) $$ = H5Tcopy(H5T_C_S1); - else if($17 == H5T_FORTRAN_S1_TOKEN) + else if($16 == H5T_FORTRAN_S1_TOKEN) $$ = H5Tcopy(H5T_FORTRAN_S1); } '}' { - hid_t str_id = $19; + hid_t str_id = $18; /*set string size*/ if(is_variable) { @@ -339,14 +333,10 @@ enum_type : H5T_ENUM_TOKEN '{' integer_type ';' enum_list : | enum_list enum_def ; -enum_def : '"' enum_symbol '"' { +enum_def : enum_symbol { is_enum_memb = 1; /*indicate member of enum*/ -#ifdef H5_HAVE_WIN32_API - enum_memb_symbol = _strdup(yylval.sval); -#else /* H5_HAVE_WIN32_API */ enum_memb_symbol = strdup(yylval.sval); -#endif /* H5_HAVE_WIN32_API */ - free(yylval.sval); + HDfree(yylval.sval); yylval.sval = NULL; } enum_val ';' @@ -386,7 +376,7 @@ enum_def : '"' enum_symbol '"' { } is_enum_memb = 0; - if(enum_memb_symbol) free(enum_memb_symbol); + if(enum_memb_symbol) HDfree(enum_memb_symbol); } H5Tclose(super); -- cgit v0.12 From c6e4e535469beaa3418b34863d455c8f17ade3f5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 17 Mar 2021 10:25:39 -0500 Subject: Update clang config (#473) * Update clang config to put H5E_BEGIN_TRY / H5E_END_TRY on separate lines, empty C++ methods on separate lines, understand that ALL_MEMBERS / UNIQUE_MEMBERS are foreach macros, and properly skip the 'config' directory in the find command without emiting a warning * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .clang-format | 2 + bin/format_source | 2 +- bin/format_source_patch | 2 +- c++/src/H5AbstractDs.cpp | 8 +- c++/src/H5ArrayType.cpp | 16 +- c++/src/H5AtomType.cpp | 16 +- c++/src/H5Attribute.cpp | 4 +- c++/src/H5CommonFG.cpp | 8 +- c++/src/H5CompType.cpp | 20 +- c++/src/H5DaccProp.cpp | 16 +- c++/src/H5DataSet.cpp | 4 +- c++/src/H5DataType.cpp | 4 +- c++/src/H5DcreatProp.cpp | 16 +- c++/src/H5DxferProp.cpp | 16 +- c++/src/H5EnumType.cpp | 20 +- c++/src/H5Exception.cpp | 104 ++++++++--- c++/src/H5FaccProp.cpp | 16 +- c++/src/H5FcreatProp.cpp | 16 +- c++/src/H5File.cpp | 4 +- c++/src/H5FloatType.cpp | 16 +- c++/src/H5Group.cpp | 4 +- c++/src/H5IdComponent.cpp | 4 +- c++/src/H5IntType.cpp | 16 +- c++/src/H5LaccProp.cpp | 16 +- c++/src/H5LcreatProp.cpp | 16 +- c++/src/H5Library.cpp | 8 +- c++/src/H5Location.cpp | 8 +- c++/src/H5Object.cpp | 8 +- c++/src/H5OcreatProp.cpp | 16 +- c++/src/H5PredType.cpp | 17 +- c++/src/H5PropList.cpp | 4 +- c++/src/H5StrType.cpp | 16 +- c++/src/H5VarLenType.cpp | 16 +- c++/test/h5cpputil.cpp | 16 +- hl/c++/src/H5PacketTable.cpp | 23 ++- hl/c++/src/H5PacketTable.h | 9 +- hl/c++/test/ptableTest.cpp | 5 +- hl/src/H5DS.c | 5 +- hl/src/H5LD.c | 5 +- hl/src/H5LT.c | 5 +- hl/test/test_ds.c | 5 +- hl/test/test_file_image.c | 5 +- hl/test/test_image.c | 15 +- hl/test/test_ld.c | 20 +- hl/tools/gif2h5/gifread.c | 5 +- java/src/jni/h5util.c | 10 +- src/H5FDmulti.c | 125 ++++++------- src/H5Fsuper.c | 5 +- src/H5Gdeprec.c | 5 +- src/H5Iint.c | 5 +- src/H5Pdcpl.c | 20 +- test/btree2.c | 115 +++++++++--- test/cache_api.c | 75 ++++++-- test/cache_image.c | 5 +- test/chunk_info.c | 10 +- test/cork.c | 45 ++++- test/cross_read.c | 15 +- test/dangle.c | 5 +- test/direct_chunk.c | 10 +- test/dsets.c | 185 +++++++++++++++---- test/dt_arith.c | 5 +- test/dtransform.c | 5 +- test/dtypes.c | 365 +++++++++++++++++++++++++++++-------- test/earray.c | 65 +++++-- test/efc.c | 5 +- test/enc_dec_plist.c | 5 +- test/enum.c | 40 +++- test/error_test.c | 25 ++- test/event_set.c | 5 +- test/evict_on_close.c | 20 +- test/external.c | 50 ++++- test/farray.c | 30 ++- test/fheap.c | 50 ++++- test/file_image.c | 30 ++- test/fillval.c | 14 +- test/filter_fail.c | 10 +- test/filter_plugin.c | 30 ++- test/flush1.c | 5 +- test/freespace.c | 5 +- test/getname.c | 5 +- test/gheap.c | 30 ++- test/h5test.c | 10 +- test/hdfs.c | 40 +++- test/lheap.c | 5 +- test/links.c | 305 ++++++++++++++++++++++++------- test/links_env.c | 5 +- test/mf.c | 130 ++++++++++--- test/mount.c | 120 +++++++++--- test/objcopy.c | 9 +- test/objcopy_ref.c | 4 +- test/ohdr.c | 35 +++- test/page_buffer.c | 30 ++- test/reserved.c | 10 +- test/ros3.c | 55 ++++-- test/set_extent.c | 25 ++- test/stab.c | 15 +- test/swmr.c | 290 +++++++++++++++++++++++------ test/tarray.c | 10 +- test/tattr.c | 40 +++- test/tfile.c | 270 +++++++++++++++++++++------ test/th5o.c | 65 +++++-- test/th5s.c | 85 +++++++-- test/tid.c | 25 ++- test/titerate.c | 25 ++- test/tmisc.c | 225 ++++++++++++++++++----- test/trefer.c | 15 +- test/trefer_deprec.c | 25 ++- test/tselect.c | 105 ++++++++--- test/tvltypes.c | 25 ++- test/unlink.c | 50 ++++- test/unregister.c | 10 +- test/vds.c | 15 +- test/vfd.c | 85 +++++++-- test/vol.c | 15 +- test/vol_plugin.c | 10 +- testpar/t_file.c | 5 +- tools/lib/h5diff_array.c | 5 +- tools/lib/h5tools.c | 5 +- tools/lib/h5tools_str.c | 10 +- tools/src/h5repack/h5repack_copy.c | 5 +- tools/src/misc/h5repart.c | 5 +- tools/test/h5dump/h5dumpgentest.c | 5 +- tools/test/h5repack/h5repacktst.c | 5 +- tools/test/misc/repart_test.c | 5 +- tools/test/misc/talign.c | 5 +- utils/mirror_vfd/mirror_writer.c | 5 +- 126 files changed, 3346 insertions(+), 913 deletions(-) diff --git a/.clang-format b/.clang-format index 34b7563..62dc6b5 100644 --- a/.clang-format +++ b/.clang-format @@ -7,6 +7,7 @@ AlignConsecutiveDeclarations: true AlignConsecutiveMacros: true #llvm10-11: AlignOperands: true - Align #llvm11: AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: None AlwaysBreakAfterReturnType: AllDefinitions # Can enable the following section when llvm 12.x is out #AttributeMacros: @@ -32,6 +33,7 @@ BreakBeforeBraces: Stroustrup BreakAfterJavaFieldAnnotations: true BreakStringLiterals: true ColumnLimit: 110 # Update $max_trace_macro_line_len in bin/trace also +ForEachMacros: ['ALL_MEMBERS', 'UNIQUE_MEMBERS'] IncludeCategories: - Regex: '^"(llvm|llvm-c|clang|clang-c)/' Priority: 3 diff --git a/bin/format_source b/bin/format_source index 1128def..dce34e5 100755 --- a/bin/format_source +++ b/bin/format_source @@ -8,7 +8,7 @@ # # (Remember to update both bin/format_source and bin/format_source_patch) -find . -type d \( -path ./config \) -prune \ +find . \( -type d -path ./config -prune -and -not -path ./config \) \ -or \( \( \! \( \ -name H5LTanalyze.c \ -or -name H5LTparse.c \ diff --git a/bin/format_source_patch b/bin/format_source_patch index 8d6be01..439baf2 100755 --- a/bin/format_source_patch +++ b/bin/format_source_patch @@ -8,7 +8,7 @@ # # (Remember to update both bin/format_source and bin/format_source_patch) -find . -type d \( -path ./config \) -prune \ +find . \( -type d -path ./config -prune -and -not -path ./config \) \ -or \( \( \! \( \ -name H5LTanalyze.c \ -or -name H5LTparse.c \ diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 6e6be8d..eeb0155 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -38,7 +38,9 @@ namespace H5 { ///\brief Default constructor // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -AbstractDs::AbstractDs() {} +AbstractDs::AbstractDs() +{ +} //-------------------------------------------------------------------------- // Function: AbstractDs default constructor @@ -331,6 +333,8 @@ AbstractDs::getVarLenType() const ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -AbstractDs::~AbstractDs() {} +AbstractDs::~AbstractDs() +{ +} } // namespace H5 diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index edf915d..6999f1b 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -34,7 +34,9 @@ namespace H5 { ///\brief Default constructor: Creates a stub ArrayType // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -ArrayType::ArrayType() : DataType() {} +ArrayType::ArrayType() : DataType() +{ +} //-------------------------------------------------------------------------- // Function: ArrayType overloaded constructor @@ -43,14 +45,18 @@ ArrayType::ArrayType() : DataType() {} ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) {} +ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) +{ +} //-------------------------------------------------------------------------- // Function: ArrayType copy constructor ///\brief Copy constructor: same HDF5 object as \a original // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -ArrayType::ArrayType(const ArrayType &original) : DataType(original) {} +ArrayType::ArrayType(const ArrayType &original) : DataType(original) +{ +} //-------------------------------------------------------------------------- // Function: ArrayType overloaded constructor @@ -206,6 +212,8 @@ ArrayType::getArrayDims(hsize_t *dims) const ///\brief Properly terminates access to this array datatype. // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -ArrayType::~ArrayType() {} +ArrayType::~ArrayType() +{ +} } // namespace H5 diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index 6730171..0b48046 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -35,7 +35,9 @@ namespace H5 { // Purpose Default constructor: creates a stub atomic datatype. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -AtomType::AtomType() : DataType() {} +AtomType::AtomType() : DataType() +{ +} //-------------------------------------------------------------------------- // Function: AtomType overloaded constructor [protected] @@ -44,14 +46,18 @@ AtomType::AtomType() : DataType() {} // Exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) {} +AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) +{ +} //-------------------------------------------------------------------------- // Function: AtomType copy constructor ///\brief Copy constructor: same HDF5 object as \a original // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -AtomType::AtomType(const AtomType &original) : DataType(original) {} +AtomType::AtomType(const AtomType &original) : DataType(original) +{ +} #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -290,7 +296,9 @@ AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -AtomType::~AtomType() {} +AtomType::~AtomType() +{ +} #endif // DOXYGEN_SHOULD_SKIP_THIS } // namespace H5 diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index b74349c..0e37c2b 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -44,7 +44,9 @@ class H5Object; // forward declaration for UserData4Aiterate ///\brief Default constructor: Creates a stub attribute // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) {} +Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) +{ +} //-------------------------------------------------------------------------- // Function: Attribute copy constructor diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index dbc88f8..fb602d9 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -357,14 +357,18 @@ CommonFG::openVarLenType(const H5std_string &name) const ///\brief Default constructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CommonFG::CommonFG() {} +CommonFG::CommonFG() +{ +} //-------------------------------------------------------------------------- // Function: CommonFG destructor ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CommonFG::~CommonFG() {} +CommonFG::~CommonFG() +{ +} //-------------------------------------------------------------------------- // Function: f_DataType_setId - friend diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index ca01aeb..3b38c6d 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -37,7 +37,9 @@ namespace H5 { ///\brief Default constructor: Creates a stub compound datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::CompType() : DataType() {} +CompType::CompType() : DataType() +{ +} //-------------------------------------------------------------------------- // Function: CompType copy constructor @@ -45,7 +47,9 @@ CompType::CompType() : DataType() {} ///\param original - IN: Original CompType instance // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::CompType(const CompType &original) : DataType(original) {} +CompType::CompType(const CompType &original) : DataType(original) +{ +} //-------------------------------------------------------------------------- // Function: CompType overloaded constructor @@ -53,7 +57,9 @@ CompType::CompType(const CompType &original) : DataType(original) {} ///\param existing_id - IN: Id of an existing compound datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::CompType(const hid_t existing_id) : DataType(existing_id) {} +CompType::CompType(const hid_t existing_id) : DataType(existing_id) +{ +} //-------------------------------------------------------------------------- // Function: CompType overloaded constructor @@ -65,7 +71,9 @@ CompType::CompType(const hid_t existing_id) : DataType(existing_id) {} // the compound datatype. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) {} +CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) +{ +} //-------------------------------------------------------------------------- // Function: CompType overloaded constructor @@ -549,6 +557,8 @@ CompType::setSize(size_t size) const ///\brief Properly terminates access to this compound datatype. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::~CompType() {} +CompType::~CompType() +{ +} } // namespace H5 diff --git a/c++/src/H5DaccProp.cpp b/c++/src/H5DaccProp.cpp index 9e2653d..35c071a 100644 --- a/c++/src/H5DaccProp.cpp +++ b/c++/src/H5DaccProp.cpp @@ -88,7 +88,9 @@ const DSetAccPropList &DSetAccPropList::DEFAULT = *getConstant(); ///\brief Default constructor: creates a stub dataset creation property list // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetAccPropList::DSetAccPropList() : LinkAccPropList(H5P_DATASET_ACCESS) {} +DSetAccPropList::DSetAccPropList() : LinkAccPropList(H5P_DATASET_ACCESS) +{ +} //-------------------------------------------------------------------------- // Function: DSetAccPropList copy constructor @@ -96,7 +98,9 @@ DSetAccPropList::DSetAccPropList() : LinkAccPropList(H5P_DATASET_ACCESS) {} /// DSetAccPropList object // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetAccPropList::DSetAccPropList(const DSetAccPropList &orig) : LinkAccPropList(orig) {} +DSetAccPropList::DSetAccPropList(const DSetAccPropList &orig) : LinkAccPropList(orig) +{ +} //-------------------------------------------------------------------------- // Function: DSetAccPropList overloaded constructor @@ -104,7 +108,9 @@ DSetAccPropList::DSetAccPropList(const DSetAccPropList &orig) : LinkAccPropList( /// existing dataset creation property list. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetAccPropList::DSetAccPropList(const hid_t plist_id) : LinkAccPropList(plist_id) {} +DSetAccPropList::DSetAccPropList(const hid_t plist_id) : LinkAccPropList(plist_id) +{ +} //-------------------------------------------------------------------------- // Function: DSetAccPropList::setChunkCache @@ -159,6 +165,8 @@ DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetAccPropList::~DSetAccPropList() {} +DSetAccPropList::~DSetAccPropList() +{ +} } // namespace H5 diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 5dc44b8..3a14975 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -44,7 +44,9 @@ using std::endl; ///\brief Default constructor: creates a stub DataSet. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) {} +DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) +{ +} //-------------------------------------------------------------------------- // Function: DataSet overloaded constructor diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 1689912..3228dcb 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -46,7 +46,9 @@ using std::endl; ///\brief Default constructor: Creates a stub datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType::DataType() : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0) {} +DataType::DataType() : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0) +{ +} //-------------------------------------------------------------------------- // Function: DataType overloaded constructor diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 0ffcbf7..383e38f 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -94,7 +94,9 @@ const DSetCreatPropList &DSetCreatPropList::DEFAULT = *getConstant(); ///\brief Default constructor: creates a stub dataset creation property list // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) {} +DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) +{ +} //-------------------------------------------------------------------------- // Function: DSetCreatPropList copy constructor @@ -102,7 +104,9 @@ DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) {} /// DSetCreatPropList object // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList &orig) : ObjCreatPropList(orig) {} +DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList &orig) : ObjCreatPropList(orig) +{ +} //-------------------------------------------------------------------------- // Function: DSetCreatPropList overloaded constructor @@ -110,7 +114,9 @@ DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList &orig) : ObjCreatPr /// existing dataset creation property list. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(plist_id) {} +DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(plist_id) +{ +} //-------------------------------------------------------------------------- // Function: DSetCreatPropList::setChunk @@ -780,6 +786,8 @@ DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string &src_f ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetCreatPropList::~DSetCreatPropList() {} +DSetCreatPropList::~DSetCreatPropList() +{ +} } // namespace H5 diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 98e6214..2b50de4 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -89,7 +89,9 @@ const DSetMemXferPropList &DSetMemXferPropList::DEFAULT = *getConstant(); /// transfer property list object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {} +DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) +{ +} //-------------------------------------------------------------------------- // Function DSetMemXferPropList constructor @@ -110,7 +112,9 @@ DSetMemXferPropList::DSetMemXferPropList(const char *exp) : PropList(H5P_DATASET /// list object to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList &original) : PropList(original) {} +DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList &original) : PropList(original) +{ +} //-------------------------------------------------------------------------- // Function DSetMemXferPropList overloaded constructor @@ -120,7 +124,9 @@ DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList &original) : /// property list // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_id) {} +DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_id) +{ +} //-------------------------------------------------------------------------- // Function: DSetMemXferPropList::setBuffer @@ -552,6 +558,8 @@ DSetMemXferPropList::getEDCCheck() const ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetMemXferPropList::~DSetMemXferPropList() {} +DSetMemXferPropList::~DSetMemXferPropList() +{ +} } // namespace H5 diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 9b179da..6c7b533 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -41,7 +41,9 @@ namespace H5 { ///\brief Default constructor: Creates a stub datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType() : DataType() {} +EnumType::EnumType() : DataType() +{ +} //-------------------------------------------------------------------------- // Function: EnumType overloaded constructor @@ -50,14 +52,18 @@ EnumType::EnumType() : DataType() {} ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType(const hid_t existing_id) : DataType(existing_id) {} +EnumType::EnumType(const hid_t existing_id) : DataType(existing_id) +{ +} //-------------------------------------------------------------------------- // Function: EnumType copy constructor ///\brief Copy constructor: same HDF5 object as \a original // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType(const EnumType &original) : DataType(original) {} +EnumType::EnumType(const EnumType &original) : DataType(original) +{ +} //-------------------------------------------------------------------------- // Function: EnumType overloaded constructor @@ -69,7 +75,9 @@ EnumType::EnumType(const EnumType &original) : DataType(original) {} // the enum datatype. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType(size_t size) : DataType(H5T_ENUM, size) {} +EnumType::EnumType(size_t size) : DataType(H5T_ENUM, size) +{ +} //-------------------------------------------------------------------------- // Function: EnumType overloaded constructor @@ -335,6 +343,8 @@ EnumType::getMemberValue(unsigned memb_no, void *value) const ///\brief Properly terminates access to this enum datatype. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::~EnumType() {} +EnumType::~EnumType() +{ +} } // namespace H5 diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 8ea20ff..6769439 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -25,7 +25,9 @@ const char Exception::DEFAULT_MSG[] = "No detailed information provided"; ///\brief Default constructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::Exception() {} +Exception::Exception() +{ +} //-------------------------------------------------------------------------- // Function: Exception overloaded constructor @@ -340,7 +342,9 @@ Exception::printErrorStack(FILE *stream, hid_t err_stack) ///\brief Noop destructor // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::~Exception() throw() {} +Exception::~Exception() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: FileIException @@ -350,7 +354,9 @@ Exception::~Exception() throw() {} // Function: FileIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -FileIException::FileIException() : Exception() {} +FileIException::FileIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: FileIException overloaded constructor ///\brief Creates a FileIException with the name of the function, @@ -366,7 +372,9 @@ FileIException::FileIException(const H5std_string &func, const H5std_string &mes // Function: FileIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -FileIException::~FileIException() throw() {} +FileIException::~FileIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: GroupIException @@ -376,7 +384,9 @@ FileIException::~FileIException() throw() {} // Function: GroupIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -GroupIException::GroupIException() : Exception() {} +GroupIException::GroupIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: GroupIException overloaded constructor ///\brief Creates a GroupIException with the name of the function, @@ -392,7 +402,9 @@ GroupIException::GroupIException(const H5std_string &func, const H5std_string &m // Function: GroupIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -GroupIException::~GroupIException() throw() {} +GroupIException::~GroupIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: DataSpaceIException @@ -402,7 +414,9 @@ GroupIException::~GroupIException() throw() {} // Function: DataSpaceIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -DataSpaceIException::DataSpaceIException() : Exception() {} +DataSpaceIException::DataSpaceIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: DataSpaceIException overloaded constructor ///\brief Creates a DataSpaceIException with the name of the function, @@ -418,7 +432,9 @@ DataSpaceIException::DataSpaceIException(const H5std_string &func, const H5std_s // Function: DataSpaceIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataSpaceIException::~DataSpaceIException() throw() {} +DataSpaceIException::~DataSpaceIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: DataTypeIException @@ -428,7 +444,9 @@ DataSpaceIException::~DataSpaceIException() throw() {} // Function: DataTypeIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -DataTypeIException::DataTypeIException() : Exception() {} +DataTypeIException::DataTypeIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: DataTypeIException overloaded constructor ///\brief Creates a DataTypeIException with the name of the function, @@ -444,7 +462,9 @@ DataTypeIException::DataTypeIException(const H5std_string &func, const H5std_str // Function: DataTypeIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataTypeIException::~DataTypeIException() throw() {} +DataTypeIException::~DataTypeIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: ObjHeaderIException @@ -454,7 +474,9 @@ DataTypeIException::~DataTypeIException() throw() {} // Function: ObjHeaderIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -ObjHeaderIException::ObjHeaderIException() : Exception() {} +ObjHeaderIException::ObjHeaderIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: ObjHeaderIException overloaded constructor ///\brief Creates an ObjHeaderIException with the name of the function, @@ -470,7 +492,9 @@ ObjHeaderIException::ObjHeaderIException(const H5std_string &func, const H5std_s // Function: ObjHeaderIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -ObjHeaderIException::~ObjHeaderIException() throw() {} +ObjHeaderIException::~ObjHeaderIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: PropListIException @@ -480,7 +504,9 @@ ObjHeaderIException::~ObjHeaderIException() throw() {} // Function: PropListIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -PropListIException::PropListIException() : Exception() {} +PropListIException::PropListIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: PropListIException overloaded constructor ///\brief Creates a PropListIException with the name of the function, @@ -496,7 +522,9 @@ PropListIException::PropListIException(const H5std_string &func, const H5std_str // Function: PropListIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -PropListIException::~PropListIException() throw() {} +PropListIException::~PropListIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: DataSetIException @@ -506,7 +534,9 @@ PropListIException::~PropListIException() throw() {} // Function: DataSetIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -DataSetIException::DataSetIException() : Exception() {} +DataSetIException::DataSetIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: DataSetIException overloaded constructor ///\brief Creates a DataSetIException with the name of the function, @@ -522,7 +552,9 @@ DataSetIException::DataSetIException(const H5std_string &func, const H5std_strin // Function: DataSetIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataSetIException::~DataSetIException() throw() {} +DataSetIException::~DataSetIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: AttributeIException @@ -532,7 +564,9 @@ DataSetIException::~DataSetIException() throw() {} // Function: AttributeIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -AttributeIException::AttributeIException() : Exception() {} +AttributeIException::AttributeIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: AttributeIException overloaded constructor ///\brief Creates an AttributeIException with the name of the function, @@ -548,7 +582,9 @@ AttributeIException::AttributeIException(const H5std_string &func, const H5std_s // Function: AttributeIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -AttributeIException::~AttributeIException() throw() {} +AttributeIException::~AttributeIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: ReferenceException @@ -558,7 +594,9 @@ AttributeIException::~AttributeIException() throw() {} // Function: ReferenceException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -ReferenceException::ReferenceException() : Exception() {} +ReferenceException::ReferenceException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: ReferenceException overloaded constructor ///\brief Creates a ReferenceException with the name of the function, @@ -574,7 +612,9 @@ ReferenceException::ReferenceException(const H5std_string &func, const H5std_str // Function: ReferenceException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -ReferenceException::~ReferenceException() throw() {} +ReferenceException::~ReferenceException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: LibraryIException @@ -584,7 +624,9 @@ ReferenceException::~ReferenceException() throw() {} // Function: LibraryIException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -LibraryIException::LibraryIException() : Exception() {} +LibraryIException::LibraryIException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: LibraryIException overloaded constructor ///\brief Creates a LibraryIException with the name of the function, @@ -600,7 +642,9 @@ LibraryIException::LibraryIException(const H5std_string &func, const H5std_strin // Function: LibraryIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -LibraryIException::~LibraryIException() throw() {} +LibraryIException::~LibraryIException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: LocationException @@ -610,7 +654,9 @@ LibraryIException::~LibraryIException() throw() {} // Function: LocationException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -LocationException::LocationException() : Exception() {} +LocationException::LocationException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: LocationException overloaded constructor ///\brief Creates a LocationException with the name of the function, @@ -626,7 +672,9 @@ LocationException::LocationException(const H5std_string &func, const H5std_strin // Function: LocationException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -LocationException::~LocationException() throw() {} +LocationException::~LocationException() throw() +{ +} //-------------------------------------------------------------------------- // Subclass: IdComponentException @@ -636,7 +684,9 @@ LocationException::~LocationException() throw() {} // Function: IdComponentException default constructor ///\brief Default constructor. //-------------------------------------------------------------------------- -IdComponentException::IdComponentException() : Exception() {} +IdComponentException::IdComponentException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: IdComponentException overloaded constructor ///\brief Creates a IdComponentException with the name of the function, @@ -652,6 +702,8 @@ IdComponentException::IdComponentException(const H5std_string &func, const H5std // Function: IdComponentException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -IdComponentException::~IdComponentException() throw() {} +IdComponentException::~IdComponentException() throw() +{ +} } // namespace H5 diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index 8166d05..926ac2f 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -92,7 +92,9 @@ const FileAccPropList &FileAccPropList::DEFAULT = *getConstant(); ///\brief Creates a file access property list // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) {} +FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) +{ +} //-------------------------------------------------------------------------- // Function: FileAccPropList copy constructor @@ -100,7 +102,9 @@ FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) {} ///\param original - IN: FileAccPropList instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileAccPropList::FileAccPropList(const FileAccPropList &original) : PropList(original) {} +FileAccPropList::FileAccPropList(const FileAccPropList &original) : PropList(original) +{ +} //-------------------------------------------------------------------------- // Function: FileAccPropList overloaded constructor @@ -108,7 +112,9 @@ FileAccPropList::FileAccPropList(const FileAccPropList &original) : PropList(ori /// existing one. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) {} +FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) +{ +} //-------------------------------------------------------------------------- // Function: FileAccPropList::setStdio @@ -810,6 +816,8 @@ FileAccPropList::getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_ ///\brief Noop destructor // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileAccPropList::~FileAccPropList() {} +FileAccPropList::~FileAccPropList() +{ +} } // namespace H5 diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index d3b214b..b9be563 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -84,7 +84,9 @@ const FileCreatPropList &FileCreatPropList::DEFAULT = *getConstant(); ///\brief Default constructor: Creates a file create property list // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) {} +FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) +{ +} //-------------------------------------------------------------------------- // Function: FileCreatPropList copy constructor @@ -93,7 +95,9 @@ FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) {} ///\param original - IN: FileCreatPropList instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileCreatPropList::FileCreatPropList(const FileCreatPropList &original) : PropList(original) {} +FileCreatPropList::FileCreatPropList(const FileCreatPropList &original) : PropList(original) +{ +} //-------------------------------------------------------------------------- // Function: FileCreatPropList overloaded constructor @@ -102,7 +106,9 @@ FileCreatPropList::FileCreatPropList(const FileCreatPropList &original) : PropLi ///\param plist_id - IN: FileCreatPropList id to use // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) {} +FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) +{ +} #ifndef H5_NO_DEPRECATED_SYMBOLS //-------------------------------------------------------------------------- @@ -376,6 +382,8 @@ FileCreatPropList::getFileSpacePagesize() const ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileCreatPropList::~FileCreatPropList() {} +FileCreatPropList::~FileCreatPropList() +{ +} } // namespace H5 diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index e40cafe..9a6f191 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -45,7 +45,9 @@ using std::endl; ///\brief Default constructor: creates a stub H5File object. // December 2000 //-------------------------------------------------------------------------- -H5File::H5File() : Group(), id(H5I_INVALID_HID) {} +H5File::H5File() : Group(), id(H5I_INVALID_HID) +{ +} //-------------------------------------------------------------------------- // Function: H5File overloaded constructor diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp index 58d18a7..33f8377 100644 --- a/c++/src/H5FloatType.cpp +++ b/c++/src/H5FloatType.cpp @@ -40,7 +40,9 @@ namespace H5 { ///\brief Default constructor: Creates a stub floating-point datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType::FloatType() {} +FloatType::FloatType() +{ +} //-------------------------------------------------------------------------- // Function: FloatType overloaded constructor @@ -63,14 +65,18 @@ FloatType::FloatType(const PredType &pred_type) : AtomType() ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType::FloatType(const hid_t existing_id) : AtomType(existing_id) {} +FloatType::FloatType(const hid_t existing_id) : AtomType(existing_id) +{ +} //-------------------------------------------------------------------------- // Function: FloatType copy constructor ///\brief Copy constructor: same HDF5 object as \a original // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType::FloatType(const FloatType &original) : AtomType(original) {} +FloatType::FloatType(const FloatType &original) : AtomType(original) +{ +} //-------------------------------------------------------------------------- // Function: FloatType overloaded constructor @@ -342,6 +348,8 @@ FloatType::setInpad(H5T_pad_t inpad) const ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType::~FloatType() {} +FloatType::~FloatType() +{ +} } // namespace H5 diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 2fc6899..fe791da 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -46,7 +46,9 @@ using std::endl; ///\brief Default constructor: creates a stub Group. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {} +Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) +{ +} //-------------------------------------------------------------------------- // Function: Group copy constructor diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 29a28c6..18bcbd3 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -327,7 +327,9 @@ IdComponent::setId(const hid_t new_id) ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IdComponent::~IdComponent() {} +IdComponent::~IdComponent() +{ +} // // Implementation of protected functions for HDF5 Reference Interface diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index da0ea36..27c4491 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -40,14 +40,18 @@ namespace H5 { ///\brief Default constructor: Creates a stub integer datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType::IntType() {} +IntType::IntType() +{ +} //-------------------------------------------------------------------------- // Function: IntType copy constructor ///\brief Copy constructor: same HDF5 object as \a original // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType::IntType(const IntType &original) : AtomType(original) {} +IntType::IntType(const IntType &original) : AtomType(original) +{ +} //-------------------------------------------------------------------------- // Function: IntType overloaded constructor @@ -70,7 +74,9 @@ IntType::IntType(const PredType &pred_type) : AtomType() ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType::IntType(const hid_t existing_id) : AtomType(existing_id) {} +IntType::IntType(const hid_t existing_id) : AtomType(existing_id) +{ +} //-------------------------------------------------------------------------- // Function: IntType overloaded constructor @@ -192,6 +198,8 @@ IntType::setSign(H5T_sign_t sign) const ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType::~IntType() {} +IntType::~IntType() +{ +} } // namespace H5 diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp index 559c432..feaa555 100644 --- a/c++/src/H5LaccProp.cpp +++ b/c++/src/H5LaccProp.cpp @@ -86,7 +86,9 @@ const LinkAccPropList &LinkAccPropList::DEFAULT = *getConstant(); ///\brief Creates a file access property list // Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- -LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) {} +LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) +{ +} //-------------------------------------------------------------------------- // Function: LinkAccPropList copy constructor @@ -94,7 +96,9 @@ LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) {} ///\param original - IN: LinkAccPropList instance to copy // Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- -LinkAccPropList::LinkAccPropList(const LinkAccPropList &original) : PropList(original) {} +LinkAccPropList::LinkAccPropList(const LinkAccPropList &original) : PropList(original) +{ +} //-------------------------------------------------------------------------- // Function: LinkAccPropList overloaded constructor @@ -102,7 +106,9 @@ LinkAccPropList::LinkAccPropList(const LinkAccPropList &original) : PropList(ori /// existing one. // Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- -LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) {} +LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) +{ +} //-------------------------------------------------------------------------- // Function: LinkAccPropList::setNumLinks @@ -148,6 +154,8 @@ LinkAccPropList::getNumLinks() const ///\brief Noop destructor // Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- -LinkAccPropList::~LinkAccPropList() {} +LinkAccPropList::~LinkAccPropList() +{ +} } // namespace H5 diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp index 8335071..29721c1 100644 --- a/c++/src/H5LcreatProp.cpp +++ b/c++/src/H5LcreatProp.cpp @@ -86,7 +86,9 @@ const LinkCreatPropList &LinkCreatPropList::DEFAULT = *getConstant(); ///\brief Creates a file access property list // December, 2016 //-------------------------------------------------------------------------- -LinkCreatPropList::LinkCreatPropList() : PropList(H5P_LINK_CREATE) {} +LinkCreatPropList::LinkCreatPropList() : PropList(H5P_LINK_CREATE) +{ +} //-------------------------------------------------------------------------- // Function: LinkCreatPropList copy constructor @@ -94,7 +96,9 @@ LinkCreatPropList::LinkCreatPropList() : PropList(H5P_LINK_CREATE) {} ///\param original - IN: LinkCreatPropList instance to copy // December, 2016 //-------------------------------------------------------------------------- -LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList &original) : PropList(original) {} +LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList &original) : PropList(original) +{ +} //-------------------------------------------------------------------------- // Function: LinkCreatPropList overloaded constructor @@ -102,7 +106,9 @@ LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList &original) : PropLi /// existing one. // December, 2016 //-------------------------------------------------------------------------- -LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) {} +LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) +{ +} //-------------------------------------------------------------------------- // Function: LinkCreatPropList::setCreateIntermediateGroup @@ -185,6 +191,8 @@ LinkCreatPropList::getCharEncoding() const ///\brief Noop destructor // December, 2016 //-------------------------------------------------------------------------- -LinkCreatPropList::~LinkCreatPropList() {} +LinkCreatPropList::~LinkCreatPropList() +{ +} } // namespace H5 diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index de15f19..37516be 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -281,14 +281,18 @@ H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_globa ///\brief Default constructor: Creates a stub H5Library object // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Library::H5Library() {} +H5Library::H5Library() +{ +} //-------------------------------------------------------------------------- // Function: H5Library destructor ///\brief Noop destructor // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Library::~H5Library() {} +H5Library::~H5Library() +{ +} #endif // DOXYGEN_SHOULD_SKIP_THIS } // namespace H5 diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index b136faa..065de0c 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -45,7 +45,9 @@ namespace H5 { // Function: H5Location default constructor (protected) // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Location::H5Location() : IdComponent() {} +H5Location::H5Location() : IdComponent() +{ +} //-------------------------------------------------------------------------- // Function: H5Location overloaded constructor (protected) @@ -2432,6 +2434,8 @@ f_DataSpace_setId(DataSpace *dspace, hid_t new_id) ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Location::~H5Location() {} +H5Location::~H5Location() +{ +} } // namespace H5 diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index c2eba8d..71109d3 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -72,7 +72,9 @@ userVisitOpWrpr(H5_ATTR_UNUSED hid_t obj_id, const char *attr_name, const H5O_in // Function: H5Object default constructor (protected) // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Object::H5Object() : H5Location() {} +H5Object::H5Object() : H5Location() +{ +} //-------------------------------------------------------------------------- // Function: f_Attribute_setId - friend @@ -556,7 +558,9 @@ H5Object::getObjName(H5std_string &obj_name, size_t len) const ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Object::~H5Object() {} +H5Object::~H5Object() +{ +} #endif // DOXYGEN_SHOULD_SKIP_THIS } // namespace H5 diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp index 70023c4..81dae31 100644 --- a/c++/src/H5OcreatProp.cpp +++ b/c++/src/H5OcreatProp.cpp @@ -86,7 +86,9 @@ const ObjCreatPropList &ObjCreatPropList::DEFAULT = *getConstant(); ///\brief Creates a file access property list // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) {} +ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) +{ +} //-------------------------------------------------------------------------- // Function: ObjCreatPropList copy constructor @@ -94,7 +96,9 @@ ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) {} ///\param original - IN: ObjCreatPropList instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList &original) : PropList(original) {} +ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList &original) : PropList(original) +{ +} //-------------------------------------------------------------------------- // Function: ObjCreatPropList overloaded constructor @@ -102,7 +106,9 @@ ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList &original) : PropList( /// existing one. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) {} +ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) +{ +} //-------------------------------------------------------------------------- // Function: ObjCreatPropList::setAttrPhaseChange @@ -209,6 +215,8 @@ ObjCreatPropList::getAttrCrtOrder() const ///\brief Noop destructor // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -ObjCreatPropList::~ObjCreatPropList() {} +ObjCreatPropList::~ObjCreatPropList() +{ +} } // namespace H5 diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index b58569f..9e67968 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -42,14 +42,19 @@ namespace H5 { // the provided HDF5 predefined datatype. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) { id = H5Tcopy(predtype_id); } +PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) +{ + id = H5Tcopy(predtype_id); +} //-------------------------------------------------------------------------- // Function: PredType default constructor ///\brief Default constructor: Creates a stub predefined datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PredType::PredType() : AtomType() {} +PredType::PredType() : AtomType() +{ +} #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -58,7 +63,9 @@ PredType::PredType() : AtomType() {} ///\param original - IN: PredType instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PredType::PredType(const PredType &original) : AtomType(original) {} +PredType::PredType(const PredType &original) : AtomType(original) +{ +} //-------------------------------------------------------------------------- // Function: PredType::operator= @@ -109,7 +116,9 @@ PredType::committed() ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PredType::~PredType() {} +PredType::~PredType() +{ +} /***************************************************************************** The following section is regarding the global constants PredType, diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index c4eda5e..28ab44e 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -87,7 +87,9 @@ const PropList &PropList::DEFAULT = *getConstant(); ///\brief Default constructor: creates a stub property list object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {} +PropList::PropList() : IdComponent(), id(H5P_DEFAULT) +{ +} //-------------------------------------------------------------------------- // Function: PropList copy constructor diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index 473cab3..5df48f3 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -41,7 +41,9 @@ namespace H5 { ///\brief Default constructor: Creates a stub string datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::StrType() : AtomType() {} +StrType::StrType() : AtomType() +{ +} //-------------------------------------------------------------------------- // Function: StrType overloaded constructor @@ -118,14 +120,18 @@ StrType::StrType(H5_ATTR_UNUSED const int dummy, const size_t &size) : AtomType( ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::StrType(const hid_t existing_id) : AtomType(existing_id) {} +StrType::StrType(const hid_t existing_id) : AtomType(existing_id) +{ +} //-------------------------------------------------------------------------- // Function: StrType copy constructor ///\brief Copy constructor: same HDF5 object as \a original // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::StrType(const StrType &original) : AtomType(original) {} +StrType::StrType(const StrType &original) : AtomType(original) +{ +} //-------------------------------------------------------------------------- // Function: StrType overloaded constructor @@ -302,6 +308,8 @@ StrType::setStrpad(H5T_str_t strpad) const ///\brief Properly terminates access to this string datatype. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::~StrType() {} +StrType::~StrType() +{ +} } // namespace H5 diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp index 2851cc0..0270feb 100644 --- a/c++/src/H5VarLenType.cpp +++ b/c++/src/H5VarLenType.cpp @@ -33,7 +33,9 @@ namespace H5 { // Function: VarLenType default constructor ///\brief Default constructor: Creates a stub variable-length datatype. //-------------------------------------------------------------------------- -VarLenType::VarLenType() : DataType() {} +VarLenType::VarLenType() : DataType() +{ +} //-------------------------------------------------------------------------- // Function: VarLenType overloaded constructor @@ -42,14 +44,18 @@ VarLenType::VarLenType() : DataType() {} ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) {} +VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) +{ +} //-------------------------------------------------------------------------- // Function: VarLenType copy constructor ///\brief Copy constructor: same HDF5 object as \a original // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -VarLenType::VarLenType(const VarLenType &original) : DataType(original) {} +VarLenType::VarLenType(const VarLenType &original) : DataType(original) +{ +} //-------------------------------------------------------------------------- // Function: VarLenType overloaded constructor @@ -153,6 +159,8 @@ VarLenType::decode() const ///\brief Properly terminates access to this datatype. // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -VarLenType::~VarLenType() {} +VarLenType::~VarLenType() +{ +} } // namespace H5 diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 38f9300..78169b2 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -200,7 +200,9 @@ verify_val(const char *x, const char *value, const char *where, int line, const //-------------------------------------------------------------------------- // Function: InvalidActionException default constructor //-------------------------------------------------------------------------- -InvalidActionException::InvalidActionException() : Exception() {} +InvalidActionException::InvalidActionException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: InvalidActionException overloaded constructor @@ -220,12 +222,16 @@ InvalidActionException::InvalidActionException(const H5std_string &func, const H //-------------------------------------------------------------------------- // Function: InvalidActionException destructor //-------------------------------------------------------------------------- -InvalidActionException::~InvalidActionException() throw() {} +InvalidActionException::~InvalidActionException() throw() +{ +} //-------------------------------------------------------------------------- // Function: TestFailedException default constructor //-------------------------------------------------------------------------- -TestFailedException::TestFailedException() : Exception() {} +TestFailedException::TestFailedException() : Exception() +{ +} //-------------------------------------------------------------------------- // Function: TestFailedException overloaded constructor @@ -245,4 +251,6 @@ TestFailedException::TestFailedException(const H5std_string &func, const H5std_s //-------------------------------------------------------------------------- // Function: TestFailedException destructor //-------------------------------------------------------------------------- -TestFailedException::~TestFailedException() throw() {} +TestFailedException::~TestFailedException() throw() +{ +} diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp index eca3ed1..0f47b0d 100644 --- a/hl/c++/src/H5PacketTable.cpp +++ b/hl/c++/src/H5PacketTable.cpp @@ -32,15 +32,24 @@ * Opens an existing packet table, which can contain either fixed-length or * variable-length packets. */ -PacketTable::PacketTable(hid_t fileID, const char *name) { table_id = H5PTopen(fileID, name); } +PacketTable::PacketTable(hid_t fileID, const char *name) +{ + table_id = H5PTopen(fileID, name); +} /* "Open" Constructor - will be deprecated because of char* name */ -PacketTable::PacketTable(hid_t fileID, char *name) { table_id = H5PTopen(fileID, name); } +PacketTable::PacketTable(hid_t fileID, char *name) +{ + table_id = H5PTopen(fileID, name); +} /* Destructor * Cleans up the packet table */ -PacketTable::~PacketTable() { H5PTclose(table_id); } +PacketTable::~PacketTable() +{ + H5PTclose(table_id); +} /* IsValid * Returns true if this packet table is valid, false otherwise. @@ -206,10 +215,14 @@ FL_PacketTable::FL_PacketTable(hid_t fileID, char *name, hid_t dtypeID, hsize_t * Opens an existing fixed-length packet table. * Fails if the packet table specified is variable-length. */ -FL_PacketTable::FL_PacketTable(hid_t fileID, const char *name) : PacketTable(fileID, name) {} +FL_PacketTable::FL_PacketTable(hid_t fileID, const char *name) : PacketTable(fileID, name) +{ +} /* "Open" Constructor - will be deprecated because of char* name */ -FL_PacketTable::FL_PacketTable(hid_t fileID, char *name) : PacketTable(fileID, name) {} +FL_PacketTable::FL_PacketTable(hid_t fileID, char *name) : PacketTable(fileID, name) +{ +} /* AppendPacket * Adds a single packet to the packet table. Takes a pointer diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index 825caf7..a73b4c9 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -33,7 +33,10 @@ class H5_HLCPPDLL PacketTable { /* Null constructor * Sets table_id to "invalid" */ - PacketTable() { table_id = H5I_BADID; } + PacketTable() + { + table_id = H5I_BADID; + } /* "Open" Constructor * Opens an existing packet table, which can contain either fixed-length or @@ -163,7 +166,9 @@ class H5_HLCPPDLL FL_PacketTable : virtual public PacketTable { /* Destructor * Cleans up the packet table */ - virtual ~FL_PacketTable() {} + virtual ~FL_PacketTable() + { + } /* AppendPacket * Adds a single packet to the packet table. Takes a pointer diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 47c6562..2600367 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -191,7 +191,10 @@ TestCompoundDatatype() error: - H5E_BEGIN_TRY { H5Tclose(dtypeID); } + H5E_BEGIN_TRY + { + H5Tclose(dtypeID); + } H5E_END_TRY; H5_FAILED(); diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 00feb4a..2bd4046 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -2215,7 +2215,10 @@ H5DS_get_REFLIST_type(void) return ntid_t; out: - H5E_BEGIN_TRY { H5Tclose(ntid_t); } + H5E_BEGIN_TRY + { + H5Tclose(ntid_t); + } H5E_END_TRY; return FAIL; } diff --git a/hl/src/H5LD.c b/hl/src/H5LD.c index 1307fda..8bfd0d6 100644 --- a/hl/src/H5LD.c +++ b/hl/src/H5LD.c @@ -303,7 +303,10 @@ H5LD_get_dset_dims(hid_t did, hsize_t *cur_dims) ret_value = SUCCEED; done: - H5E_BEGIN_TRY { H5Sclose(sid); } + H5E_BEGIN_TRY + { + H5Sclose(sid); + } H5E_END_TRY; return (ret_value); diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index d1d3648..fbd2be0 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -907,7 +907,10 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) return file_id; out: - H5E_BEGIN_TRY { H5Pclose(fapl); } + H5E_BEGIN_TRY + { + H5Pclose(fapl); + } H5E_END_TRY; return -1; } /* end H5LTopen_file_image() */ diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 20e3e82..ead5c65 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -3740,7 +3740,10 @@ match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor_data) return ret; out: - H5E_BEGIN_TRY { H5Sclose(sid); } + H5E_BEGIN_TRY + { + H5Sclose(sid); + } H5E_END_TRY; return FAIL; } diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index f820568..b397a81 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -335,7 +335,10 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) VERIFY(status1 < 0, "H5Dwrite() should have failed"); /* extend dimensions of dataset */ - H5E_BEGIN_TRY { status1 = H5Dset_extent(dset_id[i], dims4); } + H5E_BEGIN_TRY + { + status1 = H5Dset_extent(dset_id[i], dims4); + } H5E_END_TRY; VERIFY(status1 < 0, "H5Dset_extent() should have failed"); diff --git a/hl/test/test_image.c b/hl/test/test_image.c index b71531e..0c7d511 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -301,7 +301,10 @@ out: HDfree(buf1_out); if (buf2_out) HDfree(buf2_out); - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; H5_FAILED(); return FAIL; @@ -488,7 +491,10 @@ out: if (image_data) HDfree(image_data); - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; H5_FAILED(); @@ -720,7 +726,10 @@ out: if (image_data) HDfree(image_data); - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; if (f) HDfclose(f); diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c index 02a56f4..dc5755c 100644 --- a/hl/test/test_ld.c +++ b/hl/test/test_ld.c @@ -252,7 +252,10 @@ test_LD_dims_params(const char *file) /* * 1. Verify failure with negative dataset id */ - H5E_BEGIN_TRY { ret = H5LDget_dset_dims(invalid_id, one_cur_dims); } + H5E_BEGIN_TRY + { + ret = H5LDget_dset_dims(invalid_id, one_cur_dims); + } H5E_END_TRY; VERIFY_EQUAL(ret, FAIL) @@ -261,7 +264,10 @@ test_LD_dims_params(const char *file) */ if ((did = H5Dopen2(fid, DSET_ALLOC_EARLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { ret = H5LDget_dset_dims(did, NULL); } + H5E_BEGIN_TRY + { + ret = H5LDget_dset_dims(did, NULL); + } H5E_END_TRY; VERIFY_EQUAL(ret, FAIL) if (H5Dclose(did) < 0) @@ -536,7 +542,10 @@ test_LD_size(const char *file) /* * Verify failure with an invalid dataset id */ - H5E_BEGIN_TRY { dsize = H5LDget_dset_type_size(invalid_id, NULL); } + H5E_BEGIN_TRY + { + dsize = H5LDget_dset_type_size(invalid_id, NULL); + } H5E_END_TRY; VERIFY_EQUAL(dsize, 0) @@ -916,7 +925,10 @@ test_LD_elmts_invalid(const char *file) */ /* Verify failure from case #1: an invalid dataset id */ - H5E_BEGIN_TRY { ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf); } + H5E_BEGIN_TRY + { + ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf); + } H5E_END_TRY; VERIFY_EQUAL(ret, FAIL) diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index d2afbc4..dd9e5be 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -38,7 +38,10 @@ GetWord(GIFBYTE *MemGif) } GIFBYTE -GetByte(const GIFBYTE *MemGif) { return *MemGif; } +GetByte(const GIFBYTE *MemGif) +{ + return *MemGif; +} /* * Read a GIF image GIFBYTE Header. diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 8ba6cf2..6281481 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -1474,7 +1474,10 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re /* * This function fails if the region does not have blocks. */ - H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region_space); } + H5E_BEGIN_TRY + { + nblocks = H5Sget_select_hyper_nblocks(region_space); + } H5E_END_TRY; if (nblocks <= 0) { @@ -1647,7 +1650,10 @@ h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re /* * This function fails if the region does not have points. */ - H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region_space); } + H5E_BEGIN_TRY + { + npoints = H5Sget_select_elem_npoints(region_space); + } H5E_END_TRY; if (npoints <= 0) { diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 7f65f11..168bbe1 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -281,8 +281,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c H5Eclear2(H5E_DEFAULT); /* Initialize */ - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { /* Treat global heap as raw data, not metadata */ memb_map[mt] = ((mt == H5FD_MEM_DRAW || mt == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : H5FD_MEM_SUPER); memb_fapl[mt] = -1; @@ -588,15 +587,16 @@ H5FD_multi_sb_size(H5FD_t *_file) H5Eclear2(H5E_DEFAULT); /* How many unique files? */ - UNIQUE_MEMBERS(file->fa.memb_map, mt) { nseen++; } + UNIQUE_MEMBERS (file->fa.memb_map, mt) { + nseen++; + } END_MEMBERS; /* Addresses and EOA markers */ nbytes += nseen * 2 * 8; /* Name templates */ - UNIQUE_MEMBERS(file->fa.memb_map, mt) - { + UNIQUE_MEMBERS (file->fa.memb_map, mt) { size_t n = strlen(file->fa.memb_name[mt]) + 1; nbytes += (n + 7) & ~((size_t)0x0007); } @@ -663,8 +663,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out nseen = 0; p = buf + 8; assert(sizeof(haddr_t) <= 8); - UNIQUE_MEMBERS(file->fa.memb_map, mt) - { + UNIQUE_MEMBERS (file->fa.memb_map, mt) { memcpy(p, &(file->fa.memb_addr[mt]), sizeof(haddr_t)); p += sizeof(haddr_t); memb_eoa = H5FDget_eoa(file->memb[mt], mt); @@ -678,8 +677,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out /* Encode all name templates */ p = buf + 8 + nseen * 2 * 8; - UNIQUE_MEMBERS(file->fa.memb_map, mt) - { + 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); p += n; @@ -735,8 +733,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1); /* Set default values */ - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { memb_addr[mt] = HADDR_UNDEF; memb_eoa[mt] = HADDR_UNDEF; memb_name[mt] = NULL; @@ -754,7 +751,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) map_changed = TRUE; } - UNIQUE_MEMBERS(map, mt) { nseen++; } + UNIQUE_MEMBERS (map, mt) { + nseen++; + } END_MEMBERS; buf += 8; @@ -766,16 +765,14 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1); ap = (haddr_t *)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ - UNIQUE_MEMBERS(map, mt) - { + UNIQUE_MEMBERS (map, mt) { memb_addr[_unmapped] = *ap++; memb_eoa[_unmapped] = *ap++; } END_MEMBERS; /* Decode name templates */ - UNIQUE_MEMBERS(map, mt) - { + UNIQUE_MEMBERS (map, mt) { size_t n = strlen((const char *)buf) + 1; memb_name[_unmapped] = (const char *)buf; buf += (n + 7) & ~((unsigned)0x0007); @@ -790,15 +787,18 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) */ if (map_changed) { /* Commit map */ - ALL_MEMBERS(mt) { file->fa.memb_map[mt] = map[mt]; } + ALL_MEMBERS (mt) { + file->fa.memb_map[mt] = map[mt]; + } END_MEMBERS; /* Close files which are unused now */ memset(in_use, 0, sizeof in_use); - UNIQUE_MEMBERS(map, mt) { in_use[mt] = TRUE; } + UNIQUE_MEMBERS (map, mt) { + in_use[mt] = TRUE; + } END_MEMBERS; - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (!in_use[mt] && file->memb[mt]) { (void)H5FDclose(file->memb[mt]); file->memb[mt] = NULL; @@ -809,8 +809,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) } /* Commit member starting addresses and name templates */ - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { file->fa.memb_addr[mt] = memb_addr[mt]; if (memb_name[mt]) { if (file->fa.memb_name[mt]) @@ -827,8 +826,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1); /* Set the EOA marker for all open files */ - UNIQUE_MEMBERS(file->fa.memb_map, mt) - { + UNIQUE_MEMBERS (file->fa.memb_map, mt) { if (file->memb[mt]) if (H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt]) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1); @@ -898,8 +896,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) H5Eclear2(H5E_DEFAULT); memcpy(new_fa, old_fa, sizeof(H5FD_multi_fapl_t)); - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (old_fa->memb_fapl[mt] >= 0) { if (H5Iinc_ref(old_fa->memb_fapl[mt]) < 0) { nerrors++; @@ -918,8 +915,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) END_MEMBERS; if (nerrors) { - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (new_fa->memb_fapl[mt] >= 0) (void)H5Idec_ref(new_fa->memb_fapl[mt]); if (new_fa->memb_name[mt]) @@ -955,8 +951,7 @@ H5FD_multi_fapl_free(void *_fa) /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (fa->memb_fapl[mt] >= 0) if (H5Idec_ref(fa->memb_fapl[mt]) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1); @@ -1018,8 +1013,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr } fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); assert(fa); - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { file->fa.memb_map[mt] = fa->memb_map[mt]; file->fa.memb_addr[mt] = fa->memb_addr[mt]; if (fa->memb_fapl[mt] >= 0) @@ -1055,8 +1049,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr error: /* Cleanup and fail */ if (file) { - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (file->memb[mt]) (void)H5FDclose(file->memb[mt]); if (file->fa.memb_fapl[mt] >= 0) @@ -1099,8 +1092,7 @@ H5FD_multi_close(H5FD_t *_file) H5Eclear2(H5E_DEFAULT); /* Close as many members as possible */ - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (file->memb[mt]) { if (H5FDclose(file->memb[mt]) < 0) { nerrors++; @@ -1115,8 +1107,7 @@ H5FD_multi_close(H5FD_t *_file) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1); /* Clean up other stuff */ - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (file->fa.memb_fapl[mt] >= 0) (void)H5Idec_ref(file->fa.memb_fapl[mt]); if (file->fa.memb_name[mt]) @@ -1158,8 +1149,7 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { out_mt = mt; if (f1->memb[mt] && f2->memb[mt]) break; @@ -1268,13 +1258,15 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) * the query is for TYPE == H5FD_MEM_DEFAULT. */ if (H5FD_MEM_DEFAULT == type) { - UNIQUE_MEMBERS(file->fa.memb_map, mt) - { + UNIQUE_MEMBERS (file->fa.memb_map, mt) { haddr_t memb_eoa; if (file->memb[mt]) { /* Retrieve EOA */ - H5E_BEGIN_TRY { memb_eoa = H5FDget_eoa(file->memb[mt], mt); } + H5E_BEGIN_TRY + { + memb_eoa = H5FDget_eoa(file->memb[mt], mt); + } H5E_END_TRY; if (HADDR_UNDEF == memb_eoa) @@ -1307,7 +1299,10 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) mmt = type; if (file->memb[mmt]) { - H5E_BEGIN_TRY { eoa = H5FDget_eoa(file->memb[mmt], mmt); } + H5E_BEGIN_TRY + { + eoa = H5FDget_eoa(file->memb[mmt], mmt); + } H5E_END_TRY; if (HADDR_UNDEF == eoa) @@ -1385,7 +1380,10 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) assert(eoa >= file->fa.memb_addr[mmt]); assert(eoa < file->memb_next[mmt]); - H5E_BEGIN_TRY { status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); } + H5E_BEGIN_TRY + { + status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); + } H5E_END_TRY; if (status < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1); @@ -1421,13 +1419,15 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) H5Eclear2(H5E_DEFAULT); if (H5FD_MEM_DEFAULT == type) { - UNIQUE_MEMBERS(file->fa.memb_map, mt) - { + UNIQUE_MEMBERS (file->fa.memb_map, mt) { haddr_t tmp_eof; if (file->memb[mt]) { /* Retrieve EOF */ - H5E_BEGIN_TRY { tmp_eof = H5FDget_eof(file->memb[mt], type); } + H5E_BEGIN_TRY + { + tmp_eof = H5FDget_eof(file->memb[mt], type); + } H5E_END_TRY; if (HADDR_UNDEF == tmp_eof) @@ -1460,7 +1460,10 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) if (file->memb[mmt]) { /* Retrieve EOF */ - H5E_BEGIN_TRY { eof = H5FDget_eof(file->memb[mmt], mmt); } + H5E_BEGIN_TRY + { + eof = H5FDget_eof(file->memb[mmt], mmt); + } H5E_END_TRY; if (HADDR_UNDEF == eof) @@ -1544,8 +1547,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* XXX: NEED to work on this again */ if (file->pub.paged_aggr) { - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (file->memb[mt]) file->memb[mt]->paged_aggr = file->pub.paged_aggr; } @@ -1840,8 +1842,7 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) H5Eclear2(H5E_DEFAULT); /* Lock all member files */ - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { out_mt = mt; if (file->memb[mt]) { H5E_BEGIN_TRY @@ -1900,8 +1901,7 @@ H5FD_multi_unlock(H5FD_t *_file) /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - ALL_MEMBERS(mt) - { + ALL_MEMBERS (mt) { if (file->memb[mt]) if (H5FDunlock(file->memb[mt]) < 0) nerrors++; @@ -1935,11 +1935,12 @@ compute_next(H5FD_multi_t *file) /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - ALL_MEMBERS(mt) { file->memb_next[mt] = HADDR_UNDEF; } + ALL_MEMBERS (mt) { + file->memb_next[mt] = HADDR_UNDEF; + } END_MEMBERS; - UNIQUE_MEMBERS(file->fa.memb_map, mt1) - { + UNIQUE_MEMBERS (file->fa.memb_map, mt1) { UNIQUE_MEMBERS2(file->fa.memb_map, mt2) { if (file->fa.memb_addr[mt1] < file->fa.memb_addr[mt2] && @@ -1988,8 +1989,7 @@ open_members(H5FD_multi_t *file) /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - UNIQUE_MEMBERS(file->fa.memb_map, mt) - { + UNIQUE_MEMBERS (file->fa.memb_map, mt) { if (file->memb[mt]) continue; /*already open*/ assert(file->fa.memb_name[mt]); @@ -1999,7 +1999,10 @@ open_members(H5FD_multi_t *file) sprintf(tmp, file->fa.memb_name[mt], file->name); tmp[sizeof(tmp) - 1] = '\0'; - H5E_BEGIN_TRY { file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); } + H5E_BEGIN_TRY + { + file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); + } H5E_END_TRY; if (!file->memb[mt]) { if (!file->fa.relax || (file->flags & H5F_ACC_RDWR)) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 3001644..e7a3b53 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -377,7 +377,10 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Try detecting file's siganture */ /* (Don't leave before Bcast, to avoid hang on error) */ - H5E_BEGIN_TRY { status = H5FD_locate_signature(file, &super_addr); } + H5E_BEGIN_TRY + { + status = H5FD_locate_signature(file, &super_addr); + } H5E_END_TRY; /* Set superblock address to undefined on error */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index c73bfd7..453796e 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -1087,7 +1087,10 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5 /* Get information about link to the object. If this fails, e.g. * because the object is ".", just treat the object as a hard link. */ - H5E_BEGIN_TRY { ret = H5L_get_info(loc, name, &linfo); } + H5E_BEGIN_TRY + { + ret = H5L_get_info(loc, name, &linfo); + } H5E_END_TRY; if (ret >= 0 && linfo.type != H5L_TYPE_HARD) { diff --git a/src/H5Iint.c b/src/H5Iint.c index a025331..41c6316 100644 --- a/src/H5Iint.c +++ b/src/H5Iint.c @@ -461,7 +461,10 @@ H5I__destroy_type(H5I_type_t type) HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") /* Close/clear/destroy all IDs for this type */ - H5E_BEGIN_TRY { H5I_clear_type(type, TRUE, FALSE); } + H5E_BEGIN_TRY + { + H5I_clear_type(type, TRUE, FALSE); + } H5E_END_TRY /* don't care about errors */ /* Check if we should release the ID class */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 0768d11..d08d892 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -96,19 +96,31 @@ #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT \ { \ - H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT } \ + H5D_COMPACT, \ + { \ + .compact = H5D_DEF_STORAGE_COMPACT_INIT \ + } \ } #define H5D_DEF_STORAGE_CONTIG \ { \ - H5D_CONTIGUOUS, { .contig = H5D_DEF_STORAGE_CONTIG_INIT } \ + H5D_CONTIGUOUS, \ + { \ + .contig = H5D_DEF_STORAGE_CONTIG_INIT \ + } \ } #define H5D_DEF_STORAGE_CHUNK \ { \ - H5D_CHUNKED, { .chunk = H5D_DEF_STORAGE_CHUNK_INIT } \ + H5D_CHUNKED, \ + { \ + .chunk = H5D_DEF_STORAGE_CHUNK_INIT \ + } \ } #define H5D_DEF_STORAGE_VIRTUAL \ { \ - H5D_VIRTUAL, { .virt = H5D_DEF_STORAGE_VIRTUAL_INIT } \ + H5D_VIRTUAL, \ + { \ + .virt = H5D_DEF_STORAGE_VIRTUAL_INIT \ + } \ } #define H5D_DEF_LAYOUT_COMPACT \ { \ diff --git a/test/btree2.c b/test/btree2.c index cea6f78..aca0c77 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -676,7 +676,10 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* Attempt to index record in B-tree with no records */ idx = 0; - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -731,7 +734,10 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* Attempt to index non-existant record in B-tree with 1 record */ idx = 0; - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, find_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, find_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -793,7 +799,10 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* Attempt to index non-existant record in B-tree with several records */ idx = 0; - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, find_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, find_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -3120,12 +3129,18 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); } /* end for */ /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY * 3), find_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY * 3), find_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) TEST_ERROR - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY * 3), find_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY * 3), find_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -3156,7 +3171,10 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); TEST_ERROR record = INSERT_MANY / 2; - H5E_BEGIN_TRY { ret = H5B2_insert(bt2, &record); } + H5E_BEGIN_TRY + { + ret = H5B2_insert(bt2, &record); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -3288,7 +3306,10 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ TEST_ERROR /* Attempt to index non-existant record in B-tree with 1 record */ - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -3362,7 +3383,10 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ TEST_ERROR /* Attempt to index non-existant record in B-tree with 1 record */ - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -3436,7 +3460,10 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ TEST_ERROR /* Attempt to index non-existant record in B-tree with several records */ - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -3527,7 +3554,10 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ TEST_ERROR /* Attempt to index non-existant record in B-tree with several records */ - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -5187,12 +5217,18 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); } /* end for */ /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) TEST_ERROR - H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -5330,7 +5366,10 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* Attempt to remove a record from a B-tree with no records */ record = 0; - H5E_BEGIN_TRY { ret = H5B2_remove(bt2, &record, NULL, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_remove(bt2, &record, NULL, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -5367,7 +5406,10 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* Attempt to remove a non-existant record from a B-tree with 1 record */ record = 0; - H5E_BEGIN_TRY { ret = H5B2_remove(bt2, &record, NULL, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_remove(bt2, &record, NULL, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -5448,7 +5490,10 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ TEST_ERROR record = 0; - H5E_BEGIN_TRY { ret = H5B2_remove(bt2, &record, NULL, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_remove(bt2, &record, NULL, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -5650,7 +5695,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, const bt /* Attempt to remove a non-existant record from a B-tree with 1 record */ record = (INSERT_SPLIT_ROOT_NREC * 2) + 1; - H5E_BEGIN_TRY { ret = H5B2_remove(bt2, &record, NULL, NULL); } + H5E_BEGIN_TRY + { + ret = H5B2_remove(bt2, &record, NULL, NULL); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -9229,7 +9277,10 @@ test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param /* Attempt to find record B-tree less than a value */ search = 0; - H5E_BEGIN_TRY { ret = H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record); } + H5E_BEGIN_TRY + { + ret = H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -9306,7 +9357,10 @@ test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param /* Attempt to find record B-tree less than a value */ search = (FIND_NEIGHBOR * 2) + 1; - H5E_BEGIN_TRY { ret = H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record); } + H5E_BEGIN_TRY + { + ret = H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -9721,7 +9775,10 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tpa /* Attempt to modify a non-existant record */ record = 3; modify = 4; - H5E_BEGIN_TRY { ret = H5B2_modify(bt2, &record, modify_cb, &modify); } + H5E_BEGIN_TRY + { + ret = H5B2_modify(bt2, &record, modify_cb, &modify); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -9769,7 +9826,10 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tpa /* Attempt to find original record */ record = 4330; found = HSIZET_MAX; - H5E_BEGIN_TRY { ret = H5B2_modify(bt2, &record, modify_cb, &modify); } + H5E_BEGIN_TRY + { + ret = H5B2_modify(bt2, &record, modify_cb, &modify); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -9817,7 +9877,10 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tpa /* Attempt to find original record */ record = 5350; found = 5350; - H5E_BEGIN_TRY { ret = H5B2_modify(bt2, &record, modify_cb, &modify); } + H5E_BEGIN_TRY + { + ret = H5B2_modify(bt2, &record, modify_cb, &modify); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -9865,7 +9928,10 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tpa /* Attempt to find original record */ record = 9445; found = 9445; - H5E_BEGIN_TRY { ret = H5B2_modify(bt2, &record, modify_cb, &modify); } + H5E_BEGIN_TRY + { + ret = H5B2_modify(bt2, &record, modify_cb, &modify); + } H5E_END_TRY; /* Should fail */ if (ret != FAIL) @@ -10185,7 +10251,10 @@ main(void) error: HDputs("*** TESTS FAILED ***"); - H5E_BEGIN_TRY { H5Pclose(fapl); } + H5E_BEGIN_TRY + { + H5Pclose(fapl); + } H5E_END_TRY; if (api_ctx_pushed) diff --git a/test/cache_api.c b/test/cache_api.c index c7c109c..75e1b9d 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -1699,7 +1699,10 @@ check_fapl_mdc_api_errs(void) scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if (pass) { - H5E_BEGIN_TRY { result = H5Pget_mdc_config((hid_t)-1, &scratch); } + H5E_BEGIN_TRY + { + result = H5Pget_mdc_config((hid_t)-1, &scratch); + } H5E_END_TRY; if (result >= 0) { @@ -1734,7 +1737,10 @@ check_fapl_mdc_api_errs(void) if (pass) { - H5E_BEGIN_TRY { result = H5Pget_mdc_config(fapl_id, NULL); } + H5E_BEGIN_TRY + { + result = H5Pget_mdc_config(fapl_id, NULL); + } H5E_END_TRY; if (result >= 0) { @@ -1749,7 +1755,10 @@ check_fapl_mdc_api_errs(void) scratch.version = -1; /* a convenient, invalid value */ if (pass) { - H5E_BEGIN_TRY { result = H5Pget_mdc_config(fapl_id, &scratch); } + H5E_BEGIN_TRY + { + result = H5Pget_mdc_config(fapl_id, &scratch); + } H5E_END_TRY; if (result >= 0) { @@ -1765,7 +1774,10 @@ check_fapl_mdc_api_errs(void) scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if (pass) { - H5E_BEGIN_TRY { result = H5Pset_mdc_config((hid_t)-1, &default_config); } + H5E_BEGIN_TRY + { + result = H5Pset_mdc_config((hid_t)-1, &default_config); + } H5E_END_TRY; if (result >= 0) { @@ -1777,7 +1789,10 @@ check_fapl_mdc_api_errs(void) if (pass) { - H5E_BEGIN_TRY { result = H5Pset_mdc_config(fapl_id, NULL); } + H5E_BEGIN_TRY + { + result = H5Pset_mdc_config(fapl_id, NULL); + } H5E_END_TRY; if (result >= 0) { @@ -1789,7 +1804,10 @@ check_fapl_mdc_api_errs(void) i = 0; while ((pass) && (i < NUM_INVALID_CONFIGS)) { - H5E_BEGIN_TRY { result = H5Pset_mdc_config(fapl_id, &(invalid_configs[i])); } + H5E_BEGIN_TRY + { + result = H5Pset_mdc_config(fapl_id, &(invalid_configs[i])); + } H5E_END_TRY; if (result >= 0) { @@ -1914,7 +1932,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", FUNC); } - H5E_BEGIN_TRY { result = H5Fget_mdc_config((hid_t)-1, &scratch); } + H5E_BEGIN_TRY + { + result = H5Fget_mdc_config((hid_t)-1, &scratch); + } H5E_END_TRY; if (result >= 0) { @@ -1931,7 +1952,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", FUNC); } - H5E_BEGIN_TRY { result = H5Fget_mdc_config(file_id, NULL); } + H5E_BEGIN_TRY + { + result = H5Fget_mdc_config(file_id, NULL); + } H5E_END_TRY; if (result >= 0) { @@ -1949,7 +1973,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", FUNC); } - H5E_BEGIN_TRY { result = H5Fget_mdc_config(file_id, &scratch); } + H5E_BEGIN_TRY + { + result = H5Fget_mdc_config(file_id, &scratch); + } H5E_END_TRY; if (result >= 0) { @@ -1969,7 +1996,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", FUNC); } - H5E_BEGIN_TRY { result = H5Fset_mdc_config((hid_t)-1, &default_config); } + H5E_BEGIN_TRY + { + result = H5Fset_mdc_config((hid_t)-1, &default_config); + } H5E_END_TRY; if (result >= 0) { @@ -1986,7 +2016,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", FUNC); } - H5E_BEGIN_TRY { result = H5Fset_mdc_config(file_id, NULL); } + H5E_BEGIN_TRY + { + result = H5Fset_mdc_config(file_id, NULL); + } H5E_END_TRY; if (result >= 0) { @@ -2003,7 +2036,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Fset_mdc_config() with invalid config %d.\n", FUNC, i); } - H5E_BEGIN_TRY { result = H5Fset_mdc_config(file_id, &(invalid_configs[i])); } + H5E_BEGIN_TRY + { + result = H5Fset_mdc_config(file_id, &(invalid_configs[i])); + } H5E_END_TRY; if (result >= 0) { @@ -2028,7 +2064,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", FUNC); } - H5E_BEGIN_TRY { result = H5Fget_mdc_hit_rate((hid_t)-1, &hit_rate); } + H5E_BEGIN_TRY + { + result = H5Fget_mdc_hit_rate((hid_t)-1, &hit_rate); + } H5E_END_TRY; if (result >= 0) { @@ -2045,7 +2084,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", FUNC); } - H5E_BEGIN_TRY { result = H5Fget_mdc_hit_rate(file_id, NULL); } + H5E_BEGIN_TRY + { + result = H5Fget_mdc_hit_rate(file_id, NULL); + } H5E_END_TRY; if (result >= 0) { @@ -2063,7 +2105,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", FUNC); } - H5E_BEGIN_TRY { result = H5Freset_mdc_hit_rate_stats((hid_t)-1); } + H5E_BEGIN_TRY + { + result = H5Freset_mdc_hit_rate_stats((hid_t)-1); + } H5E_END_TRY; if (result >= 0) { diff --git a/test/cache_image.c b/test/cache_image.c index 5eee99d..40d6f05 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -940,7 +940,10 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, const hbool_t set_mdci_fa } else { - H5E_BEGIN_TRY { file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl_id); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl_id); + } H5E_END_TRY; } diff --git a/test/chunk_info.c b/test/chunk_info.c index 6f71cb2..ada2d80 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -1725,7 +1725,10 @@ test_failed_attempts(const char *filename, hid_t fapl) TEST_ERROR /* Attempt to get the number of chunks on contiguous dataset, should fail */ - H5E_BEGIN_TRY { ret = H5Dget_num_chunks(dset, dspace, &nchunks); } + H5E_BEGIN_TRY + { + ret = H5Dget_num_chunks(dset, dspace, &nchunks); + } H5E_END_TRY; if (ret != FAIL) FAIL_PUTS_ERROR(" Attempt a chunk query function on a contiguous dataset.") @@ -1745,7 +1748,10 @@ test_failed_attempts(const char *filename, hid_t fapl) * dataset, should fail */ offset[0] = 0; offset[1] = 0; - H5E_BEGIN_TRY { ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size); } + H5E_BEGIN_TRY + { + ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; if (ret != FAIL) FAIL_PUTS_ERROR(" Attempt a chunk query function on a contiguous dataset.") diff --git a/test/cork.c b/test/cork.c index 1b8b476..80934ad 100644 --- a/test/cork.c +++ b/test/cork.c @@ -1469,19 +1469,28 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Should fail to cork the attribute: aidg2; not an object */ - H5E_BEGIN_TRY { ret = H5Odisable_mdc_flushes(aidg2); } + H5E_BEGIN_TRY + { + ret = H5Odisable_mdc_flushes(aidg2); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR /* Should fail to uncork the attribute: aidd1; not an object */ - H5E_BEGIN_TRY { ret = H5Odisable_mdc_flushes(aidd1); } + H5E_BEGIN_TRY + { + ret = H5Odisable_mdc_flushes(aidd1); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR /* Should fail to check cork status of the attribute: aidt2; not an object */ - H5E_BEGIN_TRY { ret = H5Oare_mdc_flushes_disabled(aidt2, &corked); } + H5E_BEGIN_TRY + { + ret = H5Oare_mdc_flushes_disabled(aidt2, &corked); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -1511,7 +1520,10 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Should fail to uncork the file: fid2; not an object */ - H5E_BEGIN_TRY { ret = H5Oenable_mdc_flushes(fid2); } + H5E_BEGIN_TRY + { + ret = H5Oenable_mdc_flushes(fid2); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -1646,7 +1658,10 @@ test_objs_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Should fail to cork the datatype: not an object */ - H5E_BEGIN_TRY { ret = H5Odisable_mdc_flushes(tid); } + H5E_BEGIN_TRY + { + ret = H5Odisable_mdc_flushes(tid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -1682,7 +1697,10 @@ test_objs_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Should fail to uncork the dataspace: not an object */ - H5E_BEGIN_TRY { ret = H5Oenable_mdc_flushes(sid); } + H5E_BEGIN_TRY + { + ret = H5Oenable_mdc_flushes(sid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -1696,7 +1714,10 @@ test_objs_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Should fail to check cork status of the attribute: not an object */ - H5E_BEGIN_TRY { ret = H5Oare_mdc_flushes_disabled(aid, &corked); } + H5E_BEGIN_TRY + { + ret = H5Oare_mdc_flushes_disabled(aid, &corked); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -1736,7 +1757,10 @@ test_objs_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Should fail to cork the group again */ - H5E_BEGIN_TRY { ret = H5Odisable_mdc_flushes(gid); } + H5E_BEGIN_TRY + { + ret = H5Odisable_mdc_flushes(gid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -1758,7 +1782,10 @@ test_objs_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Should fail to un-cork the named datatype that is not corked yet */ - H5E_BEGIN_TRY { ret = H5Oenable_mdc_flushes(tid); } + H5E_BEGIN_TRY + { + ret = H5Oenable_mdc_flushes(tid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR diff --git a/test/cross_read.c b/test/cross_read.c index d2f74b6..386c0da 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -121,7 +121,10 @@ check_data_i(const char *dsetname, hid_t fid) return 0; error: - H5E_BEGIN_TRY { H5Dclose(did); } + H5E_BEGIN_TRY + { + H5Dclose(did); + } H5E_END_TRY; return 1; } /* end check_data_i() */ @@ -192,7 +195,10 @@ check_data_f(const char *dsetname, hid_t fid) return 0; error: - H5E_BEGIN_TRY { H5Dclose(did); } + H5E_BEGIN_TRY + { + H5Dclose(did); + } H5E_END_TRY; return 1; } /* end check_data_f() */ @@ -321,7 +327,10 @@ check_file(char *filename) return nerrors; error: - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; return nerrors; } /* end check_file() */ diff --git a/test/dangle.c b/test/dangle.c index a1f5c45..d41507b 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -176,7 +176,10 @@ test_dangle_group(H5F_close_degree_t degree) TEST_ERROR; /* Try creating duplicate group */ - H5E_BEGIN_TRY { gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (gid >= 0) TEST_ERROR diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 237c70d..61e3df9 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -2026,7 +2026,10 @@ test_read_unallocated_chunk(hid_t file) offset[1] = j * CHUNK_NY; /* Read a non-existant chunk using the direct read function. */ - H5E_BEGIN_TRY { status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, &direct_buf); } + H5E_BEGIN_TRY + { + status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, &direct_buf); + } H5E_END_TRY; /* Check that the chunk read call does not succeed. */ @@ -2035,7 +2038,10 @@ test_read_unallocated_chunk(hid_t file) /* Query the size of the non-existant chunk */ direct_chunk_nbytes = ULONG_MAX; - H5E_BEGIN_TRY { status = H5Dget_chunk_storage_size(dataset, offset, &direct_chunk_nbytes); } + H5E_BEGIN_TRY + { + status = H5Dget_chunk_storage_size(dataset, offset, &direct_chunk_nbytes); + } H5E_END_TRY; /* Check that the chunk storage size call does not succeed. */ diff --git a/test/dsets.c b/test/dsets.c index 7ca076f..e38f253 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -434,7 +434,10 @@ test_create(hid_t file) * cannot be created with this function. Temporarily turn off error * reporting. */ - H5E_BEGIN_TRY { dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT); + } H5E_END_TRY; if (dataset >= 0) { H5_FAILED(); @@ -929,7 +932,10 @@ test_compact_io(hid_t fapl) for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ @@ -1450,7 +1456,10 @@ test_conv_buffer(hid_t fid) if (H5Pset_buffer(xfer_list, size, NULL, NULL) < 0) goto error; - H5E_BEGIN_TRY { status = H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -1981,7 +1990,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if (corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ - H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + } H5E_END_TRY; if (status >= 0) TEST_ERROR; @@ -1996,7 +2008,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if (H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ - H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + } H5E_END_TRY; if (status >= 0) TEST_ERROR; @@ -2042,7 +2057,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if (corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ - H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + } H5E_END_TRY; if (status >= 0) TEST_ERROR; @@ -2057,7 +2075,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if (H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ - H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + } H5E_END_TRY; if (status >= 0) TEST_ERROR; @@ -2100,7 +2121,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if (corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ - H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + } H5E_END_TRY; if (status >= 0) TEST_ERROR; @@ -2116,7 +2140,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ - H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + } H5E_END_TRY; if (status >= 0) TEST_ERROR; @@ -2161,7 +2188,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if (corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ - H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + } H5E_END_TRY; if (status >= 0) TEST_ERROR; @@ -2176,7 +2206,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if (H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ - H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } + H5E_BEGIN_TRY + { + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + } H5E_END_TRY; if (status >= 0) TEST_ERROR; @@ -2317,7 +2350,10 @@ test_filter_noencoder(const char *dset_name) * allocation. */ dims = 20; /* Dataset is originally of size 10 */ - H5E_BEGIN_TRY { err = H5Dset_extent(dset_id, &dims); } + H5E_BEGIN_TRY + { + err = H5Dset_extent(dset_id, &dims); + } H5E_END_TRY if (err >= 0) @@ -2326,7 +2362,10 @@ test_filter_noencoder(const char *dset_name) /* Attempt to write to the dataset. This should fail because * the filter does not have an encoder. */ - H5E_BEGIN_TRY { err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints); } + H5E_BEGIN_TRY + { + err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints); + } H5E_END_TRY if (err >= 0) @@ -2419,7 +2458,10 @@ test_get_filter_info(void) /* Verify that get_filter_info throws an error when given a bad filter */ /* (Depends on 1.6 compatibility flag) */ - H5E_BEGIN_TRY { err = H5Zget_filter_info(-1, &flags); } + H5E_BEGIN_TRY + { + err = H5Zget_filter_info(-1, &flags); + } H5E_END_TRY; if (err >= 0) TEST_ERROR @@ -2966,7 +3008,10 @@ test_missing_filter(hid_t file) } /* end if */ /* Read data (should fail, since deflate filter is missing) */ - H5E_BEGIN_TRY { ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data); } + H5E_BEGIN_TRY + { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -6287,7 +6332,10 @@ test_can_apply_szip(hid_t /* Set (invalid at property set time) szip parameters */ szip_pixels_per_block = 3; - H5E_BEGIN_TRY { ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block); } + H5E_BEGIN_TRY + { + ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -6297,7 +6345,10 @@ test_can_apply_szip(hid_t /* Set (invalid at property set time) szip parameters */ szip_pixels_per_block = 512; - H5E_BEGIN_TRY { ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block); } + H5E_BEGIN_TRY + { + ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -7052,7 +7103,10 @@ test_filter_delete(hid_t file) } /* end if */ /* try to delete the deflate filter again */ - H5E_BEGIN_TRY { ret = H5Premove_filter(dcpl1, H5Z_FILTER_DEFLATE); } + H5E_BEGIN_TRY + { + ret = H5Premove_filter(dcpl1, H5Z_FILTER_DEFLATE); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -7337,7 +7391,10 @@ test_zero_dims(hid_t file) } /* end if */ /* Try creating chunked dataset with zero-sized chunk dimensions */ - H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl, 1, &dzero); } + H5E_BEGIN_TRY + { + ret = H5Pset_chunk(dcpl, 1, &dzero); + } H5E_END_TRY; if (ret > 0) FAIL_PUTS_ERROR("set zero-sized chunk dimensions") @@ -7415,7 +7472,10 @@ test_zero_dims(hid_t file) } /* end if */ /* Try creating chunked dataset with zero-sized chunk dimensions */ - H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl2, 2, dzero2); } + H5E_BEGIN_TRY + { + ret = H5Pset_chunk(dcpl2, 2, dzero2); + } H5E_END_TRY; if (ret > 0) FAIL_PUTS_ERROR("set zero-sized chunk dimensions") @@ -8384,7 +8444,10 @@ test_deprec(hid_t file) * dataset can only be created once. Temporarily turn off error * reporting. */ - H5E_BEGIN_TRY { dataset = H5Dcreate1(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + dataset = H5Dcreate1(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT); + } H5E_END_TRY; if (dataset >= 0) { H5_FAILED(); @@ -8406,7 +8469,10 @@ test_deprec(hid_t file) * cannot be created with this function. Temporarily turn off error * reporting. */ - H5E_BEGIN_TRY { dataset = H5Dopen1(file, "does_not_exist"); } + H5E_BEGIN_TRY + { + dataset = H5Dopen1(file, "does_not_exist"); + } H5E_END_TRY; if (dataset >= 0) { H5_FAILED(); @@ -8581,7 +8647,10 @@ test_huge_chunks(hid_t fapl) /* Try to set too large of a chunk for 1-D dataset (# of elements) */ chunk_dim = TOO_HUGE_CHUNK_DIM; - H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl, 1, &chunk_dim); } + H5E_BEGIN_TRY + { + ret = H5Pset_chunk(dcpl, 1, &chunk_dim); + } H5E_END_TRY; if (ret >= 0) FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.") @@ -8590,7 +8659,10 @@ test_huge_chunks(hid_t fapl) chunk_dim2[0] = TOO_HUGE_CHUNK_DIM2_0; chunk_dim2[1] = TOO_HUGE_CHUNK_DIM2_1; chunk_dim2[2] = TOO_HUGE_CHUNK_DIM2_2; - H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl, 3, chunk_dim2); } + H5E_BEGIN_TRY + { + ret = H5Pset_chunk(dcpl, 3, chunk_dim2); + } H5E_END_TRY; if (ret >= 0) FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.") @@ -11824,7 +11896,10 @@ test_zero_dim_dset(hid_t fapl) for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds before opening the file */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ @@ -13078,7 +13153,10 @@ test_power2up(hid_t fapl) ext_dims[1] = dims[1] + 5; /* Extend to (2^63)+ */ - H5E_BEGIN_TRY { status = H5Dset_extent(did, ext_dims); } + H5E_BEGIN_TRY + { + status = H5Dset_extent(did, ext_dims); + } H5E_END_TRY; if (status >= 0) TEST_ERROR @@ -13414,7 +13492,10 @@ test_scatter(void) return SUCCEED; error: - H5E_BEGIN_TRY { H5Sclose(sid); } + H5E_BEGIN_TRY + { + H5Sclose(sid); + } H5E_END_TRY; return FAIL; } /* end test_scatter() */ @@ -13778,7 +13859,10 @@ test_gather(void) return SUCCEED; error: - H5E_BEGIN_TRY { H5Sclose(sid); } + H5E_BEGIN_TRY + { + H5Sclose(sid); + } H5E_END_TRY; return FAIL; } /* end test_gather() */ @@ -13882,14 +13966,20 @@ test_scatter_error(void) */ scatter_info.src_buf = src_buf; scatter_info.size = 6; - H5E_BEGIN_TRY { ret = H5Dscatter(NULL, NULL, H5T_NATIVE_INT, sid, dst_buf); } + H5E_BEGIN_TRY + { + ret = H5Dscatter(NULL, NULL, H5T_NATIVE_INT, sid, dst_buf); + } H5E_END_TRY if (ret >= 0) TEST_ERROR scatter_info.src_buf = src_buf; scatter_info.size = 6; - H5E_BEGIN_TRY { ret = H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, sid, sid, dst_buf); } + H5E_BEGIN_TRY + { + ret = H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, sid, sid, dst_buf); + } H5E_END_TRY if (ret >= 0) TEST_ERROR @@ -14002,7 +14092,10 @@ test_scatter_error(void) return SUCCEED; error: - H5E_BEGIN_TRY { H5Sclose(sid); } + H5E_BEGIN_TRY + { + H5Sclose(sid); + } H5E_END_TRY; return FAIL; } /* end test_scatter_error() */ @@ -14104,14 +14197,20 @@ test_gather_error(void) gather_info.expect_dst_buf = expect_dst_buf; gather_info.last_call = FALSE; - H5E_BEGIN_TRY { ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 0, dst_buf, gather_cb, &gather_info); } + H5E_BEGIN_TRY + { + ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 0, dst_buf, gather_cb, &gather_info); + } H5E_END_TRY if (ret >= 0) TEST_ERROR gather_info.expect_dst_buf = expect_dst_buf; gather_info.last_call = FALSE; - H5E_BEGIN_TRY { ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 1, dst_buf, gather_cb, &gather_info); } + H5E_BEGIN_TRY + { + ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 1, dst_buf, gather_cb, &gather_info); + } H5E_END_TRY if (ret >= 0) TEST_ERROR @@ -14159,7 +14258,10 @@ test_gather_error(void) return SUCCEED; error: - H5E_BEGIN_TRY { H5Sclose(sid); } + H5E_BEGIN_TRY + { + H5Sclose(sid); + } H5E_END_TRY; return FAIL; } /* end test_gather_error() */ @@ -14520,7 +14622,10 @@ test_compact_open_close_dirty(hid_t fapl) /* Verify the repeated open/close of the dataset will not fail */ for (i = 0; i < 20; i++) { - H5E_BEGIN_TRY { did = H5Dopen2(fid, DSET_COMPACT_MAX_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dopen2(fid, DSET_COMPACT_MAX_NAME, H5P_DEFAULT); + } H5E_END_TRY; if (did < 0) TEST_ERROR @@ -14648,7 +14753,10 @@ test_versionbounds(void) for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds, skip for invalid low/high combination */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ @@ -14803,7 +14911,10 @@ test_object_header_minimization_dcpl(void) /* error cases */ - H5E_BEGIN_TRY { ret = H5Pget_dset_no_attrs_hint(-1, &minimize); } + H5E_BEGIN_TRY + { + ret = H5Pget_dset_no_attrs_hint(-1, &minimize); + } H5E_END_TRY; if (ret == SUCCEED) TEST_ERROR /* Invalid DCPL ID should fail */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 8658ccb..f2bf6cf 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -864,7 +864,10 @@ test_particular_fp_integer(void) error: HDfflush(stdout); - H5E_BEGIN_TRY { H5Pclose(dxpl_id); } + H5E_BEGIN_TRY + { + H5Pclose(dxpl_id); + } H5E_END_TRY; if (buf1) HDfree(buf1); diff --git a/test/dtransform.c b/test/dtransform.c index e78f857..9445d83 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -938,7 +938,10 @@ test_set(void) error: if (ptrgetTest) HDfree(ptrgetTest); - H5E_BEGIN_TRY { H5Pclose(dxpl_id); } + H5E_BEGIN_TRY + { + H5Pclose(dxpl_id); + } H5E_END_TRY return -1; diff --git a/test/dtypes.c b/test/dtypes.c index fe76480..bbc0690 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -312,7 +312,10 @@ test_copy(void) goto error; /* We should not be able to close a built-in byte */ - H5E_BEGIN_TRY { status = H5Tclose(H5T_NATIVE_SCHAR); } + H5E_BEGIN_TRY + { + status = H5Tclose(H5T_NATIVE_SCHAR); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -598,7 +601,10 @@ test_compound_1(void) goto error; /* Attempt to add the new compound datatype as a field within itself */ - H5E_BEGIN_TRY { ret = H5Tinsert(complex_id, "compound", (size_t)0, complex_id); } + H5E_BEGIN_TRY + { + ret = H5Tinsert(complex_id, "compound", (size_t)0, complex_id); + } H5E_END_TRY; if (ret >= 0) { FAIL_PUTS_ERROR("Inserted compound datatype into itself?"); @@ -612,56 +618,83 @@ test_compound_1(void) /* Test some functions that aren't supposed to work for compound type */ /* Tries to shrink the size and trail the last member */ - H5E_BEGIN_TRY { ret = H5Tset_size(complex_id, sizeof(double)); } + H5E_BEGIN_TRY + { + ret = H5Tset_size(complex_id, sizeof(double)); + } H5E_END_TRY; if (ret >= 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { size = H5Tget_precision(complex_id); } + H5E_BEGIN_TRY + { + size = H5Tget_precision(complex_id); + } H5E_END_TRY; if (size > 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ size = 128; - H5E_BEGIN_TRY { ret = H5Tset_precision(complex_id, size); } + H5E_BEGIN_TRY + { + ret = H5Tset_precision(complex_id, size); + } H5E_END_TRY; if (ret >= 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { ret = H5Tget_pad(complex_id, &lsb, &msb); } + H5E_BEGIN_TRY + { + ret = H5Tget_pad(complex_id, &lsb, &msb); + } H5E_END_TRY; if (ret >= 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { size = H5Tget_ebias(complex_id); } + H5E_BEGIN_TRY + { + size = H5Tget_ebias(complex_id); + } H5E_END_TRY; if (size > 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { lsb = H5Tget_inpad(complex_id); } + H5E_BEGIN_TRY + { + lsb = H5Tget_inpad(complex_id); + } H5E_END_TRY; if (lsb >= 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { cset = H5Tget_cset(complex_id); } + H5E_BEGIN_TRY + { + cset = H5Tget_cset(complex_id); + } H5E_END_TRY; if (cset > -1) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { strpad = H5Tget_strpad(complex_id); } + H5E_BEGIN_TRY + { + strpad = H5Tget_strpad(complex_id); + } H5E_END_TRY; if (strpad > -1) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { offset = H5Tget_offset(complex_id); } + H5E_BEGIN_TRY + { + offset = H5Tget_offset(complex_id); + } H5E_END_TRY; if (offset >= 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); @@ -673,19 +706,28 @@ test_compound_1(void) if (order != H5T_ORDER_LE && order != H5T_ORDER_BE) FAIL_PUTS_ERROR("Wrong order for this type."); - H5E_BEGIN_TRY { sign = H5Tget_sign(complex_id); } + H5E_BEGIN_TRY + { + sign = H5Tget_sign(complex_id); + } H5E_END_TRY; if (sign > -1) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { tag = H5Tget_tag(complex_id); } + H5E_BEGIN_TRY + { + tag = H5Tget_tag(complex_id); + } H5E_END_TRY; if (tag) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { super = H5Tget_super(complex_id); } + H5E_BEGIN_TRY + { + super = H5Tget_super(complex_id); + } H5E_END_TRY; if (super >= 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); @@ -1347,7 +1389,10 @@ test_compound_7(void) } /* end if */ /* Should not be able to insert field past end of compound datatype */ - H5E_BEGIN_TRY { ret = H5Tinsert(tid2, "d", HOFFSET(struct s2, d), H5T_NATIVE_DOUBLE); } + H5E_BEGIN_TRY + { + ret = H5Tinsert(tid2, "d", HOFFSET(struct s2, d), H5T_NATIVE_DOUBLE); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -1356,7 +1401,10 @@ test_compound_7(void) } /* end if */ /* Should not be able to shrink size of compound datatype */ - H5E_BEGIN_TRY { ret = H5Tset_size(tid2, sizeof(struct s1) / 2); } + H5E_BEGIN_TRY + { + ret = H5Tset_size(tid2, sizeof(struct s1) / 2); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -1590,7 +1638,10 @@ test_compound_8(void) } /* end if */ /* If the type is not packed, packing a locked type shouldn't work */ - H5E_BEGIN_TRY { ret = H5Tpack(tid3); } + H5E_BEGIN_TRY + { + ret = H5Tpack(tid3); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -2498,7 +2549,10 @@ test_compound_12(void) /* Tries to cut last member. Supposed to fail. */ size--; - H5E_BEGIN_TRY { ret = H5Tset_size(complex_id, size); } + H5E_BEGIN_TRY + { + ret = H5Tset_size(complex_id, size); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -3594,7 +3648,10 @@ test_compound_18(void) HDassert(sid > 0); /* Create a dataset with the bad compound datatype */ - H5E_BEGIN_TRY { did = H5Dcreate2(file, "dataset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dcreate2(file, "dataset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (did > 0) { H5Dclose(did); @@ -3606,7 +3663,10 @@ test_compound_18(void) HDassert(gid > 0); /* Create an attribute with the bad compound datatype */ - H5E_BEGIN_TRY { aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (aid > 0) { H5Aclose(aid); @@ -3614,7 +3674,10 @@ test_compound_18(void) } /* end if */ /* Commit the datatype */ - H5E_BEGIN_TRY { ret = H5Tcommit2(file, "cmpnd", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Tcommit2(file, "cmpnd", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (ret >= 0) { FAIL_PUTS_ERROR("committed named datatype with bad compound datatype") @@ -3636,7 +3699,10 @@ test_compound_18(void) FAIL_STACK_ERROR /* Try to open the datatype */ - H5E_BEGIN_TRY { tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); + } H5E_END_TRY; if (tid > 0) { H5Tclose(tid); @@ -3644,7 +3710,10 @@ test_compound_18(void) } /* end if */ /* Try to open the dataset */ - H5E_BEGIN_TRY { did = H5Dopen2(file, "dataset", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dopen2(file, "dataset", H5P_DEFAULT); + } H5E_END_TRY; if (did > 0) { H5Dclose(did); @@ -3656,7 +3725,10 @@ test_compound_18(void) TEST_ERROR /* Try to open the dataset */ - H5E_BEGIN_TRY { aid = H5Aopen(gid, "attr", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + aid = H5Aopen(gid, "attr", H5P_DEFAULT); + } H5E_END_TRY; if (aid > 0) { H5Aclose(aid); @@ -3958,14 +4030,20 @@ test_transient(hid_t fapl) goto error; /* Predefined types cannot be modified or closed */ - H5E_BEGIN_TRY { status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256); } + H5E_BEGIN_TRY + { + status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); HDputs(" Predefined types should not be modifiable!"); goto error; } - H5E_BEGIN_TRY { status = H5Tclose(H5T_NATIVE_INT); } + H5E_BEGIN_TRY + { + status = H5Tclose(H5T_NATIVE_INT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -3980,7 +4058,10 @@ test_transient(hid_t fapl) goto error; /* It should not be possible to create an attribute for a transient type */ - H5E_BEGIN_TRY { ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (ret_id >= 0) { H5_FAILED(); @@ -3999,7 +4080,10 @@ test_transient(hid_t fapl) /* The type returned from a dataset should not be modifiable */ if ((t2 = H5Dget_type(dset)) < 0) goto error; - H5E_BEGIN_TRY { status = H5Tset_precision(t2, (size_t)256); } + H5E_BEGIN_TRY + { + status = H5Tset_precision(t2, (size_t)256); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -4019,7 +4103,10 @@ test_transient(hid_t fapl) goto error; if ((t2 = H5Dget_type(dset)) < 0) goto error; - H5E_BEGIN_TRY { status = H5Tset_precision(t2, (size_t)256); } + H5E_BEGIN_TRY + { + status = H5Tset_precision(t2, (size_t)256); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -4127,7 +4214,10 @@ test_named(hid_t fapl) } /* We should not be able to modify a type after it has been committed. */ - H5E_BEGIN_TRY { status = H5Tset_precision(type, (size_t)256); } + H5E_BEGIN_TRY + { + status = H5Tset_precision(type, (size_t)256); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -4325,7 +4415,10 @@ test_named(hid_t fapl) /* Verify that H5Tcommit_anon returns an error */ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error; - H5E_BEGIN_TRY { status = H5Tcommit_anon(file, type, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Tcommit_anon(file, type, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -4935,37 +5028,55 @@ test_conv_str_3(void) if (H5Tget_order(type) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { ret = H5Tset_precision(type, nelmts); } + H5E_BEGIN_TRY + { + ret = H5Tset_precision(type, nelmts); + } H5E_END_TRY; if (ret >= 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { size = H5Tget_ebias(type); } + H5E_BEGIN_TRY + { + size = H5Tget_ebias(type); + } H5E_END_TRY; if (size > 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); } + H5E_BEGIN_TRY + { + inpad = H5Tget_inpad(type); + } H5E_END_TRY; if (inpad > -1) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { sign = H5Tget_sign(type); } + H5E_BEGIN_TRY + { + sign = H5Tget_sign(type); + } H5E_END_TRY; if (sign > -1) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { tag = H5Tget_tag(type); } + H5E_BEGIN_TRY + { + tag = H5Tget_tag(type); + } H5E_END_TRY; if (tag) { FAIL_PUTS_ERROR("Operation not allowed for this type."); } /* end if */ - H5E_BEGIN_TRY { super = H5Tget_super(type); } + H5E_BEGIN_TRY + { + super = H5Tget_super(type); + } H5E_END_TRY; if (super >= 0) { FAIL_PUTS_ERROR("Operation not allowed for this type."); @@ -5298,7 +5409,10 @@ test_bitfield_funcs(void) if ((ntype = H5Tget_native_type(type, H5T_DIR_ASCEND)) < 0) goto error; - H5E_BEGIN_TRY { size = H5Tget_ebias(type); } + H5E_BEGIN_TRY + { + size = H5Tget_ebias(type); + } H5E_END_TRY; if (size > 0) { H5_FAILED(); @@ -5306,7 +5420,10 @@ test_bitfield_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); } + H5E_BEGIN_TRY + { + inpad = H5Tget_inpad(type); + } H5E_END_TRY; if (inpad > -1) { H5_FAILED(); @@ -5314,7 +5431,10 @@ test_bitfield_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { cset = H5Tget_cset(type); } + H5E_BEGIN_TRY + { + cset = H5Tget_cset(type); + } H5E_END_TRY; if (cset > -1) { H5_FAILED(); @@ -5322,7 +5442,10 @@ test_bitfield_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); } + H5E_BEGIN_TRY + { + strpad = H5Tget_strpad(type); + } H5E_END_TRY; if (strpad > -1) { H5_FAILED(); @@ -5330,7 +5453,10 @@ test_bitfield_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { ret = H5Tset_sign(type, H5T_SGN_2); } + H5E_BEGIN_TRY + { + ret = H5Tset_sign(type, H5T_SGN_2); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -5338,7 +5464,10 @@ test_bitfield_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { tag = H5Tget_tag(type); } + H5E_BEGIN_TRY + { + tag = H5Tget_tag(type); + } H5E_END_TRY; if (tag) { H5_FAILED(); @@ -5346,7 +5475,10 @@ test_bitfield_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { super = H5Tget_super(type); } + H5E_BEGIN_TRY + { + super = H5Tget_super(type); + } H5E_END_TRY; if (super >= 0) { H5_FAILED(); @@ -5471,7 +5603,10 @@ opaque_check(int tag_it) } /* Make sure that we can't convert between the types yet */ - H5E_BEGIN_TRY { status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -5540,7 +5675,10 @@ opaque_long(void) long_tag[16384] = '\0'; /* Set opaque type's tag */ - H5E_BEGIN_TRY { ret = H5Tset_tag(dt, long_tag); } + H5E_BEGIN_TRY + { + ret = H5Tset_tag(dt, long_tag); + } H5E_END_TRY; if (ret != FAIL) TEST_ERROR @@ -5596,63 +5734,90 @@ opaque_funcs(void) if ((size = H5Tget_size(type)) == 0) goto error; - H5E_BEGIN_TRY { ret = H5Tset_precision(type, (size_t)32); } + H5E_BEGIN_TRY + { + ret = H5Tset_precision(type, (size_t)32); + } H5E_END_TRY; if (ret >= 0) { HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); } + H5E_BEGIN_TRY + { + ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); + } H5E_END_TRY; if (ret >= 0) { HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { size = H5Tget_ebias(type); } + H5E_BEGIN_TRY + { + size = H5Tget_ebias(type); + } H5E_END_TRY; if (size > 0) { HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); } + H5E_BEGIN_TRY + { + inpad = H5Tget_inpad(type); + } H5E_END_TRY; if (inpad > -1) { HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { cset = H5Tget_cset(type); } + H5E_BEGIN_TRY + { + cset = H5Tget_cset(type); + } H5E_END_TRY; if (cset > -1) { HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); } + H5E_BEGIN_TRY + { + strpad = H5Tget_strpad(type); + } H5E_END_TRY; if (strpad > -1) { HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { ret = H5Tset_offset(type, (size_t)16); } + H5E_BEGIN_TRY + { + ret = H5Tset_offset(type, (size_t)16); + } H5E_END_TRY; if (ret >= 0) { HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { sign = H5Tget_sign(type); } + H5E_BEGIN_TRY + { + sign = H5Tget_sign(type); + } H5E_END_TRY; if (sign > -1) { HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { super = H5Tget_super(type); } + H5E_BEGIN_TRY + { + super = H5Tget_super(type); + } H5E_END_TRY; if (super >= 0) { HDprintf("Operation not allowed for this type.\n"); @@ -5810,7 +5975,10 @@ test_encode(void) cmpd_buf = (unsigned char *)HDcalloc((size_t)1, cmpd_buf_size); /* Try decoding bogus buffer */ - H5E_BEGIN_TRY { ret_id = H5Tdecode(cmpd_buf); } + H5E_BEGIN_TRY + { + ret_id = H5Tdecode(cmpd_buf); + } H5E_END_TRY; if (ret_id != FAIL) { H5_FAILED(); @@ -6159,7 +6327,10 @@ test_encode(void) } /* end if */ /* Make sure the decoded datatypes are already closed. */ - H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid1); } + H5E_BEGIN_TRY + { + ret = H5Tclose(decoded_tid1); + } H5E_END_TRY; if (ret != FAIL) { H5_FAILED(); @@ -6167,7 +6338,10 @@ test_encode(void) goto error; } - H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid2); } + H5E_BEGIN_TRY + { + ret = H5Tclose(decoded_tid2); + } H5E_END_TRY; if (ret != FAIL) { H5_FAILED(); @@ -6175,7 +6349,10 @@ test_encode(void) goto error; } - H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid3); } + H5E_BEGIN_TRY + { + ret = H5Tclose(decoded_tid3); + } H5E_END_TRY; if (ret != FAIL) { H5_FAILED(); @@ -6610,7 +6787,10 @@ test_int_float_except(void) #if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4 error: - H5E_BEGIN_TRY { H5Pclose(dxpl); } + H5E_BEGIN_TRY + { + H5Pclose(dxpl); + } H5E_END_TRY; return 1; #endif /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */ @@ -7788,7 +7968,10 @@ test_deprec(hid_t fapl) FAIL_STACK_ERROR /* Predefined types cannot be committed */ - H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT); } + H5E_BEGIN_TRY + { + status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR(" Predefined types should not be committable!") @@ -7804,13 +7987,19 @@ test_deprec(hid_t fapl) FAIL_PUTS_ERROR(" H5Tcommitted() returned false!") /* We should not be able to modify a type after it has been committed. */ - H5E_BEGIN_TRY { status = H5Tset_precision(type, (size_t)256); } + H5E_BEGIN_TRY + { + status = H5Tset_precision(type, (size_t)256); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR(" Committed type is not constant!") /* We should not be able to re-commit a committed type */ - H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_2 (should not exist)", type); } + H5E_BEGIN_TRY + { + status = H5Tcommit1(file, "test_named_2 (should not exist)", type); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR(" Committed types should not be recommitted!") @@ -7840,7 +8029,10 @@ test_deprec(hid_t fapl) /* Verify that H5Tcommit2 returns an error */ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error; - H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_3 (should not exist)", type); } + H5E_BEGIN_TRY + { + status = H5Tcommit1(file, "test_named_3 (should not exist)", type); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -7927,7 +8119,10 @@ test_utf_ascii_conv(void) FAIL_STACK_ERROR /* Test conversion in memory */ - H5E_BEGIN_TRY { status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT); + } H5E_END_TRY if (status >= 0) FAIL_STACK_ERROR @@ -7950,7 +8145,10 @@ test_utf_ascii_conv(void) FAIL_STACK_ERROR /* Read the UTF8 string, as ASCII, supposed to fail */ - H5E_BEGIN_TRY { status = H5Dread(did, ascii_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_r); } + H5E_BEGIN_TRY + { + status = H5Dread(did, ascii_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_r); + } H5E_END_TRY if (status >= 0) FAIL_STACK_ERROR @@ -7963,7 +8161,10 @@ test_utf_ascii_conv(void) * Test VL string conversion from ASCII to UTF8 ************************************************/ /* Test conversion in memory */ - H5E_BEGIN_TRY { status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT); + } H5E_END_TRY if (status >= 0) FAIL_STACK_ERROR @@ -7977,7 +8178,10 @@ test_utf_ascii_conv(void) FAIL_STACK_ERROR /* Read the ASCII string, as UTF8, supposed to fail */ - H5E_BEGIN_TRY { status = H5Dread(did, utf8_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_r); } + H5E_BEGIN_TRY + { + status = H5Dread(did, utf8_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_r); + } H5E_END_TRY if (status >= 0) FAIL_STACK_ERROR @@ -8020,7 +8224,10 @@ test_utf_ascii_conv(void) FAIL_STACK_ERROR /* Test conversion in memory */ - H5E_BEGIN_TRY { status = H5Tconvert(utf8_tid, ascii_tid, 1, utf8_2, NULL, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Tconvert(utf8_tid, ascii_tid, 1, utf8_2, NULL, H5P_DEFAULT); + } H5E_END_TRY if (status >= 0) FAIL_STACK_ERROR @@ -8034,7 +8241,10 @@ test_utf_ascii_conv(void) FAIL_STACK_ERROR /* Read the UTF8 string as ASCII, supposed to fail */ - H5E_BEGIN_TRY { status = H5Dread(did, ascii_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii2); } + H5E_BEGIN_TRY + { + status = H5Dread(did, ascii_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii2); + } H5E_END_TRY if (status >= 0) FAIL_STACK_ERROR @@ -8047,7 +8257,10 @@ test_utf_ascii_conv(void) * Test fixed-length string conversion from ASCII to UTF8 **********************************************************/ /* Test conversion in memory */ - H5E_BEGIN_TRY { status = H5Tconvert(ascii_tid, utf8_tid, 1, ascii2, NULL, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Tconvert(ascii_tid, utf8_tid, 1, ascii2, NULL, H5P_DEFAULT); + } H5E_END_TRY if (status >= 0) FAIL_STACK_ERROR @@ -8061,7 +8274,10 @@ test_utf_ascii_conv(void) FAIL_STACK_ERROR /* Read the UTF8 string as ASCII, supposed to fail */ - H5E_BEGIN_TRY { status = H5Dread(did, utf8_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_2); } + H5E_BEGIN_TRY + { + status = H5Dread(did, utf8_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_2); + } H5E_END_TRY if (status >= 0) FAIL_STACK_ERROR @@ -8441,7 +8657,10 @@ test_versionbounds(void) for (high = 0; high < versions_count; high++) { /* Set version bounds */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, versions[low], versions[high]); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(fapl, versions[low], versions[high]); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ diff --git a/test/earray.c b/test/earray.c index bfd3d55..337e818 100644 --- a/test/earray.c +++ b/test/earray.c @@ -623,7 +623,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE /* Set invalid element size */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.raw_elmt_size = 0; - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -637,7 +640,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE /* Set invalid max. # of elements bits */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_nelmts_bits = 0; - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -650,7 +656,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_nelmts_bits = 65; - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -664,7 +673,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE /* Set invalid min. # of data block pointers in super blocks */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.sup_blk_min_data_ptrs = 0; - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -676,7 +688,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE } /* end if */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.sup_blk_min_data_ptrs = 1; - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -688,7 +703,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE } /* end if */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.sup_blk_min_data_ptrs = 6; - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -702,7 +720,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE /* Set invalid min. # of elements per data block */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.data_blk_min_elmts = 0; - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -718,7 +739,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1); - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -732,7 +756,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = 4; /* corresponds to 16 elements in data block page, which is less than the 64 elements for the default settings */ - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -744,7 +771,10 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE } /* end if */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(test_cparam.max_nelmts_bits + 1); - H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (ea) { /* Close opened extensible array */ @@ -1178,7 +1208,10 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) ea2 = NULL; /* Try re-opening the array again (should fail, as array will be deleted) */ - H5E_BEGIN_TRY { ea2 = H5EA_open(f, ea_addr, NULL); } + H5E_BEGIN_TRY + { + ea2 = H5EA_open(f, ea_addr, NULL); + } H5E_END_TRY; if (ea2) { /* Close opened array */ @@ -1198,7 +1231,10 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) TEST_ERROR /* Try re-opening the array again (should fail, as array is now deleted) */ - H5E_BEGIN_TRY { ea = H5EA_open(f, ea_addr, NULL); } + H5E_BEGIN_TRY + { + ea = H5EA_open(f, ea_addr, NULL); + } H5E_END_TRY; if (ea) { /* Close opened array */ @@ -2568,7 +2604,10 @@ main(void) error: HDputs("*** TESTS FAILED ***"); - H5E_BEGIN_TRY { H5Pclose(fapl); } + H5E_BEGIN_TRY + { + H5Pclose(fapl); + } H5E_END_TRY; if (api_ctx_pushed) diff --git a/test/efc.c b/test/efc.c index 74e559a..e61eb1b 100644 --- a/test/efc.c +++ b/test/efc.c @@ -2724,7 +2724,10 @@ main(void) error: HDputs("*** TESTS FAILED ***"); - H5E_BEGIN_TRY { H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } H5E_END_TRY if (api_ctx_pushed) diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 49fba3b..83298c8 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -39,7 +39,10 @@ test_encode_decode(hid_t orig_pl, H5F_libver_t low, H5F_libver_t high, hbool_t s if (H5Pset_libver_bounds(fapl, low, high) < 0) TEST_ERROR - H5E_BEGIN_TRY { ret = H5Pencode2(orig_pl, NULL, &temp_size, fapl); } + H5E_BEGIN_TRY + { + ret = H5Pencode2(orig_pl, NULL, &temp_size, fapl); + } H5E_END_TRY; if (support_virtual && high < H5F_LIBVER_V110) diff --git a/test/enum.c b/test/enum.c index 73c9889..3923892 100644 --- a/test/enum.c +++ b/test/enum.c @@ -602,7 +602,10 @@ test_value_dsnt_exist(void) return 0; error: - H5E_BEGIN_TRY { H5Tclose(datatype_id); } + H5E_BEGIN_TRY + { + H5Tclose(datatype_id); + } H5E_END_TRY; return 1; } @@ -661,7 +664,10 @@ test_funcs(void) if (H5Tget_super(type) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); } + H5E_BEGIN_TRY + { + ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -669,7 +675,10 @@ test_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { size = H5Tget_ebias(type); } + H5E_BEGIN_TRY + { + size = H5Tget_ebias(type); + } H5E_END_TRY; if (size > 0) { H5_FAILED(); @@ -677,7 +686,10 @@ test_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); } + H5E_BEGIN_TRY + { + inpad = H5Tget_inpad(type); + } H5E_END_TRY; if (inpad > -1) { H5_FAILED(); @@ -685,7 +697,10 @@ test_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { cset = H5Tget_cset(type); } + H5E_BEGIN_TRY + { + cset = H5Tget_cset(type); + } H5E_END_TRY; if (cset > -1) { H5_FAILED(); @@ -694,7 +709,10 @@ test_funcs(void) } /* end if */ size = 16; - H5E_BEGIN_TRY { ret = H5Tset_offset(type, (size_t)size); } + H5E_BEGIN_TRY + { + ret = H5Tset_offset(type, (size_t)size); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -702,7 +720,10 @@ test_funcs(void) goto error; } /* end if */ - H5E_BEGIN_TRY { ret = H5Tset_order(type, H5T_ORDER_BE); } + H5E_BEGIN_TRY + { + ret = H5Tset_order(type, H5T_ORDER_BE); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -717,7 +738,10 @@ test_funcs(void) return 0; error: - H5E_BEGIN_TRY { H5Tclose(type); } + H5E_BEGIN_TRY + { + H5Tclose(type); + } H5E_END_TRY; return 1; } diff --git a/test/error_test.c b/test/error_test.c index d7c7b8a..d1ce00b 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -558,7 +558,10 @@ test_copy(void) /* Try to close error stack copy. Should fail because * the current H5Eset_current_stack closes the stack to be set. */ - H5E_BEGIN_TRY { ret = H5Eclose_stack(estack_id); } + H5E_BEGIN_TRY + { + ret = H5Eclose_stack(estack_id); + } H5E_END_TRY if (ret >= 0) TEST_ERROR @@ -624,15 +627,24 @@ test_append(void) TEST_ERROR /* Try to append bad error stack IDs */ - H5E_BEGIN_TRY { ret = H5Eappend_stack(H5E_DEFAULT, H5E_DEFAULT, FALSE); } + H5E_BEGIN_TRY + { + ret = H5Eappend_stack(H5E_DEFAULT, H5E_DEFAULT, FALSE); + } H5E_END_TRY if (ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { ret = H5Eappend_stack(estack_id1, H5E_DEFAULT, FALSE); } + H5E_BEGIN_TRY + { + ret = H5Eappend_stack(estack_id1, H5E_DEFAULT, FALSE); + } H5E_END_TRY if (ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { ret = H5Eappend_stack(H5E_DEFAULT, estack_id2, FALSE); } + H5E_BEGIN_TRY + { + ret = H5Eappend_stack(H5E_DEFAULT, estack_id2, FALSE); + } H5E_END_TRY if (ret >= 0) TEST_ERROR @@ -658,7 +670,10 @@ test_append(void) /* Try to close error stack #2. Should fail because H5Eappend_stack * should have already closed it. */ - H5E_BEGIN_TRY { ret = H5Eclose_stack(estack_id2); } + H5E_BEGIN_TRY + { + ret = H5Eclose_stack(estack_id2); + } H5E_END_TRY if (ret >= 0) TEST_ERROR diff --git a/test/event_set.c b/test/event_set.c index e1ef880..6568663 100644 --- a/test/event_set.c +++ b/test/event_set.c @@ -85,7 +85,10 @@ test_es_create(void) return 0; error: - H5E_BEGIN_TRY { H5ESclose(es_id); } + H5E_BEGIN_TRY + { + H5ESclose(es_id); + } H5E_END_TRY; return 1; } diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 798fcec..8239207 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -778,7 +778,10 @@ check_dset_scheme(hid_t fid, const char *dset_name) return SUCCEED; error: - H5E_BEGIN_TRY { H5Dclose(did); } + H5E_BEGIN_TRY + { + H5Dclose(did); + } H5E_END_TRY; H5_FAILED(); @@ -841,13 +844,19 @@ check_evict_on_close_api(void) TEST_ERROR; /* ensure using an incorrect access plist fails */ - H5E_BEGIN_TRY { status = H5Pset_evict_on_close(dapl_id, evict_on_close); } + H5E_BEGIN_TRY + { + status = H5Pset_evict_on_close(dapl_id, evict_on_close); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR("H5Pset_evict_on_close() accepted invalid access plist."); /* ensure an invalid plist fails */ - H5E_BEGIN_TRY { status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close); } + H5E_BEGIN_TRY + { + status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t."); @@ -994,7 +1003,10 @@ check_evict_on_close_parallel_fail(void) /* Set the evict on close property (should fail)*/ evict_on_close = TRUE; - H5E_BEGIN_TRY { status = H5Pset_evict_on_close(fapl_id, evict_on_close); } + H5E_BEGIN_TRY + { + status = H5Pset_evict_on_close(fapl_id, evict_on_close); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR("H5Pset_evict_on_close() did not fail in parallel HDF5."); diff --git a/test/external.c b/test/external.c index c2476b3..c31701d 100644 --- a/test/external.c +++ b/test/external.c @@ -134,7 +134,10 @@ test_non_extendible(hid_t file) FAIL_STACK_ERROR /* Test dataset address. Should be undefined. */ - H5E_BEGIN_TRY { dset_addr = H5Dget_offset(dset); } + H5E_BEGIN_TRY + { + dset_addr = H5Dget_offset(dset); + } H5E_END_TRY; if (dset_addr != HADDR_UNDEF) FAIL_STACK_ERROR @@ -220,7 +223,10 @@ test_too_small(hid_t file) if ((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { dset = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + dset = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } H5E_END_TRY; if (dset >= 0) FAIL_PUTS_ERROR(" Small external file succeeded instead of failing."); @@ -332,7 +338,10 @@ test_large_enough_current_not_eventual(hid_t file) if ((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } H5E_END_TRY; if (dset >= 0) FAIL_PUTS_ERROR(" Small external file succeeded instead of failing."); @@ -547,7 +556,10 @@ test_multiple_files(hid_t file) FAIL_STACK_ERROR; } - H5E_BEGIN_TRY { dset = H5Dcreate2(file, "dset7", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + dset = H5Dcreate2(file, "dset7", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } H5E_END_TRY; if (dset >= 0) FAIL_PUTS_ERROR(" Small external files succeeded instead of failing."); @@ -599,7 +611,10 @@ test_add_to_unlimited(void) if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } + H5E_BEGIN_TRY + { + status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); @@ -615,7 +630,10 @@ test_add_to_unlimited(void) return 0; error: - H5E_BEGIN_TRY { H5Pclose(dcpl); } + H5E_BEGIN_TRY + { + H5Pclose(dcpl); + } H5E_END_TRY; return 1; } /* end test_add_to_unlimited() */ @@ -647,7 +665,10 @@ test_overflow(void) if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED - 1) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } + H5E_BEGIN_TRY + { + status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); @@ -659,7 +680,10 @@ test_overflow(void) return 0; error: - H5E_BEGIN_TRY { H5Pclose(dcpl); } + H5E_BEGIN_TRY + { + H5Pclose(dcpl); + } H5E_END_TRY; return 1; } /* end test_overflow() */ @@ -1187,7 +1211,10 @@ test_path_relative_cwd(hid_t fapl) /* Reopen dataset with different efile_prefix property */ if (H5Pset_efile_prefix(dapl, "//") < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { dset3 = H5Dopen2(file, "dset1", dapl); } + H5E_BEGIN_TRY + { + dset3 = H5Dopen2(file, "dset1", dapl); + } H5E_END_TRY; if (dset3 >= 0) FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded"); @@ -1221,7 +1248,10 @@ test_path_relative_cwd(hid_t fapl) /* Reopen dataset with different efile_prefix property */ if (H5Pset_efile_prefix(dapl, NULL) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { dset3 = H5Dopen2(file, "dset1", dapl); } + H5E_BEGIN_TRY + { + dset3 = H5Dopen2(file, "dset1", dapl); + } H5E_END_TRY; if (dset3 >= 0) FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded"); diff --git a/test/farray.c b/test/farray.c index da38b31..950c7a7 100644 --- a/test/farray.c +++ b/test/farray.c @@ -440,7 +440,10 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE /* Set invalid element size */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.raw_elmt_size = 0; - H5E_BEGIN_TRY { fa = H5FA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + fa = H5FA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (fa) { /* Close opened fixed array */ @@ -454,7 +457,10 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE /* Set invalid max. # of elements bits */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = 0; - H5E_BEGIN_TRY { fa = H5FA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + fa = H5FA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (fa) { /* Close opened fixed array */ @@ -468,7 +474,10 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE /* Set invalid max. # of elements */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.nelmts = 0; - H5E_BEGIN_TRY { fa = H5FA_create(f, &test_cparam, NULL); } + H5E_BEGIN_TRY + { + fa = H5FA_create(f, &test_cparam, NULL); + } H5E_END_TRY; if (fa) { /* Close opened fixed array */ @@ -885,7 +894,10 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) fa2 = NULL; /* Try re-opening the array again (should fail, as array will be deleted) */ - H5E_BEGIN_TRY { fa2 = H5FA_open(f, fa_addr, NULL); } + H5E_BEGIN_TRY + { + fa2 = H5FA_open(f, fa_addr, NULL); + } H5E_END_TRY; if (fa2) { /* Close opened array */ @@ -905,7 +917,10 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TEST_ERROR /* Try re-opening the array again (should fail, as array is now deleted) */ - H5E_BEGIN_TRY { fa = H5FA_open(f, fa_addr, NULL); } + H5E_BEGIN_TRY + { + fa = H5FA_open(f, fa_addr, NULL); + } H5E_END_TRY; if (fa) { /* Close opened array */ @@ -1783,7 +1798,10 @@ main(void) error: HDputs("*** TESTS FAILED ***"); - H5E_BEGIN_TRY { H5Pclose(fapl); } + H5E_BEGIN_TRY + { + H5Pclose(fapl); + } H5E_END_TRY; if (api_ctx_pushed) diff --git a/test/fheap.c b/test/fheap.c index 4dfda3a..cb9c080 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -2360,7 +2360,10 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) fh2 = NULL; /* Try re-opening the heap again (should fail, as heap will be deleted) */ - H5E_BEGIN_TRY { fh2 = H5HF_open(f, fh_addr); } + H5E_BEGIN_TRY + { + fh2 = H5HF_open(f, fh_addr); + } H5E_END_TRY; if (fh2) { /* Close opened heap */ @@ -2397,7 +2400,10 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) } /* end if */ /* Try re-opening the heap again (should fail, as heap is now deleted) */ - H5E_BEGIN_TRY { fh = H5HF_open(f, fh_addr); } + H5E_BEGIN_TRY + { + fh = H5HF_open(f, fh_addr); + } H5E_END_TRY; if (fh) { /* Close opened heap */ @@ -2584,7 +2590,10 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) tmp_cparam.id_len = 3; /* Create absolute heap */ - H5E_BEGIN_TRY { fh = H5HF_create(f, &tmp_cparam); } + H5E_BEGIN_TRY + { + fh = H5HF_create(f, &tmp_cparam); + } H5E_END_TRY; if (NULL != fh) FAIL_STACK_ERROR @@ -2745,7 +2754,10 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) tmp_cparam.id_len = H5HF_MAX_ID_LEN + 1; /* Create absolute heap */ - H5E_BEGIN_TRY { fh = H5HF_create(f, &tmp_cparam); } + H5E_BEGIN_TRY + { + fh = H5HF_create(f, &tmp_cparam); + } H5E_END_TRY; if (NULL != fh) FAIL_STACK_ERROR @@ -3232,7 +3244,10 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa TESTING("inserting 'weird' sized objects into absolute heap"); /* Attempt to insert 0-sized object into heap */ - H5E_BEGIN_TRY { ret = H5HF_insert(fh, (size_t)0, shared_wobj_g, heap_id); } + H5E_BEGIN_TRY + { + ret = H5HF_insert(fh, (size_t)0, shared_wobj_g, heap_id); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -6459,7 +6474,10 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); heap_id[u] = (unsigned char)(HDrandom() + 1); /* Try removing bogus heap ID from empty heap */ - H5E_BEGIN_TRY { ret = H5HF_remove(fh, heap_id); } + H5E_BEGIN_TRY + { + ret = H5HF_remove(fh, heap_id); + } H5E_END_TRY; if (ret >= 0) FAIL_STACK_ERROR @@ -6485,14 +6503,20 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); } /* end while */ /* Try removing bogus heap ID from heap w/objects */ - H5E_BEGIN_TRY { ret = H5HF_remove(fh, heap_id); } + H5E_BEGIN_TRY + { + ret = H5HF_remove(fh, heap_id); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR H5Eclear2(H5E_DEFAULT); /* Try reading bogus heap ID from heap w/objects */ - H5E_BEGIN_TRY { ret = H5HF_read(fh, heap_id, shared_robj_g); } + H5E_BEGIN_TRY + { + ret = H5HF_read(fh, heap_id, shared_robj_g); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -15954,7 +15978,10 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Verify that writing to 'huge' objects works for un-filtered heaps */ - H5E_BEGIN_TRY { ret = H5HF_write(fh, huge_heap_id, &id_changed, shared_wobj_g); } + H5E_BEGIN_TRY + { + ret = H5HF_write(fh, huge_heap_id, &id_changed, shared_wobj_g); + } H5E_END_TRY; HDassert(!id_changed); if (tparam->comp == FHEAP_TEST_COMPRESS) { @@ -15967,7 +15994,10 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) } /* end else */ /* Verify that writing to 'tiny' objects return failure (for now) */ - H5E_BEGIN_TRY { ret = H5HF_write(fh, tiny_heap_id, &id_changed, shared_wobj_g); } + H5E_BEGIN_TRY + { + ret = H5HF_write(fh, tiny_heap_id, &id_changed, shared_wobj_g); + } H5E_END_TRY; HDassert(!id_changed); if (ret >= 0) diff --git a/test/file_image.c b/test/file_image.c index 7e8219c..f6075d5 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -1064,21 +1064,30 @@ test_get_file_image_error_rejection(void) VERIFY(image_ptr != NULL, "HDmalloc(1) failed."); /* load the image of the file into the buffer */ - H5E_BEGIN_TRY { bytes_read = H5Fget_file_image(file_id, image_ptr, (size_t)(image_size - 1)); } + H5E_BEGIN_TRY + { + bytes_read = H5Fget_file_image(file_id, image_ptr, (size_t)(image_size - 1)); + } H5E_END_TRY; VERIFY(bytes_read < 0, "H5Fget_file_image(2 -- test 1) succeeded."); /* Call H5Fget_file_image() with good buffer and buffer size, * but non-existant file_id. Should fail. */ - H5E_BEGIN_TRY { bytes_read = H5Fget_file_image((hid_t)0, image_ptr, (size_t)(image_size)); } + H5E_BEGIN_TRY + { + bytes_read = H5Fget_file_image((hid_t)0, image_ptr, (size_t)(image_size)); + } H5E_END_TRY; VERIFY(bytes_read < 0, "H5Fget_file_image(3 -- test 1) succeeded."); /* Call H5Fget_file_image() with good buffer and buffer size, * but a file_id of the wrong type. Should fail. */ - H5E_BEGIN_TRY { bytes_read = H5Fget_file_image(dset_id, image_ptr, (size_t)(image_size)); } + H5E_BEGIN_TRY + { + bytes_read = H5Fget_file_image(dset_id, image_ptr, (size_t)(image_size)); + } H5E_END_TRY; VERIFY(bytes_read < 0, "H5Fget_file_image(4 -- test 1) succeeded."); @@ -1179,7 +1188,10 @@ test_get_file_image_error_rejection(void) VERIFY(err >= 0, "H5Fflush failed"); /* attempt to get the size of the file -- should fail */ - H5E_BEGIN_TRY { image_size = H5Fget_file_image(file_id, NULL, (size_t)0); } + H5E_BEGIN_TRY + { + image_size = H5Fget_file_image(file_id, NULL, (size_t)0); + } H5E_END_TRY; VERIFY(image_size == -1, "H5Fget_file_image(5) succeeded."); @@ -1238,7 +1250,10 @@ test_get_file_image_error_rejection(void) VERIFY(err >= 0, "H5Fflush failed"); /* attempt to get the size of the file -- should fail */ - H5E_BEGIN_TRY { image_size = H5Fget_file_image(file_id, NULL, (size_t)0); } + H5E_BEGIN_TRY + { + image_size = H5Fget_file_image(file_id, NULL, (size_t)0); + } H5E_END_TRY; VERIFY(image_size == -1, "H5Fget_file_image(6) succeeded."); @@ -1295,7 +1310,10 @@ test_get_file_image_error_rejection(void) VERIFY(err >= 0, "H5Fflush failed"); /* attempt to get the size of the file -- should fail */ - H5E_BEGIN_TRY { image_size = H5Fget_file_image(file_id, NULL, (size_t)0); } + H5E_BEGIN_TRY + { + image_size = H5Fget_file_image(file_id, NULL, (size_t)0); + } H5E_END_TRY; VERIFY(image_size == -1, "H5Fget_file_image(7) succeeded."); diff --git a/test/fillval.c b/test/fillval.c index 4c0361e..4215c89 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -86,7 +86,10 @@ create_compound_type(void) return ret_value; error: - H5E_BEGIN_TRY { H5Tclose(ret_value); } + H5E_BEGIN_TRY + { + H5Tclose(ret_value); + } H5E_END_TRY; return -1; } @@ -197,7 +200,10 @@ test_getset(void) * Reading the fill value from a dataset creation property list that has * no fill value should result in a failure. */ - H5E_BEGIN_TRY { H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i); } + H5E_BEGIN_TRY + { + H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i); + } H5E_END_TRY; if (fill_i != 0) { H5_FAILED(); @@ -380,7 +386,9 @@ test_getset_vl(hid_t fapl) return 0; error: - H5E_BEGIN_TRY {} + H5E_BEGIN_TRY + { + } H5E_END_TRY; return 1; } /* end test_getset_vl() */ diff --git a/test/filter_fail.c b/test/filter_fail.c index 5c95fe6..a1bcf28 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -167,7 +167,10 @@ test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled) } else { /* Data writing should fail */ - H5E_BEGIN_TRY { ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -185,7 +188,10 @@ test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled) /* Close dataset. If the chunk cache is enabled, the flushing of chunks should fail * during H5Dclose. If it is diabled, H5Dwrite should fail but H5Dclose should succeed. */ if (cache_enabled) { - H5E_BEGIN_TRY { ret = H5Dclose(dataset); } + H5E_BEGIN_TRY + { + ret = H5Dclose(dataset); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); diff --git a/test/filter_plugin.c b/test/filter_plugin.c index 254011c..276141a 100644 --- a/test/filter_plugin.c +++ b/test/filter_plugin.c @@ -566,7 +566,10 @@ test_dataset_write_with_filters(hid_t fid) error: /* Clean up objects used for this test */ - H5E_BEGIN_TRY { H5Pclose(dcpl_id); } + H5E_BEGIN_TRY + { + H5Pclose(dcpl_id); + } H5E_END_TRY return FAIL; @@ -703,7 +706,10 @@ test_dataset_read_with_filters(hid_t fid) error: /* Clean up objects used for this test */ - H5E_BEGIN_TRY { H5Dclose(did); } + H5E_BEGIN_TRY + { + H5Dclose(did); + } H5E_END_TRY return FAIL; @@ -728,7 +734,10 @@ ensure_data_read_fails(hid_t did) TEST_ERROR; /* Read the dataset back (should fail) */ - H5E_BEGIN_TRY { ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, *check); } + H5E_BEGIN_TRY + { + ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, *check); + } H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -998,7 +1007,10 @@ test_path_api_calls(void) TESTING(" remove (index 0 in empty table)"); /* Try to remove index zero in an empty list (SHOULD FAIL) */ - H5E_BEGIN_TRY { ret = H5PLremove(0); } + H5E_BEGIN_TRY + { + ret = H5PLremove(0); + } H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -1029,7 +1041,10 @@ test_path_api_calls(void) TESTING(" remove (index too high)"); /* Try to remove a path where the index is beyond the table capacity (SHOULD FAIL) */ - H5E_BEGIN_TRY { ret = H5PLremove(n_starting_paths); } + H5E_BEGIN_TRY + { + ret = H5PLremove(n_starting_paths); + } H5E_END_TRY if (ret >= 0) @@ -1087,7 +1102,10 @@ test_path_api_calls(void) TESTING(" get (index too high)"); /* Get path at the last + 1 index (SHOULD FAIL) */ - H5E_BEGIN_TRY { path_len = H5PLget(n_starting_paths, NULL, 0); } + H5E_BEGIN_TRY + { + path_len = H5PLget(n_starting_paths, NULL, 0); + } H5E_END_TRY if (path_len > 0) TEST_ERROR; diff --git a/test/flush1.c b/test/flush1.c index 700286d..456f5f4 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -327,7 +327,10 @@ main(void) HD_exit(EXIT_SUCCESS); error: - H5E_BEGIN_TRY { H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } H5E_END_TRY; HDexit(EXIT_FAILURE); diff --git a/test/freespace.c b/test/freespace.c index 0ca4ea7..e888b2b 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -2916,7 +2916,10 @@ main(void) error: HDputs("*** TESTS FAILED ***"); - H5E_BEGIN_TRY { H5Pclose(fapl); } + H5E_BEGIN_TRY + { + H5Pclose(fapl); + } H5E_END_TRY; if (api_ctx_pushed) diff --git a/test/getname.c b/test/getname.c index b7c0d64..200c426 100644 --- a/test/getname.c +++ b/test/getname.c @@ -3794,7 +3794,10 @@ main(void) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file_id); } + H5E_BEGIN_TRY + { + H5Fclose(file_id); + } H5E_END_TRY; HDputs("***** GET NAME TESTS FAILED *****"); diff --git a/test/gheap.c b/test/gheap.c index 728f282..95594ee 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -149,7 +149,10 @@ test_1(hid_t fapl) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; if (obj) HDfree(obj); @@ -246,7 +249,10 @@ test_2(hid_t fapl) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; if (obj) HDfree(obj); @@ -333,7 +339,10 @@ test_3(hid_t fapl) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; if (obj) HDfree(obj); @@ -426,7 +435,10 @@ test_4(hid_t fapl) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; if (obj) HDfree(obj); @@ -542,7 +554,10 @@ test_ooo_indices(hid_t fapl) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; if (obj) HDfree(obj); @@ -597,7 +612,10 @@ main(void) HDexit(EXIT_SUCCESS); error: - H5E_BEGIN_TRY { H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } H5E_END_TRY; if (api_ctx_pushed) diff --git a/test/h5test.c b/test/h5test.c index 6526c94..64eb784 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1725,7 +1725,10 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl) if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL) continue; - H5E_BEGIN_TRY { file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); } + H5E_BEGIN_TRY + { + file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); + } H5E_END_TRY if (file < 0) { i++; @@ -1746,7 +1749,10 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return -1; diff --git a/test/hdfs.c b/test/hdfs.c index 6adae07..dfaa585 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -588,7 +588,10 @@ error: ***********/ if (fapl_id < 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } return 1; @@ -671,7 +674,10 @@ test_hdfs_fapl(void) return 0; error: - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; return 1; @@ -856,7 +862,10 @@ test_vfd_open(void) HDfprintf(stderr, "testing: %s\n", T.message); #endif /* HDFS_TEST_DEBUG */ - H5E_BEGIN_TRY { fd = H5FDopen(T.url, T.flags, fapl_id, T.maxaddr); } + H5E_BEGIN_TRY + { + fd = H5FDopen(T.url, T.flags, fapl_id, T.maxaddr); + } H5E_END_TRY; if (NULL != fd) { if (TRUE == T.might_use_other_driver && H5FD_HDFS != fd->driver_id) { @@ -1037,7 +1046,10 @@ error: (void)H5FDclose(fd_shakespeare); } if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } @@ -1134,7 +1146,10 @@ error: (void)H5FDclose(file_shakespeare); } if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } @@ -1338,7 +1353,10 @@ error: (void)H5FDclose(file_raven); } if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } @@ -1450,7 +1468,10 @@ error: ***********/ if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } if (file != NULL) { @@ -1593,7 +1614,10 @@ error: #endif /* HDFS_TEST_DEBUG */ if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } if (file > 0) { diff --git a/test/lheap.c b/test/lheap.c index f249ade..9bbacbe 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -212,7 +212,10 @@ main(void) error: HDputs("*** TESTS FAILED ***"); - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; if (api_ctx_pushed) diff --git a/test/links.c b/test/links.c index e519435..2ac2e28 100644 --- a/test/links.c +++ b/test/links.c @@ -664,14 +664,20 @@ cklinks(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if (H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); HDputs(" H5Lexists() should have failed for a path with missing components."); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -1074,7 +1080,10 @@ toomany(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through too deep soft link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); + } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -1419,7 +1428,10 @@ test_move(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that the group is no longer in the original location */ - H5E_BEGIN_TRY { moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); + } H5E_END_TRY; if (moved_grp >= 0) { H5_FAILED(); @@ -2169,14 +2181,20 @@ cklinks_deprec(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if (H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); HDputs(" H5Lexists() should have failed for a path with missing components."); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -2924,7 +2942,10 @@ external_link_root_deprec(hid_t fapl, hbool_t new_format) if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - H5E_BEGIN_TRY { gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY if (gid >= 0) TEST_ERROR @@ -4231,7 +4252,10 @@ lapl_nlinks_deprec(hid_t fapl, hbool_t new_format) TEST_ERROR /* Try opening through what is now too many soft links */ - H5E_BEGIN_TRY { gid = H5Oopen(fid, "soft5", plist); } + H5E_BEGIN_TRY + { + gid = H5Oopen(fid, "soft5", plist); + } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -6397,7 +6421,10 @@ link_iterate_check_deprec(hid_t group_id, H5_index_t idx_type, H5_iter_order_t o /* Check for iteration routine indicating failure */ skip = 0; - H5E_BEGIN_TRY { ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_fail_deprec_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -6895,7 +6922,10 @@ link_iterate_old_check_deprec(hid_t group_id, H5_iter_order_t order, unsigned ma if (ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_deprec_cb, iter_info); } + H5E_BEGIN_TRY + { + ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_deprec_cb, iter_info); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -7230,7 +7260,10 @@ external_link_root(hid_t fapl, hbool_t new_format) if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - H5E_BEGIN_TRY { gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY if (gid >= 0) TEST_ERROR @@ -8024,7 +8057,10 @@ external_link_toomany(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "link1", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "link1", H5P_DEFAULT); + } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -8131,7 +8167,10 @@ external_link_dangling(hid_t fapl, hbool_t new_format) TEST_ERROR; /* Open object through dangling file external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); + } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -8140,7 +8179,10 @@ external_link_dangling(hid_t fapl, hbool_t new_format) } /* Open object through dangling object external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); + } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -8248,7 +8290,10 @@ external_link_prefix(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", gapl_id); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", gapl_id); + } H5E_END_TRY; /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ @@ -8342,7 +8387,10 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file from absolute path set for main file */ @@ -8427,7 +8475,10 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file from the main file's relative pathname */ @@ -8517,7 +8568,10 @@ external_link_cwd(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file from the current working directory */ @@ -8612,7 +8666,10 @@ external_link_abstar(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file with abolute path */ @@ -8707,7 +8764,10 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file from main file's current working directory */ @@ -8879,7 +8939,10 @@ external_link_chdir(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; if (HDchdir("..") < 0) @@ -9511,7 +9574,10 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo TEST_ERROR /* Attempt to create a group through the external link using gapl (should fail) */ - H5E_BEGIN_TRY { group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl); } + H5E_BEGIN_TRY + { + group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl); + } H5E_END_TRY; if (group != FAIL) TEST_ERROR @@ -9559,25 +9625,40 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo TEST_ERROR /* Attempt to set invalid flags on gapl */ - H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC); } + H5E_BEGIN_TRY + { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC); + } H5E_END_TRY; if (ret != FAIL) TEST_ERROR - H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL); } + H5E_BEGIN_TRY + { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL); + } H5E_END_TRY; if (ret != FAIL) TEST_ERROR - H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT); } + H5E_BEGIN_TRY + { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT); + } H5E_END_TRY; if (ret != FAIL) TEST_ERROR /* SWMR reader with write access */ - H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_READ); } + H5E_BEGIN_TRY + { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_READ); + } H5E_END_TRY; if (ret != FAIL) TEST_ERROR /* SWMR writer with read-only access */ - H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE); } + H5E_BEGIN_TRY + { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE); + } H5E_END_TRY; if (ret != FAIL) TEST_ERROR @@ -9690,19 +9771,31 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo } /* end if */ /* Verify that H5Fcreate and H5Fopen reject H5F_ACC_DEFAULT */ - H5E_BEGIN_TRY { file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); } + H5E_BEGIN_TRY + { + file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); + } H5E_END_TRY; if (file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); } + H5E_BEGIN_TRY + { + file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); + } H5E_END_TRY; if (file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl); } + H5E_BEGIN_TRY + { + file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl); + } H5E_END_TRY; if (file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl); } + H5E_BEGIN_TRY + { + file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl); + } H5E_END_TRY; if (file1 != FAIL) TEST_ERROR @@ -9883,7 +9976,10 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) op_data.code = 1; /* Attempt to reopen group2 (should fail) */ - H5E_BEGIN_TRY { group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); } + H5E_BEGIN_TRY + { + group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); + } H5E_END_TRY; if (group != FAIL) TEST_ERROR @@ -9892,7 +9988,10 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) op_data.code = 2; /* Attempt to reopen group2 (should fail) */ - H5E_BEGIN_TRY { group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); } + H5E_BEGIN_TRY + { + group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); + } H5E_END_TRY; if (group != FAIL) TEST_ERROR @@ -9977,7 +10076,10 @@ external_reset_register(void) return SUCCEED; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return FAIL; } /* end external_reset_register() */ @@ -10046,7 +10148,10 @@ external_link_win1(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file via main file's CWD*/ @@ -10140,7 +10245,10 @@ external_link_win2(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file directly */ @@ -10231,7 +10339,10 @@ external_link_win3(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file directly */ @@ -10319,7 +10430,10 @@ external_link_win4(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file via main file's absolute drive/relative path */ @@ -10417,7 +10531,10 @@ external_link_win5(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file via main file's rel drive/abs path */ @@ -10512,7 +10629,10 @@ external_link_win6(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file via target file's rel path in current drive */ @@ -10604,7 +10724,10 @@ external_link_win7(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file via main file's local host/main drive*/ @@ -10701,7 +10824,10 @@ external_link_win8(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file directly */ @@ -10793,7 +10919,10 @@ external_link_win9(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* should be able to find the target file via main file's local host/main drive*/ @@ -10865,7 +10994,10 @@ external_link_recursive(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through dangling file external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); + } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -12706,7 +12838,10 @@ external_dont_fail_to_source(hid_t fapl, hbool_t new_format) TEST_ERROR /* Attempt to open the object the link points to. This should fail */ - H5E_BEGIN_TRY { oid = H5Oopen(fid, "link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + oid = H5Oopen(fid, "link", H5P_DEFAULT); + } H5E_END_TRY if (oid >= 0) FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link") @@ -15103,7 +15238,10 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) TEST_ERROR /* Try opening through what is now too many soft links */ - H5E_BEGIN_TRY { gid = H5Oopen(fid, "soft5", plist); } + H5E_BEGIN_TRY + { + gid = H5Oopen(fid, "soft5", plist); + } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -15426,7 +15564,10 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) return SUCCEED; error: - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; return FAIL; } /* end check_all_closed() */ @@ -15552,7 +15693,10 @@ build_visit_file(hid_t fapl) return (fid); error: - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; return FAIL; } /* end build_visit_file() */ @@ -16027,7 +16171,10 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) return SUCCEED; error: - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; return FAIL; } /* end obj_visit_stop() */ @@ -16537,7 +16684,10 @@ obj_exists(hid_t fapl, hbool_t new_format) /* Hard links */ /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ - H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT); + } H5E_END_TRY if (status >= 0) TEST_ERROR @@ -16553,7 +16703,10 @@ obj_exists(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ - H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); + } H5E_END_TRY if (status >= 0) TEST_ERROR @@ -16867,7 +17020,10 @@ corder_create_empty(hid_t fapl) TEST_ERROR /* Setting invalid combination of a group order creation order indexing on should fail */ - H5E_BEGIN_TRY { ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); } + H5E_BEGIN_TRY + { + ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); + } H5E_END_TRY; if (ret > 0) { H5_FAILED(); @@ -19339,7 +19495,10 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, u /* Check for iteration routine indicating failure */ skip = 0; - H5E_BEGIN_TRY { ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -19502,7 +19661,10 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on compact group */ skip = (hsize_t)u; - H5E_BEGIN_TRY { ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -19532,7 +19694,10 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on dense group */ skip = (hsize_t)u; - H5E_BEGIN_TRY { ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -19827,20 +19992,29 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links /* Check for iteration routine indicating failure */ skip = 0; - H5E_BEGIN_TRY { ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR /* Check for iteration w/bad location ID */ skip = 0; - H5E_BEGIN_TRY { ret = H5Literate2((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5Literate2((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - H5E_BEGIN_TRY { ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_cb, iter_info); } + H5E_BEGIN_TRY + { + ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_cb, iter_info); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -19930,7 +20104,10 @@ link_iterate_old(hid_t fapl) /* Check for out of bound iteration on old-style group */ skip = (hsize_t)u; - H5E_BEGIN_TRY { ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); } + H5E_BEGIN_TRY + { + ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -20535,7 +20712,10 @@ open_by_idx_old(hid_t fapl) TEST_ERROR /* Try to open on object in an empty group */ - H5E_BEGIN_TRY { ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -20571,7 +20751,10 @@ open_by_idx_old(hid_t fapl) TEST_ERROR /* Check for out of bound open by index */ - H5E_BEGIN_TRY { ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR diff --git a/test/links_env.c b/test/links_env.c index 1b4b80b..590be20 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -106,7 +106,10 @@ external_link_env(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */ diff --git a/test/mf.c b/test/mf.c index bbe99b1..59088dc 100644 --- a/test/mf.c +++ b/test/mf.c @@ -937,17 +937,26 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) TEST_ERROR /* Reading & writing with a temporary address value should fail */ - H5E_BEGIN_TRY { status = H5F_block_read(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), &buf); } + H5E_BEGIN_TRY + { + status = H5F_block_read(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), &buf); + } H5E_END_TRY; if (status >= 0) TEST_ERROR - H5E_BEGIN_TRY { status = H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), &buf); } + H5E_BEGIN_TRY + { + status = H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), &buf); + } H5E_END_TRY; if (status >= 0) TEST_ERROR /* Freeing a temporary address value should fail */ - H5E_BEGIN_TRY { status = H5MF_xfree(f, H5FD_MEM_SUPER, tmp_addr, (hsize_t)TBLOCK_SIZE30); } + H5E_BEGIN_TRY + { + status = H5MF_xfree(f, H5FD_MEM_SUPER, tmp_addr, (hsize_t)TBLOCK_SIZE30); + } H5E_END_TRY; if (status >= 0) TEST_ERROR @@ -985,13 +994,19 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) TEST_ERROR /* Test that pushing temporary space allocation into normal space fails */ - H5E_BEGIN_TRY { check_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3)); } + H5E_BEGIN_TRY + { + check_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3)); + } H5E_END_TRY; if (H5F_addr_defined(check_addr)) TEST_ERROR /* Test that pushing normal space allocation into temporary space fails */ - H5E_BEGIN_TRY { check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)(maxaddr / 3)); } + H5E_BEGIN_TRY + { + check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)(maxaddr / 3)); + } H5E_END_TRY; if (H5F_addr_defined(check_addr)) TEST_ERROR @@ -1022,7 +1037,10 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_tmp() */ @@ -2132,7 +2150,10 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_fs_absorb() */ @@ -2417,7 +2438,10 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_aggr_alloc2() */ @@ -2580,7 +2604,10 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_aggr_alloc3() */ @@ -2745,7 +2772,10 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_aggr_alloc4() */ @@ -2868,7 +2898,10 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_aggr_alloc5() */ @@ -3028,7 +3061,10 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_aggr_alloc6() */ @@ -3217,7 +3253,10 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_aggr_alloc7() */ @@ -3513,7 +3552,10 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_aggr_extend() */ @@ -3750,7 +3792,10 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_aggr_absorb() */ @@ -4038,7 +4083,10 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_align_eoa() */ @@ -4329,7 +4377,10 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_align_fs() */ @@ -4601,7 +4652,10 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_align_alloc1() */ @@ -4891,7 +4945,10 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_align_alloc2() */ @@ -5273,7 +5330,10 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_align_alloc3() */ @@ -5485,7 +5545,10 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_align_alloc4() */ @@ -5711,7 +5774,10 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_align_alloc5() */ @@ -6022,7 +6088,10 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return 1; } /* test_mf_align_alloc6() */ @@ -6191,7 +6260,10 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_mf_bug1() */ @@ -7638,7 +7710,10 @@ test_dichotomy(hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return (1); } /* test_dichotomy() */ @@ -8546,7 +8621,10 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) return (0); error: - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; return (1); diff --git a/test/mount.c b/test/mount.c index 1ed8f58..c5ac9b3 100644 --- a/test/mount.c +++ b/test/mount.c @@ -96,7 +96,10 @@ setup(hid_t fapl) return 0; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return -1; } /* end setup() */ @@ -197,7 +200,10 @@ test_illegal(hid_t fapl) FAIL_STACK_ERROR /* Try mounting a file on itself */ - H5E_BEGIN_TRY { status = H5Fmount(file1, "/mnt1", file1, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Fmount(file1, "/mnt1", file1, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -214,7 +220,10 @@ test_illegal(hid_t fapl) FAIL_STACK_ERROR if (H5Fmount(mnt, ".", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Fmount(mnt, ".", file3, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Fmount(mnt, ".", file3, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -236,7 +245,10 @@ test_illegal(hid_t fapl) FAIL_STACK_ERROR if (H5Fmount(mnt, ".", file3, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Fmount(mnt, ".", file3b, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Fmount(mnt, ".", file3b, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -251,7 +263,10 @@ test_illegal(hid_t fapl) /* Try to create a "weak" cycle */ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Fmount(file2, "/mnt1/file2", file1b, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Fmount(file2, "/mnt1/file2", file1b, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -353,7 +368,10 @@ test_samefile(hid_t fapl) FAIL_STACK_ERROR if (!grp_info.mounted) FAIL_PUTS_ERROR(" Group should have 'mounted' flag set.") - H5E_BEGIN_TRY { status = H5Fmount(mnt1b, ".", file3, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Fmount(mnt1b, ".", file3, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR(" Mounting different files at one mount point should have failed.") @@ -389,7 +407,10 @@ test_samefile(hid_t fapl) FAIL_STACK_ERROR if (!grp_info.mounted) FAIL_PUTS_ERROR(" Group should have 'mounted' flag set.") - H5E_BEGIN_TRY { status = H5Fmount(mnt1b, ".", file2, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Fmount(mnt1b, ".", file2, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR(" Mounting same files at one mount point should have failed.") @@ -470,7 +491,10 @@ test_hide(hid_t fapl) FAIL_STACK_ERROR /* Original names under file1:/mnt1 should not be accessible */ - H5E_BEGIN_TRY { grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); + } H5E_END_TRY; if (grp >= 0) { H5_FAILED(); @@ -958,7 +982,10 @@ test_unlink(hid_t fapl) FAIL_STACK_ERROR if (H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -976,7 +1003,10 @@ test_unlink(hid_t fapl) */ if (H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -999,14 +1029,20 @@ test_unlink(hid_t fapl) * the mount point because the name doesn't exist anymore. We must * supply the mount point directly. */ - H5E_BEGIN_TRY { status = H5Funmount(file1, "/mnt_unlink"); } + H5E_BEGIN_TRY + { + status = H5Funmount(file1, "/mnt_unlink"); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); HDprintf(" %d: Unmount by name should not have been allowed!\n", __LINE__); TEST_ERROR } /* end if */ - H5E_BEGIN_TRY { status = H5Funmount(file2, "/"); } + H5E_BEGIN_TRY + { + status = H5Funmount(file2, "/"); + } H5E_END_TRY; if (status >= 0) { H5_FAILED(); @@ -2412,7 +2448,10 @@ test_fcdegree_same(hid_t fapl) TEST_ERROR /* Try mounting file with different file close degree (should fail) */ - H5E_BEGIN_TRY { ret = H5Fmount(gidA, ".", fid2, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Fmount(gidA, ".", fid2, H5P_DEFAULT); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2565,7 +2604,10 @@ test_fcdegree_semi(hid_t fapl) TEST_ERROR /* Try closing file #2 (should fail, since there are still objects open) */ - H5E_BEGIN_TRY { ret = H5Fclose(fid2); } + H5E_BEGIN_TRY + { + ret = H5Fclose(fid2); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2575,7 +2617,10 @@ test_fcdegree_semi(hid_t fapl) TEST_ERROR /* Try closing file #2 (should still fail, since there are still objects open in child file) */ - H5E_BEGIN_TRY { ret = H5Fclose(fid2); } + H5E_BEGIN_TRY + { + ret = H5Fclose(fid2); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2713,11 +2758,17 @@ test_fcdegree_strong(hid_t fapl) TEST_ERROR /* Check that objects are closed */ - H5E_BEGIN_TRY { ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC); } + H5E_BEGIN_TRY + { + ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC); } + H5E_BEGIN_TRY + { + ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2851,11 +2902,17 @@ test_acc_perm(hid_t fapl) TEST_ERROR /* Attempt to create objects in read only file (should fail) */ - H5E_BEGIN_TRY { bad_id = H5Gcreate2(gidAM, "Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + bad_id = H5Gcreate2(gidAM, "Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (bad_id >= 0) TEST_ERROR - H5E_BEGIN_TRY { bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (bad_id >= 0) TEST_ERROR @@ -2895,7 +2952,10 @@ test_acc_perm(hid_t fapl) TEST_ERROR /* Attempt to create objects in read only file again (should fail) */ - H5E_BEGIN_TRY { bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (bad_id >= 0) TEST_ERROR @@ -3294,7 +3354,10 @@ test_nested_survive(hid_t fapl) TEST_ERROR /* Open object in file #3 through file #1 mount path (should fail) */ - H5E_BEGIN_TRY { gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT); + } H5E_END_TRY; if (gidAMS >= 0) TEST_ERROR @@ -3808,7 +3871,10 @@ test_cut_graph(hid_t fapl) TEST_ERROR /* Attempt to open an object in file #4, from file #1 */ - H5E_BEGIN_TRY { gidK = H5Gopen2(gidQ, "/A/D/K", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gidK = H5Gopen2(gidQ, "/A/D/K", H5P_DEFAULT); + } H5E_END_TRY; if (gidK >= 0) TEST_ERROR @@ -3828,7 +3894,10 @@ test_cut_graph(hid_t fapl) TEST_ERROR /* Attempt to open an object in file #6, from file #5 */ - H5E_BEGIN_TRY { gidO = H5Gopen2(gidM, "/B/H/O", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gidO = H5Gopen2(gidM, "/B/H/O", H5P_DEFAULT); + } H5E_END_TRY; if (gidO >= 0) TEST_ERROR @@ -4039,7 +4108,10 @@ test_symlink(hid_t fapl) TEST_ERROR /* Attempt to open an object in file #3 (should fail) */ - H5E_BEGIN_TRY { gidL = H5Gopen2(fid1, "L", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gidL = H5Gopen2(fid1, "L", H5P_DEFAULT); + } H5E_END_TRY; if (gidL >= 0) TEST_ERROR diff --git a/test/objcopy.c b/test/objcopy.c index 4b076ba..681b8a5 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1728,7 +1728,9 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) return TRUE; error: - H5E_BEGIN_TRY {} + H5E_BEGIN_TRY + { + } H5E_END_TRY; return FALSE; } /* end compare_groups() */ @@ -2539,7 +2541,10 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl_dst, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(fapl_dst, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index 33f8900..23df121 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -1438,7 +1438,9 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) return TRUE; error: - H5E_BEGIN_TRY {} + H5E_BEGIN_TRY + { + } H5E_END_TRY; return FALSE; } /* end compare_groups() */ diff --git a/test/ohdr.c b/test/ohdr.c index cc5d526..b7af77f 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -296,7 +296,10 @@ test_ohdr_cache(char *filename, hid_t fapl) return SUCCEED; error: - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; return FAIL; @@ -549,7 +552,10 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) TESTING("object in r/o file with unknown header message & 'fail if unknown always' flag set"); /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */ - H5E_BEGIN_TRY { did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); + } H5E_END_TRY; if (did >= 0) { H5Dclose(did); @@ -713,7 +719,10 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" * flag */ - H5E_BEGIN_TRY { did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT); + } H5E_END_TRY; if (did >= 0) { H5Dclose(did); @@ -725,7 +734,10 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) TESTING("object in r/w file with unknown header message & 'fail if unknown always' flag set"); /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */ - H5E_BEGIN_TRY { did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); + } H5E_END_TRY; if (did >= 0) { H5Dclose(did); @@ -1774,7 +1786,10 @@ main(void) char msg[80]; /* Message for file format version */ /* Set version bounds before opening the file */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ @@ -1967,7 +1982,10 @@ main(void) if (ro != time_new) TEST_ERROR time_new = 33333333; - H5E_BEGIN_TRY { ret = H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new); } + H5E_BEGIN_TRY + { + ret = H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2050,7 +2068,10 @@ main(void) error: HDputs("*** TESTS FAILED ***"); - H5E_BEGIN_TRY { H5Fclose(file); } + H5E_BEGIN_TRY + { + H5Fclose(file); + } H5E_END_TRY; if (api_ctx_pushed) diff --git a/test/page_buffer.c b/test/page_buffer.c index 9aade63..b80d330 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -408,7 +408,10 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if (H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0) TEST_ERROR; - H5E_BEGIN_TRY { file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; if (file_id >= 0) @@ -426,7 +429,10 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if (H5Pset_page_buffer_size(fapl, 511, 0, 0) < 0) TEST_ERROR; - H5E_BEGIN_TRY { file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; if (file_id >= 0) @@ -435,7 +441,10 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) /* Test setting a page buffer with sum of min meta and raw * data percentage > 100 - should fail */ - H5E_BEGIN_TRY { ret = H5Pset_page_buffer_size(fapl, 512, 50, 51); } + H5E_BEGIN_TRY + { + ret = H5Pset_page_buffer_size(fapl, 512, 50, 51); + } H5E_END_TRY; if (ret >= 0) @@ -2054,7 +2063,10 @@ verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* try to create the file -- should fail */ - H5E_BEGIN_TRY { file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; if (file_id >= 0) @@ -2083,7 +2095,10 @@ verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) /* try to open the file using the fapl prepared above which enables * page buffering. Should fail. */ - H5E_BEGIN_TRY { file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl); + } H5E_END_TRY; if (file_id >= 0) @@ -2195,7 +2210,10 @@ main(void) error: HDprintf("***** %d Page Buffering TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - H5E_BEGIN_TRY { H5Pclose(fapl); } + H5E_BEGIN_TRY + { + H5Pclose(fapl); + } H5E_END_TRY; if (api_ctx_pushed) diff --git a/test/reserved.c b/test/reserved.c index 1286893..1ea73a6 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -65,7 +65,10 @@ rsrv_heap(void) * should throw an error. */ for (i = 0; i < 200; i++) { - H5E_BEGIN_TRY { dataspace_id = H5Screate_simple(1, dims, dims); } + H5E_BEGIN_TRY + { + dataspace_id = H5Screate_simple(1, dims, dims); + } H5E_END_TRY HDsprintf(dset_name, "Dset %d", i); @@ -80,7 +83,10 @@ rsrv_heap(void) if (dataset_id < 0) break; - H5E_BEGIN_TRY { H5Dwrite(dataset_id, H5T_NATIVE_INT, dataspace_id, dataspace_id, H5P_DEFAULT, &i); } + H5E_BEGIN_TRY + { + H5Dwrite(dataset_id, H5T_NATIVE_INT, dataspace_id, dataspace_id, H5P_DEFAULT, &i); + } H5E_END_TRY if (H5Dclose(dataset_id) < 0) diff --git a/test/ros3.c b/test/ros3.c index 9fb3ebe..54518f4 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -625,7 +625,10 @@ error: ***********/ if (fapl_id < 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } return 1; @@ -699,7 +702,10 @@ test_ros3_fapl(void) return 0; error: - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; return 1; @@ -867,7 +873,10 @@ test_vfd_open(void) else if (T.which_fapl == FAPL_ROS3_ANON) _fapl_id = fapl_id; - H5E_BEGIN_TRY { fd = H5FDopen(T.url, T.flags, _fapl_id, T.maxaddr); } + H5E_BEGIN_TRY + { + fd = H5FDopen(T.url, T.flags, _fapl_id, T.maxaddr); + } H5E_END_TRY; if (NULL != fd) JSVERIFY(1, 0, T.message); /* wrapper to print message and fail */ @@ -908,11 +917,17 @@ error: (void)H5FDclose(fd); } if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } if (fapl_file_access >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_file_access); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_file_access); + } H5E_END_TRY; } if (curl_ready == TRUE) { @@ -1043,7 +1058,10 @@ error: if (TRUE == curl_ready) curl_global_cleanup(); if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } @@ -1138,7 +1156,10 @@ error: (void)H5FDclose(file_shakespeare); } if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } @@ -1338,7 +1359,10 @@ error: if (file_raven) (void)H5FDclose(file_raven); if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } @@ -1448,7 +1472,10 @@ error: ***********/ if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } if (file) { @@ -1579,7 +1606,10 @@ error: if (TRUE == curl_ready) curl_global_cleanup(); if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } @@ -1685,7 +1715,10 @@ error: HDfflush(stdout); if (fapl_id >= 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } if (file > 0) diff --git a/test/set_extent.c b/test/set_extent.c index c69a492..5a07362 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -388,7 +388,10 @@ do_ranks(hid_t fapl, hbool_t new_format) return 0; error: - H5E_BEGIN_TRY { H5Pclose(dcpl); } + H5E_BEGIN_TRY + { + H5Pclose(dcpl); + } H5E_END_TRY return -1; @@ -414,7 +417,10 @@ do_layouts(hid_t fapl) new_fapl = H5Pcopy(fapl); /* Set version bounds */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ @@ -440,7 +446,10 @@ do_layouts(hid_t fapl) return 0; error: - H5E_BEGIN_TRY { H5Pclose(new_fapl); } + H5E_BEGIN_TRY + { + H5Pclose(new_fapl); + } H5E_END_TRY; return -1; } @@ -2075,7 +2084,10 @@ test_layouts(H5D_layout_t layout, hid_t fapl) *------------------------------------------------------------------------- */ - H5E_BEGIN_TRY { ret = H5Dset_extent(did, dims_e); } + H5E_BEGIN_TRY + { + ret = H5Dset_extent(did, dims_e); + } H5E_END_TRY; if (ret >= 0) @@ -2121,7 +2133,10 @@ test_layouts(H5D_layout_t layout, hid_t fapl) *------------------------------------------------------------------------- */ - H5E_BEGIN_TRY { ret = H5Dset_extent(did, dims_s); } + H5E_BEGIN_TRY + { + ret = H5Dset_extent(did, dims_s); + } H5E_END_TRY; if (ret >= 0) diff --git a/test/stab.c b/test/stab.c index 5f9cad7..798619d 100644 --- a/test/stab.c +++ b/test/stab.c @@ -148,12 +148,18 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format) TEST_ERROR /* Check that creating groups with no-op names isn't allowed */ - H5E_BEGIN_TRY { g1 = H5Gcreate2(fid, "/", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + g1 = H5Gcreate2(fid, "/", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY if (g1 >= 0) TEST_ERROR - H5E_BEGIN_TRY { g1 = H5Gcreate2(fid, "./././", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + g1 = H5Gcreate2(fid, "./././", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY if (g1 >= 0) TEST_ERROR @@ -1358,7 +1364,10 @@ corrupt_stab_msg(void) TEST_ERROR /* Verify that an error is thrown when we try to access the dataset */ - H5E_BEGIN_TRY { did = H5Dopen2(fid, CORRUPT_STAB_DSET, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dopen2(fid, CORRUPT_STAB_DSET, H5P_DEFAULT); + } H5E_END_TRY if (did >= 0) TEST_ERROR diff --git a/test/swmr.c b/test/swmr.c index 2f90114..607b448 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -163,7 +163,10 @@ test_metadata_read_attempts(hid_t in_fapl) TEST_ERROR /* Set the # of read attempts to 0--should fail */ - H5E_BEGIN_TRY { ret = H5Pset_metadata_read_attempts(fapl, 0); } + H5E_BEGIN_TRY + { + ret = H5Pset_metadata_read_attempts(fapl, 0); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -1649,7 +1652,10 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format) /* Should fail to enable SWMR for non-latest-format */ /* Should succeed in enabling SWMR for latest format */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (new_format) { if (ret < 0) @@ -1974,7 +1980,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl); /* Should fail to enable SWMR writing when the file is already in SWMR writing mode */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -1997,7 +2006,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Should fail to enable SWMR writing when there is an opened named datatype */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2021,7 +2033,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) TEST_ERROR /* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2047,7 +2062,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Should fail to enable SWMR writing when the file is already in SWMR writing mode */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2063,7 +2081,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Should fail to enable SWMR writing when the file is opened with read only access */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2079,7 +2100,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Should fail to enable SWMR writing when the file is opened with SWMR read access only */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2109,7 +2133,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Should fail to enable SWMR writing when there are opened named datatype and attribute */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2119,7 +2146,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Still fail to enable SWMR writing when the attribute is still opened */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2164,7 +2194,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) TEST_ERROR /* Should fail for a second call to enable SWMR writing mode */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2188,7 +2221,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Should fail to enable SWMR writing mode for fid2 */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid2); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid2); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2214,7 +2250,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) TEST_ERROR /* Should fail to enable SWMR writing for fid2 */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid2); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid2); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2241,7 +2280,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) /* Should fail to open the file with SWMR write + latest format due to superblock version not at least * 3 */ - H5E_BEGIN_TRY { bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, new_fapl); } + H5E_BEGIN_TRY + { + bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, new_fapl); + } H5E_END_TRY; if (bad_fid >= 0) TEST_ERROR @@ -2250,7 +2292,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) /* Should fail to open the file with SWMR write + non-latest-format due to superblock version not at * least 3 */ - H5E_BEGIN_TRY { bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; if (bad_fid >= 0) TEST_ERROR @@ -2262,7 +2307,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Should fail to enable SWMR writing due to superblock version not at least 3 */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2277,7 +2325,10 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */ - H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); } + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -2732,7 +2783,10 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) } /* Should fail in opening the test file */ - H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); + } H5E_END_TRY; if (fid >= 0) HDexit(EXIT_FAILURE); @@ -2805,7 +2859,10 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) } /* Should fail in opening the test file */ - H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); + } H5E_END_TRY; if (fid >= 0) HDexit(EXIT_FAILURE); @@ -2882,7 +2939,10 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) } /* Should fail in opening the test file */ - H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; if (fid >= 0) HDexit(EXIT_FAILURE); @@ -3170,7 +3230,10 @@ test_object_flush_cb(hid_t in_fapl) * To verify the failure condition in setting object flush property */ /* Should fail if the callback function is not defined but user data is defined */ - H5E_BEGIN_TRY { ret = H5Pset_object_flush_cb(fapl, NULL, &flush_ct); } + H5E_BEGIN_TRY + { + ret = H5Pset_object_flush_cb(fapl, NULL, &flush_ct); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -3471,19 +3534,28 @@ test_append_flush_generic(void) FAIL_STACK_ERROR /* Invalid dataset rank: zero value */ - H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 0, NULL, NULL, &count); } + H5E_BEGIN_TRY + { + ret = H5Pset_append_flush(dapl, 0, NULL, NULL, &count); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR /* Invalid dataset rank: > H5S_MAX_RANK */ - H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, H5S_MAX_RANK + 1, NULL, NULL, &count); } + H5E_BEGIN_TRY + { + ret = H5Pset_append_flush(dapl, H5S_MAX_RANK + 1, NULL, NULL, &count); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR /* No boundary specified */ - H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, NULL, NULL, &count); } + H5E_BEGIN_TRY + { + ret = H5Pset_append_flush(dapl, 2, NULL, NULL, &count); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -3493,7 +3565,10 @@ test_append_flush_generic(void) boundary[1] = 1; /* Undefined callback function but defined user data */ - H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, NULL, &count); } + H5E_BEGIN_TRY + { + ret = H5Pset_append_flush(dapl, 2, boundary, NULL, &count); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -3501,7 +3576,10 @@ test_append_flush_generic(void) /* Invalid boundary size: negative value */ boundary[0] = (hsize_t)-1; boundary[1] = 1; - H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); } + H5E_BEGIN_TRY + { + ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -3509,7 +3587,10 @@ test_append_flush_generic(void) /* Invalid boundary size: H5S_UNLIMITED */ boundary[0] = 1; boundary[1] = H5S_UNLIMITED; - H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); } + H5E_BEGIN_TRY + { + ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); + } H5E_END_TRY; if (ret >= 0) TEST_ERROR @@ -3552,7 +3633,10 @@ test_append_flush_generic(void) return 0; error: - H5E_BEGIN_TRY { H5Pclose(dapl); } + H5E_BEGIN_TRY + { + H5Pclose(dapl); + } H5E_END_TRY; return -1; @@ -3670,7 +3754,10 @@ test_append_flush_dataset_chunked(hid_t in_fapl) FAIL_STACK_ERROR /* Should fail to Create the dataset */ - H5E_BEGIN_TRY { did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); } + H5E_BEGIN_TRY + { + did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); + } H5E_END_TRY; if (did2 >= 0) TEST_ERROR @@ -3681,7 +3768,10 @@ test_append_flush_dataset_chunked(hid_t in_fapl) FAIL_STACK_ERROR /* Should fail to create the dataset */ - H5E_BEGIN_TRY { did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); } + H5E_BEGIN_TRY + { + did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); + } H5E_END_TRY; if (did2 >= 0) TEST_ERROR @@ -3693,7 +3783,10 @@ test_append_flush_dataset_chunked(hid_t in_fapl) FAIL_STACK_ERROR; /* Should fail to open the dataset */ - H5E_BEGIN_TRY { did2 = H5Dopen2(fid, "dataset2", dapl); } + H5E_BEGIN_TRY + { + did2 = H5Dopen2(fid, "dataset2", dapl); + } H5E_END_TRY; if (did2 >= 0) TEST_ERROR @@ -4332,7 +4425,10 @@ test_file_lock_same(hid_t in_fapl) TEST_ERROR /* Open file with RDWR should fail */ - H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); } + H5E_BEGIN_TRY + { + fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); + } H5E_END_TRY; if (fid2 >= 0) TEST_ERROR @@ -4436,7 +4532,10 @@ test_file_lock_swmr_same(hid_t in_fapl) /* * Case a: RDWR|SWRM_READ : should fail */ - H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_READ, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_READ, fapl); + } H5E_END_TRY; if (fid >= 0) TEST_ERROR @@ -4444,7 +4543,10 @@ test_file_lock_swmr_same(hid_t in_fapl) /* * Case b: RDWR|SWMM_WRTE|SWMR_READ : should fail */ - H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); + } H5E_END_TRY; if (fid >= 0) TEST_ERROR @@ -4452,7 +4554,10 @@ test_file_lock_swmr_same(hid_t in_fapl) /* * Case c: RDONLY|SWMM_WRITE : should fail */ - H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; if (fid >= 0) TEST_ERROR @@ -4460,7 +4565,10 @@ test_file_lock_swmr_same(hid_t in_fapl) /* * Case d: RDONLY|SWMM_WRITE|SWMR_READ : should fail */ - H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); + } H5E_END_TRY; if (fid >= 0) TEST_ERROR @@ -4475,7 +4583,10 @@ test_file_lock_swmr_same(hid_t in_fapl) if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; if (fid2 >= 0) TEST_ERROR @@ -4568,7 +4679,10 @@ test_file_lock_swmr_same(hid_t in_fapl) if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + } H5E_END_TRY; if (fid2 >= 0) TEST_ERROR @@ -4583,7 +4697,10 @@ test_file_lock_swmr_same(hid_t in_fapl) if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; if (fid2 >= 0) TEST_ERROR @@ -4630,7 +4747,10 @@ test_file_lock_swmr_same(hid_t in_fapl) if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; if (fid2 >= 0) TEST_ERROR @@ -4645,7 +4765,10 @@ test_file_lock_swmr_same(hid_t in_fapl) if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } + H5E_BEGIN_TRY + { + fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); + } H5E_END_TRY; if (fid2 >= 0) TEST_ERROR @@ -4756,7 +4879,10 @@ test_file_lock_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); + } H5E_END_TRY; /* Should fail */ @@ -4830,7 +4956,10 @@ test_file_lock_concur(hid_t in_fapl) } /* Opens the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); + } H5E_END_TRY; /* Should fail */ @@ -4905,7 +5034,10 @@ test_file_lock_concur(hid_t in_fapl) } /* Opens the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); + } H5E_END_TRY; /* Should fail */ @@ -4980,7 +5112,10 @@ test_file_lock_concur(hid_t in_fapl) } /* Opens the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); + } H5E_END_TRY; /* Should succeed */ @@ -5141,7 +5276,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; /* Should fail */ @@ -5216,7 +5354,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); + } H5E_END_TRY; /* Should fail */ @@ -5291,7 +5432,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + } H5E_END_TRY; /* Should fail */ @@ -5365,7 +5509,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; /* Should fail */ @@ -5439,7 +5586,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); + } H5E_END_TRY; /* Should succeed */ @@ -5516,7 +5666,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); + } H5E_END_TRY; /* Should fail */ @@ -5591,7 +5744,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); + } H5E_END_TRY; /* Should fail */ @@ -5666,7 +5822,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; /* Should fail */ @@ -5741,7 +5900,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); + } H5E_END_TRY; /* Should succeed */ @@ -5897,7 +6059,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); + } H5E_END_TRY; /* Should fail */ @@ -5972,7 +6137,10 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); + } H5E_END_TRY; /* Should succeed */ @@ -6279,7 +6447,10 @@ test_different_lock_flags(hid_t in_fapl) TEST_ERROR /* Open the test file with different flags (should FAIL) */ - H5E_BEGIN_TRY { fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); } + H5E_BEGIN_TRY + { + fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + } H5E_END_TRY; if (H5I_INVALID_HID != fid3) FAIL_PUTS_ERROR("Should not have been able to open a file with different locking flags") @@ -6347,7 +6518,10 @@ test_swmr_vfd_flag(void) fid = -1; h5_fixname(FILENAME[0], bad_fapl, filename, sizeof(filename)); - H5E_BEGIN_TRY { fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, bad_fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, bad_fapl); + } H5E_END_TRY; if (fid >= 0) TEST_ERROR; diff --git a/test/tarray.c b/test/tarray.c index 0ea86e22..8b518cf 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -235,11 +235,17 @@ test_array_funcs(void) ret = H5Tset_offset(type, (size_t)16); CHECK(ret, FAIL, "H5Tset_offset"); - H5E_BEGIN_TRY { cset = H5Tget_cset(type); } + H5E_BEGIN_TRY + { + cset = H5Tget_cset(type); + } H5E_END_TRY; VERIFY(cset, FAIL, "H5Tget_cset"); - H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); } + H5E_BEGIN_TRY + { + strpad = H5Tget_strpad(type); + } H5E_END_TRY; VERIFY(strpad, FAIL, "H5Tget_strpad"); diff --git a/test/tattr.c b/test/tattr.c index 06856d7..3f0c102 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -6010,7 +6010,10 @@ test_attr_info_null_info_pointer(hid_t fcpl, hid_t fapl) attr = H5Acreate2(fid, GET_INFO_NULL_POINTER_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); - H5E_BEGIN_TRY { err_ret = H5Aget_info(attr, NULL); } + H5E_BEGIN_TRY + { + err_ret = H5Aget_info(attr, NULL); + } H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Aget_info"); @@ -6071,22 +6074,34 @@ test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl) attr = H5Acreate2(fid, INVALID_RENAME_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); - H5E_BEGIN_TRY { err_ret = H5Arename(fid, NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME); } + H5E_BEGIN_TRY + { + err_ret = H5Arename(fid, NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME); + } H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename"); - H5E_BEGIN_TRY { err_ret = H5Arename(fid, "", INVALID_RENAME_TEST_NEW_ATTR_NAME); } + H5E_BEGIN_TRY + { + err_ret = H5Arename(fid, "", INVALID_RENAME_TEST_NEW_ATTR_NAME); + } H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename"); - H5E_BEGIN_TRY { err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, NULL); } + H5E_BEGIN_TRY + { + err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, NULL); + } H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename"); - H5E_BEGIN_TRY { err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, ""); } + H5E_BEGIN_TRY + { + err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, ""); + } H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename"); @@ -6107,12 +6122,18 @@ test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl) CHECK(err_ret, SUCCEED, "H5Arename_by_name"); - H5E_BEGIN_TRY { err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, NULL, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, NULL, H5P_DEFAULT); + } H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename_by_name"); - H5E_BEGIN_TRY { err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, "", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, "", H5P_DEFAULT); + } H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename_by_name"); @@ -6159,7 +6180,10 @@ test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl) H5Acreate2(fid, GET_NAME_INVALID_BUF_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); - H5E_BEGIN_TRY { err_ret = H5Aget_name(attr, 1, NULL); } + H5E_BEGIN_TRY + { + err_ret = H5Aget_name(attr, 1, NULL); + } H5E_END_TRY; VERIFY(err_ret, FAIL, "H5Aget_name"); diff --git a/test/tfile.c b/test/tfile.c index 364c4f8..c8c123c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -309,25 +309,46 @@ test_file_create(void) CHECK(tmpl1, FAIL, "H5Pcreate"); /* Try setting some bad userblock sizes */ - H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1); } + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2); } + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3); } + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4); } + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5); } + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6); } + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7); } + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_userblock"); @@ -1282,7 +1303,10 @@ test_get_file_id(void) plist = H5Pcreate(H5P_FILE_ACCESS); CHECK(plist, FAIL, "H5Pcreate"); - H5E_BEGIN_TRY { fid2 = H5Iget_file_id(plist); } + H5E_BEGIN_TRY + { + fid2 = H5Iget_file_id(plist); + } H5E_END_TRY; VERIFY(fid2, FAIL, "H5Iget_file_id"); @@ -1543,7 +1567,10 @@ test_file_perm2(void) CHECK(filero, FAIL, "H5Fopen"); /* Create a group with the read-only file handle (should fail) */ - H5E_BEGIN_TRY { group = H5Gcreate2(filero, "MY_GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + group = H5Gcreate2(filero, "MY_GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(group, FAIL, "H5Gcreate2"); @@ -1556,7 +1583,10 @@ test_file_perm2(void) VERIFY(dset, FAIL, "H5Dcreate2"); /* Create an attribute with the read-only file handle (should fail) */ - H5E_BEGIN_TRY { attr = H5Acreate2(filero, "MY_ATTR", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + attr = H5Acreate2(filero, "MY_ATTR", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(attr, FAIL, "H5Acreate2"); @@ -1564,7 +1594,10 @@ test_file_perm2(void) CHECK(type, FAIL, "H5Tcopy"); /* Commit a datatype with the read-only file handle (should fail) */ - H5E_BEGIN_TRY { ret = H5Tcommit2(filero, "MY_DTYPE", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Tcommit2(filero, "MY_DTYPE", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Tcommit2"); @@ -1882,7 +1915,10 @@ test_file_delete(hid_t fapl_id) VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); /* Attempt to delete the file - should fail */ - H5E_BEGIN_TRY { ret = H5Fdelete(filename, fapl_id); } + H5E_BEGIN_TRY + { + ret = H5Fdelete(filename, fapl_id); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Fdelete"); @@ -1914,12 +1950,18 @@ test_file_delete(hid_t fapl_id) * may not have been created since we created it with * open(2) and not the library. */ - H5E_BEGIN_TRY { is_hdf5 = H5Fis_accessible(filename, fapl_id); } + H5E_BEGIN_TRY + { + is_hdf5 = H5Fis_accessible(filename, fapl_id); + } H5E_END_TRY; CHECK(is_hdf5, TRUE, "H5Fis_accessible"); /* Try to delete it (should fail) */ - H5E_BEGIN_TRY { ret = H5Fdelete(filename, fapl_id); } + H5E_BEGIN_TRY + { + ret = H5Fdelete(filename, fapl_id); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Fdelete"); @@ -1962,22 +2004,34 @@ test_file_open_dot(void) CHECK(sid, FAIL, "H5Screate"); /* Create a dataset with no name using the file ID */ - H5E_BEGIN_TRY { did = H5Dcreate2(fid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dcreate2(fid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(did, FAIL, "H5Dcreate2"); /* Create a dataset with no name using the group ID */ - H5E_BEGIN_TRY { did = H5Dcreate2(gid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dcreate2(gid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(did, FAIL, "H5Dcreate2"); /* Open a dataset with no name using the file ID */ - H5E_BEGIN_TRY { did = H5Dopen2(fid, ".", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dopen2(fid, ".", H5P_DEFAULT); + } H5E_END_TRY; VERIFY(did, FAIL, "H5Dopen2"); /* Open a dataset with no name using the group ID */ - H5E_BEGIN_TRY { did = H5Dopen2(gid, ".", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dopen2(gid, ".", H5P_DEFAULT); + } H5E_END_TRY; VERIFY(did, FAIL, "H5Dopen2"); @@ -1986,32 +2040,50 @@ test_file_open_dot(void) CHECK(tid, FAIL, "H5Tcopy"); /* Create a named datatype with no name using the file ID */ - H5E_BEGIN_TRY { ret = H5Tcommit2(fid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Tcommit2(fid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Tcommit2"); /* Create a named datatype with no name using the group ID */ - H5E_BEGIN_TRY { ret = H5Tcommit2(gid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Tcommit2(gid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Tcommit2"); /* Open a named datatype with no name using the file ID */ - H5E_BEGIN_TRY { tid2 = H5Topen2(fid, ".", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tid2 = H5Topen2(fid, ".", H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tid2, FAIL, "H5Topen2"); /* Open a named datatype with no name using the group ID */ - H5E_BEGIN_TRY { tid2 = H5Topen2(gid, ".", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tid2 = H5Topen2(gid, ".", H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tid2, FAIL, "H5Topen2"); /* Create a group with no name using the file ID */ - H5E_BEGIN_TRY { gid2 = H5Gcreate2(fid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid2 = H5Gcreate2(fid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(gid2, FAIL, "H5Gcreate2"); /* Create a group with no name using the group ID */ - H5E_BEGIN_TRY { gid2 = H5Gcreate2(gid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid2 = H5Gcreate2(gid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(gid2, FAIL, "H5Gcreate2"); @@ -2191,7 +2263,10 @@ test_file_getname(void) /* Try get file name from data space. Supposed to fail because * it's illegal operation. */ - H5E_BEGIN_TRY { name_len = H5Fget_name(space_id, name, (size_t)TESTA_NAME_BUF_SIZE); } + H5E_BEGIN_TRY + { + name_len = H5Fget_name(space_id, name, (size_t)TESTA_NAME_BUF_SIZE); + } H5E_END_TRY; VERIFY(name_len, FAIL, "H5Fget_name"); @@ -3312,7 +3387,10 @@ test_userblock_alignment(void) CHECK(ret, FAIL, "H5Pset_alignment"); /* Create a file with FAPL & FCPL */ - H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; VERIFY(fid, FAIL, "H5Fcreate"); @@ -3342,7 +3420,10 @@ test_userblock_alignment(void) CHECK(ret, FAIL, "H5Pset_alignment"); /* Create a file with FAPL & FCPL */ - H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; VERIFY(fid, FAIL, "H5Fcreate"); @@ -3515,7 +3596,10 @@ test_userblock_alignment_paged(void) CHECK(ret, FAIL, "H5Pset_alignment"); /* Create a file with FAPL & FCPL */ - H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; VERIFY(fid, FAIL, "H5Fcreate"); @@ -3590,7 +3674,10 @@ test_userblock_alignment_paged(void) CHECK(ret, FAIL, "H5Pset_alignment"); /* Create a file with FAPL & FCPL */ - H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; VERIFY(fid, FAIL, "H5Fcreate"); @@ -3627,7 +3714,10 @@ test_userblock_alignment_paged(void) CHECK(ret, FAIL, "H5Pset_alignment"); /* Create a file with FAPL & FCPL */ - H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; VERIFY(fid, FAIL, "H5Fcreate"); @@ -3702,7 +3792,10 @@ test_userblock_alignment_paged(void) CHECK(ret, FAIL, "H5Pset_alignment"); /* Create a file with FAPL & FCPL */ - H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; VERIFY(fid, FAIL, "H5Fcreate"); @@ -3892,17 +3985,26 @@ test_filespace_info(const char *env_h5_drvr) CHECK(fcpl, FAIL, "H5Pcreate"); /* Setting to 0: should fail */ - H5E_BEGIN_TRY { ret = H5Pset_file_space_page_size(fcpl, 0); } + H5E_BEGIN_TRY + { + ret = H5Pset_file_space_page_size(fcpl, 0); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_file_space_page_size"); /* Setting to 511: should fail */ - H5E_BEGIN_TRY { ret = H5Pset_file_space_page_size(fcpl, 511); } + H5E_BEGIN_TRY + { + ret = H5Pset_file_space_page_size(fcpl, 511); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_file_space_page_size"); /* Setting to 1GB+1: should fail */ - H5E_BEGIN_TRY { ret = H5Pset_file_space_page_size(fcpl, FSP_SIZE1G + 1); } + H5E_BEGIN_TRY + { + ret = H5Pset_file_space_page_size(fcpl, FSP_SIZE1G + 1); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_file_space_page_size"); @@ -5302,13 +5404,19 @@ test_libver_bounds_open(void) /* Attempt to open latest file with (earliest, v18), should fail */ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18); - H5E_BEGIN_TRY { file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); } + H5E_BEGIN_TRY + { + file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); + } H5E_END_TRY; VERIFY(file, FAIL, "Attempted to open latest file with earliest version"); /* Attempt to open latest file with (v18, v18), should fail */ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18); - H5E_BEGIN_TRY { file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); } + H5E_BEGIN_TRY + { + file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); + } H5E_END_TRY; VERIFY(file, FAIL, "Attempted to open latest file with v18 bounds"); @@ -5689,7 +5797,10 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n herr_t ret; /* The return value */ /* Try to create the file */ - H5E_BEGIN_TRY { fid = H5Fcreate(FILE8, H5F_ACC_TRUNC | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(FILE8, H5F_ACC_TRUNC | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl); + } H5E_END_TRY; /* Get the internal file pointer if the create succeeds */ @@ -5853,7 +5964,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non herr_t ret; /* Return value */ /* Create the file with the input fcpl and fapl */ - H5E_BEGIN_TRY { fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; /* Retrieve the low/high bounds */ @@ -5884,7 +5998,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non /* Loop through all the combinations of low/high bounds in new_fapl */ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; /* Invalid combinations */ @@ -6064,14 +6181,20 @@ test_libver_bounds_obj(hid_t fapl) object header version, then delete the group and close the file.*/ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid combinations */ continue; /* Open the file */ - H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); + } H5E_END_TRY; if (fid >= 0) { /* The file open succeeds */ @@ -6224,7 +6347,10 @@ test_libver_bounds_dataset(hid_t fapl) CHECK(ret, FAIL, "H5Pset_chunk_opts"); /* Create the chunked dataset */ - H5E_BEGIN_TRY { did = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + did = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } H5E_END_TRY; if (did >= 0) { @@ -6273,14 +6399,20 @@ test_libver_bounds_dataset(hid_t fapl) /* Verify the dataset's layout, fill value and filter pipleline message versions */ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ continue; /* Open the file */ - H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); + } H5E_END_TRY; if (fid >= 0) { /* The file open succeeds */ @@ -6491,14 +6623,20 @@ test_libver_bounds_dataspace(hid_t fapl) hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */ H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ continue; /* Open the file */ - H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); + } H5E_END_TRY; if (fid >= 0) { /* The file open succeeds */ @@ -6815,14 +6953,20 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Also verify the committed atatype message version */ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ continue; /* Open the file */ - H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); + } H5E_END_TRY; if (fid >= 0) { /* The file open succeeds */ @@ -7135,14 +7279,20 @@ test_libver_bounds_attributes(hid_t fapl) /* Verify the attribute version */ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ continue; /* Open the file */ - H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } + H5E_BEGIN_TRY + { + fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); + } H5E_END_TRY; if (fid >= 0) { /* The file open succeeds */ @@ -7296,7 +7446,10 @@ test_libver_macros2(void) ret = H5Gunlink(file, "Group"); CHECK(ret, FAIL, "H5Gunlink"); - H5E_BEGIN_TRY { grp = H5Gopen(file, "Group"); } + H5E_BEGIN_TRY + { + grp = H5Gopen(file, "Group"); + } H5E_END_TRY; VERIFY(grp, FAIL, "H5Gopen"); #endif @@ -7532,17 +7685,26 @@ test_min_dset_ohdr(void) */ /* trying to set with invalid file ID */ - H5E_BEGIN_TRY { ret = H5Fset_dset_no_attrs_hint(-1, TRUE); } + H5E_BEGIN_TRY + { + ret = H5Fset_dset_no_attrs_hint(-1, TRUE); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Fset_dset_no_attrs_hint"); /* trying to get with invalid file ID */ - H5E_BEGIN_TRY { ret = H5Fget_dset_no_attrs_hint(-1, &minimize); } + H5E_BEGIN_TRY + { + ret = H5Fget_dset_no_attrs_hint(-1, &minimize); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint"); /* trying to get with invalid pointer */ - H5E_BEGIN_TRY { ret = H5Fget_dset_no_attrs_hint(file_id, NULL); } + H5E_BEGIN_TRY + { + ret = H5Fget_dset_no_attrs_hint(file_id, NULL); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint"); diff --git a/test/th5o.c b/test/th5o.c index b6b1bf4..ebb6c6e 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -347,21 +347,30 @@ test_h5o_open_by_addr(void) /* Try giving some bogus values to H5O_open_by_addr. */ /* Try to open an object with a bad address */ grp_addr += 20; - H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); } + H5E_BEGIN_TRY + { + grp = H5Oopen_by_addr(fid, grp_addr); + } H5E_END_TRY VERIFY(grp, FAIL, "H5Oopen_by_addr"); /* For instance, an objectno smaller than the end of the file's superblock should * trigger an error */ grp_addr = 10; - H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); } + H5E_BEGIN_TRY + { + grp = H5Oopen_by_addr(fid, grp_addr); + } H5E_END_TRY VERIFY(grp, FAIL, "H5Oopen_by_addr"); /* Likewise, an objectno larger than the size of the file should fail */ grp_addr = 0; grp_addr = 1000000000; - H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); } + H5E_BEGIN_TRY + { + grp = H5Oopen_by_addr(fid, grp_addr); + } H5E_END_TRY VERIFY(grp, FAIL, "H5Oopen_by_addr"); @@ -369,7 +378,10 @@ test_h5o_open_by_addr(void) CHECK(ret, FAIL, "H5Fclose"); /* Also, trying to open an object without a valid location should fail */ - H5E_BEGIN_TRY { dtype = H5Oopen_by_addr(fid, dtype_addr); } + H5E_BEGIN_TRY + { + dtype = H5Oopen_by_addr(fid, dtype_addr); + } H5E_END_TRY VERIFY(dtype, FAIL, "H5Oopen_by_addr"); } /* test_h5o_open_by_addr() */ @@ -473,7 +485,10 @@ test_h5o_open_by_token(void) /* Try giving some bogus values to H5O_open_by_token */ /* Try opening an object using H5O_TOKEN_UNDEF (should fail) */ - H5E_BEGIN_TRY { dtype = H5Oopen_by_token(fid, H5O_TOKEN_UNDEF); } + H5E_BEGIN_TRY + { + dtype = H5Oopen_by_token(fid, H5O_TOKEN_UNDEF); + } H5E_END_TRY VERIFY(dtype, FAIL, "H5Oopen_by_token"); @@ -481,7 +496,10 @@ test_h5o_open_by_token(void) CHECK(ret, FAIL, "H5Fclose"); /* Also, trying to open an object without a valid location (should fail) */ - H5E_BEGIN_TRY { dtype = H5Oopen_by_token(fid, li.u.token); } + H5E_BEGIN_TRY + { + dtype = H5Oopen_by_token(fid, li.u.token); + } H5E_END_TRY VERIFY(dtype, FAIL, "H5Oopen_by_token"); @@ -929,7 +947,10 @@ test_h5o_link(void) for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds */ - H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl_id, low, high); } + H5E_BEGIN_TRY + { + ret = H5Pset_libver_bounds(fapl_id, low, high); + } H5E_END_TRY; if (ret < 0) /* Invalid low/high combinations */ @@ -1114,7 +1135,10 @@ test_h5o_comment(void) CHECK(ret, FAIL, "H5Oset_comment"); /* Putting a comment on the dataspace. It's supposed to fail. */ - H5E_BEGIN_TRY { ret = H5Oset_comment(dspace, "dataspace comment"); } + H5E_BEGIN_TRY + { + ret = H5Oset_comment(dspace, "dataspace comment"); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oset_comment"); @@ -1283,7 +1307,10 @@ test_h5o_comment_by_name(void) CHECK(ret, FAIL, "H5Oset_comment_by_name"); /* Putting a comment on the dataspace. It's supposed to fail. */ - H5E_BEGIN_TRY { ret = H5Oset_comment_by_name(dspace, ".", "dataspace comment", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Oset_comment_by_name(dspace, ".", "dataspace comment", H5P_DEFAULT); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oset_comment"); @@ -1565,21 +1592,30 @@ test_h5o_open_by_addr_deprec(void) /* Try giving some bogus values to H5O_open_by_addr. */ /* Try to open an object with a bad address */ grp_addr += 20; - H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); } + H5E_BEGIN_TRY + { + grp = H5Oopen_by_addr(fid, grp_addr); + } H5E_END_TRY VERIFY(grp, FAIL, "H5Oopen_by_addr"); /* For instance, an objectno smaller than the end of the file's superblock should * trigger an error */ grp_addr = 10; - H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); } + H5E_BEGIN_TRY + { + grp = H5Oopen_by_addr(fid, grp_addr); + } H5E_END_TRY VERIFY(grp, FAIL, "H5Oopen_by_addr"); /* Likewise, an objectno larger than the size of the file should fail */ grp_addr = 0; grp_addr = 1000000000; - H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); } + H5E_BEGIN_TRY + { + grp = H5Oopen_by_addr(fid, grp_addr); + } H5E_END_TRY VERIFY(grp, FAIL, "H5Oopen_by_addr"); @@ -1587,7 +1623,10 @@ test_h5o_open_by_addr_deprec(void) CHECK(ret, FAIL, "H5Fclose"); /* Also, trying to open an object without a valid location should fail */ - H5E_BEGIN_TRY { dtype = H5Oopen_by_addr(fid, dtype_addr); } + H5E_BEGIN_TRY + { + dtype = H5Oopen_by_addr(fid, dtype_addr); + } H5E_END_TRY VERIFY(dtype, FAIL, "H5Oopen_by_addr"); } /* test_h5o_open_by_addr_deprec() */ diff --git a/test/th5s.c b/test/th5s.c index 4cfe83b..8598e71 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -180,7 +180,10 @@ test_h5s_basic(void) * Check to be sure we can't create a simple dataspace that has too many * dimensions. */ - H5E_BEGIN_TRY { sid1 = H5Screate_simple(H5S_MAX_RANK + 1, dims3, NULL); } + H5E_BEGIN_TRY + { + sid1 = H5Screate_simple(H5S_MAX_RANK + 1, dims3, NULL); + } H5E_END_TRY; VERIFY(sid1, FAIL, "H5Screate_simple"); @@ -247,43 +250,70 @@ test_h5s_basic(void) CHECK(dset1, FAIL, "H5Dcreate2"); /* Try some writes with the bad dataspace (sid1) */ - H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, &n); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, &n); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Dwrite"); - H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &n); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &n); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Dwrite"); - H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, sid1, H5P_DEFAULT, &n); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, sid1, H5P_DEFAULT, &n); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Dwrite"); /* Try to iterate using the bad dataspace */ - H5E_BEGIN_TRY { ret = H5Diterate(&n, H5T_NATIVE_INT, sid1, NULL, NULL); } + H5E_BEGIN_TRY + { + ret = H5Diterate(&n, H5T_NATIVE_INT, sid1, NULL, NULL); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Diterate"); /* Try to fill using the bad dataspace */ - H5E_BEGIN_TRY { ret = H5Dfill(NULL, H5T_NATIVE_INT, &n, H5T_NATIVE_INT, sid1); } + H5E_BEGIN_TRY + { + ret = H5Dfill(NULL, H5T_NATIVE_INT, &n, H5T_NATIVE_INT, sid1); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Dfill"); /* Now use the bad dataspace as the space for an attribute */ - H5E_BEGIN_TRY { aid1 = H5Acreate2(dset1, BASICATTR, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + aid1 = H5Acreate2(dset1, BASICATTR, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY VERIFY(aid1, FAIL, "H5Acreate2"); /* Make sure that dataspace reads using the bad dataspace fail */ - H5E_BEGIN_TRY { ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, &n); } + H5E_BEGIN_TRY + { + ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, &n); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Dread"); - H5E_BEGIN_TRY { ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &n); } + H5E_BEGIN_TRY + { + ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &n); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Dread"); - H5E_BEGIN_TRY { ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, sid1, H5P_DEFAULT, &n); } + H5E_BEGIN_TRY + { + ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, sid1, H5P_DEFAULT, &n); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Dread"); @@ -700,7 +730,10 @@ test_h5s_zero_dim(void) ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, wdata); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, wdata); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dwrite"); @@ -716,7 +749,10 @@ test_h5s_zero_dim(void) ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord); CHECK(ret, FAIL, "H5Sselect_elements"); - H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &val); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &val); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dwrite"); @@ -813,7 +849,10 @@ test_h5s_zero_dim(void) /* Now extend the first dimension size of the dataset to SPACE1_DIM1*3 past the maximal size. * It is supposed to fail. */ extend_dims[0] = SPACE1_DIM1 * 3; - H5E_BEGIN_TRY { ret = H5Dset_extent(dset1, extend_dims); } + H5E_BEGIN_TRY + { + ret = H5Dset_extent(dset1, extend_dims); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dset_extent"); @@ -1211,7 +1250,10 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) } /* Try decoding bogus buffer */ - H5E_BEGIN_TRY { ret_id = H5Sdecode(sbuf); } + H5E_BEGIN_TRY + { + ret_id = H5Sdecode(sbuf); + } H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Sdecode"); @@ -1400,7 +1442,10 @@ test_h5s_encode1(void) } /* Try decoding bogus buffer */ - H5E_BEGIN_TRY { ret_id = H5Sdecode(sbuf); } + H5E_BEGIN_TRY + { + ret_id = H5Sdecode(sbuf); + } H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Sdecode"); @@ -1563,7 +1608,10 @@ test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, uint32_t expected_version, herr_t ret; /* Return value */ /* Get buffer size for encoding with the format setting in in_fapl */ - H5E_BEGIN_TRY { ret = H5Sencode2(in_sid, NULL, &buf_size, in_fapl); } + H5E_BEGIN_TRY + { + ret = H5Sencode2(in_sid, NULL, &buf_size, in_fapl); + } H5E_END_TRY if (expected_to_fail) { @@ -2158,7 +2206,10 @@ test_h5s_scalar_write(void) CHECK(fid1, FAIL, "H5Fcreate"); /* Verify a non-zero rank fails with a NULL dimension. */ - H5E_BEGIN_TRY { sid1 = H5Screate_simple(SPACE1_RANK, NULL, NULL); } + H5E_BEGIN_TRY + { + sid1 = H5Screate_simple(SPACE1_RANK, NULL, NULL); + } H5E_END_TRY VERIFY(sid1, FAIL, "H5Screate_simple"); diff --git a/test/tid.c b/test/tid.c index 7b5fff2..662064f 100644 --- a/test/tid.c +++ b/test/tid.c @@ -856,7 +856,10 @@ test_remove_clear_type(void) error: /* Cleanup. For simplicity, just destroy the types and ignore errors. */ - H5E_BEGIN_TRY { H5Idestroy_type(obj_type); } + H5E_BEGIN_TRY + { + H5Idestroy_type(obj_type); + } H5E_END_TRY HDfree(obj_list.objects); @@ -995,19 +998,28 @@ test_future_ids(void) /* Test basic error conditions */ fake_future_obj = 0; - H5E_BEGIN_TRY { future_id = H5Iregister_future(obj_type, &fake_future_obj, NULL, NULL); } + H5E_BEGIN_TRY + { + future_id = H5Iregister_future(obj_type, &fake_future_obj, NULL, NULL); + } H5E_END_TRY VERIFY(future_id, H5I_INVALID_HID, "H5Iregister_future"); if (H5I_INVALID_HID != future_id) goto error; - H5E_BEGIN_TRY { future_id = H5Iregister_future(obj_type, &fake_future_obj, realize_future_cb, NULL); } + H5E_BEGIN_TRY + { + future_id = H5Iregister_future(obj_type, &fake_future_obj, realize_future_cb, NULL); + } H5E_END_TRY VERIFY(future_id, H5I_INVALID_HID, "H5Iregister_future"); if (H5I_INVALID_HID != future_id) goto error; - H5E_BEGIN_TRY { future_id = H5Iregister_future(obj_type, &fake_future_obj, NULL, discard_future_cb); } + H5E_BEGIN_TRY + { + future_id = H5Iregister_future(obj_type, &fake_future_obj, NULL, discard_future_cb); + } H5E_END_TRY VERIFY(future_id, H5I_INVALID_HID, "H5Iregister_future"); if (H5I_INVALID_HID != future_id) @@ -1349,7 +1361,10 @@ test_future_ids(void) error: /* Cleanup. For simplicity, just destroy the types and ignore errors. */ - H5E_BEGIN_TRY { H5Idestroy_type(obj_type); } + H5E_BEGIN_TRY + { + H5Idestroy_type(obj_type); + } H5E_END_TRY return -1; diff --git a/test/titerate.c b/test/titerate.c index 5252da4..c507beb 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -271,19 +271,28 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test invalid indices for starting iteration */ info.command = RET_ZERO; idx = (hsize_t)-1; - H5E_BEGIN_TRY { ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } + H5E_BEGIN_TRY + { + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Literate2"); /* Test skipping exactly as many entries as in the group */ idx = NDATASETS + 2; - H5E_BEGIN_TRY { ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } + H5E_BEGIN_TRY + { + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Literate2"); /* Test skipping more entries than are in the group */ idx = NDATASETS + 3; - H5E_BEGIN_TRY { ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } + H5E_BEGIN_TRY + { + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Literate2"); @@ -461,13 +470,19 @@ test_iter_attr(hid_t fapl, hbool_t new_format) /* Test skipping exactly as many attributes as there are */ idx = NATTR; - H5E_BEGIN_TRY { ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info); } + H5E_BEGIN_TRY + { + ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate2"); /* Test skipping more attributes than there are */ idx = NATTR + 1; - H5E_BEGIN_TRY { ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info); } + H5E_BEGIN_TRY + { + ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate2"); diff --git a/test/tmisc.c b/test/tmisc.c index 826f28a..8c7e53d 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1894,7 +1894,10 @@ test_misc11(void) CHECK(ret, FAIL, "H5Pset_sizes"); /* This should fail as (32770*2) will exceed ^16 - 2 bytes for storing btree entries */ - H5E_BEGIN_TRY { ret = H5Pset_sym_k(fcpl, 32770, 0); } + H5E_BEGIN_TRY + { + ret = H5Pset_sym_k(fcpl, 32770, 0); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_sym_k"); @@ -1902,7 +1905,10 @@ test_misc11(void) CHECK(ret, FAIL, "H5Pset_sym_k"); /* This should fail as (32770*2) will exceed ^16 - 2 bytes for storing btree entries */ - H5E_BEGIN_TRY { ret = H5Pset_istore_k(fcpl, 32770); } + H5E_BEGIN_TRY + { + ret = H5Pset_istore_k(fcpl, 32770); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_istore_k"); @@ -3160,7 +3166,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the file again (should fail) */ - H5E_BEGIN_TRY { ret = H5Fclose(fid); } + H5E_BEGIN_TRY + { + ret = H5Fclose(fid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Fclose"); @@ -3191,7 +3200,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the property list again (should fail) */ - H5E_BEGIN_TRY { ret = H5Pclose(plid); } + H5E_BEGIN_TRY + { + ret = H5Pclose(plid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pclose"); @@ -3222,7 +3234,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the property class again (should fail) */ - H5E_BEGIN_TRY { ret = H5Pclose_class(pcid); } + H5E_BEGIN_TRY + { + ret = H5Pclose_class(pcid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Pclose_class"); @@ -3253,7 +3268,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the datatype again (should fail) */ - H5E_BEGIN_TRY { ret = H5Tclose(tid); } + H5E_BEGIN_TRY + { + ret = H5Tclose(tid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Tclose"); @@ -3284,7 +3302,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the dataspace again (should fail) */ - H5E_BEGIN_TRY { ret = H5Sclose(sid); } + H5E_BEGIN_TRY + { + ret = H5Sclose(sid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sclose"); @@ -3323,7 +3344,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the dataset again (should fail) */ - H5E_BEGIN_TRY { ret = H5Dclose(did); } + H5E_BEGIN_TRY + { + ret = H5Dclose(did); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dclose"); @@ -3374,7 +3398,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the attribute again (should fail) */ - H5E_BEGIN_TRY { ret = H5Aclose(aid); } + H5E_BEGIN_TRY + { + ret = H5Aclose(aid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Aclose"); @@ -3421,7 +3448,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the group again (should fail) */ - H5E_BEGIN_TRY { ret = H5Gclose(gid); } + H5E_BEGIN_TRY + { + ret = H5Gclose(gid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Gclose"); @@ -3456,7 +3486,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the error class again (should fail) */ - H5E_BEGIN_TRY { ret = H5Eunregister_class(ecid); } + H5E_BEGIN_TRY + { + ret = H5Eunregister_class(ecid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Eunregister_class"); @@ -3491,7 +3524,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the error message again (should fail) */ - H5E_BEGIN_TRY { ret = H5Eclose_msg(emid); } + H5E_BEGIN_TRY + { + ret = H5Eclose_msg(emid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Eclose_msg"); @@ -3526,7 +3562,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try closing the error stack again (should fail) */ - H5E_BEGIN_TRY { ret = H5Eclose_stack(esid); } + H5E_BEGIN_TRY + { + ret = H5Eclose_stack(esid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Eclose_stack"); @@ -3561,7 +3600,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try unregistering the VFD again (should fail) */ - H5E_BEGIN_TRY { ret = H5FDunregister(vfdid); } + H5E_BEGIN_TRY + { + ret = H5FDunregister(vfdid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5FDunregister"); @@ -3598,7 +3640,10 @@ test_misc19(void) VERIFY(rc, 0, "H5Idec_ref"); /* Try unregistering the VOL connector again (should fail) */ - H5E_BEGIN_TRY { ret = H5VLunregister_connector(volid); } + H5E_BEGIN_TRY + { + ret = H5VLunregister_connector(volid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5VLunregister_connector"); @@ -4036,7 +4081,10 @@ test_misc23(void) * test the old APIs **********************************************************************/ - H5E_BEGIN_TRY { tmp_id = H5Gcreate1(file_id, "/A/B00a/grp", (size_t)0); } + H5E_BEGIN_TRY + { + tmp_id = H5Gcreate1(file_id, "/A/B00a/grp", (size_t)0); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gcreate1"); @@ -4046,7 +4094,10 @@ test_misc23(void) status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); - H5E_BEGIN_TRY { tmp_id = H5Dcreate1(file_id, "/A/B00c/dset", type_id, space_id, create_id); } + H5E_BEGIN_TRY + { + tmp_id = H5Dcreate1(file_id, "/A/B00c/dset", type_id, space_id, create_id); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dcreate1"); @@ -4379,51 +4430,87 @@ test_misc24(void) CHECK(ret, FAIL, "H5Tclose"); /* Attempt to open each kind of object with wrong API, including using soft links */ - H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dopen2"); - H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dopen2"); - H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Topen2"); - H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Topen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Topen2"); - H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Topen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Topen2"); - H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Topen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Topen2"); - H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dopen2"); - H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dopen2"); @@ -4432,19 +4519,31 @@ test_misc24(void) group_id = H5Gopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); CHECK(group_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dopen2"); - H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dopen2"); - H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Topen2"); - H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Topen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Topen2"); @@ -4455,19 +4554,31 @@ test_misc24(void) dset_id = H5Dopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); CHECK(dset_id, FAIL, "H5Dopen2"); - H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Topen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Topen2"); - H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Topen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Topen2"); @@ -4478,19 +4589,31 @@ test_misc24(void) type_id = H5Topen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Topen2"); - H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gopen2"); - H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dopen2"); - H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Dopen2"); @@ -5076,7 +5199,10 @@ test_misc27(void) #ifdef H5_STRICT_FORMAT_CHECKS /* Open group with incorrect # of object header messages (should fail) */ - H5E_BEGIN_TRY { gid = H5Gopen2(fid, MISC27_GROUP, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + gid = H5Gopen2(fid, MISC27_GROUP, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(gid, FAIL, "H5Gopen2"); #else /* H5_STRICT_FORMAT_CHECKS */ @@ -5569,17 +5695,26 @@ test_misc33(void) CHECK(fid, FAIL, "H5Fopen"); /* Case (1) */ - H5E_BEGIN_TRY { ret = H5Oget_info_by_name3(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Oget_info_by_name3(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Case (2) */ - H5E_BEGIN_TRY { ret = H5Oget_info_by_name3(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Oget_info_by_name3(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Case (3) */ - H5E_BEGIN_TRY { ret = H5Oget_info_by_name3(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + ret = H5Oget_info_by_name3(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name3"); diff --git a/test/trefer.c b/test/trefer.c index 6422a1b..9b6c415 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -1358,7 +1358,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* * Dereference an undefined reference (should fail) */ - H5E_BEGIN_TRY { dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object"); @@ -1368,7 +1371,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* This close should fail since H5Ropen_object never created * the id of the referenced object. */ - H5E_BEGIN_TRY { ret = H5Dclose(dset2); } + H5E_BEGIN_TRY + { + ret = H5Dclose(dset2); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dclose"); @@ -1520,7 +1526,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* Attempting to retrieve type of object using non-valid refs */ for (j = 0; j < 3; j++) { - H5E_BEGIN_TRY { ret = H5Rget_obj_type3(&nvrbuf[j], H5P_DEFAULT, &obj_type); } + H5E_BEGIN_TRY + { + ret = H5Rget_obj_type3(&nvrbuf[j], H5P_DEFAULT, &obj_type); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Rget_obj_type3"); } /* end for */ diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 82f5b57..24371ef 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -456,7 +456,10 @@ test_reference_obj(void) /* Attempting to retrieve type of object using non-valid refs */ for (j = 0; j < 3; j++) { - H5E_BEGIN_TRY { ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &nvrbuf[j], &obj_type); } + H5E_BEGIN_TRY + { + ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &nvrbuf[j], &obj_type); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Rget_obj_type2"); } /* end for */ @@ -653,7 +656,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); /* Store third dataset region */ - H5E_BEGIN_TRY { ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2); } + H5E_BEGIN_TRY + { + ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2); + } H5E_END_TRY; if (libver_high < H5F_LIBVER_V110) @@ -728,7 +734,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* * Dereference an undefined reference (should fail) */ - H5E_BEGIN_TRY { dset2 = H5Rdereference2(dset_NA, H5P_DEFAULT, H5R_DATASET_REGION, &rdata_NA[0]); } + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2(dset_NA, H5P_DEFAULT, H5R_DATASET_REGION, &rdata_NA[0]); + } H5E_END_TRY; VERIFY(dset2, FAIL, "H5Rdereference2"); @@ -738,7 +747,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* This close should fail since H5Rdereference2 never created * the id of the referenced object. */ - H5E_BEGIN_TRY { ret = H5Dclose(dset2); } + H5E_BEGIN_TRY + { + ret = H5Dclose(dset2); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dclose"); @@ -892,7 +904,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* Attempting to retrieve type of object using non-valid refs */ for (j = 0; j < 3; j++) { - H5E_BEGIN_TRY { ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &nvrbuf[j], &obj_type); } + H5E_BEGIN_TRY + { + ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &nvrbuf[j], &obj_type); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Rget_obj_type2"); } /* end for */ diff --git a/test/tselect.c b/test/tselect.c index e3b3f54..cea8301 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -287,7 +287,10 @@ test_select_hyper(hid_t xfer_plist) block[0] = 1; block[1] = 1; block[2] = 1; - H5E_BEGIN_TRY { ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); } + H5E_BEGIN_TRY + { + ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sselect_hyperslab"); @@ -304,7 +307,10 @@ test_select_hyper(hid_t xfer_plist) block[0] = 2; block[1] = 2; block[2] = 2; - H5E_BEGIN_TRY { ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); } + H5E_BEGIN_TRY + { + ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sselect_hyperslab"); @@ -344,10 +350,16 @@ test_select_hyper(hid_t xfer_plist) CHECK(ret, FAIL, "H5Dwrite"); /* Exercise checks for NULL buffer and valid selection */ - H5E_BEGIN_TRY { ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, NULL); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, NULL); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dwrite"); - H5E_BEGIN_TRY { ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, xfer_plist, NULL); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, xfer_plist, NULL); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dwrite"); @@ -388,10 +400,16 @@ test_select_hyper(hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Exercise checks for NULL buffer and valid selection */ - H5E_BEGIN_TRY { ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, NULL); } + H5E_BEGIN_TRY + { + ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, NULL); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dread"); - H5E_BEGIN_TRY { ret = H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, xfer_plist, NULL); } + H5E_BEGIN_TRY + { + ret = H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, xfer_plist, NULL); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dread"); @@ -8166,14 +8184,20 @@ test_scalar_select2(void) /* Select one element in memory with a point selection */ coord1[0] = 0; - H5E_BEGIN_TRY { ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord1); } + H5E_BEGIN_TRY + { + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord1); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sselect_elements"); /* Select one element in memory with a hyperslab selection */ start[0] = 0; count[0] = 0; - H5E_BEGIN_TRY { ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL); } + H5E_BEGIN_TRY + { + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sselect_hyperslab"); @@ -13835,7 +13859,10 @@ test_select_bounds(void) CHECK(ret, FAIL, "H5Sselect_none"); /* Get bounds for 'none' selection */ - H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); } + H5E_BEGIN_TRY + { + ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_select_bo unds"); @@ -13866,7 +13893,10 @@ test_select_bounds(void) CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for hyperslab selection with negative offset */ - H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); } + H5E_BEGIN_TRY + { + ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_select_bounds"); @@ -13917,7 +13947,10 @@ test_select_bounds(void) CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for hyperslab selection with negative offset */ - H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); } + H5E_BEGIN_TRY + { + ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_select_bounds"); @@ -13968,7 +14001,10 @@ test_select_bounds(void) CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for hyperslab selection with negative offset */ - H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); } + H5E_BEGIN_TRY + { + ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_select_bounds"); @@ -14030,12 +14066,18 @@ test_hyper_regular(void) CHECK(sid, FAIL, "H5Screate_simple"); /* Query if 'all' selection is regular hyperslab (should fail) */ - H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); } + H5E_BEGIN_TRY + { + is_regular = H5Sis_regular_hyperslab(sid); + } H5E_END_TRY; VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ - H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); } + H5E_BEGIN_TRY + { + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); @@ -14044,12 +14086,18 @@ test_hyper_regular(void) CHECK(ret, FAIL, "H5Sselect_none"); /* Query if 'none' selection is regular hyperslab (should fail) */ - H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); } + H5E_BEGIN_TRY + { + is_regular = H5Sis_regular_hyperslab(sid); + } H5E_END_TRY; VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ - H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); } + H5E_BEGIN_TRY + { + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); @@ -14070,12 +14118,18 @@ test_hyper_regular(void) CHECK(ret, FAIL, "H5Sselect_elements"); /* Query if 'point' selection is regular hyperslab (should fail) */ - H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); } + H5E_BEGIN_TRY + { + is_regular = H5Sis_regular_hyperslab(sid); + } H5E_END_TRY; VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ - H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); } + H5E_BEGIN_TRY + { + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); @@ -14130,7 +14184,10 @@ test_hyper_regular(void) VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ - H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); } + H5E_BEGIN_TRY + { + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); @@ -15108,10 +15165,16 @@ test_sel_iter(void) CHECK(iter_id, FAIL, "H5Ssel_iter_create"); /* Try resetting selection iterator with bad parameters */ - H5E_BEGIN_TRY { ret = H5Ssel_iter_reset(H5I_INVALID_HID, sid); } + H5E_BEGIN_TRY + { + ret = H5Ssel_iter_reset(H5I_INVALID_HID, sid); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Ssel_iter_reset"); - H5E_BEGIN_TRY { ret = H5Ssel_iter_reset(iter_id, H5I_INVALID_HID); } + H5E_BEGIN_TRY + { + ret = H5Ssel_iter_reset(iter_id, H5I_INVALID_HID); + } H5E_END_TRY; VERIFY(ret, FAIL, "H5Ssel_iter_reset"); diff --git a/test/tvltypes.c b/test/tvltypes.c index e31c65f..b8cbe6d 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -136,7 +136,10 @@ test_vltypes_dataset_create(void) CHECK(ret, FAIL, "H5Pset_fill_time"); /* Create a dataset, supposed to fail */ - H5E_BEGIN_TRY { dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } H5E_END_TRY; VERIFY(dataset, FAIL, "H5Dcreate2"); @@ -202,11 +205,17 @@ test_vltypes_funcs(void) ret = H5Tset_offset(type, (size_t)16); CHECK(ret, FAIL, "H5Tset_offset"); - H5E_BEGIN_TRY { cset = H5Tget_cset(type); } + H5E_BEGIN_TRY + { + cset = H5Tget_cset(type); + } H5E_END_TRY; VERIFY(cset, FAIL, "H5Tget_cset"); - H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); } + H5E_BEGIN_TRY + { + strpad = H5Tget_strpad(type); + } H5E_END_TRY; VERIFY(strpad, FAIL, "H5Tget_strpad"); @@ -476,7 +485,10 @@ test_vltypes_vlen_atomic(void) VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size"); /* Try to call H5Dvlen_get_buf with bad dataspace */ - H5E_BEGIN_TRY { ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } + H5E_BEGIN_TRY + { + ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); @@ -507,7 +519,10 @@ test_vltypes_vlen_atomic(void) /* Try to reclaim read data using "bad" dataspace with no extent * Should fail */ - H5E_BEGIN_TRY { ret = H5Treclaim(tid1, sid2, xfer_pid, rdata); } + H5E_BEGIN_TRY + { + ret = H5Treclaim(tid1, sid2, xfer_pid, rdata); + } H5E_END_TRY VERIFY(ret, FAIL, "H5Treclaim"); diff --git a/test/unlink.c b/test/unlink.c index c58e3ec..94bd035 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -117,7 +117,10 @@ test_one(hid_t file) TESTING("unlink without a name"); if ((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - H5E_BEGIN_TRY { status = H5Ldelete(grp, ".", H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Ldelete(grp, ".", H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.") @@ -287,7 +290,10 @@ test_symlink(hid_t file) return 0; error: - H5E_BEGIN_TRY { H5Gclose(work); } + H5E_BEGIN_TRY + { + H5Gclose(work); + } H5E_END_TRY; return 1; } /* end test_symlink() */ @@ -1288,7 +1294,10 @@ test_filespace(hid_t fapl) FAIL_STACK_ERROR /* Create another group with same name */ - H5E_BEGIN_TRY { group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (group >= 0) { H5Gclose(group); @@ -1335,7 +1344,10 @@ test_filespace(hid_t fapl) FAIL_STACK_ERROR /* Create another named datatype with same name */ - H5E_BEGIN_TRY { status = H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + status = H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; if (status >= 0) TEST_ERROR @@ -1789,12 +1801,18 @@ error: /* Close any open groups */ for (n = 0; n < ngroups; n++) if (gids[n]) { - H5E_BEGIN_TRY { H5Gclose(gids[n]); } + H5E_BEGIN_TRY + { + H5Gclose(gids[n]); + } H5E_END_TRY; } /* end if */ HDfree(gids); } /* end if */ - H5E_BEGIN_TRY { H5Gclose(rootid); } + H5E_BEGIN_TRY + { + H5Gclose(rootid); + } H5E_END_TRY; return 1; @@ -1875,12 +1893,18 @@ error: /* Close any open groups */ for (n = 0; n < ngroups; n++) if (gids[n]) { - H5E_BEGIN_TRY { H5Gclose(gids[n]); } + H5E_BEGIN_TRY + { + H5Gclose(gids[n]); + } H5E_END_TRY; } /* end if */ HDfree(gids); } /* end if */ - H5E_BEGIN_TRY { H5Gclose(rootid); } + H5E_BEGIN_TRY + { + H5Gclose(rootid); + } H5E_END_TRY; return 1; @@ -2247,12 +2271,18 @@ error: /* Close any open groups */ for (n = 0; n < ngroups; n++) if (gids[n]) { - H5E_BEGIN_TRY { H5Gclose(gids[n]); } + H5E_BEGIN_TRY + { + H5Gclose(gids[n]); + } H5E_END_TRY; } /* end if */ HDfree(gids); } /* end if */ - H5E_BEGIN_TRY { H5Gclose(rootid); } + H5E_BEGIN_TRY + { + H5Gclose(rootid); + } H5E_END_TRY; return 1; diff --git a/test/unregister.c b/test/unregister.c index 48b29c8..803f8373 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -148,7 +148,10 @@ test_unregister_filters(hid_t fapl_id) goto error; /* Unregister the filter before closing the group. It should fail */ - H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } + H5E_BEGIN_TRY + { + ret = H5Zunregister(H5Z_FILTER_DUMMY); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); @@ -196,7 +199,10 @@ test_unregister_filters(hid_t fapl_id) goto error; /* Unregister the filter before closing the dataset. It should fail */ - H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } + H5E_BEGIN_TRY + { + ret = H5Zunregister(H5Z_FILTER_DUMMY); + } H5E_END_TRY; if (ret >= 0) { H5_FAILED(); diff --git a/test/vds.c b/test/vds.c index 66e512e..88ac4eb 100644 --- a/test/vds.c +++ b/test/vds.c @@ -323,7 +323,10 @@ vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, const char return 0; error: - H5E_BEGIN_TRY { H5Sclose(space_out); } + H5E_BEGIN_TRY + { + H5Sclose(space_out); + } H5E_END_TRY return -1; @@ -999,7 +1002,10 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) TEST_ERROR /* Attempt to add virtual layout mapping */ - H5E_BEGIN_TRY { ret = H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]); } + H5E_BEGIN_TRY + { + ret = H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]); + } H5E_END_TRY if (ret >= 0) TEST_ERROR @@ -3549,7 +3555,10 @@ test_basic_io(unsigned config, hid_t vds_fapl, hid_t src_fapl) count[1] = 9; if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR_SUPPRESSED - H5E_BEGIN_TRY { ret = H5Dwrite(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]); } + H5E_BEGIN_TRY + { + ret = H5Dwrite(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]); + } H5E_END_TRY if (ret >= 0) TEST_ERROR_SUPPRESSED diff --git a/test/vfd.c b/test/vfd.c index 710fda4..f129c5d 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -636,7 +636,10 @@ test_direct(void) if (H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0) TEST_ERROR; - H5E_BEGIN_TRY { file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); } + H5E_BEGIN_TRY + { + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + } H5E_END_TRY; if (file < 0) { H5Pclose(fapl); @@ -836,13 +839,19 @@ test_family_opens(char *fname, hid_t fa_pl) /* Case 1: reopen file with 1st member file name and default property list */ HDsnprintf(first_name, sizeof(first_name), fname, 0); - H5E_BEGIN_TRY { file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); + } H5E_END_TRY; if (file >= 0) TEST_ERROR /* Case 2: reopen file with correct name template but default property list */ - H5E_BEGIN_TRY { file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); + } H5E_END_TRY; if (file >= 0) TEST_ERROR @@ -851,7 +860,10 @@ test_family_opens(char *fname, hid_t fa_pl) if (H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0) TEST_ERROR; - H5E_BEGIN_TRY { file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl); } + H5E_BEGIN_TRY + { + file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl); + } H5E_END_TRY; if (file >= 0) TEST_ERROR @@ -867,7 +879,10 @@ test_family_opens(char *fname, hid_t fa_pl) if (H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR; - H5E_BEGIN_TRY { file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); } + H5E_BEGIN_TRY + { + file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); + } H5E_END_TRY; if (file >= 0) TEST_ERROR @@ -1341,7 +1356,10 @@ test_multi_opens(char *fname) HDsnprintf(super_name, sizeof(super_name), "%%s-%c.h5", 's'); HDsnprintf(sf_name, sizeof(sf_name), super_name, fname); - H5E_BEGIN_TRY { fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); + } H5E_END_TRY; return (fid >= 0 ? FAIL : SUCCEED); @@ -2529,7 +2547,10 @@ driver_is_splitter_compatible(hid_t fapl_id) HDstrncpy(vfd_config->wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX); vfd_config->log_file_path[0] = '\0'; - H5E_BEGIN_TRY { ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config); } + H5E_BEGIN_TRY + { + ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config); + } H5E_END_TRY; if (SUCCEED == ret) { ret_value = -1; @@ -2545,7 +2566,10 @@ driver_is_splitter_compatible(hid_t fapl_id) return ret_value; error: - H5E_BEGIN_TRY { H5Pclose(split_fapl_id); } + H5E_BEGIN_TRY + { + H5Pclose(split_fapl_id); + } H5E_END_TRY; HDfree(vfd_config); @@ -2606,7 +2630,10 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id) * Should fail. */ - H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); + } H5E_END_TRY; if (file_id >= 0) { SPLITTER_TEST_FAULT("R/O open on nonexistent files unexpectedly successful\n"); @@ -2619,7 +2646,10 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id) if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) { SPLITTER_TEST_FAULT("can't write W/O file\n"); } - H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); + } H5E_END_TRY; if (file_id >= 0) { SPLITTER_TEST_FAULT("R/O open with extant W/O file unexpectedly successful\n"); @@ -2633,7 +2663,10 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id) if (splitter_create_single_file_at(filename_rw, vfd_config->rw_fapl_id, data) < 0) { SPLITTER_TEST_FAULT("can't create R/W file\n"); } - H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); + } H5E_END_TRY; if (file_id >= 0) { SPLITTER_TEST_FAULT("R/O open with extant R/W file unexpectedly successful\n"); @@ -2868,7 +2901,10 @@ splitter_compare_expected_data(hid_t file_id, const struct splitter_dataset_def done: if (ret_value < 0) { - H5E_BEGIN_TRY { H5Dclose(dset_id); } + H5E_BEGIN_TRY + { + H5Dclose(dset_id); + } H5E_END_TRY; } return ret_value; @@ -2966,7 +3002,10 @@ splitter_tentative_open_test(hid_t child_fapl_id) * Should fail. */ - H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); + } H5E_END_TRY; if (file_id != H5I_INVALID_HID) { SPLITTER_TEST_FAULT("open with both nonexistent files unexpectedly succeeded\n"); @@ -2987,7 +3026,10 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("Can't create W/O file copy.\n"); } - H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); + } H5E_END_TRY; if (file_id != H5I_INVALID_HID) { SPLITTER_TEST_FAULT("open with nonexistent R/W file unexpectedly succeeded\n"); @@ -3012,7 +3054,10 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) { SPLITTER_TEST_FAULT("Can't create R/W file copy.\n"); } - H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); + } H5E_END_TRY; if (file_id != H5I_INVALID_HID) { SPLITTER_TEST_FAULT("open with nonexistent W/O unexpectedly succeeded\n"); @@ -3178,7 +3223,10 @@ file_exists(const char *filename, hid_t fapl_id) hid_t file_id = H5I_INVALID_HID; int ret_value = 0; - H5E_BEGIN_TRY { file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id); } + H5E_BEGIN_TRY + { + file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id); + } H5E_END_TRY; if (file_id != H5I_INVALID_HID) { ret_value = 1; @@ -3190,7 +3238,10 @@ file_exists(const char *filename, hid_t fapl_id) return ret_value; error: - H5E_BEGIN_TRY { H5Fclose(file_id); } + H5E_BEGIN_TRY + { + H5Fclose(file_id); + } H5E_END_TRY; return ret_value; } /* end file_exists() */ diff --git a/test/vol.c b/test/vol.c index 61ef621..d975243 100644 --- a/test/vol.c +++ b/test/vol.c @@ -199,7 +199,10 @@ test_vol_registration(void) /* Test registering a connector with an incorrect property list (SHOULD FAIL) */ if ((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR; - H5E_BEGIN_TRY { vol_id = H5VLregister_connector(&fake_vol_g, lapl_id); } + H5E_BEGIN_TRY + { + vol_id = H5VLregister_connector(&fake_vol_g, lapl_id); + } H5E_END_TRY; if (H5I_INVALID_HID != vol_id) FAIL_PUTS_ERROR("should not be able to register a connector with an incorrect property list"); @@ -211,7 +214,10 @@ test_vol_registration(void) TEST_ERROR; HDmemcpy(bad_fake_vol_class, &fake_vol_g, sizeof(H5VL_class_t)); bad_fake_vol_class->version = H5VL_VERSION + 1; - H5E_BEGIN_TRY { vol_id = H5VLregister_connector(bad_fake_vol_class, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + vol_id = H5VLregister_connector(bad_fake_vol_class, H5P_DEFAULT); + } H5E_END_TRY; if (H5I_INVALID_HID != vol_id) FAIL_PUTS_ERROR("should not be able to register a connector with an incompatible version #"); @@ -275,7 +281,10 @@ test_vol_registration(void) /* Try to unregister the native VOL connector (should fail) */ if (H5I_INVALID_HID == (native_id = H5VLget_connector_id_by_name(H5VL_NATIVE_NAME))) TEST_ERROR; - H5E_BEGIN_TRY { ret = H5VLunregister_connector(native_id); } + H5E_BEGIN_TRY + { + ret = H5VLunregister_connector(native_id); + } H5E_END_TRY; if (FAIL != ret) FAIL_PUTS_ERROR("should not be able to unregister the native VOL connector"); diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 8bd6848..7656870 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -71,7 +71,10 @@ test_registration_by_value(void) return SUCCEED; error: - H5E_BEGIN_TRY { H5VLunregister_connector(vol_id); } + H5E_BEGIN_TRY + { + H5VLunregister_connector(vol_id); + } H5E_END_TRY; return FAIL; @@ -125,7 +128,10 @@ test_registration_by_name(void) return SUCCEED; error: - H5E_BEGIN_TRY { H5VLunregister_connector(vol_id); } + H5E_BEGIN_TRY + { + H5VLunregister_connector(vol_id); + } H5E_END_TRY; return FAIL; diff --git a/testpar/t_file.c b/testpar/t_file.c index 9a99c1c..629c24c 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -151,7 +151,10 @@ test_page_buffer_access(void) VRFY((ret == 0), ""); /* This should fail because collective metadata writes are not supported with page buffering */ - H5E_BEGIN_TRY { file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); } + H5E_BEGIN_TRY + { + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; VRFY((file_id < 0), "H5Fcreate failed"); diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index faee63f..41f4761 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -3137,7 +3137,10 @@ ull2float(unsigned long long ull_value, float *f_value) HDmemcpy(f_value, buf, dst_size); done: - H5E_BEGIN_TRY { H5Pclose(dxpl_id); } + H5E_BEGIN_TRY + { + H5Pclose(dxpl_id); + } H5E_END_TRY; if (buf) diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index ab868db..97026f0 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -885,7 +885,10 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_spec fid = H5Fopen(fname, flags, fapl_id); } else { - H5E_BEGIN_TRY { fid = H5Fopen(fname, flags, fapl_id); } + H5E_BEGIN_TRY + { + fid = H5Fopen(fname, flags, fapl_id); + } H5E_END_TRY; } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 5d6a90f..e4c0bdc 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -439,7 +439,10 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace, const h5tool_for /* * This function fails if the rspace does not have blocks. */ - H5E_BEGIN_TRY { snblocks = H5Sget_select_hyper_nblocks(rspace); } + H5E_BEGIN_TRY + { + snblocks = H5Sget_select_hyper_nblocks(rspace); + } H5E_END_TRY; /* Print block information */ @@ -496,7 +499,10 @@ h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace, const h5tool_for /* * This function fails if the rspace does not have points. */ - H5E_BEGIN_TRY { snpoints = H5Sget_select_elem_npoints(rspace); } + H5E_BEGIN_TRY + { + snpoints = H5Sget_select_elem_npoints(rspace); + } H5E_END_TRY; /* Print point information */ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 72e2147..7e05a5a 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -1337,7 +1337,10 @@ done: H5TOOLS_ERROR((-1), "named_datatype_free failed"); } else { - H5E_BEGIN_TRY { named_datatype_free(&named_dt_head, 1); } + H5E_BEGIN_TRY + { + named_datatype_free(&named_dt_head, 1); + } H5E_END_TRY; } diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index a75f6d8..f4cef6a 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -483,7 +483,10 @@ main(int argc, char *argv[]) * file and the new file can only be a single file, reopen the new file should fail. * There's nothing to do in this case. */ - H5E_BEGIN_TRY { file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); } + H5E_BEGIN_TRY + { + file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); + } H5E_END_TRY; if (file >= 0) { diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 5178f25..35e1d6a 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -5375,7 +5375,10 @@ make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void return 0; out: - H5E_BEGIN_TRY { H5Dclose(dsid); } + H5E_BEGIN_TRY + { + H5Dclose(dsid); + } H5E_END_TRY; return -1; } diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index c4ed074..3396217 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -5813,7 +5813,10 @@ make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t dcpl, void *buf) return 0; out: - H5E_BEGIN_TRY { H5Dclose(did); } + H5E_BEGIN_TRY + { + H5Dclose(did); + } H5E_END_TRY; return -1; } diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c index e081bf0..7aa5ad9 100644 --- a/tools/test/misc/repart_test.c +++ b/tools/test/misc/repart_test.c @@ -113,7 +113,10 @@ test_single_h5repart_opens(void) return SUCCEED; error: - H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_BEGIN_TRY + { + H5Fclose(fid); + } H5E_END_TRY; return FAIL; diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index 60e7e15..f214527 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -63,7 +63,10 @@ main(void) return 1; } - H5E_BEGIN_TRY { (void)H5Ldelete(fil, setname, H5P_DEFAULT); } + H5E_BEGIN_TRY + { + (void)H5Ldelete(fil, setname, H5P_DEFAULT); + } H5E_END_TRY; cs6 = H5Tcopy(H5T_C_S1); diff --git a/utils/mirror_vfd/mirror_writer.c b/utils/mirror_vfd/mirror_writer.c index 8171abe..d3f12de 100644 --- a/utils/mirror_vfd/mirror_writer.c +++ b/utils/mirror_vfd/mirror_writer.c @@ -591,7 +591,10 @@ do_open(struct mirror_session *session, const H5FD_mirror_xmit_open_t *xmit_open error: if (fapl_id > 0) { - H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } + H5E_BEGIN_TRY + { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; } return -1; -- cgit v0.12 From d83679762669dc66bde7b2efb54d47c403c1a1bc Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Wed, 17 Mar 2021 10:26:40 -0500 Subject: Correct syntax error. (#474) a Fortran compile -> a Fortran compiler --- release_docs/RELEASE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 95ff9c5..bf4a273 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -242,7 +242,7 @@ New Features - CMake option to link the generated Fortran MOD files into the include directory. - The Fortran generation of MOD files by a Fortran compile can produce + The Fortran generation of MOD files by a Fortran compiler can produce different binary files between SHARED and STATIC compiles with different compilers and/or different platforms. Note that it has been found that different versions of Fortran compilers will produce incompatible MOD -- cgit v0.12 From af54fd532c470fa0bb76aa924dc695a86d3b0f9d Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 17 Mar 2021 10:27:21 -0500 Subject: Fix display of long double in tools (#469) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .gitattributes | 1 + MANIFEST | 4 ++++ config/cmake/hdf5-config-version.cmake.in | 2 +- release_docs/RELEASE.txt | 7 +++++++ tools/lib/h5diff_array.c | 6 +++--- tools/test/h5dump/CMakeTests.cmake | 11 +++++++++-- tools/test/h5dump/h5dumpgentest.c | 1 + tools/test/h5dump/testh5dump.sh.in | 5 ++++- tools/testfiles/tldouble.wddl | 11 +++++++++++ tools/testfiles/tldouble_scalar.ddl | 26 ++++++++++++++++++++++++++ tools/testfiles/tldouble_scalar.h5 | Bin 0 -> 2144 bytes tools/testfiles/tldouble_scalar.wddl | 26 ++++++++++++++++++++++++++ 12 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 tools/testfiles/tldouble.wddl create mode 100755 tools/testfiles/tldouble_scalar.ddl create mode 100644 tools/testfiles/tldouble_scalar.h5 create mode 100755 tools/testfiles/tldouble_scalar.wddl diff --git a/.gitattributes b/.gitattributes index f72b49c..e01442a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -785,6 +785,7 @@ tools/testfiles/tints4dimsStride2.ddl -text tools/testfiles/tintsattrs.h5 -text svneol=unset#application/x-hdf tools/testfiles/tlarge_objname.h5 -text tools/testfiles/tldouble.h5 -text +tools/testfiles/tldouble_scalar.h5 -text tools/testfiles/tlonglinks.h5 -text tools/testfiles/tloop.h5 -text tools/testfiles/tloop2.h5 -text diff --git a/MANIFEST b/MANIFEST index 6605812..b484ce5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2021,7 +2021,11 @@ ./tools/testfiles/tlarge_objname.ddl ./tools/testfiles/tlarge_objname.h5 ./tools/testfiles/tldouble.ddl +./tools/testfiles/tldouble.wddl ./tools/testfiles/tldouble.h5 +./tools/testfiles/tldouble_scalar.ddl +./tools/testfiles/tldouble_scalar.wddl +./tools/testfiles/tldouble_scalar.h5 ./tools/testfiles/tlonglinks.ddl ./tools/testfiles/tlonglinks.h5 ./tools/testfiles/tloop-1.ddl diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in index 8e93dc6..20ce630 100644 --- a/config/cmake/hdf5-config-version.cmake.in +++ b/config/cmake/hdf5-config-version.cmake.in @@ -33,7 +33,7 @@ else() endif() if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND - (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR)) + (PACKAGE_FIND_VERSION_MINOR STRLESS_EQUAL CVF_VERSION_MINOR)) set(PACKAGE_VERSION_COMPATIBLE TRUE) else() set(PACKAGE_VERSION_COMPATIBLE FALSE) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index bf4a273..0549394 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -877,6 +877,13 @@ Bug Fixes since HDF5-1.12.0 release Tools ----- + - Fixed tools display of long double. + + Long doubles were not being display correctly. Changed the printf + specifier from %Lf to %Lg. + + (ADB - 2021/03/12, HDFFV-11113) + - Fixed tools argument parsing. Tools parsing used the length of the option from the long array to match diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 41f4761..77b6a5e 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -27,7 +27,7 @@ #define F_FORMAT "%-15g %-15g %-15g\n" #if H5_SIZEOF_LONG_DOUBLE != 0 -#define LD_FORMAT "%-15Lf %-15Lf %-15Lf\n" +#define LD_FORMAT "%-15Lg %-15Lg %-15Lg\n" #endif #define I_FORMAT "%-15d %-15d %-15d\n" @@ -42,7 +42,7 @@ #define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n" #if H5_SIZEOF_LONG_DOUBLE != 0 -#define LD_FORMAT_P "%-15.10Lf %-15.10Lf %-15.10Lf %-14.10Lf\n" +#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n" #endif #define I_FORMAT_P "%-15d %-15d %-15d %-14f\n" @@ -59,7 +59,7 @@ #define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n" #if H5_SIZEOF_LONG_DOUBLE != 0 -#define LD_FORMAT_P_NOTCOMP "%-15.10Lf %-15.10Lf %-15.10Lf not comparable\n" +#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n" #endif #define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n" diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index f54da76..4b61569 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -127,7 +127,8 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.ddl ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.ddl ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.ddl - ${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl + #${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl #special handling on windows + #${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl #special handling on windows ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.ddl ${HDF5_TOOLS_DIR}/testfiles/tloop-1.ddl ${HDF5_TOOLS_DIR}/testfiles/tmulti.ddl @@ -294,6 +295,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.h5 ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.h5 ${HDF5_TOOLS_DIR}/testfiles/tldouble.h5 + ${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.h5 ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.h5 ${HDF5_TOOLS_DIR}/testfiles/tloop.h5 ${HDF5_TOOLS_DIR}/testfiles/tmulti-b.h5 @@ -409,8 +411,12 @@ configure_file(${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp NEWLINE_STYLE CRLF) #file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM) #file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble.ddl" "h5dump_std_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble_scalar.ddl" "h5dump_std_files") else () HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble.ddl" "h5dump_std_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble_scalar.ddl" "h5dump_std_files") endif () add_custom_target(h5dump_std_files ALL COMMENT "Copying files needed by h5dump_std tests" DEPENDS ${h5dump_std_files_list}) @@ -1085,7 +1091,8 @@ ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5) # test for long double (some systems do not have long double) -# ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) + ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) + ADD_H5_TEST (tldouble_scalar 0 -p --enable-error-stack tldouble_scalar.h5) # test for vms ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5) diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 35e1d6a..1c2bf6f 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -11138,6 +11138,7 @@ main(void) gent_aindices(); gent_longlinks(); gent_ldouble(); + gent_ldouble_scalar(); gent_binary(); gent_bigdims(); gent_hyperslab(); diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 8f478b0..f985da5 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -143,6 +143,7 @@ $SRC_H5DUMP_TESTFILES/tintsattrs.h5 $SRC_H5DUMP_TESTFILES/tints4dims.h5 $SRC_H5DUMP_TESTFILES/tlarge_objname.h5 $SRC_H5DUMP_TESTFILES/tldouble.h5 +$SRC_H5DUMP_TESTFILES/tldouble_scalar.h5 $SRC_H5DUMP_TESTFILES/tlonglinks.h5 $SRC_H5DUMP_TESTFILES/tloop.h5 $SRC_H5DUMP_TESTFILES/tmulti-b.h5 @@ -288,6 +289,7 @@ $SRC_H5DUMP_TESTFILES/tints4dimsStride2.ddl $SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl $SRC_H5DUMP_TESTFILES/tldouble.ddl +$SRC_H5DUMP_TESTFILES/tldouble_scalar.ddl $SRC_H5DUMP_TESTFILES/tlonglinks.ddl $SRC_H5DUMP_TESTFILES/tloop-1.ddl $SRC_H5DUMP_TESTFILES/tmulti.ddl @@ -1351,7 +1353,8 @@ TOOLTEST tgrpnullspace.ddl -p --enable-error-stack tgrpnullspace.h5 TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5 # test for long double (some systems do not have long double) -#TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 +TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 +TOOLTEST tldouble_scalar.ddl -p --enable-error-stack tldouble_scalar.h5 # test for vms TOOLTEST tvms.ddl --enable-error-stack tvms.h5 diff --git a/tools/testfiles/tldouble.wddl b/tools/testfiles/tldouble.wddl new file mode 100644 index 0000000..4793b4d --- /dev/null +++ b/tools/testfiles/tldouble.wddl @@ -0,0 +1,11 @@ +HDF5 "tldouble.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE 128-bit little-endian floating-point + DATASPACE SIMPLE { ( 3 ) / ( 3 ) } + DATA { + (0): 1, 2, 3 + } + } +} +} diff --git a/tools/testfiles/tldouble_scalar.ddl b/tools/testfiles/tldouble_scalar.ddl new file mode 100755 index 0000000..45f0b45 --- /dev/null +++ b/tools/testfiles/tldouble_scalar.ddl @@ -0,0 +1,26 @@ +HDF5 "tldouble_scalar.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_ARRAY { [6] H5T_NATIVE_LDOUBLE } + DATASPACE SCALAR + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 96 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0): [ 0, 1, 2, 3, 4, 5 ] + } + } +} +} diff --git a/tools/testfiles/tldouble_scalar.h5 b/tools/testfiles/tldouble_scalar.h5 new file mode 100644 index 0000000..0344ea0 Binary files /dev/null and b/tools/testfiles/tldouble_scalar.h5 differ diff --git a/tools/testfiles/tldouble_scalar.wddl b/tools/testfiles/tldouble_scalar.wddl new file mode 100755 index 0000000..0c17c31 --- /dev/null +++ b/tools/testfiles/tldouble_scalar.wddl @@ -0,0 +1,26 @@ +HDF5 "tldouble_scalar.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_ARRAY { [6] 128-bit little-endian floating-point } + DATASPACE SCALAR + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 96 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0): [ 0, 1, 2, 3, 4, 5 ] + } + } +} +} -- cgit v0.12 From 35d6091ab7c09ec5d450860ba9795e6abe430c8c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 17 Mar 2021 12:22:02 -0700 Subject: Cleans up a couple of MSVC warnings in testhdf5 (#475) * Fixes a few testhdf5 warnings raised in Visual Studio Visual Studio is grumpier about treating pointers like integers than gcc. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/trefstr.c | 8 +++++--- test/tselect.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/trefstr.c b/test/trefstr.c index 74455da..a3f568a 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -265,7 +265,9 @@ test_refstr_wrap(void) /* Get pointer to raw string in ref-counted string */ s = H5RS_get_str(rs); CHECK_PTR(s, "H5RS_get_str"); - CHECK(s, buf, "wrapping"); + if (s == buf) + TestErrPrintf("%d: Should not have gotten the same pointer from reference-counted string!\n", + __LINE__); cmp = HDstrcmp(s, buf); if (cmp <= 0) TestErrPrintf("%d: string comparison incorrect!\n", __LINE__); @@ -375,7 +377,7 @@ test_refstr_acat(void) /* Append a large string to ref-counted string */ large_str = HDmalloc(1024); - CHECK(large_str, NULL, "HDmalloc"); + CHECK_PTR(large_str, "HDmalloc"); HDmemset(large_str, 'a', 1024); large_str[1023] = '\0'; ret = H5RS_acat(rs, large_str); @@ -386,7 +388,7 @@ test_refstr_acat(void) CHECK_PTR(s, "H5RS_get_str"); HDsprintf(buf, "%s", "foobar"); large_str2 = HDmalloc(1024 + 6); - CHECK(large_str2, NULL, "HDmalloc"); + CHECK_PTR(large_str2, "HDmalloc"); HDstrcpy(large_str2, "foobar"); HDmemset(&large_str2[6], 'a', 1024); large_str2[1029] = '\0'; diff --git a/test/tselect.c b/test/tselect.c index cea8301..1bfb663 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -5381,9 +5381,9 @@ test_select_hyper_union_3d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE3_DIM1 * SPACE3_DIM2); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for (i = 0, tbuf = wbuf; i < SPACE4_DIM1; i++) -- cgit v0.12 From 00a4e41ea4cb09bd4476565cfc550ea715435a91 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Wed, 17 Mar 2021 14:22:17 -0500 Subject: Fix typos and grammar errors. (#476) --- release_docs/RELEASE.txt | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 0549394..0d3c2a5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -242,7 +242,7 @@ New Features - CMake option to link the generated Fortran MOD files into the include directory. - The Fortran generation of MOD files by a Fortran compiler can produce + The Fortran generation of MOD files by a Fortran compile can produce different binary files between SHARED and STATIC compiles with different compilers and/or different platforms. Note that it has been found that different versions of Fortran compilers will produce incompatible MOD @@ -259,7 +259,7 @@ New Features YES NO Default to STATIC NO YES Default to SHARED NO NO Default to SHARED - The defaults can be overriden by setting the config option + The defaults can be overridden by setting the config option HDF5_INSTALL_MOD_FORTRAN to one of NO, SHARED, or STATIC (ADB - 2020/07/09, HDFFV-11116) @@ -384,10 +384,10 @@ New Features Library: -------- - - H5Epush_ret() now requires a trailing semi-colon + - H5Epush_ret() now requires a trailing semicolon H5Epush_ret() is a function-like macro that has been changed to - contain a `do {} while(0)` loop. Consequently, a trailing semi-colon + contain a `do {} while(0)` loop. Consequently, a trailing semicolon is now required to end the `while` statement. Previously, a trailing semi would work, but was not mandatory. This change was made to allow clang-format to correctly format the source code. @@ -413,7 +413,7 @@ New Features (DER - 2020/11/24, HDFFV-11190) - - Add new public function H5Ssel_iter_reset + - Add a new public function H5Ssel_iter_reset This function resets a dataspace selection iterator back to an initial state so that it may be used for iteration once more. @@ -536,7 +536,7 @@ New Features This function returns a datatype equivalent to the supplied datatype but with the location set to be in the file. This datatype can then be used with H5Tconvert to convert data between file and in-memory representation. - This funcition is intended for use only by VOL connector developers. + This function is intended for use only by VOL connector developers. (NAF - 2019/11/08, ID-127) @@ -608,11 +608,11 @@ New Features - Added ability to test java library with VOLs. - Created new CMake script that combines the java and vol test scripts. + Created a new CMake script that combines the java and vol test scripts. (ADB - 2020/02/03, HDFFV-10996) - - Tests fail for non-English locale. + - Tests fail for non-English locales. In the JUnit tests with a non-English locale, only the part before the decimal comma is replaced by XXXX and this leads to a comparison @@ -709,7 +709,7 @@ Bug Fixes since HDF5-1.12.0 release ------- - Remove underscores on header file guards - Header file guards used a variety of underscores at the beginning the define. + Header file guards used a variety of underscores at the beginning of the define. Removed all leading (some trailing) underscores from header file guards. @@ -739,7 +739,7 @@ Bug Fixes since HDF5-1.12.0 release and the filter is optional, it was supposed to be skipped but it was not skipped and the creation failed. - Allowed the creation of the dataset in such situation. + Allowed the creation of the dataset in such a situation. (BMR - 2020/08/13, HDFFV-10933) @@ -758,7 +758,7 @@ Bug Fixes since HDF5-1.12.0 release H5S_NO_CLASS is an internal class value that should not have been exposed via a public API call. - In debug builds of the library, this can cause asserts to trip. In + In debug builds of the library, this can cause assert() functions to trip. In non-debug builds, it will produce normal library errors. The new library behavior is for H5Sset_extent_none() to convert @@ -836,11 +836,11 @@ Bug Fixes since HDF5-1.12.0 release - Added ability to test java library with VOLs. - Created new CMake script that combines the java and vol test scripts. + Created a new CMake script that combines the java and vol test scripts. (ADB - 2020/02/03, HDFFV-10996) - - Tests fail for non-English locale. + - Tests fail for non-English locales. In the JUnit tests with a non-English locale, only the part before the decimal comma is replaced by XXXX and this leads to a comparison @@ -877,18 +877,11 @@ Bug Fixes since HDF5-1.12.0 release Tools ----- - - Fixed tools display of long double. - - Long doubles were not being display correctly. Changed the printf - specifier from %Lf to %Lg. - - (ADB - 2021/03/12, HDFFV-11113) - - Fixed tools argument parsing. Tools parsing used the length of the option from the long array to match the option from the command line. This incorrectly matched a shorter long - name option that was happened to be a subset of another long option. + name option that happened to be a subset of another long option. Changed to match whole names. (ADB - 2021/01/19, HDFFV-11106) @@ -916,8 +909,8 @@ Bug Fixes since HDF5-1.12.0 release - h5diff added a command line option to ignore attributes. h5diff would ignore all objects with a supplied path if the exclude-path argument is used. - Adding the exclude-attribute argument will only eclude attributes, with the supplied path, - from comparision. + Adding the exclude-attribute argument will only exclude attributes, with the supplied path, + from comparison. (ADB - 2020/07/20, HDFFV-5935) -- cgit v0.12 From d0f807527f9aed62643254afb69e1889eac3390e Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 17 Mar 2021 12:23:07 -0700 Subject: Suppresses the tcheck_version test's abort dialog on Windows (#477) * Suppresses the tcheck_version test's abort dialog on Windows Windows raises a modal abort/retry/ignore dialog box when CRT calls abort(). This change installs a report hook that suppresses the dialog so that the CMake tests don't time out waiting for a nonexistent user to click a dialog box. * Committing clang-format changes * Removes __cdecl from callback Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/tcheck_version.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/tcheck_version.c b/test/tcheck_version.c index 49c86c2..bfc8daf 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -29,6 +29,10 @@ #include "h5test.h" +#ifdef H5_HAVE_WIN32_API +#include +#endif + #define progname "tcheck_version" /* prototypes */ @@ -108,12 +112,31 @@ abort_intercept(int H5_ATTR_UNUSED sig) HDexit(6); } +#ifdef H5_HAVE_WIN32_API +/* Turns off the modal dialog that is raised when the Windows CRT calls abort(). + * + * Returning TRUE here lets Windows know that we've handled the abort() and that there + * is no need to alert the user with a modal dialog box. + */ +int +handle_crt_abort(int reportType, char *message, int *returnValue) +{ + return TRUE; +} +#endif + int main(int ac, char **av) { +#ifdef H5_HAVE_WIN32_API + (void)_CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, handle_crt_abort); +#endif parse(ac, av); HDsignal(SIGABRT, &abort_intercept); H5check_version(major, minor, release); HDsignal(SIGABRT, SIG_DFL); +#ifdef H5_HAVE_WIN32_API + (void)_CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, handle_crt_abort); +#endif return 0; } -- cgit v0.12 From 49a14f9e0279e5b43b15121a3d64105f0d7b65b0 Mon Sep 17 00:00:00 2001 From: epourmal Date: Fri, 19 Mar 2021 08:13:32 -0500 Subject: Added description of the current HDF5 branches; added a draft of contribution policy. (#445) * Added description of the current HDF5 branches. * Removed capitalization in from Develop, Release, Feature to reflect the real naming schema * Added a draft of contributions guidance document. * Fixed typos. * Fixed section title. * Fixed typo. * Fixed typos and formatting. * Fixed many typos and simplified the text (e.g., removed testing instructions and left pointers to where to find them, etc.) * Fixed a typo. Please enter the commit message for your changes. Lines starting * Added contributing.md file and rearranged doc entries in alphabetical order. * ddressed Gerd's review comments; found and fixed more typos. * Addressed comments from Larry and Scot. --- MANIFEST | 2 ++ doc/branches-explained.md | 41 ++++++++++++++++++++++ doc/contributing.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 doc/branches-explained.md create mode 100644 doc/contributing.md diff --git a/MANIFEST b/MANIFEST index b484ce5..5d1eb49 100644 --- a/MANIFEST +++ b/MANIFEST @@ -203,7 +203,9 @@ ./config/site-specific/BlankForm +./doc/branches-explained.md ./doc/code-conventions.md +./doc/contributing.md ./doxygen/aliases ./doxygen/Doxyfile.in diff --git a/doc/branches-explained.md b/doc/branches-explained.md new file mode 100644 index 0000000..22b9c8f --- /dev/null +++ b/doc/branches-explained.md @@ -0,0 +1,41 @@ +# HDF5 Git Branching Model Explained + +This document describes current HDF5 branches. + +Branches are tested nightly and testing results are available at https://cdash-internal.hdfgroup.org/ and https://cdash.hdfgroup.org/. +Commits that break daily testing should be fixed by 3:00 pm Central time or reverted. +We encourage code contributors to check the status of their commits. If you have any questions, please contact help@hdfgroup.org. + +## `develop` +Develop is the main branch whose source code always reflects a state with the latest delivered development changes for the next major release of HDF5. +This is also considered the integration branch, as **all** new features are integrated into this branch from respective feature branches. + +## `Maintenance branches` + +Each currently supported release-line of HDF5 (e.g. 1.8.x, 1.10.x, 1.12.x) has a support branch with the name 1_8, 1_10, 1_12. +Maintenance branches are similar to the develop branch, except the source code in a maintenance branch always reflects a state +with the latest delivered development changes for the next **maintenance** release of that particular supported release-line of HDF5. +**Some** new features will be integrated into a release maintenance branch, depending on whether or not those features can be +introduced in minor releases. Maintenance branches are removed when a release-line is retired from support. + +## `feature/*` +Feature branches are temporary branches used to develop new features in HDF5. +Feature branches branch off of develop and exist as long as the feature is under development. +When the feature is complete, the branch is merged back into develop, as well as into any support branches in which the change will be included, and then the feature branch is removed. + +## `release/*` +Release branches are used to prepare a new production release. They are primarily used to allow for last minute dotting of i's and crossing of t's +(things like setting the release version, finalizing release notes, et cetera) and do not include new development. +They are created from the maintenance branch at the time of the maintenance release and have +names 1_8_N, 1_10_N, 1_12_N, where N is the minor release number. Once the release is done it is tagged. +Patches can be applied to the release branch for patch releases that are treated as "scaled down" maintenance releases as defined by Release coordinator. + +## `1.X/master/*` where X is 8, 10 or 12 +These branches are used to tag 1.X.* maintenance releases. + +## `inactive//*` +These branches are for experimental features that were developed in the past and have not been merged to develop, and are not under active development. The features +can be out of sync with the develop branch. + +This document was last updated on March 16, 2021 + diff --git a/doc/contributing.md b/doc/contributing.md new file mode 100644 index 0000000..3f738c8 --- /dev/null +++ b/doc/contributing.md @@ -0,0 +1,87 @@ +# How to contribute to HDF5 (Draft) + +The HDF Group encourages community members to contribute to the HDF5 project. We accept and are very grateful for any type of contributions +from small typos and bug fixes to new features. The HDF Group is committed to work with the code contributors and make contribution process simple and enjoyable. + +This document describes guiding principles for the HDF5 code contributors and does not pretend to address any possible +contribution. If in doubt, please do not hesitate to ask us for guidance. +***Note that no contribution may be accepted unless the donor agrees with the HDF Group software license terms +found in the COPYING file in the top source directory of every branch.*** + + +> We will assume that you are familiar with `git` and `GitHub`. If not, you may go through the GitHub tutorial found at [https://guides.github.com/activities/hello-world/](https://guides.github.com/activities/hello-world/). This tutorial should only take around 10 minutes. + +## Table of Contents + +* [Workflow](#workflow) +* [Acceptance criteria for pull request](#criteria) +* [Check List](#checklist) + +# Workflow + +The process for contributing code to HDF5 is as follows: + +* Open an issue on [HDF5 GitHub](https://github.com/HDFGroup/hdf5/issues). + +> This step is ***required*** unless the change is minor (e.g., typo fix). + +* Fork the [HDF5](https://github.com/HDFGroup/hdf5) repository. +* Make the desired changes to the HDF5 software. + * New features should always go to develop branch first and later should be merged to the appropriate maintenance branches. + * Bug fixes should go to all appropriate branches (develop and maintenance). +* Build and test your changes. Detailed instructions on how to build and test HDF5 can be found in the `INSTALL*` files in the `release_docs` directory. +* Push your changes to GitHub. +* Issue a pull request and address any code formatting and testing issues reported. + +Once a pull request is correctly formatted and passes **ALL** CI tests, it will be reviewed and evaluated by The HDF Group developers and HDF5 community members who can approve pull requests.. +The HDF Group developers will work with you to assure that the pull request satisfies acceptance criteria described in the next section. + +# Acceptance criteria for pull request + +We appreciate every contribution we receive, but we may not accept them all. Those that we *do* accept satisfy the following criteria: + +* **The pull request has a clear purpose** - What does the pull request address? How does it benefit the HDF5 community? +If the pull request does not have a clear purpose and benefits it will not be accepted. + +* **The pull request is documented** - The HDF5 developers must understand not only *what* a change is doing, but *how* it is doing it. + Documenting the code makes it easier for us to understand your patch and will help to maintaine the code in the future. + +* **The pull request passes HDF5 regression testing** - Any issue fixed or functionality added should be accompanied by the corresponding +tests and pass HDF5 regression testing run by The HDF Group. We do not expect you to perform comprehensive testing across multiple platforms +before we accept the pull request. If the pull request does not pass regression testing after the merge, The HDF Group developers will i +work with you on the fixes. + +* **The pull request does not compromise the principles behind HDF5** - HDF5 has a 100% commitment to backward compatibility. + * Any file ever created with HDF5 must be readable by any future version of HDF5. + If the purpose of your patch is to modify HDF5 data model or file format, + **please** discuss this with us first. File format changes and features required by those changes can be introduced only in a new major release. + * HDF5 has a commitment to remaining *machine-independent*; data created on one platform/environment/architecture **must** remain readable by HDF5 on any other. + * For binary compatibility no changes are allowed to public APIs and data structures in the maintenance releases; new APIs can be added. + +* **New features are documented** - Any new features should have proper documentation; talk to us if you have any questions. + + +# Checklist + +Please make sure that you check the items applicable to your pull request: + +* Code + * [ ] Does the pull request have a corresponding GitHub issue and clear purpose? + * [ ] Does the pull request follow HDF5 best practices (naming conventions, code portability, code structure, etc.)? <> + * [ ] If changes were done to autotools build were they added to CMake and vice versa? + * [ ] Is the pull request applicable to any other branches? If yes, which ones? Please document it in the GitHub issue. + * [ ] Is the new code sufficiently documented for future maintenance? + * [ ] Does the new feature require a change to an existing API? See "API Compatibility Macros" document (https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros) +* Documentation + * [ ] Was the change described in the release_docs/RELEASE.txt file? + * [ ] Was MANIFEST updated if new files had been added to the source? + * [ ] Was the new function documented in the corresponding public header file using Doxygen? <> + * [ ] Was new functionality documented for the HDF5 community (the level of documentation depends on the feature; ask us what would be appropriate) +* Testing + * [ ] Does the pull request have tests? + * [ ] Does the pull request affect HDF5 library perfromance? + +We want as many contributions as we can get, and we are here to help. Feel free to reach out to us if you have any questions + +Thank you for your contribution! + -- cgit v0.12 From dafc7285bb1df4a6529a64c215c5de4017016d24 Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Fri, 19 Mar 2021 09:15:03 -0400 Subject: Fixed HDFFV-10480 (CVE-2018-11206) and HDFFV-11159 (CVE-2018-14033) (#405) * Fixed HDFFV-10480 (CVE-2018-11206) and HDFFV-11159 (CVE-2018-14033) Description Checked against buffer size to prevent segfault, in case of data corruption. + HDFFV-11159 CVE-2018-14033 Buffer over-read in H5O_layout_decode + HDFFV-10480 CVE-2018-11206 Buffer over-read in H5O_fill_new[/old]_decode Platforms tested: Linux/64 (jelly) * Accidentally left in another occurrence of the previous patch from user after a more correct fix was applied, that is the check now accounted for the previous advance of the buffer pointer. Removed it. * Typo * Fixed format issues. * Added test. * Changed arguments to ADD_H5_TEST * Fixing arguments to ADD_H5_TEST again. * Fixing arguments again. * Took out the CMake changes until Allen can help. * Added files: tCVE_2018_11206_fill_old.h5 tCVE_2018_11206_fill_new.h5 * Revert "Took out the CMake changes until Allen can help." This reverts commit c21324d6e0044994c5cd24b0671e7d1dd41096cc. * Revert "Fixing arguments again." This reverts commit 5832a70674339e4b524749adde5a181f8c3a446a. * Revert "Fixing arguments to ADD_H5_TEST again." This reverts commit b45de823c22ce83a388d46466ef7c04b66ff05ed. * Revert "Changed arguments to ADD_H5_TEST" This reverts commit 16719824f57e52158451ddd261788c0dcaa3ec55. * Added first argument to ADD_H5_TEST for HDFFV-10480 fix. * Changed argument 0 to 1 * Revert "Changed argument 0 to 1" This reverts commit b343d6613ba681b43248dd5820e96389984ebcf7. * Revert "Added first argument to ADD_H5_TEST for HDFFV-10480 fix." This reverts commit b8a0f9a9e8ec8e6c6ff38d33195d63edff76a563. * Added first argument and corrected the second. * Updated fixes for HDFFV-10480 and HDFFV-11159/HDFFV-11049 * Improved error messages. --- MANIFEST | 2 ++ release_docs/RELEASE.txt | 20 ++++++++++++++++ src/H5Ofill.c | 27 +++++++++++++-------- src/H5Olayout.c | 29 +++++++++++++++-------- tools/test/h5dump/CMakeTests.cmake | 6 +++++ tools/test/h5dump/testh5dump.sh.in | 35 ++++++++++++++++++++++++++++ tools/testfiles/tCVE_2018_11206_fill_new.h5 | Bin 0 -> 1752 bytes tools/testfiles/tCVE_2018_11206_fill_old.h5 | Bin 0 -> 2560 bytes 8 files changed, 99 insertions(+), 20 deletions(-) create mode 100644 tools/testfiles/tCVE_2018_11206_fill_new.h5 create mode 100644 tools/testfiles/tCVE_2018_11206_fill_old.h5 diff --git a/MANIFEST b/MANIFEST index 5d1eb49..f8c64ab 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2134,6 +2134,8 @@ ./tools/testfiles/twithddl.exp ./tools/testfiles/twithddlfile.ddl ./tools/testfiles/twithddlfile.exp +./tools/testfiles/tCVE_2018_11206_fill_old.h5 +./tools/testfiles/tCVE_2018_11206_fill_new.h5 # h5dump test error files ./tools/test/h5dump/errfiles/filter_fail.err diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 0d3c2a5..242d3e6 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -707,6 +707,26 @@ Bug Fixes since HDF5-1.12.0 release =================================== Library ------- + - Fixed CVE-2018-17435 + + The tool h5dump produced a segfault when the size of a fill value + message was corrupted and caused a buffer overflow. + + The problem was fixed by verifying the fill value's size + against the buffer size before attempting to access the buffer. + + (BMR - 2021/03/15, HDFFV-10480) + + - Fixed CVE-2018-14033 (same issue as CVE-2020-10811) + + The tool h5dump produced a segfault when the storage size message + was corrupted and caused a buffer overflow. + + The problem was fixed by verifying the storage size against the + buffer size before attempting to access the buffer. + + (BMR - 2021/03/15, HDFFV-11159/HDFFV-11049) + - Remove underscores on header file guards Header file guards used a variety of underscores at the beginning of the define. diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 695673f..5068039 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -196,8 +196,9 @@ H5O__fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_fill_t *fill = NULL; - void * ret_value = NULL; /* Return value */ + H5O_fill_t * fill = NULL; + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -228,8 +229,11 @@ H5O__fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, INT32DECODE(p, fill->size); if (fill->size > 0) { H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - if ((size_t)fill->size > p_size) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small") + + /* Ensure that fill size doesn't exceed buffer size, due to possible data corruption */ + if (p + fill->size - 1 > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "fill size exceeds buffer size") + if (NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") H5MM_memcpy(fill->buf, p, (size_t)fill->size); @@ -311,10 +315,11 @@ static void * H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_fill_t *fill = NULL; /* Decoded fill value message */ - htri_t exists = FALSE; - H5T_t * dt = NULL; - void * ret_value = NULL; /* Return value */ + H5O_fill_t * fill = NULL; /* Decoded fill value message */ + htri_t exists = FALSE; + H5T_t * dt = NULL; + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -335,8 +340,10 @@ H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flag /* Only decode the fill value itself if there is one */ if (fill->size > 0) { H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - if ((size_t)fill->size > p_size) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small") + + /* Ensure that fill size doesn't exceed buffer size, due to possible data corruption */ + if (p + fill->size - 1 > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "fill size exceeds buffer size") /* Get the datatype message */ if ((exists = H5O_msg_exists_oh(open_oh, H5O_DTYPE_ID)) < 0) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 4020b23..651e317 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -17,7 +17,7 @@ * Purpose: Messages related to data layout. */ -#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ #include "H5private.h" /* Generic Functions */ @@ -90,12 +90,13 @@ H5FL_DEFINE(H5O_layout_t); */ static void * H5O__layout_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_layout_t *mesg = NULL; - uint8_t * heap_block = NULL; - unsigned u; - void * ret_value = NULL; /* Return value */ + H5O_layout_t * mesg = NULL; + uint8_t * heap_block = NULL; + unsigned u; + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -179,6 +180,10 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU if (mesg->type == H5D_COMPACT) { UINT32DECODE(p, mesg->storage.u.compact.size); if (mesg->storage.u.compact.size > 0) { + /* Ensure that size doesn't exceed buffer size, due to possible data corruption */ + if (p + mesg->storage.u.compact.size - 1 > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "storage size exceeds buffer size") + if (NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") @@ -198,6 +203,10 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU UINT16DECODE(p, mesg->storage.u.compact.size); if (mesg->storage.u.compact.size > 0) { + /* Ensure that size doesn't exceed buffer size, due to possible data corruption */ + if (p + mesg->storage.u.compact.size - 1 > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "storage size exceeds buffer size") + /* Allocate space for compact data */ if (NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, @@ -887,13 +896,13 @@ done: } /* end H5O__layout_reset() */ /*------------------------------------------------------------------------- - * Function: H5O__layout_free + * Function: H5O__layout_free * - * Purpose: Free's the message + * Purpose: Free's the message * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2000 * *------------------------------------------------------------------------- diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 4b61569..411e9ef 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -333,6 +333,8 @@ ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5 ${HDF5_TOOLS_DIR}/testfiles/tvms.h5 ${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5 + ${HDF5_TOOLS_DIR}/testfiles/tCVE_2018_11206_fill_old.h5 + ${HDF5_TOOLS_DIR}/testfiles/tCVE_2018_11206_fill_new.h5 ${HDF5_TOOLS_DIR}/testfiles/zerodim.h5 #STD_REF_OBJ files ${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5 @@ -1179,6 +1181,10 @@ # test to verify HDFFV-9407: long double full precision # ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lg t128bit_float.h5) + # test to verify HDFFV-10480: out of bounds read in H5O_fill_new[old]_decode + ADD_H5_TEST (tCVE_2018_11206_fill_old 1 tCVE_2018_11206_fill_old.h5) + ADD_H5_TEST (tCVE_2018_11206_fill_new 1 tCVE_2018_11206_fill_new.h5) + ############################################################################## ### P L U G I N T E S T S ############################################################################## diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index f985da5..c4e2fd4 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -181,6 +181,8 @@ $SRC_H5DUMP_TESTFILES/tvlenstr_array.h5 $SRC_H5DUMP_TESTFILES/tvlstr.h5 $SRC_H5DUMP_TESTFILES/tvms.h5 $SRC_H5DUMP_TESTFILES/err_attr_dspace.h5 +$SRC_H5DUMP_TESTFILES/tCVE_2018_11206_fill_old.h5 +$SRC_H5DUMP_TESTFILES/tCVE_2018_11206_fill_new.h5 " LIST_OTHER_TEST_FILES=" @@ -870,6 +872,35 @@ TOOLTEST5() { fi } +# same as TOOLTEST1 but expects h5dump to fail +# +TOOLTEST_FAIL() { + + infile=$1 + expect="$TESTDIR/`basename $1 exp`.ddl" + actual="$TESTDIR/`basename $1 .exp`.out" + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" $infile + ) >&$actual + RET=$? + # Segfault occurred + if [ $RET == 139 ] ; then + nerrors="`expr $nerrors + 1`" + echo "*FAILED - test on $infile failed with segmentation fault" + # Should fail but didn't + elif [ $RET == 0 ] ; then + nerrors="`expr $nerrors + 1`" + echo "*FAILED - test on $infile did not fail as expected" + else + echo " PASSED" + fi + +} + # ADD_HELP_TEST TOOLTEST_HELP() { @@ -1448,6 +1479,10 @@ TOOLTEST err_attr_dspace.ddl err_attr_dspace.h5 # test to verify HDFFV-9407: long double full precision #GREPTEST OUTTXT "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 +# test to verify HDFFV-10480: out of bounds read in H5O_fill_new[old]_decode +TOOLTEST_FAIL tCVE_2018_11206_fill_old.h5 +TOOLTEST_FAIL tCVE_2018_11206_fill_new.h5 + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/testfiles/tCVE_2018_11206_fill_new.h5 b/tools/testfiles/tCVE_2018_11206_fill_new.h5 new file mode 100644 index 0000000..643591c Binary files /dev/null and b/tools/testfiles/tCVE_2018_11206_fill_new.h5 differ diff --git a/tools/testfiles/tCVE_2018_11206_fill_old.h5 b/tools/testfiles/tCVE_2018_11206_fill_old.h5 new file mode 100644 index 0000000..7f5b41a Binary files /dev/null and b/tools/testfiles/tCVE_2018_11206_fill_old.h5 differ -- cgit v0.12 From 1c8b3dbe4df31b8e35a51a927977b64ec12f27e9 Mon Sep 17 00:00:00 2001 From: Yu Feng Date: Fri, 19 Mar 2021 06:32:05 -0700 Subject: Purge the buffer used in type conversion. (#263) Some of the uniniitialized bits in the buffer may get carried through all the way to disk, creating a risk for leaks. We observed an msan error during the floating point output conversion. Due to the encoding certain bits could remain untouched during the conversion. In this draft we zero initialize the dbuf used by every convertor. --- src/H5Tconv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 7b5fce1..f2dff0b 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1668,7 +1668,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz size_t olap; /*num overlapping elements */ size_t half_size; /*1/2 of total size for swapping*/ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t dbuf[256]; /*temp destination buffer */ + uint8_t dbuf[256] = {0}; /*temp destination buffer */ size_t msb_pad_offset; /*offset for dest MSB padding */ size_t i; uint8_t * src_rev = NULL; /*order-reversed source buffer */ @@ -3844,7 +3844,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz size_t olap; /*num overlapping elements */ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ uint8_t * src_rev = NULL; /*order-reversed source buffer */ - uint8_t dbuf[64]; /*temp destination buffer */ + uint8_t dbuf[64] = {0}; /*temp destination buffer */ size_t first; ssize_t sfirst; /*a signed version of `first' */ size_t i; /*Local index variables */ @@ -4287,7 +4287,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz ssize_t bitno = 0; /*bit number */ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ uint8_t * src_rev = NULL; /*order-reversed source buffer */ - uint8_t dbuf[64]; /*temp destination buffer */ + uint8_t dbuf[64] = {0}; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ /* Conversion-related variables */ @@ -4947,7 +4947,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz dst_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : dst->shared->size); /* Allocate the overlap buffer */ - if (NULL == (dbuf = (uint8_t *)H5MM_malloc(dst->shared->size))) + if (NULL == (dbuf = (uint8_t *)H5MM_calloc(dst->shared->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion") /* The conversion loop. */ @@ -8402,7 +8402,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz size_t olap; /*num overlapping elements */ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ uint8_t * src_rev = NULL; /*order-reversed source buffer */ - uint8_t dbuf[64]; /*temp destination buffer */ + uint8_t dbuf[64] = {0}; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ /* Conversion-related variables */ @@ -9028,7 +9028,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz size_t olap; /*num overlapping elements */ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ uint8_t * src_rev = NULL; /*order-reversed source buffer */ - uint8_t dbuf[64]; /*temp destination buffer */ + uint8_t dbuf[64] = {0}; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ /* Conversion-related variables */ -- cgit v0.12 From 03864c675c9037209a0c7fb9cd16a6d26233ac6c Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Fri, 19 Mar 2021 21:20:11 -0500 Subject: Fix CMake error message location. (#478) Print error message if Perl is not found. --- test/CMakeTests.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index c623a0e..242c918 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -916,9 +916,9 @@ if (ENABLE_EXTENDED_TESTS) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test ) + else () + message (STATUS "Cannot execute TEST flushrefresh - perl not found") endif () -else () - message (STATUS "Cannot execute TEST flushrefresh - perl not found") endif () ############################################################################## -- cgit v0.12 From 05bc1905cb37d145c29c036bacb1caac63c7f0c9 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 22 Mar 2021 03:55:40 -0700 Subject: Adds an implementation for nanosleep on Windows (#483) * Adds an implementation for nanosleep on Windows * Committing clang-format changes * Fix insane formatter issue Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5Tconv.c | 8 ++++---- src/H5system.c | 45 ++++++++++++++++++++------------------------- src/H5win32defs.h | 1 - 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index f2dff0b..0c98633 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3843,7 +3843,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz size_t half_size; /*half the type size */ size_t olap; /*num overlapping elements */ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t * src_rev = NULL; /*order-reversed source buffer */ + uint8_t * src_rev = NULL; /*order-reversed source buffer */ uint8_t dbuf[64] = {0}; /*temp destination buffer */ size_t first; ssize_t sfirst; /*a signed version of `first' */ @@ -4286,7 +4286,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz size_t olap; /*num overlapping elements */ ssize_t bitno = 0; /*bit number */ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t * src_rev = NULL; /*order-reversed source buffer */ + uint8_t * src_rev = NULL; /*order-reversed source buffer */ uint8_t dbuf[64] = {0}; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ @@ -8401,7 +8401,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz size_t tsize; /*type size for swapping bytes */ size_t olap; /*num overlapping elements */ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t * src_rev = NULL; /*order-reversed source buffer */ + uint8_t * src_rev = NULL; /*order-reversed source buffer */ uint8_t dbuf[64] = {0}; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ @@ -9027,7 +9027,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz size_t tsize; /*type size for swapping bytes */ size_t olap; /*num overlapping elements */ uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t * src_rev = NULL; /*order-reversed source buffer */ + uint8_t * src_rev = NULL; /*order-reversed source buffer */ uint8_t dbuf[64] = {0}; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ diff --git a/src/H5system.c b/src/H5system.c index 53307a8..1d94816 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -655,25 +655,6 @@ Wflock(int fd, int operation) { return 0; } /* end Wflock() */ -/*-------------------------------------------------------------------------- - * Function: Wnanosleep - * - * Purpose: Sleep for a given # of nanoseconds (Windows version) - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * Fall 2016 - *-------------------------------------------------------------------------- - */ -int -Wnanosleep(const struct timespec *req, struct timespec *rem) -{ - /* XXX: Currently just a placeholder */ - return 0; - -} /* end Wnanosleep() */ - /*------------------------------------------------------------------------- * Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf * @@ -1052,6 +1033,9 @@ done: * * Purpose: Sleep for a given # of nanoseconds * + * Note that commodity hardware is probably going to have a + * resolution of milliseconds, not nanoseconds. + * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol @@ -1061,15 +1045,26 @@ done: void H5_nanosleep(uint64_t nanosec) { - struct timespec sleeptime; /* Struct to hold time to sleep */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Set up time to sleep */ - sleeptime.tv_sec = 0; - sleeptime.tv_nsec = (long)nanosec; +#ifdef H5_HAVE_WIN32_API + + /* On Windows, Sleep() is in milliseconds. Passing 0 to Sleep() + * causes the thread to relinquish the rest of its time slice. + */ + Sleep(nanosec / (1000 * 1000)); - HDnanosleep(&sleeptime, NULL); +#else + { + struct timespec sleeptime; /* Struct to hold time to sleep */ + + /* Set up time to sleep */ + sleeptime.tv_sec = 0; + sleeptime.tv_nsec = (long)nanosec; + + HDnanosleep(&sleeptime, NULL); + } +#endif FUNC_LEAVE_NOAPI_VOID } /* end H5_nanosleep() */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 8f3947a..9cd0afb 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -174,7 +174,6 @@ H5_DLL int Wflock(int fd, int operation); H5_DLL char * Wgetlogin(void); H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...); H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap); -H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); H5_DLL wchar_t *H5_get_utf16_str(const char *s); H5_DLL int Wopen_utf8(const char *path, int oflag, ...); -- cgit v0.12 From 60e14b826a22452934f7057196c1ce4d0054d97a Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 22 Mar 2021 09:32:40 -0700 Subject: File locks now work on Windows (#480) * File locks now work on Windows Uses LockFileEx() and UnlockFileEx(). Fixes HDFFV-10191 (partial). * Committing clang-format changes * Committing clang-format changes * Fixes commenting in h5repack * Reworks H5Fis_accessible() H5Fis_accessible() created a new file handle and attempted to read through it, which will fail when a file has been opened with an exclusive lock on operating systems that have mandatory locks. This change uses the same scheme we use in H5Fopen() to check if the file is already open and only tries to read the file signature if the file has not already been opened. Also adds a test for this behavior. * Committing clang-format changes * Trivial change to force github to run actions Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- release_docs/RELEASE.txt | 17 ++++++++++ src/H5Fint.c | 36 +++++++++++++++----- src/H5system.c | 51 +++++++++++++++-------------- test/tfile.c | 23 +++++++++++++ tools/src/h5repack/h5repack_copy.c | 67 ++++++++++++++++++++++++++------------ 5 files changed, 140 insertions(+), 54 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 242d3e6..13331b1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -384,6 +384,23 @@ New Features Library: -------- + - File locking now works on Windows + + Since version 1.10.0, the HDF5 library has used a file locking scheme + to help enforce one reader at a time accessing an HDF5 file, which can + be helpful when setting up readers and writers to use the single- + writer/multiple-readers (SWMR) access pattern. + + In the past, this was only functional on POSIX systems where flock() or + fcntl() were present. Windows used a no-op stub that always succeeded. + + HDF5 now uses LockFileEx() and UnlockFileEx() to lock the file using the + same scheme as POSIX systems. We lock the entire file when we set up the + locks (by passing DWORDMAX as both size parameters to LockFileEx()). + + (DER - 2021/03/19, HDFFV-10191) + + - H5Epush_ret() now requires a trailing semicolon H5Epush_ret() is a function-like macro that has been changed to diff --git a/src/H5Fint.c b/src/H5Fint.c index 920bf51..6da9473 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1056,9 +1056,10 @@ done: htri_t H5F__is_hdf5(const char *name, hid_t fapl_id) { - H5FD_t *file = NULL; /* Low-level file struct */ - haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */ - htri_t ret_value = FAIL; /* Return value */ + H5FD_t * file = NULL; /* Low-level file struct */ + H5F_shared_t *shared = NULL; /* Shared part of file */ + haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1069,10 +1070,20 @@ H5F__is_hdf5(const char *name, hid_t fapl_id) if (NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file") - /* The file is an hdf5 file if the hdf5 file signature can be found */ - if (H5FD_locate_signature(file, &sig_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature") - ret_value = (HADDR_UNDEF != sig_addr); + /* If the file is already open, it's an HDF5 file + * + * If the file is open with an exclusive lock on an operating system that enforces + * mandatory file locks (like Windows), creating a new file handle and attempting + * to read through it will fail so we have to try this first. + */ + if ((shared = H5F__sfile_search(file)) != NULL) + ret_value = TRUE; + else { + /* The file is an HDF5 file if the HDF5 file signature can be found */ + if (H5FD_locate_signature(file, &sig_addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature") + ret_value = (HADDR_UNDEF != sig_addr); + } done: /* Close the file */ @@ -1782,7 +1793,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) FUNC_ENTER_NOAPI(NULL) /* - * If the driver has a `cmp' method then the driver is capable of + * If the driver has a 'cmp' method then the driver is capable of * determining when two file handles refer to the same file and the * library can insure that when the application opens a file twice * that the two handles coordinate their operations appropriately. @@ -3718,10 +3729,17 @@ H5F__start_swmr_write(H5F_t *f) setup = TRUE; /* Place an advisory lock on the file */ - if (H5F_USE_FILE_LOCKING(f)) + if (H5F_USE_FILE_LOCKING(f)) { + /* Have to unlock on Windows as Win32 doesn't support changing the lock + * type (exclusive vs shared) with a second call. + */ + if (H5FD_unlock(f->shared->lf) < 0) { + HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file") + } if (H5FD_lock(f->shared->lf, TRUE) < 0) { HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file") } + } /* Mark superblock as dirty */ if (H5F_super_dirty(f) < 0) diff --git a/src/H5system.c b/src/H5system.c index 1d94816..745476d 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -618,40 +618,43 @@ c99_vsnprintf(char *str, size_t size, const char *format, va_list ap) *------------------------------------------------------------------------- */ int -Wflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) +Wflock(int fd, int operation) { -/* This is a no-op while we implement a Win32 VFD */ -#if 0 -int -Wflock(int fd, int operation) { - - HANDLE hFile; - DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; - DWORD dwReserved = 0; - /* MAXDWORD for entire file */ - DWORD nNumberOfBytesToLockLow = MAXDWORD; - DWORD nNumberOfBytesToLockHigh = MAXDWORD; - /* Must initialize OVERLAPPED struct */ - OVERLAPPED overlapped = {0}; + HANDLE hFile; + DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; + DWORD dwReserved = 0; + /* MAXDWORD locks the entire file */ + DWORD nNumberOfBytesToLockLow = MAXDWORD; + DWORD nNumberOfBytesToLockHigh = MAXDWORD; + /* Must initialize OVERLAPPED struct */ + OVERLAPPED overlapped = {0}; /* Get Windows HANDLE */ - hFile = _get_osfhandle(fd); + if (INVALID_HANDLE_VALUE == (hFile = (HANDLE)_get_osfhandle(fd))) + return -1; /* Convert to Windows flags */ - if(operation & LOCK_EX) + if (operation & LOCK_EX) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; /* Lock or unlock */ - if(operation & LOCK_UN) - if(0 == UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow, - nNumberOfBytesToLockHigh, &overlapped)) - return -1; - else - if(0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, - nNumberOfBytesToLockHigh, &overlapped)) + if (operation & LOCK_UN) { + if (0 == + UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, &overlapped)) { + /* Attempting to unlock an already unlocked file will fail and this can happen + * in H5Fstart_swmr_write(). For now, just ignore the "error" (error code: 0x9e / 158). + */ + if (GetLastError() != 158) + return -1; + } + } + else { + if (0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, + &overlapped)) return -1; -#endif /* 0 */ + } + return 0; } /* end Wflock() */ diff --git a/test/tfile.c b/test/tfile.c index c8c123c..0d2926f 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1666,6 +1666,29 @@ test_file_is_accessible(const char *env_h5_drvr) is_hdf5 = H5Fis_accessible(filename, fapl_id); VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); + /*****************************************/ + /* Newly created file that is still open */ + /*****************************************/ + + /* On Windows, file locking is mandatory so this check ensures that + * H5Fis_accessible() works on files that have an exclusive lock. + * Previous versions of this API call created an additional file handle + * and attempted to read through it, which will not work when locks + * are enforced by the OS. + */ + + /* Create a file and hold it open */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); + + /* Verify that the file is an HDF5 file */ + is_hdf5 = H5Fis_accessible(filename, fapl_id); + VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + /*******************************/ /* Non-default user block size */ /*******************************/ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 7e05a5a..536de69 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -305,14 +305,6 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) H5TOOLS_GOTO_ERROR((-1), "H5Fcreate could not create file <%s>:", fnameout); /*------------------------------------------------------------------------- - * write a new user block if requested - *------------------------------------------------------------------------- - */ - if (options->ublock_size > 0) - if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) - H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); - - /*------------------------------------------------------------------------- * get list of objects *------------------------------------------------------------------------- */ @@ -346,27 +338,60 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) } /*------------------------------------------------------------------------- - * write only the input file user block if there is no user block file input + * Close the file and everything in it so the lock is removed + *------------------------------------------------------------------------- + */ + if (H5Pclose(fcpl) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Pclose(options->fout_fapl) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + options->fout_fapl = H5P_DEFAULT; + if (H5Pclose(gcpl_in) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Gclose(grp_in) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Fclose(fidout) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Fclose(fidin) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + + /*------------------------------------------------------------------------- + * NOTE: The userblock MUST be written out AFTER the file is closed or + * the file locking will cause failures on Windows, where file locks + * are mandatory, not advisory. + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * Write a new user block if requested, using the input file user block if + * there is no separate user block file input *------------------------------------------------------------------------- */ - if (ub_size > 0 && options->ublock_size == 0) + if (options->ublock_size > 0) { + if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) + H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); + } + else if (ub_size > 0 && options->ublock_size == 0) { if (copy_user_block(fnamein, fnameout, ub_size) < 0) H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); + } done: - H5E_BEGIN_TRY - { - H5Pclose(fcpl); - H5Pclose(options->fout_fapl); - options->fout_fapl = H5P_DEFAULT; - H5Pclose(gcpl_in); - H5Gclose(grp_in); - H5Pclose(fcpl_in); - H5Fclose(fidout); - H5Fclose(fidin); + if (-1 == ret_value) { + H5E_BEGIN_TRY + { + H5Pclose(fcpl); + H5Pclose(options->fout_fapl); + options->fout_fapl = H5P_DEFAULT; + H5Pclose(gcpl_in); + H5Gclose(grp_in); + H5Pclose(fcpl_in); + H5Fclose(fidout); + H5Fclose(fidin); + } + H5E_END_TRY; } - H5E_END_TRY; if (travt) trav_table_free(travt); -- cgit v0.12 From 38b9474af03909d49cc928c71c190e4f26a15b5c Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 22 Mar 2021 13:51:18 -0400 Subject: Applied clang-tidy readability-delete-null-pointer fixes (#430) delete nullptr is well-defined, does not need check. Manually fixed indentation after automatic changes. --- c++/src/H5DaccProp.cpp | 3 +-- c++/src/H5DataSpace.cpp | 3 +-- c++/src/H5DcreatProp.cpp | 3 +-- c++/src/H5DxferProp.cpp | 3 +-- c++/src/H5FaccProp.cpp | 3 +-- c++/src/H5FcreatProp.cpp | 3 +-- c++/src/H5LaccProp.cpp | 3 +-- c++/src/H5LcreatProp.cpp | 3 +-- c++/src/H5OcreatProp.cpp | 3 +-- c++/src/H5PropList.cpp | 3 +-- c++/test/dsets.cpp | 36 ++++++++++++------------------------ c++/test/tcompound.cpp | 12 ++++-------- c++/test/tfile.cpp | 12 ++++++------ c++/test/trefer.cpp | 9 +++------ c++/test/ttypes.cpp | 3 +-- c++/test/tvlstr.cpp | 6 ++---- 16 files changed, 38 insertions(+), 70 deletions(-) diff --git a/c++/src/H5DaccProp.cpp b/c++/src/H5DaccProp.cpp index 35c071a..1905f27 100644 --- a/c++/src/H5DaccProp.cpp +++ b/c++/src/H5DaccProp.cpp @@ -72,8 +72,7 @@ DSetAccPropList::getConstant() void DSetAccPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 0485530..c20a88c 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -69,8 +69,7 @@ DataSpace::getConstant() void DataSpace::deleteConstants() { - if (ALL_ != 0) - delete ALL_; + delete ALL_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 383e38f..34be7ba 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -78,8 +78,7 @@ DSetCreatPropList::getConstant() void DSetCreatPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 2b50de4..43ea6f4 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -72,8 +72,7 @@ DSetMemXferPropList::getConstant() void DSetMemXferPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index 926ac2f..a79ada3 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -76,8 +76,7 @@ FileAccPropList::getConstant() void FileAccPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index b9be563..b51ba10 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -68,8 +68,7 @@ FileCreatPropList::getConstant() void FileCreatPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp index feaa555..acdaa13 100644 --- a/c++/src/H5LaccProp.cpp +++ b/c++/src/H5LaccProp.cpp @@ -70,8 +70,7 @@ LinkAccPropList::getConstant() void LinkAccPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp index 29721c1..63fe861 100644 --- a/c++/src/H5LcreatProp.cpp +++ b/c++/src/H5LcreatProp.cpp @@ -70,8 +70,7 @@ LinkCreatPropList::getConstant() void LinkCreatPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp index 81dae31..dffdeb1 100644 --- a/c++/src/H5OcreatProp.cpp +++ b/c++/src/H5OcreatProp.cpp @@ -70,8 +70,7 @@ ObjCreatPropList::getConstant() void ObjCreatPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 28ab44e..8b45f79 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -71,8 +71,7 @@ PropList::getConstant() void PropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 0faf457..356112e 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -159,8 +159,7 @@ test_create(H5File &file) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; // clean up and return with failure - if (dataset != NULL) - delete dataset; + delete dataset; return -1; } // catch all other exceptions @@ -168,8 +167,7 @@ test_create(H5File &file) issue_fail_msg("test_create", __LINE__, __FILE__); // clean up and return with failure - if (dataset != NULL) - delete dataset; + delete dataset; return -1; } } // test_create @@ -249,8 +247,7 @@ test_simple_io(H5File &file) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; // clean up and return with failure - if (tconv_buf) - delete[] tconv_buf; + delete[] tconv_buf; return -1; } } // test_simple_io @@ -692,10 +689,8 @@ test_compression(H5File &file) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; // clean up and return with failure - if (dataset != NULL) - delete dataset; - if (tconv_buf) - delete[] tconv_buf; + delete dataset; + delete[] tconv_buf; return -1; } } // test_compression @@ -885,8 +880,7 @@ test_multiopen(H5File &file) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; // clean up and return with failure - if (space != NULL) - delete space; + delete space; return -1; } } // test_multiopen @@ -964,8 +958,7 @@ test_types(H5File &file) cerr << " <<< " << "bitfield_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; + delete dset; return -1; } @@ -996,8 +989,7 @@ test_types(H5File &file) cerr << " <<< " << "bitfield_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; + delete dset; throw E; // propagate the exception } @@ -1031,10 +1023,8 @@ test_types(H5File &file) cerr << " <<< " << "opaque_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; - if (optype != NULL) - delete optype; + delete dset; + delete optype; throw E; // propagate the exception } @@ -1067,10 +1057,8 @@ test_types(H5File &file) cerr << " <<< " << "opaque_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; - if (optype != NULL) - delete optype; + delete dset; + delete optype; throw E; // propagate the exception } diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 82c21e8..2170a9d 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -176,8 +176,7 @@ test_compound_2() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - if (array_dt) - delete array_dt; + delete array_dt; } // test_compound_2() /*------------------------------------------------------------------------- @@ -287,8 +286,7 @@ test_compound_3() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - if (array_dt) - delete array_dt; + delete array_dt; } // test_compound_3() /*------------------------------------------------------------------------- @@ -407,8 +405,7 @@ test_compound_4() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - if (array_dt) - delete array_dt; + delete array_dt; } // test_compound_4() /*------------------------------------------------------------------------- @@ -504,8 +501,7 @@ test_compound_5() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - if (array_dt) - delete array_dt; + delete array_dt; } // test_compound_5() /*------------------------------------------------------------------------- diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 5e4e91b..255fc30 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -175,14 +175,14 @@ test_file_create() catch (InvalidActionException &E) { cerr << " *FAILED*" << endl; cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - if (file1 != NULL) // clean up - delete file1; + // clean up + delete file1; } // catch all other exceptions catch (Exception &E) { issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); - if (file1 != NULL) // clean up - delete file1; + // clean up + delete file1; } // Setting this to NULL for cleaning up in failure situations @@ -260,8 +260,8 @@ test_file_create() // catch all exceptions catch (Exception &E) { issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); - if (tmpl1 != NULL) // clean up - delete tmpl1; + // clean up + delete tmpl1; } } // test_file_create() diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 939b0ee..604ccc0 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -179,8 +179,7 @@ test_reference_params() issue_fail_msg("test_reference_param()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } /* test_reference_param() */ /*------------------------------------------------------------------------- @@ -374,8 +373,7 @@ test_reference_obj() issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } // test_reference_obj() /*------------------------------------------------------------------------- @@ -518,8 +516,7 @@ test_reference_group() issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } /* test_reference_group() */ /*------------------------------------------------------------------------- diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 5fc82a5..b633740 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -802,8 +802,7 @@ test_named() issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg()); } - if (ds_type) - delete ds_type; + delete ds_type; } // test_named /*------------------------------------------------------------------------- diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index b371518..9c0f78a 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -313,8 +313,7 @@ test_vlstring_array_dataset() issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } // end test_vlstring_array_dataset() /*------------------------------------------------------------------------- @@ -527,8 +526,7 @@ test_vlstring_type() issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } // end test_vlstring_type() /*------------------------------------------------------------------------- -- cgit v0.12 From 98acb0adcffd1c0f8daad4568a85fe75b5066827 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Mon, 22 Mar 2021 13:31:42 -0500 Subject: small edits (#481) * fixed missed closing of a dataset * fixed missed closing of a dataset * fixed typo in error return * Committing clang-format changes * minor edits * code format * Committing clang-format changes * code format * minor edit Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- doc/contributing.md | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/doc/contributing.md b/doc/contributing.md index 3f738c8..7f9e8d3 100644 --- a/doc/contributing.md +++ b/doc/contributing.md @@ -1,12 +1,12 @@ -# How to contribute to HDF5 (Draft) +# How to contribute to HDF5 -The HDF Group encourages community members to contribute to the HDF5 project. We accept and are very grateful for any type of contributions -from small typos and bug fixes to new features. The HDF Group is committed to work with the code contributors and make contribution process simple and enjoyable. +The HDF Group encourages community members to contribute to the HDF5 project. We accept and are very grateful for any contributions, +from minor typos and bug fixes to new features. The HDF Group is committed to work with the code contributors and make contribution process enjoyable and straightforward. This document describes guiding principles for the HDF5 code contributors and does not pretend to address any possible contribution. If in doubt, please do not hesitate to ask us for guidance. ***Note that no contribution may be accepted unless the donor agrees with the HDF Group software license terms -found in the COPYING file in the top source directory of every branch.*** +found in the COPYING file in every branch's top source directory.*** > We will assume that you are familiar with `git` and `GitHub`. If not, you may go through the GitHub tutorial found at [https://guides.github.com/activities/hello-world/](https://guides.github.com/activities/hello-world/). This tutorial should only take around 10 minutes. @@ -14,7 +14,7 @@ found in the COPYING file in the top source directory of every branch.*** ## Table of Contents * [Workflow](#workflow) -* [Acceptance criteria for pull request](#criteria) +* [Acceptance criteria for a pull request](#criteria) * [Check List](#checklist) # Workflow @@ -27,36 +27,35 @@ The process for contributing code to HDF5 is as follows: * Fork the [HDF5](https://github.com/HDFGroup/hdf5) repository. * Make the desired changes to the HDF5 software. - * New features should always go to develop branch first and later should be merged to the appropriate maintenance branches. - * Bug fixes should go to all appropriate branches (develop and maintenance). -* Build and test your changes. Detailed instructions on how to build and test HDF5 can be found in the `INSTALL*` files in the `release_docs` directory. + * New features should always go to _develop_ branch first and later should be merged to the appropriate maintenance branches. + * Bug fixes should go to all appropriate branches (_develop_ and maintenance). +* Build and test your changes. Detailed instructions on building and testing HDF5 can be found in the `INSTALL*` files in the `release_docs` directory. * Push your changes to GitHub. * Issue a pull request and address any code formatting and testing issues reported. -Once a pull request is correctly formatted and passes **ALL** CI tests, it will be reviewed and evaluated by The HDF Group developers and HDF5 community members who can approve pull requests.. -The HDF Group developers will work with you to assure that the pull request satisfies acceptance criteria described in the next section. +Once a pull request is correctly formatted and passes **ALL** CI tests, it will be reviewed and evaluated by The HDF Group developers and HDF5 community members who can approve pull requests. +The HDF Group developers will work with you to ensure that the pull request satisfies the acceptance criteria described in the next section. -# Acceptance criteria for pull request +# Acceptance criteria for a pull request -We appreciate every contribution we receive, but we may not accept them all. Those that we *do* accept satisfy the following criteria: +We appreciate every contribution we receive, but we may not accept them all. Those that we *do* satisfy the following criteria: * **The pull request has a clear purpose** - What does the pull request address? How does it benefit the HDF5 community? -If the pull request does not have a clear purpose and benefits it will not be accepted. +If the pull request does not have a clear purpose and benefits, it will not be accepted. * **The pull request is documented** - The HDF5 developers must understand not only *what* a change is doing, but *how* it is doing it. - Documenting the code makes it easier for us to understand your patch and will help to maintaine the code in the future. + Documenting the code makes it easier for us to understand your patch and maintain the code in the future. * **The pull request passes HDF5 regression testing** - Any issue fixed or functionality added should be accompanied by the corresponding tests and pass HDF5 regression testing run by The HDF Group. We do not expect you to perform comprehensive testing across multiple platforms -before we accept the pull request. If the pull request does not pass regression testing after the merge, The HDF Group developers will i -work with you on the fixes. +before we accept the pull request. If the pull request does not pass regression testing after the merge, The HDF Group developers will work with you on the fixes. * **The pull request does not compromise the principles behind HDF5** - HDF5 has a 100% commitment to backward compatibility. * Any file ever created with HDF5 must be readable by any future version of HDF5. - If the purpose of your patch is to modify HDF5 data model or file format, + If your patch's purpose is to modify the HDF5 data model or file format, **please** discuss this with us first. File format changes and features required by those changes can be introduced only in a new major release. * HDF5 has a commitment to remaining *machine-independent*; data created on one platform/environment/architecture **must** remain readable by HDF5 on any other. - * For binary compatibility no changes are allowed to public APIs and data structures in the maintenance releases; new APIs can be added. + * For binary compatibility, no changes are allowed to public APIs and data structures in the maintenance releases; new APIs can be added. * **New features are documented** - Any new features should have proper documentation; talk to us if you have any questions. @@ -68,7 +67,7 @@ Please make sure that you check the items applicable to your pull request: * Code * [ ] Does the pull request have a corresponding GitHub issue and clear purpose? * [ ] Does the pull request follow HDF5 best practices (naming conventions, code portability, code structure, etc.)? <> - * [ ] If changes were done to autotools build were they added to CMake and vice versa? + * [ ] If changes were done to Autotools build, were they added to CMake and vice versa? * [ ] Is the pull request applicable to any other branches? If yes, which ones? Please document it in the GitHub issue. * [ ] Is the new code sufficiently documented for future maintenance? * [ ] Does the new feature require a change to an existing API? See "API Compatibility Macros" document (https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros) @@ -79,7 +78,7 @@ Please make sure that you check the items applicable to your pull request: * [ ] Was new functionality documented for the HDF5 community (the level of documentation depends on the feature; ask us what would be appropriate) * Testing * [ ] Does the pull request have tests? - * [ ] Does the pull request affect HDF5 library perfromance? + * [ ] Does the pull request affect HDF5 library performance? We want as many contributions as we can get, and we are here to help. Feel free to reach out to us if you have any questions -- cgit v0.12 From 99c0f504a27164d74b2c8e2d4d6afa597ba5ca7b Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 22 Mar 2021 15:28:06 -0500 Subject: Disable long double tests and remove CMake flag groups (#494) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- config/cmake/HDFCXXCompilerFlags.cmake | 140 +++++++---------------------- config/cmake/HDFCompilerFlags.cmake | 156 +++++++++++---------------------- release_docs/RELEASE.txt | 13 +++ tools/test/h5dump/CMakeTests.cmake | 4 +- tools/test/h5dump/testh5dump.sh.in | 4 +- 5 files changed, 99 insertions(+), 218 deletions(-) diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index 12dec20..757692c 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -91,8 +91,8 @@ if (NOT MSVC AND NOT MINGW) if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) - list (APPEND H5_CXXFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") - list (APPEND H5_CXXFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") + list (APPEND H5_CXXFLAGS "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + list (APPEND H5_CXXFLAGS "-Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED @@ -100,9 +100,9 @@ if (NOT MSVC AND NOT MINGW) # add the general CXX flags for g++ compiler versions 4.8 and above. ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") else () - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") endif () endif () elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") @@ -122,20 +122,20 @@ if (NOT MSVC AND NOT MINGW) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") # if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - # list (APPEND H5_CXXFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing") + # list (APPEND H5_CXXFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () else () if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () endif () @@ -144,41 +144,41 @@ if (NOT MSVC AND NOT MINGW) # we should approach them a bit cautiously... Only needed for gcc 4.X if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") endif () # Append more extra warning flags that only gcc 4.8+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") else () - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") endif () endif () # Append more extra warning flags that only gcc 4.9+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9") endif () # Append more extra warning flags that only gcc 5.1+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") else () - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-5") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-5") endif () endif () # Append more extra warning flags that only gcc 6.x+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () # Append more extra warning flags that only gcc 7.x+ know about @@ -187,34 +187,34 @@ if (NOT MSVC AND NOT MINGW) ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") if (HDF5_ENABLE_DEV_WARNINGS) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") #else () - # ADD_H5_FLAGS (H5_CXXFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") endif () endif () # Append more extra warning flags that only gcc 8.x+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") #if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - # ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") #else () - # ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") #endif () if (HDF5_ENABLE_DEV_WARNINGS) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") endif () endif () # Append more extra warning flags that only gcc 9.x+ know about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") endif () endif () else () @@ -232,97 +232,17 @@ if (HDF5_ENABLE_ALL_WARNINGS) if (HDF5_ENABLE_DEV_WARNINGS) if (CMAKE_CXX_COMPILER_LOADED) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall" "/wd4668") endif () else () if (CMAKE_CXX_COMPILER_LOADED) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3" "/wd4100" "/wd4706" "/wd4127") endif () endif () else () if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0} ${H5_CXXFLAGS1} ${H5_CXXFLAGS2} ${H5_CXXFLAGS3} ${H5_CXXFLAGS4}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPZERO_WARNINGS) - message (STATUS "....Group Zero warnings are enabled") - if (MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W1") - endif () - else () - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPONE_WARNINGS) - message (STATUS "....Group One warnings are enabled") - if (MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2") - endif () - else () - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS1}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPTWO_WARNINGS) - message (STATUS "....Group Two warnings are enabled") - if (MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") - endif () - else () - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS2}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPTHREE_WARNINGS) - message (STATUS "....Group Three warnings are enabled") - if (MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4") - endif () - else () - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS3}) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_GROUPFOUR_WARNINGS) - message (STATUS "....Group Four warnings are enabled") - if (NOT MSVC) - if (CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS4}) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS}) endif () endif () endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index bce906d..add40bb 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -15,6 +15,7 @@ set(CMAKE_C_STANDARD_REQUIRED TRUE) set (CMAKE_C_FLAGS "${CMAKE_C99_STANDARD_COMPILE_OPTION} ${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_SANITIZER_FLAGS} ${CMAKE_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Warnings Configuration: default: ${CMAKE_C_FLAGS} : ${CMAKE_CXX_FLAGS}") endif () @@ -111,34 +112,34 @@ if (NOT MSVC AND NOT MINGW) # warnings that are emitted. If you need it, add it at configure time. if (CMAKE_C_COMPILER_ID STREQUAL "Intel") ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") - list (APPEND H5_CFLAGS0 "-Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") - list (APPEND H5_CFLAGS0 "-Wreturn-type -Wstrict-prototypes -Wuninitialized") - list (APPEND H5_CFLAGS0 "-Wunknown-pragmas -Wunused-function -Wunused-variable") + list (APPEND H5_CFLAGS "-Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") + list (APPEND H5_CFLAGS "-Wreturn-type -Wstrict-prototypes -Wuninitialized") + list (APPEND H5_CFLAGS "-Wunknown-pragmas -Wunused-function -Wunused-variable") # this is just a failsafe - list (APPEND H5_CFLAGS0 "-finline-functions") + list (APPEND H5_CFLAGS "-finline-functions") if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) - list (APPEND H5_CFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") - list (APPEND H5_CFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") + list (APPEND H5_CFLAGS "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + list (APPEND H5_CFLAGS "-Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") # Add general CFlags for GCC versions 4.8 and above if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") else () - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-general") endif () endif () # gcc automatically inlines based on the optimization level # this is just a failsafe - list (APPEND H5_CFLAGS0 "-finline-functions") + list (APPEND H5_CFLAGS "-finline-functions") elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") else () - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/noerror-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/noerror-general") endif () elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform") @@ -156,17 +157,17 @@ if (NOT MSVC AND NOT MINGW) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - list (APPEND H5_CFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing") + list (APPEND H5_CFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () else () if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () endif () @@ -174,65 +175,79 @@ if (NOT MSVC AND NOT MINGW) # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... Only needed for gcc 4.X if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") endif () # Append more extra warning flags that only gcc 4.8+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") else () - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") endif () endif () # Append more extra warning flags that only gcc 4.9+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") endif () # Append more extra warning flags that only gcc 5.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") else () - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") endif () endif () # Append more extra warning flags that only gcc 6.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () # Append more extra warning flags that only gcc 7.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) - ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") #else () - # ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") + # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") endif () endif () # Append more extra warning flags that only gcc 8.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") endif () if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") endif () endif () # Append more extra warning flags that only gcc 9.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) - ADD_H5_FLAGS (H5_CFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + endif () + + # Append more extra warning flags that only gcc 9.3+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3") + endif () + + # Append more extra warning flags that only gcc 10.x+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0) + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10") + #else () + # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") + endif () endif () endif () endif () @@ -240,86 +255,19 @@ endif () #----------------------------------------------------------------------------- # Option to allow the user to enable all warnings #----------------------------------------------------------------------------- -option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) +option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" ON) if (HDF5_ENABLE_ALL_WARNINGS) message (STATUS "....All Warnings are enabled") if (MSVC) if (HDF5_ENABLE_DEV_WARNINGS) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/Wall /wd4668") + list (APPEND HDF5_CMAKE_C_FLAGS "/Wall" "/wd4668") else () string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W3") + list (APPEND HDF5_CMAKE_C_FLAGS "/W3" "/wd4100" "/wd4706" "/wd4127") endif () else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) -if (HDF5_ENABLE_GROUPZERO_WARNINGS) - message (STATUS "....Group Zero warnings are enabled") - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W1") - else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) -if (HDF5_ENABLE_GROUPONE_WARNINGS) - message (STATUS "....Group One warnings are enabled") - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W2") - else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) -if (HDF5_ENABLE_GROUPTWO_WARNINGS) - message (STATUS "....Group Two warnings are enabled") - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W3") - else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) -if (HDF5_ENABLE_GROUPTHREE_WARNINGS) - message (STATUS "....Group Three warnings are enabled") - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") - list (APPEND HDF5_CMAKE_C_FLAGS "/W4") - else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) -if (HDF5_ENABLE_GROUPFOUR_WARNINGS) - message (STATUS "....Group Four warnings are enabled") - if (NOT MSVC) - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4}) + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS}) endif () endif () diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 13331b1..848c712 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -888,6 +888,19 @@ Bug Fixes since HDF5-1.12.0 release Configuration ------------- + - Remove arbitrary warning flag groups from CMake builds + + The arbitrary groups were created to reduce the quantity of warnings being + reported that overwhelmed testing report systems. Considerable work has + been accomplished to reduce the warning count and these arbitrary groups + are no longer needed. + Also the default for all warnings, HDF5_ENABLE_ALL_WARNINGS, is now ON. + + Visual Studio warnings C4100, C4706, and C4127 have been moved to + developer warnings, HDF5_ENABLE_DEV_WARNINGS, and are disabled for normal builds. + + (ADB - 2021/03/22, HDFFV-11228) + - Reclassify CMake messages, to allow new modes and --log-level option CMake message commands have a mode argument. By default, STATUS mode diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 411e9ef..1e6ccb2 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -1093,8 +1093,8 @@ ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5) # test for long double (some systems do not have long double) - ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) - ADD_H5_TEST (tldouble_scalar 0 -p --enable-error-stack tldouble_scalar.h5) + #ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) + #ADD_H5_TEST (tldouble_scalar 0 -p --enable-error-stack tldouble_scalar.h5) # test for vms ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5) diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index c4e2fd4..e2776ab 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -1384,8 +1384,8 @@ TOOLTEST tgrpnullspace.ddl -p --enable-error-stack tgrpnullspace.h5 TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5 # test for long double (some systems do not have long double) -TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 -TOOLTEST tldouble_scalar.ddl -p --enable-error-stack tldouble_scalar.h5 +#TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 +#TOOLTEST tldouble_scalar.ddl -p --enable-error-stack tldouble_scalar.h5 # test for vms TOOLTEST tvms.ddl --enable-error-stack tvms.h5 -- cgit v0.12 From 69f3cde9365a1190f624586e7e9736b7b4df55f1 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 23 Mar 2021 04:19:53 -0700 Subject: Updates HSYS_GOTO_ERROR to emit GetLastError() values on Win32 (#492) * Committing clang-format changes * Updates H5SYS_GOTO_ERROR to emit Win32's GetLastError() * Committing clang-format changes * Format source changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- release_docs/RELEASE.txt | 28 +++++++++++++++++++++++++++- src/H5Eprivate.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 848c712..2af0273 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -384,6 +384,33 @@ New Features Library: -------- + - HSYS_GOTO_ERROR now emits the results of GetLastError() on Windows + + HSYS_GOTO_ERROR is an internal macro that is used to produce error + messages when system calls fail. These strings include errno and the + the associated strerror() value, which are not particularly useful + when a Win32 API call fails. + + On Windows, this macro has been updated to include the result of + GetLastError(). When a system call fails on Windows, usually only + one of errno and GetLastError() will be useful, however we emit both + for the user to parse. The Windows error message is not emitted as + it would be awkward to free the FormatMessage() buffer given the + existing HDF5 error framework. Users will have to look up the error + codes in MSDN. + + The format string on Windows has been changed from: + + "%s, errno = %d, error message = '%s'" + + to: + + "%s, errno = %d, error message = '%s', Win32 GetLastError() = %"PRIu32"" + + for those inclined to parse it for error values. + + (DER - 2021/03/21) + - File locking now works on Windows Since version 1.10.0, the HDF5 library has used a file locking scheme @@ -400,7 +427,6 @@ New Features (DER - 2021/03/19, HDFFV-10191) - - H5Epush_ret() now requires a trailing semicolon H5Epush_ret() is a function-like macro that has been changed to diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 58010a3..c3c440f 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -111,6 +111,7 @@ typedef struct H5E_t H5E_t; /* Retrieve the error code description string and push it onto the error * stack. */ +#ifndef H5_HAVE_WIN32_API #define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \ { \ int myerrno = errno; \ @@ -129,6 +130,35 @@ typedef struct H5E_t H5E_t; HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \ HDstrerror(myerrno)); \ } +#else /* H5_HAVE_WIN32_API */ +/* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a + * 32-bit unsigned type. Note that on Windows, either errno or GetLastError() (but probably not both) will + * be useful depending on whether a C/POSIX or Win32 call failed. The other value will likely be zero, + * though I wouldn't count on that. + */ +#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \ + { \ + int myerrno = errno; \ + DWORD win_error = GetLastError(); \ + /* Other projects may rely on the description format to get the errno and any changes should be \ + * considered as an API change \ + */ \ + HDONE_ERROR(majorcode, minorcode, retcode, \ + "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \ + myerrno, HDstrerror(myerrno), win_error); \ + } +#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \ + { \ + int myerrno = errno; \ + DWORD win_error = GetLastError(); \ + /* Other projects may rely on the description format to get the errno and any changes should be \ + * considered as an API change \ + */ \ + HGOTO_ERROR(majorcode, minorcode, retcode, \ + "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \ + myerrno, HDstrerror(myerrno), win_error); \ + } +#endif /* H5_HAVE_WIN32_API */ #ifdef H5_HAVE_PARALLEL /* -- cgit v0.12 From 1f3f7fe3aedf3d207d7bfa1b2870e87278378ad8 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 23 Mar 2021 19:13:57 -0700 Subject: Removes support for pre-2015 Visual Studio (#496) * Committing clang-format changes * Removes work-around code for pre-2015 Visual Studio HDF5 no longer provides an implementation for: * * snprintf and vsnprintf * llround(f), lround(f), round(f) * strtoll and strtoull * va_copy * struct timespec Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- release_docs/RELEASE.txt | 14 ++++++ src/H5system.c | 75 ------------------------------- src/H5win32defs.h | 112 +++-------------------------------------------- 3 files changed, 21 insertions(+), 180 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2af0273..8b6f488 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,20 @@ New Features Configuration: ------------- + - Removal of pre-VS2015 work-arounds + + HDF5 now requires Visual Studio 2015 or greater, so old work-around + code and definitions have been removed, including: + + * + * snprintf and vsnprintf + * llround, llroundf, lround, lroundf, round, roundf + * strtoll and strtoull + * va_copy + * struct timespec + + (DER - 2021/03/22) + - On macOS, Universal Binaries can now be built, allowing native execution on both Intel and Apple Silicon (ARM) based Macs. diff --git a/src/H5system.c b/src/H5system.c index 745476d..caf2fc3 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -581,32 +581,6 @@ Wgetlogin(void) return NULL; } -int -c99_snprintf(char *str, size_t size, const char *format, ...) -{ - int count; - va_list ap; - - HDva_start(ap, format); - count = c99_vsnprintf(str, size, format, ap); - HDva_end(ap); - - return count; -} - -int -c99_vsnprintf(char *str, size_t size, const char *format, va_list ap) -{ - int count = -1; - - if (size != 0) - count = _vsnprintf_s(str, size, _TRUNCATE, format, ap); - if (count == -1) - count = _vscprintf(format, ap); - - return count; -} - /*------------------------------------------------------------------------- * Function: Wflock * @@ -659,55 +633,6 @@ Wflock(int fd, int operation) } /* end Wflock() */ /*------------------------------------------------------------------------- - * Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf - * - * Purpose: Wrapper function for round functions for use with VS2012 - * and earlier. - * - * Return: The rounded value that was passed in. - * - * Programmer: Dana Robinson - * December 2016 - * - *------------------------------------------------------------------------- - */ -long long -Wllround(double arg) -{ - return (long long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5)); -} - -long long -Wllroundf(float arg) -{ - return (long long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); -} - -long -Wlround(double arg) -{ - return (long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5)); -} - -long -Wlroundf(float arg) -{ - return (long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); -} - -double -Wround(double arg) -{ - return arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5); -} - -float -Wroundf(float arg) -{ - return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); -} - -/*------------------------------------------------------------------------- * Function: H5_get_utf16_str * * Purpose: Gets a UTF-16 string from an UTF-8 (or ASCII) string. diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 9cd0afb..88911b0 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -11,66 +11,18 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Scott Wegner - * June 3, 2008 - * - * Purpose: This file is used to map HDF macros to Windows functions. This +/* Purpose: This file is used to map HDF macros to Windows functions. This * should get included H5private mappings, so as to override them. * Any macro not mapped here, however, will receive a similar mapping * inside H5private.h * */ -#ifndef H5_HAVE_INTTYPES_H -/* The following definitions should be suitable for 64-bit Windows, which is - * LLP64, and for 32-bit Windows, which is ILP32. Those are the only - * platforms where is likely to be missing. VS2015 and later - * *may* provide these definitions. - */ -#ifdef _WIN64 -#define PRIdPTR "lld" -#define PRIoPTR "llo" -#define PRIuPTR "llu" -#define PRIxPTR "llx" -#define PRIXPTR "llX" -#else /* _WIN64 */ -#define PRIdPTR "ld" -#define PRIoPTR "lo" -#define PRIuPTR "lu" -#define PRIxPTR "lx" -#define PRIXPTR "lX" -#endif /* _WIN64 */ - -#define PRId8 "d" -#define PRIo8 "o" -#define PRIu8 "u" -#define PRIx8 "x" -#define PRIX8 "X" -#define PRId16 "d" -#define PRIo16 "o" -#define PRIu16 "u" -#define PRIx16 "x" -#define PRIX16 "X" -#define PRId32 "d" -#define PRIo32 "o" -#define PRIu32 "u" -#define PRIx32 "x" -#define PRIX32 "X" -#define PRId64 "lld" -#define PRIo64 "llo" -#define PRIu64 "llu" -#define PRIx64 "llx" -#define PRIX64 "llX" -#define PRIdMAX "lld" -#define PRIoMAX "llo" -#define PRIuMAX "llu" -#define PRIxMAX "llx" -#define PRIXMAX "llX" -#endif -/* - * _MSC_VER = 1900 VS2015 - * _MSC_VER = 1800 VS2013 - * _MSC_VER = 1700 VS2012 +/* _MSC_VER = 192x VS2019 + * _MSC_VER = 191x VS2017 + * _MSC_VER = 1900 VS2015 + * _MSC_VER = 1800 VS2013 + * _MSC_VER = 1700 VS2012 */ #ifdef H5_HAVE_WIN32_API @@ -119,22 +71,8 @@ typedef __int64 h5_stat_size_t; #ifdef H5_HAVE_VISUAL_STUDIO -#if (_MSC_VER < 1800) -#ifndef H5_HAVE_STRTOLL -#define HDstrtoll(S, R, N) _strtoi64(S, R, N) -#endif /* H5_HAVE_STRTOLL */ -#ifndef H5_HAVE_STRTOULL -#define HDstrtoull(S, R, N) _strtoui64(S, R, N) -#endif /* H5_HAVE_STRTOULL */ -/* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are - * just pointers into the stack in those CRTs, the usual work-around - * is to just define the operation as a pointer copy. - */ -#define HDva_copy(D, S) ((D) = (S)) -#endif /* MSC_VER < 1800 */ - /* - * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO + * The (void*) cast just avoids a compiler warning in MSVC */ #define HDmemset(X, C, Z) memset((void *)(X), C, Z) @@ -143,26 +81,6 @@ struct timezone { int tz_dsttime; }; -/* time.h before VS2015 does not include timespec */ -#if (_MSC_VER < 1900) -struct timespec { - time_t tv_sec; /* Seconds - >= 0 */ - long tv_nsec; /* Nanoseconds - [0, 999999999] */ -}; -#endif /* MSC_VER < 1900 */ - -#if (_MSC_VER <= 1700) -/* The isnan function needs underscore in VS2012 and earlier */ -#define HDisnan(X) _isnan(X) -/* The round functions do not exist in VS2012 and earlier */ -#define HDllround(V) Wllround(V) -#define HDllroundf(V) Wllroundf(V) -#define HDlround(V) Wlround(V) -#define HDlroundf(V) Wlroundf(V) -#define HDround(V) Wround(V) -#define HDroundf(V) Wroundf(V) -#endif /* MSC_VER < 1700 */ - #endif /* H5_HAVE_VISUAL_STUDIO */ #ifdef __cplusplus @@ -172,25 +90,11 @@ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); H5_DLL int Wsetenv(const char *name, const char *value, int overwrite); H5_DLL int Wflock(int fd, int operation); H5_DLL char * Wgetlogin(void); -H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...); -H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); H5_DLL wchar_t *H5_get_utf16_str(const char *s); H5_DLL int Wopen_utf8(const char *path, int oflag, ...); H5_DLL int Wremove_utf8(const char *path); H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); - -/* Round functions only needed for VS2012 and earlier. - * They are always built to ensure they don't go stale and - * can be deleted (along with their #defines, above) when we - * drop VS2012 support. - */ -H5_DLL long long Wllround(double arg); -H5_DLL long long Wllroundf(float arg); -H5_DLL long Wlround(double arg); -H5_DLL long Wlroundf(float arg); -H5_DLL double Wround(double arg); -H5_DLL float Wroundf(float arg); #ifdef __cplusplus } #endif /* __cplusplus */ @@ -199,8 +103,6 @@ H5_DLL float Wroundf(float arg); #define HDsetenv(N, V, O) Wsetenv(N, V, O) #define HDflock(F, L) Wflock(F, L) #define HDgetlogin() Wgetlogin() -#define HDsnprintf c99_snprintf /*varargs*/ -#define HDvsnprintf c99_vsnprintf /*varargs*/ /* Non-POSIX functions */ -- cgit v0.12 From 695a4e4f656c91e380eb34aaf8daabc897267a65 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 23 Mar 2021 21:46:19 -0500 Subject: Update h5LT files with latest flex and Bison available on jelly (#502) * Modify temporary rpath for testing in java example scripts. * Update URL in source file Copyright headers for web copy of COPYING (license) file. * Add release_docs/code-conventions.md file. * Add script to test h5py. * Fix script error. * Add file h5pytest.yml. * Test declaration of counter variables in for loops. * Committing clang-format changes * Committing clang-format changes * Added [] to line 126 of H5LTanalyze.l. Ran bin/genparser with flex v2.6.4 and Bison v3.0.4 on jelly. * Revert "Added [] to line 126 of H5LTanalyze.l." This reverts commit e4a9cee441efa75b16a8ee030c86189e186dd266. * Revert extra commits to match canonical develop. * Added [] to H5LTanalyze.l line 126 to eliminate warning "rule could not be matched". Ran bin/genparser hl/src with flex v2.6.4 and Bison v3.0.4 on jelly. * Added HD to strdup in H5LTparse.y line 338. Ran bin/genparser hlsrc again. * Removed line 126 from H5LTanalyze.l - previous line matches. Added previously removed line 318 of H5LTparse.y to fix hl_test_lite failure. Ran bin/genparser. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- hl/src/H5LTanalyze.c | 1374 +++++++++++++++++++++++++++++--------------------- hl/src/H5LTanalyze.l | 1 - hl/src/H5LTparse.c | 1263 ++++++++++++++++++++-------------------------- hl/src/H5LTparse.h | 165 +++--- hl/src/H5LTparse.y | 2 +- 5 files changed, 1436 insertions(+), 1369 deletions(-) diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 1f23d3b..65da9d0 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -28,9 +28,9 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -#line 2 "hl/src//H5LTanalyze.c" +#line 1 "hl/src/H5LTanalyze.c" -#line 4 "hl/src//H5LTanalyze.c" +#line 3 "hl/src/H5LTanalyze.c" #define YY_INT_ALIGNED short int @@ -38,11 +38,17 @@ #define yy_create_buffer H5LTyy_create_buffer #define yy_delete_buffer H5LTyy_delete_buffer -#define yy_flex_debug H5LTyy_flex_debug +#define yy_scan_buffer H5LTyy_scan_buffer +#define yy_scan_string H5LTyy_scan_string +#define yy_scan_bytes H5LTyy_scan_bytes #define yy_init_buffer H5LTyy_init_buffer #define yy_flush_buffer H5LTyy_flush_buffer #define yy_load_buffer_state H5LTyy_load_buffer_state #define yy_switch_to_buffer H5LTyy_switch_to_buffer +#define yypush_buffer_state H5LTyypush_buffer_state +#define yypop_buffer_state H5LTyypop_buffer_state +#define yyensure_buffer_stack H5LTyyensure_buffer_stack +#define yy_flex_debug H5LTyy_flex_debug #define yyin H5LTyyin #define yyleng H5LTyyleng #define yylex H5LTyylex @@ -57,12 +63,246 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define H5LTyy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer H5LTyy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define H5LTyy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer H5LTyy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define H5LTyy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer H5LTyy_scan_buffer +#endif + +#ifdef yy_scan_string +#define H5LTyy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string H5LTyy_scan_string +#endif + +#ifdef yy_scan_bytes +#define H5LTyy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes H5LTyy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define H5LTyy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer H5LTyy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define H5LTyy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer H5LTyy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define H5LTyy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state H5LTyy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define H5LTyy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer H5LTyy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define H5LTyypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state H5LTyypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define H5LTyypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state H5LTyypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define H5LTyyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack H5LTyyensure_buffer_stack +#endif + +#ifdef yylex +#define H5LTyylex_ALREADY_DEFINED +#else +#define yylex H5LTyylex +#endif + +#ifdef yyrestart +#define H5LTyyrestart_ALREADY_DEFINED +#else +#define yyrestart H5LTyyrestart +#endif + +#ifdef yylex_init +#define H5LTyylex_init_ALREADY_DEFINED +#else +#define yylex_init H5LTyylex_init +#endif + +#ifdef yylex_init_extra +#define H5LTyylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra H5LTyylex_init_extra +#endif + +#ifdef yylex_destroy +#define H5LTyylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy H5LTyylex_destroy +#endif + +#ifdef yyget_debug +#define H5LTyyget_debug_ALREADY_DEFINED +#else +#define yyget_debug H5LTyyget_debug +#endif + +#ifdef yyset_debug +#define H5LTyyset_debug_ALREADY_DEFINED +#else +#define yyset_debug H5LTyyset_debug +#endif + +#ifdef yyget_extra +#define H5LTyyget_extra_ALREADY_DEFINED +#else +#define yyget_extra H5LTyyget_extra +#endif + +#ifdef yyset_extra +#define H5LTyyset_extra_ALREADY_DEFINED +#else +#define yyset_extra H5LTyyset_extra +#endif + +#ifdef yyget_in +#define H5LTyyget_in_ALREADY_DEFINED +#else +#define yyget_in H5LTyyget_in +#endif + +#ifdef yyset_in +#define H5LTyyset_in_ALREADY_DEFINED +#else +#define yyset_in H5LTyyset_in +#endif + +#ifdef yyget_out +#define H5LTyyget_out_ALREADY_DEFINED +#else +#define yyget_out H5LTyyget_out +#endif + +#ifdef yyset_out +#define H5LTyyset_out_ALREADY_DEFINED +#else +#define yyset_out H5LTyyset_out +#endif + +#ifdef yyget_leng +#define H5LTyyget_leng_ALREADY_DEFINED +#else +#define yyget_leng H5LTyyget_leng +#endif + +#ifdef yyget_text +#define H5LTyyget_text_ALREADY_DEFINED +#else +#define yyget_text H5LTyyget_text +#endif + +#ifdef yyget_lineno +#define H5LTyyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno H5LTyyget_lineno +#endif + +#ifdef yyset_lineno +#define H5LTyyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno H5LTyyset_lineno +#endif + +#ifdef yywrap +#define H5LTyywrap_ALREADY_DEFINED +#else +#define yywrap H5LTyywrap +#endif + +#ifdef yyalloc +#define H5LTyyalloc_ALREADY_DEFINED +#else +#define yyalloc H5LTyyalloc +#endif + +#ifdef yyrealloc +#define H5LTyyrealloc_ALREADY_DEFINED +#else +#define yyrealloc H5LTyyrealloc +#endif + +#ifdef yyfree +#define H5LTyyfree_ALREADY_DEFINED +#else +#define yyfree H5LTyyfree +#endif + +#ifdef yytext +#define H5LTyytext_ALREADY_DEFINED +#else +#define yytext H5LTyytext +#endif + +#ifdef yyleng +#define H5LTyyleng_ALREADY_DEFINED +#else +#define yyleng H5LTyyleng +#endif + +#ifdef yyin +#define H5LTyyin_ALREADY_DEFINED +#else +#define yyin H5LTyyin +#endif + +#ifdef yyout +#define H5LTyyout_ALREADY_DEFINED +#else +#define yyout H5LTyyout +#endif + +#ifdef yy_flex_debug +#define H5LTyy_flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug H5LTyy_flex_debug +#endif + +#ifdef yylineno +#define H5LTyylineno_ALREADY_DEFINED +#else +#define yylineno H5LTyylineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -133,65 +373,61 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST +/* begin standard C++ headers. */ -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE H5LTyyrestart(H5LTyyin ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -208,30 +444,30 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t H5LTyyleng; +extern int yyleng; -extern FILE *H5LTyyin, *H5LTyyout; +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up H5LTyytext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up H5LTyytext again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -246,12 +482,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -274,7 +510,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -291,8 +527,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via H5LTyyrestart()), so that the user can continue scanning by - * just pointing H5LTyyin at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -302,7 +538,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -313,105 +549,100 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when H5LTyytext is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t H5LTyyleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow H5LTyywrap()'s to do buffer switches - * instead of setting up a fresh H5LTyyin. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void H5LTyyrestart (FILE *input_file ); -void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE H5LTyy_create_buffer (FILE *file,int size ); -void H5LTyy_delete_buffer (YY_BUFFER_STATE b ); -void H5LTyy_flush_buffer (YY_BUFFER_STATE b ); -void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void H5LTyypop_buffer_state (void ); - -static void H5LTyyensure_buffer_stack (void ); -static void H5LTyy_load_buffer_state (void ); -static void H5LTyy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -#define YY_FLUSH_BUFFER H5LTyy_flush_buffer(YY_CURRENT_BUFFER ) +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -YY_BUFFER_STATE H5LTyy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE H5LTyy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -void *H5LTyyalloc (yy_size_t ); -void *H5LTyyrealloc (void *,yy_size_t ); -void H5LTyyfree (void * ); - -#define yy_new_buffer H5LTyy_create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - H5LTyyensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - H5LTyyensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *H5LTyyin = (FILE *) 0, *H5LTyyout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int H5LTyylineno; - -int H5LTyylineno = 1; +extern int yylineno; +int yylineno = 1; -extern char *H5LTyytext; -#define yytext_ptr H5LTyytext +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up H5LTyytext. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - H5LTyyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 65 -#define YY_END_OF_BUFFER 66 +#define YY_NUM_RULES 64 +#define YY_END_OF_BUFFER 65 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -419,56 +650,56 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[276] = +static const flex_int16_t yy_accept[275] = { 0, - 63, 63, 66, 65, 63, 63, 65, 55, 61, 62, - 65, 65, 65, 65, 59, 60, 57, 58, 63, 0, - 55, 0, 0, 0, 0, 0, 56, 0, 0, 0, - 0, 0, 38, 0, 0, 0, 0, 0, 39, 0, + 63, 63, 65, 64, 63, 64, 55, 61, 62, 64, + 64, 64, 64, 59, 60, 57, 58, 63, 0, 55, + 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, + 0, 38, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, + 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 54, 36, 0, 0, 0, 45, 49, 0, - 0, 0, 0, 0, 0, 0, 0, 51, 53, 50, + 0, 54, 36, 0, 0, 0, 45, 49, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 53, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, - 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, + 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 0, 0, 0, 0, 0, 0, 9, 10, - 0, 0, 47, 0, 44, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 2, 0, 0, 0, 0, 0, 0, 9, 10, 0, + 0, 47, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3, 4, 5, 6, 7, 8, 11, - 12, 13, 14, 15, 16, 0, 0, 0, 43, 46, - 28, 29, 30, 31, 0, 0, 0, 22, 0, 0, + 0, 0, 3, 4, 5, 6, 7, 8, 11, 12, + 13, 14, 15, 16, 0, 0, 0, 43, 46, 28, + 29, 30, 31, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 0, 0, 0, 0, 24, 0, 0, 0, - 23, 0, 0, 0, 41, 0, 0, 0, 32, 0, - 26, 18, 20, 19, 0, 25, 0, 40, 42, 33, - 0, 27, 21, 34, 0 + 17, 0, 0, 0, 0, 24, 0, 0, 0, 23, + 0, 0, 0, 41, 0, 0, 0, 32, 0, 26, + 18, 20, 19, 0, 25, 0, 40, 42, 33, 0, + 27, 21, 34, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, - 8, 9, 10, 11, 5, 12, 5, 13, 14, 1, - 1, 1, 1, 1, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 1, 1, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 1, 1, 35, 36, - 37, 1, 38, 1, 39, 1, 1, 1, 1, 1, + 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 4, 5, 6, + 7, 8, 9, 10, 4, 11, 4, 12, 13, 1, + 1, 1, 1, 1, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 1, 1, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 1, 1, 34, 35, + 36, 1, 37, 1, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 40, 1, 41, 1, 1, 1, 1, 1, + 1, 1, 39, 1, 40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -485,172 +716,169 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[42] = +static const YY_CHAR yy_meta[41] = { 0, - 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, - 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[278] = +static const flex_int16_t yy_base[277] = { 0, - 0, 0, 304, 305, 40, 42, 0, 0, 305, 305, - 15, 293, 274, 269, 305, 305, 305, 305, 46, 296, - 0, 280, 263, 265, 267, 265, 305, 262, 265, 253, - 252, 22, 305, 271, 39, 20, 274, 265, 305, 257, - 30, 260, 258, 265, 268, 254, 249, 40, 257, 264, - 260, 241, 246, 250, 255, 242, 239, 241, 251, 237, - 253, 42, 237, 247, 229, 243, 305, 244, 247, 233, - 228, 253, 233, 225, 237, 232, 225, 214, 40, 229, - 225, 231, 305, 305, 214, 221, 208, 305, 305, 216, - 206, 210, 210, 44, 216, 45, 226, 305, 305, 305, - - 207, 53, 224, 218, 218, 217, 72, 79, 214, 201, - 205, 216, 205, 199, 197, 202, 81, 188, 305, 215, - 218, 215, 58, 212, 215, 212, 72, 305, 196, 204, - 194, 199, 199, 195, 175, 206, 203, 80, 77, 78, - 83, 192, 191, 90, 92, 93, 190, 189, 183, 189, - 186, 305, 181, 191, 171, 94, 96, 179, 173, 175, - 172, 97, 105, 102, 178, 177, 176, 175, 174, 173, - 305, 305, 172, 171, 170, 169, 168, 167, 305, 305, - 100, 166, 305, 161, 305, 177, 163, 162, 161, 160, - 163, 144, 149, 143, 147, 146, 146, 149, 143, 147, - - 142, 107, 145, 305, 305, 305, 305, 305, 305, 305, - 305, 305, 305, 305, 305, 151, 146, 136, 305, 305, - 305, 305, 305, 305, 133, 146, 146, 305, 127, 133, - 137, 142, 126, 140, 122, 126, 126, 124, 132, 119, - 133, 305, 123, 114, 129, 123, 305, 113, 110, 111, - 305, 114, 118, 108, 305, 111, 112, 110, 305, 99, - 305, 305, 305, 305, 84, 305, 63, 305, 305, 305, - 62, 305, 305, 305, 305, 134, 72 + 0, 0, 299, 300, 296, 0, 0, 300, 300, 11, + 288, 269, 264, 300, 300, 300, 300, 292, 290, 0, + 274, 257, 259, 261, 259, 300, 256, 259, 247, 246, + 16, 300, 265, 33, 14, 268, 259, 300, 251, 24, + 254, 252, 259, 262, 248, 243, 34, 251, 258, 254, + 235, 240, 244, 249, 236, 233, 235, 245, 231, 247, + 36, 231, 241, 223, 237, 300, 238, 241, 227, 222, + 247, 227, 219, 231, 226, 219, 208, 34, 223, 219, + 225, 300, 300, 208, 215, 202, 300, 300, 210, 200, + 204, 204, 38, 210, 39, 220, 300, 300, 300, 201, + + 47, 218, 212, 212, 211, 66, 73, 208, 195, 199, + 210, 199, 193, 191, 196, 75, 182, 300, 209, 212, + 209, 52, 206, 209, 206, 66, 300, 190, 198, 188, + 193, 193, 189, 169, 200, 197, 74, 71, 72, 77, + 186, 185, 84, 86, 87, 184, 183, 177, 183, 180, + 300, 175, 185, 165, 88, 90, 173, 167, 169, 166, + 91, 99, 96, 172, 171, 170, 169, 168, 167, 300, + 300, 166, 165, 164, 163, 162, 161, 300, 300, 94, + 160, 300, 155, 300, 171, 157, 156, 155, 154, 157, + 138, 143, 137, 141, 140, 140, 143, 137, 141, 136, + + 101, 139, 300, 300, 300, 300, 300, 300, 300, 300, + 300, 300, 300, 300, 145, 140, 130, 300, 300, 300, + 300, 300, 300, 127, 140, 140, 300, 121, 127, 131, + 136, 120, 134, 116, 120, 120, 118, 126, 113, 127, + 300, 117, 108, 123, 117, 300, 107, 104, 105, 300, + 108, 112, 102, 300, 105, 106, 104, 300, 93, 300, + 300, 300, 300, 78, 300, 57, 300, 300, 300, 56, + 300, 300, 300, 300, 127, 65 } ; -static yyconst flex_int16_t yy_def[278] = +static const flex_int16_t yy_def[277] = { 0, - 275, 1, 275, 275, 275, 275, 276, 277, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 276, - 277, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 0, 275, 275 + 274, 1, 274, 274, 274, 275, 276, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 275, 276, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 0, 274, 274 } ; -static yyconst flex_int16_t yy_nxt[347] = +static const flex_int16_t yy_nxt[341] = { 0, - 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, - 8, 8, 9, 10, 4, 4, 11, 4, 4, 4, - 4, 12, 4, 4, 4, 4, 13, 4, 4, 4, - 14, 4, 4, 4, 4, 4, 15, 16, 4, 17, - 18, 19, 19, 19, 19, 22, 23, 19, 19, 37, - 49, 50, 38, 40, 63, 41, 54, 42, 43, 78, - 55, 44, 95, 64, 45, 46, 107, 114, 56, 47, - 110, 79, 48, 142, 21, 111, 108, 120, 96, 121, - 274, 143, 122, 123, 124, 115, 125, 147, 136, 126, - 127, 137, 165, 167, 273, 148, 158, 159, 169, 160, - - 166, 168, 161, 162, 272, 173, 170, 175, 177, 187, - 163, 189, 164, 174, 195, 176, 178, 188, 200, 190, - 196, 198, 271, 197, 201, 202, 199, 216, 270, 269, - 236, 217, 203, 237, 20, 268, 20, 267, 266, 265, - 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, - 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, - 244, 243, 242, 241, 240, 239, 238, 235, 234, 233, - 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, - 222, 221, 220, 219, 218, 215, 214, 213, 212, 211, - 210, 209, 208, 207, 206, 205, 204, 194, 193, 192, - - 191, 186, 185, 184, 183, 182, 181, 180, 179, 172, - 171, 157, 156, 155, 154, 153, 152, 151, 150, 149, - 146, 145, 144, 141, 140, 139, 138, 135, 134, 133, - 132, 131, 130, 129, 128, 119, 118, 117, 116, 113, - 112, 109, 106, 105, 104, 103, 102, 101, 100, 99, - 98, 97, 94, 93, 92, 91, 90, 89, 88, 87, - 86, 85, 84, 83, 82, 81, 80, 77, 76, 75, - 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, - 62, 61, 60, 59, 58, 57, 53, 52, 51, 39, - 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, - - 26, 25, 24, 275, 3, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275 + 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, + 7, 8, 9, 4, 4, 10, 4, 4, 4, 4, + 11, 4, 4, 4, 4, 12, 4, 4, 4, 13, + 4, 4, 4, 4, 4, 14, 15, 4, 16, 17, + 21, 22, 36, 48, 49, 37, 39, 62, 40, 53, + 41, 42, 77, 54, 43, 94, 63, 44, 45, 106, + 113, 55, 46, 109, 78, 47, 141, 20, 110, 107, + 119, 95, 120, 273, 142, 121, 122, 123, 114, 124, + 146, 135, 125, 126, 136, 164, 166, 272, 147, 157, + 158, 168, 159, 165, 167, 160, 161, 271, 172, 169, + + 174, 176, 186, 162, 188, 163, 173, 194, 175, 177, + 187, 199, 189, 195, 197, 270, 196, 200, 201, 198, + 215, 269, 268, 235, 216, 202, 236, 19, 267, 19, + 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, + 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, + 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, + 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, + 224, 223, 222, 221, 220, 219, 218, 217, 214, 213, + 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, + 193, 192, 191, 190, 185, 184, 183, 182, 181, 180, + + 179, 178, 171, 170, 156, 155, 154, 153, 152, 151, + 150, 149, 148, 145, 144, 143, 140, 139, 138, 137, + 134, 133, 132, 131, 130, 129, 128, 127, 118, 117, + 116, 115, 112, 111, 108, 105, 104, 103, 102, 101, + 100, 99, 98, 97, 96, 93, 92, 91, 90, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, + 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, + 66, 65, 64, 61, 60, 59, 58, 57, 56, 52, + 51, 50, 38, 35, 34, 33, 32, 31, 30, 29, + 28, 27, 26, 18, 25, 24, 23, 18, 274, 3, + + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274 } ; -static yyconst flex_int16_t yy_chk[347] = +static const flex_int16_t yy_chk[341] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 5, 5, 6, 6, 11, 11, 19, 19, 32, - 36, 36, 32, 35, 48, 35, 41, 35, 35, 62, - 41, 35, 79, 48, 35, 35, 94, 102, 41, 35, - 96, 62, 35, 123, 277, 96, 94, 107, 79, 107, - 271, 123, 107, 107, 108, 102, 108, 127, 117, 108, - 108, 117, 139, 140, 267, 127, 138, 138, 141, 138, - - 139, 140, 138, 138, 265, 144, 141, 145, 146, 156, - 138, 157, 138, 144, 162, 145, 146, 156, 164, 157, - 162, 163, 260, 162, 164, 164, 163, 181, 258, 257, - 202, 181, 164, 202, 276, 256, 276, 254, 253, 252, - 250, 249, 248, 246, 245, 244, 243, 241, 240, 239, - 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, - 227, 226, 225, 218, 217, 216, 203, 201, 200, 199, - 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, - 188, 187, 186, 184, 182, 178, 177, 176, 175, 174, - 173, 170, 169, 168, 167, 166, 165, 161, 160, 159, - - 158, 155, 154, 153, 151, 150, 149, 148, 147, 143, - 142, 137, 136, 135, 134, 133, 132, 131, 130, 129, - 126, 125, 124, 122, 121, 120, 118, 116, 115, 114, - 113, 112, 111, 110, 109, 106, 105, 104, 103, 101, - 97, 95, 93, 92, 91, 90, 87, 86, 85, 82, - 81, 80, 78, 77, 76, 75, 74, 73, 72, 71, - 70, 69, 68, 66, 65, 64, 63, 61, 60, 59, - 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, - 47, 46, 45, 44, 43, 42, 40, 38, 37, 34, - 31, 30, 29, 28, 26, 25, 24, 23, 22, 20, - - 14, 13, 12, 3, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275 + 10, 10, 31, 35, 35, 31, 34, 47, 34, 40, + 34, 34, 61, 40, 34, 78, 47, 34, 34, 93, + 101, 40, 34, 95, 61, 34, 122, 276, 95, 93, + 106, 78, 106, 270, 122, 106, 106, 107, 101, 107, + 126, 116, 107, 107, 116, 138, 139, 266, 126, 137, + 137, 140, 137, 138, 139, 137, 137, 264, 143, 140, + + 144, 145, 155, 137, 156, 137, 143, 161, 144, 145, + 155, 163, 156, 161, 162, 259, 161, 163, 163, 162, + 180, 257, 256, 201, 180, 163, 201, 275, 255, 275, + 253, 252, 251, 249, 248, 247, 245, 244, 243, 242, + 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, + 230, 229, 228, 226, 225, 224, 217, 216, 215, 202, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, + 190, 189, 188, 187, 186, 185, 183, 181, 177, 176, + 175, 174, 173, 172, 169, 168, 167, 166, 165, 164, + 160, 159, 158, 157, 154, 153, 152, 150, 149, 148, + + 147, 146, 142, 141, 136, 135, 134, 133, 132, 131, + 130, 129, 128, 125, 124, 123, 121, 120, 119, 117, + 115, 114, 113, 112, 111, 110, 109, 108, 105, 104, + 103, 102, 100, 96, 94, 92, 91, 90, 89, 86, + 85, 84, 81, 80, 79, 77, 76, 75, 74, 73, + 72, 71, 70, 69, 68, 67, 65, 64, 63, 62, + 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, + 50, 49, 48, 46, 45, 44, 43, 42, 41, 39, + 37, 36, 33, 30, 29, 28, 27, 25, 24, 23, + 22, 21, 19, 18, 13, 12, 11, 5, 3, 274, + + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int H5LTyy_flex_debug; -int H5LTyy_flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -659,8 +887,8 @@ int H5LTyy_flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *H5LTyytext; -#line 1 "hl/src//H5LTanalyze.l" +char *yytext; +#line 1 "hl/src/H5LTanalyze.l" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -678,7 +906,7 @@ char *H5LTyytext; * If you make any changes to H5LTanalyze.l, please run bin/genparser to * recreate the output files. */ -#line 21 "hl/src//H5LTanalyze.l" +#line 21 "hl/src/H5LTanalyze.l" #include #include #include @@ -702,7 +930,8 @@ int my_yyinput(char *, int); extern char *myinput; extern size_t input_len; -#line 676 "hl/src//H5LTanalyze.c" +#line 903 "hl/src/H5LTanalyze.c" +#line 904 "hl/src/H5LTanalyze.c" #define INITIAL 0 @@ -710,36 +939,36 @@ extern size_t input_len; #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int H5LTyylex_destroy (void ); +int yylex_destroy ( void ); -int H5LTyyget_debug (void ); +int yyget_debug ( void ); -void H5LTyyset_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE H5LTyyget_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void H5LTyyset_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *H5LTyyget_in (void ); +FILE *yyget_in ( void ); -void H5LTyyset_in (FILE * in_str ); +void yyset_in ( FILE * _in_str ); -FILE *H5LTyyget_out (void ); +FILE *yyget_out ( void ); -void H5LTyyset_out (FILE * out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t H5LTyyget_leng (void ); + int yyget_leng ( void ); -char *H5LTyyget_text (void ); +char *yyget_text ( void ); -int H5LTyyget_lineno (void ); +int yyget_lineno ( void ); -void H5LTyyset_lineno (int line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -747,35 +976,43 @@ void H5LTyyset_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int H5LTyywrap (void ); +extern "C" int yywrap ( void ); #else -extern int H5LTyywrap (void ); +extern int yywrap ( void ); #endif #endif - static void yyunput (int c,char *buf_ptr ); +#ifndef YY_NO_UNPUT + static void yyunput ( int c, char *buf_ptr ); + +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -783,7 +1020,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -794,20 +1031,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( H5LTyyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( H5LTyyin ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, H5LTyyin))==0 && ferror(H5LTyyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -815,7 +1052,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(H5LTyyin); \ + clearerr(yyin); \ } \ }\ \ @@ -848,12 +1085,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int H5LTyylex (void); +extern int yylex (void); -#define YY_DECL int H5LTyylex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after H5LTyytext and H5LTyyleng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -862,7 +1099,7 @@ extern int H5LTyylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -872,15 +1109,10 @@ extern int H5LTyylex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 46 "hl/src//H5LTanalyze.l" - - -#line 853 "hl/src//H5LTanalyze.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -892,26 +1124,32 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! H5LTyyin ) - H5LTyyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! H5LTyyout ) - H5LTyyout = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 46 "hl/src/H5LTanalyze.l" + + +#line 1116 "hl/src/H5LTanalyze.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of H5LTyytext. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -923,7 +1161,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -932,13 +1170,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 276 ) - yy_c = yy_meta[(unsigned int) yy_c]; + if ( yy_current_state >= 275 ) + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 305 ); + while ( yy_base[yy_current_state] != 300 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -964,339 +1202,333 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 48 "hl/src//H5LTanalyze.l" +#line 48 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8BE_TOKEN);} YY_BREAK case 2: YY_RULE_SETUP -#line 49 "hl/src//H5LTanalyze.l" +#line 49 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8LE_TOKEN);} YY_BREAK case 3: YY_RULE_SETUP -#line 50 "hl/src//H5LTanalyze.l" +#line 50 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16BE_TOKEN);} YY_BREAK case 4: YY_RULE_SETUP -#line 51 "hl/src//H5LTanalyze.l" +#line 51 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16LE_TOKEN);} YY_BREAK case 5: YY_RULE_SETUP -#line 52 "hl/src//H5LTanalyze.l" +#line 52 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32BE_TOKEN);} YY_BREAK case 6: YY_RULE_SETUP -#line 53 "hl/src//H5LTanalyze.l" +#line 53 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32LE_TOKEN);} YY_BREAK case 7: YY_RULE_SETUP -#line 54 "hl/src//H5LTanalyze.l" +#line 54 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64BE_TOKEN);} YY_BREAK case 8: YY_RULE_SETUP -#line 55 "hl/src//H5LTanalyze.l" +#line 55 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64LE_TOKEN);} YY_BREAK case 9: YY_RULE_SETUP -#line 57 "hl/src//H5LTanalyze.l" +#line 57 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8BE_TOKEN);} YY_BREAK case 10: YY_RULE_SETUP -#line 58 "hl/src//H5LTanalyze.l" +#line 58 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8LE_TOKEN);} YY_BREAK case 11: YY_RULE_SETUP -#line 59 "hl/src//H5LTanalyze.l" +#line 59 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16BE_TOKEN);} YY_BREAK case 12: YY_RULE_SETUP -#line 60 "hl/src//H5LTanalyze.l" +#line 60 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16LE_TOKEN);} YY_BREAK case 13: YY_RULE_SETUP -#line 61 "hl/src//H5LTanalyze.l" +#line 61 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32BE_TOKEN);} YY_BREAK case 14: YY_RULE_SETUP -#line 62 "hl/src//H5LTanalyze.l" +#line 62 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32LE_TOKEN);} YY_BREAK case 15: YY_RULE_SETUP -#line 63 "hl/src//H5LTanalyze.l" +#line 63 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64BE_TOKEN);} YY_BREAK case 16: YY_RULE_SETUP -#line 64 "hl/src//H5LTanalyze.l" +#line 64 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64LE_TOKEN);} YY_BREAK case 17: YY_RULE_SETUP -#line 66 "hl/src//H5LTanalyze.l" +#line 66 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_CHAR_TOKEN);} YY_BREAK case 18: YY_RULE_SETUP -#line 67 "hl/src//H5LTanalyze.l" +#line 67 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SCHAR_TOKEN);} YY_BREAK case 19: YY_RULE_SETUP -#line 68 "hl/src//H5LTanalyze.l" +#line 68 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UCHAR_TOKEN);} YY_BREAK case 20: YY_RULE_SETUP -#line 69 "hl/src//H5LTanalyze.l" +#line 69 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SHORT_TOKEN);} YY_BREAK case 21: YY_RULE_SETUP -#line 70 "hl/src//H5LTanalyze.l" +#line 70 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_USHORT_TOKEN);} YY_BREAK case 22: YY_RULE_SETUP -#line 71 "hl/src//H5LTanalyze.l" +#line 71 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_INT_TOKEN);} YY_BREAK case 23: YY_RULE_SETUP -#line 72 "hl/src//H5LTanalyze.l" +#line 72 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UINT_TOKEN);} YY_BREAK case 24: YY_RULE_SETUP -#line 73 "hl/src//H5LTanalyze.l" +#line 73 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LONG_TOKEN);} YY_BREAK case 25: YY_RULE_SETUP -#line 74 "hl/src//H5LTanalyze.l" +#line 74 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULONG_TOKEN);} YY_BREAK case 26: YY_RULE_SETUP -#line 75 "hl/src//H5LTanalyze.l" +#line 75 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LLONG_TOKEN);} YY_BREAK case 27: YY_RULE_SETUP -#line 76 "hl/src//H5LTanalyze.l" +#line 76 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULLONG_TOKEN);} YY_BREAK case 28: YY_RULE_SETUP -#line 78 "hl/src//H5LTanalyze.l" +#line 78 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32BE_TOKEN);} YY_BREAK case 29: YY_RULE_SETUP -#line 79 "hl/src//H5LTanalyze.l" +#line 79 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32LE_TOKEN);} YY_BREAK case 30: YY_RULE_SETUP -#line 80 "hl/src//H5LTanalyze.l" +#line 80 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64BE_TOKEN);} YY_BREAK case 31: YY_RULE_SETUP -#line 81 "hl/src//H5LTanalyze.l" +#line 81 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64LE_TOKEN);} YY_BREAK case 32: YY_RULE_SETUP -#line 82 "hl/src//H5LTanalyze.l" +#line 82 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 33: YY_RULE_SETUP -#line 83 "hl/src//H5LTanalyze.l" +#line 83 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 34: YY_RULE_SETUP -#line 84 "hl/src//H5LTanalyze.l" +#line 84 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 35: YY_RULE_SETUP -#line 86 "hl/src//H5LTanalyze.l" +#line 86 "hl/src/H5LTanalyze.l" {return token(H5T_STRING_TOKEN);} YY_BREAK case 36: YY_RULE_SETUP -#line 87 "hl/src//H5LTanalyze.l" +#line 87 "hl/src/H5LTanalyze.l" {return token(STRSIZE_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP -#line 88 "hl/src//H5LTanalyze.l" +#line 88 "hl/src/H5LTanalyze.l" {return token(STRPAD_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP -#line 89 "hl/src//H5LTanalyze.l" +#line 89 "hl/src/H5LTanalyze.l" {return token(CSET_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP -#line 90 "hl/src//H5LTanalyze.l" +#line 90 "hl/src/H5LTanalyze.l" {return token(CTYPE_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP -#line 91 "hl/src//H5LTanalyze.l" +#line 91 "hl/src/H5LTanalyze.l" {return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP -#line 92 "hl/src//H5LTanalyze.l" +#line 92 "hl/src/H5LTanalyze.l" {return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP -#line 93 "hl/src//H5LTanalyze.l" +#line 93 "hl/src/H5LTanalyze.l" {return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP -#line 94 "hl/src//H5LTanalyze.l" +#line 94 "hl/src/H5LTanalyze.l" {return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP -#line 95 "hl/src//H5LTanalyze.l" +#line 95 "hl/src/H5LTanalyze.l" {return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP -#line 96 "hl/src//H5LTanalyze.l" +#line 96 "hl/src/H5LTanalyze.l" {return token(H5T_C_S1_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP -#line 97 "hl/src//H5LTanalyze.l" +#line 97 "hl/src/H5LTanalyze.l" {return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP -#line 98 "hl/src//H5LTanalyze.l" +#line 98 "hl/src/H5LTanalyze.l" {return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP -#line 100 "hl/src//H5LTanalyze.l" +#line 100 "hl/src/H5LTanalyze.l" {return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 101 "hl/src//H5LTanalyze.l" +#line 101 "hl/src/H5LTanalyze.l" {return token(H5T_ENUM_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 102 "hl/src//H5LTanalyze.l" +#line 102 "hl/src/H5LTanalyze.l" {return token(H5T_ARRAY_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP -#line 103 "hl/src//H5LTanalyze.l" +#line 103 "hl/src/H5LTanalyze.l" {return token(H5T_VLEN_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP -#line 105 "hl/src//H5LTanalyze.l" +#line 105 "hl/src/H5LTanalyze.l" {return token(H5T_OPAQUE_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP -#line 106 "hl/src//H5LTanalyze.l" +#line 106 "hl/src/H5LTanalyze.l" {return token(OPQ_SIZE_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP -#line 107 "hl/src//H5LTanalyze.l" +#line 107 "hl/src/H5LTanalyze.l" {return token(OPQ_TAG_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP -#line 109 "hl/src//H5LTanalyze.l" +#line 109 "hl/src/H5LTanalyze.l" { - H5LTyylval.ival = HDatoi(H5LTyytext); + H5LTyylval.ival = HDatoi(yytext); return NUMBER; } YY_BREAK case 56: /* rule 56 can match eol */ YY_RULE_SETUP -#line 114 "hl/src//H5LTanalyze.l" +#line 114 "hl/src/H5LTanalyze.l" { - H5LTyylval.sval = trim_quotes(H5LTyytext); + H5LTyylval.sval = trim_quotes(yytext); return STRING; } YY_BREAK case 57: YY_RULE_SETUP -#line 119 "hl/src//H5LTanalyze.l" +#line 119 "hl/src/H5LTanalyze.l" {return token('{');} YY_BREAK case 58: YY_RULE_SETUP -#line 120 "hl/src//H5LTanalyze.l" +#line 120 "hl/src/H5LTanalyze.l" {return token('}');} YY_BREAK case 59: YY_RULE_SETUP -#line 121 "hl/src//H5LTanalyze.l" +#line 121 "hl/src/H5LTanalyze.l" {return token('[');} YY_BREAK case 60: YY_RULE_SETUP -#line 122 "hl/src//H5LTanalyze.l" +#line 122 "hl/src/H5LTanalyze.l" {return token(']');} YY_BREAK case 61: YY_RULE_SETUP -#line 123 "hl/src//H5LTanalyze.l" +#line 123 "hl/src/H5LTanalyze.l" {return token(':');} YY_BREAK case 62: YY_RULE_SETUP -#line 124 "hl/src//H5LTanalyze.l" +#line 124 "hl/src/H5LTanalyze.l" {return token(';');} YY_BREAK case 63: /* rule 63 can match eol */ YY_RULE_SETUP -#line 125 "hl/src//H5LTanalyze.l" +#line 125 "hl/src/H5LTanalyze.l" ; YY_BREAK case 64: -/* rule 64 can match eol */ YY_RULE_SETUP -#line 126 "hl/src//H5LTanalyze.l" -{ return 0; } - YY_BREAK -case 65: -YY_RULE_SETUP -#line 128 "hl/src//H5LTanalyze.l" +#line 127 "hl/src/H5LTanalyze.l" ECHO; YY_BREAK -#line 1270 "hl/src//H5LTanalyze.c" +#line 1501 "hl/src/H5LTanalyze.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1313,15 +1545,15 @@ case YY_STATE_EOF(INITIAL): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed H5LTyyin at a new source and called - * H5LTyylex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = H5LTyyin; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -1374,11 +1606,11 @@ case YY_STATE_EOF(INITIAL): { (yy_did_buffer_switch_on_eof) = 0; - if ( H5LTyywrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * H5LTyytext, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -1427,7 +1659,8 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of H5LTyylex */ + } /* end of user's declarations */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1438,9 +1671,9 @@ case YY_STATE_EOF(INITIAL): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1469,7 +1702,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1482,7 +1715,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1496,7 +1729,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1505,11 +1738,12 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - H5LTyyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1537,7 +1771,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - H5LTyyrestart(H5LTyyin ); + yyrestart( yyin ); } else @@ -1551,12 +1785,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) H5LTyyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1572,14 +1809,14 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1588,10 +1825,10 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 276 ) - yy_c = yy_meta[(unsigned int) yy_c]; + if ( yy_current_state >= 275 ) + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1604,10 +1841,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1616,31 +1853,33 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 276 ) - yy_c = yy_meta[(unsigned int) yy_c]; + if ( yy_current_state >= 275 ) + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 275); + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 274); return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); - /* undo effects of setting up H5LTyytext */ + /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1649,7 +1888,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1662,6 +1901,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1686,7 +1927,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1703,14 +1944,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - H5LTyyrestart(H5LTyyin ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( H5LTyywrap( ) ) - return EOF; + if ( yywrap( ) ) + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1729,7 +1970,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve H5LTyytext */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -1741,32 +1982,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void H5LTyyrestart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - H5LTyy_init_buffer(YY_CURRENT_BUFFER,input_file ); - H5LTyy_load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * H5LTyypop_buffer_state(); - * H5LTyypush_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -1779,21 +2020,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (H5LTyywrap()) processing, but the only time this flag - * is looked at is after H5LTyywrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void H5LTyy_load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - H5LTyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -1803,35 +2044,35 @@ static void H5LTyy_load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE H5LTyy_create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) H5LTyyalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - H5LTyy_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with H5LTyy_create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void H5LTyy_delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -1841,27 +2082,27 @@ static void H5LTyy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - H5LTyyfree((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - H5LTyyfree((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a H5LTyyrestart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void H5LTyy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - H5LTyy_flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then H5LTyy_init_buffer was _probably_ - * called from H5LTyyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -1878,7 +2119,7 @@ static void H5LTyy_load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void H5LTyy_flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -1898,7 +2139,7 @@ static void H5LTyy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1907,14 +2148,14 @@ static void H5LTyy_load_buffer_state (void) * @param new_buffer The new state. * */ -void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - H5LTyyensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from H5LTyy_switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -1928,8 +2169,8 @@ void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from H5LTyy_switch_to_buffer. */ - H5LTyy_load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -1937,18 +2178,18 @@ void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void H5LTyypop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -1956,7 +2197,7 @@ void H5LTyypop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void H5LTyyensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -1966,15 +2207,15 @@ static void H5LTyyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyalloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1983,15 +2224,15 @@ static void H5LTyyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyrealloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2003,9 +2244,9 @@ static void H5LTyyensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -2013,49 +2254,49 @@ YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - H5LTyy_switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to H5LTyylex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * H5LTyy_scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return H5LTyy_scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to H5LTyylex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; @@ -2063,19 +2304,19 @@ YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) H5LTyyalloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = H5LTyy_scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in H5LTyy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2089,9 +2330,9 @@ YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2101,14 +2342,14 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up H5LTyytext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - H5LTyytext[H5LTyyleng] = (yy_hold_char); \ - (yy_c_buf_p) = H5LTyytext + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - H5LTyyleng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -2117,126 +2358,126 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int H5LTyyget_lineno (void) +int yyget_lineno (void) { - - return H5LTyylineno; + + return yylineno; } /** Get the input stream. * */ -FILE *H5LTyyget_in (void) +FILE *yyget_in (void) { - return H5LTyyin; + return yyin; } /** Get the output stream. * */ -FILE *H5LTyyget_out (void) +FILE *yyget_out (void) { - return H5LTyyout; + return yyout; } /** Get the length of the current token. * */ -yy_size_t H5LTyyget_leng (void) +int yyget_leng (void) { - return H5LTyyleng; + return yyleng; } /** Get the current token. * */ -char *H5LTyyget_text (void) +char *yyget_text (void) { - return H5LTyytext; + return yytext; } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void H5LTyyset_lineno (int line_number ) +void yyset_lineno (int _line_number ) { - H5LTyylineno = line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * - * @see H5LTyy_switch_to_buffer + * @see yy_switch_to_buffer */ -void H5LTyyset_in (FILE * in_str ) +void yyset_in (FILE * _in_str ) { - H5LTyyin = in_str ; + yyin = _in_str ; } -void H5LTyyset_out (FILE * out_str ) +void yyset_out (FILE * _out_str ) { - H5LTyyout = out_str ; + yyout = _out_str ; } -int H5LTyyget_debug (void) +int yyget_debug (void) { - return H5LTyy_flex_debug; + return yy_flex_debug; } -void H5LTyyset_debug (int bdebug ) +void yyset_debug (int _bdebug ) { - H5LTyy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from H5LTyylex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - H5LTyyin = stdin; - H5LTyyout = stdout; + yyin = stdin; + yyout = stdout; #else - H5LTyyin = (FILE *) 0; - H5LTyyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * H5LTyylex_init() + * yylex_init() */ return 0; } -/* H5LTyylex_destroy is for both reentrant and non-reentrant scanners. */ -int H5LTyylex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - H5LTyypop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - H5LTyyfree((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * H5LTyylex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -2247,18 +2488,19 @@ int H5LTyylex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2266,13 +2508,14 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *H5LTyyalloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *H5LTyyrealloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2280,18 +2523,17 @@ void *H5LTyyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void H5LTyyfree (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see H5LTyyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 128 "hl/src//H5LTanalyze.l" - +#line 127 "hl/src/H5LTanalyze.l" /* Allocate a copy of `quoted` with the double quote character at @@ -2323,11 +2565,11 @@ int my_yyinput(char *buf, int max_size) int H5LTyyerror(const char *msg) { - HDprintf("ERROR: %s before \"%s\".\n", msg, H5LTyytext); + HDprintf("ERROR: %s before \"%s\".\n", msg, yytext); return 0; } -int H5LTyywrap() +int yywrap() { return(1); } diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 76d5800..fd1cbe5 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -123,7 +123,6 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} ":" {return token(':');} ";" {return token(';');} [ \t\n]* ; -"\n" { return 0; } %% diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index eec7c64..7f552d8 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -28,22 +28,22 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -56,7 +56,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -74,7 +74,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -93,14 +93,14 @@ #define yyparse H5LTyyparse #define yylex H5LTyylex #define yyerror H5LTyyerror -#define yylval H5LTyylval -#define yychar H5LTyychar #define yydebug H5LTyydebug #define yynerrs H5LTyynerrs +#define yylval H5LTyylval +#define yychar H5LTyychar + /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 20 "hl/src//H5LTparse.y" +#line 20 "hl/src/H5LTparse.y" /* yacc.c:339 */ #include #include @@ -150,14 +150,13 @@ static hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ static char* enum_memb_symbol; /*enum member symbol string*/ -/* Line 371 of yacc.c */ -#line 125 "hl/src//H5LTparse.c" +#line 124 "hl/src/H5LTparse.c" /* yacc.c:339 */ -# ifndef YY_NULL +# ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# define YY_NULLPTR nullptr # else -# define YY_NULL 0 +# define YY_NULLPTR 0 # endif # endif @@ -173,7 +172,7 @@ static char* enum_memb_symbol; /*enum member symbol string*/ by #include "H5LTparse.h". */ #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -181,113 +180,99 @@ static char* enum_memb_symbol; /*enum member symbol string*/ extern int H5LTyydebug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - H5T_STD_I8BE_TOKEN = 258, - H5T_STD_I8LE_TOKEN = 259, - H5T_STD_I16BE_TOKEN = 260, - H5T_STD_I16LE_TOKEN = 261, - H5T_STD_I32BE_TOKEN = 262, - H5T_STD_I32LE_TOKEN = 263, - H5T_STD_I64BE_TOKEN = 264, - H5T_STD_I64LE_TOKEN = 265, - H5T_STD_U8BE_TOKEN = 266, - H5T_STD_U8LE_TOKEN = 267, - H5T_STD_U16BE_TOKEN = 268, - H5T_STD_U16LE_TOKEN = 269, - H5T_STD_U32BE_TOKEN = 270, - H5T_STD_U32LE_TOKEN = 271, - H5T_STD_U64BE_TOKEN = 272, - H5T_STD_U64LE_TOKEN = 273, - H5T_NATIVE_CHAR_TOKEN = 274, - H5T_NATIVE_SCHAR_TOKEN = 275, - H5T_NATIVE_UCHAR_TOKEN = 276, - H5T_NATIVE_SHORT_TOKEN = 277, - H5T_NATIVE_USHORT_TOKEN = 278, - H5T_NATIVE_INT_TOKEN = 279, - H5T_NATIVE_UINT_TOKEN = 280, - H5T_NATIVE_LONG_TOKEN = 281, - H5T_NATIVE_ULONG_TOKEN = 282, - H5T_NATIVE_LLONG_TOKEN = 283, - H5T_NATIVE_ULLONG_TOKEN = 284, - H5T_IEEE_F32BE_TOKEN = 285, - H5T_IEEE_F32LE_TOKEN = 286, - H5T_IEEE_F64BE_TOKEN = 287, - H5T_IEEE_F64LE_TOKEN = 288, - H5T_NATIVE_FLOAT_TOKEN = 289, - H5T_NATIVE_DOUBLE_TOKEN = 290, - H5T_NATIVE_LDOUBLE_TOKEN = 291, - H5T_STRING_TOKEN = 292, - STRSIZE_TOKEN = 293, - STRPAD_TOKEN = 294, - CSET_TOKEN = 295, - CTYPE_TOKEN = 296, - H5T_VARIABLE_TOKEN = 297, - H5T_STR_NULLTERM_TOKEN = 298, - H5T_STR_NULLPAD_TOKEN = 299, - H5T_STR_SPACEPAD_TOKEN = 300, - H5T_CSET_ASCII_TOKEN = 301, - H5T_CSET_UTF8_TOKEN = 302, - H5T_C_S1_TOKEN = 303, - H5T_FORTRAN_S1_TOKEN = 304, - H5T_OPAQUE_TOKEN = 305, - OPQ_SIZE_TOKEN = 306, - OPQ_TAG_TOKEN = 307, - H5T_COMPOUND_TOKEN = 308, - H5T_ENUM_TOKEN = 309, - H5T_ARRAY_TOKEN = 310, - H5T_VLEN_TOKEN = 311, - STRING = 312, - NUMBER = 313 - }; + enum yytokentype + { + H5T_STD_I8BE_TOKEN = 258, + H5T_STD_I8LE_TOKEN = 259, + H5T_STD_I16BE_TOKEN = 260, + H5T_STD_I16LE_TOKEN = 261, + H5T_STD_I32BE_TOKEN = 262, + H5T_STD_I32LE_TOKEN = 263, + H5T_STD_I64BE_TOKEN = 264, + H5T_STD_I64LE_TOKEN = 265, + H5T_STD_U8BE_TOKEN = 266, + H5T_STD_U8LE_TOKEN = 267, + H5T_STD_U16BE_TOKEN = 268, + H5T_STD_U16LE_TOKEN = 269, + H5T_STD_U32BE_TOKEN = 270, + H5T_STD_U32LE_TOKEN = 271, + H5T_STD_U64BE_TOKEN = 272, + H5T_STD_U64LE_TOKEN = 273, + H5T_NATIVE_CHAR_TOKEN = 274, + H5T_NATIVE_SCHAR_TOKEN = 275, + H5T_NATIVE_UCHAR_TOKEN = 276, + H5T_NATIVE_SHORT_TOKEN = 277, + H5T_NATIVE_USHORT_TOKEN = 278, + H5T_NATIVE_INT_TOKEN = 279, + H5T_NATIVE_UINT_TOKEN = 280, + H5T_NATIVE_LONG_TOKEN = 281, + H5T_NATIVE_ULONG_TOKEN = 282, + H5T_NATIVE_LLONG_TOKEN = 283, + H5T_NATIVE_ULLONG_TOKEN = 284, + H5T_IEEE_F32BE_TOKEN = 285, + H5T_IEEE_F32LE_TOKEN = 286, + H5T_IEEE_F64BE_TOKEN = 287, + H5T_IEEE_F64LE_TOKEN = 288, + H5T_NATIVE_FLOAT_TOKEN = 289, + H5T_NATIVE_DOUBLE_TOKEN = 290, + H5T_NATIVE_LDOUBLE_TOKEN = 291, + H5T_STRING_TOKEN = 292, + STRSIZE_TOKEN = 293, + STRPAD_TOKEN = 294, + CSET_TOKEN = 295, + CTYPE_TOKEN = 296, + H5T_VARIABLE_TOKEN = 297, + H5T_STR_NULLTERM_TOKEN = 298, + H5T_STR_NULLPAD_TOKEN = 299, + H5T_STR_SPACEPAD_TOKEN = 300, + H5T_CSET_ASCII_TOKEN = 301, + H5T_CSET_UTF8_TOKEN = 302, + H5T_C_S1_TOKEN = 303, + H5T_FORTRAN_S1_TOKEN = 304, + H5T_OPAQUE_TOKEN = 305, + OPQ_SIZE_TOKEN = 306, + OPQ_TAG_TOKEN = 307, + H5T_COMPOUND_TOKEN = 308, + H5T_ENUM_TOKEN = 309, + H5T_ARRAY_TOKEN = 310, + H5T_VLEN_TOKEN = 311, + STRING = 312, + NUMBER = 313 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE + +union YYSTYPE { -/* Line 387 of yacc.c */ -#line 69 "hl/src//H5LTparse.y" +#line 69 "hl/src/H5LTparse.y" /* yacc.c:355 */ int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ +#line 229 "hl/src/H5LTparse.c" /* yacc.c:355 */ +}; -/* Line 387 of yacc.c */ -#line 233 "hl/src//H5LTparse.c" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE H5LTyylval; -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -hid_t H5LTyyparse (void *YYPARSE_PARAM); -#else -hid_t H5LTyyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus hid_t H5LTyyparse (void); -#else -hid_t H5LTyyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 261 "hl/src//H5LTparse.c" +#line 246 "hl/src/H5LTparse.c" /* yacc.c:358 */ #ifdef short # undef short @@ -301,11 +286,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -325,8 +307,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -348,6 +329,33 @@ typedef short int yytype_int16; # endif #endif +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -355,23 +363,25 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -390,8 +400,7 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS @@ -403,8 +412,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -420,7 +429,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -428,15 +437,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -446,7 +453,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -471,16 +478,16 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif @@ -499,7 +506,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -515,17 +522,19 @@ union yyalloc #define YYNNTS 43 /* YYNRULES -- Number of rules. */ #define YYNRULES 92 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 134 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 313 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -563,51 +572,7 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 4, 6, 8, 10, 12, 14, 16, - 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, - 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, - 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, - 78, 80, 82, 84, 86, 88, 90, 92, 93, 99, - 100, 103, 104, 110, 112, 113, 116, 118, 119, 126, - 127, 130, 131, 132, 138, 140, 145, 146, 147, 159, - 161, 163, 164, 165, 166, 167, 187, 189, 191, 193, - 195, 197, 199, 201, 203, 205, 206, 214, 215, 218, - 219, 224, 226 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 66, 0, -1, -1, 67, -1, 68, -1, 71, -1, - 79, -1, 86, -1, 69, -1, 70, -1, 92, -1, - 101, -1, 87, -1, 3, -1, 4, -1, 5, -1, - 6, -1, 7, -1, 8, -1, 9, -1, 10, -1, - 11, -1, 12, -1, 13, -1, 14, -1, 15, -1, - 16, -1, 17, -1, 18, -1, 19, -1, 20, -1, - 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, - 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, - 31, -1, 32, -1, 33, -1, 34, -1, 35, -1, - 36, -1, -1, 53, 72, 59, 73, 60, -1, -1, - 73, 74, -1, -1, 67, 75, 76, 77, 64, -1, - 57, -1, -1, 63, 78, -1, 58, -1, -1, 55, - 80, 59, 81, 67, 60, -1, -1, 81, 82, -1, - -1, -1, 61, 83, 85, 84, 62, -1, 58, -1, - 56, 59, 67, 60, -1, -1, -1, 50, 59, 51, - 90, 64, 88, 52, 91, 64, 89, 60, -1, 58, - -1, 57, -1, -1, -1, -1, -1, 37, 59, 38, - 97, 64, 93, 39, 98, 64, 94, 40, 99, 64, - 95, 41, 100, 64, 96, 60, -1, 42, -1, 58, - -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, - -1, 48, -1, 49, -1, -1, 54, 59, 69, 64, - 102, 103, 60, -1, -1, 103, 104, -1, -1, 106, - 105, 107, 64, -1, 57, -1, 58, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 102, 102, 103, 105, 106, 107, 108, 110, 111, @@ -656,13 +621,13 @@ static const char *const yytname[] = "dimsize", "vlen_type", "opaque_type", "@6", "$@7", "opaque_size", "opaque_tag", "string_type", "$@8", "$@9", "$@10", "@11", "strsize", "strpad", "cset", "ctype", "enum_type", "$@12", "enum_list", "enum_def", - "$@13", "enum_symbol", "enum_val", YY_NULL + "$@13", "enum_symbol", "enum_val", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -675,70 +640,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 65, 66, 66, 67, 67, 67, 67, 68, 68, - 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 70, 70, 70, 70, 70, 70, 70, 72, 71, 73, - 73, 75, 74, 76, 77, 77, 78, 80, 79, 81, - 81, 83, 84, 82, 85, 86, 88, 89, 87, 90, - 91, 93, 94, 95, 96, 92, 97, 97, 98, 98, - 98, 99, 99, 100, 100, 102, 101, 103, 103, 105, - 104, 106, 107 -}; +#define YYPACT_NINF -25 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, - 2, 0, 5, 1, 0, 2, 1, 0, 6, 0, - 2, 0, 0, 5, 1, 4, 0, 0, 11, 1, - 1, 0, 0, 0, 0, 19, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 7, 0, 2, 0, - 4, 1, 1 -}; +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-25))) -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, - 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, - 10, 11, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 49, 0, 59, 0, 76, 77, 0, 69, 0, - 0, 85, 0, 65, 71, 66, 48, 51, 50, 87, - 61, 0, 60, 0, 0, 0, 0, 0, 58, 0, - 0, 53, 54, 91, 86, 88, 89, 64, 62, 78, - 79, 80, 0, 70, 0, 0, 0, 0, 0, 72, - 67, 56, 55, 52, 92, 0, 63, 0, 0, 90, - 0, 68, 81, 82, 0, 73, 0, 0, 83, 84, - 0, 74, 0, 75 -}; +#define YYTABLE_NINF -1 -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 41, 42, 43, 44, 45, 46, 54, 70, 78, - 85, 92, 106, 112, 47, 56, 72, 82, 87, 108, - 98, 48, 49, 84, 118, 69, 104, 50, 83, 117, - 126, 132, 67, 102, 124, 130, 51, 79, 86, 95, - 107, 96, 115 -}; +#define yytable_value_is_error(Yytable_value) \ + 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -25 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, @@ -757,7 +670,28 @@ static const yytype_int16 yypact[] = 101, -25, 103, -25 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, + 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, + 10, 11, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 49, 0, 59, 0, 76, 77, 0, 69, 0, + 0, 85, 0, 65, 71, 66, 48, 51, 50, 87, + 61, 0, 60, 0, 0, 0, 0, 0, 58, 0, + 0, 53, 54, 91, 86, 88, 89, 64, 62, 78, + 79, 80, 0, 70, 0, 0, 0, 0, 0, 72, + 67, 56, 55, 52, 92, 0, 63, 0, 0, 90, + 0, 68, 81, 82, 0, 73, 0, 0, 83, 84, + 0, 74, 0, 75 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -25, -25, -15, -25, 111, -25, -25, -25, -25, -25, @@ -767,10 +701,19 @@ static const yytype_int8 yypgoto[] = -25, -25, -25 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 41, 42, 43, 44, 45, 46, 54, 70, 78, + 85, 92, 106, 112, 47, 56, 72, 82, 87, 108, + 98, 48, 49, 84, 118, 69, 104, 50, 83, 117, + 126, 132, 67, 102, 124, 130, 51, 79, 86, 95, + 107, 96, 115 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, @@ -795,12 +738,6 @@ static const yytype_uint8 yytable[] = 20, 21, 22, 23, 24, 25, 26, 27 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-25))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - static const yytype_uint8 yycheck[] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, @@ -825,8 +762,8 @@ static const yytype_uint8 yycheck[] = 22, 23, 24, 25, 26, 27, 28, 29 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, @@ -845,30 +782,46 @@ static const yytype_uint8 yystos[] = 100, 64, 96, 60 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 65, 66, 66, 67, 67, 67, 67, 68, 68, + 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 70, 70, 70, 70, 70, 70, 70, 72, 71, 73, + 73, 75, 74, 76, 77, 77, 78, 80, 79, 81, + 81, 83, 84, 82, 85, 86, 88, 89, 87, 90, + 91, 93, 94, 95, 96, 92, 97, 97, 98, 98, + 98, 99, 99, 100, 100, 102, 101, 103, 103, 105, + 104, 106, 107 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, + 2, 0, 5, 1, 0, 2, 1, 0, 6, 0, + 2, 0, 0, 5, 1, 4, 0, 0, 11, 1, + 1, 0, 0, 0, 0, 19, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 7, 0, 2, 0, + 4, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + #define YYRECOVERING() (!!yyerrstatus) @@ -885,28 +838,16 @@ do \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) /* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - +#define YYTERROR 1 +#define YYERRCODE 256 -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - /* Enable debugging if requested. */ #if YYDEBUG @@ -915,40 +856,36 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { FILE *yyo = yyoutput; YYUSE (yyo); @@ -957,14 +894,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -972,22 +903,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); @@ -998,16 +918,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1018,49 +930,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1074,7 +979,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1097,15 +1002,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1121,16 +1019,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1160,27 +1050,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1203,11 +1093,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1215,10 +1105,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1268,7 +1154,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1335,31 +1221,17 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif { YYUSE (yyvaluep); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1368,18 +1240,8 @@ yydestruct (yymsg, yytype, yyvaluep) /* The lookahead symbol. */ int yychar; - -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - +YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; @@ -1388,35 +1250,16 @@ int yynerrs; | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -hid_t -yyparse (void *YYPARSE_PARAM) -#else -hid_t -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) hid_t yyparse (void) -#else -hid_t -yyparse () - -#endif -#endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ @@ -1484,23 +1327,23 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1508,22 +1351,22 @@ yyparse () # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1532,10 +1375,10 @@ yyparse () yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1564,7 +1407,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (); } if (yychar <= YYEOF) @@ -1629,7 +1472,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1643,419 +1486,418 @@ yyreduce: switch (yyn) { case 2: -/* Line 1792 of yacc.c */ -#line 102 "hl/src//H5LTparse.y" +#line 102 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } +#line 1462 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 3: -/* Line 1792 of yacc.c */ -#line 103 "hl/src//H5LTparse.y" +#line 103 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { return (yyval.hid);} +#line 1468 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 13: -/* Line 1792 of yacc.c */ -#line 117 "hl/src//H5LTparse.y" +#line 117 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } +#line 1474 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 14: -/* Line 1792 of yacc.c */ -#line 118 "hl/src//H5LTparse.y" +#line 118 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } +#line 1480 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 15: -/* Line 1792 of yacc.c */ -#line 119 "hl/src//H5LTparse.y" +#line 119 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } +#line 1486 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 16: -/* Line 1792 of yacc.c */ -#line 120 "hl/src//H5LTparse.y" +#line 120 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } +#line 1492 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 17: -/* Line 1792 of yacc.c */ -#line 121 "hl/src//H5LTparse.y" +#line 121 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } +#line 1498 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 18: -/* Line 1792 of yacc.c */ -#line 122 "hl/src//H5LTparse.y" +#line 122 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } +#line 1504 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 19: -/* Line 1792 of yacc.c */ -#line 123 "hl/src//H5LTparse.y" +#line 123 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } +#line 1510 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 20: -/* Line 1792 of yacc.c */ -#line 124 "hl/src//H5LTparse.y" +#line 124 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } +#line 1516 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 21: -/* Line 1792 of yacc.c */ -#line 125 "hl/src//H5LTparse.y" +#line 125 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } +#line 1522 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 22: -/* Line 1792 of yacc.c */ -#line 126 "hl/src//H5LTparse.y" +#line 126 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } +#line 1528 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 23: -/* Line 1792 of yacc.c */ -#line 127 "hl/src//H5LTparse.y" +#line 127 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } +#line 1534 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 24: -/* Line 1792 of yacc.c */ -#line 128 "hl/src//H5LTparse.y" +#line 128 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } +#line 1540 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 25: -/* Line 1792 of yacc.c */ -#line 129 "hl/src//H5LTparse.y" +#line 129 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } +#line 1546 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 26: -/* Line 1792 of yacc.c */ -#line 130 "hl/src//H5LTparse.y" +#line 130 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } +#line 1552 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 27: -/* Line 1792 of yacc.c */ -#line 131 "hl/src//H5LTparse.y" +#line 131 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } +#line 1558 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 28: -/* Line 1792 of yacc.c */ -#line 132 "hl/src//H5LTparse.y" +#line 132 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } +#line 1564 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 29: -/* Line 1792 of yacc.c */ -#line 133 "hl/src//H5LTparse.y" +#line 133 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } +#line 1570 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 30: -/* Line 1792 of yacc.c */ -#line 134 "hl/src//H5LTparse.y" +#line 134 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } +#line 1576 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 31: -/* Line 1792 of yacc.c */ -#line 135 "hl/src//H5LTparse.y" +#line 135 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } +#line 1582 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 32: -/* Line 1792 of yacc.c */ -#line 136 "hl/src//H5LTparse.y" +#line 136 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } +#line 1588 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 33: -/* Line 1792 of yacc.c */ -#line 137 "hl/src//H5LTparse.y" +#line 137 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } +#line 1594 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 34: -/* Line 1792 of yacc.c */ -#line 138 "hl/src//H5LTparse.y" +#line 138 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } +#line 1600 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 35: -/* Line 1792 of yacc.c */ -#line 139 "hl/src//H5LTparse.y" +#line 139 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } +#line 1606 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 36: -/* Line 1792 of yacc.c */ -#line 140 "hl/src//H5LTparse.y" +#line 140 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } +#line 1612 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 37: -/* Line 1792 of yacc.c */ -#line 141 "hl/src//H5LTparse.y" +#line 141 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } +#line 1618 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 38: -/* Line 1792 of yacc.c */ -#line 142 "hl/src//H5LTparse.y" +#line 142 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } +#line 1624 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 39: -/* Line 1792 of yacc.c */ -#line 143 "hl/src//H5LTparse.y" +#line 143 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } +#line 1630 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 40: -/* Line 1792 of yacc.c */ -#line 146 "hl/src//H5LTparse.y" +#line 146 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } +#line 1636 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 41: -/* Line 1792 of yacc.c */ -#line 147 "hl/src//H5LTparse.y" +#line 147 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } +#line 1642 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 42: -/* Line 1792 of yacc.c */ -#line 148 "hl/src//H5LTparse.y" +#line 148 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } +#line 1648 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 43: -/* Line 1792 of yacc.c */ -#line 149 "hl/src//H5LTparse.y" +#line 149 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } +#line 1654 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 44: -/* Line 1792 of yacc.c */ -#line 150 "hl/src//H5LTparse.y" +#line 150 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } +#line 1660 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 45: -/* Line 1792 of yacc.c */ -#line 151 "hl/src//H5LTparse.y" +#line 151 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } +#line 1666 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 46: -/* Line 1792 of yacc.c */ -#line 152 "hl/src//H5LTparse.y" +#line 152 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } +#line 1672 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 47: -/* Line 1792 of yacc.c */ -#line 156 "hl/src//H5LTparse.y" +#line 156 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } +#line 1678 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 48: -/* Line 1792 of yacc.c */ -#line 158 "hl/src//H5LTparse.y" +#line 158 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; cmpd_stack[csindex].first_memb = 1; csindex--; } +#line 1688 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 51: -/* Line 1792 of yacc.c */ -#line 167 "hl/src//H5LTparse.y" +#line 167 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } +#line 1694 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 52: -/* Line 1792 of yacc.c */ -#line 169 "hl/src//H5LTparse.y" +#line 169 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; /*Adjust size and insert member, consider both member size and offset.*/ if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ - new_size = H5Tget_size((yyvsp[(1) - (5)].hid)) + (yyvsp[(4) - (5)].ival); + new_size = H5Tget_size((yyvsp[-4].hid)) + (yyvsp[-1].ival); H5Tset_size(dtype_id, new_size); /*member name is saved in yylval.sval by lexer*/ - H5Tinsert(dtype_id, (yyvsp[(3) - (5)].sval), (yyvsp[(4) - (5)].ival), (yyvsp[(1) - (5)].hid)); + H5Tinsert(dtype_id, (yyvsp[-2].sval), (yyvsp[-1].ival), (yyvsp[-4].hid)); cmpd_stack[csindex].first_memb = 0; } else { origin_size = H5Tget_size(dtype_id); - if((yyvsp[(4) - (5)].ival) == 0) { - new_size = origin_size + H5Tget_size((yyvsp[(1) - (5)].hid)); + if((yyvsp[-1].ival) == 0) { + new_size = origin_size + H5Tget_size((yyvsp[-4].hid)); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, (yyvsp[(3) - (5)].sval), origin_size, (yyvsp[(1) - (5)].hid)); + H5Tinsert(dtype_id, (yyvsp[-2].sval), origin_size, (yyvsp[-4].hid)); } else { - new_size = (yyvsp[(4) - (5)].ival) + H5Tget_size((yyvsp[(1) - (5)].hid)); + new_size = (yyvsp[-1].ival) + H5Tget_size((yyvsp[-4].hid)); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, (yyvsp[(3) - (5)].sval), (yyvsp[(4) - (5)].ival), (yyvsp[(1) - (5)].hid)); + H5Tinsert(dtype_id, (yyvsp[-2].sval), (yyvsp[-1].ival), (yyvsp[-4].hid)); } } - if((yyvsp[(3) - (5)].sval)) { - HDfree((yyvsp[(3) - (5)].sval)); - (yyvsp[(3) - (5)].sval) = NULL; + if((yyvsp[-2].sval)) { + HDfree((yyvsp[-2].sval)); + (yyvsp[-2].sval) = NULL; } cmpd_stack[csindex].is_field = 0; - H5Tclose((yyvsp[(1) - (5)].hid)); + H5Tclose((yyvsp[-4].hid)); new_size = H5Tget_size(dtype_id); } +#line 1733 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 53: -/* Line 1792 of yacc.c */ -#line 205 "hl/src//H5LTparse.y" +#line 205 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.sval) = HDstrdup(yylval.sval); HDfree(yylval.sval); yylval.sval = NULL; } +#line 1743 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 54: -/* Line 1792 of yacc.c */ -#line 212 "hl/src//H5LTparse.y" +#line 212 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } +#line 1749 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 55: -/* Line 1792 of yacc.c */ -#line 214 "hl/src//H5LTparse.y" +#line 214 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.ival) = yylval.ival; } +#line 1755 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 57: -/* Line 1792 of yacc.c */ -#line 218 "hl/src//H5LTparse.y" +#line 218 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { asindex++; /*pushd onto the stack*/ } +#line 1761 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 58: -/* Line 1792 of yacc.c */ -#line 220 "hl/src//H5LTparse.y" +#line 220 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - (yyval.hid) = H5Tarray_create2((yyvsp[(5) - (6)].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); + (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; - H5Tclose((yyvsp[(5) - (6)].hid)); + H5Tclose((yyvsp[-1].hid)); } +#line 1772 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 61: -/* Line 1792 of yacc.c */ -#line 230 "hl/src//H5LTparse.y" +#line 230 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } +#line 1778 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 62: -/* Line 1792 of yacc.c */ -#line 231 "hl/src//H5LTparse.y" +#line 231 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { unsigned ndims = arr_stack[asindex].ndims; arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; arr_stack[asindex].is_dim = 0; } +#line 1788 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 65: -/* Line 1792 of yacc.c */ -#line 242 "hl/src//H5LTparse.y" - { (yyval.hid) = H5Tvlen_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); } +#line 242 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1794 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 66: -/* Line 1792 of yacc.c */ -#line 248 "hl/src//H5LTparse.y" +#line 248 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { size_t size = (size_t)yylval.ival; (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); } +#line 1803 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 67: -/* Line 1792 of yacc.c */ -#line 253 "hl/src//H5LTparse.y" +#line 253 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - H5Tset_tag((yyvsp[(6) - (9)].hid), yylval.sval); + H5Tset_tag((yyvsp[-3].hid), yylval.sval); HDfree(yylval.sval); yylval.sval = NULL; } +#line 1813 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 68: -/* Line 1792 of yacc.c */ -#line 258 "hl/src//H5LTparse.y" - { (yyval.hid) = (yyvsp[(6) - (11)].hid); } +#line 258 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { (yyval.hid) = (yyvsp[-5].hid); } +#line 1819 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 71: -/* Line 1792 of yacc.c */ -#line 267 "hl/src//H5LTparse.y" +#line 267 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - if((yyvsp[(4) - (5)].ival) == H5T_VARIABLE_TOKEN) + if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) is_variable = 1; else str_size = yylval.ival; } +#line 1830 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 72: -/* Line 1792 of yacc.c */ -#line 274 "hl/src//H5LTparse.y" +#line 274 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - if((yyvsp[(8) - (9)].ival) == H5T_STR_NULLTERM_TOKEN) + if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; - else if((yyvsp[(8) - (9)].ival) == H5T_STR_NULLPAD_TOKEN) + else if((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN) str_pad = H5T_STR_NULLPAD; - else if((yyvsp[(8) - (9)].ival) == H5T_STR_SPACEPAD_TOKEN) + else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } +#line 1843 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 73: -/* Line 1792 of yacc.c */ -#line 283 "hl/src//H5LTparse.y" +#line 283 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - if((yyvsp[(12) - (13)].ival) == H5T_CSET_ASCII_TOKEN) + if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; - else if((yyvsp[(12) - (13)].ival) == H5T_CSET_UTF8_TOKEN) + else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } +#line 1854 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 74: -/* Line 1792 of yacc.c */ -#line 290 "hl/src//H5LTparse.y" +#line 290 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - if((yyvsp[(16) - (17)].hid) == H5T_C_S1_TOKEN) + if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_C_S1); - else if((yyvsp[(16) - (17)].hid) == H5T_FORTRAN_S1_TOKEN) + else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); } +#line 1865 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 75: -/* Line 1792 of yacc.c */ -#line 297 "hl/src//H5LTparse.y" +#line 297 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - hid_t str_id = (yyvsp[(18) - (19)].hid); + hid_t str_id = (yyvsp[-1].hid); /*set string size*/ if(is_variable) { @@ -2070,82 +1912,82 @@ yyreduce: (yyval.hid) = str_id; } +#line 1886 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 76: -/* Line 1792 of yacc.c */ -#line 314 "hl/src//H5LTparse.y" +#line 314 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_VARIABLE_TOKEN;} +#line 1892 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 78: -/* Line 1792 of yacc.c */ -#line 317 "hl/src//H5LTparse.y" +#line 317 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} +#line 1898 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 79: -/* Line 1792 of yacc.c */ -#line 318 "hl/src//H5LTparse.y" +#line 318 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} +#line 1904 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 80: -/* Line 1792 of yacc.c */ -#line 319 "hl/src//H5LTparse.y" +#line 319 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} +#line 1910 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 81: -/* Line 1792 of yacc.c */ -#line 321 "hl/src//H5LTparse.y" +#line 321 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} +#line 1916 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 82: -/* Line 1792 of yacc.c */ -#line 322 "hl/src//H5LTparse.y" +#line 322 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} +#line 1922 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 83: -/* Line 1792 of yacc.c */ -#line 324 "hl/src//H5LTparse.y" +#line 324 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.hid) = H5T_C_S1_TOKEN;} +#line 1928 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 84: -/* Line 1792 of yacc.c */ -#line 325 "hl/src//H5LTparse.y" +#line 325 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} +#line 1934 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 85: -/* Line 1792 of yacc.c */ -#line 329 "hl/src//H5LTparse.y" - { is_enum = 1; enum_id = H5Tenum_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); } +#line 329 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1940 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 86: -/* Line 1792 of yacc.c */ -#line 331 "hl/src//H5LTparse.y" +#line 331 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } +#line 1946 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 89: -/* Line 1792 of yacc.c */ -#line 336 "hl/src//H5LTparse.y" +#line 336 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_enum_memb = 1; /*indicate member of enum*/ - enum_memb_symbol = strdup(yylval.sval); + enum_memb_symbol = HDstrdup(yylval.sval); HDfree(yylval.sval); yylval.sval = NULL; } +#line 1957 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 90: -/* Line 1792 of yacc.c */ -#line 343 "hl/src//H5LTparse.y" +#line 343 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; @@ -2188,11 +2030,11 @@ yyreduce: H5Tclose(super); H5Tclose(native); } +#line 2004 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; -/* Line 1792 of yacc.c */ -#line 2166 "hl/src//H5LTparse.c" +#line 2008 "hl/src/H5LTparse.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2214,7 +2056,7 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -2229,9 +2071,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -2282,20 +2124,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -2314,7 +2156,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2327,29 +2169,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -2400,14 +2242,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2418,8 +2260,5 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index 7169017..9dd2fba 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,13 +26,13 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -40,105 +40,92 @@ extern int H5LTyydebug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - H5T_STD_I8BE_TOKEN = 258, - H5T_STD_I8LE_TOKEN = 259, - H5T_STD_I16BE_TOKEN = 260, - H5T_STD_I16LE_TOKEN = 261, - H5T_STD_I32BE_TOKEN = 262, - H5T_STD_I32LE_TOKEN = 263, - H5T_STD_I64BE_TOKEN = 264, - H5T_STD_I64LE_TOKEN = 265, - H5T_STD_U8BE_TOKEN = 266, - H5T_STD_U8LE_TOKEN = 267, - H5T_STD_U16BE_TOKEN = 268, - H5T_STD_U16LE_TOKEN = 269, - H5T_STD_U32BE_TOKEN = 270, - H5T_STD_U32LE_TOKEN = 271, - H5T_STD_U64BE_TOKEN = 272, - H5T_STD_U64LE_TOKEN = 273, - H5T_NATIVE_CHAR_TOKEN = 274, - H5T_NATIVE_SCHAR_TOKEN = 275, - H5T_NATIVE_UCHAR_TOKEN = 276, - H5T_NATIVE_SHORT_TOKEN = 277, - H5T_NATIVE_USHORT_TOKEN = 278, - H5T_NATIVE_INT_TOKEN = 279, - H5T_NATIVE_UINT_TOKEN = 280, - H5T_NATIVE_LONG_TOKEN = 281, - H5T_NATIVE_ULONG_TOKEN = 282, - H5T_NATIVE_LLONG_TOKEN = 283, - H5T_NATIVE_ULLONG_TOKEN = 284, - H5T_IEEE_F32BE_TOKEN = 285, - H5T_IEEE_F32LE_TOKEN = 286, - H5T_IEEE_F64BE_TOKEN = 287, - H5T_IEEE_F64LE_TOKEN = 288, - H5T_NATIVE_FLOAT_TOKEN = 289, - H5T_NATIVE_DOUBLE_TOKEN = 290, - H5T_NATIVE_LDOUBLE_TOKEN = 291, - H5T_STRING_TOKEN = 292, - STRSIZE_TOKEN = 293, - STRPAD_TOKEN = 294, - CSET_TOKEN = 295, - CTYPE_TOKEN = 296, - H5T_VARIABLE_TOKEN = 297, - H5T_STR_NULLTERM_TOKEN = 298, - H5T_STR_NULLPAD_TOKEN = 299, - H5T_STR_SPACEPAD_TOKEN = 300, - H5T_CSET_ASCII_TOKEN = 301, - H5T_CSET_UTF8_TOKEN = 302, - H5T_C_S1_TOKEN = 303, - H5T_FORTRAN_S1_TOKEN = 304, - H5T_OPAQUE_TOKEN = 305, - OPQ_SIZE_TOKEN = 306, - OPQ_TAG_TOKEN = 307, - H5T_COMPOUND_TOKEN = 308, - H5T_ENUM_TOKEN = 309, - H5T_ARRAY_TOKEN = 310, - H5T_VLEN_TOKEN = 311, - STRING = 312, - NUMBER = 313 - }; + enum yytokentype + { + H5T_STD_I8BE_TOKEN = 258, + H5T_STD_I8LE_TOKEN = 259, + H5T_STD_I16BE_TOKEN = 260, + H5T_STD_I16LE_TOKEN = 261, + H5T_STD_I32BE_TOKEN = 262, + H5T_STD_I32LE_TOKEN = 263, + H5T_STD_I64BE_TOKEN = 264, + H5T_STD_I64LE_TOKEN = 265, + H5T_STD_U8BE_TOKEN = 266, + H5T_STD_U8LE_TOKEN = 267, + H5T_STD_U16BE_TOKEN = 268, + H5T_STD_U16LE_TOKEN = 269, + H5T_STD_U32BE_TOKEN = 270, + H5T_STD_U32LE_TOKEN = 271, + H5T_STD_U64BE_TOKEN = 272, + H5T_STD_U64LE_TOKEN = 273, + H5T_NATIVE_CHAR_TOKEN = 274, + H5T_NATIVE_SCHAR_TOKEN = 275, + H5T_NATIVE_UCHAR_TOKEN = 276, + H5T_NATIVE_SHORT_TOKEN = 277, + H5T_NATIVE_USHORT_TOKEN = 278, + H5T_NATIVE_INT_TOKEN = 279, + H5T_NATIVE_UINT_TOKEN = 280, + H5T_NATIVE_LONG_TOKEN = 281, + H5T_NATIVE_ULONG_TOKEN = 282, + H5T_NATIVE_LLONG_TOKEN = 283, + H5T_NATIVE_ULLONG_TOKEN = 284, + H5T_IEEE_F32BE_TOKEN = 285, + H5T_IEEE_F32LE_TOKEN = 286, + H5T_IEEE_F64BE_TOKEN = 287, + H5T_IEEE_F64LE_TOKEN = 288, + H5T_NATIVE_FLOAT_TOKEN = 289, + H5T_NATIVE_DOUBLE_TOKEN = 290, + H5T_NATIVE_LDOUBLE_TOKEN = 291, + H5T_STRING_TOKEN = 292, + STRSIZE_TOKEN = 293, + STRPAD_TOKEN = 294, + CSET_TOKEN = 295, + CTYPE_TOKEN = 296, + H5T_VARIABLE_TOKEN = 297, + H5T_STR_NULLTERM_TOKEN = 298, + H5T_STR_NULLPAD_TOKEN = 299, + H5T_STR_SPACEPAD_TOKEN = 300, + H5T_CSET_ASCII_TOKEN = 301, + H5T_CSET_UTF8_TOKEN = 302, + H5T_C_S1_TOKEN = 303, + H5T_FORTRAN_S1_TOKEN = 304, + H5T_OPAQUE_TOKEN = 305, + OPQ_SIZE_TOKEN = 306, + OPQ_TAG_TOKEN = 307, + H5T_COMPOUND_TOKEN = 308, + H5T_ENUM_TOKEN = 309, + H5T_ARRAY_TOKEN = 310, + H5T_VLEN_TOKEN = 311, + STRING = 312, + NUMBER = 313 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE + +union YYSTYPE { -/* Line 2058 of yacc.c */ -#line 69 "hl/src//H5LTparse.y" +#line 69 "hl/src/H5LTparse.y" /* yacc.c:1909 */ int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ +#line 119 "hl/src/H5LTparse.h" /* yacc.c:1909 */ +}; -/* Line 2058 of yacc.c */ -#line 122 "hl/src//H5LTparse.h" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE H5LTyylval; -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -hid_t H5LTyyparse (void *YYPARSE_PARAM); -#else -hid_t H5LTyyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus hid_t H5LTyyparse (void); -#else -hid_t H5LTyyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index 7c32772..01f6ded 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -335,7 +335,7 @@ enum_list : ; enum_def : enum_symbol { is_enum_memb = 1; /*indicate member of enum*/ - enum_memb_symbol = strdup(yylval.sval); + enum_memb_symbol = HDstrdup(yylval.sval); HDfree(yylval.sval); yylval.sval = NULL; } -- cgit v0.12 From df9abfe3f0695df3cc39103e3e7d6e9e8b0f56dd Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 24 Mar 2021 09:25:50 -0700 Subject: Misc warning fixes (#495) * Committing clang-format changes * Misc warning fixes from Visual Studio * Committing clang-format changes * Fixes warnings in swmr.c test * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5system.c | 4 ++-- src/H5trace.c | 2 +- test/swmr.c | 34 +++++++++++++++++++++++----------- test/tfile.c | 48 ++++++++++++++++++++++++------------------------ test/th5s.c | 22 +++++++++++----------- test/tid.c | 10 +++++----- test/titerate.c | 4 ++-- test/tmisc.c | 2 +- test/tvltypes.c | 8 ++++---- 9 files changed, 73 insertions(+), 61 deletions(-) diff --git a/src/H5system.c b/src/H5system.c index caf2fc3..144e0bc 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -573,8 +573,8 @@ Wgetlogin(void) { #ifdef H5_HAVE_WINSOCK2_H - long bufferCount = WloginBuffer_count; - if (GetUserName(Wlogin_buffer, &bufferCount) == 0) + DWORD bufferCount = WloginBuffer_count; + if (GetUserName(Wlogin_buffer, &bufferCount) != 0) return (Wlogin_buffer); else #endif /* H5_HAVE_WINSOCK2_H */ diff --git a/src/H5trace.c b/src/H5trace.c index aa9cfd4..d0c6fdd 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -3884,7 +3884,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) FILE * out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; H5_timer_t function_timer = {{0}, {0}, {0}, FALSE}; - H5_timevals_t function_times; + H5_timevals_t function_times = {0.0, 0.0, 0.0}; static H5_timer_t running_timer; H5_timevals_t running_times; static int current_depth = 0; diff --git a/test/swmr.c b/test/swmr.c index 607b448..24a0b7c 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -847,14 +847,17 @@ error: static int test_metadata_read_retry_info(hid_t in_fapl) { - hid_t fapl, new_fapl; /* File access property list */ - hid_t fid, fid1; /* File IDs */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid1 = H5I_INVALID_HID; /* File ID */ H5F_retry_info_t info, info1; /* The collection of metadata retries */ H5F_t * f = NULL, *f1 = NULL; /* Internal file object pointers */ unsigned i, j, n; /* Local index variables */ - hid_t did1, did2; /* Dataset IDs */ - hid_t sid; /* Dataspace ID */ - hid_t dcpl; /* Dataset creation property list */ + hid_t did1 = H5I_INVALID_HID; /* Dataset ID */ + hid_t did2 = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ hsize_t dims[2] = {6, 10}; /* Dataset dimensions */ char filename[NAME_BUF_SIZE]; /* File name */ int buf[6][10], chkbuf1[6][10], chkbuf2[6][10]; /* Buffers for data */ @@ -1623,7 +1626,7 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR /* Should be 100 */ - if (attempts != (new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS)) + if (attempts != (unsigned int)(new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS)) TEST_ERROR; /* Close the property list */ @@ -4499,8 +4502,9 @@ error: static int test_file_lock_swmr_same(hid_t in_fapl) { - hid_t fid, fid2; /* File IDs */ - hid_t fapl; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File IDs */ + hid_t fid2 = H5I_INVALID_HID; + hid_t fapl = H5I_INVALID_HID; /* File access property list */ char filename[NAME_BUF_SIZE]; /* file name */ /* Output message about test being performed */ @@ -6556,10 +6560,18 @@ error: static int test_bug_refresh(hid_t in_fapl) { - hid_t fid = -1; /* File ID */ - hid_t fapl; + hid_t fid = H5I_INVALID_HID; + hid_t fapl = H5I_INVALID_HID; H5F_t *f; - hid_t gid1, gid2, gid3, gid4, gid5, gid6, gid7, gid8, gid9; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t gid3 = H5I_INVALID_HID; + hid_t gid4 = H5I_INVALID_HID; + hid_t gid5 = H5I_INVALID_HID; + hid_t gid6 = H5I_INVALID_HID; + hid_t gid7 = H5I_INVALID_HID; + hid_t gid8 = H5I_INVALID_HID; + hid_t gid9 = H5I_INVALID_HID; char filename[NAME_BUF_SIZE]; /* File name */ /* Create a copy of the input parameter in_fapl */ diff --git a/test/tfile.c b/test/tfile.c index 0d2926f..1861291 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5829,7 +5829,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n /* Get the internal file pointer if the create succeeds */ if (fid >= 0) { f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + CHECK_PTR(f, "H5VL_object"); } /* Retrieve the low/high bounds */ @@ -6005,7 +6005,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non /* Get the internal file pointer */ f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + CHECK_PTR(f, "H5VL_object"); /* The file's superblock version */ super_vers = f->shared->sblock->super_vers; @@ -6046,7 +6046,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non /* Get the internal file pointer if the open succeeds */ if (fid >= 0) { f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + CHECK_PTR(f, "H5VL_object"); } /* Verify the file open succeeds or fails */ @@ -6224,7 +6224,7 @@ test_libver_bounds_obj(hid_t fapl) /* Get the internal file pointer */ f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + CHECK_PTR(f, "H5VL_object"); /* Create a group in the file */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -6332,7 +6332,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Get the internal dataset pointer */ dset = (H5D_t *)H5VL_object(did); - CHECK(dset, NULL, "H5VL_object"); + CHECK_PTR(dset, "H5VL_object"); /* Verify version for layout and fill value messages */ if (low == H5F_LIBVER_EARLIEST) { @@ -6380,7 +6380,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Get the internal dataset pointer */ dset = (H5D_t *)H5VL_object(did); - CHECK(dset, NULL, "H5VL_object"); + CHECK_PTR(dset, "H5VL_object"); /* Verify layout message version and chunk indexing type */ VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_4, "H5O_layout_ver_bounds"); @@ -6442,7 +6442,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Get the internal file pointer */ f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + CHECK_PTR(f, "H5VL_object"); /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -6450,7 +6450,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Get the internal file pointer */ dset = (H5D_t *)H5VL_object(did); - CHECK(dset, NULL, "H5VL_object"); + CHECK_PTR(dset, "H5VL_object"); /* Verify the dataset's layout, fill value and filter pipeline message versions */ /* Also verify the chunk indexing type */ @@ -6571,7 +6571,7 @@ test_libver_bounds_dataspace(hid_t fapl) sid = H5Dget_space(did); CHECK(sid, H5I_INVALID_HID, "H5Dget_space"); space = (H5S_t *)H5I_object(sid); - CHECK(space, NULL, "H5I_object"); + CHECK_PTR(space, "H5I_object"); /* Verify the dataspace version */ VERIFY(space->extent.version, H5O_sdspace_ver_bounds[low], "H5O_sdspace_ver_bounds"); @@ -6588,7 +6588,7 @@ test_libver_bounds_dataspace(hid_t fapl) sid_null = H5Dget_space(did_null); CHECK(sid_null, H5I_INVALID_HID, "H5Dget_space"); space_null = (H5S_t *)H5I_object(sid_null); - CHECK(space_null, NULL, "H5I_object"); + CHECK_PTR(space_null, "H5I_object"); /* Verify the dataspace version */ VERIFY(space_null->extent.version, H5O_SDSPACE_VERSION_2, "H5O_sdspace_ver_bounds"); @@ -6666,7 +6666,7 @@ test_libver_bounds_dataspace(hid_t fapl) /* Get the internal file pointer */ f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + CHECK_PTR(f, "H5VL_object"); /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -6676,7 +6676,7 @@ test_libver_bounds_dataspace(hid_t fapl) tmp_sid = H5Dget_space(did); CHECK(tmp_sid, H5I_INVALID_HID, "H5Dget_space"); tmp_space = (H5S_t *)H5I_object(tmp_sid); - CHECK(tmp_space, NULL, "H5I_object"); + CHECK_PTR(tmp_space, "H5I_object"); /* Create the compact dataset */ did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact, @@ -6687,7 +6687,7 @@ test_libver_bounds_dataspace(hid_t fapl) tmp_sid_compact = H5Dget_space(did_compact); CHECK(tmp_sid_compact, H5I_INVALID_HID, "H5Dget_space"); tmp_space_compact = (H5S_t *)H5I_object(tmp_sid_compact); - CHECK(tmp_space_compact, NULL, "H5I_object"); + CHECK_PTR(tmp_space_compact, "H5I_object"); /* Create the contiguous dataset */ did_contig = @@ -6698,7 +6698,7 @@ test_libver_bounds_dataspace(hid_t fapl) tmp_sid_contig = H5Dget_space(did_contig); CHECK(tmp_sid_contig, H5I_INVALID_HID, "H5Dget_space"); tmp_space_contig = (H5S_t *)H5I_object(tmp_sid_contig); - CHECK(tmp_space_contig, NULL, "H5I_object"); + CHECK_PTR(tmp_space_contig, "H5I_object"); /* Verify versions for the three dataspaces */ VERIFY(tmp_space->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound], @@ -6922,7 +6922,7 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); - CHECK(dtype, NULL, "H5I_object"); + CHECK_PTR(dtype, "H5I_object"); /* Verify the datatype message version */ /* H5T_COMPOUND, H5T_ENUM, H5T_ARRAY: @@ -6996,13 +6996,13 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Get the internal file pointer */ f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + CHECK_PTR(f, "H5VL_object"); /* Open the committed datatype */ str_tid = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(str_tid, FAIL, "H5Topen2"); str_dtype = (H5T_t *)H5VL_object(str_tid); - CHECK(str_dtype, NULL, "H5VL_object"); + CHECK_PTR(str_dtype, "H5VL_object"); /* Verify the committed datatype message version */ VERIFY(str_dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], @@ -7022,7 +7022,7 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); - CHECK(dtype, NULL, "H5I_object"); + CHECK_PTR(dtype, "H5I_object"); /* Verify the dataset's datatype message version */ /* H5T_COMPOUND, H5T_ENUM, H5T_ARRAY: @@ -7155,7 +7155,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); - CHECK(attr, NULL, "H5VL_object"); + CHECK_PTR(attr, "H5VL_object"); /* Verify the attribute version */ if (low == H5F_LIBVER_EARLIEST) @@ -7174,7 +7174,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); - CHECK(attr, NULL, "H5VL_object"); + CHECK_PTR(attr, "H5VL_object"); /* Verify attribute version */ VERIFY(attr->shared->version, H5O_attr_ver_bounds[low], "H5O_attr_ver_bounds"); @@ -7195,7 +7195,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); - CHECK(attr, NULL, "H5VL_object"); + CHECK_PTR(attr, "H5VL_object"); /* Verify attribute version */ if (low == H5F_LIBVER_EARLIEST) @@ -7260,7 +7260,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); - CHECK(attr, NULL, "H5VL_object"); + CHECK_PTR(attr, "H5VL_object"); /* Verify the attribute version */ if (low == H5F_LIBVER_EARLIEST) @@ -7322,7 +7322,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal file pointer */ f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + CHECK_PTR(f, "H5VL_object"); /* Open the group */ gid = H5Gopen2(fid, GRP_NAME, H5P_DEFAULT); @@ -7334,7 +7334,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Get the internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); - CHECK(attr, NULL, "H5VL_object"); + CHECK_PTR(attr, "H5VL_object"); /* Verify the attribute message version */ VERIFY(attr->shared->version, H5O_attr_ver_bounds[f->shared->low_bound], diff --git a/test/th5s.c b/test/th5s.c index 8598e71..30c3396 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1246,7 +1246,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) if (sbuf_size > 0) { sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size); - CHECK(sbuf, NULL, "HDcalloc"); + CHECK_PTR(sbuf, "HDcalloc"); } /* Try decoding bogus buffer */ @@ -1308,7 +1308,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) if (null_size > 0) { null_sbuf = (unsigned char *)HDcalloc((size_t)1, null_size); - CHECK(null_sbuf, NULL, "HDcalloc"); + CHECK_PTR(null_sbuf, "HDcalloc"); } /* Encode the null dataspace in the buffer */ @@ -1344,7 +1344,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) if (scalar_size > 0) { scalar_buf = (unsigned char *)HDcalloc((size_t)1, scalar_size); - CHECK(scalar_buf, NULL, "HDcalloc"); + CHECK_PTR(scalar_buf, "HDcalloc"); } /* Encode the scalar dataspace in the buffer */ @@ -1438,7 +1438,7 @@ test_h5s_encode1(void) if (sbuf_size > 0) { sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size); - CHECK(sbuf, NULL, "HDcalloc"); + CHECK_PTR(sbuf, "HDcalloc"); } /* Try decoding bogus buffer */ @@ -1500,7 +1500,7 @@ test_h5s_encode1(void) if (null_size > 0) { null_sbuf = (unsigned char *)HDcalloc((size_t)1, null_size); - CHECK(null_sbuf, NULL, "HDcalloc"); + CHECK_PTR(null_sbuf, "HDcalloc"); } /* Encode the null dataspace in the buffer */ @@ -1536,7 +1536,7 @@ test_h5s_encode1(void) if (scalar_size > 0) { scalar_buf = (unsigned char *)HDcalloc((size_t)1, scalar_size); - CHECK(scalar_buf, NULL, "HDcalloc"); + CHECK_PTR(scalar_buf, "HDcalloc"); } /* Encode the scalar dataspace in the buffer */ @@ -1623,7 +1623,7 @@ test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, uint32_t expected_version, /* Allocate the buffer for encoding */ buf = (char *)HDmalloc(buf_size); - CHECK(buf, NULL, "H5Dmalloc"); + CHECK_PTR(buf, "H5Dmalloc"); /* Encode according to the setting in in_fapl */ ret = H5Sencode2(in_sid, buf, &buf_size, in_fapl); @@ -2149,7 +2149,7 @@ test_h5s_encode_length(void) /* Allocate the buffer */ if (sbuf_size > 0) { sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size); - CHECK(sbuf, NULL, "H5Sencode2"); + CHECK_PTR(sbuf, "H5Sencode2"); } /* Encode the dataspace */ @@ -3304,7 +3304,7 @@ test_versionbounds(void) /* Its version should be H5O_SDSPACE_VERSION_1 */ spacep = (H5S_t *)H5I_object(space); - CHECK(spacep, NULL, "H5I_object"); + CHECK_PTR(spacep, "H5I_object"); VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound"); /* Set high bound to V18 */ @@ -3325,7 +3325,7 @@ test_versionbounds(void) dset_space = H5Dget_space(dset); CHECK(dset_space, FAIL, "H5Dget_space"); spacep = (H5S_t *)H5I_object(dset_space); - CHECK(spacep, NULL, "H5I_object"); + CHECK_PTR(spacep, "H5I_object"); /* Dataspace version should remain as H5O_SDSPACE_VERSION_1 */ VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound"); @@ -3362,7 +3362,7 @@ test_versionbounds(void) dset_space = H5Dget_space(dset); CHECK(dset_space, FAIL, "H5Dget_space"); spacep = (H5S_t *)H5I_object(dset_space); - CHECK(spacep, NULL, "H5I_object"); + CHECK_PTR(spacep, "H5I_object"); /* Verify the dataspace version */ VERIFY(spacep->extent.version, H5O_sdspace_ver_bounds[low], "upgraded dataspace version"); diff --git a/test/tid.c b/test/tid.c index 662064f..1f30a4f 100644 --- a/test/tid.c +++ b/test/tid.c @@ -513,7 +513,7 @@ test_id_type_list(void) /* Sanity check */ if ((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) { /* Error condition, throw an error */ - CHECK(1, 1, "H5Iregister_type"); + ERROR("H5Iregister_type"); goto out; } /* Create types up to H5I_MAX_NUM_TYPES */ @@ -705,7 +705,7 @@ test_remove_clear_type(void) /* Create an array to hold the objects in the master list */ list_size = RCT_MAX_NOBJS * sizeof(rct_obj_t); obj_list.objects = HDmalloc(list_size); - CHECK(obj_list.objects, NULL, "HDcalloc"); + CHECK_PTR(obj_list.objects, "HDcalloc"); if (NULL == obj_list.objects) goto error; @@ -718,7 +718,7 @@ test_remove_clear_type(void) hsize_t nmembers = 1234567; /* The number of objects found while scanning through the object list */ - unsigned found; + int found; /********************* * Build object list * @@ -1080,7 +1080,7 @@ test_future_ids(void) VERIFY(*actual_obj2, 7, "H5Iobject_verify"); if (7 != *actual_obj2) goto error; - VERIFY(actual_obj, actual_obj2, "H5Iobject_verify"); + CHECK_PTR_EQ(actual_obj, actual_obj2, "H5Iobject_verify"); if (actual_obj != actual_obj2) goto error; @@ -1131,7 +1131,7 @@ test_future_ids(void) VERIFY(*actual_obj2, 7, "H5Iobject_verify"); if (7 != *actual_obj2) goto error; - VERIFY(actual_obj, actual_obj2, "H5Iobject_verify"); + CHECK_PTR_EQ(actual_obj, actual_obj2, "H5Iobject_verify"); if (actual_obj != actual_obj2) goto error; diff --git a/test/titerate.c b/test/titerate.c index c507beb..10ed039 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -952,7 +952,7 @@ test_links(hid_t fapl) else if (!HDstrcmp(obj_name, "softlink")) VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx"); else - CHECK(0, 0, "unknown object name"); + ERROR("unknown object name"); } /* end for */ ret = H5Gclose(gid); @@ -1122,7 +1122,7 @@ test_links_deprec(hid_t fapl) else if (!HDstrcmp(obj_name, "softlink")) VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx"); else - CHECK(0, 0, "unknown object name"); + ERROR("unknown object name"); } /* end for */ ret = H5Gclose(gid); diff --git a/test/tmisc.c b/test/tmisc.c index 8c7e53d..03f9952 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -3613,7 +3613,7 @@ test_misc19(void) /* Get a VOL class to register */ vol_cls = h5_get_dummy_vol_class(); - CHECK(vol_cls, NULL, "h5_get_dummy_vol_class"); + CHECK_PTR(vol_cls, "h5_get_dummy_vol_class"); /* Register a VOL connector */ volid = H5VLregister_connector(vol_cls, H5P_DEFAULT); diff --git a/test/tvltypes.c b/test/tvltypes.c index b8cbe6d..50b2d7a 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2508,8 +2508,8 @@ test_vltypes_fill_value(void) hid_t large_dspace_id; /* Dataspace ID for large datasets */ hid_t small_select_dspace_id; /* Dataspace ID for selection in small datasets */ hid_t large_select_dspace_id; /* Dataspace ID for selection in large datasets */ - hid_t dset_dspace_id; /* Dataspace ID for a particular dataset */ - hid_t dset_select_dspace_id; /* Dataspace ID for selection in a particular dataset */ + hid_t dset_dspace_id = -1; /* Dataspace ID for a particular dataset */ + hid_t dset_select_dspace_id = -1; /* Dataspace ID for selection in a particular dataset */ hid_t scalar_dspace_id; /* Dataspace ID for scalar dataspace */ hid_t single_dspace_id; /* Dataspace ID for single element selection */ hsize_t single_offset[] = {2}; /* Offset of single element selection */ @@ -2525,8 +2525,8 @@ test_vltypes_fill_value(void) hid_t dset_id; hsize_t small_dims[] = {SPACE4_DIM_SMALL}; hsize_t large_dims[] = {SPACE4_DIM_LARGE}; - size_t dset_elmts; /* Number of elements in a particular dataset */ - const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", + size_t dset_elmts = 0; /* Number of elements in a particular dataset */ + const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"}; const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"}; dtype1_struct * rbuf = NULL; /* Buffer for reading data */ -- cgit v0.12 From 1f637e49d98062562960dedff2a7c67423346c7d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 24 Mar 2021 13:38:05 -0700 Subject: Removes c99_(v)snprintf() calls from the standalone test code (#509) * Committing clang-format changes * Removes c99_(v)snprintf from standalone code These internal API calls were removed in a previous commit but were missed in the sio/pio_standalone code. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- tools/test/perform/pio_standalone.h | 44 ++++++++++++++----------------------- tools/test/perform/sio_standalone.h | 44 ++++++++++++++----------------------- 2 files changed, 32 insertions(+), 56 deletions(-) diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 09454a9..35a5217 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -348,15 +348,9 @@ H5_DLL int HDrand(void); #define HDsin(X) sin(X) #define HDsinh(X) sinh(X) #define HDsleep(N) sleep(N) -#ifdef H5_HAVE_WIN32_API -H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...); -#define HDsnprintf c99_snprintf /*varargs*/ -#else -#define HDsnprintf snprintf /*varargs*/ -#endif -/* sprintf() variable arguments */ -#define HDsprintf sprintf /*varargs*/ -#define HDsqrt(X) sqrt(X) +#define HDsnprintf snprintf /*varargs*/ +#define HDsprintf sprintf /*varargs*/ +#define HDsqrt(X) sqrt(X) #ifdef H5_HAVE_RAND_R H5_DLL void HDsrand(unsigned int seed); #define HDsrandom(S) HDsrand(S) @@ -367,7 +361,6 @@ H5_DLL void HDsrand(unsigned int seed); #define HDsrand(S) srand(S) #define HDsrandom(S) srand(S) #endif -/* sscanf() variable arguments */ #ifdef H5_HAVE_WIN32_API #define HDstrcasecmp(A, B) _stricmp(A, B) @@ -429,25 +422,20 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #else #define HDunlink(S) unlink(S) #endif -#define HDutime(S, T) utime(S, T) -#define HDva_arg(A, T) va_arg(A, T) -#define HDva_end(A) va_end(A) -#define HDva_start(A, P) va_start(A, P) -#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) -#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) -#define HDvprintf(FMT, A) vprintf(FMT, A) -#define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A) -#ifdef H5_HAVE_WIN32_API -H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap); -#define HDvsnprintf c99_vsnprintf -#else +#define HDutime(S, T) utime(S, T) +#define HDva_arg(A, T) va_arg(A, T) +#define HDva_end(A) va_end(A) +#define HDva_start(A, P) va_start(A, P) +#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) +#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) +#define HDvprintf(FMT, A) vprintf(FMT, A) +#define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A) #define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A) -#endif -#define HDwait(W) wait(W) -#define HDwaitpid(P, W, O) waitpid(P, W, O) -#define HDwcstombs(S, P, Z) wcstombs(S, P, Z) -#define HDwctomb(S, C) wctomb(S, C) -#define HDwrite(F, M, Z) write(F, M, Z) +#define HDwait(W) wait(W) +#define HDwaitpid(P, W, O) waitpid(P, W, O) +#define HDwcstombs(S, P, Z) wcstombs(S, P, Z) +#define HDwctomb(S, C) wctomb(S, C) +#define HDwrite(F, M, Z) write(F, M, Z) /* * And now for a couple non-Posix functions... Watch out for systems that diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index a85f93e..d8b6412 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -363,15 +363,9 @@ H5_DLL int HDrand(void); #define HDsin(X) sin(X) #define HDsinh(X) sinh(X) #define HDsleep(N) sleep(N) -#ifdef H5_HAVE_WIN32_API -H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...); -#define HDsnprintf c99_snprintf /*varargs*/ -#else -#define HDsnprintf snprintf /*varargs*/ -#endif -/* sprintf() variable arguments */ -#define HDsprintf sprintf /*varargs*/ -#define HDsqrt(X) sqrt(X) +#define HDsnprintf snprintf /*varargs*/ +#define HDsprintf sprintf /*varargs*/ +#define HDsqrt(X) sqrt(X) #ifdef H5_HAVE_RAND_R H5_DLL void HDsrand(unsigned int seed); #define HDsrandom(S) HDsrand(S) @@ -382,7 +376,6 @@ H5_DLL void HDsrand(unsigned int seed); #define HDsrand(S) srand(S) #define HDsrandom(S) srand(S) #endif -/* sscanf() variable arguments */ #ifdef H5_HAVE_WIN32_API #define HDstrcasecmp(A, B) _stricmp(A, B) @@ -444,25 +437,20 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #else #define HDunlink(S) unlink(S) #endif -#define HDutime(S, T) utime(S, T) -#define HDva_arg(A, T) va_arg(A, T) -#define HDva_end(A) va_end(A) -#define HDva_start(A, P) va_start(A, P) -#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) -#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) -#define HDvprintf(FMT, A) vprintf(FMT, A) -#define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A) -#ifdef H5_HAVE_WIN32_API -H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap); -#define HDvsnprintf c99_vsnprintf -#else +#define HDutime(S, T) utime(S, T) +#define HDva_arg(A, T) va_arg(A, T) +#define HDva_end(A) va_end(A) +#define HDva_start(A, P) va_start(A, P) +#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) +#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) +#define HDvprintf(FMT, A) vprintf(FMT, A) +#define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A) #define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A) -#endif -#define HDwait(W) wait(W) -#define HDwaitpid(P, W, O) waitpid(P, W, O) -#define HDwcstombs(S, P, Z) wcstombs(S, P, Z) -#define HDwctomb(S, C) wctomb(S, C) -#define HDwrite(F, M, Z) write(F, M, Z) +#define HDwait(W) wait(W) +#define HDwaitpid(P, W, O) waitpid(P, W, O) +#define HDwcstombs(S, P, Z) wcstombs(S, P, Z) +#define HDwctomb(S, C) wctomb(S, C) +#define HDwrite(F, M, Z) write(F, M, Z) /* * And now for a couple non-Posix functions... Watch out for systems that -- cgit v0.12 From 3dbbd8aea1b8389ad7df0c982c9a78a9a2d4dee8 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 24 Mar 2021 15:57:32 -0500 Subject: Align with "parallel fence" changes (#479) * Small code updates and simplifications * Committing clang-format changes * Fix 'make installcheck' for parallel builds Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- examples/testh5cc.sh.in | 6 +++ src/H5AC.c | 15 ++---- src/H5ACmpio.c | 12 ++--- src/H5C.c | 31 +++-------- src/H5Cmpio.c | 67 +++++++++-------------- src/H5FDmpio.c | 83 +++++++++++++++------------- src/H5Fint.c | 10 ++-- src/H5Fmpi.c | 29 ---------- src/H5Fpkg.h | 1 - src/H5Fprivate.h | 1 - testpar/t_bigio.c | 95 +++++--------------------------- testpar/t_cache.c | 50 +++++------------ testpar/t_mdset.c | 141 ++++++++++-------------------------------------- 13 files changed, 148 insertions(+), 393 deletions(-) diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 0c122c7..ba80f2d 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -91,6 +91,8 @@ temp_FILES="a.out $applib" cat > $appmain < $prog1 < +void sub1(void) { printf("in sub1\n"); @@ -123,6 +127,8 @@ EOF # generate prog2 cat > $prog2 < +void sub2(void) { printf("in sub2\n"); diff --git a/src/H5AC.c b/src/H5AC.c index ffdca78..2eadd21 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -350,19 +350,14 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co if (NULL == (aux_ptr->candidate_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list") - if (aux_ptr != NULL) - if (aux_ptr->mpi_rank == 0) - f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, - (H5AC_NTYPES - 1), H5AC_class_s, H5AC__check_if_write_permitted, - TRUE, H5AC__log_flushed_entry, (void *)aux_ptr); - else - f->shared->cache = - H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1), - H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, (void *)aux_ptr); + if (aux_ptr->mpi_rank == 0) + f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, + (H5AC_NTYPES - 1), H5AC_class_s, H5AC__check_if_write_permitted, + TRUE, H5AC__log_flushed_entry, (void *)aux_ptr); else f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1), - H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, NULL); + H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, (void *)aux_ptr); } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 140fd96..7d2ba25 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -1271,7 +1271,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) if (aux_ptr->write_done) (aux_ptr->write_done)(); - /* to prevent "messages from the past" we must synchronize all + /* To prevent "messages from the past" we must synchronize all * processes again before we go on. */ if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) @@ -1514,7 +1514,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list") if (num_entries > 0) - /* mark the indicated entries as clean */ + /* Mark the indicated entries as clean */ if (H5C_mark_entries_as_clean(f, num_entries, haddr_buf_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean.") @@ -1900,28 +1900,22 @@ H5AC__rsp__p0_only__flush(H5F_t *f) /* Check for error on the write operation */ if (result < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") /* this code exists primarily for the test bed -- it allows us to * enforce POSIX semantics on the server that pretends to be a * file system in our parallel tests. */ - if (aux_ptr->write_done) { - + if (aux_ptr->write_done) (aux_ptr->write_done)(); - } } /* end if */ /* Propagate cleaned entries to other ranks. */ if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC__rsp__p0_only__flush() */ /*------------------------------------------------------------------------- diff --git a/src/H5C.c b/src/H5C.c index 551a2b2..1b885e3 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -21,14 +21,8 @@ * things which exist on disk, and which may be * unambiguously referenced by their disk addresses. * - * The code in this module was initially written in - * support of a complete re-write of the metadata cache - * in H5AC.c However, other uses for the cache code - * suggested themselves, and thus this file was created - * in an attempt to support re-use. - * - * For a detailed overview of the cache, please see the - * header comment for H5C_t in H5Cpkg.h. + * For a detailed overview of the cache, please see the + * header comment for H5C_t in H5Cpkg.h. * *------------------------------------------------------------------------- */ @@ -39,9 +33,7 @@ * * Code Changes: * - * - Remove extra functionality in H5C__flush_single_entry()? - * - * - Change protect/unprotect to lock/unlock. + * - Change protect/unprotect to lock/unlock. * * - Flush entries in increasing address order in * H5C__make_space_in_cache(). @@ -53,18 +45,9 @@ * I/O overhead. Can't do this just yet as some entries are not * contiguous. Do this in parallel only or in serial as well? * - * - Create MPI type for dirty objects when flushing in parallel. - * - * - Now that TBBT routines aren't used, fix nodes in memory to - * point directly to the skip list node from the LRU list, eliminating - * skip list lookups when evicting objects from the cache. - * - * Tests: - * - * - Trim execution time. (This is no longer a major issue with the - * shift from the TBBT to a hash table for indexing.) - * - * - Add random tests. + * - Fix nodes in memory to point directly to the skip list node from + * the LRU list, eliminating skip list lookups when evicting objects + * from the cache. * **************************************************************************/ @@ -6650,9 +6633,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) } if (H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file") - #ifdef H5_HAVE_PARALLEL } #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 7a5c630..66c6601 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -154,19 +154,12 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned * Programmer: John Mainzer * 3/17/10 * - * Changes: Updated sanity checks to allow for the possibility that - * the slist is disabled. - * JRM -- 8/3/20 - * *------------------------------------------------------------------------- */ herr_t H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr, int mpi_rank, int mpi_size) { - int i; - int m; - unsigned n; unsigned first_entry_to_flush; unsigned last_entry_to_flush; unsigned total_entries_to_clear = 0; @@ -176,15 +169,13 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha unsigned entries_to_clear[H5C_RING_NTYPES]; haddr_t addr; H5C_cache_entry_t *entry_ptr = NULL; - #if H5C_DO_SANITY_CHECKS haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ - #if H5C_APPLY_CANDIDATE_LIST__DEBUG char tbl_buf[1024]; #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - + unsigned m, n; unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -226,9 +217,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha } /* end if */ n = num_candidates / (unsigned)mpi_size; - if (num_candidates % (unsigned)mpi_size > INT_MAX) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "m overflow") - m = (int)(num_candidates % (unsigned)mpi_size); + m = num_candidates % (unsigned)mpi_size; if (NULL == (candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1)))) @@ -239,31 +228,31 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha candidate_assignment_table[mpi_size] = num_candidates; if (m == 0) { /* mpi_size is an even divisor of num_candidates */ - for (i = 1; i < mpi_size; i++) - candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n; + for (u = 1; u < (unsigned)mpi_size; u++) + candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n; } /* end if */ else { - for (i = 1; i <= m; i++) - candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1; + for (u = 1; u <= m; u++) + candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n + 1; if (num_candidates < (unsigned)mpi_size) { - for (i = m + 1; i < mpi_size; i++) - candidate_assignment_table[i] = num_candidates; + for (u = m + 1; u < (unsigned)mpi_size; u++) + candidate_assignment_table[u] = num_candidates; } /* end if */ else { - for (i = m + 1; i < mpi_size; i++) - candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n; + for (u = m + 1; u < (unsigned)mpi_size; u++) + candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n; } /* end else */ } /* end else */ HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates); #if H5C_DO_SANITY_CHECKS /* Verify that the candidate assignment table has the expected form */ - for (i = 1; i < mpi_size - 1; i++) { + for (u = 1; u < (unsigned)(mpi_size - 1); u++) { unsigned a, b; - a = candidate_assignment_table[i] - candidate_assignment_table[i - 1]; - b = candidate_assignment_table[i + 1] - candidate_assignment_table[i]; + a = candidate_assignment_table[u] - candidate_assignment_table[u - 1]; + b = candidate_assignment_table[u + 1] - candidate_assignment_table[u]; HDassert(n + 1 >= a); HDassert(a >= b); @@ -275,11 +264,11 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha last_entry_to_flush = candidate_assignment_table[mpi_rank + 1] - 1; #if H5C_APPLY_CANDIDATE_LIST__DEBUG - for (i = 0; i < 1024; i++) - tbl_buf[i] = '\0'; + for (u = 0; u < 1024; u++) + tbl_buf[u] = '\0'; HDsprintf(&(tbl_buf[0]), "candidate assignment table = "); - for (i = 0; i <= mpi_size; i++) - HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[i]); + for (u = 0; u <= (unsigned)mpi_size; u++) + HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); HDfprintf(stdout, "%s", tbl_buf); @@ -354,9 +343,9 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha #if H5C_DO_SANITY_CHECKS m = 0; n = 0; - for (i = 0; i < H5C_RING_NTYPES; i++) { - m += (int)entries_to_flush[i]; - n += entries_to_clear[i]; + for (u = 0; u < H5C_RING_NTYPES; u++) { + m += entries_to_flush[u]; + n += entries_to_clear[u]; } /* end if */ HDassert((unsigned)m == total_entries_to_flush); @@ -957,10 +946,8 @@ H5C__collective_write(H5F_t *f) int * length_array = NULL; MPI_Aint * buf_array = NULL; MPI_Aint * offset_array = NULL; - MPI_Datatype btype; - hbool_t btype_created = FALSE; - MPI_Datatype ftype; - hbool_t ftype_created = FALSE; + MPI_Datatype btype = MPI_BYTE; + MPI_Datatype ftype = MPI_BYTE; int mpi_code; char unused = 0; /* Unused, except for non-NULL pointer value */ size_t buf_count; @@ -1032,7 +1019,6 @@ H5C__collective_write(H5F_t *f) if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - btype_created = TRUE; if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) @@ -1040,7 +1026,6 @@ H5C__collective_write(H5F_t *f) if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - ftype_created = TRUE; if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) @@ -1048,10 +1033,6 @@ H5C__collective_write(H5F_t *f) buf_count = 1; } /* end if */ else { - /* Pass trivial buf type, file type to the file driver */ - btype = MPI_BYTE; - ftype = MPI_BYTE; - /* Set non-NULL pointer for I/O operation */ base_buf = &unused; @@ -1074,9 +1055,9 @@ done: offset_array = (MPI_Aint *)H5MM_xfree(offset_array); /* Free MPI Types */ - if (btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype))) + if (MPI_BYTE != btype && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype))) + if (MPI_BYTE != ftype && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) /* Reset transfer mode in API context, if changed */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index f0a6842..f79b9cd 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -750,18 +750,18 @@ done: static H5FD_t * H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { - H5FD_mpio_t * file = NULL; - MPI_File fh; - hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */ - int mpi_amode; - int mpi_rank; /* MPI rank of this process */ - int mpi_size; /* Total number of MPI processes */ - int mpi_code; /* MPI return code */ - MPI_Offset size; - H5P_genplist_t *plist; /* Property list pointer */ - MPI_Comm comm = MPI_COMM_NULL; - MPI_Info info = MPI_INFO_NULL; - H5FD_t * ret_value = NULL; /* Return value */ + H5FD_mpio_t * file = NULL; /* VFD File struct for new file */ + H5P_genplist_t *plist; /* Property list pointer */ + MPI_Comm comm = MPI_COMM_NULL; /* MPI Communicator, from plist */ + MPI_Info info = MPI_INFO_NULL; /* MPI Info, from plist */ + MPI_File fh; /* MPI file handle */ + hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */ + int mpi_amode; /* MPI file access flags */ + int mpi_rank = INT_MAX; /* MPI rank of this process */ + int mpi_size; /* Total number of MPI processes */ + int mpi_code; /* MPI return code */ + MPI_Offset file_size; /* File size (of existing files) */ + H5FD_t * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -781,6 +781,12 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object") + /* Get the MPI rank of this process and the total number of processes */ + if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank))) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code) + if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size))) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code) + /* Convert HDF5 flags to MPI-IO flags */ /* Some combinations are illegal; let MPI-IO figure it out */ mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; @@ -810,12 +816,6 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code) file_opened = TRUE; - /* Get the MPI rank of this process and the total number of processes */ - if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code) - if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code) - /* Build the return value and initialize it */ if (NULL == (file = (H5FD_mpio_t *)H5MM_calloc(sizeof(H5FD_mpio_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -826,17 +826,16 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR file->mpi_size = mpi_size; /* Only processor p0 will get the filesize and broadcast it. */ - if (mpi_rank == 0) { - if (MPI_SUCCESS != (mpi_code = MPI_File_get_size(fh, &size))) + if (mpi_rank == 0) + if (MPI_SUCCESS != (mpi_code = MPI_File_get_size(fh, &file_size))) HMPI_GOTO_ERROR(NULL, "MPI_File_get_size failed", mpi_code) - } /* end if */ /* Broadcast file size */ - if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm))) + if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&file_size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) /* Determine if the file should be truncated */ - if (size && (flags & H5F_ACC_TRUNC)) { + if (file_size && (flags & H5F_ACC_TRUNC)) { if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(fh, (MPI_Offset)0))) HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code) @@ -845,11 +844,11 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR HMPI_GOTO_ERROR(NULL, "MPI_Barrier failed", mpi_code) /* File is zero size now */ - size = 0; + file_size = 0; } /* end if */ /* Set the size of the file (from library's perspective) */ - file->eof = H5FD_mpi_MPIOff_to_haddr(size); + file->eof = H5FD_mpi_MPIOff_to_haddr(file_size); file->local_eof = file->eof; /* Set return value */ @@ -906,7 +905,7 @@ H5FD__mpio_close(H5FD_t *_file) HDassert(H5FD_MPIO == file->pub.driver_id); /* MPI_File_close sets argument to MPI_FILE_NULL */ - if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f) /*in,out*/))) + if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f)))) HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code) /* Clean up other stuff */ @@ -1228,8 +1227,10 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (MPI_SUCCESS != (mpi_code = MPI_Bcast(buf, size_i, buf_type, 0, file->comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code) } /* end if */ - else if (MPI_SUCCESS != - (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + else + /* Perform collective read operation */ + if (MPI_SUCCESS != + (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code) } /* end if */ else { @@ -1238,6 +1239,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); #endif + /* Perform independent read operation */ if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) @@ -1250,7 +1252,9 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ - else if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + else + /* Perform independent read operation */ + if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) /* Only retrieve bytes read if this rank _actually_ participated in I/O */ @@ -1446,6 +1450,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (H5FD_mpio_Debug[(int)'w']) HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); #endif + /* Perform collective write operation */ if (MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) @@ -1458,6 +1463,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (H5FD_mpio_Debug[(int)'w']) HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); #endif + /* Perform independent write operation */ if (MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) @@ -1468,8 +1474,9 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ - else if (MPI_SUCCESS != - (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + else + /* Perform independent write operation */ + if (MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) /* How many bytes were actually written? */ @@ -1507,9 +1514,9 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h file->local_eof = addr + (haddr_t)bytes_written; done: - if (derived_type) { + if (derived_type) MPI_Type_free(&buf_type); - } + #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value); @@ -1569,13 +1576,14 @@ done: * * This is a little sticky in the mpio case, as it is not * easy for us to track the current EOF by extracting it from - * write calls. + * write calls, since other ranks could have written to the + * file beyond the local EOF. * - * Instead, we first check to see if the eoa has changed since + * Instead, we first check to see if the EOA has changed since * the last call to this function. If it has, we call * MPI_File_get_size() to determine the current EOF, and * only call MPI_File_set_size() if this value disagrees - * with the current eoa. + * with the current EOA. * * Return: SUCCEED/FAIL * @@ -1637,7 +1645,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR if (H5FD_mpi_haddr_to_MPIOff(file->eoa, &needed_eof) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset") - /* eoa != eof. Set eof to eoa */ + /* EOA != EOF. Set EOF to EOA */ if (size != needed_eof) { /* Extend the file's size */ if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(file->f, needed_eof))) @@ -1749,5 +1757,4 @@ H5FD__mpio_communicator(const H5FD_t *_file) FUNC_LEAVE_NOAPI(file->comm) } /* end H5FD__mpio_communicator() */ - #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 6da9473..ed6b9c1 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -81,6 +81,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); @@ -1379,12 +1380,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); @@ -2512,11 +2513,6 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) if (H5F__efc_try_close(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't attempt to close EFC") - /* Delay flush until the shared file struct is closed, in H5F__dest. If the - * application called H5Fclose, it would have been flushed in that function - * (unless it will have been flushed in H5F__dest anyways). - */ - /* Destroy the H5F_t struct and decrement the reference count for the * shared H5F_shared_t struct. If the reference count for the H5F_shared_t * struct reaches zero then destroy it also. diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 3336d4f..4b5283e 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -68,35 +68,6 @@ /*******************/ #ifdef H5_HAVE_PARALLEL - -/*------------------------------------------------------------------------- - * Function: H5F_get_mpi_handle - * - * Purpose: Retrieves MPI File handle. - * - * Return: Success: The size (positive) - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle) -{ - herr_t ret_value = SUCCEED; - hid_t fapl_id = H5I_INVALID_HID; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(f && f->shared); - - /* Dispatch to driver */ - if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl_id, (void **)f_handle)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_mpi_handle() */ - /*------------------------------------------------------------------------- * Function: H5F_mpi_get_rank * diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 371260d..087c9c9 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -405,7 +405,6 @@ 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); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0c75cf0..5c5937b 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -955,7 +955,6 @@ H5_DLL herr_t H5F_eoa_dirty(H5F_t *f); /* Parallel I/O (i.e. MPI) related routines */ #ifdef H5_HAVE_PARALLEL -H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); 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); diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index 7884ecb..ed99fc4 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -1104,7 +1104,7 @@ static void single_rank_independent_io(void) { if (mpi_rank_g == 0) - HDprintf("single_rank_independent_io\n"); + HDprintf("\nSingle Rank Independent I/O\n"); if (MAIN_PROCESS) { hsize_t dims[] = {LARGE_DIM}; @@ -1223,8 +1223,6 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) * Programmer: Unknown * July 12th, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -1250,7 +1248,7 @@ coll_chunk1(void) { const char *filename = FILENAME[0]; if (mpi_rank_g == 0) - HDprintf("coll_chunk1\n"); + HDprintf("\nCollective chunk I/O Test #1\n"); coll_chunktest(filename, 1, BYROW_CONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); coll_chunktest(filename, 1, BYROW_CONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); @@ -1303,7 +1301,7 @@ coll_chunk2(void) { const char *filename = FILENAME[0]; if (mpi_rank_g == 0) - HDprintf("coll_chunk2\n"); + HDprintf("\nCollective chunk I/O Test #2\n"); coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); @@ -1329,8 +1327,6 @@ coll_chunk2(void) * Programmer: Unknown * July 12th, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -1357,7 +1353,7 @@ coll_chunk3(void) { const char *filename = FILENAME[0]; if (mpi_rank_g == 0) - HDprintf("coll_chunk3\n"); + HDprintf("\nCollective chunk I/O Test #3\n"); coll_chunktest(filename, mpi_size_g, BYROW_CONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); coll_chunktest(filename, mpi_size_g, BYROW_CONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); @@ -1385,17 +1381,9 @@ coll_chunk3(void) * * Failure: -1 * - * Modifications: - * Remove invalid temporary property checkings for API_LINK_HARD and - * API_LINK_TRUE cases. - * Programmer: Jonathan Kim - * Date: 2012-10-10 - * * Programmer: Unknown * July 12th, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -1845,55 +1833,10 @@ coll_chunktest(const char *filename, int chunk_factor, int select_factor, int ap HDfree(data_origin1); } -/***************************************************************************** - * - * Function: do_express_test() - * - * Purpose: Do an MPI_Allreduce to obtain the maximum value returned - * by GetTestExpress() across all processes. Return this - * value. - * - * Envirmoment variables can be different across different - * processes. This function ensures that all processes agree - * on whether to do an express test. - * - * Return: Success: Maximum of the values returned by - * GetTestExpress() across all processes. - * - * Failure: -1 - * - * Programmer: JRM -- 4/25/06 - * - *****************************************************************************/ -static int -do_express_test(int world_mpi_rank) -{ - int express_test; - int max_express_test; - int result; - - express_test = GetTestExpress(); - - result = - MPI_Allreduce((void *)&express_test, (void *)&max_express_test, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); - - if (result != MPI_SUCCESS) { - nerrors++; - max_express_test = -1; - if (VERBOSE_MED && (world_mpi_rank == 0)) { - HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n", world_mpi_rank, FUNC); - } - } - - return (max_express_test); - -} /* do_express_test() */ - int main(int argc, char **argv) { - int ExpressMode = 0; - hsize_t newsize = 1048576; + hsize_t newsize = 1048576; /* Set the bigio processing limit to be 'newsize' bytes */ hsize_t oldsize = H5_mpi_set_bigio_count(newsize); @@ -1902,9 +1845,8 @@ main(int argc, char **argv) * that we try to ensure that our bigio handling is actually * envoked and tested. */ - if (newsize != oldsize) { + if (newsize != oldsize) bigcount = newsize * 2; - } MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size_g); @@ -1915,34 +1857,25 @@ main(int argc, char **argv) * hang in the atexit post processing in which it may try to make MPI * calls. By then, MPI calls may not work. */ - if (H5dont_atexit() < 0) { + if (H5dont_atexit() < 0) HDprintf("Failed to turn off atexit processing. Continue.\n"); - }; /* set alarm. */ ALARM_ON; - ExpressMode = do_express_test(mpi_rank_g); - dataset_big_write(); MPI_Barrier(MPI_COMM_WORLD); dataset_big_read(); MPI_Barrier(MPI_COMM_WORLD); - if (ExpressMode > 0) { - if (mpi_rank_g == 0) - HDprintf("***Express test mode on. Several tests are skipped\n"); - } - else { - coll_chunk1(); - MPI_Barrier(MPI_COMM_WORLD); - coll_chunk2(); - MPI_Barrier(MPI_COMM_WORLD); - coll_chunk3(); - MPI_Barrier(MPI_COMM_WORLD); - single_rank_independent_io(); - } + coll_chunk1(); + MPI_Barrier(MPI_COMM_WORLD); + coll_chunk2(); + MPI_Barrier(MPI_COMM_WORLD); + coll_chunk3(); + MPI_Barrier(MPI_COMM_WORLD); + single_rank_independent_io(); /* turn off alarm */ ALARM_OFF; diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 4846a75..4cf1139 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -6874,28 +6874,20 @@ main(int argc, char **argv) * hang in the atexit post processing in which it may try to make MPI * calls. By then, MPI calls may not work. */ - if (H5dont_atexit() < 0) { + if (H5dont_atexit() < 0) HDprintf("%d:Failed to turn off atexit processing. Continue.\n", mpi_rank); - }; + H5open(); express_test = do_express_test(); -#if 0 /* JRM */ - express_test = 0; -#endif /* JRM */ - if (express_test) { - + if (express_test) virt_num_data_entries = EXPRESS_VIRT_NUM_DATA_ENTRIES; - } - else { - + else virt_num_data_entries = STD_VIRT_NUM_DATA_ENTRIES; - } #ifdef H5_HAVE_MPE - if (MAINPROCESS) { + if (MAINPROCESS) HDprintf(" Tests compiled for MPE.\n"); - } virt_num_data_entries = MPE_VIRT_NUM_DATA_ENTIES; #endif /* H5_HAVE_MPE */ @@ -6908,11 +6900,8 @@ main(int argc, char **argv) } if (mpi_size < 3) { - - if (MAINPROCESS) { - + if (MAINPROCESS) HDprintf(" Need at least 3 processes. Exiting.\n"); - } goto finish; } @@ -6930,27 +6919,22 @@ main(int argc, char **argv) /* setup file access property list with the world communicator */ if (FAIL == (fapl = H5Pcreate(H5P_FILE_ACCESS))) { nerrors++; - if (verbose) { + if (verbose) HDfprintf(stdout, "%d:%s: H5Pcreate() failed 1.\n", world_mpi_rank, FUNC); - } } if (H5Pset_fapl_mpio(fapl, world_mpi_comm, MPI_INFO_NULL) < 0) { - nerrors++; - if (verbose) { + if (verbose) HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 1.\n", world_mpi_rank, FUNC); - } } /* fix the file names */ for (u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u) { if (h5_fixname(FILENAME[u], fapl, filenames[u], sizeof(filenames[u])) == NULL) { - nerrors++; - if (verbose) { + if (verbose) HDfprintf(stdout, "%d:%s: h5_fixname() failed.\n", world_mpi_rank, FUNC); - } break; } } @@ -6958,9 +6942,8 @@ main(int argc, char **argv) /* close the fapl before we set it up again */ if (H5Pclose(fapl) < 0) { nerrors++; - if (verbose) { + if (verbose) HDfprintf(stdout, "%d:%s: H5Pclose() failed.\n", world_mpi_rank, FUNC); - } } /* now create the fapl again, excluding the server process. */ @@ -6969,32 +6952,25 @@ main(int argc, char **argv) /* setup file access property list */ if (FAIL == (fapl = H5Pcreate(H5P_FILE_ACCESS))) { nerrors++; - if (verbose) { + if (verbose) HDfprintf(stdout, "%d:%s: H5Pcreate() failed 2.\n", world_mpi_rank, FUNC); - } } if (H5Pset_fapl_mpio(fapl, file_mpi_comm, MPI_INFO_NULL) < 0) { - nerrors++; - if (verbose) { + if (verbose) HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 2.\n", world_mpi_rank, FUNC); - } } } setup_rand(); max_nerrors = get_max_nerrors(); - if (max_nerrors != 0) { /* errors in setup -- no point in continuing */ - - if (world_mpi_rank == 0) { - + if (world_mpi_rank == 0) HDfprintf(stdout, "Errors in test initialization. Exiting.\n"); - } goto finish; } diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 2eca297..3041e77 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -129,12 +129,6 @@ zero_dim_dset(void) /* * Example of using PHDF5 to create ndatasets datasets. Each process write * a slab of array to the file. - * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. - * - * JRM - 8/11/04 */ void multiple_dset_write(void) @@ -218,12 +212,6 @@ multiple_dset_write(void) } /* Example of using PHDF5 to create, write, and read compact dataset. - * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. - * - * JRM - 8/11/04 */ void compact_dataset(void) @@ -353,14 +341,6 @@ compact_dataset(void) /* * Example of using PHDF5 to create, write, and read dataset and attribute * of Null dataspace. - * - * Changes: Removed the assert that mpi_size <= the SIZE #define. - * As best I can tell, this assert isn't needed here, - * and in any case, the SIZE #define is being removed - * in an update of the functions in this file to run - * with an arbitrary number of processes. - * - * JRM - 8/24/04 */ void null_dataset(void) @@ -465,14 +445,6 @@ null_dataset(void) * Actual data is _not_ written to these datasets. Dataspaces are exact * sizes(2GB, 4GB, etc.), but the metadata for the file pushes the file over * the boundary of interest. - * - * Changes: Removed the assert that mpi_size <= the SIZE #define. - * As best I can tell, this assert isn't needed here, - * and in any case, the SIZE #define is being removed - * in an update of the functions in this file to run - * with an arbitrary number of processes. - * - * JRM - 8/11/04 */ void big_dataset(void) @@ -594,16 +566,6 @@ big_dataset(void) /* Example of using PHDF5 to read a partial written dataset. The dataset does * not have actual data written to the entire raw data area and relies on the * default fill value of zeros to work correctly. - * - * Changes: Removed the assert that mpi_size <= the SIZE #define. - * As best I can tell, this assert isn't needed here, - * and in any case, the SIZE #define is being removed - * in an update of the functions in this file to run - * with an arbitrary number of processes. - * - * Also added code to free dynamically allocated buffers. - * - * JRM - 8/11/04 */ void dataset_fillvalue(void) @@ -710,15 +672,16 @@ dataset_fillvalue(void) for (i = 0; i < (int)dset_dims[0]; i++) for (j = 0; j < (int)dset_dims[1]; j++) for (k = 0; k < (int)dset_dims[2]; k++) - for (l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++) + for (l = 0; l < (int)dset_dims[3]; l++, trdata++) if (*trdata != 0) if (err_num++ < MAX_ERR_REPORT || VERBOSE_MED) - HDprintf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, - j, k, l, *trdata); + HDprintf( + "Rank %d: Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", + mpi_rank, i, j, k, l, *trdata); if (err_num > MAX_ERR_REPORT && !VERBOSE_MED) - HDprintf("[more errors ...]\n"); + HDprintf("Rank %d: [more errors ...]\n", mpi_rank); if (err_num) { - HDprintf("%d errors found in check_value\n", err_num); + HDprintf("Rank %d: %d errors found in check_value\n", mpi_rank, err_num); nerrors++; } } @@ -856,12 +819,6 @@ collective_group_write_independent_group_read(void) /* Write multiple groups with a chunked dataset in each group collectively. * These groups and datasets are for testing independent read later. - * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. - * - * JRM - 8/16/04 */ void collective_group_write(void) @@ -896,6 +853,7 @@ collective_group_write(void) plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist); + VRFY((fid >= 0), "H5Fcreate"); H5Pclose(plist); /* decide the hyperslab according to process number. */ @@ -909,13 +867,13 @@ collective_group_write(void) ret2 = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims); VRFY((memspace >= 0), "memspace"); VRFY((filespace >= 0), "filespace"); - VRFY((ret1 >= 0), "mgroup memspace selection"); - VRFY((ret2 >= 0), "mgroup filespace selection"); + VRFY((ret1 == 0), "mgroup memspace selection"); + VRFY((ret2 == 0), "mgroup filespace selection"); dcpl = H5Pcreate(H5P_DATASET_CREATE); ret1 = H5Pset_chunk(dcpl, 2, chunk_size); VRFY((dcpl >= 0), "dataset creation property"); - VRFY((ret1 >= 0), "set chunk for dataset creation property"); + VRFY((ret1 == 0), "set chunk for dataset creation property"); /* creates ngroups groups under the root group, writes chunked * datasets in parallel. */ @@ -932,10 +890,14 @@ collective_group_write(void) for (j = 0; j < size; j++) outme[(i * size) + j] = (i + j) * 1000 + mpi_rank; - H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, outme); + ret1 = H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, outme); + VRFY((ret1 == 0), "H5Dwrite"); - H5Dclose(did); - H5Gclose(gid); + ret1 = H5Dclose(did); + VRFY((ret1 == 0), "H5Dclose"); + + ret1 = H5Gclose(gid); + VRFY((ret1 == 0), "H5Gclose"); #ifdef BARRIER_CHECKS if (!((m + 1) % 10)) { @@ -948,7 +910,9 @@ collective_group_write(void) H5Pclose(dcpl); H5Sclose(filespace); H5Sclose(memspace); - H5Fclose(fid); + + ret1 = H5Fclose(fid); + VRFY((ret1 == 0), "H5Fclose"); HDfree(outme); } @@ -964,6 +928,7 @@ independent_group_read(void) const H5Ptest_param_t *pt; char * filename; int ngroups; + herr_t ret; pt = GetTestParameters(); filename = pt->name; @@ -975,6 +940,7 @@ independent_group_read(void) H5Pset_all_coll_metadata_ops(plist, FALSE); fid = H5Fopen(filename, H5F_ACC_RDONLY, plist); + VRFY((fid > 0), "H5Fopen"); H5Pclose(plist); /* open groups and read datasets. Odd number processes read even number @@ -989,20 +955,11 @@ independent_group_read(void) group_dataset_read(fid, mpi_rank, m); } - H5Fclose(fid); + ret = H5Fclose(fid); + VRFY((ret == 0), "H5Fclose"); } /* Open and read datasets and compare data - * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. - * - * Also added code to verify the results of dynamic memory - * allocations, and to free dynamically allocated memeory - * when we are done with it. - * - * JRM - 8/16/04 */ static void group_dataset_read(hid_t fid, int mpi_rank, int m) @@ -1035,16 +992,17 @@ group_dataset_read(hid_t fid, int mpi_rank, int m) /* this is the original value */ for (i = 0; i < size; i++) - for (j = 0; j < size; j++) { + for (j = 0; j < size; j++) outdata[(i * size) + j] = (i + j) * 1000 + mpi_rank; - } /* compare the original value(outdata) to the value in file(indata).*/ ret = check_value(indata, outdata, size); VRFY((ret == 0), "check the data"); - H5Dclose(did); - H5Gclose(gid); + ret = H5Dclose(did); + VRFY((ret == 0), "H5Dclose"); + ret = H5Gclose(gid); + VRFY((ret == 0), "H5Gclose"); HDfree(indata); HDfree(outdata); @@ -1076,11 +1034,6 @@ group_dataset_read(hid_t fid, int mpi_rank, int m) * + means the group has attribute(s). * ' means the datasets in the groups have attribute(s). * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. - * - * JRM - 8/16/04 */ void multiple_group_write(void) @@ -1164,12 +1117,6 @@ multiple_group_write(void) /* * In a group, creates NDATASETS datasets. Each process writes a hyperslab * of a data array to the file. - * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. - * - * JRM - 8/16/04 */ static void write_dataset(hid_t memspace, hid_t filespace, hid_t gid) @@ -1243,12 +1190,6 @@ create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, int counter) /* * This function is to verify the data from multiple group testing. It opens * every dataset in every group and check their correctness. - * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. - * - * JRM - 8/11/04 */ void multiple_group_read(void) @@ -1323,12 +1264,6 @@ multiple_group_read(void) /* * This function opens all the datasets in a certain, checks the data using * dataset_vrfy function. - * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. - * - * JRM - 8/11/04 */ static int read_dataset(hid_t memspace, hid_t filespace, hid_t gid) @@ -1475,12 +1410,6 @@ read_attribute(hid_t obj_id, int this_type, int num) /* This functions compares the original data with the read-in data for its * hyperslab part only by process ID. - * - * Changes: Modified function to use a passed in size parameter - * instead of the old SIZE #define. This should let us - * run with an arbitrary number of processes. - * - * JRM - 8/16/04 */ static int check_value(DATATYPE *indata, DATATYPE *outdata, int size) @@ -1513,12 +1442,6 @@ check_value(DATATYPE *indata, DATATYPE *outdata, int size) } /* Decide the portion of data chunk in dataset by process ID. - * - * Changes: Modified function to use a passed in size parameter - * instead of the old SIZE #define. This should let us - * run with an arbitrary number of processes. - * - * JRM - 8/11/04 */ static void @@ -1560,8 +1483,6 @@ get_slab(hsize_t chunk_origin[], hsize_t chunk_dims[], hsize_t count[], hsize_t * This function reproduces this situation. At present the test hangs * on failure. * JRM - 9/13/04 - * - * Changes: None. */ #define N 4 @@ -1805,10 +1726,6 @@ io_mode_confusion(void) * cache clients will have to construct on disk images on demand. * * JRM -- 10/13/10 - * - * Changes: - * Break it into two parts, a writer to write the file and a reader - * the correctness of the writer. AKC -- 2010/10/27 */ #define NUM_DATA_SETS 4 -- cgit v0.12 From d46fa9950c76b3e66619882126cf16c4409eaaab Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 24 Mar 2021 17:02:46 -0500 Subject: develop - Javadoc warning fixes (#506) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .../hdf5lib/exceptions/HDF5LibraryException.java | 2 + .../hdf/hdf5lib/structs/H5AC_cache_config_t.java | 243 ++++++++++++++++++++- java/src/hdf/hdf5lib/structs/H5E_error2_t.java | 22 +- java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java | 18 +- java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java | 5 + java/src/hdf/hdf5lib/structs/H5F_info2_t.java | 39 +++- java/src/hdf/hdf5lib/structs/H5G_info_t.java | 12 +- java/src/hdf/hdf5lib/structs/H5L_info_t.java | 10 +- java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java | 30 ++- java/src/hdf/hdf5lib/structs/H5O_info_t.java | 39 +++- .../src/hdf/hdf5lib/structs/H5O_native_info_t.java | 10 +- java/src/hdf/hdf5lib/structs/H5O_token_t.java | 10 + 12 files changed, 386 insertions(+), 54 deletions(-) diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java index e3e774c..532355e 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java @@ -30,7 +30,9 @@ import hdf.hdf5lib.HDF5Constants; @SuppressWarnings("serial") public class HDF5LibraryException extends HDF5Exception { + /** major error number of the first error on the HDF5 library error stack. */ private final long majorErrorNumber; + /** minor error number of the first error on the HDF5 library error stack. */ private final long minorErrorNumber; /** diff --git a/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java index 9f04211..cf84532 100644 --- a/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java +++ b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java @@ -20,41 +20,270 @@ import java.io.Serializable; */ public class H5AC_cache_config_t implements Serializable{ private static final long serialVersionUID = -6748085696476149972L; - // general configuration fields: + // general configuration fields + /** + * version: Integer field containing the version number of this version + * of the H5AC_cache_config_t structure. Any instance of + * H5AC_cache_config_t passed to the cache must have a known + * version number, or an error will be flagged. + */ public int version; + /** + * rpt_fcn_enabled: Boolean field used to enable and disable the default + * reporting function. This function is invoked every time the + * automatic cache resize code is run, and reports on its activities. + * + * This is a debugging function, and should normally be turned off. + */ public boolean rpt_fcn_enabled; + /** + * open_trace_file: Boolean field indicating whether the trace_file_name + * field should be used to open a trace file for the cache. + * + * *** DEPRECATED *** Use H5Fstart/stop logging functions instead + */ public boolean open_trace_file; + /** + * close_trace_file: Boolean field indicating whether the current trace + * file (if any) should be closed. + * + * *** DEPRECATED *** Use H5Fstart/stop logging functions instead + */ public boolean close_trace_file; + /** + * trace_file_name: Full path of the trace file to be opened if the + * open_trace_file field is TRUE. + * + * *** DEPRECATED *** Use H5Fstart/stop logging functions instead + */ public String trace_file_name; + /** + * evictions_enabled: Boolean field used to either report the current + * evictions enabled status of the cache, or to set the cache's + * evictions enabled status. + */ public boolean evictions_enabled; + /** + * set_initial_size: Boolean flag indicating whether the size of the + * initial size of the cache is to be set to the value given in + * the initial_size field. If set_initial_size is FALSE, the + * initial_size field is ignored. + */ public boolean set_initial_size; + /** + * initial_size: If enabled, this field contain the size the cache is + * to be set to upon receipt of this structure. Needless to say, + * initial_size must lie in the closed interval [min_size, max_size]. + */ public long initial_size; + /** + * min_clean_fraction: double in the range 0 to 1 indicating the fraction + * of the cache that is to be kept clean. This field is only used + * in parallel mode. Typical values are 0.1 to 0.5. + */ public double min_clean_fraction; + /** + * max_size: Maximum size to which the cache can be adjusted. The + * supplied value must fall in the closed interval + * [MIN_MAX_CACHE_SIZE, MAX_MAX_CACHE_SIZE]. Also, max_size must + * be greater than or equal to min_size. + */ public long max_size; + /** + * min_size: Minimum size to which the cache can be adjusted. The + * supplied value must fall in the closed interval + * [H5C__MIN_MAX_CACHE_SIZE, H5C__MAX_MAX_CACHE_SIZE]. Also, min_size + * must be less than or equal to max_size. + */ public long min_size; + /** + * epoch_length: Number of accesses on the cache over which to collect + * hit rate stats before running the automatic cache resize code, + * if it is enabled. + */ public long epoch_length; - // size increase control fields: - public int incr_mode; // H5C_cache_incr_mode + // size increase control fields + /** + * incr_mode: Instance of the H5C_cache_incr_mode enumerated type whose + * value indicates how we determine whether the cache size should be + * increased. At present there are two possible values. + */ + public int incr_mode; + /** + * lower_hr_threshold: Lower hit rate threshold. If the increment mode + * (incr_mode) is H5C_incr__threshold and the hit rate drops below the + * value supplied in this field in an epoch, increment the cache size by + * size_increment. Note that cache size may not be incremented above + * max_size, and that the increment may be further restricted by the + * max_increment field if it is enabled. + */ public double lower_hr_threshold; + /** + * increment: Double containing the multiplier used to derive the new + * cache size from the old if a cache size increment is triggered. + * The increment must be greater than 1.0, and should not exceed 2.0. + */ public double increment; + /** + * apply_max_increment: Boolean flag indicating whether the max_increment + * field should be used to limit the maximum cache size increment. + */ public boolean apply_max_increment; + /** + * max_increment: If enabled by the apply_max_increment field described + * above, this field contains the maximum number of bytes by which the + * cache size can be increased in a single re-size. + */ public long max_increment; - public int flash_incr_mode; // H5C_cache_flash_incr_mode + /** + * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated + * type whose value indicates whether and by which algorithm we should + * make flash increases in the size of the cache to accommodate insertion + * of large entries and large increases in the size of a single entry. + */ + public int flash_incr_mode; + /** + * flash_multiple: Double containing the multiple described above in the + * H5C_flash_incr__add_space section of the discussion of the + * flash_incr_mode section. This field is ignored unless flash_incr_mode + * is H5C_flash_incr__add_space. + */ public double flash_multiple; + /** + * flash_threshold: Double containing the factor by which current max cache + * size is multiplied to obtain the size threshold for the add_space flash + * increment algorithm. The field is ignored unless flash_incr_mode is + * H5C_flash_incr__add_space. + */ public double flash_threshold; - // size decrease control fields: - public int decr_mode; // H5C_cache_decr_mode + // size decrease control fields + /** + * decr_mode: Instance of the H5C_cache_decr_mode enumerated type whose + * value indicates how we determine whether the cache size should be + * decreased. At present there are four possibilities. + */ + public int decr_mode; + /** + * upper_hr_threshold: Upper hit rate threshold. The use of this field + * varies according to the current decr_mode. + */ public double upper_hr_threshold; + /** + * decrement: This field is only used when the decr_mode is + * H5C_decr__threshold. + */ public double decrement; + /** + * apply_max_decrement: Boolean flag used to determine whether decrements + * in cache size are to be limited by the max_decrement field. + */ public boolean apply_max_decrement; + /** + * max_decrement: Maximum number of bytes by which the cache size can be + * decreased in a single re-size. Note that decrements may also be + * restricted by the min_size of the cache, and (in age out modes) by + * the empty_reserve field. + */ public long max_decrement; + /** + * epochs_before_eviction: Integer field used in H5C_decr__age_out and + * H5C_decr__age_out_with_threshold decrement modes. + */ public int epochs_before_eviction; + /** + * apply_empty_reserve: Boolean field controlling whether the empty_reserve + * field is to be used in computing the new cache size when the + * decr_mode is H5C_decr__age_out or H5C_decr__age_out_with_threshold. + */ public boolean apply_empty_reserve; + /** + * empty_reserve: To avoid a constant racheting down of cache size by small + * amounts in the H5C_decr__age_out and H5C_decr__age_out_with_threshold + * modes, this field allows one to require that any cache size + * reductions leave the specified fraction of unused space in the cache. + */ public double empty_reserve; - // parallel configuration fields: + // parallel configuration fields + /** + * dirty_bytes_threshold: Threshold of dirty byte creation used to + * synchronize updates between caches. + */ public long dirty_bytes_threshold; + /** + * metadata_write_strategy: Integer field containing a code indicating the + * desired metadata write strategy. + */ public int metadata_write_strategy; + /** H5AC_cache_config_t is a public structure intended for use in public APIs. + * At least in its initial incarnation, it is basically a copy of struct + * H5C_auto_size_ctl_t, minus the report_fcn field, and plus the + * dirty_bytes_threshold field. + * + * @param version: Integer field containing the version number of this version + * @param rpt_fcn_enabled: Boolean field used to enable and disable the default reporting function. + * @param open_trace_file: Boolean field indicating whether the trace_file_name + * field should be used to open a trace file for the cache. + * @param close_trace_file: Boolean field indicating whether the current trace + * file (if any) should be closed. + * @param trace_file_name: Full path of the trace file to be opened if the + * open_trace_file field is TRUE. + * @param evictions_enabled: Boolean field used to either report or set the current + * evictions enabled status of the cache. + * @param set_initial_size: Boolean flag indicating whether the size of the + * initial size of the cache is to be set to the value given in + * the initial_size field. + * @param initial_size: If enabled, this field contain the size the cache is + * to be set to upon receipt of this structure. + * @param min_clean_fraction: double in the range 0 to 1 indicating the fraction + * of the cache that is to be kept clean. + * @param max_size: Maximum size to which the cache can be adjusted. + * @param min_size: Minimum size to which the cache can be adjusted. + * @param epoch_length: Number of accesses on the cache over which to collect + * hit rate stats before running the automatic cache resize code. + * @param incr_mode: Instance of the H5C_cache_incr_mode enumerated type. + * @param lower_hr_threshold: Lower hit rate threshold. + * @param increment: Double containing the multiplier used to derive the new + * cache size from the old if a cache size increment is triggered. + * @param apply_max_increment: Boolean flag indicating whether the max_increment + * field should be used to limit the maximum cache size increment. + * @param max_increment: If enabled by the apply_max_increment field described + * above, this field contains the maximum number of bytes by which the + * cache size can be increased in a single re-size. + * @param flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated + * type whose value indicates whether and by which algorithm we should + * make flash increases in the size of the cache to accommodate insertion + * of large entries and large increases in the size of a single entry. + * @param flash_multiple: Double containing the multiple described above in the + * H5C_flash_incr__add_space section of the discussion of the + * flash_incr_mode section. + * @param flash_threshold: Double containing the factor by which current max cache + * size is multiplied to obtain the size threshold for the add_space flash + * increment algorithm. + * @param decr_mode: Instance of the H5C_cache_decr_mode enumerated type whose + * value indicates how we determine whether the cache size should be + * decreased. + * @param upper_hr_threshold: Upper hit rate threshold. The use of this field + * varies according to the current decr_mode. + * @param decrement: This field is only used when the decr_mode is + * H5C_decr__threshold. + * @param apply_max_decrement: Boolean flag used to determine whether decrements + * in cache size are to be limited by the max_decrement field. + * @param max_decrement: Maximum number of bytes by which the cache size can be + * decreased in a single re-size. + * @param epochs_before_eviction: Integer field used in H5C_decr__age_out and + * H5C_decr__age_out_with_threshold decrement modes. + * @param apply_empty_reserve: Boolean field controlling whether the empty_reserve + * field is to be used in computing the new cache size when the + * decr_mode is H5C_decr__age_out or H5C_decr__age_out_with_threshold. + * @param empty_reserve: To avoid a constant racheting down of cache size by small + * amounts in the H5C_decr__age_out and H5C_decr__age_out_with_threshold + * modes. + * @param dirty_bytes_threshold: Threshold of dirty byte creation used to + * synchronize updates between caches. + * @param metadata_write_strategy: Integer field containing a code indicating the + * desired metadata write strategy. + */ public H5AC_cache_config_t (int version, boolean rpt_fcn_enabled, boolean open_trace_file, boolean close_trace_file, String trace_file_name, boolean evictions_enabled, boolean set_initial_size, long initial_size, double min_clean_fraction, long max_size, diff --git a/java/src/hdf/hdf5lib/structs/H5E_error2_t.java b/java/src/hdf/hdf5lib/structs/H5E_error2_t.java index e074156..5981fc7 100644 --- a/java/src/hdf/hdf5lib/structs/H5E_error2_t.java +++ b/java/src/hdf/hdf5lib/structs/H5E_error2_t.java @@ -20,14 +20,20 @@ import java.io.Serializable; */ public class H5E_error2_t implements Serializable{ private static final long serialVersionUID = 279144359041667613L; - - public long cls_id; //class ID - public long maj_num; //major error ID - public long min_num; //minor error number - public int line; //line in file where error occurs - public String func_name; //function in which error occurred - public String file_name; //file in which error occurred - public String desc; //optional supplied description + /** class ID */ + public long cls_id; + /** major error ID */ + public long maj_num; + /** minor error number */ + public long min_num; + /** line in file where error occurs */ + public int line; + /** function in which error occurred */ + public String func_name; + /** file in which error occurred */ + public String file_name; + /** optional supplied description */ + public String desc; H5E_error2_t(long cls_id, long maj_num, long min_num, int line, String func_name, String file_name, String desc) { this.cls_id = cls_id; diff --git a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java index 26690ec..5da4abd 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java @@ -26,15 +26,31 @@ import java.io.Serializable; public class H5FD_hdfs_fapl_t implements Serializable { private static final long serialVersionUID = 2072473407027648309L; + /** Version number of the H5FD_hdfs_fapl_t structure. */ private int version; + /** Name of "Name Node" to access as the HDFS server. */ private String namenode_name; + /** Port number to use to connect with Name Node. */ private int namenode_port; + /** Username to use when accessing file. */ private String user_name; + /** Path to the location of the Kerberos authentication cache. */ private String kerberos_ticket_cache; + /** Size (in bytes) of the file read stream buffer. */ private int stream_buffer_size; - /* + /** * Create a fapl_t structure with the specified components. + * @param namenode_name + * Name of "Name Node" to access as the HDFS server. + * @param namenode_port + * Port number to use to connect with Name Node. + * @param user_name + * Username to use when accessing file. + * @param kerberos_ticket_cache + * Path to the location of the Kerberos authentication cache. + * @param stream_buffer_size + * Size (in bytes) of the file read stream buffer. */ public H5FD_hdfs_fapl_t( String namenode_name, diff --git a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java index 735cc7e..39f5424 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java @@ -46,10 +46,15 @@ import java.io.Serializable; public class H5FD_ros3_fapl_t implements Serializable { private static final long serialVersionUID = 8985533001471224030L; + /** Version number of the H5FD_ros3_fapl_t structure */ private int version; + /** Flag TRUE or FALSE whether or not requests are to be authenticated with the AWS4 algorithm. */ private boolean authenticate; + /** region "aws region" for authenticating request */ private String aws_region; + /** id "secret id" or "access id" for authenticating request */ private String secret_id; + /** key "secret key" or "access key" for authenticating request */ private String secret_key; /** diff --git a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java index bb87201..f951bb4 100644 --- a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java +++ b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java @@ -20,16 +20,37 @@ import java.io.Serializable; */ public class H5F_info2_t implements Serializable{ private static final long serialVersionUID = 4691681162544054518L; - public int super_version; // Superblock version # - public long super_size; // Superblock size - public long super_ext_size; // Superblock extension size - public int free_version; // Version # of file free space management - public long free_meta_size; // Free space manager metadata size - public long free_tot_space; // Amount of free space in the file - public int sohm_version; // Version # of shared object header info - public long sohm_hdr_size; // Shared object header message header size - public H5_ih_info_t sohm_msgs_info; // Shared object header message index & heap size + /** Superblock version number */ + public int super_version; + /** Superblock size */ + public long super_size; + /** Superblock extension size */ + public long super_ext_size; + /** Version number of file free space management */ + public int free_version; + /** Free space manager metadata size */ + public long free_meta_size; + /** Amount of free space in the file */ + public long free_tot_space; + /** Version number of shared object header info */ + public int sohm_version; + /** Shared object header message header size */ + public long sohm_hdr_size; + /** Shared object header message index and heap size */ + public H5_ih_info_t sohm_msgs_info; + /** + * Constructor fot current "global" information about file + * @param super_version: Superblock version number + * @param super_size: Superblock size + * @param super_ext_size: Superblock extension size + * @param free_version: Version number of file free space management + * @param free_meta_size: Free space manager metadata size + * @param free_tot_space: Amount of free space in the file + * @param sohm_version: Version number of shared object header info + * @param sohm_hdr_size: Shared object header message header size + * @param sohm_msgs_info: Shared object header message index and heap size + */ public H5F_info2_t (int super_version, long super_size, long super_ext_size, int free_version, long free_meta_size, long free_tot_space, int sohm_version, long sohm_hdr_size, H5_ih_info_t sohm_msgs_info) diff --git a/java/src/hdf/hdf5lib/structs/H5G_info_t.java b/java/src/hdf/hdf5lib/structs/H5G_info_t.java index 6d4f405..e79f859 100644 --- a/java/src/hdf/hdf5lib/structs/H5G_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5G_info_t.java @@ -20,8 +20,12 @@ import java.io.Serializable; */ public class H5G_info_t implements Serializable{ private static final long serialVersionUID = -3746463015312132912L; - public int storage_type; // Type of storage for links in group - public long nlinks; // Number of links in group - public long max_corder; // Current max. creation order value for group - public boolean mounted; // Whether group has a file mounted on it + /** Type of storage for links in group */ + public int storage_type; + /** Number of links in group */ + public long nlinks; + /** Current max. creation order value for group */ + public long max_corder; + /** Whether group has a file mounted on it */ + public boolean mounted; } diff --git a/java/src/hdf/hdf5lib/structs/H5L_info_t.java b/java/src/hdf/hdf5lib/structs/H5L_info_t.java index eaf0da5..a3011c0 100644 --- a/java/src/hdf/hdf5lib/structs/H5L_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5L_info_t.java @@ -22,14 +22,20 @@ import hdf.hdf5lib.HDF5Constants; */ public class H5L_info_t implements Serializable { private static final long serialVersionUID = -4754320605310155033L; + /** Type of link */ public int type; + /** Indicate if creation order is valid */ public boolean corder_valid; + /** Creation order */ public long corder; + /** Character set of link name */ public int cset; + /** Character set of link name */ public H5O_token_t token; + /** Size of a soft link or user-defined link value */ public long val_size; - // Constructor for using object token portion of C union + /** Constructor for using object token portion of C union */ H5L_info_t (int type, boolean corder_valid, long corder, int cset, H5O_token_t token) { @@ -41,7 +47,7 @@ public class H5L_info_t implements Serializable { this.val_size = -1; } - // Constructor for using val_size portion of C union + /** Constructor for using val_size portion of C union */ H5L_info_t (int type, boolean corder_valid, long corder, int cset, long val_size) { diff --git a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java index 9a1749d..2475dd9 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java @@ -20,16 +20,26 @@ import java.io.Serializable; */ public class H5O_hdr_info_t implements Serializable { private static final long serialVersionUID = 7883826382952577189L; - public int version; /* Version number of header format in file */ - public int nmesgs; /* Number of object header messages */ - public int nchunks; /* Number of object header chunks */ - public int flags; /* Object header status flags */ - public long space_total; /* Total space for storing object header in file */ - public long space_meta; /* Space within header for object header metadata information */ - public long space_mesg; /* Space within header for actual message information */ - public long space_free; /* Free space within object header */ - public long mesg_present; /* Flags to indicate presence of message type in header */ - public long mesg_shared; /* Flags to indicate message type is shared in header */ + /** Version number of header format in file */ + public int version; + /** Number of object header messages */ + public int nmesgs; + /** Number of object header chunks */ + public int nchunks; + /** Object header status flags */ + public int flags; + /** Total space for storing object header in file */ + public long space_total; + /** Space within header for object header metadata information */ + public long space_meta; + /** Space within header for actual message information */ + public long space_mesg; + /** Free space within object header */ + public long space_free; + /** Flags to indicate presence of message type in header */ + public long mesg_present; + /** Flags to indicate message type is shared in header */ + public long mesg_shared; H5O_hdr_info_t (int version, int nmesgs, int nchunks, int flags, long space_total, long space_meta, long space_mesg, long space_free, diff --git a/java/src/hdf/hdf5lib/structs/H5O_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_info_t.java index cc94247..d2208d2 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_info_t.java @@ -20,16 +20,37 @@ import java.io.Serializable; */ public class H5O_info_t implements Serializable { private static final long serialVersionUID = 4691681163544054518L; - public long fileno; /* File number that object is located in */ - public H5O_token_t token; /* Object token in file */ - public int type; /* Basic object type (group, dataset, etc.) */ - public int rc; /* Reference count of object */ - public long atime; /* Access time */ - public long mtime; /* Modification time */ - public long ctime; /* Change time */ - public long btime; /* Birth time */ - public long num_attrs; /* # of attributes attached to object */ + /** File number that object is located in */ + public long fileno; + /** Object token in file */ + public H5O_token_t token; + /** Basic object type (group, dataset, etc.) */ + public int type; + /** Reference count of object */ + public int rc; + /** Access time */ + public long atime; + /** Modification time */ + public long mtime; + /** Change time */ + public long ctime; + /** Birth time */ + public long btime; + /** Number of attributes attached to object */ + public long num_attrs; + /** Constructor for data model information struct for objects + * + * @param fileno: File number that object is located in + * @param token: Object token in file + * @param type: Basic object type + * @param rc: Reference count of object + * @param atime: Access time + * @param mtime: Modification time + * @param ctime: Change time + * @param btime: Birth time + * @param num_attrs: Number of attributes attached to object + */ public H5O_info_t (long fileno, H5O_token_t token, int type, int rc, long atime, long mtime, long ctime, long btime, long num_attrs) { diff --git a/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java index ff801e8..70e5231 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java @@ -20,12 +20,14 @@ import java.io.Serializable; */ public class H5O_native_info_t implements Serializable { private static final long serialVersionUID = 7883826382952577189L; - - public H5O_hdr_info_t hdr_info; /* Object header information */ + /** Object header information */ + public H5O_hdr_info_t hdr_info; /* Extra metadata storage for obj & attributes */ - public H5_ih_info_t obj_info; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ - public H5_ih_info_t attr_info; /* v2 B-tree & heap for attributes */ + /** v1/v2 B-tree and local/fractal heap for groups, B-tree for chunked datasets */ + public H5_ih_info_t obj_info; + /** v2 B-tree and heap for attributes */ + public H5_ih_info_t attr_info; H5O_native_info_t (H5O_hdr_info_t oheader_info, H5_ih_info_t obj_info, H5_ih_info_t attr_info) { diff --git a/java/src/hdf/hdf5lib/structs/H5O_token_t.java b/java/src/hdf/hdf5lib/structs/H5O_token_t.java index c7ac437..f0bb978 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_token_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_token_t.java @@ -23,12 +23,22 @@ import hdf.hdf5lib.HDF5Constants; */ public class H5O_token_t implements Serializable { private static final long serialVersionUID = -4754320605310155032L; + /** + * Tokens are unique and permanent identifiers that are + * used to reference HDF5 objects in a container. + * Use basic byte array to store the dat + */ public byte[] data; H5O_token_t (byte[] data) { this.data = data; } + /** + * Check if token data is undefined + * + * @return true if token data is undefined + */ public boolean isUndefined() { return this.equals(HDF5Constants.H5O_TOKEN_UNDEF); } -- cgit v0.12 From da5aca29ff8e8e858eda0c030bf48cf64ac95519 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 25 Mar 2021 18:11:32 -0500 Subject: Hdf5 merge pr7 (#516) * Modify temporary rpath for testing in java example scripts. * Update URL in source file Copyright headers for web copy of COPYING (license) file. * Add release_docs/code-conventions.md file. * Add script to test h5py. * Fix script error. * Add file h5pytest.yml. * Test declaration of counter variables in for loops. * Committing clang-format changes * Committing clang-format changes * Added [] to line 126 of H5LTanalyze.l. Ran bin/genparser with flex v2.6.4 and Bison v3.0.4 on jelly. * Revert "Added [] to line 126 of H5LTanalyze.l." This reverts commit e4a9cee441efa75b16a8ee030c86189e186dd266. * Revert extra commits to match canonical develop. * Add cmake variable HDF5_LIB_INFIX (#7) * Add cmake variable HDF5_LIB_INFIX This infix is added to all library names after 'hdf5'. e.g. the infix '_openmpi' results in the library name 'libhdf5_openmpi.so' This name is used in packages on debian based systems. (see https://packages.debian.org/jessie/amd64/libhdf5-openmpi-8/filelist) This option is useful when testing projects on debian based systems with custom builds of hdf5 while trying to minimize differences between the custom setup and the environment created by installing system packages. * Added RELEASE.txt entry for HDF5_LIB_INFIX. Co-authored-by: Larry Knox Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raphael Grimm --- CMakeLists.txt | 35 +++++++++++++++++++++-------------- release_docs/RELEASE.txt | 9 +++++++++ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9809339..99dc035 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,13 @@ mark_as_advanced (HDF5_EXTERNAL_LIB_PREFIX) # If the parent project needs to install hdf libraries, but avoid # name conflicts with system versions, then a prefix may be added # to ensure that the correct versions configured are used. +set (HDF5_LIB_INFIX "" CACHE STRING "Use infix for custom library naming.") +mark_as_advanced (HDF5_LIB_INFIX) +# HDF5_LIB_INFIX : +# This infix is added to all library names after 'hdf5'. +# e.g. the infix '_openmpi' results in the library name 'libhdf5_openmpi.so' +# This name is used in packages on debian based systems. +# (see https://packages.debian.org/jessie/amd64/libhdf5-openmpi-8/filelist) # # HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR, HDF5_INSTALL_DATA_DIR : # Customize the 'bin', 'lib', 'include', and 'share' installation directories. @@ -130,20 +137,20 @@ mark_as_advanced (ALLOW_UNSUPPORTED) #----------------------------------------------------------------------------- # Set the core names of all the libraries #----------------------------------------------------------------------------- -set (HDF5_LIB_CORENAME "hdf5") -set (HDF5_TEST_LIB_CORENAME "hdf5_test") -set (HDF5_CPP_LIB_CORENAME "hdf5_cpp") -set (HDF5_HL_LIB_CORENAME "hdf5_hl") -set (HDF5_HL_CPP_LIB_CORENAME "hdf5_hl_cpp") -set (HDF5_TOOLS_LIB_CORENAME "hdf5_tools") -set (HDF5_UTILS_LIB_CORENAME "hdf5_utils") -set (HDF5_F90_LIB_CORENAME "hdf5_fortran") -set (HDF5_F90_C_LIB_CORENAME "hdf5_f90cstub") -set (HDF5_F90_TEST_LIB_CORENAME "hdf5_test_fortran") -set (HDF5_F90_C_TEST_LIB_CORENAME "hdf5_test_f90cstub") -set (HDF5_HL_F90_LIB_CORENAME "hdf5_hl_fortran") -set (HDF5_HL_F90_C_LIB_CORENAME "hdf5_hl_f90cstub") -set (HDF5_JAVA_JNI_LIB_CORENAME "hdf5_java") +set (HDF5_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}") +set (HDF5_TEST_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_test") +set (HDF5_CPP_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_cpp") +set (HDF5_HL_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_hl") +set (HDF5_HL_CPP_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_hl_cpp") +set (HDF5_TOOLS_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_tools") +set (HDF5_UTILS_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_utils") +set (HDF5_F90_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_fortran") +set (HDF5_F90_C_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_f90cstub") +set (HDF5_F90_TEST_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_test_fortran") +set (HDF5_F90_C_TEST_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_test_f90cstub") +set (HDF5_HL_F90_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_hl_fortran") +set (HDF5_HL_F90_C_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_hl_f90cstub") +set (HDF5_JAVA_JNI_LIB_CORENAME "hdf5${HDF5_LIB_INFIX}_java") set (HDF5_JAVA_HDF5_LIB_CORENAME "jarhdf5") set (HDF5_JAVA_TEST_LIB_CORENAME "jartest5") diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8b6f488..39260c0 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -63,6 +63,15 @@ New Features (DER - 2021/03/22) + - Add CMake variable HDF5_LIB_INFIX + + This infix is added to all library names after 'hdf5'. + e.g. the infix '_openmpi' results in the library name 'libhdf5_openmpi.so' + This name is used in packages on debian based systems. + (see https://packages.debian.org/jessie/amd64/libhdf5-openmpi-8/filelist) + + (barcode - 2021/03/22) + - On macOS, Universal Binaries can now be built, allowing native execution on both Intel and Apple Silicon (ARM) based Macs. -- cgit v0.12 From cb0a883f6d3ce976f8d485c8e44996d7264fce54 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 26 Mar 2021 15:14:09 -0500 Subject: Minor parallel improvements (#519) * Improve MPI error reporting, handled failed operations in parallel tests more nicely, and clean up MPI_Allreduce for determining whether to break collective I/O * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5Dmpio.c | 2 +- src/H5Eprivate.h | 13 ++++------- testpar/t_dset.c | 67 ++++++++++++++++++++++++++++------------------------- testpar/testphdf5.c | 3 --- testpar/testphdf5.h | 12 ++++------ 5 files changed, 46 insertions(+), 51 deletions(-) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 5f8a586..448e92d 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -413,7 +413,7 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, co * collective I/O */ if (MPI_SUCCESS != - (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm))) + (mpi_code = MPI_Allreduce(local_cause, global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code) } /* end else */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index c3c440f..4cd8b70 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -168,20 +168,15 @@ typedef struct H5E_t H5E_t; extern char H5E_mpi_error_str[MPI_MAX_ERROR_STRING]; extern int H5E_mpi_error_str_len; -#define HMPI_ERROR(mpierr) \ - { \ - MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \ - HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \ - } #define HMPI_DONE_ERROR(retcode, str, mpierr) \ { \ - HMPI_ERROR(mpierr); \ - HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \ + MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \ + HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, "%s: MPI error string is '%s'", str, H5E_mpi_error_str); \ } #define HMPI_GOTO_ERROR(retcode, str, mpierr) \ { \ - HMPI_ERROR(mpierr); \ - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \ + MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \ + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, "%s: MPI error string is '%s'", str, H5E_mpi_error_str); \ } #endif /* H5_HAVE_PARALLEL */ diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 3e4a304..bbd4b28 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -1627,9 +1627,6 @@ extend_writeInd(void) VRFY((mem_dataspace >= 0), ""); /* Try write to dataset2 beyond its current dim sizes. Should fail. */ - /* Temporary turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* create a file dataspace independently */ file_dataspace = H5Dget_space(dataset2); @@ -1638,11 +1635,13 @@ extend_writeInd(void) VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* write data independently. Should fail. */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); + H5E_BEGIN_TRY + { + ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); + } + H5E_END_TRY VRFY((ret < 0), "H5Dwrite failed as expected"); - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); H5Sclose(file_dataspace); /* Extend dataset2 and try again. Should succeed. */ @@ -1911,20 +1910,19 @@ extend_readInd(void) VRFY((dataset2 >= 0), ""); /* Try extend dataset1 which is open RDONLY. Should fail. */ - /* first turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); file_dataspace = H5Dget_space(dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL); VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded"); dims[0]++; - ret = H5Dset_extent(dataset1, dims); + H5E_BEGIN_TRY + { + ret = H5Dset_extent(dataset1, dims); + } + H5E_END_TRY VRFY((ret < 0), "H5Dset_extent failed as expected"); - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); H5Sclose(file_dataspace); /* Read dataset1 using BYROW pattern */ @@ -2209,9 +2207,6 @@ extend_writeAll(void) } /* Try write to dataset2 beyond its current dim sizes. Should fail. */ - /* Temporary turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* create a file dataspace independently */ file_dataspace = H5Dget_space(dataset2); @@ -2220,11 +2215,13 @@ extend_writeAll(void) VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* write data independently. Should fail. */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); + H5E_BEGIN_TRY + { + ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); + } + H5E_END_TRY VRFY((ret < 0), "H5Dwrite failed as expected"); - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); H5Sclose(file_dataspace); /* Extend dataset2 and try again. Should succeed. */ @@ -2331,20 +2328,19 @@ extend_readAll(void) VRFY((dataset2 >= 0), ""); /* Try extend dataset1 which is open RDONLY. Should fail. */ - /* first turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); file_dataspace = H5Dget_space(dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL); VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded"); dims[0]++; - ret = H5Dset_extent(dataset1, dims); + H5E_BEGIN_TRY + { + ret = H5Dset_extent(dataset1, dims); + } + H5E_END_TRY VRFY((ret < 0), "H5Dset_extent failed as expected"); - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); H5Sclose(file_dataspace); /* Read dataset1 using BYROW pattern */ @@ -3321,14 +3317,23 @@ test_actual_io_mode(int selection_mode) /* Release some resources */ ret = H5Sclose(sid); + VRFY((ret >= 0), "H5Sclose succeeded"); ret = H5Pclose(fapl); + VRFY((ret >= 0), "H5Pclose succeeded"); ret = H5Pclose(dcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); ret = H5Pclose(dxpl_write); + VRFY((ret >= 0), "H5Pclose succeeded"); ret = H5Pclose(dxpl_read); + VRFY((ret >= 0), "H5Pclose succeeded"); ret = H5Dclose(dataset); + VRFY((ret >= 0), "H5Dclose succeeded"); ret = H5Sclose(mem_space); + VRFY((ret >= 0), "H5Sclose succeeded"); ret = H5Sclose(file_space); + VRFY((ret >= 0), "H5Sclose succeeded"); ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); HDfree(buffer); return; } @@ -3344,9 +3349,7 @@ void actual_io_mode_tests(void) { int mpi_size = -1; - int mpi_rank = -1; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - MPI_Comm_size(MPI_COMM_WORLD, &mpi_rank); test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); @@ -4112,13 +4115,15 @@ dataset_atomicity(void) if (MAINPROCESS) { fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); VRFY((fid >= 0), "H5Fopen succeeed"); - } - /* should fail */ - ret = H5Fset_mpi_atomicity(fid, TRUE); - VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed"); + /* should fail */ + H5E_BEGIN_TRY + { + ret = H5Fset_mpi_atomicity(fid, TRUE); + } + H5E_END_TRY + VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed"); - if (MAINPROCESS) { ret = H5Fclose(fid); VRFY((ret >= 0), "H5Fclose succeeded"); } diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index f5b9e63..e24e1e4 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -33,9 +33,6 @@ int ngroups = 512; /* number of groups to create in root int facc_type = FACC_MPIO; /*Test file access type */ int dxfer_coll_type = DXFER_COLLECTIVE_IO; -H5E_auto2_t old_func; /* previous error handler */ -void * old_client_data; /* previous error handler arg.*/ - /* other option flags */ /* FILENAME and filenames must have the same number of names. diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index bd8de08..007fac0 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -225,13 +225,11 @@ typedef enum { } ShapeSameTestMethods; /* Shared global variables */ -extern int dim0, dim1; /*Dataset dimensions */ -extern int chunkdim0, chunkdim1; /*Chunk dimensions */ -extern int nerrors; /*errors count */ -extern H5E_auto2_t old_func; /* previous error handler */ -extern void * old_client_data; /*previous error handler arg.*/ -extern int facc_type; /*Test file access type */ -extern int dxfer_coll_type; +extern int dim0, dim1; /*Dataset dimensions */ +extern int chunkdim0, chunkdim1; /*Chunk dimensions */ +extern int nerrors; /*errors count */ +extern int facc_type; /*Test file access type */ +extern int dxfer_coll_type; /* Test program prototypes */ void test_plist_ed(void); -- cgit v0.12 From 6b13310f5c898ee0561f9601f04a4b07a60c4866 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 26 Mar 2021 17:03:38 -0500 Subject: Clean up MPI-IO VFD tracing support (#520) * Clean up tracing support * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5FDmpio.c | 324 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 196 insertions(+), 128 deletions(-) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index f79b9cd..6f38b3b 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -42,7 +42,7 @@ static hid_t H5FD_MPIO_g = 0; /* Whether to allow collective I/O operations */ -/* (Value can be set from environment variable also) */ +/* (Can be changed by setting "HDF5_MPI_OPT_TYPES" environment variable to '0' or '1') */ hbool_t H5FD_mpi_opt_types_g = TRUE; /* @@ -133,23 +133,26 @@ static const H5FD_class_mpi_t H5FD_mpio_g = { }; #ifdef H5FDmpio_DEBUG -/* Flags to control debug actions in H5Fmpio. - * Meant to be indexed by characters. - * - * 'c' show result of MPI_Get_count after read - * 'r' show read offset and size - * 't' trace function entry and exit - * 'w' show write offset and size +/* Flags to control debug actions in the MPI-IO VFD. + * (Meant to be indexed by characters) + * + * These flags can be set with either (or both) the environment variable + * "H5FD_mpio_Debug" set to a string containing one or more characters + * (flags) or by setting them as a string value for the + * "H5F_mpio_debug_key" MPI Info key. + * + * Supported characters in 'H5FD_mpio_Debug' string: + * 't' trace function entry and exit + * 'r' show read offset and size + * 'w' show write offset and size + * '0'-'9' only show output from a single MPI rank (ranks 0-9 supported) */ -static int H5FD_mpio_Debug[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static int H5FD_mpio_debug_flags_s[256]; +static int H5FD_mpio_debug_rank_s = -1; + +/* Indicate if this rank should output tracing info */ +#define H5FD_MPIO_TRACE_THIS_RANK(file) \ + (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == (file)->mpi_rank) #endif /*-------------------------------------------------------------------------- @@ -181,6 +184,41 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD__init_package() */ +#ifdef H5FDmpio_DEBUG + +/*--------------------------------------------------------------------------- + * Function: H5FD__mpio_parse_debug_str + * + * Purpose: Parse a string for debugging flags + * + * Returns: N/A + * + * Programmer: Quincey Koziol + * Wednesday, Aug 12, 2020 + * + *--------------------------------------------------------------------------- + */ +static void +H5FD__mpio_parse_debug_str(const char *s) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(s); + + /* Set debug mask */ + while (*s) { + if ((int)(*s) >= (int)'0' && (int)(*s) <= (int)'9') + H5FD_mpio_debug_rank_s = ((int)*s) - (int)'0'; + else + H5FD_mpio_debug_flags_s[(int)*s]++; + s++; + } /* end while */ + + FUNC_LEAVE_NOAPI_VOID +} /* end H5FD__mpio_parse_debug_str() */ +#endif /* H5FDmpio_DEBUG */ + /*------------------------------------------------------------------------- * Function: H5FD_mpio_init * @@ -198,11 +236,8 @@ done: hid_t H5FD_mpio_init(void) { -#ifdef H5FDmpio_DEBUG static int H5FD_mpio_Debug_inited = 0; -#endif /* H5FDmpio_DEBUG */ - const char *s; /* String for environment variables */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -210,28 +245,27 @@ H5FD_mpio_init(void) if (H5I_VFL != H5I_get_type(H5FD_MPIO_g)) H5FD_MPIO_g = H5FD_register((const H5FD_class_t *)&H5FD_mpio_g, sizeof(H5FD_class_mpi_t), FALSE); - /* Allow MPI buf-and-file-type optimizations? */ - s = HDgetenv("HDF5_MPI_OPT_TYPES"); - if (s && HDisdigit(*s)) { - long env_val = HDstrtol(s, NULL, 0); - H5FD_mpi_opt_types_g = (0 == env_val) ? FALSE : TRUE; - } + if (!H5FD_mpio_Debug_inited) { + const char *s; /* String for environment variables */ + + /* Allow MPI buf-and-file-type optimizations? */ + s = HDgetenv("HDF5_MPI_OPT_TYPES"); + if (s && HDisdigit(*s)) + H5FD_mpi_opt_types_g = (0 == HDstrtol(s, NULL, 0)) ? FALSE : TRUE; #ifdef H5FDmpio_DEBUG - if (!H5FD_mpio_Debug_inited) { + /* Clear the flag buffer */ + HDmemset(H5FD_mpio_debug_flags_s, 0, sizeof(H5FD_mpio_debug_flags_s)); + /* Retrieve MPI-IO debugging environment variable */ s = HDgetenv("H5FD_mpio_Debug"); - if (s) { - /* Set debug mask */ - while (*s) { - H5FD_mpio_Debug[(int)*s]++; - s++; - } /* end while */ - } /* end if */ - H5FD_mpio_Debug_inited++; - } /* end if */ + if (s) + H5FD__mpio_parse_debug_str(s); #endif /* H5FDmpio_DEBUG */ + H5FD_mpio_Debug_inited++; + } /* end if */ + /* Set return value */ ret_value = H5FD_MPIO_g; @@ -655,30 +689,27 @@ herr_t H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) { H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - int mpi_code; /* MPI return code */ - int temp_flag; - herr_t ret_value = SUCCEED; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif - if (FALSE == flag) - temp_flag = 0; - else - temp_flag = 1; - /* set atomicity value */ - if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, temp_flag))) + if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, (int)(flag != FALSE)))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -700,15 +731,18 @@ herr_t H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) { H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - int mpi_code; /* MPI return code */ int temp_flag; - herr_t ret_value = SUCCEED; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Get atomicity value */ @@ -722,8 +756,8 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -759,17 +793,14 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR int mpi_amode; /* MPI file access flags */ int mpi_rank = INT_MAX; /* MPI rank of this process */ int mpi_size; /* Total number of MPI processes */ - int mpi_code; /* MPI return code */ MPI_Offset file_size; /* File size (of existing files) */ - H5FD_t * ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, - name, flags, (int)fapl_id, (unsigned long)maxaddr); + hbool_t H5FD_mpio_debug_t_flag = FALSE; #endif + int mpi_code; /* MPI return code */ + H5FD_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC /* Get a pointer to the fapl */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -787,6 +818,14 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size))) HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code) +#ifdef H5FDmpio_DEBUG + H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && + (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == mpi_rank)); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", + FUNC, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr); +#endif + /* Convert HDF5 flags to MPI-IO flags */ /* Some combinations are illegal; let MPI-IO figure it out */ mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; @@ -802,14 +841,9 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR int flag; MPI_Info_get(info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag); - if (flag) { - int i; - - HDfprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str); - for (i = 0; debug_str[i] /*end of string*/ && i < 128 /*just in case*/; ++i) - H5FD_mpio_Debug[(int)debug_str[i]] = 1; - } /* end if */ - } /* end if */ + if (flag) + H5FD__mpio_parse_debug_str(debug_str); + } /* end if */ #endif if (MPI_SUCCESS != (mpi_code = MPI_File_open(comm, name, mpi_amode, info, &fh))) @@ -836,6 +870,7 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR /* Determine if the file should be truncated */ if (file_size && (flags & H5F_ACC_TRUNC)) { + /* Truncate the file */ if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(fh, (MPI_Offset)0))) HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code) @@ -867,8 +902,8 @@ done: } /* end if */ #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -890,14 +925,18 @@ static herr_t H5FD__mpio_close(H5FD_t *_file) { H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - int mpi_code; /* MPI return code */ - herr_t ret_value = SUCCEED; /* Return value */ +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); + int mpi_rank = file->mpi_rank; +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -915,8 +954,8 @@ H5FD__mpio_close(H5FD_t *_file) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -948,7 +987,7 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out *flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */ *flags |= H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */ *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default - VFD */ + VFD */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -1110,7 +1149,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU H5FD_mpio_t *file = (H5FD_mpio_t *)_file; MPI_Offset mpi_off; MPI_Status mpi_stat; /* Status from I/O operation */ - int mpi_code; /* mpi return code */ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ int size_i; /* Integer copy of 'size' to read */ #if MPI_VERSION >= 3 @@ -1126,13 +1164,18 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #endif hbool_t use_view_this_time = FALSE; hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */ - herr_t ret_value = SUCCEED; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); + hbool_t H5FD_mpio_debug_r_flag = (H5FD_mpio_debug_flags_s[(int)'r'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -1151,8 +1194,9 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i") #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off, + size_i); #endif /* Only look for MPI views for raw data transfers */ @@ -1198,8 +1242,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU H5FD_mpio_collective_opt_t coll_opt_mode; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) @@ -1207,14 +1251,14 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank); #endif /* Check whether we should read from rank 0 and broadcast to other ranks */ if (H5CX_get_mpio_rank0_bcast()) { #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", FUNC, file->mpi_rank); #endif /* Indicate path we've taken */ rank0_bcast = TRUE; @@ -1235,8 +1279,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU } /* end if */ else { #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); #endif /* Perform independent read operation */ @@ -1252,10 +1296,16 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ - else + else { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); +#endif + /* Perform independent read operation */ if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) + } /* end else */ /* Only retrieve bytes read if this rank _actually_ participated in I/O */ if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) { @@ -1305,8 +1355,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1341,7 +1391,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h MPI_Offset mpi_off; MPI_Status mpi_stat; /* Status from I/O operation */ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ - int mpi_code; /* MPI return code */ #if MPI_VERSION >= 3 MPI_Count bytes_written; MPI_Count type_size; /* MPI datatype used for I/O's size */ @@ -1355,13 +1404,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h hbool_t use_view_this_time = FALSE; hbool_t derived_type = FALSE; H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ - herr_t ret_value = SUCCEED; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); + hbool_t H5FD_mpio_debug_w_flag = (H5FD_mpio_debug_flags_s[(int)'w'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -1381,8 +1435,9 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h size_i = (int)size; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off, + size_i); #endif /* Get the transfer mode from the API context */ @@ -1437,8 +1492,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h H5FD_mpio_collective_opt_t coll_opt_mode; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC); + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ @@ -1447,8 +1502,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank); #endif /* Perform collective write operation */ if (MPI_SUCCESS != @@ -1459,9 +1514,10 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (type != H5FD_MEM_DRAW) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Metadata Coll opt property should be collective at this point") + #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); #endif /* Perform independent write operation */ if (MPI_SUCCESS != @@ -1474,12 +1530,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ - else + else { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); +#endif + /* Perform independent write operation */ if (MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) + } /* end else */ - /* How many bytes were actually written? */ + /* How many bytes were actually written? */ #if MPI_VERSION >= 3 if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_written))) #else @@ -1518,8 +1580,8 @@ done: MPI_Type_free(&buf_type); #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", FUNC, file->mpi_rank, ret_value); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1541,14 +1603,17 @@ static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - int mpi_code; /* mpi return code */ - herr_t ret_value = SUCCEED; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* mpi return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -1562,8 +1627,8 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1595,14 +1660,17 @@ done: static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { - H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - herr_t ret_value = SUCCEED; + H5FD_mpio_t *file = (H5FD_mpio_t *)_file; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -1670,8 +1738,8 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12 From e0eb5c6e1dbf527db240faa0f398617577ec783f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 26 Mar 2021 20:07:59 -0700 Subject: Updates that allow accum SWMR tests to work on Windows (#493) * Committing clang-format changes * Updates the accum test to work on Windows Uses CreateProcess() on Windows * Source formatting * Fix for Unix child result * Fixes process return code bug on Windows Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/accum.c | 162 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 102 insertions(+), 60 deletions(-) diff --git a/test/accum.c b/test/accum.c index 51a03c6..c3346bc 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2074,13 +2074,14 @@ error: /*------------------------------------------------------------------------- * Function: test_swmr_write_big * - * Purpose: A SWMR test: verifies that writing "large" metadata to a file - * opened with SWMR_WRITE will flush the existing metadata in the - * accumulator to disk first before writing the "large" metadata - * to disk. - * This test will fork and exec a reader "accum_swmr_reader" which - * opens the same file with SWMR_READ and verifies that the correct - * metadata is read from disk. + * Purpose: A SWMR test: verifies that writing "large" metadata to a file + * opened with SWMR_WRITE will flush the existing metadata in the + * accumulator to disk first before writing the "large" metadata + * to disk. + * + * This test will fork and exec a reader "accum_swmr_reader" which + * opens the same file with SWMR_READ and verifies that the correct + * metadata is read from disk. * * Return: Success: 0 * Failure: 1 @@ -2092,7 +2093,7 @@ error: unsigned test_swmr_write_big(hbool_t newest_format) { -#ifdef H5_HAVE_UNISTD_H + hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ H5F_t * rf = NULL; /* File pointer */ @@ -2100,16 +2101,23 @@ test_swmr_write_big(hbool_t newest_format) uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ uint8_t wbuf[1024]; /* Buffer for reading & writing */ unsigned u; /* Local index variable */ - pid_t pid; /* Process ID */ - int status; /* Status returned from child process */ - char * driver = NULL; /* VFD string (from env variable) */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t process_success = FALSE; + char * driver = NULL; /* VFD string (from env variable) */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (newest_format) TESTING("SWMR write of large metadata: with latest format") else TESTING("SWMR write of large metadata: with non-latest-format") +#if !defined(H5_HAVE_UNISTD_H) && !defined(H5_HAVE_WIN32_API) + + /* Not a Windows or POSIX system */ + SKIPPED(); + HDputs(" Test skipped: Not a Windows or POSIX system."); + return 0; + +#else /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ @@ -2219,56 +2227,94 @@ test_swmr_write_big(hbool_t newest_format) if (HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR; - /* Fork child process to verify that the data at [1024, 2014] does get written to disk */ - if ((pid = HDfork()) < 0) { - HDperror("fork"); - FAIL_STACK_ERROR; - } - else if (0 == pid) { /* Child process */ - /* By convention, argv[0] tells the name of program invoked. - * - * execv on NetBSD 8 will actually return EFAULT if there is a - * NULL at argv[0], so we follow the convention unconditionally. - */ - char swmr_reader[] = SWMR_READER; - char *const new_argv[] = {swmr_reader, NULL}; - /* Run the reader */ - status = HDexecv(SWMR_READER, new_argv); - HDprintf("errno from execv = %s\n", HDstrerror(errno)); - FAIL_STACK_ERROR; - } /* end if */ +#if defined(H5_HAVE_WIN32_API) + { + STARTUPINFO si; + PROCESS_INFORMATION pi; + DWORD exit_code = EXIT_FAILURE; - /* Parent process -- wait for the child process to complete */ - while (pid != HDwaitpid(pid, &status, 0)) - /*void*/; + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); - /* Check if child process terminates normally and its return value */ - if (WIFEXITED(status) && !WEXITSTATUS(status)) { - /* Flush the accumulator */ - if (accum_reset(rf) < 0) + if (0 == CreateProcess(NULL, SWMR_READER, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { + HDprintf("CreateProcess failed (%d).\n", GetLastError()); FAIL_STACK_ERROR; + } - /* Close and remove the file */ - if (H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + (void)WaitForSingleObject(pi.hProcess, INFINITE); + + if (FALSE == GetExitCodeProcess(pi.hProcess, &exit_code) || EXIT_FAILURE == exit_code) + process_success = FALSE; + else + process_success = TRUE; - /* Close the property list */ - if (H5Pclose(fapl) < 0) + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } +#else /* defined(H5_HAVE_WIN32_API) */ + { + pid_t pid; /* Process ID */ + int status; /* Status returned from child process */ + + /* Fork child process to verify that the data at [1024, 2014] does get written to disk */ + if ((pid = HDfork()) < 0) { + HDperror("fork"); + FAIL_STACK_ERROR; + } + else if (0 == pid) { /* Child process */ + /* By convention, argv[0] tells the name of program invoked. + * + * execv on NetBSD 8 will actually return EFAULT if there is a + * NULL at argv[0], so we follow the convention unconditionally. + */ + char swmr_reader[] = SWMR_READER; + char *const new_argv[] = {swmr_reader, NULL}; + /* Run the reader */ + status = HDexecv(SWMR_READER, new_argv); + HDprintf("errno from execv = %s\n", HDstrerror(errno)); FAIL_STACK_ERROR; + } /* end if */ - /* Pop API context */ - if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - FAIL_STACK_ERROR - api_ctx_pushed = FALSE; - - /* Release memory */ - if (wbuf2) - HDfree(wbuf2); - if (rbuf) - HDfree(rbuf); - PASSED(); - return 0; - } /* end if */ + /* Parent process -- wait for the child process to complete */ + while (pid != HDwaitpid(pid, &status, 0)) + /*void*/; + + /* Check if child process terminates normally and its return value */ + if (WIFEXITED(status) && !WEXITSTATUS(status)) + process_success = TRUE; + } +#endif /* defined(H5_HAVE_WIN32_API) */ + + /* Check if the process terminated correctly */ + if (!process_success) + FAIL_PUTS_ERROR("child process exited abnormally") + + /* Flush the accumulator */ + if (accum_reset(rf) < 0) + FAIL_STACK_ERROR; + + /* Close and remove the file */ + if (H5Fclose(fid) < 0) + FAIL_STACK_ERROR; + + /* Close the property list */ + if (H5Pclose(fapl) < 0) + FAIL_STACK_ERROR; + + /* Pop API context */ + if (api_ctx_pushed && H5CX_pop(FALSE) < 0) + FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + + /* Release memory */ + if (wbuf2) + HDfree(wbuf2); + if (rbuf) + HDfree(rbuf); + + PASSED(); + return 0; error: /* Closing and remove the file */ @@ -2287,11 +2333,7 @@ error: return 1; -#else /* H5_HAVE_UNISTD_H */ - SKIPPED(); - HDputs(" Test skipped due to fork, waitpid, or pid_t not defined."); - return 0; -#endif /* H5_HAVE_UNISTD_H */ +#endif /* !defined(H5_HAVE_UNISTD_H) && !defined(H5_HAVE_WIN32_API) */ } /* end test_swmr_write_big() */ -- cgit v0.12 From 189293e12fff33eda98a464f644d474cf4baef33 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:32:52 -0700 Subject: Removes dead H5ST package from the library (#528) * Committing clang-format changes * Removes the unused H5ST package from the library Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 3 - src/CMakeLists.txt | 15 +- src/H5ST.c | 779 ---------------------------------------------------- src/H5STprivate.h | 63 ----- src/Makefile.am | 1 - test/CMakeLists.txt | 1 - test/Makefile.am | 2 +- test/testhdf5.c | 1 - test/testhdf5.h | 1 - test/theap.c | 2 +- test/ttst.c | 391 -------------------------- 11 files changed, 4 insertions(+), 1255 deletions(-) delete mode 100644 src/H5ST.c delete mode 100644 src/H5STprivate.h delete mode 100644 test/ttst.c diff --git a/MANIFEST b/MANIFEST index f8c64ab..23499d3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -997,8 +997,6 @@ ./src/H5SMpkg.h ./src/H5SMprivate.h ./src/H5SMtest.c -./src/H5ST.c -./src/H5STprivate.h ./src/H5T.c ./src/H5Tarray.c ./src/H5Tbit.c @@ -1315,7 +1313,6 @@ ./test/ttsafe_cancel.c ./test/ttsafe_dcreate.c ./test/ttsafe_error.c -./test/ttst.c ./test/tunicode.c ./test/tvlstr.c ./test/tvltypes.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 610e905..06b0c8c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -600,14 +600,6 @@ set (H5SM_HDRS IDE_GENERATED_PROPERTIES ("H5SM" "${H5SM_HDRS}" "${H5SM_SOURCES}" ) -set (H5ST_SOURCES - ${HDF5_SRC_DIR}/H5ST.c -) -set (H5ST_HDRS -) -IDE_GENERATED_PROPERTIES ("H5ST" "${H5ST_HDRS}" "${H5ST_SOURCES}" ) - - set (H5T_SOURCES ${HDF5_SRC_DIR}/H5T.c ${HDF5_SRC_DIR}/H5Tarray.c @@ -802,7 +794,6 @@ set (common_SRCS ${H5S_SOURCES} ${H5SL_SOURCES} ${H5SM_SOURCES} - ${H5ST_SOURCES} ${H5T_SOURCES} ${H5TS_SOURCES} ${H5VL_SOURCES} @@ -961,8 +952,6 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5SMpkg.h ${HDF5_SRC_DIR}/H5SMprivate.h - ${HDF5_SRC_DIR}/H5STprivate.h - ${HDF5_SRC_DIR}/H5Tpkg.h ${HDF5_SRC_DIR}/H5Tprivate.h @@ -1219,7 +1208,7 @@ if (NOT ONLY_SHARED_LIBS) ${HDF_EXTRA_FLAGS} PRIVATE $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> ) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} @@ -1258,7 +1247,7 @@ if (BUILD_SHARED_LIBS) PRIVATE $<$:H5_HAVE_THREADSAFE> $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} diff --git a/src/H5ST.c b/src/H5ST.c deleted file mode 100644 index 0b7b858..0000000 --- a/src/H5ST.c +++ /dev/null @@ -1,779 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* TERNARY SEARCH TREE ALGS - This code is described in "Ternary Search Trees" by Jon -Bentley and Robert Sedgewick in the April, 1998, Dr. Dobb's Journal. -*/ - -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5STprivate.h" /* Ternary search trees */ - -#ifdef H5ST_DEBUG -static herr_t H5ST__dump_internal(H5ST_ptr_t p); -#endif /* H5ST_DEBUG */ - -/* Declare a free list to manage the H5ST_node_t struct */ -H5FL_DEFINE_STATIC(H5ST_node_t); - -/* Declare a free list to manage the H5ST_tree_t struct */ -H5FL_DEFINE_STATIC(H5ST_tree_t); - -/*-------------------------------------------------------------------------- - NAME - H5ST_create - PURPOSE - Create a TST - USAGE - H5ST_ptr_t H5ST_create() - - RETURNS - Returns a pointer to the new TST tree on success, NULL on failure. - DESCRIPTION - Create a TST. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -H5ST_tree_t * -H5ST_create(void) -{ - H5ST_tree_t *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Allocate wrapper for TST */ - if (NULL == (ret_value = H5FL_MALLOC(H5ST_tree_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - /* Set the internal fields */ - ret_value->root = NULL; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_create() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST__close_internal - PURPOSE - Close a TST, deallocating it. - USAGE - herr_t H5ST_close(p) - H5ST_ptr_t p; IN/OUT: Root of TST to free - - RETURNS - Returns non-negative on success, negative on failure. - DESCRIPTION - Close a TST, freeing all nodes. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5ST__close_internal(H5ST_ptr_t p) -{ - FUNC_ENTER_STATIC_NOERR - - /* Recursively free TST */ - if (p) { - H5ST__close_internal(p->lokid); - if (p->splitchar) - H5ST__close_internal(p->eqkid); - H5ST__close_internal(p->hikid); - p = H5FL_FREE(H5ST_node_t, p); - } /* end if */ - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5ST__close_internal() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_close - PURPOSE - Close a TST, deallocating it. - USAGE - herr_t H5ST_close(tree) - H5ST_tree_t *tree; IN/OUT: TST tree to free - - RETURNS - Returns non-negative on success, negative on failure. - DESCRIPTION - Close a TST, freeing all nodes. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -herr_t -H5ST_close(H5ST_tree_t *tree) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check arguments */ - if (NULL == tree) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid TST") - - /* Free the TST itself */ - if (H5ST__close_internal(tree->root) < 0) - HGOTO_ERROR(H5E_TST, H5E_CANTFREE, FAIL, "can't free TST") - - /* Free root node itself */ - tree = H5FL_FREE(H5ST_tree_t, tree); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_close() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_insert - PURPOSE - Insert a string/object pair into a TST - USAGE - herr_t H5ST_insert(tree,s,obj) - H5ST_tree_t *tree; IN/OUT: TST to insert string into - const char *s; IN: String to use as key for object - void *obj; IN: Pointer to object to insert - - RETURNS - Returns non-negative on success, negative on failure. - DESCRIPTION - Insert a key (string)/object pair into a TST - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -herr_t -H5ST_insert(H5ST_tree_t *tree, const char *s, void *obj) -{ - int d; /* Comparison value */ - H5ST_ptr_t pp, *p; /* Pointer to current node and pointer to that */ - H5ST_ptr_t parent = NULL; /* Pointer to parent node */ - H5ST_ptr_t up = NULL; /* Pointer to up node */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Find the correct location to insert object */ - p = &tree->root; - while ((pp = *p)) { - /* If this node matches the character in the key, then drop down to the lower tree */ - if (0 == (d = *s - pp->splitchar)) { - if (*s++ == 0) - HGOTO_ERROR(H5E_TST, H5E_EXISTS, FAIL, "key already in tree") - up = pp; - p = &(pp->eqkid); - } /* end if */ - else { - /* Walk through the current tree, searching for the matching character */ - parent = pp; - if (d < 0) - p = &(pp->lokid); - else - p = &(pp->hikid); - } /* end else */ - } /* end while */ - - /* Finish walking through the key string, adding nodes until the end */ - for (;;) { - if (NULL == (*p = H5FL_MALLOC(H5ST_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - pp = *p; - pp->splitchar = *s; - pp->up = up; - pp->parent = parent; - pp->lokid = pp->eqkid = pp->hikid = NULL; - - /* If this is the end of the key string, break out */ - if (*s++ == 0) { - pp->eqkid = (H5ST_ptr_t)obj; - break; - } /* end if */ - - /* Continue to next character */ - parent = NULL; - up = pp; - p = &(pp->eqkid); - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_insert() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_search - PURPOSE - Determine if a key is in the TST - USAGE - hbool_t H5ST_search(tree,s) - H5ST_tree_t *tree; IN: TST to find string in - const char *s; IN: String to use as key to locate - - RETURNS - Success: TRUE if key string in TST, FALSE if not - Failure: negative - DESCRIPTION - Locate a key (string) in a TST - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -htri_t -H5ST_search(H5ST_tree_t *tree, const char *s) -{ - H5ST_ptr_t p; /* Temporary pointer to TST node */ - htri_t ret_value = FALSE; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - p = tree->root; - while (p) { - if (*s < p->splitchar) - p = p->lokid; - else if (*s == p->splitchar) { - if (*s++ == 0) - HGOTO_DONE(TRUE); - p = p->eqkid; - } - else - p = p->hikid; - } /* end while */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_search() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST__find_internal - PURPOSE - Find the node matching a particular key string - USAGE - H5ST_ptr_t H5ST_find(p,s) - H5ST_ptr_t p; IN: TST to find string in - const char *s; IN: String to use as key to locate - - RETURNS - Success: Non-NULL - Failure: NULL - DESCRIPTION - Locate a key (string) in a TST - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static H5ST_ptr_t -H5ST__find_internal(H5ST_ptr_t p, const char *s) -{ - H5ST_ptr_t ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC_NOERR - - while (p) { - if (*s < p->splitchar) - p = p->lokid; - else if (*s == p->splitchar) { - if (*s++ == 0) - HGOTO_DONE(p); - p = p->eqkid; - } - else - p = p->hikid; - } /* end while */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST__find_internal() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_find - PURPOSE - Find the node matching a particular key string - USAGE - H5ST_ptr_t H5ST_find(tree,s) - H5ST_tree_t *tree; IN: TST to find string in - const char *s; IN: String to use as key to locate - - RETURNS - Success: Non-NULL - Failure: NULL - DESCRIPTION - Locate a key (string) in a TST - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -H5ST_ptr_t -H5ST_find(H5ST_tree_t *tree, const char *s) -{ - H5ST_ptr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - if (NULL == (ret_value = H5ST__find_internal(tree->root, s))) - HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_find() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_locate - PURPOSE - Find an object in a TST - USAGE - void *H5ST_locate(tree,s) - H5ST_tree_t *tree; IN: TST to locate object within - const char *s; IN: String of key for object to locate - RETURNS - Success: Non-NULL, pointer to object stored for key - Failure: Negative - DESCRIPTION - Locate a node in a TST, returning the object from the node. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -void * -H5ST_locate(H5ST_tree_t *tree, const char *s) -{ - H5ST_ptr_t node; /* Pointer to node located */ - void * ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Locate the node to remove */ - if (NULL == (node = H5ST__find_internal(tree->root, s))) - HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST") - - /* Get the pointer to the object to return */ - ret_value = node->eqkid; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5ST_locate() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST__findfirst_internal - PURPOSE - Find the first node in a TST - USAGE - H5ST_ptr_t H5ST__findfirst_internal(p) - H5ST_ptr_t p; IN: TST to locate first node within - RETURNS - Success: Non-NULL - Failure: NULL - DESCRIPTION - Get the first (lexicographically) node in a TST - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static H5ST_ptr_t -H5ST__findfirst_internal(H5ST_ptr_t p) -{ - H5ST_ptr_t ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC_NOERR - - while (p) { - /* Find least node in current tree */ - while (p->lokid) - p = p->lokid; - - /* Is least node '\0'? */ - if (p->splitchar == '\0') { - /* Return it */ - HGOTO_DONE(p); - } /* end if */ - else { - /* Go down to next level of tree */ - p = p->eqkid; - } /* end else */ - } /* end while */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST__findfirst_internal() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_findfirst - PURPOSE - Find the first node in a TST - USAGE - H5ST_ptr_t H5ST_findfirst(tree) - H5ST_tree_t *tree; IN: TST to locate first node within - RETURNS - Success: Non-NULL - Failure: NULL - DESCRIPTION - Get the first (lexicographically) node in a TST - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -H5ST_ptr_t -H5ST_findfirst(H5ST_tree_t *tree) -{ - H5ST_ptr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - if (NULL == (ret_value = H5ST__findfirst_internal(tree->root))) - HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "no nodes in TST"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_findfirst() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST__getnext - PURPOSE - Internal routine to find the next node in a given level of a TST - USAGE - H5ST_ptr_t H5ST__getnext(p) - H5ST_ptr_t *p; IN: Pointer to node to find next node from - RETURNS - Success: Non-NULL - Failure: NULL - DESCRIPTION - Get the next (lexicographically) node in the current level of a TST - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static H5ST_ptr_t -H5ST__getnext(H5ST_ptr_t p) -{ - H5ST_ptr_t ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC_NOERR - - /* If the node to continue from has higher-valued nodes attached */ - if (p->hikid) { - /* Go to first higher-valued node */ - p = p->hikid; - - /* Find least node from here */ - while (p->lokid) - p = p->lokid; - HGOTO_DONE(p); - } /* end if */ - else { - H5ST_ptr_t q; /* Temporary TST node pointer */ - - /* Go up one level in current tree */ - q = p->parent; - if (q == NULL) - HGOTO_DONE(NULL); - - /* While the previous node was the higher-valued node, keep backing up the tree */ - while (q->hikid == p) { - p = q; - q = p->parent; - if (NULL == q) - HGOTO_DONE(NULL); - } /* end while */ - HGOTO_DONE(q); - } /* end else */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST__getnext() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_findnext - PURPOSE - Find the next node from a node in a TST - USAGE - H5ST_ptr_t H5ST_findnext(p) - H5ST_ptr_t p; IN: Current node to continue from - RETURNS - Success: Non-NULL - Failure: NULL - DESCRIPTION - Get the next (lexicographically) node in a TST - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -H5ST_ptr_t -H5ST_findnext(H5ST_ptr_t p) -{ - H5ST_ptr_t q; /* Temporary pointer to TST node */ - H5ST_ptr_t ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Find the next node at the current level, or go back up the tree */ - do { - q = H5ST__getnext(p); - if (q) { - HGOTO_DONE(H5ST__findfirst_internal(q->eqkid)); - } /* end if */ - else - p = p->up; - } while (p); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_findnext() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST__delete_internal - PURPOSE - Delete a node from a TST - USAGE - herr_t H5ST__delete_internal(root,p) - H5ST_ptr_t *root; IN/OUT: Root of TST to delete node from - H5ST_ptr_t p; IN: Node to delete - RETURNS - Success: Non-negative - Failure: Negative - DESCRIPTION - Delete a node from a TST. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - This should be the final node for a string. - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5ST__delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p) -{ - H5ST_ptr_t q, /* Temporary pointer to TST node */ - newp; /* Pointer to node which will replace deleted node in tree */ - - FUNC_ENTER_STATIC_NOERR - - /* Find node to replace one being deleted */ - if (p->lokid) { - /* If the deleted node has lo & hi kids, attach them together */ - if (p->hikid) { - q = p->lokid; - while (q->hikid) - q = q->hikid; - q->hikid = p->hikid; - p->hikid->parent = q; - } /* end if */ - newp = p->lokid; - } /* end if */ - else if (p->hikid) { - newp = p->hikid; - } /* end if */ - else { - newp = NULL; - } /* end else */ - - /* Deleted node is in middle of tree */ - if (p->parent) { - /* Attach new node to correct side of parent */ - if (p == p->parent->lokid) - p->parent->lokid = newp; - else - p->parent->hikid = newp; - if (newp) - newp->parent = p->parent; - } /* end if */ - else { - if (newp) - newp->parent = p->parent; - if (p->up) { - p->up->eqkid = newp; - - /* If we deleted the last node in the TST, delete the upper node also */ - if (NULL == newp) - H5ST__delete_internal(root, p->up); - } /* end if */ - else /* Deleted last node at top level of tree */ - *root = newp; - } /* end else */ - - p = H5FL_FREE(H5ST_node_t, p); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5ST__delete_internal() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_delete - PURPOSE - Delete a node from a TST - USAGE - herr_t H5ST_delete(tree,p) - H5ST_tree_t *tree; IN/OUT: TST to delete node from - H5ST_ptr_t p; IN: Node to delete - RETURNS - Success: Non-negative - Failure: Negative - DESCRIPTION - Delete a node from a TST. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - This should be the final node for a string. - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -herr_t -H5ST_delete(H5ST_tree_t *tree, H5ST_ptr_t p) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if (H5ST__delete_internal(&tree->root, p) < 0) - HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, FAIL, "can't delete node from TST") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_delete() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_remove - PURPOSE - Remove a node from a TST - USAGE - void *H5ST_remove(tree,s) - H5ST_tree_t *tree; IN/OUT: TST to remove node from - const char *s; IN: String of key for node to remove - RETURNS - Success: Non-NULL, pointer to object stored for key - Failure: Negative - DESCRIPTION - Remove a node from a TST, returning the object from the node. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -void * -H5ST_remove(H5ST_tree_t *tree, const char *s) -{ - H5ST_ptr_t node; /* Pointer to node to remove */ - void * ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Locate the node to remove */ - if (NULL == (node = H5ST__find_internal(tree->root, s))) - HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST") - - /* Get the pointer to the object to return */ - ret_value = node->eqkid; - - /* Remove the node from the TST */ - if (H5ST__delete_internal(&tree->root, node) < 0) - HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, NULL, "can't delete node from TST") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5ST_remove() */ - -#ifdef H5ST_DEBUG - -/*-------------------------------------------------------------------------- - NAME - H5ST__dump_internal - PURPOSE - Dump all the nodes of a TST - USAGE - herr_t H5ST_dump(p) - H5ST_ptr_t p; IN: Root of TST to dump - RETURNS - Success: Non-negative - Failure: Negative - DESCRIPTION - Dump information for a TST. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5ST__dump_internal(H5ST_ptr_t p) -{ - FUNC_ENTER_STATIC_NOERR - - if (p) { - HDprintf("p=%p\n", (void *)p); - HDprintf("\tp->up=%p\n", (void *)p->up); - HDprintf("\tp->parent=%p\n", (void *)p->parent); - HDprintf("\tp->lokid=%p\n", (void *)p->lokid); - HDprintf("\tp->hikid=%p\n", (void *)p->hikid); - HDprintf("\tp->eqkid=%p\n", (void *)p->eqkid); - HDprintf("\tp->splitchar=%c\n", p->splitchar); - - H5ST__dump_internal(p->lokid); - if (p->splitchar) - H5ST__dump_internal(p->eqkid); - else - HDprintf("%s\n", (char *)p->eqkid); - H5ST__dump_internal(p->hikid); - } /* end if */ - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5ST__dump_internal() */ - -/*-------------------------------------------------------------------------- - NAME - H5ST_dump - PURPOSE - Dump all the nodes of a TST - USAGE - herr_t H5ST_dump(tree) - H5ST_tree_t *tree; IN: TST to dump - RETURNS - Success: Non-negative - Failure: Negative - DESCRIPTION - Dump information for a TST. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -herr_t -H5ST_dump(H5ST_tree_t *tree) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Dump the tree */ - H5ST__dump_internal(tree->root); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5ST_dump() */ -#endif /* H5ST_DEBUG */ diff --git a/src/H5STprivate.h b/src/H5STprivate.h deleted file mode 100644 index 2d009fa..0000000 --- a/src/H5STprivate.h +++ /dev/null @@ -1,63 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * This file contains private information about the H5ST module - */ -#ifndef H5STprivate_H -#define H5STprivate_H - -#ifdef LATER -#include "H5STpublic.h" -#endif /* LATER */ - -/* Private headers needed by this file */ -#include "H5private.h" - -/* Typedefs */ - -/* Internal nodes for TST */ -typedef struct H5ST_node *H5ST_ptr_t; -typedef struct H5ST_node { - char splitchar; /* Character represented at node */ - H5ST_ptr_t up; /* Pointer to the node in the tree above (before) this node */ - H5ST_ptr_t parent; /* Pointer to the next higher tree node in this tree */ - H5ST_ptr_t lokid; /* Pointer to the lower node from this one, in this tree */ - H5ST_ptr_t eqkid; /* Pointer to the parent node in the next tree down (after) this node */ - H5ST_ptr_t hikid; /* Pointer to the higher node from this one, in this tree */ -} H5ST_node_t; - -/* Wrapper about TST */ -typedef struct { - H5ST_ptr_t root; /* Pointer to actual TST */ -} H5ST_tree_t; - -/* Macro to access "data" pointer in H5ST_node_t's returned from functions */ -#define H5ST_NODE_DATA(p) ((void *)(p->eqkid)) - -/* Private routines */ -H5_DLL H5ST_tree_t *H5ST_create(void); -H5_DLL herr_t H5ST_close(H5ST_tree_t *p); -H5_DLL herr_t H5ST_insert(H5ST_tree_t *root, const char *s, void *obj); -H5_DLL htri_t H5ST_search(H5ST_tree_t *root, const char *s); -H5_DLL H5ST_ptr_t H5ST_find(H5ST_tree_t *root, const char *s); -H5_DLL void * H5ST_locate(H5ST_tree_t *root, const char *s); -H5_DLL H5ST_ptr_t H5ST_findfirst(H5ST_tree_t *p); -H5_DLL H5ST_ptr_t H5ST_findnext(H5ST_ptr_t p); -H5_DLL void * H5ST_remove(H5ST_tree_t *root, const char *s); -H5_DLL herr_t H5ST_delete(H5ST_tree_t *root, H5ST_ptr_t p); -#ifdef H5ST_DEBUG -H5_DLL herr_t H5ST_dump(H5ST_tree_t *tree); -#endif /* H5ST_DEBUG */ - -#endif /* H5STprivate_H */ diff --git a/src/Makefile.am b/src/Makefile.am index e21a3e7..0b4fa5c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -102,7 +102,6 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \ H5Sselect.c H5Stest.c \ H5SL.c \ H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \ - H5ST.c \ H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \ H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dbc7e55..f0d0d8a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -234,7 +234,6 @@ set (testhdf5_SOURCES ${HDF5_TEST_SOURCE_DIR}/tskiplist.c ${HDF5_TEST_SOURCE_DIR}/tsohm.c ${HDF5_TEST_SOURCE_DIR}/ttime.c - ${HDF5_TEST_SOURCE_DIR}/ttst.c ${HDF5_TEST_SOURCE_DIR}/tunicode.c ${HDF5_TEST_SOURCE_DIR}/tvltypes.c ${HDF5_TEST_SOURCE_DIR}/tvlstr.c diff --git a/test/Makefile.am b/test/Makefile.am index 59675f1..5d07428 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -217,7 +217,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ tgenprop.c th5o.c th5s.c tcoords.c theap.c tid.c titerate.c tmeta.c tmisc.c \ - trefer.c trefer_deprec.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c ttst.c tunicode.c \ + trefer.c trefer_deprec.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c tunicode.c \ tvlstr.c tvltypes.c # Sources for Use Cases diff --git a/test/testhdf5.c b/test/testhdf5.c index 5e413f3..45c0f9f 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -45,7 +45,6 @@ main(int argc, char *argv[]) AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL); AddTest("metadata", test_metadata, cleanup_metadata, "Encoding/decoding metadata", NULL); AddTest("checksum", test_checksum, cleanup_checksum, "Checksum algorithm", NULL); - AddTest("tst", test_tst, NULL, "Ternary Search Trees", NULL); AddTest("heap", test_heap, NULL, "Memory Heaps", NULL); AddTest("skiplist", test_skiplist, NULL, "Skip Lists", NULL); AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL); diff --git a/test/testhdf5.h b/test/testhdf5.h index f3cb995..5fb01a8 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -203,7 +203,6 @@ extern "C" { /* Prototypes for the test routines */ void test_metadata(void); void test_checksum(void); -void test_tst(void); void test_heap(void); void test_refstr(void); void test_file(void); diff --git a/test/theap.c b/test/theap.c index f8a6e9b..9d5787b 100644 --- a/test/theap.c +++ b/test/theap.c @@ -1050,7 +1050,7 @@ test_heap_term(void) HDfree(inc_sort_num); if (dec_sort_num) HDfree(dec_sort_num); -} /* end test_tst_term() */ +} /* end test_heap_term() */ /**************************************************************** ** diff --git a/test/ttst.c b/test/ttst.c deleted file mode 100644 index 07f118c..0000000 --- a/test/ttst.c +++ /dev/null @@ -1,391 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - FILE - tst.c - Test HDF Ternary Search Tree (tst) routines. - - REMARKS - - DESIGN - - BUGS/LIMITATIONS - - EXPORTED ROUTINES - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 12/9/02 - Started coding - */ - -#include "testhdf5.h" -#include "H5STprivate.h" - -/* Test words to insert into s TST */ -static const char *words[] = { - "We", "hold", "these", "truths", "to", "be", "self-evident,", - "that", "all", "men", "are", "created", "equal,", "that", - "they", "are", "endowed", "by", "their", "Creator", "with", - "certain", "unalienable", "Rights,", "that", "among", "these", "are", - "Life,", "Liberty", "and", "the", "pursuit", "of", "Happiness."}; -/* Number of words in test words set */ -size_t num_words; - -/* Number of unique words in test word set */ -size_t num_uniq_words; -/* Unique words in test word set */ -char **uniq_words; -/* Randomized order version of words in test word set */ -char **rand_uniq_words; -/* Sorted order version of words in test word set */ -char **sort_uniq_words; - -static int -tst_strcmp(const void *_s1, const void *_s2) -{ - return (HDstrcmp(*(const char *const *)_s1, *(const char *const *)_s2)); -} - -/**************************************************************** -** -** test_tst_init(): Test basic H5ST (ternary search tree) selection code. -** Initialize data for TST testing -** -****************************************************************/ -static void -test_tst_init(void) -{ - time_t curr_time; /* Current time, for seeding random number generator */ - char * tmp_word; /* Temporary pointer to word in word set */ - size_t u, v, w; /* Local index variables */ - - /* Compute the number of words in the test set */ - num_words = sizeof(words) / sizeof(words[0]); - - /* Determine the number of unique words in test set */ - /* (Not particularly efficient, be careful if many words are added to set) */ - num_uniq_words = 0; - for (u = 0; u < num_words; u++) { - /* Assume word is unique */ - num_uniq_words++; - for (v = 0; v < u; v++) - /* If word is already found in words looked at, decrement unique count */ - if (!HDstrcmp(words[u], words[v])) { - num_uniq_words--; - break; - } /* end if */ - } /* end for */ - - /* Allocate space for the array of unique words */ - uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words); - - /* Allocate space for the array of randomized order unique words also */ - rand_uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words); - - /* Allocate space for the array of sorted order unique words also */ - sort_uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words); - - /* Insert unique words from test set into unique word set */ - w = 0; - for (u = 0; u < num_words; u++) { - /* Assume word is unique */ - tmp_word = (char *)words[u]; - for (v = 0; v < u; v++) - /* If word is already found in words looked at, decrement unique count */ - if (!HDstrcmp(words[u], words[v])) { - tmp_word = NULL; - break; - } /* end if */ - - /* Check if word was actually unique */ - if (tmp_word != NULL) - uniq_words[w++] = tmp_word; - } /* end for */ - - /* Create randomized set of unique words */ - for (u = 0; u < num_uniq_words; u++) - rand_uniq_words[u] = uniq_words[u]; - curr_time = HDtime(NULL); - HDsrandom((unsigned)curr_time); - for (u = 0; u < num_uniq_words; u++) { - v = u + ((size_t)HDrandom() % (num_uniq_words - u)); - if (u != v) { - tmp_word = rand_uniq_words[u]; - rand_uniq_words[u] = rand_uniq_words[v]; - rand_uniq_words[v] = tmp_word; - } /* end if */ - } /* end for */ - - /* Create sorted set of unique words */ - for (u = 0; u < num_uniq_words; u++) - sort_uniq_words[u] = uniq_words[u]; - HDqsort(sort_uniq_words, num_uniq_words, sizeof(char *), tst_strcmp); -} /* end test_tst_init() */ - -/**************************************************************** -** -** test_tst_create(): Test basic H5ST (ternary search tree) selection code. -** Tests creating and closing TSTs. -** -****************************************************************/ -static void -test_tst_create(void) -{ - H5ST_tree_t *tree; /* TST created */ - herr_t ret; /* Generic return value */ - - /* Output message about test being performed */ - MESSAGE(5, ("Testing Creating & Closing TSTs\n")); - - /* Try closing a NULL tree */ - tree = NULL; - ret = H5ST_close(tree); - VERIFY(ret, FAIL, "H5ST_close"); - - /* Try creating a TST */ - tree = H5ST_create(); - CHECK_PTR(tree, "H5ST_create"); - - /* Try closing a real tree */ - ret = H5ST_close(tree); - CHECK(ret, FAIL, "H5ST_close"); - -} /* end test_tst_create() */ - -/**************************************************************** -** -** test_tst_insert(): Test basic H5ST (ternary search tree) selection code. -** Tests inserting key/value pairs into TST -** -****************************************************************/ -static void -test_tst_insert(void) -{ - H5ST_tree_t *tree; /* TST created */ - H5ST_ptr_t found; /* Pointer to TST node found */ - void * obj; /* Pointer to object located in TST */ - size_t u; /* Local index counter */ - htri_t check; /* Is string in TST? */ - herr_t ret; /* Generic return value */ - - /* Output message about test being performed */ - MESSAGE(5, ("Testing Inserting Values into TSTs\n")); - - /* Create the TST */ - tree = H5ST_create(); - CHECK_PTR(tree, "H5ST_create"); - - /* Insert unique words into TST, in random order */ - for (u = 0; u < num_uniq_words; u++) { - ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]); - CHECK(ret, FAIL, "H5ST_insert"); - } /* end for */ - - /* Verify that all words were inserted into TST properly */ - for (u = 0; u < num_uniq_words; u++) { - /* Check that the word is present */ - check = H5ST_search(tree, uniq_words[u]); - VERIFY(check, TRUE, "H5ST_search"); - - /* Check that the value "payloads" are correct */ - found = H5ST_find(tree, uniq_words[u]); - CHECK_PTR(found, "H5ST_find"); - - if (HDstrcmp((const char *)found->eqkid, uniq_words[u]) != 0) - TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n", __LINE__, - (char *)found->eqkid, (unsigned)u, uniq_words[u]); - - obj = H5ST_locate(tree, uniq_words[u]); - CHECK_PTR(obj, "H5ST_locate"); - - if (HDstrcmp((const char *)obj, uniq_words[u]) != 0) - TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n", __LINE__, (char *)obj, - (unsigned)u, uniq_words[u]); - } /* end for */ - - /* Verify that words not in the TST aren't found */ - check = H5ST_search(tree, "foo"); - VERIFY(check, FALSE, "H5ST_search"); - check = H5ST_search(tree, "bar"); - VERIFY(check, FALSE, "H5ST_search"); - check = H5ST_search(tree, "baz"); - VERIFY(check, FALSE, "H5ST_search"); - - /* Close the TST */ - ret = H5ST_close(tree); - CHECK(ret, FAIL, "H5ST_close"); -} /* end test_tst_insert() */ - -/**************************************************************** -** -** test_tst_iterate(): Test basic H5ST (ternary search tree) code. -** Tests iterating through key/value pairs in TST -** -****************************************************************/ -static void -test_tst_iterate(void) -{ - H5ST_tree_t *tree; /* TST created */ - H5ST_ptr_t found; /* Pointer to TST node found */ - size_t u; /* Local index counter */ - herr_t ret; /* Generic return value */ - - /* Output message about test being performed */ - MESSAGE(5, ("Testing Iterating Over TSTs\n")); - - /* Create the TST */ - tree = H5ST_create(); - CHECK_PTR(tree, "H5ST_create"); - - /* Insert unique words into TST, in random order */ - for (u = 0; u < num_uniq_words; u++) { - ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]); - CHECK(ret, FAIL, "H5ST_insert"); - } /* end for */ - - /* Use findfirst/findnext calls to iterate through TST */ - found = H5ST_findfirst(tree); - CHECK_PTR(found, "H5ST_findfirst"); - u = 0; - do { - /* Check that the strings in the TST are in the correct order */ - if (HDstrcmp((const char *)found->eqkid, sort_uniq_words[u]) != 0) - TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n", - __LINE__, (char *)found->eqkid, (unsigned)u, sort_uniq_words[u]); - - /* Advance to next string in TST */ - found = H5ST_findnext(found); - u++; - } while (found != NULL); - - /* Close the TST */ - ret = H5ST_close(tree); - CHECK(ret, FAIL, "H5ST_close"); -} /* end test_tst_iterate() */ - -/**************************************************************** -** -** test_tst_remove(): Test basic H5ST (ternary search tree) code. -** Tests removing key/value pairs by string value in TST -** -****************************************************************/ -static void -test_tst_remove(void) -{ - H5ST_tree_t *tree; /* TST created */ - H5ST_ptr_t found; /* Pointer to TST node found */ - void * obj; /* Pointer to object removed from TST */ - htri_t check; /* Is string in TST? */ - size_t u; /* Local index counter */ - herr_t ret; /* Generic return value */ - - /* Output message about test being performed */ - MESSAGE(5, ("Testing Removing String Values from TSTs\n")); - - /* Create the TST */ - tree = H5ST_create(); - CHECK_PTR(tree, "H5ST_create"); - - /* Insert unique words into TST, in random order */ - for (u = 0; u < num_uniq_words; u++) { - ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]); - CHECK(ret, FAIL, "H5ST_insert"); - } /* end for */ - - /* Remove strings from TST in random order */ - for (u = 0; u < num_uniq_words; u++) { - obj = H5ST_remove(tree, rand_uniq_words[u]); - CHECK_PTR(obj, "H5ST_remove"); - - /* Check that the correct string was removed from TST */ - if (HDstrcmp((const char *)obj, rand_uniq_words[u]) != 0) - TestErrPrintf("%d: TST node values don't match!, obj=%s, rand_uniq_words[%u]=%s\n", __LINE__, - (char *)obj, (unsigned)u, rand_uniq_words[u]); - - /* Check that the string can't be found in the TST any longer */ - check = H5ST_search(tree, rand_uniq_words[u]); - VERIFY(check, FALSE, "H5ST_search"); - } /* end for */ - - /* Re-insert unique words into TST, in random order */ - for (u = 0; u < num_uniq_words; u++) { - ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]); - CHECK(ret, FAIL, "H5ST_insert"); - } /* end for */ - - /* Remove TST nodes from TST in random order */ - for (u = 0; u < num_uniq_words; u++) { - /* Get the pointer to the node to delete */ - found = H5ST_find(tree, rand_uniq_words[u]); - CHECK_PTR(found, "H5ST_find"); - - /* Check that the correct object will be removed from TST */ - if (HDstrcmp((const char *)found->eqkid, rand_uniq_words[u]) != 0) - TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, rand_uniq_words[%u]=%s\n", - __LINE__, (char *)found->eqkid, (unsigned)u, rand_uniq_words[u]); - - /* Remove the node */ - ret = H5ST_delete(tree, found); - CHECK(ret, FAIL, "H5ST_delete"); - - /* Check that the string can't be found in the TST any longer */ - check = H5ST_search(tree, rand_uniq_words[u]); - VERIFY(check, FALSE, "H5ST_search"); - } /* end for */ - - /* Close the TST */ - ret = H5ST_close(tree); - CHECK(ret, FAIL, "H5ST_close"); -} /* end test_tst_remove() */ - -/**************************************************************** -** -** test_tst_finalize(): Test basic H5ST (ternary search tree) selection code. -** Wrap up data for TST testing -** -****************************************************************/ -static void -test_tst_finalize(void) -{ - /* Release memory for unordered, randomized and sorted order unique words */ - HDfree(uniq_words); - HDfree(rand_uniq_words); - HDfree(sort_uniq_words); -} /* end test_tst_finalize() */ - -/**************************************************************** -** -** test_tst(): Main H5ST selection testing routine. -** -****************************************************************/ -void -test_tst(void) -{ - /* Output message about test being performed */ - MESSAGE(5, ("Testing Ternary Search Trees\n")); - - /* Initialize TST testing data */ - test_tst_init(); - - /* Actual TST tests */ - test_tst_create(); /* Test TST creation */ - test_tst_insert(); /* Test TST insertion */ - test_tst_iterate(); /* Test TST iteration */ - test_tst_remove(); /* Test TST deletion */ - - /* Finalize TST testing data */ - test_tst_finalize(); -} /* end test_tst() */ -- cgit v0.12 From 6dae5c2cb565fce010db28a5bcfc0220edb98921 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Wed, 31 Mar 2021 09:48:51 -0500 Subject: Fix HDFFV-11232 (#530) * fixed missed closing of a dataset * fixed missed closing of a dataset * fixed typo in error return * Committing clang-format changes * minor edits * code format * Committing clang-format changes * code format * minor edit * added H5fortkit dependency for H5VLff.F90, HDFFV-11232 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- fortran/src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 5168eb6..65ffa0c 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -155,7 +155,7 @@ H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo -H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo +H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo H5fortkit.lo H5Zff.lo: $(srcdir)/H5Zff.F90 H5f90global.lo H5_gen.lo: H5_gen.F90 H5f90global.lo H5Aff.lo H5Dff.lo H5Pff.lo HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \ -- cgit v0.12 From 0f0721f2d616ac9edd7cea642baa176c87713757 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 31 Mar 2021 13:31:20 -0700 Subject: Minor warning fixes in develop (#526) * Committing clang-format changes * Minor warning fixes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- hl/src/H5PT.c | 4 +- src/H5FDlog.c | 229 +++++++++++++++++++++++++++------------------------- src/H5trace.c | 47 ++++++----- test/cache_common.c | 1 - test/dtypes.c | 2 +- 5 files changed, 145 insertions(+), 138 deletions(-) diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index d9fdfb0..f5fb99f 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -29,7 +29,7 @@ static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT; #define H5PT_HASH_TABLE_SIZE 64 /* Packet Table private functions */ -static herr_t H5PT_free_id(void *id); +static herr_t H5PT_free_id(void *id, void **_ctx); static herr_t H5PT_close(htbl_t *table); static herr_t H5PT_create_index(htbl_t *table_id); static herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index); @@ -402,7 +402,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -H5PT_free_id(void *id) +H5PT_free_id(void *id, void H5_ATTR_UNUSED **_ctx) { HDfree(id); return SUCCEED; diff --git a/src/H5FDlog.c b/src/H5FDlog.c index aa2d6db..b836a3d 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -426,7 +426,7 @@ done: if (new_fa->logfile) new_fa->logfile = (char *)H5MM_xfree(new_fa->logfile); H5MM_free(new_fa); - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__log_fapl_copy() */ @@ -484,8 +484,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif - H5_timer_t open_timer = {{0}, {0}, {0}, FALSE}; /* Timer for open() call */ - H5_timer_t stat_timer = {{0}, {0}, {0}, FALSE}; /* Timer for stat() call */ + H5_timer_t open_timer; /* Timer for open() call */ + H5_timer_t stat_timer; /* Timer for stat() call */ h5_stat_t sb; H5FD_t * ret_value = NULL; /* Return value */ @@ -502,6 +502,10 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + /* Initialize timers */ + H5_timer_init(&open_timer); + H5_timer_init(&stat_timer); + /* Build the open flags */ o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY; if (H5F_ACC_TRUNC & flags) @@ -518,10 +522,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") /* Start timer for open() call */ - if (fa->flags & H5FD_LOG_TIME_OPEN) { - H5_timer_init(&open_timer); + if (fa->flags & H5FD_LOG_TIME_OPEN) H5_timer_start(&open_timer); - } /* end if */ /* Open the file */ if ((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) { @@ -531,17 +533,15 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags); - } /* end if */ + } /* Stop timer for open() call */ if (fa->flags & H5FD_LOG_TIME_OPEN) H5_timer_stop(&open_timer); /* Start timer for stat() call */ - if (fa->flags & H5FD_LOG_TIME_STAT) { - H5_timer_init(&stat_timer); + if (fa->flags & H5FD_LOG_TIME_STAT) H5_timer_start(&stat_timer); - } /* end if */ /* Get the file stats */ if (HDfstat(fd, &sb) < 0) @@ -594,15 +594,15 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (file->fa.flags & H5FD_LOG_FILE_READ) { file->nread = (unsigned char *)H5MM_calloc(file->iosize); HDassert(file->nread); - } /* end if */ + } if (file->fa.flags & H5FD_LOG_FILE_WRITE) { file->nwrite = (unsigned char *)H5MM_calloc(file->iosize); HDassert(file->nwrite); - } /* end if */ + } if (file->fa.flags & H5FD_LOG_FLAVOR) { file->flavor = (unsigned char *)H5MM_calloc(file->iosize); HDassert(file->flavor); - } /* end if */ + } /* Set the log file pointer */ if (fa->logfile) @@ -616,14 +616,14 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5_timer_get_times(open_timer, &open_times); HDfprintf(file->logfp, "Open took: (%f s)\n", open_times.elapsed); - } /* end if */ + } if (file->fa.flags & H5FD_LOG_TIME_STAT) { H5_timevals_t stat_times; /* Elapsed time for stat() call */ H5_timer_get_times(stat_timer, &stat_times); HDfprintf(file->logfp, "Stat took: (%f s)\n", stat_times.elapsed); - } /* end if */ - } /* end if */ + } + } /* Check the file locking flags in the fapl */ if (ignore_disabled_file_locks_s != FAIL) @@ -645,7 +645,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0) if (H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single") - } /* end if */ + } /* Set return value */ ret_value = (H5FD_t *)file; @@ -656,7 +656,7 @@ done: HDclose(fd); if (file) file = H5FL_FREE(H5FD_log_t, file); - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__log_open() */ @@ -677,20 +677,21 @@ done: static herr_t H5FD__log_close(H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t *)_file; - H5_timer_t close_timer = {{0}, {0}, {0}, FALSE}; /* Timer for close() call */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_log_t *file = (H5FD_log_t *)_file; + H5_timer_t close_timer; /* Timer for close() call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity check */ HDassert(file); + /* Initialize timer */ + H5_timer_init(&close_timer); + /* Start timer for close() call */ - if (file->fa.flags & H5FD_LOG_TIME_CLOSE) { - H5_timer_init(&close_timer); + if (file->fa.flags & H5FD_LOG_TIME_CLOSE) H5_timer_start(&close_timer); - } /* end if */ /* Close the underlying file */ if (HDclose(file->fd) < 0) @@ -711,7 +712,7 @@ H5FD__log_close(H5FD_t *_file) H5_timer_get_times(close_timer, &close_times); HDfprintf(file->logfp, "Close took: (%f s)\n", close_times.elapsed); - } /* end if */ + } /* Dump the total number of seek/read/write operations */ if (file->fa.flags & H5FD_LOG_NUM_READ) @@ -746,13 +747,13 @@ H5FD__log_close(H5FD_t *_file) last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); last_val = file->nwrite[addr]; last_addr = addr; - } /* end if */ + } addr++; - } /* end while */ + } HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); - } /* end if */ + } /* Dump the read I/O information */ if (file->fa.flags & H5FD_LOG_FILE_READ) { @@ -767,13 +768,13 @@ H5FD__log_close(H5FD_t *_file) last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); last_val = file->nread[addr]; last_addr = addr; - } /* end if */ + } addr++; - } /* end while */ + } HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); - } /* end if */ + } /* Dump the I/O flavor information */ if (file->fa.flags & H5FD_LOG_FLAVOR) { @@ -788,12 +789,12 @@ H5FD__log_close(H5FD_t *_file) last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); last_val = file->flavor[addr]; last_addr = addr; - } /* end if */ + } addr++; - } /* end while */ + } HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); - } /* end if */ + } /* Free the logging information */ if (file->fa.flags & H5FD_LOG_FILE_WRITE) @@ -920,7 +921,7 @@ H5FD__log_query(const H5FD_t *_file, unsigned long *flags /* out */) if (file && file->fam_to_single) *flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */ - } /* end if */ + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__log_query() */ @@ -959,13 +960,13 @@ H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hs HDassert(addr < file->iosize); H5_CHECK_OVERFLOW(size, hsize_t, size_t); HDmemset(&file->flavor[addr], (int)type, (size_t)size); - } /* end if */ + } if (file->fa.flags & H5FD_LOG_ALLOC) HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", addr, (haddr_t)((addr + size) - 1), size, flavors[type]); - } /* end if */ + } /* Set return value */ ret_value = addr; @@ -998,13 +999,13 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had HDassert(addr < file->iosize); H5_CHECK_OVERFLOW(size, hsize_t, size_t); HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size); - } /* end if */ + } /* Log the file memory freed */ if (file->fa.flags & H5FD_LOG_FREE) HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", addr, (haddr_t)((addr + size) - 1), size, flavors[type]); - } /* end if */ + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__log_free() */ @@ -1065,14 +1066,14 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) HDassert(addr < file->iosize); H5_CHECK_OVERFLOW(size, hsize_t, size_t); HDmemset(&file->flavor[file->eoa], (int)type, (size_t)size); - } /* end if */ + } /* Log the extension like an allocation */ if (file->fa.flags & H5FD_LOG_ALLOC) HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", file->eoa, addr, size, flavors[type]); - } /* end if */ + } /* Check for decreasing file size */ if (H5F_addr_lt(addr, file->eoa) && H5F_addr_gt(addr, 0)) { @@ -1083,15 +1084,15 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) HDassert((addr + size) < file->iosize); H5_CHECK_OVERFLOW(size, hsize_t, size_t); HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size); - } /* end if */ + } /* Log the shrink like a free */ if (file->fa.flags & H5FD_LOG_FREE) HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", file->eoa, addr, size, flavors[type]); - } /* end if */ - } /* end if */ + } + } file->eoa = addr; @@ -1174,23 +1175,22 @@ static herr_t H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf /*out*/) { - H5FD_log_t * file = (H5FD_log_t *)_file; - size_t orig_size = size; /* Save the original size for later */ - haddr_t orig_addr = addr; - H5_timer_t read_timer = {{0}, {0}, {0}, FALSE}; /* Timer for read operation */ - H5_timevals_t read_times; /* Elapsed time for read operation */ -#ifndef H5_HAVE_PREADWRITE - H5_timer_t seek_timer; /* Timer for seek operation */ - H5_timevals_t seek_times; /* Elapsed time for seek operation */ -#endif /* H5_HAVE_PREADWRITE */ - HDoff_t offset = (HDoff_t)addr; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_log_t * file = (H5FD_log_t *)_file; + size_t orig_size = size; /* Save the original size for later */ + haddr_t orig_addr = addr; + H5_timer_t read_timer; /* Timer for read operation */ + H5_timevals_t read_times; /* Elapsed time for read operation */ + HDoff_t offset = (HDoff_t)addr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); + /* Initialize timer */ + H5_timer_init(&read_timer); + /* Check for overflow conditions */ if (!H5F_addr_defined(addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) @@ -1207,17 +1207,22 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had HDassert((addr + size) < file->iosize); while (tmp_size-- > 0) file->nread[tmp_addr++]++; - } /* end if */ - } /* end if */ + } + } #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 */ + + /* Initialize timer */ + H5_timer_init(&seek_timer); + /* Start timer for seek() call */ - if (file->fa.flags & H5FD_LOG_TIME_SEEK) { - H5_timer_init(&seek_timer); + if (file->fa.flags & H5FD_LOG_TIME_SEEK) H5_timer_start(&seek_timer); - } /* end if */ if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") @@ -1234,7 +1239,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had if (file->fa.flags & H5FD_LOG_TIME_SEEK) { H5_timer_get_times(seek_timer, &seek_times); file->total_seek_time += seek_times.elapsed; - } /* end if */ + } /* Emit log string if we're tracking individual seek events. */ if (file->fa.flags & H5FD_LOG_LOC_SEEK) { @@ -1248,15 +1253,13 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed); else HDfprintf(file->logfp, "\n"); - } /* end if */ - } /* end if */ -#endif /* H5_HAVE_PREADWRITE */ + } + } +#endif /* H5_HAVE_PREADWRITE */ /* Start timer for read operation */ - if (file->fa.flags & H5FD_LOG_TIME_READ) { - H5_timer_init(&read_timer); + if (file->fa.flags & H5FD_LOG_TIME_READ) H5_timer_start(&read_timer); - } /* end if */ /* * Read data, being careful of interrupted system calls, partial results, @@ -1301,13 +1304,13 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); - } /* end if */ + } if (0 == bytes_read) { - /* end of file but not end of format address space */ + /* End of file but not end of format address space */ HDmemset(buf, 0, size); break; - } /* end if */ + } HDassert(bytes_read >= 0); HDassert((size_t)bytes_read <= size); @@ -1315,8 +1318,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had size -= (size_t)bytes_read; addr += (haddr_t)bytes_read; buf = (char *)buf + bytes_read; - - } /* end while */ + } /* Stop timer for read operation */ if (file->fa.flags & H5FD_LOG_TIME_READ) @@ -1330,7 +1332,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had if (file->fa.flags & H5FD_LOG_TIME_READ) { H5_timer_get_times(read_timer, &read_times); file->total_read_time += read_times.elapsed; - } /* end if */ + } /* Log information about the read */ if (file->fa.flags & H5FD_LOG_LOC_READ) { @@ -1344,7 +1346,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] || (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] == H5FD_MEM_DEFAULT); - } /* end if */ + } /* Add the read time, if we're tracking that. * Note that the read time is NOT emitted for when just H5FD_LOG_TIME_READ @@ -1354,7 +1356,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had HDfprintf(file->logfp, " (%fs @ %f)\n", read_times.elapsed, read_timer.initial.elapsed); else HDfprintf(file->logfp, "\n"); - } /* end if */ + } /* Update current position */ file->pos = addr; @@ -1365,7 +1367,7 @@ done: /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__log_read() */ @@ -1388,17 +1390,13 @@ static herr_t H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { - H5FD_log_t * file = (H5FD_log_t *)_file; - size_t orig_size = size; /* Save the original size for later */ - haddr_t orig_addr = addr; - H5_timer_t write_timer = {{0}, {0}, {0}, FALSE}; /* Timer for write operation */ - H5_timevals_t write_times; /* Elapsed time for write operation */ -#ifndef H5_HAVE_PREADWRITE - H5_timer_t seek_timer; /* Timer for seek operation */ - H5_timevals_t seek_times; /* Elapsed time for seek operation */ -#endif /* H5_HAVE_PREADWRITE */ - HDoff_t offset = (HDoff_t)addr; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_log_t * file = (H5FD_log_t *)_file; + size_t orig_size = size; /* Save the original size for later */ + haddr_t orig_addr = addr; + H5_timer_t write_timer; /* Timer for write operation */ + H5_timevals_t write_times; /* Elapsed time for write operation */ + HDoff_t offset = (HDoff_t)addr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1406,13 +1404,16 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha HDassert(size > 0); HDassert(buf); + /* Initialize timer */ + H5_timer_init(&write_timer); + /* Verify that we are writing out the type of data we allocated in this location */ if (file->flavor) { HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[addr] || (H5FD_mem_t)file->flavor[addr] == H5FD_MEM_DEFAULT); HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(addr + size) - 1] || (H5FD_mem_t)file->flavor[(addr + size) - 1] == H5FD_MEM_DEFAULT); - } /* end if */ + } /* Check for overflow conditions */ if (!H5F_addr_defined(addr)) @@ -1430,16 +1431,21 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha HDassert((addr + size) < file->iosize); while (tmp_size-- > 0) file->nwrite[tmp_addr++]++; - } /* end if */ + } #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 */ + + /* Initialize timer */ + H5_timer_init(&seek_timer); + /* Start timer for seek() call */ - if (file->fa.flags & H5FD_LOG_TIME_SEEK) { - H5_timer_init(&seek_timer); + if (file->fa.flags & H5FD_LOG_TIME_SEEK) H5_timer_start(&seek_timer); - } /* end if */ if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") @@ -1456,7 +1462,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha if (file->fa.flags & H5FD_LOG_TIME_SEEK) { H5_timer_get_times(seek_timer, &seek_times); file->total_seek_time += seek_times.elapsed; - } /* end if */ + } /* Emit log string if we're tracking individual seek events. */ if (file->fa.flags & H5FD_LOG_LOC_SEEK) { @@ -1470,15 +1476,13 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed); else HDfprintf(file->logfp, "\n"); - } /* end if */ - } /* end if */ -#endif /* H5_HAVE_PREADWRITE */ + } + } +#endif /* H5_HAVE_PREADWRITE */ /* Start timer for write operation */ - if (file->fa.flags & H5FD_LOG_TIME_WRITE) { - H5_timer_init(&write_timer); + if (file->fa.flags & H5FD_LOG_TIME_WRITE) H5_timer_start(&write_timer); - } /* end if */ /* * Write the data, being careful of interrupted system calls and partial @@ -1545,7 +1549,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha if (file->fa.flags & H5FD_LOG_TIME_WRITE) { H5_timer_get_times(write_timer, &write_times); file->total_write_time += write_times.elapsed; - } /* end if */ + } /* Log information about the write */ if (file->fa.flags & H5FD_LOG_LOC_WRITE) { @@ -1558,8 +1562,8 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha if ((H5FD_mem_t)file->flavor[orig_addr] == H5FD_MEM_DEFAULT) { HDmemset(&file->flavor[orig_addr], (int)type, orig_size); HDfprintf(file->logfp, " (fresh)"); - } /* end if */ - } /* end if */ + } + } /* Add the write time, if we're tracking that. * Note that the write time is NOT emitted for when just H5FD_LOG_TIME_WRITE @@ -1569,7 +1573,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha HDfprintf(file->logfp, " (%fs @ %f)\n", write_times.elapsed, write_timer.initial.elapsed); else HDfprintf(file->logfp, "\n"); - } /* end if */ + } /* Update current position and eof */ file->pos = addr; @@ -1582,7 +1586,7 @@ done: /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__log_write() */ @@ -1612,14 +1616,15 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ /* Extend the file to make sure it's large enough */ if (!H5F_addr_eq(file->eoa, file->eof)) { - H5_timer_t trunc_timer = {{0}, {0}, {0}, FALSE}; /* Timer for truncate operation */ - H5_timevals_t trunc_times; /* Elapsed time for truncate operation */ + H5_timer_t trunc_timer; /* Timer for truncate operation */ + H5_timevals_t trunc_times; /* Elapsed time for truncate operation */ + + /* Initialize timer */ + H5_timer_init(&trunc_timer); /* Start timer for truncate operation */ - if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) { - H5_timer_init(&trunc_timer); + if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) H5_timer_start(&trunc_timer); - } /* end if */ #ifdef H5_HAVE_WIN32_API { @@ -1643,7 +1648,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ dwError = GetLastError(); if (dwError != NO_ERROR) HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer") - } /* end if */ + } if (0 == SetEndOfFile(file->hFile)) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") @@ -1666,7 +1671,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) { H5_timer_get_times(trunc_timer, &trunc_times); file->total_truncate_time += trunc_times.elapsed; - } /* end if */ + } /* Emit log string if we're tracking individual truncate events. */ if (file->fa.flags & H5FD_LOG_TRUNCATE) { @@ -1680,7 +1685,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ HDfprintf(file->logfp, " (%fs @ %f)\n", trunc_times.elapsed, trunc_timer.initial.elapsed); else HDfprintf(file->logfp, "\n"); - } /* end if */ + } /* Update the eof value */ file->eof = file->eoa; diff --git a/src/H5trace.c b/src/H5trace.c index d0c6fdd..d587853 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -3883,8 +3883,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) hssize_t i; FILE * out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; - H5_timer_t function_timer = {{0}, {0}, {0}, FALSE}; - H5_timevals_t function_times = {0.0, 0.0, 0.0}; + H5_timer_t function_timer; + H5_timevals_t function_times = {0.0, 0.0, 0.0}; static H5_timer_t running_timer; H5_timevals_t running_times; static int current_depth = 0; @@ -3893,36 +3893,39 @@ H5_trace(const double *returning, const char *func, const char *type, ...) /* FUNC_ENTER() should not be called */ if (!out) - return (double)0.0F; /*tracing is off*/ + return 0.0; /* Tracing is off */ + + /* Initialize the timer for this function */ + if (H5_debug_g.ttimes) + H5_timer_init(&function_timer); if (H5_debug_g.ttop) { if (returning) { if (current_depth > 1) { --current_depth; return (double)0.0F; - } /* end if */ - } /* end if */ + } + } else { if (current_depth > 0) { - /*do not update last_call_depth*/ + /* Do not update last_call_depth */ current_depth++; return (double)0.0F; - } /* end if */ - } /* end else */ - } /* end if */ + } + } + } /* Get time for event if the trace times flag is set */ if (is_first_invocation && H5_debug_g.ttimes) { - /* start the library-wide timer */ + /* Start the library-wide timer */ is_first_invocation = FALSE; H5_timer_init(&running_timer); H5_timer_start(&running_timer); - } /* end if */ - if (H5_debug_g.ttimes) { - /* start the timer for this function */ - H5_timer_init(&function_timer); + } + + /* Start the timer for this function */ + if (H5_debug_g.ttimes) H5_timer_start(&function_timer); - } /* end if */ /* Create the ref-counted string */ rs = H5RS_create(NULL); @@ -3945,15 +3948,15 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5_timer_get_times(running_timer, &running_times); HDsprintf(tmp, "%.6f", (function_times.elapsed - running_times.elapsed)); H5RS_asprintf_cat(rs, " %*s ", (int)HDstrlen(tmp), ""); - } /* end if */ + } for (i = 0; i < current_depth; i++) H5RS_aputc(rs, '+'); H5RS_asprintf_cat(rs, "%*s%s = ", 2 * current_depth, "", func); - } /* end if */ + } else /* Continue current line with return value */ H5RS_acat(rs, " = "); - } /* end if */ + } else { if (current_depth > last_call_depth) H5RS_acat(rs, " = \n"); @@ -3961,11 +3964,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5_timer_get_times(function_timer, &function_times); H5_timer_get_times(running_timer, &running_times); H5RS_asprintf_cat(rs, "@%.6f ", (function_times.elapsed - running_times.elapsed)); - } /* end if */ + } for (i = 0; i < current_depth; i++) H5RS_aputc(rs, '+'); H5RS_asprintf_cat(rs, "%*s%s(", 2 * current_depth, "", func); - } /* end else */ + } /* Format arguments into the refcounted string */ HDva_start(ap, type); @@ -3978,7 +3981,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5_timer_get_times(running_timer, &running_times); H5RS_asprintf_cat(rs, " @%.6f [dt=%.6f]", (function_times.elapsed - running_times.elapsed), (function_times.elapsed - *returning)); - } /* end if */ + } /* Display generated string */ if (returning) @@ -3986,7 +3989,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { last_call_depth = current_depth++; H5RS_acat(rs, ")"); - } /* end else */ + } HDfputs(H5RS_get_str(rs), out); HDfflush(out); H5RS_decr(rs); diff --git a/test/cache_common.c b/test/cache_common.c index 676b8d1..7269c49 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -2757,7 +2757,6 @@ flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_ if (pass) { H5C_t *cache_ptr; - herr_t result = 0; HDassert(file_ptr); diff --git a/test/dtypes.c b/test/dtypes.c index bbc0690..626c58c 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1485,7 +1485,7 @@ test_compound_8(void) struct s2 { char c; s1 d; - } s2; + }; hid_t tid1, tid1_copy, tid2, tid2_copy, tid3, arr_tid; size_t tsize; hsize_t dims[1] = {ARRAY_DIM}; -- cgit v0.12 From 78fe6751b5a682111e8bc2bf7ce944c55d52ba56 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 31 Mar 2021 13:52:57 -0700 Subject: Removes implementation of my_strdup() from the multi VFD (#527) * Committing clang-format changes * Removes my_strdup() from the multi VFD * Use strdup directly when memory sanity checks are off Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5FDmulti.c | 44 +++++++++++--------------------------------- src/H5MM.c | 15 +++++++++++++-- src/H5private.h | 15 +++------------ 3 files changed, 27 insertions(+), 47 deletions(-) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 168bbe1..9226624 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -35,6 +35,15 @@ #define TRUE 1 #endif +/* Windows doesn't like some POSIX names and redefines them with an + * underscore + */ +#ifdef _WIN32 +#define my_strdup _strdup +#else +#define my_strdup strdup +#endif + /* Loop through all mapped files */ #define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) \ { \ @@ -103,9 +112,8 @@ typedef struct H5FD_multi_dxpl_t { } H5FD_multi_dxpl_t; /* Private functions */ -static char *my_strdup(const char *s); -static int compute_next(H5FD_multi_t *file); -static int open_members(H5FD_multi_t *file); +static int compute_next(H5FD_multi_t *file); +static int open_members(H5FD_multi_t *file); /* Callback prototypes */ static herr_t H5FD_multi_term(void); @@ -172,36 +180,6 @@ static const H5FD_class_t H5FD_multi_g = { }; /*------------------------------------------------------------------------- - * Function: my_strdup - * - * Purpose: Private version of strdup() - * - * Return: Success: Ptr to new copy of string - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Friday, August 13, 1999 - * - *------------------------------------------------------------------------- - */ -static char * -my_strdup(const char *s) -{ - char * x; - size_t str_len; - - if (!s) - return NULL; - str_len = strlen(s) + 1; - if (NULL == (x = (char *)malloc(str_len))) - return NULL; - memcpy(x, s, str_len); - - return x; -} - -/*------------------------------------------------------------------------- * Function: H5FD_multi_init * * Purpose: Initialize this driver by registering the driver with the diff --git a/src/H5MM.c b/src/H5MM.c index d17db16..b4447f6 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -449,11 +449,17 @@ H5MM_xstrdup(const char *s) FUNC_ENTER_NOAPI(NULL) +#if defined H5_MEMORY_ALLOC_SANITY_CHECK if (s) { if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDstrcpy(ret_value, s); - } /* end if */ + } +#else + if (s) + if (NULL == (ret_value = HDstrdup(s))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed") +#endif done: FUNC_LEAVE_NOAPI(ret_value) @@ -483,10 +489,15 @@ H5MM_strdup(const char *s) FUNC_ENTER_NOAPI(NULL) if (!s) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "null string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed") +#if defined H5_MEMORY_ALLOC_SANITY_CHECK if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDstrcpy(ret_value, s); +#else + if (NULL == (ret_value = HDstrdup(s))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed") +#endif done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5private.h b/src/H5private.h index 0d6377c..efc19d3 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1484,6 +1484,9 @@ H5_DLL void HDsrand(unsigned int seed); #ifndef HDstrcspn #define HDstrcspn(X, Y) strcspn(X, Y) #endif /* HDstrcspn */ +#ifndef HDstrdup +#define HDstrdup(S) strdup(S) +#endif /* HDstrdup */ #ifndef HDstrerror #define HDstrerror(N) strerror(N) #endif /* HDstrerror */ @@ -1672,18 +1675,6 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #define HDwrite(F, M, Z) write(F, M, Z) #endif /* HDwrite */ -/* - * And now for a couple non-Posix functions... Watch out for systems that - * define these in terms of macros. - */ -#if !defined strdup && !defined H5_HAVE_STRDUP -extern char * strdup(const char *s); -#endif - -#ifndef HDstrdup -#define HDstrdup(S) strdup(S) -#endif /* HDstrdup */ - /* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ /* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ #define H5_STRINGIZE(x) #x -- cgit v0.12 From 052eed29d8922b87d4aa2734e4366de461326dd0 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 12 Apr 2021 20:21:55 -0400 Subject: Remove unused #cmakedefine and autotools checks (#431) With C99 as the minimum, there's no point checking for these standard things anymore. --- config/cmake/H5pubconf.h.in | 27 --------------------------- config/cmake_ext_mod/ConfigureChecks.cmake | 6 ------ configure.ac | 1 - 3 files changed, 34 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 4ba6303..c57d85a 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -243,21 +243,9 @@ /* Define to 1 if you have the `z' library (-lz). */ #cmakedefine H5_HAVE_LIBZ @H5_HAVE_LIBZ@ -/* Define to 1 if you have the `llround' function. */ -#cmakedefine H5_HAVE_LLROUND @H5_HAVE_LLROUND@ - -/* Define to 1 if you have the `llroundf' function. */ -#cmakedefine H5_HAVE_LLROUNDF @H5_HAVE_LLROUNDF@ - /* Define to 1 if you have the `longjmp' function. */ #cmakedefine H5_HAVE_LONGJMP @H5_HAVE_LONGJMP@ -/* Define to 1 if you have the `lround' function. */ -#cmakedefine H5_HAVE_LROUND @H5_HAVE_LROUND@ - -/* Define to 1 if you have the `lroundf' function. */ -#cmakedefine H5_HAVE_LROUNDF @H5_HAVE_LROUNDF@ - /* Define to 1 if you have the `lseek64' function. */ #cmakedefine H5_HAVE_LSEEK64 @H5_HAVE_LSEEK64@ @@ -322,12 +310,6 @@ compiled */ #cmakedefine H5_HAVE_ROS3_VFD @H5_HAVE_ROS3_VFD@ -/* Define to 1 if you have the `round' function. */ -#cmakedefine H5_HAVE_ROUND @H5_HAVE_ROUND@ - -/* Define to 1 if you have the `roundf' function. */ -#cmakedefine H5_HAVE_ROUNDF @H5_HAVE_ROUNDF@ - /* Define to 1 if you have the `setjmp' function. */ #cmakedefine H5_HAVE_SETJMP @H5_HAVE_SETJMP@ @@ -781,19 +763,10 @@ /* Define for large files, on AIX-style hosts. */ #cmakedefine H5__LARGE_FILES -/* Define to empty if `const' does not conform to ANSI C. */ -#cmakedefine H5_const - /* Define to `long int' if does not define. */ #cmakedefine H5_off_t /* Define to `long' if does not define. */ -#cmakedefine H5_ptrdiff_t - -/* Define to `unsigned long' if does not define. */ -#cmakedefine H5_size_t - -/* Define to `long' if does not define. */ #cmakedefine H5_ssize_t #endif diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 004aded..38b5ab3 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -500,18 +500,12 @@ CHECK_FUNCTION_EXISTS (frexpl ${HDF_PREFIX}_HAVE_FREXPL) CHECK_FUNCTION_EXISTS (gethostname ${HDF_PREFIX}_HAVE_GETHOSTNAME) CHECK_FUNCTION_EXISTS (getrusage ${HDF_PREFIX}_HAVE_GETRUSAGE) -CHECK_FUNCTION_EXISTS (llround ${HDF_PREFIX}_HAVE_LLROUND) -CHECK_FUNCTION_EXISTS (llroundf ${HDF_PREFIX}_HAVE_LLROUNDF) -CHECK_FUNCTION_EXISTS (lround ${HDF_PREFIX}_HAVE_LROUND) -CHECK_FUNCTION_EXISTS (lroundf ${HDF_PREFIX}_HAVE_LROUNDF) CHECK_FUNCTION_EXISTS (lstat ${HDF_PREFIX}_HAVE_LSTAT) CHECK_FUNCTION_EXISTS (pread ${HDF_PREFIX}_HAVE_PREAD) CHECK_FUNCTION_EXISTS (pwrite ${HDF_PREFIX}_HAVE_PWRITE) CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R) CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM) -CHECK_FUNCTION_EXISTS (round ${HDF_PREFIX}_HAVE_ROUND) -CHECK_FUNCTION_EXISTS (roundf ${HDF_PREFIX}_HAVE_ROUNDF) CHECK_FUNCTION_EXISTS (setsysinfo ${HDF_PREFIX}_HAVE_SETSYSINFO) CHECK_FUNCTION_EXISTS (signal ${HDF_PREFIX}_HAVE_SIGNAL) diff --git a/configure.ac b/configure.ac index c2c38e6..d769ddc 100644 --- a/configure.ac +++ b/configure.ac @@ -2054,7 +2054,6 @@ AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([snprintf srandom strdup symlink system]) AC_CHECK_FUNCS([strtoll strtoull]) AC_CHECK_FUNCS([tmpfile asprintf vasprintf vsnprintf waitpid]) -AC_CHECK_FUNCS([roundf lroundf llroundf round lround llround]) ## ---------------------------------------------------------------------- ## Check compiler characteristics -- cgit v0.12 From e21f7aaac4a4d34a8a5aa1330fb2ed6814532cfb Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 15 Apr 2021 07:59:01 -0500 Subject: Tools long double updates (#522) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 9 +- java/test/CMakeLists.txt | 6 + java/test/Makefile.am | 2 + java/test/TestAll.java | 4 +- java/test/TestH5Arw.java | 449 +++++++++++++++++++++++ java/test/TestH5Drw.java | 378 +++++++++++++++++++ java/test/junit.sh.in | 46 +++ java/test/testfiles/JUnit-TestH5Arw.txt | 13 + java/test/testfiles/JUnit-TestH5Drw.txt | 13 + release_docs/RELEASE.txt | 17 +- tools/lib/h5tools_dump.c | 19 +- tools/lib/h5tools_utils.c | 1 - tools/src/h5ls/h5ls.c | 5 - tools/test/h5dump/CMakeTests.cmake | 18 +- tools/test/h5dump/h5dumpgentest.c | 157 ++++++++ tools/test/h5dump/testh5dump.sh.in | 7 +- tools/testfiles/tfloatsattrs.ddl | 621 ++++++++++++++++++++++++++++++++ tools/testfiles/tfloatsattrs.h5 | Bin 0 -> 47264 bytes tools/testfiles/tfloatsattrs.wddl | 621 ++++++++++++++++++++++++++++++++ tools/testfiles/tldouble.ddl | 2 +- tools/testfiles/tldouble.wddl | 11 - tools/testfiles/tldouble_scalar.ddl | 2 +- tools/testfiles/tldouble_scalar.wddl | 26 -- tools/testfiles/tnbit.ddl | 2 +- tools/testfiles/treadintfilter.ddl | 2 +- 25 files changed, 2356 insertions(+), 75 deletions(-) create mode 100644 java/test/TestH5Arw.java create mode 100644 java/test/TestH5Drw.java create mode 100644 java/test/testfiles/JUnit-TestH5Arw.txt create mode 100644 java/test/testfiles/JUnit-TestH5Drw.txt create mode 100644 tools/testfiles/tfloatsattrs.ddl create mode 100644 tools/testfiles/tfloatsattrs.h5 create mode 100644 tools/testfiles/tfloatsattrs.wddl delete mode 100644 tools/testfiles/tldouble.wddl delete mode 100755 tools/testfiles/tldouble_scalar.wddl diff --git a/MANIFEST b/MANIFEST index 23499d3..fb43579 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1982,6 +1982,9 @@ ./tools/testfiles/tfill.ddl ./tools/testfiles/tfilters.h5 ./tools/testfiles/tfletcher32.ddl +./tools/testfiles/tfloatsattrs.ddl +./tools/testfiles/tfloatsattrs.h5 +./tools/testfiles/tfloatsattrs.wddl ./tools/testfiles/tfvalues.h5 ./tools/testfiles/tgroup-1.ddl ./tools/testfiles/tgroup-2.ddl @@ -2020,10 +2023,8 @@ ./tools/testfiles/tlarge_objname.ddl ./tools/testfiles/tlarge_objname.h5 ./tools/testfiles/tldouble.ddl -./tools/testfiles/tldouble.wddl ./tools/testfiles/tldouble.h5 ./tools/testfiles/tldouble_scalar.ddl -./tools/testfiles/tldouble_scalar.wddl ./tools/testfiles/tldouble_scalar.h5 ./tools/testfiles/tlonglinks.ddl ./tools/testfiles/tlonglinks.h5 @@ -3405,9 +3406,11 @@ ./java/test/junit.sh.in ./java/test/testfiles/JUnit-TestH5.txt ./java/test/testfiles/JUnit-TestH5A.txt +./java/test/testfiles/JUnit-TestH5Arw.txt ./java/test/testfiles/JUnit-TestH5Dparams.txt ./java/test/testfiles/JUnit-TestH5D.txt ./java/test/testfiles/JUnit-TestH5Dplist.txt +./java/test/testfiles/JUnit-TestH5Drw.txt ./java/test/testfiles/JUnit-TestH5E.txt ./java/test/testfiles/JUnit-TestH5Edefault.txt ./java/test/testfiles/JUnit-TestH5Eparams.txt @@ -3446,9 +3449,11 @@ ./java/test/h5ex_g_iterate.orig ./java/test/TestH5.java ./java/test/TestH5A.java +./java/test/TestH5Arw.java ./java/test/TestH5Dparams.java ./java/test/TestH5D.java ./java/test/TestH5Dplist.java +./java/test/TestH5Drw.java ./java/test/TestH5E.java ./java/test/TestH5Edefault.java ./java/test/TestH5Eparams.java diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 10f9d52..ffaf5f5 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -23,6 +23,7 @@ set (HDF5_JAVA_TEST_SOURCES TestH5Dparams TestH5D TestH5Dplist + TestH5Drw TestH5Lparams TestH5Lbasic TestH5Lcreate @@ -34,6 +35,7 @@ set (HDF5_JAVA_TEST_SOURCES TestH5Pvirtual TestH5Plist TestH5A + TestH5Arw TestH5Oparams TestH5Obasic TestH5Ocreate @@ -98,6 +100,8 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/tdatareg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5" "${PROJECT_BINARY_DIR}/tintsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5" "${PROJECT_BINARY_DIR}/tfloatsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list}) @@ -217,6 +221,8 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/${voltest}/tdatareg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/${voltest}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5" "${PROJECT_BINARY_DIR}/${voltest}/tintsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5" "${PROJECT_BINARY_DIR}/${voltest}/tfloatsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list}) diff --git a/java/test/Makefile.am b/java/test/Makefile.am index 732e1d2..ac3b619 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -52,6 +52,7 @@ noinst_JAVA = \ TestH5T.java \ TestH5Dparams.java \ TestH5D.java \ + TestH5Drw.java \ TestH5Dplist.java \ TestH5Lparams.java \ TestH5Lbasic.java \ @@ -66,6 +67,7 @@ noinst_JAVA = \ TestH5Pvirtual.java \ TestH5Plist.java \ TestH5A.java \ + TestH5Arw.java \ TestH5Oparams.java \ TestH5Obasic.java \ TestH5Ocreate.java \ diff --git a/java/test/TestAll.java b/java/test/TestAll.java index 3950072..16414e4 100644 --- a/java/test/TestAll.java +++ b/java/test/TestAll.java @@ -22,12 +22,12 @@ import org.junit.runners.Suite; TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class, TestH5Sbasic.class, TestH5S.class, TestH5Tparams.class, TestH5Tbasic.class, TestH5T.class, - TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, + TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, TestH5Drw.class, TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class, TestH5R.class, TestH5Rref.class, TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class, TestH5Pfapls3.class, TestH5Pfaplhdfs.class, - TestH5A.class, + TestH5A.class, TestH5Arw.class, TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class, TestH5PL.class, TestH5Z.class }) diff --git a/java/test/TestH5Arw.java b/java/test/TestH5Arw.java new file mode 100644 index 0000000..282b736 --- /dev/null +++ b/java/test/TestH5Arw.java @@ -0,0 +1,449 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.HDFNativeData; +import hdf.hdf5lib.callbacks.H5A_iterate_cb; +import hdf.hdf5lib.callbacks.H5A_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Arw { + @Rule public TestName testname = new TestName(); + private static final String H5_INTS_FILE = "tintsattrs.h5"; + private static final String H5_FLTS_FILE = "tfloatsattrs.h5"; + private static final int DIM_X = 8; + private static final int DIM8_Y = 8; + private static final int DIM16_Y = 16; + private static final int DIM32_Y = 32; + private static final int DIM64_Y = 64; + private static final int DIM128_Y = 128; + private static final String DATASETU08 = "DU08BITS"; + private static final String DATASETS08 = "DS08BITS"; + private static final String DATASETU16 = "DU16BITS"; + private static final String DATASETS16 = "DS16BITS"; + private static final String DATASETU32 = "DU32BITS"; + private static final String DATASETS32 = "DS32BITS"; + private static final String DATASETU64 = "DU64BITS"; + private static final String DATASETS64 = "DS64BITS"; + private static final String DATASETF32 = "DS32BITS"; + private static final String DATASETF64 = "DS64BITS"; + private static final String DATASETF128 = "DS128BITS"; + private static final int RANK = 2; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5aid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + + private final void _closeH5file() throws HDF5LibraryException { + if (H5aid >= 0) + try {H5.H5Aclose(H5aid);} catch (Exception ex) {} + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + + public void openH5file(String filename, String dsetname) { + try { + H5fid = H5.H5Fopen(filename, + HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Arw._openH5file: " + err); + } + assertTrue("TestH5Arw._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Arw._openH5file: " + err); + } + assertTrue("TestH5Arw._openH5file: H5.H5Dopen: ", H5did >= 0); + try { + H5aid = H5.H5Aopen(H5did, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Arw._openH5file: " + err); + } + assertTrue("TestH5Arw._openH5file: H5.H5Aopen: ", H5aid >= 0); + } + + @After + public void closeH5file() throws HDF5LibraryException { + if (H5aid >= 0) + try {H5.H5Aclose(H5aid);} catch (Exception ex) {} + if (H5did >= 0) + try {H5.H5Aclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = HDF5Constants.H5I_INVALID_HID; + H5did = HDF5Constants.H5I_INVALID_HID; + H5aid = HDF5Constants.H5I_INVALID_HID; + System.out.println(); + } + + @Before + public void verifyCount() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + + @Test + public void testH5Aread_8bit_ints() { + byte[][] attr_data = new byte[DIM_X][DIM8_Y]; + + try { + openH5file(H5_INTS_FILE, DATASETU08); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aread_8bit_ints: openH5file: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT8, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_8bit_ints: H5Aread: " + err); + } + + // End access to the attribute and release resources used by it. + try { + H5.H5Aclose(H5aid); + } + catch (Exception err) { + err.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + H5.H5Dclose(H5did); + } + catch (Exception err) { + err.printStackTrace(); + } + + // Open an existing dataset. + try { + H5did = H5.H5Dopen(H5fid, DATASETS08, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_8bit_ints: H5Dopen: " + err); + } + + // Open an existing attribute. + try { + H5aid = H5.H5Aopen(H5did, DATASETS08, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_8bit_ints: H5Aopen: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT8, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_8bit_ints: H5Aread: " + err); + } + } + + @Test + public void testH5Aread_16bit_ints() { + short[][] attr_data = new short[DIM_X][DIM16_Y]; + + try { + openH5file(H5_INTS_FILE, DATASETU16); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aread_16bit_ints: openH5file: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT16, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_16bit_ints: H5Aread: " + err); + } + + // End access to the attribute and release resources used by it. + try { + H5.H5Aclose(H5aid); + } + catch (Exception err) { + err.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + H5.H5Dclose(H5did); + } + catch (Exception err) { + err.printStackTrace(); + } + + // Open an existing dataset. + try { + H5did = H5.H5Dopen(H5fid, DATASETS16, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_16bit_ints: H5Dopen: " + err); + } + + // Open an existing attribute. + try { + H5aid = H5.H5Aopen(H5did, DATASETS16, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_16bit_ints: H5Aopen: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT16, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_16bit_ints: H5Aread: " + err); + } + } + + @Test + public void testH5Aread_32bit_ints() { + int[][] attr_data = new int[DIM_X][DIM16_Y]; + + try { + openH5file(H5_INTS_FILE, DATASETU32); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aread_32bit_ints: openH5file: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT32, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_32bit_ints: H5Aread: " + err); + } + + // End access to the attribute and release resources used by it. + try { + H5.H5Aclose(H5aid); + } + catch (Exception err) { + err.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + H5.H5Dclose(H5did); + } + catch (Exception err) { + err.printStackTrace(); + } + + // Open an existing dataset. + try { + H5did = H5.H5Dopen(H5fid, DATASETS32, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_32bit_ints: H5Dopen: " + err); + } + + // Open an existing attribute. + try { + H5aid = H5.H5Aopen(H5did, DATASETS32, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_32bit_ints: H5Aopen: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT32, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_32bit_ints: H5Aread: " + err); + } + } + + @Test + public void testH5Aread_64bit_ints() { + long[][] attr_data = new long[DIM_X][DIM64_Y]; + + try { + openH5file(H5_INTS_FILE, DATASETU64); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aread_64bit_ints: openH5file: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT64, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_64bit_ints: H5Aread: " + err); + } + + // End access to the attribute and release resources used by it. + try { + H5.H5Aclose(H5aid); + } + catch (Exception err) { + err.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + H5.H5Dclose(H5did); + } + catch (Exception err) { + err.printStackTrace(); + } + + // Open an existing dataset. + try { + H5did = H5.H5Dopen(H5fid, DATASETS64, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_64bit_ints: H5Dopen: " + err); + } + + // Open an existing attribute. + try { + H5aid = H5.H5Aopen(H5did, DATASETS64, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_64bit_ints: H5Aopen: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT64, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_64bit_ints: H5Aread: " + err); + } + } + + @Test + public void testH5Aread_32bit_floats() { + float[][] attr_data = new float[DIM_X][DIM32_Y]; + + try { + openH5file(H5_FLTS_FILE, DATASETF32); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aread_32bit_floats: openH5file: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_FLOAT, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_32bit_floats: H5Aread: " + err); + } + for (int i = 0; i < DIM_X; i++) + assertTrue("testH5Aread_32bit_floats - H5.H5Aread: ", attr_data[i][0] == (32 - i)); + } + + @Test + public void testH5Aread_64bit_floats() { + double[][] attr_data = new double[DIM_X][DIM64_Y]; + + try { + openH5file(H5_FLTS_FILE, DATASETF64); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aread_64bit_floats: openH5file: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_DOUBLE, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_64bit_floats: H5Aread: " + err); + } + for (int i = 0; i < DIM_X; i++) + assertTrue("testH5Aread_64bit_floats - H5.H5Aread: ", attr_data[i][0] == (64 - i)); + } + + @Test + public void testH5Aread_128bit_floats() { + byte[][][] attr_data = new byte[DIM_X][DIM128_Y][8]; + + try { + openH5file(H5_FLTS_FILE, DATASETF128); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aread_128bit_floats: openH5file: " + err); + } + + // Read data. + try { + H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_LDOUBLE, attr_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Aread_128bit_floats: H5Aread: " + err); + } + } + +} diff --git a/java/test/TestH5Drw.java b/java/test/TestH5Drw.java new file mode 100644 index 0000000..69fb9d7 --- /dev/null +++ b/java/test/TestH5Drw.java @@ -0,0 +1,378 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.HDFNativeData; +import hdf.hdf5lib.callbacks.H5D_iterate_cb; +import hdf.hdf5lib.callbacks.H5D_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Drw { + @Rule public TestName testname = new TestName(); + private static final String H5_INTS_FILE = "tintsattrs.h5"; + private static final String H5_FLTS_FILE = "tfloatsattrs.h5"; + private static final int DIM_X = 8; + private static final int DIM8_Y = 8; + private static final int DIM16_Y = 16; + private static final int DIM32_Y = 32; + private static final int DIM64_Y = 64; + private static final int DIM128_Y = 128; + private static final String DATASETU08 = "DU08BITS"; + private static final String DATASETS08 = "DS08BITS"; + private static final String DATASETU16 = "DU16BITS"; + private static final String DATASETS16 = "DS16BITS"; + private static final String DATASETU32 = "DU32BITS"; + private static final String DATASETS32 = "DS32BITS"; + private static final String DATASETU64 = "DU64BITS"; + private static final String DATASETS64 = "DS64BITS"; + private static final String DATASETF32 = "DS32BITS"; + private static final String DATASETF64 = "DS64BITS"; + private static final String DATASETF128 = "DS128BITS"; + private static final int RANK = 2; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + + private final void _closeH5file() throws HDF5LibraryException { + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + + public void openH5file(String filename, String dsetname) { + try { + H5fid = H5.H5Fopen(filename, + HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Drw._openH5file: " + err); + } + assertTrue("TestH5Drw._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Drw._openH5file: " + err); + } + assertTrue("TestH5Drw._openH5file: H5.H5Dopen: ", H5did >= 0); + } + + @After + public void closeH5file() throws HDF5LibraryException { + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = HDF5Constants.H5I_INVALID_HID; + H5did = HDF5Constants.H5I_INVALID_HID; + System.out.println(); + } + + @Before + public void verifyCount() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + + @Test + public void testH5Dread_8bit_ints() { + byte[][] dset_data = new byte[DIM_X][DIM8_Y]; + + try { + openH5file(H5_INTS_FILE, DATASETU08); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dread_8bit_ints: openH5file: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_8bit_ints: H5Dread: " + err); + } + + // End access to the dataset and release resources used by it. + try { + H5.H5Dclose(H5did); + } + catch (Exception err) { + err.printStackTrace(); + } + + // Open an existing dataset. + try { + H5did = H5.H5Dopen(H5fid, DATASETS08, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_8bit_ints: H5Dopen: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_8bit_ints: H5Dread: " + err); + } + } + + @Test + public void testH5Dread_16bit_ints() { + short[][] dset_data = new short[DIM_X][DIM16_Y]; + + try { + openH5file(H5_INTS_FILE, DATASETU16); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dread_16bit_ints: openH5file: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_16bit_ints: H5Dread: " + err); + } + + // End access to the dataset and release resources used by it. + try { + H5.H5Dclose(H5did); + } + catch (Exception err) { + err.printStackTrace(); + } + + // Open an existing dataset. + try { + H5did = H5.H5Dopen(H5fid, DATASETS16, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_16bit_ints: H5Dopen: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_16bit_ints: H5Dread: " + err); + } + } + + @Test + public void testH5Dread_32bit_ints() { + int[][] dset_data = new int[DIM_X][DIM16_Y]; + + try { + openH5file(H5_INTS_FILE, DATASETU32); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dread_32bit_ints: openH5file: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_32bit_ints: H5Dread: " + err); + } + + // End access to the dataset and release resources used by it. + try { + H5.H5Dclose(H5did); + } + catch (Exception err) { + err.printStackTrace(); + } + + // Open an existing dataset. + try { + H5did = H5.H5Dopen(H5fid, DATASETS32, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_32bit_ints: H5Dopen: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_32bit_ints: H5Dread: " + err); + } + } + + @Test + public void testH5Dread_64bit_ints() { + long[][] dset_data = new long[DIM_X][DIM64_Y]; + + try { + openH5file(H5_INTS_FILE, DATASETU64); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dread_64bit_ints: openH5file: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_64bit_ints: H5Dread: " + err); + } + + // End access to the dataset and release resources used by it. + try { + H5.H5Dclose(H5did); + } + catch (Exception err) { + err.printStackTrace(); + } + + // Open an existing dataset. + try { + H5did = H5.H5Dopen(H5fid, DATASETS64, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_64bit_ints: H5Dopen: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_64bit_ints: H5Dread: " + err); + } + } + + @Test + public void testH5Dread_32bit_floats() { + float[][] dset_data = new float[DIM_X][DIM32_Y]; + + try { + openH5file(H5_FLTS_FILE, DATASETF32); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dread_32bit_floats: openH5file: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_FLOAT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_32bit_floats: H5Dread: " + err); + } + for (int i = 0; i < DIM_X; i++) + assertTrue("testH5Dread_32bit_floats - H5.H5Dread: ", dset_data[i][0] == (32 - i)); + } + + @Test + public void testH5Dread_64bit_floats() { + double[][] dset_data = new double[DIM_X][DIM64_Y]; + + try { + openH5file(H5_FLTS_FILE, DATASETF64); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dread_64bit_floats: openH5file: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_64bit_floats: H5Dread: " + err); + } + for (int i = 0; i < DIM_X; i++) + assertTrue("testH5Dread_64bit_floats - H5.H5Dread: ", dset_data[i][0] == (64 - i)); + } + + @Test + public void testH5Dread_128bit_floats() { + byte[][][] dset_data = new byte[DIM_X][DIM128_Y][8]; + + try { + openH5file(H5_FLTS_FILE, DATASETF128); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dread_128bit_floats: openH5file: " + err); + } + + // Read data. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_LDOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dread_128bit_floats: H5Dread: " + err); + } + } + +} diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 3774cbd..39db296 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -90,6 +90,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5T.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Dparams.txt $HDFTEST_HOME/testfiles/JUnit-TestH5D.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Dplist.txt +$HDFTEST_HOME/testfiles/JUnit-TestH5Drw.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Lparams.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Lbasic.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Lcreate.txt @@ -103,6 +104,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Pfaplhdfs.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Pvirtual.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Plist.txt $HDFTEST_HOME/testfiles/JUnit-TestH5A.txt +$HDFTEST_HOME/testfiles/JUnit-TestH5Arw.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Oparams.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Obasic.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Ocreate.txt @@ -254,6 +256,8 @@ COPY_DATAFILES_TO_BLDDIR() $CP -f $TOOLS_TESTFILES/trefer_attr.h5 $BLDDIR/trefer_attr.h5 $CP -f $TOOLS_TESTFILES/tdatareg.h5 $BLDDIR/tdatareg.h5 $CP -f $TOOLS_TESTFILES/tattrreg.h5 $BLDDIR/tattrreg.h5 + $CP -f $TOOLS_TESTFILES/tintsattrs.h5 $BLDDIR/tintsattrs.h5 + $CP -f $TOOLS_TESTFILES/tfloatsattrs.h5 $BLDDIR/tfloatsattrs.h5 } CLEAN_DATAFILES_AND_BLDDIR() @@ -669,6 +673,27 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5D.txt JUnit-TestH5D.out |sed 's/^/ /' fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Drw" +TESTING JUnit-TestH5Drw +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Drw > JUnit-TestH5Drw.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Drw.ext > JUnit-TestH5Drw.out + +if diff JUnit-TestH5Drw.out JUnit-TestH5Drw.txt > /dev/null; then + echo " PASSED JUnit-TestH5Drw" +else + echo "**FAILED** JUnit-TestH5Drw" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Drw.txt JUnit-TestH5Drw.out |sed 's/^/ /' +fi + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist" TESTING JUnit-TestH5Dplist ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist > JUnit-TestH5Dplist.ext) @@ -921,6 +946,27 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5A.txt JUnit-TestH5A.out |sed 's/^/ /' fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Arw" +TESTING JUnit-TestH5Arw +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Arw > JUnit-TestH5Arw.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Arw.ext > JUnit-TestH5Arw.out + +if diff JUnit-TestH5Arw.out JUnit-TestH5Arw.txt > /dev/null; then + echo " PASSED JUnit-TestH5Arw" +else + echo "**FAILED** JUnit-TestH5Arw" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Arw.txt JUnit-TestH5Arw.out |sed 's/^/ /' +fi + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams" TESTING JUnit-TestH5Oparams ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams > JUnit-TestH5Oparams.ext) diff --git a/java/test/testfiles/JUnit-TestH5Arw.txt b/java/test/testfiles/JUnit-TestH5Arw.txt new file mode 100644 index 0000000..49d3b1c --- /dev/null +++ b/java/test/testfiles/JUnit-TestH5Arw.txt @@ -0,0 +1,13 @@ +JUnit version 4.11 +.testH5Aread_128bit_floats +.testH5Aread_64bit_floats +.testH5Aread_8bit_ints +.testH5Aread_32bit_ints +.testH5Aread_64bit_ints +.testH5Aread_32bit_floats +.testH5Aread_16bit_ints + +Time: XXXX + +OK (7 tests) + diff --git a/java/test/testfiles/JUnit-TestH5Drw.txt b/java/test/testfiles/JUnit-TestH5Drw.txt new file mode 100644 index 0000000..6b854cf --- /dev/null +++ b/java/test/testfiles/JUnit-TestH5Drw.txt @@ -0,0 +1,13 @@ +JUnit version 4.11 +.testH5Dread_32bit_floats +.testH5Dread_32bit_ints +.testH5Dread_64bit_ints +.testH5Dread_64bit_floats +.testH5Dread_8bit_ints +.testH5Dread_128bit_floats +.testH5Dread_16bit_ints + +Time: XXXX + +OK (7 tests) + diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 39260c0..edf39f8 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -458,7 +458,7 @@ New Features semi would work, but was not mandatory. This change was made to allow clang-format to correctly format the source code. - (SAM - 2021/03-03) + (SAM - 2021/03/03) - Improved performance of H5Sget_select_elem_pointlist @@ -844,8 +844,8 @@ Bug Fixes since HDF5-1.12.0 release H5S_NO_CLASS is an internal class value that should not have been exposed via a public API call. - In debug builds of the library, this can cause assert() functions to trip. In - non-debug builds, it will produce normal library errors. + In debug builds of the library, this can cause assert() function to + trip. In non-debug builds, it will produce normal library errors. The new library behavior is for H5Sset_extent_none() to convert the dataspace into one of type H5S_NULL, which is better handled @@ -976,6 +976,17 @@ Bug Fixes since HDF5-1.12.0 release Tools ----- + - Changed how h5dump and h5ls identify long double. + + Long double support is not consistent across platforms. Tools will always + identify long double as 128-bit [little/big]-endian float nn-bit precision. + New test file created for datasets with attributes for float, double and + long double. In addition any unknown integer or float datatype will now + also show the number of bits for precision. + These files are also used in the java tests. + + (ADB - 2021/03/24, HDFFV-11229) + - Fixed tools argument parsing. Tools parsing used the length of the option from the long array to match diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 9725cf6..4fb8202 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2197,9 +2197,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ else sign_s = " unknown-sign"; - /* print size, order, and sign */ - h5tools_str_append(buffer, "%lu-bit%s%s integer", (unsigned long)(8 * H5Tget_size(type)), - order_s, sign_s); + /* print size, order, sign, and precision */ + h5tools_str_append(buffer, "%lu-bit%s%s integer %lu-bit precision", + (unsigned long)(8 * H5Tget_size(type)), order_s, sign_s, + H5Tget_precision(type)); } break; @@ -2220,12 +2221,8 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "H5T_NATIVE_FLOAT"); else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE"); -#if H5_SIZEOF_LONG_DOUBLE != 0 - else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) - h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE"); -#endif else { - + /* print what the library knows */ /* byte order */ if (H5Tget_size(type) > 1) { order = H5Tget_order(type); @@ -2241,9 +2238,9 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ else order_s = ""; - /* print size and byte order */ - h5tools_str_append(buffer, "%lu-bit%s floating-point", (unsigned long)(8 * H5Tget_size(type)), - order_s); + /* print size. byte order, and precision */ + h5tools_str_append(buffer, "%lu-bit%s floating-point %lu-bit precision", + (unsigned long)(8 * H5Tget_size(type)), order_s, H5Tget_precision(type)); } break; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index b33d908..6aec6b8 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -1075,7 +1075,6 @@ h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim, H5FD_ros3_fapl_t { const char *ccred[3]; unsigned nelems = 0; - char * start = NULL; char * s3cred_src = NULL; char ** s3cred = NULL; herr_t ret_value = SUCCEED; diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 94005ef..1a430b3 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -428,11 +428,6 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind) else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) { h5tools_str_append(buffer, "native double"); } -#if H5_SIZEOF_LONG_DOUBLE != 0 - else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) { - h5tools_str_append(buffer, "native long double"); - } -#endif else if (H5Tequal(type, H5T_NATIVE_INT8) == TRUE) { h5tools_str_append(buffer, "native int8_t"); } diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 1e6ccb2..a8984de 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -101,6 +101,8 @@ ${HDF5_TOOLS_DIR}/testfiles/tfamily.ddl ${HDF5_TOOLS_DIR}/testfiles/tfill.ddl ${HDF5_TOOLS_DIR}/testfiles/tfletcher32.ddl + #${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.ddl #native + #${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.wddl #special for windows ${HDF5_TOOLS_DIR}/testfiles/tfpformat.ddl ${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ddl ${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ddl @@ -127,8 +129,8 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.ddl ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.ddl ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.ddl - #${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl #special handling on windows - #${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl #special handling on windows + ${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl + ${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.ddl ${HDF5_TOOLS_DIR}/testfiles/tloop-1.ddl ${HDF5_TOOLS_DIR}/testfiles/tmulti.ddl @@ -283,6 +285,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tfcontents1.h5 ${HDF5_TOOLS_DIR}/testfiles/tfcontents2.h5 ${HDF5_TOOLS_DIR}/testfiles/tfilters.h5 + ${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5 ${HDF5_TOOLS_DIR}/testfiles/tfpformat.h5 ${HDF5_TOOLS_DIR}/testfiles/tfvalues.h5 ${HDF5_TOOLS_DIR}/testfiles/tgroup.h5 @@ -413,12 +416,10 @@ configure_file(${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp NEWLINE_STYLE CRLF) #file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM) #file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble.ddl" "h5dump_std_files") - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble_scalar.ddl" "h5dump_std_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tfloatsattrs.ddl" "h5dump_std_files") else () HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files") - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble.ddl" "h5dump_std_files") - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tldouble_scalar.ddl" "h5dump_std_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tfloatsattrs.ddl" "h5dump_std_files") endif () add_custom_target(h5dump_std_files ALL COMMENT "Copying files needed by h5dump_std tests" DEPENDS ${h5dump_std_files_list}) @@ -1093,8 +1094,9 @@ ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5) # test for long double (some systems do not have long double) - #ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) - #ADD_H5_TEST (tldouble_scalar 0 -p --enable-error-stack tldouble_scalar.h5) + ADD_H5_TEST (tfloatsattrs 0 -p --enable-error-stack tfloatsattrs.h5) + ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) + ADD_H5_TEST (tldouble_scalar 0 -p --enable-error-stack tldouble_scalar.h5) # test for vms ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5) diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 1c2bf6f..29922e8 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -116,6 +116,7 @@ #define FILE86 "err_attr_dspace.h5" #define FILE87 "tintsnodata.h5" #define FILE88 "tldouble_scalar.h5" +#define FILE89 "tfloatsattrs.h5" /*------------------------------------------------------------------------- * prototypes @@ -396,6 +397,15 @@ typedef struct s1_t { #define F83_RANK 1 #define F83_ARRAYDIM 3 +/* "FILE89" macros */ +#define F89_XDIM 8 +#define F89_DATASETF32 "DS32BITS" +#define F89_YDIM32 32 +#define F89_DATASETF64 "DS64BITS" +#define F89_YDIM64 64 +#define F89_DATASETF128 "DS128BITS" +#define F89_YDIM128 128 + static void gent_group(void) { @@ -10209,6 +10219,152 @@ gent_intsattrs(void) HDfree(asetdbl); } +/*------------------------------------------------------------------------- + * Function: gent_floatsattrs + * + * Purpose: Generate a file to be used in the h5dump tests. + * Three datasets of 4, 8 and 16 bytes of float types are created. + * Fill them with raw data such that no bit will be all zero in a dataset. + *------------------------------------------------------------------------- + */ +static void +gent_floatsattrs(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t attr = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t aspace = H5I_INVALID_HID; + hsize_t dims[2], adims[1]; + + float ** dset32 = NULL; + double ** dset64 = NULL; + long double **dset128 = NULL; + + float * aset32 = NULL; + double * aset64 = NULL; + long double *aset128 = NULL; + + float val32bits; + double val64bits; + long double val128bits; + + unsigned int i, j; + + /* Create arrays */ + H5TEST_ALLOCATE_2D_ARRAY(dset32, float, F89_XDIM, F89_YDIM32); + H5TEST_ALLOCATE_2D_ARRAY(dset64, double, F89_XDIM, F89_YDIM64); + H5TEST_ALLOCATE_2D_ARRAY(dset128, long double, F89_XDIM, F89_YDIM128); + + aset32 = HDcalloc(F89_XDIM * F89_YDIM32, sizeof(float)); + aset64 = HDcalloc(F89_XDIM * F89_YDIM64, sizeof(double)); + aset128 = HDcalloc(F89_XDIM * F89_YDIM128, sizeof(long double)); + + fid = H5Fcreate(FILE89, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + if ((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) + goto error; + + if (H5Tget_size(tid) == 0) + goto error; + + /* Dataset of 32 bits float */ + dims[0] = F89_XDIM; + dims[1] = F89_YDIM32; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F89_DATASETF32, H5T_IEEE_F32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val32bits = (float)F89_YDIM32; + for (i = 0; i < dims[0]; i++) { + dset32[i][0] = val32bits; + aset32[i * dims[1]] = dset32[i][0]; + for (j = 1; j < dims[1]; j++) { + dset32[i][j] = (float)(j * dims[0] + i) / (float)F89_YDIM32; + aset32[i * dims[1] + j] = dset32[i][j]; + } + val32bits -= (float)1; + } + + H5Dwrite(dataset, H5T_IEEE_F32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]); + /* Attribute of 32 bits float */ + adims[0] = F89_XDIM * F89_YDIM32; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F89_DATASETF32, H5T_IEEE_F32LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_IEEE_F32LE, aset32); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits double */ + dims[0] = F89_XDIM; + dims[1] = F89_YDIM64; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F89_DATASETF64, H5T_IEEE_F64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val64bits = (double)F89_YDIM64; + for (i = 0; i < dims[0]; i++) { + dset64[i][0] = val64bits; + aset64[i * dims[1]] = dset64[i][0]; + for (j = 1; j < dims[1]; j++) { + dset64[i][j] = (double)(j * dims[0] + i) / (double)F89_YDIM64; + aset64[i * dims[1] + j] = dset64[i][j]; + } + val64bits -= (double)1; + } + + H5Dwrite(dataset, H5T_IEEE_F64LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]); + /* Attribute of 64 bits double */ + adims[0] = F89_XDIM * F89_YDIM64; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F89_DATASETF64, H5T_IEEE_F64LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_IEEE_F64LE, aset64); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 128 bits long double */ + dims[0] = F89_XDIM; + dims[1] = F89_YDIM128; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F89_DATASETF128, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val128bits = (long double)F89_YDIM128; + for (i = 0; i < dims[0]; i++) { + dset128[i][0] = val128bits; + aset128[i * dims[1]] = dset128[i][0]; + for (j = 1; j < dims[1]; j++) { + dset128[i][j] = (long double)(j * dims[0] + i) / (long double)F89_YDIM128; + aset128[i * dims[1] + j] = dset128[i][j]; + } + val128bits -= (long double)1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset128[0]); + /* Attribute of 128 bits long double */ + adims[0] = F89_XDIM * F89_YDIM128; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F89_DATASETF128, tid, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, aset128); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + +error: + H5Fclose(fid); + + HDfree(dset32); + HDfree(dset64); + HDfree(dset128); + + HDfree(aset32); + HDfree(aset64); + HDfree(aset128); +} + static void gent_bitnopaquefields(void) { @@ -11162,6 +11318,7 @@ main(void) gent_compound_ints(); gent_intattrscalars(); gent_intsattrs(); + gent_floatsattrs(); gent_bitnopaquefields(); gent_nodata(); diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index e2776ab..9464302 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -132,6 +132,7 @@ $SRC_H5DUMP_TESTFILES/tfamily00010.h5 $SRC_H5DUMP_TESTFILES/tfcontents1.h5 $SRC_H5DUMP_TESTFILES/tfcontents2.h5 $SRC_H5DUMP_TESTFILES/tfilters.h5 +$SRC_H5DUMP_TESTFILES/tfloatsattrs.h5 $SRC_H5DUMP_TESTFILES/tfpformat.h5 $SRC_H5DUMP_TESTFILES/tfvalues.h5 $SRC_H5DUMP_TESTFILES/tgroup.h5 @@ -265,6 +266,7 @@ $SRC_H5DUMP_TESTFILES/textlink.ddl $SRC_H5DUMP_TESTFILES/tfamily.ddl $SRC_H5DUMP_TESTFILES/tfill.ddl $SRC_H5DUMP_TESTFILES/tfletcher32.ddl +$SRC_H5DUMP_TESTFILES/tfloatsattrs.ddl $SRC_H5DUMP_TESTFILES/tfpformat.ddl $SRC_H5DUMP_TESTFILES/tgroup-1.ddl $SRC_H5DUMP_TESTFILES/tgroup-2.ddl @@ -1384,8 +1386,9 @@ TOOLTEST tgrpnullspace.ddl -p --enable-error-stack tgrpnullspace.h5 TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5 # test for long double (some systems do not have long double) -#TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 -#TOOLTEST tldouble_scalar.ddl -p --enable-error-stack tldouble_scalar.h5 +TOOLTEST tfloatsattrs.ddl -p --enable-error-stack tfloatsattrs.h5 +TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 +TOOLTEST tldouble_scalar.ddl -p --enable-error-stack tldouble_scalar.h5 # test for vms TOOLTEST tvms.ddl --enable-error-stack tvms.h5 diff --git a/tools/testfiles/tfloatsattrs.ddl b/tools/testfiles/tfloatsattrs.ddl new file mode 100644 index 0000000..11c65b8 --- /dev/null +++ b/tools/testfiles/tfloatsattrs.ddl @@ -0,0 +1,621 @@ +HDF5 "tfloatsattrs.h5" { +GROUP "/" { + DATASET "DS128BITS" { + DATATYPE 128-bit little-endian floating-point 80-bit precision + DATASPACE SIMPLE { ( 8, 128 ) / ( 8, 128 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 16384 + OFFSET 14416 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0): 128, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, + (0,9): 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.0625, + (0,18): 1.125, 1.1875, 1.25, 1.3125, 1.375, 1.4375, 1.5, 1.5625, 1.625, + (0,27): 1.6875, 1.75, 1.8125, 1.875, 1.9375, 2, 2.0625, 2.125, 2.1875, + (0,36): 2.25, 2.3125, 2.375, 2.4375, 2.5, 2.5625, 2.625, 2.6875, 2.75, + (0,45): 2.8125, 2.875, 2.9375, 3, 3.0625, 3.125, 3.1875, 3.25, 3.3125, + (0,54): 3.375, 3.4375, 3.5, 3.5625, 3.625, 3.6875, 3.75, 3.8125, 3.875, + (0,63): 3.9375, 4, 4.0625, 4.125, 4.1875, 4.25, 4.3125, 4.375, 4.4375, + (0,72): 4.5, 4.5625, 4.625, 4.6875, 4.75, 4.8125, 4.875, 4.9375, 5, + (0,81): 5.0625, 5.125, 5.1875, 5.25, 5.3125, 5.375, 5.4375, 5.5, + (0,89): 5.5625, 5.625, 5.6875, 5.75, 5.8125, 5.875, 5.9375, 6, 6.0625, + (0,98): 6.125, 6.1875, 6.25, 6.3125, 6.375, 6.4375, 6.5, 6.5625, 6.625, + (0,107): 6.6875, 6.75, 6.8125, 6.875, 6.9375, 7, 7.0625, 7.125, 7.1875, + (0,116): 7.25, 7.3125, 7.375, 7.4375, 7.5, 7.5625, 7.625, 7.6875, 7.75, + (0,125): 7.8125, 7.875, 7.9375, + (1,0): 127, 0.0703125, 0.132812, 0.195312, 0.257812, 0.320312, + (1,6): 0.382812, 0.445312, 0.507812, 0.570312, 0.632812, 0.695312, + (1,12): 0.757812, 0.820312, 0.882812, 0.945312, 1.00781, 1.07031, + (1,18): 1.13281, 1.19531, 1.25781, 1.32031, 1.38281, 1.44531, 1.50781, + (1,25): 1.57031, 1.63281, 1.69531, 1.75781, 1.82031, 1.88281, 1.94531, + (1,32): 2.00781, 2.07031, 2.13281, 2.19531, 2.25781, 2.32031, 2.38281, + (1,39): 2.44531, 2.50781, 2.57031, 2.63281, 2.69531, 2.75781, 2.82031, + (1,46): 2.88281, 2.94531, 3.00781, 3.07031, 3.13281, 3.19531, 3.25781, + (1,53): 3.32031, 3.38281, 3.44531, 3.50781, 3.57031, 3.63281, 3.69531, + (1,60): 3.75781, 3.82031, 3.88281, 3.94531, 4.00781, 4.07031, 4.13281, + (1,67): 4.19531, 4.25781, 4.32031, 4.38281, 4.44531, 4.50781, 4.57031, + (1,74): 4.63281, 4.69531, 4.75781, 4.82031, 4.88281, 4.94531, 5.00781, + (1,81): 5.07031, 5.13281, 5.19531, 5.25781, 5.32031, 5.38281, 5.44531, + (1,88): 5.50781, 5.57031, 5.63281, 5.69531, 5.75781, 5.82031, 5.88281, + (1,95): 5.94531, 6.00781, 6.07031, 6.13281, 6.19531, 6.25781, 6.32031, + (1,102): 6.38281, 6.44531, 6.50781, 6.57031, 6.63281, 6.69531, 6.75781, + (1,109): 6.82031, 6.88281, 6.94531, 7.00781, 7.07031, 7.13281, 7.19531, + (1,116): 7.25781, 7.32031, 7.38281, 7.44531, 7.50781, 7.57031, 7.63281, + (1,123): 7.69531, 7.75781, 7.82031, 7.88281, 7.94531, + (2,0): 126, 0.078125, 0.140625, 0.203125, 0.265625, 0.328125, 0.390625, + (2,7): 0.453125, 0.515625, 0.578125, 0.640625, 0.703125, 0.765625, + (2,13): 0.828125, 0.890625, 0.953125, 1.01562, 1.07812, 1.14062, + (2,19): 1.20312, 1.26562, 1.32812, 1.39062, 1.45312, 1.51562, 1.57812, + (2,26): 1.64062, 1.70312, 1.76562, 1.82812, 1.89062, 1.95312, 2.01562, + (2,33): 2.07812, 2.14062, 2.20312, 2.26562, 2.32812, 2.39062, 2.45312, + (2,40): 2.51562, 2.57812, 2.64062, 2.70312, 2.76562, 2.82812, 2.89062, + (2,47): 2.95312, 3.01562, 3.07812, 3.14062, 3.20312, 3.26562, 3.32812, + (2,54): 3.39062, 3.45312, 3.51562, 3.57812, 3.64062, 3.70312, 3.76562, + (2,61): 3.82812, 3.89062, 3.95312, 4.01562, 4.07812, 4.14062, 4.20312, + (2,68): 4.26562, 4.32812, 4.39062, 4.45312, 4.51562, 4.57812, 4.64062, + (2,75): 4.70312, 4.76562, 4.82812, 4.89062, 4.95312, 5.01562, 5.07812, + (2,82): 5.14062, 5.20312, 5.26562, 5.32812, 5.39062, 5.45312, 5.51562, + (2,89): 5.57812, 5.64062, 5.70312, 5.76562, 5.82812, 5.89062, 5.95312, + (2,96): 6.01562, 6.07812, 6.14062, 6.20312, 6.26562, 6.32812, 6.39062, + (2,103): 6.45312, 6.51562, 6.57812, 6.64062, 6.70312, 6.76562, 6.82812, + (2,110): 6.89062, 6.95312, 7.01562, 7.07812, 7.14062, 7.20312, 7.26562, + (2,117): 7.32812, 7.39062, 7.45312, 7.51562, 7.57812, 7.64062, 7.70312, + (2,124): 7.76562, 7.82812, 7.89062, 7.95312, + (3,0): 125, 0.0859375, 0.148438, 0.210938, 0.273438, 0.335938, + (3,6): 0.398438, 0.460938, 0.523438, 0.585938, 0.648438, 0.710938, + (3,12): 0.773438, 0.835938, 0.898438, 0.960938, 1.02344, 1.08594, + (3,18): 1.14844, 1.21094, 1.27344, 1.33594, 1.39844, 1.46094, 1.52344, + (3,25): 1.58594, 1.64844, 1.71094, 1.77344, 1.83594, 1.89844, 1.96094, + (3,32): 2.02344, 2.08594, 2.14844, 2.21094, 2.27344, 2.33594, 2.39844, + (3,39): 2.46094, 2.52344, 2.58594, 2.64844, 2.71094, 2.77344, 2.83594, + (3,46): 2.89844, 2.96094, 3.02344, 3.08594, 3.14844, 3.21094, 3.27344, + (3,53): 3.33594, 3.39844, 3.46094, 3.52344, 3.58594, 3.64844, 3.71094, + (3,60): 3.77344, 3.83594, 3.89844, 3.96094, 4.02344, 4.08594, 4.14844, + (3,67): 4.21094, 4.27344, 4.33594, 4.39844, 4.46094, 4.52344, 4.58594, + (3,74): 4.64844, 4.71094, 4.77344, 4.83594, 4.89844, 4.96094, 5.02344, + (3,81): 5.08594, 5.14844, 5.21094, 5.27344, 5.33594, 5.39844, 5.46094, + (3,88): 5.52344, 5.58594, 5.64844, 5.71094, 5.77344, 5.83594, 5.89844, + (3,95): 5.96094, 6.02344, 6.08594, 6.14844, 6.21094, 6.27344, 6.33594, + (3,102): 6.39844, 6.46094, 6.52344, 6.58594, 6.64844, 6.71094, 6.77344, + (3,109): 6.83594, 6.89844, 6.96094, 7.02344, 7.08594, 7.14844, 7.21094, + (3,116): 7.27344, 7.33594, 7.39844, 7.46094, 7.52344, 7.58594, 7.64844, + (3,123): 7.71094, 7.77344, 7.83594, 7.89844, 7.96094, + (4,0): 124, 0.09375, 0.15625, 0.21875, 0.28125, 0.34375, 0.40625, + (4,7): 0.46875, 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375, + (4,14): 0.90625, 0.96875, 1.03125, 1.09375, 1.15625, 1.21875, 1.28125, + (4,21): 1.34375, 1.40625, 1.46875, 1.53125, 1.59375, 1.65625, 1.71875, + (4,28): 1.78125, 1.84375, 1.90625, 1.96875, 2.03125, 2.09375, 2.15625, + (4,35): 2.21875, 2.28125, 2.34375, 2.40625, 2.46875, 2.53125, 2.59375, + (4,42): 2.65625, 2.71875, 2.78125, 2.84375, 2.90625, 2.96875, 3.03125, + (4,49): 3.09375, 3.15625, 3.21875, 3.28125, 3.34375, 3.40625, 3.46875, + (4,56): 3.53125, 3.59375, 3.65625, 3.71875, 3.78125, 3.84375, 3.90625, + (4,63): 3.96875, 4.03125, 4.09375, 4.15625, 4.21875, 4.28125, 4.34375, + (4,70): 4.40625, 4.46875, 4.53125, 4.59375, 4.65625, 4.71875, 4.78125, + (4,77): 4.84375, 4.90625, 4.96875, 5.03125, 5.09375, 5.15625, 5.21875, + (4,84): 5.28125, 5.34375, 5.40625, 5.46875, 5.53125, 5.59375, 5.65625, + (4,91): 5.71875, 5.78125, 5.84375, 5.90625, 5.96875, 6.03125, 6.09375, + (4,98): 6.15625, 6.21875, 6.28125, 6.34375, 6.40625, 6.46875, 6.53125, + (4,105): 6.59375, 6.65625, 6.71875, 6.78125, 6.84375, 6.90625, 6.96875, + (4,112): 7.03125, 7.09375, 7.15625, 7.21875, 7.28125, 7.34375, 7.40625, + (4,119): 7.46875, 7.53125, 7.59375, 7.65625, 7.71875, 7.78125, 7.84375, + (4,126): 7.90625, 7.96875, + (5,0): 123, 0.101562, 0.164062, 0.226562, 0.289062, 0.351562, 0.414062, + (5,7): 0.476562, 0.539062, 0.601562, 0.664062, 0.726562, 0.789062, + (5,13): 0.851562, 0.914062, 0.976562, 1.03906, 1.10156, 1.16406, + (5,19): 1.22656, 1.28906, 1.35156, 1.41406, 1.47656, 1.53906, 1.60156, + (5,26): 1.66406, 1.72656, 1.78906, 1.85156, 1.91406, 1.97656, 2.03906, + (5,33): 2.10156, 2.16406, 2.22656, 2.28906, 2.35156, 2.41406, 2.47656, + (5,40): 2.53906, 2.60156, 2.66406, 2.72656, 2.78906, 2.85156, 2.91406, + (5,47): 2.97656, 3.03906, 3.10156, 3.16406, 3.22656, 3.28906, 3.35156, + (5,54): 3.41406, 3.47656, 3.53906, 3.60156, 3.66406, 3.72656, 3.78906, + (5,61): 3.85156, 3.91406, 3.97656, 4.03906, 4.10156, 4.16406, 4.22656, + (5,68): 4.28906, 4.35156, 4.41406, 4.47656, 4.53906, 4.60156, 4.66406, + (5,75): 4.72656, 4.78906, 4.85156, 4.91406, 4.97656, 5.03906, 5.10156, + (5,82): 5.16406, 5.22656, 5.28906, 5.35156, 5.41406, 5.47656, 5.53906, + (5,89): 5.60156, 5.66406, 5.72656, 5.78906, 5.85156, 5.91406, 5.97656, + (5,96): 6.03906, 6.10156, 6.16406, 6.22656, 6.28906, 6.35156, 6.41406, + (5,103): 6.47656, 6.53906, 6.60156, 6.66406, 6.72656, 6.78906, 6.85156, + (5,110): 6.91406, 6.97656, 7.03906, 7.10156, 7.16406, 7.22656, 7.28906, + (5,117): 7.35156, 7.41406, 7.47656, 7.53906, 7.60156, 7.66406, 7.72656, + (5,124): 7.78906, 7.85156, 7.91406, 7.97656, + (6,0): 122, 0.109375, 0.171875, 0.234375, 0.296875, 0.359375, 0.421875, + (6,7): 0.484375, 0.546875, 0.609375, 0.671875, 0.734375, 0.796875, + (6,13): 0.859375, 0.921875, 0.984375, 1.04688, 1.10938, 1.17188, + (6,19): 1.23438, 1.29688, 1.35938, 1.42188, 1.48438, 1.54688, 1.60938, + (6,26): 1.67188, 1.73438, 1.79688, 1.85938, 1.92188, 1.98438, 2.04688, + (6,33): 2.10938, 2.17188, 2.23438, 2.29688, 2.35938, 2.42188, 2.48438, + (6,40): 2.54688, 2.60938, 2.67188, 2.73438, 2.79688, 2.85938, 2.92188, + (6,47): 2.98438, 3.04688, 3.10938, 3.17188, 3.23438, 3.29688, 3.35938, + (6,54): 3.42188, 3.48438, 3.54688, 3.60938, 3.67188, 3.73438, 3.79688, + (6,61): 3.85938, 3.92188, 3.98438, 4.04688, 4.10938, 4.17188, 4.23438, + (6,68): 4.29688, 4.35938, 4.42188, 4.48438, 4.54688, 4.60938, 4.67188, + (6,75): 4.73438, 4.79688, 4.85938, 4.92188, 4.98438, 5.04688, 5.10938, + (6,82): 5.17188, 5.23438, 5.29688, 5.35938, 5.42188, 5.48438, 5.54688, + (6,89): 5.60938, 5.67188, 5.73438, 5.79688, 5.85938, 5.92188, 5.98438, + (6,96): 6.04688, 6.10938, 6.17188, 6.23438, 6.29688, 6.35938, 6.42188, + (6,103): 6.48438, 6.54688, 6.60938, 6.67188, 6.73438, 6.79688, 6.85938, + (6,110): 6.92188, 6.98438, 7.04688, 7.10938, 7.17188, 7.23438, 7.29688, + (6,117): 7.35938, 7.42188, 7.48438, 7.54688, 7.60938, 7.67188, 7.73438, + (6,124): 7.79688, 7.85938, 7.92188, 7.98438, + (7,0): 121, 0.117188, 0.179688, 0.242188, 0.304688, 0.367188, 0.429688, + (7,7): 0.492188, 0.554688, 0.617188, 0.679688, 0.742188, 0.804688, + (7,13): 0.867188, 0.929688, 0.992188, 1.05469, 1.11719, 1.17969, + (7,19): 1.24219, 1.30469, 1.36719, 1.42969, 1.49219, 1.55469, 1.61719, + (7,26): 1.67969, 1.74219, 1.80469, 1.86719, 1.92969, 1.99219, 2.05469, + (7,33): 2.11719, 2.17969, 2.24219, 2.30469, 2.36719, 2.42969, 2.49219, + (7,40): 2.55469, 2.61719, 2.67969, 2.74219, 2.80469, 2.86719, 2.92969, + (7,47): 2.99219, 3.05469, 3.11719, 3.17969, 3.24219, 3.30469, 3.36719, + (7,54): 3.42969, 3.49219, 3.55469, 3.61719, 3.67969, 3.74219, 3.80469, + (7,61): 3.86719, 3.92969, 3.99219, 4.05469, 4.11719, 4.17969, 4.24219, + (7,68): 4.30469, 4.36719, 4.42969, 4.49219, 4.55469, 4.61719, 4.67969, + (7,75): 4.74219, 4.80469, 4.86719, 4.92969, 4.99219, 5.05469, 5.11719, + (7,82): 5.17969, 5.24219, 5.30469, 5.36719, 5.42969, 5.49219, 5.55469, + (7,89): 5.61719, 5.67969, 5.74219, 5.80469, 5.86719, 5.92969, 5.99219, + (7,96): 6.05469, 6.11719, 6.17969, 6.24219, 6.30469, 6.36719, 6.42969, + (7,103): 6.49219, 6.55469, 6.61719, 6.67969, 6.74219, 6.80469, 6.86719, + (7,110): 6.92969, 6.99219, 7.05469, 7.11719, 7.17969, 7.24219, 7.30469, + (7,117): 7.36719, 7.42969, 7.49219, 7.55469, 7.61719, 7.67969, 7.74219, + (7,124): 7.80469, 7.86719, 7.92969, 7.99219 + } + ATTRIBUTE "DS128BITS" { + DATATYPE 128-bit little-endian floating-point 80-bit precision + DATASPACE SIMPLE { ( 1024 ) / ( 1024 ) } + DATA { + (0): 128, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, + (9): 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.0625, + (18): 1.125, 1.1875, 1.25, 1.3125, 1.375, 1.4375, 1.5, 1.5625, + (26): 1.625, 1.6875, 1.75, 1.8125, 1.875, 1.9375, 2, 2.0625, 2.125, + (35): 2.1875, 2.25, 2.3125, 2.375, 2.4375, 2.5, 2.5625, 2.625, + (43): 2.6875, 2.75, 2.8125, 2.875, 2.9375, 3, 3.0625, 3.125, 3.1875, + (52): 3.25, 3.3125, 3.375, 3.4375, 3.5, 3.5625, 3.625, 3.6875, 3.75, + (61): 3.8125, 3.875, 3.9375, 4, 4.0625, 4.125, 4.1875, 4.25, 4.3125, + (70): 4.375, 4.4375, 4.5, 4.5625, 4.625, 4.6875, 4.75, 4.8125, + (78): 4.875, 4.9375, 5, 5.0625, 5.125, 5.1875, 5.25, 5.3125, 5.375, + (87): 5.4375, 5.5, 5.5625, 5.625, 5.6875, 5.75, 5.8125, 5.875, + (95): 5.9375, 6, 6.0625, 6.125, 6.1875, 6.25, 6.3125, 6.375, 6.4375, + (104): 6.5, 6.5625, 6.625, 6.6875, 6.75, 6.8125, 6.875, 6.9375, 7, + (113): 7.0625, 7.125, 7.1875, 7.25, 7.3125, 7.375, 7.4375, 7.5, + (121): 7.5625, 7.625, 7.6875, 7.75, 7.8125, 7.875, 7.9375, 127, + (129): 0.0703125, 0.132812, 0.195312, 0.257812, 0.320312, 0.382812, + (135): 0.445312, 0.507812, 0.570312, 0.632812, 0.695312, 0.757812, + (141): 0.820312, 0.882812, 0.945312, 1.00781, 1.07031, 1.13281, + (147): 1.19531, 1.25781, 1.32031, 1.38281, 1.44531, 1.50781, + (153): 1.57031, 1.63281, 1.69531, 1.75781, 1.82031, 1.88281, + (159): 1.94531, 2.00781, 2.07031, 2.13281, 2.19531, 2.25781, + (165): 2.32031, 2.38281, 2.44531, 2.50781, 2.57031, 2.63281, + (171): 2.69531, 2.75781, 2.82031, 2.88281, 2.94531, 3.00781, + (177): 3.07031, 3.13281, 3.19531, 3.25781, 3.32031, 3.38281, + (183): 3.44531, 3.50781, 3.57031, 3.63281, 3.69531, 3.75781, + (189): 3.82031, 3.88281, 3.94531, 4.00781, 4.07031, 4.13281, + (195): 4.19531, 4.25781, 4.32031, 4.38281, 4.44531, 4.50781, + (201): 4.57031, 4.63281, 4.69531, 4.75781, 4.82031, 4.88281, + (207): 4.94531, 5.00781, 5.07031, 5.13281, 5.19531, 5.25781, + (213): 5.32031, 5.38281, 5.44531, 5.50781, 5.57031, 5.63281, + (219): 5.69531, 5.75781, 5.82031, 5.88281, 5.94531, 6.00781, + (225): 6.07031, 6.13281, 6.19531, 6.25781, 6.32031, 6.38281, + (231): 6.44531, 6.50781, 6.57031, 6.63281, 6.69531, 6.75781, + (237): 6.82031, 6.88281, 6.94531, 7.00781, 7.07031, 7.13281, + (243): 7.19531, 7.25781, 7.32031, 7.38281, 7.44531, 7.50781, + (249): 7.57031, 7.63281, 7.69531, 7.75781, 7.82031, 7.88281, + (255): 7.94531, 126, 0.078125, 0.140625, 0.203125, 0.265625, + (261): 0.328125, 0.390625, 0.453125, 0.515625, 0.578125, 0.640625, + (267): 0.703125, 0.765625, 0.828125, 0.890625, 0.953125, 1.01562, + (273): 1.07812, 1.14062, 1.20312, 1.26562, 1.32812, 1.39062, + (279): 1.45312, 1.51562, 1.57812, 1.64062, 1.70312, 1.76562, + (285): 1.82812, 1.89062, 1.95312, 2.01562, 2.07812, 2.14062, + (291): 2.20312, 2.26562, 2.32812, 2.39062, 2.45312, 2.51562, + (297): 2.57812, 2.64062, 2.70312, 2.76562, 2.82812, 2.89062, + (303): 2.95312, 3.01562, 3.07812, 3.14062, 3.20312, 3.26562, + (309): 3.32812, 3.39062, 3.45312, 3.51562, 3.57812, 3.64062, + (315): 3.70312, 3.76562, 3.82812, 3.89062, 3.95312, 4.01562, + (321): 4.07812, 4.14062, 4.20312, 4.26562, 4.32812, 4.39062, + (327): 4.45312, 4.51562, 4.57812, 4.64062, 4.70312, 4.76562, + (333): 4.82812, 4.89062, 4.95312, 5.01562, 5.07812, 5.14062, + (339): 5.20312, 5.26562, 5.32812, 5.39062, 5.45312, 5.51562, + (345): 5.57812, 5.64062, 5.70312, 5.76562, 5.82812, 5.89062, + (351): 5.95312, 6.01562, 6.07812, 6.14062, 6.20312, 6.26562, + (357): 6.32812, 6.39062, 6.45312, 6.51562, 6.57812, 6.64062, + (363): 6.70312, 6.76562, 6.82812, 6.89062, 6.95312, 7.01562, + (369): 7.07812, 7.14062, 7.20312, 7.26562, 7.32812, 7.39062, + (375): 7.45312, 7.51562, 7.57812, 7.64062, 7.70312, 7.76562, + (381): 7.82812, 7.89062, 7.95312, 125, 0.0859375, 0.148438, + (387): 0.210938, 0.273438, 0.335938, 0.398438, 0.460938, 0.523438, + (393): 0.585938, 0.648438, 0.710938, 0.773438, 0.835938, 0.898438, + (399): 0.960938, 1.02344, 1.08594, 1.14844, 1.21094, 1.27344, + (405): 1.33594, 1.39844, 1.46094, 1.52344, 1.58594, 1.64844, + (411): 1.71094, 1.77344, 1.83594, 1.89844, 1.96094, 2.02344, + (417): 2.08594, 2.14844, 2.21094, 2.27344, 2.33594, 2.39844, + (423): 2.46094, 2.52344, 2.58594, 2.64844, 2.71094, 2.77344, + (429): 2.83594, 2.89844, 2.96094, 3.02344, 3.08594, 3.14844, + (435): 3.21094, 3.27344, 3.33594, 3.39844, 3.46094, 3.52344, + (441): 3.58594, 3.64844, 3.71094, 3.77344, 3.83594, 3.89844, + (447): 3.96094, 4.02344, 4.08594, 4.14844, 4.21094, 4.27344, + (453): 4.33594, 4.39844, 4.46094, 4.52344, 4.58594, 4.64844, + (459): 4.71094, 4.77344, 4.83594, 4.89844, 4.96094, 5.02344, + (465): 5.08594, 5.14844, 5.21094, 5.27344, 5.33594, 5.39844, + (471): 5.46094, 5.52344, 5.58594, 5.64844, 5.71094, 5.77344, + (477): 5.83594, 5.89844, 5.96094, 6.02344, 6.08594, 6.14844, + (483): 6.21094, 6.27344, 6.33594, 6.39844, 6.46094, 6.52344, + (489): 6.58594, 6.64844, 6.71094, 6.77344, 6.83594, 6.89844, + (495): 6.96094, 7.02344, 7.08594, 7.14844, 7.21094, 7.27344, + (501): 7.33594, 7.39844, 7.46094, 7.52344, 7.58594, 7.64844, + (507): 7.71094, 7.77344, 7.83594, 7.89844, 7.96094, 124, 0.09375, + (514): 0.15625, 0.21875, 0.28125, 0.34375, 0.40625, 0.46875, + (520): 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375, + (526): 0.90625, 0.96875, 1.03125, 1.09375, 1.15625, 1.21875, + (532): 1.28125, 1.34375, 1.40625, 1.46875, 1.53125, 1.59375, + (538): 1.65625, 1.71875, 1.78125, 1.84375, 1.90625, 1.96875, + (544): 2.03125, 2.09375, 2.15625, 2.21875, 2.28125, 2.34375, + (550): 2.40625, 2.46875, 2.53125, 2.59375, 2.65625, 2.71875, + (556): 2.78125, 2.84375, 2.90625, 2.96875, 3.03125, 3.09375, + (562): 3.15625, 3.21875, 3.28125, 3.34375, 3.40625, 3.46875, + (568): 3.53125, 3.59375, 3.65625, 3.71875, 3.78125, 3.84375, + (574): 3.90625, 3.96875, 4.03125, 4.09375, 4.15625, 4.21875, + (580): 4.28125, 4.34375, 4.40625, 4.46875, 4.53125, 4.59375, + (586): 4.65625, 4.71875, 4.78125, 4.84375, 4.90625, 4.96875, + (592): 5.03125, 5.09375, 5.15625, 5.21875, 5.28125, 5.34375, + (598): 5.40625, 5.46875, 5.53125, 5.59375, 5.65625, 5.71875, + (604): 5.78125, 5.84375, 5.90625, 5.96875, 6.03125, 6.09375, + (610): 6.15625, 6.21875, 6.28125, 6.34375, 6.40625, 6.46875, + (616): 6.53125, 6.59375, 6.65625, 6.71875, 6.78125, 6.84375, + (622): 6.90625, 6.96875, 7.03125, 7.09375, 7.15625, 7.21875, + (628): 7.28125, 7.34375, 7.40625, 7.46875, 7.53125, 7.59375, + (634): 7.65625, 7.71875, 7.78125, 7.84375, 7.90625, 7.96875, 123, + (641): 0.101562, 0.164062, 0.226562, 0.289062, 0.351562, 0.414062, + (647): 0.476562, 0.539062, 0.601562, 0.664062, 0.726562, 0.789062, + (653): 0.851562, 0.914062, 0.976562, 1.03906, 1.10156, 1.16406, + (659): 1.22656, 1.28906, 1.35156, 1.41406, 1.47656, 1.53906, + (665): 1.60156, 1.66406, 1.72656, 1.78906, 1.85156, 1.91406, + (671): 1.97656, 2.03906, 2.10156, 2.16406, 2.22656, 2.28906, + (677): 2.35156, 2.41406, 2.47656, 2.53906, 2.60156, 2.66406, + (683): 2.72656, 2.78906, 2.85156, 2.91406, 2.97656, 3.03906, + (689): 3.10156, 3.16406, 3.22656, 3.28906, 3.35156, 3.41406, + (695): 3.47656, 3.53906, 3.60156, 3.66406, 3.72656, 3.78906, + (701): 3.85156, 3.91406, 3.97656, 4.03906, 4.10156, 4.16406, + (707): 4.22656, 4.28906, 4.35156, 4.41406, 4.47656, 4.53906, + (713): 4.60156, 4.66406, 4.72656, 4.78906, 4.85156, 4.91406, + (719): 4.97656, 5.03906, 5.10156, 5.16406, 5.22656, 5.28906, + (725): 5.35156, 5.41406, 5.47656, 5.53906, 5.60156, 5.66406, + (731): 5.72656, 5.78906, 5.85156, 5.91406, 5.97656, 6.03906, + (737): 6.10156, 6.16406, 6.22656, 6.28906, 6.35156, 6.41406, + (743): 6.47656, 6.53906, 6.60156, 6.66406, 6.72656, 6.78906, + (749): 6.85156, 6.91406, 6.97656, 7.03906, 7.10156, 7.16406, + (755): 7.22656, 7.28906, 7.35156, 7.41406, 7.47656, 7.53906, + (761): 7.60156, 7.66406, 7.72656, 7.78906, 7.85156, 7.91406, + (767): 7.97656, 122, 0.109375, 0.171875, 0.234375, 0.296875, + (773): 0.359375, 0.421875, 0.484375, 0.546875, 0.609375, 0.671875, + (779): 0.734375, 0.796875, 0.859375, 0.921875, 0.984375, 1.04688, + (785): 1.10938, 1.17188, 1.23438, 1.29688, 1.35938, 1.42188, + (791): 1.48438, 1.54688, 1.60938, 1.67188, 1.73438, 1.79688, + (797): 1.85938, 1.92188, 1.98438, 2.04688, 2.10938, 2.17188, + (803): 2.23438, 2.29688, 2.35938, 2.42188, 2.48438, 2.54688, + (809): 2.60938, 2.67188, 2.73438, 2.79688, 2.85938, 2.92188, + (815): 2.98438, 3.04688, 3.10938, 3.17188, 3.23438, 3.29688, + (821): 3.35938, 3.42188, 3.48438, 3.54688, 3.60938, 3.67188, + (827): 3.73438, 3.79688, 3.85938, 3.92188, 3.98438, 4.04688, + (833): 4.10938, 4.17188, 4.23438, 4.29688, 4.35938, 4.42188, + (839): 4.48438, 4.54688, 4.60938, 4.67188, 4.73438, 4.79688, + (845): 4.85938, 4.92188, 4.98438, 5.04688, 5.10938, 5.17188, + (851): 5.23438, 5.29688, 5.35938, 5.42188, 5.48438, 5.54688, + (857): 5.60938, 5.67188, 5.73438, 5.79688, 5.85938, 5.92188, + (863): 5.98438, 6.04688, 6.10938, 6.17188, 6.23438, 6.29688, + (869): 6.35938, 6.42188, 6.48438, 6.54688, 6.60938, 6.67188, + (875): 6.73438, 6.79688, 6.85938, 6.92188, 6.98438, 7.04688, + (881): 7.10938, 7.17188, 7.23438, 7.29688, 7.35938, 7.42188, + (887): 7.48438, 7.54688, 7.60938, 7.67188, 7.73438, 7.79688, + (893): 7.85938, 7.92188, 7.98438, 121, 0.117188, 0.179688, 0.242188, + (900): 0.304688, 0.367188, 0.429688, 0.492188, 0.554688, 0.617188, + (906): 0.679688, 0.742188, 0.804688, 0.867188, 0.929688, 0.992188, + (912): 1.05469, 1.11719, 1.17969, 1.24219, 1.30469, 1.36719, + (918): 1.42969, 1.49219, 1.55469, 1.61719, 1.67969, 1.74219, + (924): 1.80469, 1.86719, 1.92969, 1.99219, 2.05469, 2.11719, + (930): 2.17969, 2.24219, 2.30469, 2.36719, 2.42969, 2.49219, + (936): 2.55469, 2.61719, 2.67969, 2.74219, 2.80469, 2.86719, + (942): 2.92969, 2.99219, 3.05469, 3.11719, 3.17969, 3.24219, + (948): 3.30469, 3.36719, 3.42969, 3.49219, 3.55469, 3.61719, + (954): 3.67969, 3.74219, 3.80469, 3.86719, 3.92969, 3.99219, + (960): 4.05469, 4.11719, 4.17969, 4.24219, 4.30469, 4.36719, + (966): 4.42969, 4.49219, 4.55469, 4.61719, 4.67969, 4.74219, + (972): 4.80469, 4.86719, 4.92969, 4.99219, 5.05469, 5.11719, + (978): 5.17969, 5.24219, 5.30469, 5.36719, 5.42969, 5.49219, + (984): 5.55469, 5.61719, 5.67969, 5.74219, 5.80469, 5.86719, + (990): 5.92969, 5.99219, 6.05469, 6.11719, 6.17969, 6.24219, + (996): 6.30469, 6.36719, 6.42969, 6.49219, 6.55469, 6.61719, + (1002): 6.67969, 6.74219, 6.80469, 6.86719, 6.92969, 6.99219, + (1008): 7.05469, 7.11719, 7.17969, 7.24219, 7.30469, 7.36719, + (1014): 7.42969, 7.49219, 7.55469, 7.61719, 7.67969, 7.74219, + (1020): 7.80469, 7.86719, 7.92969, 7.99219 + } + } + } + DATASET "DS32BITS" { + DATATYPE H5T_IEEE_F32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 1024 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0): 32, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, + (0,13): 3.25, 3.5, 3.75, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6, + (0,25): 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75, + (1,0): 31, 0.28125, 0.53125, 0.78125, 1.03125, 1.28125, 1.53125, + (1,7): 1.78125, 2.03125, 2.28125, 2.53125, 2.78125, 3.03125, 3.28125, + (1,14): 3.53125, 3.78125, 4.03125, 4.28125, 4.53125, 4.78125, 5.03125, + (1,21): 5.28125, 5.53125, 5.78125, 6.03125, 6.28125, 6.53125, 6.78125, + (1,28): 7.03125, 7.28125, 7.53125, 7.78125, + (2,0): 30, 0.3125, 0.5625, 0.8125, 1.0625, 1.3125, 1.5625, 1.8125, + (2,8): 2.0625, 2.3125, 2.5625, 2.8125, 3.0625, 3.3125, 3.5625, 3.8125, + (2,16): 4.0625, 4.3125, 4.5625, 4.8125, 5.0625, 5.3125, 5.5625, 5.8125, + (2,24): 6.0625, 6.3125, 6.5625, 6.8125, 7.0625, 7.3125, 7.5625, 7.8125, + (3,0): 29, 0.34375, 0.59375, 0.84375, 1.09375, 1.34375, 1.59375, + (3,7): 1.84375, 2.09375, 2.34375, 2.59375, 2.84375, 3.09375, 3.34375, + (3,14): 3.59375, 3.84375, 4.09375, 4.34375, 4.59375, 4.84375, 5.09375, + (3,21): 5.34375, 5.59375, 5.84375, 6.09375, 6.34375, 6.59375, 6.84375, + (3,28): 7.09375, 7.34375, 7.59375, 7.84375, + (4,0): 28, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875, 2.125, + (4,9): 2.375, 2.625, 2.875, 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, + (4,18): 4.625, 4.875, 5.125, 5.375, 5.625, 5.875, 6.125, 6.375, 6.625, + (4,27): 6.875, 7.125, 7.375, 7.625, 7.875, + (5,0): 27, 0.40625, 0.65625, 0.90625, 1.15625, 1.40625, 1.65625, + (5,7): 1.90625, 2.15625, 2.40625, 2.65625, 2.90625, 3.15625, 3.40625, + (5,14): 3.65625, 3.90625, 4.15625, 4.40625, 4.65625, 4.90625, 5.15625, + (5,21): 5.40625, 5.65625, 5.90625, 6.15625, 6.40625, 6.65625, 6.90625, + (5,28): 7.15625, 7.40625, 7.65625, 7.90625, + (6,0): 26, 0.4375, 0.6875, 0.9375, 1.1875, 1.4375, 1.6875, 1.9375, + (6,8): 2.1875, 2.4375, 2.6875, 2.9375, 3.1875, 3.4375, 3.6875, 3.9375, + (6,16): 4.1875, 4.4375, 4.6875, 4.9375, 5.1875, 5.4375, 5.6875, 5.9375, + (6,24): 6.1875, 6.4375, 6.6875, 6.9375, 7.1875, 7.4375, 7.6875, 7.9375, + (7,0): 25, 0.46875, 0.71875, 0.96875, 1.21875, 1.46875, 1.71875, + (7,7): 1.96875, 2.21875, 2.46875, 2.71875, 2.96875, 3.21875, 3.46875, + (7,14): 3.71875, 3.96875, 4.21875, 4.46875, 4.71875, 4.96875, 5.21875, + (7,21): 5.46875, 5.71875, 5.96875, 6.21875, 6.46875, 6.71875, 6.96875, + (7,28): 7.21875, 7.46875, 7.71875, 7.96875 + } + ATTRIBUTE "DS32BITS" { + DATATYPE H5T_IEEE_F32LE + DATASPACE SIMPLE { ( 256 ) / ( 256 ) } + DATA { + (0): 32, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, + (13): 3.25, 3.5, 3.75, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6, + (25): 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75, 31, 0.28125, 0.53125, + (35): 0.78125, 1.03125, 1.28125, 1.53125, 1.78125, 2.03125, 2.28125, + (42): 2.53125, 2.78125, 3.03125, 3.28125, 3.53125, 3.78125, 4.03125, + (49): 4.28125, 4.53125, 4.78125, 5.03125, 5.28125, 5.53125, 5.78125, + (56): 6.03125, 6.28125, 6.53125, 6.78125, 7.03125, 7.28125, 7.53125, + (63): 7.78125, 30, 0.3125, 0.5625, 0.8125, 1.0625, 1.3125, 1.5625, + (71): 1.8125, 2.0625, 2.3125, 2.5625, 2.8125, 3.0625, 3.3125, + (78): 3.5625, 3.8125, 4.0625, 4.3125, 4.5625, 4.8125, 5.0625, + (85): 5.3125, 5.5625, 5.8125, 6.0625, 6.3125, 6.5625, 6.8125, + (92): 7.0625, 7.3125, 7.5625, 7.8125, 29, 0.34375, 0.59375, 0.84375, + (100): 1.09375, 1.34375, 1.59375, 1.84375, 2.09375, 2.34375, + (106): 2.59375, 2.84375, 3.09375, 3.34375, 3.59375, 3.84375, + (112): 4.09375, 4.34375, 4.59375, 4.84375, 5.09375, 5.34375, + (118): 5.59375, 5.84375, 6.09375, 6.34375, 6.59375, 6.84375, + (124): 7.09375, 7.34375, 7.59375, 7.84375, 28, 0.375, 0.625, 0.875, + (132): 1.125, 1.375, 1.625, 1.875, 2.125, 2.375, 2.625, 2.875, + (140): 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, 4.625, 4.875, + (148): 5.125, 5.375, 5.625, 5.875, 6.125, 6.375, 6.625, 6.875, + (156): 7.125, 7.375, 7.625, 7.875, 27, 0.40625, 0.65625, 0.90625, + (164): 1.15625, 1.40625, 1.65625, 1.90625, 2.15625, 2.40625, + (170): 2.65625, 2.90625, 3.15625, 3.40625, 3.65625, 3.90625, + (176): 4.15625, 4.40625, 4.65625, 4.90625, 5.15625, 5.40625, + (182): 5.65625, 5.90625, 6.15625, 6.40625, 6.65625, 6.90625, + (188): 7.15625, 7.40625, 7.65625, 7.90625, 26, 0.4375, 0.6875, + (195): 0.9375, 1.1875, 1.4375, 1.6875, 1.9375, 2.1875, 2.4375, + (202): 2.6875, 2.9375, 3.1875, 3.4375, 3.6875, 3.9375, 4.1875, + (209): 4.4375, 4.6875, 4.9375, 5.1875, 5.4375, 5.6875, 5.9375, + (216): 6.1875, 6.4375, 6.6875, 6.9375, 7.1875, 7.4375, 7.6875, + (223): 7.9375, 25, 0.46875, 0.71875, 0.96875, 1.21875, 1.46875, + (230): 1.71875, 1.96875, 2.21875, 2.46875, 2.71875, 2.96875, + (236): 3.21875, 3.46875, 3.71875, 3.96875, 4.21875, 4.46875, + (242): 4.71875, 4.96875, 5.21875, 5.46875, 5.71875, 5.96875, + (248): 6.21875, 6.46875, 6.71875, 6.96875, 7.21875, 7.46875, + (254): 7.71875, 7.96875 + } + } + } + DATASET "DS64BITS" { + DATATYPE H5T_IEEE_F64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 4096 + OFFSET 6144 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0): 64, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, 1.25, + (0,11): 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, 2.5, + (0,21): 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, 3.75, + (0,31): 3.875, 4, 4.125, 4.25, 4.375, 4.5, 4.625, 4.75, 4.875, 5, + (0,41): 5.125, 5.25, 5.375, 5.5, 5.625, 5.75, 5.875, 6, 6.125, 6.25, + (0,51): 6.375, 6.5, 6.625, 6.75, 6.875, 7, 7.125, 7.25, 7.375, 7.5, + (0,61): 7.625, 7.75, 7.875, + (1,0): 63, 0.140625, 0.265625, 0.390625, 0.515625, 0.640625, 0.765625, + (1,7): 0.890625, 1.01562, 1.14062, 1.26562, 1.39062, 1.51562, 1.64062, + (1,14): 1.76562, 1.89062, 2.01562, 2.14062, 2.26562, 2.39062, 2.51562, + (1,21): 2.64062, 2.76562, 2.89062, 3.01562, 3.14062, 3.26562, 3.39062, + (1,28): 3.51562, 3.64062, 3.76562, 3.89062, 4.01562, 4.14062, 4.26562, + (1,35): 4.39062, 4.51562, 4.64062, 4.76562, 4.89062, 5.01562, 5.14062, + (1,42): 5.26562, 5.39062, 5.51562, 5.64062, 5.76562, 5.89062, 6.01562, + (1,49): 6.14062, 6.26562, 6.39062, 6.51562, 6.64062, 6.76562, 6.89062, + (1,56): 7.01562, 7.14062, 7.26562, 7.39062, 7.51562, 7.64062, 7.76562, + (1,63): 7.89062, + (2,0): 62, 0.15625, 0.28125, 0.40625, 0.53125, 0.65625, 0.78125, + (2,7): 0.90625, 1.03125, 1.15625, 1.28125, 1.40625, 1.53125, 1.65625, + (2,14): 1.78125, 1.90625, 2.03125, 2.15625, 2.28125, 2.40625, 2.53125, + (2,21): 2.65625, 2.78125, 2.90625, 3.03125, 3.15625, 3.28125, 3.40625, + (2,28): 3.53125, 3.65625, 3.78125, 3.90625, 4.03125, 4.15625, 4.28125, + (2,35): 4.40625, 4.53125, 4.65625, 4.78125, 4.90625, 5.03125, 5.15625, + (2,42): 5.28125, 5.40625, 5.53125, 5.65625, 5.78125, 5.90625, 6.03125, + (2,49): 6.15625, 6.28125, 6.40625, 6.53125, 6.65625, 6.78125, 6.90625, + (2,56): 7.03125, 7.15625, 7.28125, 7.40625, 7.53125, 7.65625, 7.78125, + (2,63): 7.90625, + (3,0): 61, 0.171875, 0.296875, 0.421875, 0.546875, 0.671875, 0.796875, + (3,7): 0.921875, 1.04688, 1.17188, 1.29688, 1.42188, 1.54688, 1.67188, + (3,14): 1.79688, 1.92188, 2.04688, 2.17188, 2.29688, 2.42188, 2.54688, + (3,21): 2.67188, 2.79688, 2.92188, 3.04688, 3.17188, 3.29688, 3.42188, + (3,28): 3.54688, 3.67188, 3.79688, 3.92188, 4.04688, 4.17188, 4.29688, + (3,35): 4.42188, 4.54688, 4.67188, 4.79688, 4.92188, 5.04688, 5.17188, + (3,42): 5.29688, 5.42188, 5.54688, 5.67188, 5.79688, 5.92188, 6.04688, + (3,49): 6.17188, 6.29688, 6.42188, 6.54688, 6.67188, 6.79688, 6.92188, + (3,56): 7.04688, 7.17188, 7.29688, 7.42188, 7.54688, 7.67188, 7.79688, + (3,63): 7.92188, + (4,0): 60, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875, 0.8125, 0.9375, + (4,8): 1.0625, 1.1875, 1.3125, 1.4375, 1.5625, 1.6875, 1.8125, 1.9375, + (4,16): 2.0625, 2.1875, 2.3125, 2.4375, 2.5625, 2.6875, 2.8125, 2.9375, + (4,24): 3.0625, 3.1875, 3.3125, 3.4375, 3.5625, 3.6875, 3.8125, 3.9375, + (4,32): 4.0625, 4.1875, 4.3125, 4.4375, 4.5625, 4.6875, 4.8125, 4.9375, + (4,40): 5.0625, 5.1875, 5.3125, 5.4375, 5.5625, 5.6875, 5.8125, 5.9375, + (4,48): 6.0625, 6.1875, 6.3125, 6.4375, 6.5625, 6.6875, 6.8125, 6.9375, + (4,56): 7.0625, 7.1875, 7.3125, 7.4375, 7.5625, 7.6875, 7.8125, 7.9375, + (5,0): 59, 0.203125, 0.328125, 0.453125, 0.578125, 0.703125, 0.828125, + (5,7): 0.953125, 1.07812, 1.20312, 1.32812, 1.45312, 1.57812, 1.70312, + (5,14): 1.82812, 1.95312, 2.07812, 2.20312, 2.32812, 2.45312, 2.57812, + (5,21): 2.70312, 2.82812, 2.95312, 3.07812, 3.20312, 3.32812, 3.45312, + (5,28): 3.57812, 3.70312, 3.82812, 3.95312, 4.07812, 4.20312, 4.32812, + (5,35): 4.45312, 4.57812, 4.70312, 4.82812, 4.95312, 5.07812, 5.20312, + (5,42): 5.32812, 5.45312, 5.57812, 5.70312, 5.82812, 5.95312, 6.07812, + (5,49): 6.20312, 6.32812, 6.45312, 6.57812, 6.70312, 6.82812, 6.95312, + (5,56): 7.07812, 7.20312, 7.32812, 7.45312, 7.57812, 7.70312, 7.82812, + (5,63): 7.95312, + (6,0): 58, 0.21875, 0.34375, 0.46875, 0.59375, 0.71875, 0.84375, + (6,7): 0.96875, 1.09375, 1.21875, 1.34375, 1.46875, 1.59375, 1.71875, + (6,14): 1.84375, 1.96875, 2.09375, 2.21875, 2.34375, 2.46875, 2.59375, + (6,21): 2.71875, 2.84375, 2.96875, 3.09375, 3.21875, 3.34375, 3.46875, + (6,28): 3.59375, 3.71875, 3.84375, 3.96875, 4.09375, 4.21875, 4.34375, + (6,35): 4.46875, 4.59375, 4.71875, 4.84375, 4.96875, 5.09375, 5.21875, + (6,42): 5.34375, 5.46875, 5.59375, 5.71875, 5.84375, 5.96875, 6.09375, + (6,49): 6.21875, 6.34375, 6.46875, 6.59375, 6.71875, 6.84375, 6.96875, + (6,56): 7.09375, 7.21875, 7.34375, 7.46875, 7.59375, 7.71875, 7.84375, + (6,63): 7.96875, + (7,0): 57, 0.234375, 0.359375, 0.484375, 0.609375, 0.734375, 0.859375, + (7,7): 0.984375, 1.10938, 1.23438, 1.35938, 1.48438, 1.60938, 1.73438, + (7,14): 1.85938, 1.98438, 2.10938, 2.23438, 2.35938, 2.48438, 2.60938, + (7,21): 2.73438, 2.85938, 2.98438, 3.10938, 3.23438, 3.35938, 3.48438, + (7,28): 3.60938, 3.73438, 3.85938, 3.98438, 4.10938, 4.23438, 4.35938, + (7,35): 4.48438, 4.60938, 4.73438, 4.85938, 4.98438, 5.10938, 5.23438, + (7,42): 5.35938, 5.48438, 5.60938, 5.73438, 5.85938, 5.98438, 6.10938, + (7,49): 6.23438, 6.35938, 6.48438, 6.60938, 6.73438, 6.85938, 6.98438, + (7,56): 7.10938, 7.23438, 7.35938, 7.48438, 7.60938, 7.73438, 7.85938, + (7,63): 7.98438 + } + ATTRIBUTE "DS64BITS" { + DATATYPE H5T_IEEE_F64LE + DATASPACE SIMPLE { ( 512 ) / ( 512 ) } + DATA { + (0): 64, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, + (10): 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, + (20): 2.5, 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, + (30): 3.75, 3.875, 4, 4.125, 4.25, 4.375, 4.5, 4.625, 4.75, 4.875, + (40): 5, 5.125, 5.25, 5.375, 5.5, 5.625, 5.75, 5.875, 6, 6.125, + (50): 6.25, 6.375, 6.5, 6.625, 6.75, 6.875, 7, 7.125, 7.25, 7.375, + (60): 7.5, 7.625, 7.75, 7.875, 63, 0.140625, 0.265625, 0.390625, + (68): 0.515625, 0.640625, 0.765625, 0.890625, 1.01562, 1.14062, + (74): 1.26562, 1.39062, 1.51562, 1.64062, 1.76562, 1.89062, 2.01562, + (81): 2.14062, 2.26562, 2.39062, 2.51562, 2.64062, 2.76562, 2.89062, + (88): 3.01562, 3.14062, 3.26562, 3.39062, 3.51562, 3.64062, 3.76562, + (95): 3.89062, 4.01562, 4.14062, 4.26562, 4.39062, 4.51562, 4.64062, + (102): 4.76562, 4.89062, 5.01562, 5.14062, 5.26562, 5.39062, + (108): 5.51562, 5.64062, 5.76562, 5.89062, 6.01562, 6.14062, + (114): 6.26562, 6.39062, 6.51562, 6.64062, 6.76562, 6.89062, + (120): 7.01562, 7.14062, 7.26562, 7.39062, 7.51562, 7.64062, + (126): 7.76562, 7.89062, 62, 0.15625, 0.28125, 0.40625, 0.53125, + (133): 0.65625, 0.78125, 0.90625, 1.03125, 1.15625, 1.28125, + (139): 1.40625, 1.53125, 1.65625, 1.78125, 1.90625, 2.03125, + (145): 2.15625, 2.28125, 2.40625, 2.53125, 2.65625, 2.78125, + (151): 2.90625, 3.03125, 3.15625, 3.28125, 3.40625, 3.53125, + (157): 3.65625, 3.78125, 3.90625, 4.03125, 4.15625, 4.28125, + (163): 4.40625, 4.53125, 4.65625, 4.78125, 4.90625, 5.03125, + (169): 5.15625, 5.28125, 5.40625, 5.53125, 5.65625, 5.78125, + (175): 5.90625, 6.03125, 6.15625, 6.28125, 6.40625, 6.53125, + (181): 6.65625, 6.78125, 6.90625, 7.03125, 7.15625, 7.28125, + (187): 7.40625, 7.53125, 7.65625, 7.78125, 7.90625, 61, 0.171875, + (194): 0.296875, 0.421875, 0.546875, 0.671875, 0.796875, 0.921875, + (200): 1.04688, 1.17188, 1.29688, 1.42188, 1.54688, 1.67188, + (206): 1.79688, 1.92188, 2.04688, 2.17188, 2.29688, 2.42188, + (212): 2.54688, 2.67188, 2.79688, 2.92188, 3.04688, 3.17188, + (218): 3.29688, 3.42188, 3.54688, 3.67188, 3.79688, 3.92188, + (224): 4.04688, 4.17188, 4.29688, 4.42188, 4.54688, 4.67188, + (230): 4.79688, 4.92188, 5.04688, 5.17188, 5.29688, 5.42188, + (236): 5.54688, 5.67188, 5.79688, 5.92188, 6.04688, 6.17188, + (242): 6.29688, 6.42188, 6.54688, 6.67188, 6.79688, 6.92188, + (248): 7.04688, 7.17188, 7.29688, 7.42188, 7.54688, 7.67188, + (254): 7.79688, 7.92188, 60, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875, + (262): 0.8125, 0.9375, 1.0625, 1.1875, 1.3125, 1.4375, 1.5625, + (269): 1.6875, 1.8125, 1.9375, 2.0625, 2.1875, 2.3125, 2.4375, + (276): 2.5625, 2.6875, 2.8125, 2.9375, 3.0625, 3.1875, 3.3125, + (283): 3.4375, 3.5625, 3.6875, 3.8125, 3.9375, 4.0625, 4.1875, + (290): 4.3125, 4.4375, 4.5625, 4.6875, 4.8125, 4.9375, 5.0625, + (297): 5.1875, 5.3125, 5.4375, 5.5625, 5.6875, 5.8125, 5.9375, + (304): 6.0625, 6.1875, 6.3125, 6.4375, 6.5625, 6.6875, 6.8125, + (311): 6.9375, 7.0625, 7.1875, 7.3125, 7.4375, 7.5625, 7.6875, + (318): 7.8125, 7.9375, 59, 0.203125, 0.328125, 0.453125, 0.578125, + (325): 0.703125, 0.828125, 0.953125, 1.07812, 1.20312, 1.32812, + (331): 1.45312, 1.57812, 1.70312, 1.82812, 1.95312, 2.07812, + (337): 2.20312, 2.32812, 2.45312, 2.57812, 2.70312, 2.82812, + (343): 2.95312, 3.07812, 3.20312, 3.32812, 3.45312, 3.57812, + (349): 3.70312, 3.82812, 3.95312, 4.07812, 4.20312, 4.32812, + (355): 4.45312, 4.57812, 4.70312, 4.82812, 4.95312, 5.07812, + (361): 5.20312, 5.32812, 5.45312, 5.57812, 5.70312, 5.82812, + (367): 5.95312, 6.07812, 6.20312, 6.32812, 6.45312, 6.57812, + (373): 6.70312, 6.82812, 6.95312, 7.07812, 7.20312, 7.32812, + (379): 7.45312, 7.57812, 7.70312, 7.82812, 7.95312, 58, 0.21875, + (386): 0.34375, 0.46875, 0.59375, 0.71875, 0.84375, 0.96875, + (392): 1.09375, 1.21875, 1.34375, 1.46875, 1.59375, 1.71875, + (398): 1.84375, 1.96875, 2.09375, 2.21875, 2.34375, 2.46875, + (404): 2.59375, 2.71875, 2.84375, 2.96875, 3.09375, 3.21875, + (410): 3.34375, 3.46875, 3.59375, 3.71875, 3.84375, 3.96875, + (416): 4.09375, 4.21875, 4.34375, 4.46875, 4.59375, 4.71875, + (422): 4.84375, 4.96875, 5.09375, 5.21875, 5.34375, 5.46875, + (428): 5.59375, 5.71875, 5.84375, 5.96875, 6.09375, 6.21875, + (434): 6.34375, 6.46875, 6.59375, 6.71875, 6.84375, 6.96875, + (440): 7.09375, 7.21875, 7.34375, 7.46875, 7.59375, 7.71875, + (446): 7.84375, 7.96875, 57, 0.234375, 0.359375, 0.484375, 0.609375, + (453): 0.734375, 0.859375, 0.984375, 1.10938, 1.23438, 1.35938, + (459): 1.48438, 1.60938, 1.73438, 1.85938, 1.98438, 2.10938, + (465): 2.23438, 2.35938, 2.48438, 2.60938, 2.73438, 2.85938, + (471): 2.98438, 3.10938, 3.23438, 3.35938, 3.48438, 3.60938, + (477): 3.73438, 3.85938, 3.98438, 4.10938, 4.23438, 4.35938, + (483): 4.48438, 4.60938, 4.73438, 4.85938, 4.98438, 5.10938, + (489): 5.23438, 5.35938, 5.48438, 5.60938, 5.73438, 5.85938, + (495): 5.98438, 6.10938, 6.23438, 6.35938, 6.48438, 6.60938, + (501): 6.73438, 6.85938, 6.98438, 7.10938, 7.23438, 7.35938, + (507): 7.48438, 7.60938, 7.73438, 7.85938, 7.98438 + } + } + } +} +} diff --git a/tools/testfiles/tfloatsattrs.h5 b/tools/testfiles/tfloatsattrs.h5 new file mode 100644 index 0000000..9e73542 Binary files /dev/null and b/tools/testfiles/tfloatsattrs.h5 differ diff --git a/tools/testfiles/tfloatsattrs.wddl b/tools/testfiles/tfloatsattrs.wddl new file mode 100644 index 0000000..38b735f --- /dev/null +++ b/tools/testfiles/tfloatsattrs.wddl @@ -0,0 +1,621 @@ +HDF5 "tfloatsattrs.h5" { +GROUP "/" { + DATASET "DS128BITS" { + DATATYPE 128-bit little-endian floating-point 80-bit precision + DATASPACE SIMPLE { ( 8, 128 ) / ( 8, 128 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 16384 + OFFSET 14416 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0): 128, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, + (0,9): 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.0625, + (0,18): 1.125, 1.1875, 1.25, 1.3125, 1.375, 1.4375, 1.5, 1.5625, 1.625, + (0,27): 1.6875, 1.75, 1.8125, 1.875, 1.9375, 2, 2.0625, 2.125, 2.1875, + (0,36): 2.25, 2.3125, 2.375, 2.4375, 2.5, 2.5625, 2.625, 2.6875, 2.75, + (0,45): 2.8125, 2.875, 2.9375, 3, 3.0625, 3.125, 3.1875, 3.25, 3.3125, + (0,54): 3.375, 3.4375, 3.5, 3.5625, 3.625, 3.6875, 3.75, 3.8125, 3.875, + (0,63): 3.9375, 4, 4.0625, 4.125, 4.1875, 4.25, 4.3125, 4.375, 4.4375, + (0,72): 4.5, 4.5625, 4.625, 4.6875, 4.75, 4.8125, 4.875, 4.9375, 5, + (0,81): 5.0625, 5.125, 5.1875, 5.25, 5.3125, 5.375, 5.4375, 5.5, + (0,89): 5.5625, 5.625, 5.6875, 5.75, 5.8125, 5.875, 5.9375, 6, 6.0625, + (0,98): 6.125, 6.1875, 6.25, 6.3125, 6.375, 6.4375, 6.5, 6.5625, 6.625, + (0,107): 6.6875, 6.75, 6.8125, 6.875, 6.9375, 7, 7.0625, 7.125, 7.1875, + (0,116): 7.25, 7.3125, 7.375, 7.4375, 7.5, 7.5625, 7.625, 7.6875, 7.75, + (0,125): 7.8125, 7.875, 7.9375, + (1,0): 127, 0.0703125, 0.132813, 0.195313, 0.257813, 0.320313, + (1,6): 0.382813, 0.445313, 0.507813, 0.570313, 0.632813, 0.695313, + (1,12): 0.757813, 0.820313, 0.882813, 0.945313, 1.00781, 1.07031, + (1,18): 1.13281, 1.19531, 1.25781, 1.32031, 1.38281, 1.44531, 1.50781, + (1,25): 1.57031, 1.63281, 1.69531, 1.75781, 1.82031, 1.88281, 1.94531, + (1,32): 2.00781, 2.07031, 2.13281, 2.19531, 2.25781, 2.32031, 2.38281, + (1,39): 2.44531, 2.50781, 2.57031, 2.63281, 2.69531, 2.75781, 2.82031, + (1,46): 2.88281, 2.94531, 3.00781, 3.07031, 3.13281, 3.19531, 3.25781, + (1,53): 3.32031, 3.38281, 3.44531, 3.50781, 3.57031, 3.63281, 3.69531, + (1,60): 3.75781, 3.82031, 3.88281, 3.94531, 4.00781, 4.07031, 4.13281, + (1,67): 4.19531, 4.25781, 4.32031, 4.38281, 4.44531, 4.50781, 4.57031, + (1,74): 4.63281, 4.69531, 4.75781, 4.82031, 4.88281, 4.94531, 5.00781, + (1,81): 5.07031, 5.13281, 5.19531, 5.25781, 5.32031, 5.38281, 5.44531, + (1,88): 5.50781, 5.57031, 5.63281, 5.69531, 5.75781, 5.82031, 5.88281, + (1,95): 5.94531, 6.00781, 6.07031, 6.13281, 6.19531, 6.25781, 6.32031, + (1,102): 6.38281, 6.44531, 6.50781, 6.57031, 6.63281, 6.69531, 6.75781, + (1,109): 6.82031, 6.88281, 6.94531, 7.00781, 7.07031, 7.13281, 7.19531, + (1,116): 7.25781, 7.32031, 7.38281, 7.44531, 7.50781, 7.57031, 7.63281, + (1,123): 7.69531, 7.75781, 7.82031, 7.88281, 7.94531, + (2,0): 126, 0.078125, 0.140625, 0.203125, 0.265625, 0.328125, 0.390625, + (2,7): 0.453125, 0.515625, 0.578125, 0.640625, 0.703125, 0.765625, + (2,13): 0.828125, 0.890625, 0.953125, 1.01563, 1.07813, 1.14063, + (2,19): 1.20313, 1.26563, 1.32813, 1.39063, 1.45313, 1.51563, 1.57813, + (2,26): 1.64063, 1.70313, 1.76563, 1.82813, 1.89063, 1.95313, 2.01563, + (2,33): 2.07813, 2.14063, 2.20313, 2.26563, 2.32813, 2.39063, 2.45313, + (2,40): 2.51563, 2.57813, 2.64063, 2.70313, 2.76563, 2.82813, 2.89063, + (2,47): 2.95313, 3.01563, 3.07813, 3.14063, 3.20313, 3.26563, 3.32813, + (2,54): 3.39063, 3.45313, 3.51563, 3.57813, 3.64063, 3.70313, 3.76563, + (2,61): 3.82813, 3.89063, 3.95313, 4.01563, 4.07813, 4.14063, 4.20313, + (2,68): 4.26563, 4.32813, 4.39063, 4.45313, 4.51563, 4.57813, 4.64063, + (2,75): 4.70313, 4.76563, 4.82813, 4.89063, 4.95313, 5.01563, 5.07813, + (2,82): 5.14063, 5.20313, 5.26563, 5.32813, 5.39063, 5.45313, 5.51563, + (2,89): 5.57813, 5.64063, 5.70313, 5.76563, 5.82813, 5.89063, 5.95313, + (2,96): 6.01563, 6.07813, 6.14063, 6.20313, 6.26563, 6.32813, 6.39063, + (2,103): 6.45313, 6.51563, 6.57813, 6.64063, 6.70313, 6.76563, 6.82813, + (2,110): 6.89063, 6.95313, 7.01563, 7.07813, 7.14063, 7.20313, 7.26563, + (2,117): 7.32813, 7.39063, 7.45313, 7.51563, 7.57813, 7.64063, 7.70313, + (2,124): 7.76563, 7.82813, 7.89063, 7.95313, + (3,0): 125, 0.0859375, 0.148438, 0.210938, 0.273438, 0.335938, + (3,6): 0.398438, 0.460938, 0.523438, 0.585938, 0.648438, 0.710938, + (3,12): 0.773438, 0.835938, 0.898438, 0.960938, 1.02344, 1.08594, + (3,18): 1.14844, 1.21094, 1.27344, 1.33594, 1.39844, 1.46094, 1.52344, + (3,25): 1.58594, 1.64844, 1.71094, 1.77344, 1.83594, 1.89844, 1.96094, + (3,32): 2.02344, 2.08594, 2.14844, 2.21094, 2.27344, 2.33594, 2.39844, + (3,39): 2.46094, 2.52344, 2.58594, 2.64844, 2.71094, 2.77344, 2.83594, + (3,46): 2.89844, 2.96094, 3.02344, 3.08594, 3.14844, 3.21094, 3.27344, + (3,53): 3.33594, 3.39844, 3.46094, 3.52344, 3.58594, 3.64844, 3.71094, + (3,60): 3.77344, 3.83594, 3.89844, 3.96094, 4.02344, 4.08594, 4.14844, + (3,67): 4.21094, 4.27344, 4.33594, 4.39844, 4.46094, 4.52344, 4.58594, + (3,74): 4.64844, 4.71094, 4.77344, 4.83594, 4.89844, 4.96094, 5.02344, + (3,81): 5.08594, 5.14844, 5.21094, 5.27344, 5.33594, 5.39844, 5.46094, + (3,88): 5.52344, 5.58594, 5.64844, 5.71094, 5.77344, 5.83594, 5.89844, + (3,95): 5.96094, 6.02344, 6.08594, 6.14844, 6.21094, 6.27344, 6.33594, + (3,102): 6.39844, 6.46094, 6.52344, 6.58594, 6.64844, 6.71094, 6.77344, + (3,109): 6.83594, 6.89844, 6.96094, 7.02344, 7.08594, 7.14844, 7.21094, + (3,116): 7.27344, 7.33594, 7.39844, 7.46094, 7.52344, 7.58594, 7.64844, + (3,123): 7.71094, 7.77344, 7.83594, 7.89844, 7.96094, + (4,0): 124, 0.09375, 0.15625, 0.21875, 0.28125, 0.34375, 0.40625, + (4,7): 0.46875, 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375, + (4,14): 0.90625, 0.96875, 1.03125, 1.09375, 1.15625, 1.21875, 1.28125, + (4,21): 1.34375, 1.40625, 1.46875, 1.53125, 1.59375, 1.65625, 1.71875, + (4,28): 1.78125, 1.84375, 1.90625, 1.96875, 2.03125, 2.09375, 2.15625, + (4,35): 2.21875, 2.28125, 2.34375, 2.40625, 2.46875, 2.53125, 2.59375, + (4,42): 2.65625, 2.71875, 2.78125, 2.84375, 2.90625, 2.96875, 3.03125, + (4,49): 3.09375, 3.15625, 3.21875, 3.28125, 3.34375, 3.40625, 3.46875, + (4,56): 3.53125, 3.59375, 3.65625, 3.71875, 3.78125, 3.84375, 3.90625, + (4,63): 3.96875, 4.03125, 4.09375, 4.15625, 4.21875, 4.28125, 4.34375, + (4,70): 4.40625, 4.46875, 4.53125, 4.59375, 4.65625, 4.71875, 4.78125, + (4,77): 4.84375, 4.90625, 4.96875, 5.03125, 5.09375, 5.15625, 5.21875, + (4,84): 5.28125, 5.34375, 5.40625, 5.46875, 5.53125, 5.59375, 5.65625, + (4,91): 5.71875, 5.78125, 5.84375, 5.90625, 5.96875, 6.03125, 6.09375, + (4,98): 6.15625, 6.21875, 6.28125, 6.34375, 6.40625, 6.46875, 6.53125, + (4,105): 6.59375, 6.65625, 6.71875, 6.78125, 6.84375, 6.90625, 6.96875, + (4,112): 7.03125, 7.09375, 7.15625, 7.21875, 7.28125, 7.34375, 7.40625, + (4,119): 7.46875, 7.53125, 7.59375, 7.65625, 7.71875, 7.78125, 7.84375, + (4,126): 7.90625, 7.96875, + (5,0): 123, 0.101563, 0.164063, 0.226563, 0.289063, 0.351563, 0.414063, + (5,7): 0.476563, 0.539063, 0.601563, 0.664063, 0.726563, 0.789063, + (5,13): 0.851563, 0.914063, 0.976563, 1.03906, 1.10156, 1.16406, + (5,19): 1.22656, 1.28906, 1.35156, 1.41406, 1.47656, 1.53906, 1.60156, + (5,26): 1.66406, 1.72656, 1.78906, 1.85156, 1.91406, 1.97656, 2.03906, + (5,33): 2.10156, 2.16406, 2.22656, 2.28906, 2.35156, 2.41406, 2.47656, + (5,40): 2.53906, 2.60156, 2.66406, 2.72656, 2.78906, 2.85156, 2.91406, + (5,47): 2.97656, 3.03906, 3.10156, 3.16406, 3.22656, 3.28906, 3.35156, + (5,54): 3.41406, 3.47656, 3.53906, 3.60156, 3.66406, 3.72656, 3.78906, + (5,61): 3.85156, 3.91406, 3.97656, 4.03906, 4.10156, 4.16406, 4.22656, + (5,68): 4.28906, 4.35156, 4.41406, 4.47656, 4.53906, 4.60156, 4.66406, + (5,75): 4.72656, 4.78906, 4.85156, 4.91406, 4.97656, 5.03906, 5.10156, + (5,82): 5.16406, 5.22656, 5.28906, 5.35156, 5.41406, 5.47656, 5.53906, + (5,89): 5.60156, 5.66406, 5.72656, 5.78906, 5.85156, 5.91406, 5.97656, + (5,96): 6.03906, 6.10156, 6.16406, 6.22656, 6.28906, 6.35156, 6.41406, + (5,103): 6.47656, 6.53906, 6.60156, 6.66406, 6.72656, 6.78906, 6.85156, + (5,110): 6.91406, 6.97656, 7.03906, 7.10156, 7.16406, 7.22656, 7.28906, + (5,117): 7.35156, 7.41406, 7.47656, 7.53906, 7.60156, 7.66406, 7.72656, + (5,124): 7.78906, 7.85156, 7.91406, 7.97656, + (6,0): 122, 0.109375, 0.171875, 0.234375, 0.296875, 0.359375, 0.421875, + (6,7): 0.484375, 0.546875, 0.609375, 0.671875, 0.734375, 0.796875, + (6,13): 0.859375, 0.921875, 0.984375, 1.04688, 1.10938, 1.17188, + (6,19): 1.23438, 1.29688, 1.35938, 1.42188, 1.48438, 1.54688, 1.60938, + (6,26): 1.67188, 1.73438, 1.79688, 1.85938, 1.92188, 1.98438, 2.04688, + (6,33): 2.10938, 2.17188, 2.23438, 2.29688, 2.35938, 2.42188, 2.48438, + (6,40): 2.54688, 2.60938, 2.67188, 2.73438, 2.79688, 2.85938, 2.92188, + (6,47): 2.98438, 3.04688, 3.10938, 3.17188, 3.23438, 3.29688, 3.35938, + (6,54): 3.42188, 3.48438, 3.54688, 3.60938, 3.67188, 3.73438, 3.79688, + (6,61): 3.85938, 3.92188, 3.98438, 4.04688, 4.10938, 4.17188, 4.23438, + (6,68): 4.29688, 4.35938, 4.42188, 4.48438, 4.54688, 4.60938, 4.67188, + (6,75): 4.73438, 4.79688, 4.85938, 4.92188, 4.98438, 5.04688, 5.10938, + (6,82): 5.17188, 5.23438, 5.29688, 5.35938, 5.42188, 5.48438, 5.54688, + (6,89): 5.60938, 5.67188, 5.73438, 5.79688, 5.85938, 5.92188, 5.98438, + (6,96): 6.04688, 6.10938, 6.17188, 6.23438, 6.29688, 6.35938, 6.42188, + (6,103): 6.48438, 6.54688, 6.60938, 6.67188, 6.73438, 6.79688, 6.85938, + (6,110): 6.92188, 6.98438, 7.04688, 7.10938, 7.17188, 7.23438, 7.29688, + (6,117): 7.35938, 7.42188, 7.48438, 7.54688, 7.60938, 7.67188, 7.73438, + (6,124): 7.79688, 7.85938, 7.92188, 7.98438, + (7,0): 121, 0.117188, 0.179688, 0.242188, 0.304688, 0.367188, 0.429688, + (7,7): 0.492188, 0.554688, 0.617188, 0.679688, 0.742188, 0.804688, + (7,13): 0.867188, 0.929688, 0.992188, 1.05469, 1.11719, 1.17969, + (7,19): 1.24219, 1.30469, 1.36719, 1.42969, 1.49219, 1.55469, 1.61719, + (7,26): 1.67969, 1.74219, 1.80469, 1.86719, 1.92969, 1.99219, 2.05469, + (7,33): 2.11719, 2.17969, 2.24219, 2.30469, 2.36719, 2.42969, 2.49219, + (7,40): 2.55469, 2.61719, 2.67969, 2.74219, 2.80469, 2.86719, 2.92969, + (7,47): 2.99219, 3.05469, 3.11719, 3.17969, 3.24219, 3.30469, 3.36719, + (7,54): 3.42969, 3.49219, 3.55469, 3.61719, 3.67969, 3.74219, 3.80469, + (7,61): 3.86719, 3.92969, 3.99219, 4.05469, 4.11719, 4.17969, 4.24219, + (7,68): 4.30469, 4.36719, 4.42969, 4.49219, 4.55469, 4.61719, 4.67969, + (7,75): 4.74219, 4.80469, 4.86719, 4.92969, 4.99219, 5.05469, 5.11719, + (7,82): 5.17969, 5.24219, 5.30469, 5.36719, 5.42969, 5.49219, 5.55469, + (7,89): 5.61719, 5.67969, 5.74219, 5.80469, 5.86719, 5.92969, 5.99219, + (7,96): 6.05469, 6.11719, 6.17969, 6.24219, 6.30469, 6.36719, 6.42969, + (7,103): 6.49219, 6.55469, 6.61719, 6.67969, 6.74219, 6.80469, 6.86719, + (7,110): 6.92969, 6.99219, 7.05469, 7.11719, 7.17969, 7.24219, 7.30469, + (7,117): 7.36719, 7.42969, 7.49219, 7.55469, 7.61719, 7.67969, 7.74219, + (7,124): 7.80469, 7.86719, 7.92969, 7.99219 + } + ATTRIBUTE "DS128BITS" { + DATATYPE 128-bit little-endian floating-point 80-bit precision + DATASPACE SIMPLE { ( 1024 ) / ( 1024 ) } + DATA { + (0): 128, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, + (9): 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.0625, + (18): 1.125, 1.1875, 1.25, 1.3125, 1.375, 1.4375, 1.5, 1.5625, + (26): 1.625, 1.6875, 1.75, 1.8125, 1.875, 1.9375, 2, 2.0625, 2.125, + (35): 2.1875, 2.25, 2.3125, 2.375, 2.4375, 2.5, 2.5625, 2.625, + (43): 2.6875, 2.75, 2.8125, 2.875, 2.9375, 3, 3.0625, 3.125, 3.1875, + (52): 3.25, 3.3125, 3.375, 3.4375, 3.5, 3.5625, 3.625, 3.6875, 3.75, + (61): 3.8125, 3.875, 3.9375, 4, 4.0625, 4.125, 4.1875, 4.25, 4.3125, + (70): 4.375, 4.4375, 4.5, 4.5625, 4.625, 4.6875, 4.75, 4.8125, + (78): 4.875, 4.9375, 5, 5.0625, 5.125, 5.1875, 5.25, 5.3125, 5.375, + (87): 5.4375, 5.5, 5.5625, 5.625, 5.6875, 5.75, 5.8125, 5.875, + (95): 5.9375, 6, 6.0625, 6.125, 6.1875, 6.25, 6.3125, 6.375, 6.4375, + (104): 6.5, 6.5625, 6.625, 6.6875, 6.75, 6.8125, 6.875, 6.9375, 7, + (113): 7.0625, 7.125, 7.1875, 7.25, 7.3125, 7.375, 7.4375, 7.5, + (121): 7.5625, 7.625, 7.6875, 7.75, 7.8125, 7.875, 7.9375, 127, + (129): 0.0703125, 0.132813, 0.195313, 0.257813, 0.320313, 0.382813, + (135): 0.445313, 0.507813, 0.570313, 0.632813, 0.695313, 0.757813, + (141): 0.820313, 0.882813, 0.945313, 1.00781, 1.07031, 1.13281, + (147): 1.19531, 1.25781, 1.32031, 1.38281, 1.44531, 1.50781, + (153): 1.57031, 1.63281, 1.69531, 1.75781, 1.82031, 1.88281, + (159): 1.94531, 2.00781, 2.07031, 2.13281, 2.19531, 2.25781, + (165): 2.32031, 2.38281, 2.44531, 2.50781, 2.57031, 2.63281, + (171): 2.69531, 2.75781, 2.82031, 2.88281, 2.94531, 3.00781, + (177): 3.07031, 3.13281, 3.19531, 3.25781, 3.32031, 3.38281, + (183): 3.44531, 3.50781, 3.57031, 3.63281, 3.69531, 3.75781, + (189): 3.82031, 3.88281, 3.94531, 4.00781, 4.07031, 4.13281, + (195): 4.19531, 4.25781, 4.32031, 4.38281, 4.44531, 4.50781, + (201): 4.57031, 4.63281, 4.69531, 4.75781, 4.82031, 4.88281, + (207): 4.94531, 5.00781, 5.07031, 5.13281, 5.19531, 5.25781, + (213): 5.32031, 5.38281, 5.44531, 5.50781, 5.57031, 5.63281, + (219): 5.69531, 5.75781, 5.82031, 5.88281, 5.94531, 6.00781, + (225): 6.07031, 6.13281, 6.19531, 6.25781, 6.32031, 6.38281, + (231): 6.44531, 6.50781, 6.57031, 6.63281, 6.69531, 6.75781, + (237): 6.82031, 6.88281, 6.94531, 7.00781, 7.07031, 7.13281, + (243): 7.19531, 7.25781, 7.32031, 7.38281, 7.44531, 7.50781, + (249): 7.57031, 7.63281, 7.69531, 7.75781, 7.82031, 7.88281, + (255): 7.94531, 126, 0.078125, 0.140625, 0.203125, 0.265625, + (261): 0.328125, 0.390625, 0.453125, 0.515625, 0.578125, 0.640625, + (267): 0.703125, 0.765625, 0.828125, 0.890625, 0.953125, 1.01563, + (273): 1.07813, 1.14063, 1.20313, 1.26563, 1.32813, 1.39063, + (279): 1.45313, 1.51563, 1.57813, 1.64063, 1.70313, 1.76563, + (285): 1.82813, 1.89063, 1.95313, 2.01563, 2.07813, 2.14063, + (291): 2.20313, 2.26563, 2.32813, 2.39063, 2.45313, 2.51563, + (297): 2.57813, 2.64063, 2.70313, 2.76563, 2.82813, 2.89063, + (303): 2.95313, 3.01563, 3.07813, 3.14063, 3.20313, 3.26563, + (309): 3.32813, 3.39063, 3.45313, 3.51563, 3.57813, 3.64063, + (315): 3.70313, 3.76563, 3.82813, 3.89063, 3.95313, 4.01563, + (321): 4.07813, 4.14063, 4.20313, 4.26563, 4.32813, 4.39063, + (327): 4.45313, 4.51563, 4.57813, 4.64063, 4.70313, 4.76563, + (333): 4.82813, 4.89063, 4.95313, 5.01563, 5.07813, 5.14063, + (339): 5.20313, 5.26563, 5.32813, 5.39063, 5.45313, 5.51563, + (345): 5.57813, 5.64063, 5.70313, 5.76563, 5.82813, 5.89063, + (351): 5.95313, 6.01563, 6.07813, 6.14063, 6.20313, 6.26563, + (357): 6.32813, 6.39063, 6.45313, 6.51563, 6.57813, 6.64063, + (363): 6.70313, 6.76563, 6.82813, 6.89063, 6.95313, 7.01563, + (369): 7.07813, 7.14063, 7.20313, 7.26563, 7.32813, 7.39063, + (375): 7.45313, 7.51563, 7.57813, 7.64063, 7.70313, 7.76563, + (381): 7.82813, 7.89063, 7.95313, 125, 0.0859375, 0.148438, + (387): 0.210938, 0.273438, 0.335938, 0.398438, 0.460938, 0.523438, + (393): 0.585938, 0.648438, 0.710938, 0.773438, 0.835938, 0.898438, + (399): 0.960938, 1.02344, 1.08594, 1.14844, 1.21094, 1.27344, + (405): 1.33594, 1.39844, 1.46094, 1.52344, 1.58594, 1.64844, + (411): 1.71094, 1.77344, 1.83594, 1.89844, 1.96094, 2.02344, + (417): 2.08594, 2.14844, 2.21094, 2.27344, 2.33594, 2.39844, + (423): 2.46094, 2.52344, 2.58594, 2.64844, 2.71094, 2.77344, + (429): 2.83594, 2.89844, 2.96094, 3.02344, 3.08594, 3.14844, + (435): 3.21094, 3.27344, 3.33594, 3.39844, 3.46094, 3.52344, + (441): 3.58594, 3.64844, 3.71094, 3.77344, 3.83594, 3.89844, + (447): 3.96094, 4.02344, 4.08594, 4.14844, 4.21094, 4.27344, + (453): 4.33594, 4.39844, 4.46094, 4.52344, 4.58594, 4.64844, + (459): 4.71094, 4.77344, 4.83594, 4.89844, 4.96094, 5.02344, + (465): 5.08594, 5.14844, 5.21094, 5.27344, 5.33594, 5.39844, + (471): 5.46094, 5.52344, 5.58594, 5.64844, 5.71094, 5.77344, + (477): 5.83594, 5.89844, 5.96094, 6.02344, 6.08594, 6.14844, + (483): 6.21094, 6.27344, 6.33594, 6.39844, 6.46094, 6.52344, + (489): 6.58594, 6.64844, 6.71094, 6.77344, 6.83594, 6.89844, + (495): 6.96094, 7.02344, 7.08594, 7.14844, 7.21094, 7.27344, + (501): 7.33594, 7.39844, 7.46094, 7.52344, 7.58594, 7.64844, + (507): 7.71094, 7.77344, 7.83594, 7.89844, 7.96094, 124, 0.09375, + (514): 0.15625, 0.21875, 0.28125, 0.34375, 0.40625, 0.46875, + (520): 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375, + (526): 0.90625, 0.96875, 1.03125, 1.09375, 1.15625, 1.21875, + (532): 1.28125, 1.34375, 1.40625, 1.46875, 1.53125, 1.59375, + (538): 1.65625, 1.71875, 1.78125, 1.84375, 1.90625, 1.96875, + (544): 2.03125, 2.09375, 2.15625, 2.21875, 2.28125, 2.34375, + (550): 2.40625, 2.46875, 2.53125, 2.59375, 2.65625, 2.71875, + (556): 2.78125, 2.84375, 2.90625, 2.96875, 3.03125, 3.09375, + (562): 3.15625, 3.21875, 3.28125, 3.34375, 3.40625, 3.46875, + (568): 3.53125, 3.59375, 3.65625, 3.71875, 3.78125, 3.84375, + (574): 3.90625, 3.96875, 4.03125, 4.09375, 4.15625, 4.21875, + (580): 4.28125, 4.34375, 4.40625, 4.46875, 4.53125, 4.59375, + (586): 4.65625, 4.71875, 4.78125, 4.84375, 4.90625, 4.96875, + (592): 5.03125, 5.09375, 5.15625, 5.21875, 5.28125, 5.34375, + (598): 5.40625, 5.46875, 5.53125, 5.59375, 5.65625, 5.71875, + (604): 5.78125, 5.84375, 5.90625, 5.96875, 6.03125, 6.09375, + (610): 6.15625, 6.21875, 6.28125, 6.34375, 6.40625, 6.46875, + (616): 6.53125, 6.59375, 6.65625, 6.71875, 6.78125, 6.84375, + (622): 6.90625, 6.96875, 7.03125, 7.09375, 7.15625, 7.21875, + (628): 7.28125, 7.34375, 7.40625, 7.46875, 7.53125, 7.59375, + (634): 7.65625, 7.71875, 7.78125, 7.84375, 7.90625, 7.96875, 123, + (641): 0.101563, 0.164063, 0.226563, 0.289063, 0.351563, 0.414063, + (647): 0.476563, 0.539063, 0.601563, 0.664063, 0.726563, 0.789063, + (653): 0.851563, 0.914063, 0.976563, 1.03906, 1.10156, 1.16406, + (659): 1.22656, 1.28906, 1.35156, 1.41406, 1.47656, 1.53906, + (665): 1.60156, 1.66406, 1.72656, 1.78906, 1.85156, 1.91406, + (671): 1.97656, 2.03906, 2.10156, 2.16406, 2.22656, 2.28906, + (677): 2.35156, 2.41406, 2.47656, 2.53906, 2.60156, 2.66406, + (683): 2.72656, 2.78906, 2.85156, 2.91406, 2.97656, 3.03906, + (689): 3.10156, 3.16406, 3.22656, 3.28906, 3.35156, 3.41406, + (695): 3.47656, 3.53906, 3.60156, 3.66406, 3.72656, 3.78906, + (701): 3.85156, 3.91406, 3.97656, 4.03906, 4.10156, 4.16406, + (707): 4.22656, 4.28906, 4.35156, 4.41406, 4.47656, 4.53906, + (713): 4.60156, 4.66406, 4.72656, 4.78906, 4.85156, 4.91406, + (719): 4.97656, 5.03906, 5.10156, 5.16406, 5.22656, 5.28906, + (725): 5.35156, 5.41406, 5.47656, 5.53906, 5.60156, 5.66406, + (731): 5.72656, 5.78906, 5.85156, 5.91406, 5.97656, 6.03906, + (737): 6.10156, 6.16406, 6.22656, 6.28906, 6.35156, 6.41406, + (743): 6.47656, 6.53906, 6.60156, 6.66406, 6.72656, 6.78906, + (749): 6.85156, 6.91406, 6.97656, 7.03906, 7.10156, 7.16406, + (755): 7.22656, 7.28906, 7.35156, 7.41406, 7.47656, 7.53906, + (761): 7.60156, 7.66406, 7.72656, 7.78906, 7.85156, 7.91406, + (767): 7.97656, 122, 0.109375, 0.171875, 0.234375, 0.296875, + (773): 0.359375, 0.421875, 0.484375, 0.546875, 0.609375, 0.671875, + (779): 0.734375, 0.796875, 0.859375, 0.921875, 0.984375, 1.04688, + (785): 1.10938, 1.17188, 1.23438, 1.29688, 1.35938, 1.42188, + (791): 1.48438, 1.54688, 1.60938, 1.67188, 1.73438, 1.79688, + (797): 1.85938, 1.92188, 1.98438, 2.04688, 2.10938, 2.17188, + (803): 2.23438, 2.29688, 2.35938, 2.42188, 2.48438, 2.54688, + (809): 2.60938, 2.67188, 2.73438, 2.79688, 2.85938, 2.92188, + (815): 2.98438, 3.04688, 3.10938, 3.17188, 3.23438, 3.29688, + (821): 3.35938, 3.42188, 3.48438, 3.54688, 3.60938, 3.67188, + (827): 3.73438, 3.79688, 3.85938, 3.92188, 3.98438, 4.04688, + (833): 4.10938, 4.17188, 4.23438, 4.29688, 4.35938, 4.42188, + (839): 4.48438, 4.54688, 4.60938, 4.67188, 4.73438, 4.79688, + (845): 4.85938, 4.92188, 4.98438, 5.04688, 5.10938, 5.17188, + (851): 5.23438, 5.29688, 5.35938, 5.42188, 5.48438, 5.54688, + (857): 5.60938, 5.67188, 5.73438, 5.79688, 5.85938, 5.92188, + (863): 5.98438, 6.04688, 6.10938, 6.17188, 6.23438, 6.29688, + (869): 6.35938, 6.42188, 6.48438, 6.54688, 6.60938, 6.67188, + (875): 6.73438, 6.79688, 6.85938, 6.92188, 6.98438, 7.04688, + (881): 7.10938, 7.17188, 7.23438, 7.29688, 7.35938, 7.42188, + (887): 7.48438, 7.54688, 7.60938, 7.67188, 7.73438, 7.79688, + (893): 7.85938, 7.92188, 7.98438, 121, 0.117188, 0.179688, 0.242188, + (900): 0.304688, 0.367188, 0.429688, 0.492188, 0.554688, 0.617188, + (906): 0.679688, 0.742188, 0.804688, 0.867188, 0.929688, 0.992188, + (912): 1.05469, 1.11719, 1.17969, 1.24219, 1.30469, 1.36719, + (918): 1.42969, 1.49219, 1.55469, 1.61719, 1.67969, 1.74219, + (924): 1.80469, 1.86719, 1.92969, 1.99219, 2.05469, 2.11719, + (930): 2.17969, 2.24219, 2.30469, 2.36719, 2.42969, 2.49219, + (936): 2.55469, 2.61719, 2.67969, 2.74219, 2.80469, 2.86719, + (942): 2.92969, 2.99219, 3.05469, 3.11719, 3.17969, 3.24219, + (948): 3.30469, 3.36719, 3.42969, 3.49219, 3.55469, 3.61719, + (954): 3.67969, 3.74219, 3.80469, 3.86719, 3.92969, 3.99219, + (960): 4.05469, 4.11719, 4.17969, 4.24219, 4.30469, 4.36719, + (966): 4.42969, 4.49219, 4.55469, 4.61719, 4.67969, 4.74219, + (972): 4.80469, 4.86719, 4.92969, 4.99219, 5.05469, 5.11719, + (978): 5.17969, 5.24219, 5.30469, 5.36719, 5.42969, 5.49219, + (984): 5.55469, 5.61719, 5.67969, 5.74219, 5.80469, 5.86719, + (990): 5.92969, 5.99219, 6.05469, 6.11719, 6.17969, 6.24219, + (996): 6.30469, 6.36719, 6.42969, 6.49219, 6.55469, 6.61719, + (1002): 6.67969, 6.74219, 6.80469, 6.86719, 6.92969, 6.99219, + (1008): 7.05469, 7.11719, 7.17969, 7.24219, 7.30469, 7.36719, + (1014): 7.42969, 7.49219, 7.55469, 7.61719, 7.67969, 7.74219, + (1020): 7.80469, 7.86719, 7.92969, 7.99219 + } + } + } + DATASET "DS32BITS" { + DATATYPE H5T_IEEE_F32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 1024 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0): 32, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, + (0,13): 3.25, 3.5, 3.75, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6, + (0,25): 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75, + (1,0): 31, 0.28125, 0.53125, 0.78125, 1.03125, 1.28125, 1.53125, + (1,7): 1.78125, 2.03125, 2.28125, 2.53125, 2.78125, 3.03125, 3.28125, + (1,14): 3.53125, 3.78125, 4.03125, 4.28125, 4.53125, 4.78125, 5.03125, + (1,21): 5.28125, 5.53125, 5.78125, 6.03125, 6.28125, 6.53125, 6.78125, + (1,28): 7.03125, 7.28125, 7.53125, 7.78125, + (2,0): 30, 0.3125, 0.5625, 0.8125, 1.0625, 1.3125, 1.5625, 1.8125, + (2,8): 2.0625, 2.3125, 2.5625, 2.8125, 3.0625, 3.3125, 3.5625, 3.8125, + (2,16): 4.0625, 4.3125, 4.5625, 4.8125, 5.0625, 5.3125, 5.5625, 5.8125, + (2,24): 6.0625, 6.3125, 6.5625, 6.8125, 7.0625, 7.3125, 7.5625, 7.8125, + (3,0): 29, 0.34375, 0.59375, 0.84375, 1.09375, 1.34375, 1.59375, + (3,7): 1.84375, 2.09375, 2.34375, 2.59375, 2.84375, 3.09375, 3.34375, + (3,14): 3.59375, 3.84375, 4.09375, 4.34375, 4.59375, 4.84375, 5.09375, + (3,21): 5.34375, 5.59375, 5.84375, 6.09375, 6.34375, 6.59375, 6.84375, + (3,28): 7.09375, 7.34375, 7.59375, 7.84375, + (4,0): 28, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875, 2.125, + (4,9): 2.375, 2.625, 2.875, 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, + (4,18): 4.625, 4.875, 5.125, 5.375, 5.625, 5.875, 6.125, 6.375, 6.625, + (4,27): 6.875, 7.125, 7.375, 7.625, 7.875, + (5,0): 27, 0.40625, 0.65625, 0.90625, 1.15625, 1.40625, 1.65625, + (5,7): 1.90625, 2.15625, 2.40625, 2.65625, 2.90625, 3.15625, 3.40625, + (5,14): 3.65625, 3.90625, 4.15625, 4.40625, 4.65625, 4.90625, 5.15625, + (5,21): 5.40625, 5.65625, 5.90625, 6.15625, 6.40625, 6.65625, 6.90625, + (5,28): 7.15625, 7.40625, 7.65625, 7.90625, + (6,0): 26, 0.4375, 0.6875, 0.9375, 1.1875, 1.4375, 1.6875, 1.9375, + (6,8): 2.1875, 2.4375, 2.6875, 2.9375, 3.1875, 3.4375, 3.6875, 3.9375, + (6,16): 4.1875, 4.4375, 4.6875, 4.9375, 5.1875, 5.4375, 5.6875, 5.9375, + (6,24): 6.1875, 6.4375, 6.6875, 6.9375, 7.1875, 7.4375, 7.6875, 7.9375, + (7,0): 25, 0.46875, 0.71875, 0.96875, 1.21875, 1.46875, 1.71875, + (7,7): 1.96875, 2.21875, 2.46875, 2.71875, 2.96875, 3.21875, 3.46875, + (7,14): 3.71875, 3.96875, 4.21875, 4.46875, 4.71875, 4.96875, 5.21875, + (7,21): 5.46875, 5.71875, 5.96875, 6.21875, 6.46875, 6.71875, 6.96875, + (7,28): 7.21875, 7.46875, 7.71875, 7.96875 + } + ATTRIBUTE "DS32BITS" { + DATATYPE H5T_IEEE_F32LE + DATASPACE SIMPLE { ( 256 ) / ( 256 ) } + DATA { + (0): 32, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, + (13): 3.25, 3.5, 3.75, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6, + (25): 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75, 31, 0.28125, 0.53125, + (35): 0.78125, 1.03125, 1.28125, 1.53125, 1.78125, 2.03125, 2.28125, + (42): 2.53125, 2.78125, 3.03125, 3.28125, 3.53125, 3.78125, 4.03125, + (49): 4.28125, 4.53125, 4.78125, 5.03125, 5.28125, 5.53125, 5.78125, + (56): 6.03125, 6.28125, 6.53125, 6.78125, 7.03125, 7.28125, 7.53125, + (63): 7.78125, 30, 0.3125, 0.5625, 0.8125, 1.0625, 1.3125, 1.5625, + (71): 1.8125, 2.0625, 2.3125, 2.5625, 2.8125, 3.0625, 3.3125, + (78): 3.5625, 3.8125, 4.0625, 4.3125, 4.5625, 4.8125, 5.0625, + (85): 5.3125, 5.5625, 5.8125, 6.0625, 6.3125, 6.5625, 6.8125, + (92): 7.0625, 7.3125, 7.5625, 7.8125, 29, 0.34375, 0.59375, 0.84375, + (100): 1.09375, 1.34375, 1.59375, 1.84375, 2.09375, 2.34375, + (106): 2.59375, 2.84375, 3.09375, 3.34375, 3.59375, 3.84375, + (112): 4.09375, 4.34375, 4.59375, 4.84375, 5.09375, 5.34375, + (118): 5.59375, 5.84375, 6.09375, 6.34375, 6.59375, 6.84375, + (124): 7.09375, 7.34375, 7.59375, 7.84375, 28, 0.375, 0.625, 0.875, + (132): 1.125, 1.375, 1.625, 1.875, 2.125, 2.375, 2.625, 2.875, + (140): 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, 4.625, 4.875, + (148): 5.125, 5.375, 5.625, 5.875, 6.125, 6.375, 6.625, 6.875, + (156): 7.125, 7.375, 7.625, 7.875, 27, 0.40625, 0.65625, 0.90625, + (164): 1.15625, 1.40625, 1.65625, 1.90625, 2.15625, 2.40625, + (170): 2.65625, 2.90625, 3.15625, 3.40625, 3.65625, 3.90625, + (176): 4.15625, 4.40625, 4.65625, 4.90625, 5.15625, 5.40625, + (182): 5.65625, 5.90625, 6.15625, 6.40625, 6.65625, 6.90625, + (188): 7.15625, 7.40625, 7.65625, 7.90625, 26, 0.4375, 0.6875, + (195): 0.9375, 1.1875, 1.4375, 1.6875, 1.9375, 2.1875, 2.4375, + (202): 2.6875, 2.9375, 3.1875, 3.4375, 3.6875, 3.9375, 4.1875, + (209): 4.4375, 4.6875, 4.9375, 5.1875, 5.4375, 5.6875, 5.9375, + (216): 6.1875, 6.4375, 6.6875, 6.9375, 7.1875, 7.4375, 7.6875, + (223): 7.9375, 25, 0.46875, 0.71875, 0.96875, 1.21875, 1.46875, + (230): 1.71875, 1.96875, 2.21875, 2.46875, 2.71875, 2.96875, + (236): 3.21875, 3.46875, 3.71875, 3.96875, 4.21875, 4.46875, + (242): 4.71875, 4.96875, 5.21875, 5.46875, 5.71875, 5.96875, + (248): 6.21875, 6.46875, 6.71875, 6.96875, 7.21875, 7.46875, + (254): 7.71875, 7.96875 + } + } + } + DATASET "DS64BITS" { + DATATYPE H5T_IEEE_F64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 4096 + OFFSET 6144 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0): 64, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, 1.25, + (0,11): 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, 2.5, + (0,21): 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, 3.75, + (0,31): 3.875, 4, 4.125, 4.25, 4.375, 4.5, 4.625, 4.75, 4.875, 5, + (0,41): 5.125, 5.25, 5.375, 5.5, 5.625, 5.75, 5.875, 6, 6.125, 6.25, + (0,51): 6.375, 6.5, 6.625, 6.75, 6.875, 7, 7.125, 7.25, 7.375, 7.5, + (0,61): 7.625, 7.75, 7.875, + (1,0): 63, 0.140625, 0.265625, 0.390625, 0.515625, 0.640625, 0.765625, + (1,7): 0.890625, 1.01563, 1.14063, 1.26563, 1.39063, 1.51563, 1.64063, + (1,14): 1.76563, 1.89063, 2.01563, 2.14063, 2.26563, 2.39063, 2.51563, + (1,21): 2.64063, 2.76563, 2.89063, 3.01563, 3.14063, 3.26563, 3.39063, + (1,28): 3.51563, 3.64063, 3.76563, 3.89063, 4.01563, 4.14063, 4.26563, + (1,35): 4.39063, 4.51563, 4.64063, 4.76563, 4.89063, 5.01563, 5.14063, + (1,42): 5.26563, 5.39063, 5.51563, 5.64063, 5.76563, 5.89063, 6.01563, + (1,49): 6.14063, 6.26563, 6.39063, 6.51563, 6.64063, 6.76563, 6.89063, + (1,56): 7.01563, 7.14063, 7.26563, 7.39063, 7.51563, 7.64063, 7.76563, + (1,63): 7.89063, + (2,0): 62, 0.15625, 0.28125, 0.40625, 0.53125, 0.65625, 0.78125, + (2,7): 0.90625, 1.03125, 1.15625, 1.28125, 1.40625, 1.53125, 1.65625, + (2,14): 1.78125, 1.90625, 2.03125, 2.15625, 2.28125, 2.40625, 2.53125, + (2,21): 2.65625, 2.78125, 2.90625, 3.03125, 3.15625, 3.28125, 3.40625, + (2,28): 3.53125, 3.65625, 3.78125, 3.90625, 4.03125, 4.15625, 4.28125, + (2,35): 4.40625, 4.53125, 4.65625, 4.78125, 4.90625, 5.03125, 5.15625, + (2,42): 5.28125, 5.40625, 5.53125, 5.65625, 5.78125, 5.90625, 6.03125, + (2,49): 6.15625, 6.28125, 6.40625, 6.53125, 6.65625, 6.78125, 6.90625, + (2,56): 7.03125, 7.15625, 7.28125, 7.40625, 7.53125, 7.65625, 7.78125, + (2,63): 7.90625, + (3,0): 61, 0.171875, 0.296875, 0.421875, 0.546875, 0.671875, 0.796875, + (3,7): 0.921875, 1.04688, 1.17188, 1.29688, 1.42188, 1.54688, 1.67188, + (3,14): 1.79688, 1.92188, 2.04688, 2.17188, 2.29688, 2.42188, 2.54688, + (3,21): 2.67188, 2.79688, 2.92188, 3.04688, 3.17188, 3.29688, 3.42188, + (3,28): 3.54688, 3.67188, 3.79688, 3.92188, 4.04688, 4.17188, 4.29688, + (3,35): 4.42188, 4.54688, 4.67188, 4.79688, 4.92188, 5.04688, 5.17188, + (3,42): 5.29688, 5.42188, 5.54688, 5.67188, 5.79688, 5.92188, 6.04688, + (3,49): 6.17188, 6.29688, 6.42188, 6.54688, 6.67188, 6.79688, 6.92188, + (3,56): 7.04688, 7.17188, 7.29688, 7.42188, 7.54688, 7.67188, 7.79688, + (3,63): 7.92188, + (4,0): 60, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875, 0.8125, 0.9375, + (4,8): 1.0625, 1.1875, 1.3125, 1.4375, 1.5625, 1.6875, 1.8125, 1.9375, + (4,16): 2.0625, 2.1875, 2.3125, 2.4375, 2.5625, 2.6875, 2.8125, 2.9375, + (4,24): 3.0625, 3.1875, 3.3125, 3.4375, 3.5625, 3.6875, 3.8125, 3.9375, + (4,32): 4.0625, 4.1875, 4.3125, 4.4375, 4.5625, 4.6875, 4.8125, 4.9375, + (4,40): 5.0625, 5.1875, 5.3125, 5.4375, 5.5625, 5.6875, 5.8125, 5.9375, + (4,48): 6.0625, 6.1875, 6.3125, 6.4375, 6.5625, 6.6875, 6.8125, 6.9375, + (4,56): 7.0625, 7.1875, 7.3125, 7.4375, 7.5625, 7.6875, 7.8125, 7.9375, + (5,0): 59, 0.203125, 0.328125, 0.453125, 0.578125, 0.703125, 0.828125, + (5,7): 0.953125, 1.07813, 1.20313, 1.32813, 1.45313, 1.57813, 1.70313, + (5,14): 1.82813, 1.95313, 2.07813, 2.20313, 2.32813, 2.45313, 2.57813, + (5,21): 2.70313, 2.82813, 2.95313, 3.07813, 3.20313, 3.32813, 3.45313, + (5,28): 3.57813, 3.70313, 3.82813, 3.95313, 4.07813, 4.20313, 4.32813, + (5,35): 4.45313, 4.57813, 4.70313, 4.82813, 4.95313, 5.07813, 5.20313, + (5,42): 5.32813, 5.45313, 5.57813, 5.70313, 5.82813, 5.95313, 6.07813, + (5,49): 6.20313, 6.32813, 6.45313, 6.57813, 6.70313, 6.82813, 6.95313, + (5,56): 7.07813, 7.20313, 7.32813, 7.45313, 7.57813, 7.70313, 7.82813, + (5,63): 7.95313, + (6,0): 58, 0.21875, 0.34375, 0.46875, 0.59375, 0.71875, 0.84375, + (6,7): 0.96875, 1.09375, 1.21875, 1.34375, 1.46875, 1.59375, 1.71875, + (6,14): 1.84375, 1.96875, 2.09375, 2.21875, 2.34375, 2.46875, 2.59375, + (6,21): 2.71875, 2.84375, 2.96875, 3.09375, 3.21875, 3.34375, 3.46875, + (6,28): 3.59375, 3.71875, 3.84375, 3.96875, 4.09375, 4.21875, 4.34375, + (6,35): 4.46875, 4.59375, 4.71875, 4.84375, 4.96875, 5.09375, 5.21875, + (6,42): 5.34375, 5.46875, 5.59375, 5.71875, 5.84375, 5.96875, 6.09375, + (6,49): 6.21875, 6.34375, 6.46875, 6.59375, 6.71875, 6.84375, 6.96875, + (6,56): 7.09375, 7.21875, 7.34375, 7.46875, 7.59375, 7.71875, 7.84375, + (6,63): 7.96875, + (7,0): 57, 0.234375, 0.359375, 0.484375, 0.609375, 0.734375, 0.859375, + (7,7): 0.984375, 1.10938, 1.23438, 1.35938, 1.48438, 1.60938, 1.73438, + (7,14): 1.85938, 1.98438, 2.10938, 2.23438, 2.35938, 2.48438, 2.60938, + (7,21): 2.73438, 2.85938, 2.98438, 3.10938, 3.23438, 3.35938, 3.48438, + (7,28): 3.60938, 3.73438, 3.85938, 3.98438, 4.10938, 4.23438, 4.35938, + (7,35): 4.48438, 4.60938, 4.73438, 4.85938, 4.98438, 5.10938, 5.23438, + (7,42): 5.35938, 5.48438, 5.60938, 5.73438, 5.85938, 5.98438, 6.10938, + (7,49): 6.23438, 6.35938, 6.48438, 6.60938, 6.73438, 6.85938, 6.98438, + (7,56): 7.10938, 7.23438, 7.35938, 7.48438, 7.60938, 7.73438, 7.85938, + (7,63): 7.98438 + } + ATTRIBUTE "DS64BITS" { + DATATYPE H5T_IEEE_F64LE + DATASPACE SIMPLE { ( 512 ) / ( 512 ) } + DATA { + (0): 64, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, + (10): 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, + (20): 2.5, 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, + (30): 3.75, 3.875, 4, 4.125, 4.25, 4.375, 4.5, 4.625, 4.75, 4.875, + (40): 5, 5.125, 5.25, 5.375, 5.5, 5.625, 5.75, 5.875, 6, 6.125, + (50): 6.25, 6.375, 6.5, 6.625, 6.75, 6.875, 7, 7.125, 7.25, 7.375, + (60): 7.5, 7.625, 7.75, 7.875, 63, 0.140625, 0.265625, 0.390625, + (68): 0.515625, 0.640625, 0.765625, 0.890625, 1.01563, 1.14063, + (74): 1.26563, 1.39063, 1.51563, 1.64063, 1.76563, 1.89063, 2.01563, + (81): 2.14063, 2.26563, 2.39063, 2.51563, 2.64063, 2.76563, 2.89063, + (88): 3.01563, 3.14063, 3.26563, 3.39063, 3.51563, 3.64063, 3.76563, + (95): 3.89063, 4.01563, 4.14063, 4.26563, 4.39063, 4.51563, 4.64063, + (102): 4.76563, 4.89063, 5.01563, 5.14063, 5.26563, 5.39063, + (108): 5.51563, 5.64063, 5.76563, 5.89063, 6.01563, 6.14063, + (114): 6.26563, 6.39063, 6.51563, 6.64063, 6.76563, 6.89063, + (120): 7.01563, 7.14063, 7.26563, 7.39063, 7.51563, 7.64063, + (126): 7.76563, 7.89063, 62, 0.15625, 0.28125, 0.40625, 0.53125, + (133): 0.65625, 0.78125, 0.90625, 1.03125, 1.15625, 1.28125, + (139): 1.40625, 1.53125, 1.65625, 1.78125, 1.90625, 2.03125, + (145): 2.15625, 2.28125, 2.40625, 2.53125, 2.65625, 2.78125, + (151): 2.90625, 3.03125, 3.15625, 3.28125, 3.40625, 3.53125, + (157): 3.65625, 3.78125, 3.90625, 4.03125, 4.15625, 4.28125, + (163): 4.40625, 4.53125, 4.65625, 4.78125, 4.90625, 5.03125, + (169): 5.15625, 5.28125, 5.40625, 5.53125, 5.65625, 5.78125, + (175): 5.90625, 6.03125, 6.15625, 6.28125, 6.40625, 6.53125, + (181): 6.65625, 6.78125, 6.90625, 7.03125, 7.15625, 7.28125, + (187): 7.40625, 7.53125, 7.65625, 7.78125, 7.90625, 61, 0.171875, + (194): 0.296875, 0.421875, 0.546875, 0.671875, 0.796875, 0.921875, + (200): 1.04688, 1.17188, 1.29688, 1.42188, 1.54688, 1.67188, + (206): 1.79688, 1.92188, 2.04688, 2.17188, 2.29688, 2.42188, + (212): 2.54688, 2.67188, 2.79688, 2.92188, 3.04688, 3.17188, + (218): 3.29688, 3.42188, 3.54688, 3.67188, 3.79688, 3.92188, + (224): 4.04688, 4.17188, 4.29688, 4.42188, 4.54688, 4.67188, + (230): 4.79688, 4.92188, 5.04688, 5.17188, 5.29688, 5.42188, + (236): 5.54688, 5.67188, 5.79688, 5.92188, 6.04688, 6.17188, + (242): 6.29688, 6.42188, 6.54688, 6.67188, 6.79688, 6.92188, + (248): 7.04688, 7.17188, 7.29688, 7.42188, 7.54688, 7.67188, + (254): 7.79688, 7.92188, 60, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875, + (262): 0.8125, 0.9375, 1.0625, 1.1875, 1.3125, 1.4375, 1.5625, + (269): 1.6875, 1.8125, 1.9375, 2.0625, 2.1875, 2.3125, 2.4375, + (276): 2.5625, 2.6875, 2.8125, 2.9375, 3.0625, 3.1875, 3.3125, + (283): 3.4375, 3.5625, 3.6875, 3.8125, 3.9375, 4.0625, 4.1875, + (290): 4.3125, 4.4375, 4.5625, 4.6875, 4.8125, 4.9375, 5.0625, + (297): 5.1875, 5.3125, 5.4375, 5.5625, 5.6875, 5.8125, 5.9375, + (304): 6.0625, 6.1875, 6.3125, 6.4375, 6.5625, 6.6875, 6.8125, + (311): 6.9375, 7.0625, 7.1875, 7.3125, 7.4375, 7.5625, 7.6875, + (318): 7.8125, 7.9375, 59, 0.203125, 0.328125, 0.453125, 0.578125, + (325): 0.703125, 0.828125, 0.953125, 1.07813, 1.20313, 1.32813, + (331): 1.45313, 1.57813, 1.70313, 1.82813, 1.95313, 2.07813, + (337): 2.20313, 2.32813, 2.45313, 2.57813, 2.70313, 2.82813, + (343): 2.95313, 3.07813, 3.20313, 3.32813, 3.45313, 3.57813, + (349): 3.70313, 3.82813, 3.95313, 4.07813, 4.20313, 4.32813, + (355): 4.45313, 4.57813, 4.70313, 4.82813, 4.95313, 5.07813, + (361): 5.20313, 5.32813, 5.45313, 5.57813, 5.70313, 5.82813, + (367): 5.95313, 6.07813, 6.20313, 6.32813, 6.45313, 6.57813, + (373): 6.70313, 6.82813, 6.95313, 7.07813, 7.20313, 7.32813, + (379): 7.45313, 7.57813, 7.70313, 7.82813, 7.95313, 58, 0.21875, + (386): 0.34375, 0.46875, 0.59375, 0.71875, 0.84375, 0.96875, + (392): 1.09375, 1.21875, 1.34375, 1.46875, 1.59375, 1.71875, + (398): 1.84375, 1.96875, 2.09375, 2.21875, 2.34375, 2.46875, + (404): 2.59375, 2.71875, 2.84375, 2.96875, 3.09375, 3.21875, + (410): 3.34375, 3.46875, 3.59375, 3.71875, 3.84375, 3.96875, + (416): 4.09375, 4.21875, 4.34375, 4.46875, 4.59375, 4.71875, + (422): 4.84375, 4.96875, 5.09375, 5.21875, 5.34375, 5.46875, + (428): 5.59375, 5.71875, 5.84375, 5.96875, 6.09375, 6.21875, + (434): 6.34375, 6.46875, 6.59375, 6.71875, 6.84375, 6.96875, + (440): 7.09375, 7.21875, 7.34375, 7.46875, 7.59375, 7.71875, + (446): 7.84375, 7.96875, 57, 0.234375, 0.359375, 0.484375, 0.609375, + (453): 0.734375, 0.859375, 0.984375, 1.10938, 1.23438, 1.35938, + (459): 1.48438, 1.60938, 1.73438, 1.85938, 1.98438, 2.10938, + (465): 2.23438, 2.35938, 2.48438, 2.60938, 2.73438, 2.85938, + (471): 2.98438, 3.10938, 3.23438, 3.35938, 3.48438, 3.60938, + (477): 3.73438, 3.85938, 3.98438, 4.10938, 4.23438, 4.35938, + (483): 4.48438, 4.60938, 4.73438, 4.85938, 4.98438, 5.10938, + (489): 5.23438, 5.35938, 5.48438, 5.60938, 5.73438, 5.85938, + (495): 5.98438, 6.10938, 6.23438, 6.35938, 6.48438, 6.60938, + (501): 6.73438, 6.85938, 6.98438, 7.10938, 7.23438, 7.35938, + (507): 7.48438, 7.60938, 7.73438, 7.85938, 7.98438 + } + } + } +} +} diff --git a/tools/testfiles/tldouble.ddl b/tools/testfiles/tldouble.ddl index c032ef3..2fed523 100644 --- a/tools/testfiles/tldouble.ddl +++ b/tools/testfiles/tldouble.ddl @@ -1,7 +1,7 @@ HDF5 "tldouble.h5" { GROUP "/" { DATASET "dset" { - DATATYPE H5T_NATIVE_LDOUBLE + DATATYPE 128-bit little-endian floating-point 80-bit precision DATASPACE SIMPLE { ( 3 ) / ( 3 ) } DATA { (0): 1, 2, 3 diff --git a/tools/testfiles/tldouble.wddl b/tools/testfiles/tldouble.wddl deleted file mode 100644 index 4793b4d..0000000 --- a/tools/testfiles/tldouble.wddl +++ /dev/null @@ -1,11 +0,0 @@ -HDF5 "tldouble.h5" { -GROUP "/" { - DATASET "dset" { - DATATYPE 128-bit little-endian floating-point - DATASPACE SIMPLE { ( 3 ) / ( 3 ) } - DATA { - (0): 1, 2, 3 - } - } -} -} diff --git a/tools/testfiles/tldouble_scalar.ddl b/tools/testfiles/tldouble_scalar.ddl index 45f0b45..596d8db 100755 --- a/tools/testfiles/tldouble_scalar.ddl +++ b/tools/testfiles/tldouble_scalar.ddl @@ -1,7 +1,7 @@ HDF5 "tldouble_scalar.h5" { GROUP "/" { DATASET "dset" { - DATATYPE H5T_ARRAY { [6] H5T_NATIVE_LDOUBLE } + DATATYPE H5T_ARRAY { [6] 128-bit little-endian floating-point 80-bit precision } DATASPACE SCALAR STORAGE_LAYOUT { CONTIGUOUS diff --git a/tools/testfiles/tldouble_scalar.wddl b/tools/testfiles/tldouble_scalar.wddl deleted file mode 100755 index 0c17c31..0000000 --- a/tools/testfiles/tldouble_scalar.wddl +++ /dev/null @@ -1,26 +0,0 @@ -HDF5 "tldouble_scalar.h5" { -GROUP "/" { - DATASET "dset" { - DATATYPE H5T_ARRAY { [6] 128-bit little-endian floating-point } - DATASPACE SCALAR - STORAGE_LAYOUT { - CONTIGUOUS - SIZE 96 - OFFSET 2048 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_LATE - } - DATA { - (0): [ 0, 1, 2, 3, 4, 5 ] - } - } -} -} diff --git a/tools/testfiles/tnbit.ddl b/tools/testfiles/tnbit.ddl index fd5d1cf..cf2ac1f 100644 --- a/tools/testfiles/tnbit.ddl +++ b/tools/testfiles/tnbit.ddl @@ -1,6 +1,6 @@ HDF5 "tfilters.h5" { DATASET "nbit" { - DATATYPE 32-bit little-endian integer + DATATYPE 32-bit little-endian integer 3-bit precision DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) diff --git a/tools/testfiles/treadintfilter.ddl b/tools/testfiles/treadintfilter.ddl index a2269a6b..fbad3f6 100644 --- a/tools/testfiles/treadintfilter.ddl +++ b/tools/testfiles/treadintfilter.ddl @@ -78,7 +78,7 @@ DATASET "fletcher32" { } } DATASET "nbit" { - DATATYPE 32-bit little-endian integer + DATATYPE 32-bit little-endian integer 3-bit precision DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } DATA { (0,0): 0, 1, 2, 3, -4, -3, -2, -1, 0, 1, -- cgit v0.12 From d5c449248f74886529b9fad09473dd73d60a34fd Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 16 Apr 2021 11:47:32 -0700 Subject: Brings the native implementation of H5Fdelete() from Bitbucket (#524) * Committing clang-format changes * Brings the native VFD H5Fdelete() implementation from Bitbucket Only brings the 'del' callbacks, not the 'open/close' scheme. * Formatter changes * Committing clang-format changes * Fixes direct VFD callback name * Removes UNUSED macro from family API call * Adds barrier and rank 0 check to MPI-I/O VFD delete * Revert "Adds barrier and rank 0 check to MPI-I/O VFD delete" This reverts commit 909765f759d9d96e84f4b8b1cc14f7d2b3ac8143. * Revert "Revert "Adds barrier and rank 0 check to MPI-I/O VFD delete"" This reverts commit 9b04bef1157853fc79fcb8fcc3e8ba1371091702. * Adds a second barrier after the delete in MPI-I/O VFD * Only delete files in the core VFD when the backing store flag is set * Fixes string issues in multi VFD Also, h5test.c cleanup code now uses H5Fdelete(). * Formatted source * Rework fapl checks for MPI-I/O VFD delete callback Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5FD.c | 34 +++++++++++ src/H5FDcore.c | 35 +++++++++++ src/H5FDdirect.c | 27 +++++++++ src/H5FDfamily.c | 147 +++++++++++++++++++++++++++++++++++++--------- src/H5FDhdfs.c | 1 + src/H5FDint.c | 44 ++++++++++++++ src/H5FDlog.c | 91 ++++++++++++++++++---------- src/H5FDmirror.c | 1 + src/H5FDmpio.c | 126 ++++++++++++++++++++++++++++----------- src/H5FDmulti.c | 130 +++++++++++++++++++++++++++------------- src/H5FDprivate.h | 1 + src/H5FDpublic.h | 2 + src/H5FDros3.c | 1 + src/H5FDsec2.c | 27 +++++++++ src/H5FDsplitter.c | 1 + src/H5FDstdio.c | 30 ++++++++++ src/H5Fint.c | 25 ++++++++ src/H5Fprivate.h | 1 + src/H5VLnative_file.c | 9 ++- test/cache_logging.c | 16 +++-- test/h5test.c | 54 ++--------------- test/tfile.c | 21 +++---- test/vfd.c | 34 ++++++++++- testpar/t_file.c | 55 +++++++++++++++++ testpar/testphdf5.c | 2 + testpar/testphdf5.h | 1 + tools/src/misc/h5delete.c | 7 --- 27 files changed, 715 insertions(+), 208 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index efb8fbb..abda921 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -1886,3 +1886,37 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/) done: FUNC_LEAVE_API(ret_value) } /* end H5FDdriver_query() */ + +/*------------------------------------------------------------------------- + * Function: H5FDdelete + * + * Purpose: Deletes a file + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDdelete(const char *filename, hid_t fapl_id) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "*si", filename, fapl_id); + + /* Check arguments */ + if (!filename || !*filename) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified") + + if (H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + /* Call private function */ + if (H5FD_delete(filename, fapl_id) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDdelete() */ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 2e1a6d8..50288c4 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -148,6 +148,7 @@ static herr_t H5FD__core_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__core_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__core_unlock(H5FD_t *_file); +static herr_t H5FD__core_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_core_g = { "core", /* name */ @@ -181,6 +182,7 @@ static const H5FD_class_t H5FD_core_g = { H5FD__core_truncate, /* truncate */ H5FD__core_lock, /* lock */ H5FD__core_unlock, /* unlock */ + H5FD__core_delete, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1708,3 +1710,36 @@ H5FD__core_unlock(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__core_unlock() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__core_delete + * + * Purpose: Delete a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__core_delete(const char *filename, hid_t fapl_id) +{ + const H5FD_core_fapl_t *fa = NULL; + H5P_genplist_t * plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(filename); + + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + + if (fa->backing_store) + if (HDremove(filename) < 0) + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__core_delete() */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 35da1f1..a1b7b7e 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -137,6 +137,7 @@ static herr_t H5FD__direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, static herr_t H5FD__direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__direct_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__direct_unlock(H5FD_t *_file); +static herr_t H5FD__direct_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_direct_g = { "direct", /* name */ @@ -170,6 +171,7 @@ static const H5FD_class_t H5FD_direct_g = { H5FD__direct_truncate, /* truncate */ H5FD__direct_lock, /* lock */ H5FD__direct_unlock, /* unlock */ + H5FD__direct_delete, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1380,4 +1382,29 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__direct_unlock() */ +/*------------------------------------------------------------------------- + * Function: H5FD__direct_delete + * + * Purpose: Delete a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__direct_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(filename); + + if (HDremove(filename) < 0) + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__direct_delete() */ + #endif /* H5_HAVE_DIRECT */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 59a6dfa..b265e1d 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -101,40 +101,42 @@ static herr_t H5FD__family_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) static herr_t H5FD__family_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__family_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__family_unlock(H5FD_t *_file); +static herr_t H5FD__family_delete(const char *filename, hid_t fapl_id); /* The class struct */ static const H5FD_class_t H5FD_family_g = { - "family", /* name */ - HADDR_MAX, /* maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ + "family", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ H5FD__family_term, /* terminate */ - H5FD__family_sb_size, /* sb_size */ - H5FD__family_sb_encode, /* sb_encode */ - H5FD__family_sb_decode, /* sb_decode */ - sizeof(H5FD_family_fapl_t), /* fapl_size */ - H5FD__family_fapl_get, /* fapl_get */ - H5FD__family_fapl_copy, /* fapl_copy */ - H5FD__family_fapl_free, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - H5FD__family_open, /* open */ - H5FD__family_close, /* close */ - H5FD__family_cmp, /* cmp */ - H5FD__family_query, /* query */ - NULL, /* get_type_map */ - NULL, /* alloc */ - NULL, /* free */ - H5FD__family_get_eoa, /* get_eoa */ - H5FD__family_set_eoa, /* set_eoa */ - H5FD__family_get_eof, /* get_eof */ + H5FD__family_sb_size, /* sb_size */ + H5FD__family_sb_encode, /* sb_encode */ + H5FD__family_sb_decode, /* sb_decode */ + sizeof(H5FD_family_fapl_t), /* fapl_size */ + H5FD__family_fapl_get, /* fapl_get */ + H5FD__family_fapl_copy, /* fapl_copy */ + H5FD__family_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__family_open, /* open */ + H5FD__family_close, /* close */ + H5FD__family_cmp, /* cmp */ + H5FD__family_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__family_get_eoa, /* get_eoa */ + H5FD__family_set_eoa, /* set_eoa */ + H5FD__family_get_eof, /* get_eof */ H5FD__family_get_handle, /* get_handle */ - H5FD__family_read, /* read */ - H5FD__family_write, /* write */ - H5FD__family_flush, /* flush */ - H5FD__family_truncate, /* truncate */ + H5FD__family_read, /* read */ + H5FD__family_write, /* write */ + H5FD__family_flush, /* flush */ + H5FD__family_truncate, /* truncate */ H5FD__family_lock, /* lock */ H5FD__family_unlock, /* unlock */ + H5FD__family_delete, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1343,3 +1345,94 @@ H5FD__family_unlock(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__family_unlock() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__family_delete + * + * Purpose: Delete a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__family_delete(const char *filename, hid_t fapl_id) +{ + H5P_genplist_t * plist; + const H5FD_family_fapl_t *fa; + hid_t memb_fapl_id = H5I_INVALID_HID; + unsigned current_member; + char * member_name = NULL; + char * temp = NULL; + herr_t delete_error = FAIL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(filename); + + /* Get the driver info (for the member fapl) + * The family_open call accepts H5P_DEFAULT, so we'll accept that here, too. + */ + if (H5P_FILE_ACCESS_DEFAULT == fapl_id) + memb_fapl_id = H5P_FILE_ACCESS_DEFAULT; + else { + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad family VFD driver info") + memb_fapl_id = fa->memb_fapl_id; + } + + /* Allocate space for the string buffers */ + if (NULL == (member_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate member name") + if (NULL == (temp = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate temporary member name") + + /* Sanity check to make sure that generated names are unique */ + HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 0); + HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 1); + if (!HDstrcmp(member_name, temp)) + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "provided file name cannot generate unique sub-files") + + /* Delete all the family members */ + current_member = 0; + while (1) { + /* Fix up the filename with the current member's number */ + HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, current_member); + + /* Attempt to delete the member files. If the first file throws an error + * we always consider this an error. With subsequent member files, however, + * errors usually mean that we hit the last member file so we ignore them. + * + * Note that this means that any missing files in the family will leave + * undeleted members behind. + */ + H5E_BEGIN_TRY + { + delete_error = H5FD_delete(member_name, memb_fapl_id); + } + H5E_END_TRY; + if (FAIL == delete_error) { + if (0 == current_member) + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete member file") + else + H5E_clear_stack(NULL); + break; + } + current_member++; + } /* end while */ + +done: + if (member_name) + H5MM_xfree(member_name); + if (temp) + H5MM_xfree(temp); + + /* Don't close memb_fapl_id - We didn't bump its reference count since we're + * only using it in this call. + */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__family_delete() */ diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 61c694d..5cd4a65 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -309,6 +309,7 @@ static const H5FD_class_t H5FD_hdfs_g = { H5FD__hdfs_truncate, /* truncate */ NULL, /* lock */ NULL, /* unlock */ + NULL, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDint.c b/src/H5FDint.c index 25d77d1..f13f222 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -381,3 +381,47 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/) FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_driver_query() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_delete + * + * Purpose: Private version of H5FDdelete() + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_delete(const char *filename, hid_t fapl_id) +{ + H5FD_class_t * driver; /* VFD for file */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5P_genplist_t * plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(filename); + + /* Get file access property list */ + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + /* Get the VFD to open the file with */ + if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") + + /* Get driver info */ + if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") + if (NULL == driver->del) + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no 'del' method") + + /* Dispatch to file driver */ + if ((driver->del)(filename, fapl_id)) + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "delete failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_delete() */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index b836a3d..57902b6 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -177,40 +177,42 @@ static herr_t H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, ha static herr_t H5FD__log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__log_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__log_unlock(H5FD_t *_file); +static herr_t H5FD__log_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_log_g = { - "log", /* name */ - MAXADDR, /* maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD__log_term, /* terminate */ - NULL, /* sb_size */ - NULL, /* sb_encode */ - NULL, /* sb_decode */ - sizeof(H5FD_log_fapl_t), /* fapl_size */ - H5FD__log_fapl_get, /* fapl_get */ - H5FD__log_fapl_copy, /* fapl_copy */ - H5FD__log_fapl_free, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - H5FD__log_open, /* open */ - H5FD__log_close, /* close */ - H5FD__log_cmp, /* cmp */ - H5FD__log_query, /* query */ - NULL, /* get_type_map */ - H5FD__log_alloc, /* alloc */ - H5FD__log_free, /* free */ - H5FD__log_get_eoa, /* get_eoa */ - H5FD__log_set_eoa, /* set_eoa */ - H5FD__log_get_eof, /* get_eof */ - H5FD__log_get_handle, /* get_handle */ - H5FD__log_read, /* read */ - H5FD__log_write, /* write */ - NULL, /* flush */ - H5FD__log_truncate, /* truncate */ - H5FD__log_lock, /* lock */ - H5FD__log_unlock, /* unlock */ - H5FD_FLMAP_DICHOTOMY /* fl_map */ + "log", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__log_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_log_fapl_t), /* fapl_size */ + H5FD__log_fapl_get, /* fapl_get */ + H5FD__log_fapl_copy, /* fapl_copy */ + H5FD__log_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__log_open, /* open */ + H5FD__log_close, /* close */ + H5FD__log_cmp, /* cmp */ + H5FD__log_query, /* query */ + NULL, /* get_type_map */ + H5FD__log_alloc, /* alloc */ + H5FD__log_free, /* free */ + H5FD__log_get_eoa, /* get_eoa */ + H5FD__log_set_eoa, /* set_eoa */ + H5FD__log_get_eof, /* get_eof */ + H5FD__log_get_handle, /* get_handle */ + H5FD__log_read, /* read */ + H5FD__log_write, /* write */ + NULL, /* flush */ + H5FD__log_truncate, /* truncate */ + H5FD__log_lock, /* lock */ + H5FD__log_unlock, /* unlock */ + H5FD__log_delete, /* del */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_log_t struct */ @@ -1777,3 +1779,28 @@ H5FD__log_unlock(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__log_unlock() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__log_delete + * + * Purpose: Delete a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__log_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(filename); + + if (HDremove(filename) < 0) + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__log_delete() */ diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index d3bb3a3..00b5cd0 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -191,6 +191,7 @@ static const H5FD_class_t H5FD_mirror_g = { H5FD__mirror_truncate, /* truncate */ H5FD__mirror_lock, /* lock */ H5FD__mirror_unlock, /* unlock */ + NULL, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 6f38b3b..08bd52a 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -86,6 +86,7 @@ static herr_t H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, const void *buf); static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__mpio_delete(const char *filename, hid_t fapl_id); static int H5FD__mpio_mpi_rank(const H5FD_t *_file); static int H5FD__mpio_mpi_size(const H5FD_t *_file); static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file); @@ -94,42 +95,43 @@ static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file); static const H5FD_class_mpi_t H5FD_mpio_g = { { /* Start of superclass information */ - "mpio", /*name */ - HADDR_MAX, /*maxaddr */ - H5F_CLOSE_SEMI, /*fc_degree */ - H5FD__mpio_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - 0, /*fapl_size */ - NULL, /*fapl_get */ - NULL, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD__mpio_open, /*open */ - H5FD__mpio_close, /*close */ - NULL, /*cmp */ - H5FD__mpio_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD__mpio_get_eoa, /*get_eoa */ - H5FD__mpio_set_eoa, /*set_eoa */ - H5FD__mpio_get_eof, /*get_eof */ - H5FD__mpio_get_handle, /*get_handle */ - H5FD__mpio_read, /*read */ - H5FD__mpio_write, /*write */ - H5FD__mpio_flush, /*flush */ - H5FD__mpio_truncate, /*truncate */ - NULL, /*lock */ - NULL, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + "mpio", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_SEMI, /* fc_degree */ + H5FD__mpio_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__mpio_open, /* open */ + H5FD__mpio_close, /* close */ + NULL, /* cmp */ + H5FD__mpio_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__mpio_get_eoa, /* get_eoa */ + H5FD__mpio_set_eoa, /* set_eoa */ + H5FD__mpio_get_eof, /* get_eof */ + H5FD__mpio_get_handle, /* get_handle */ + H5FD__mpio_read, /* read */ + H5FD__mpio_write, /* write */ + H5FD__mpio_flush, /* flush */ + H5FD__mpio_truncate, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD__mpio_delete, /* del */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }, /* End of superclass information */ - H5FD__mpio_mpi_rank, /*get_rank */ - H5FD__mpio_mpi_size, /*get_size */ - H5FD__mpio_communicator /*get_comm */ + H5FD__mpio_mpi_rank, /* get_rank */ + H5FD__mpio_mpi_size, /* get_size */ + H5FD__mpio_communicator /* get_comm */ }; #ifdef H5FDmpio_DEBUG @@ -1746,6 +1748,60 @@ done: } /* end H5FD__mpio_truncate() */ /*------------------------------------------------------------------------- + * Function: H5FD__mpio_delete + * + * Purpose: Delete a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__mpio_delete(const char *filename, hid_t fapl_id) +{ + H5P_genplist_t *plist; /* Property list pointer */ + MPI_Comm comm = MPI_COMM_NULL; + MPI_Info info = MPI_INFO_NULL; + int mpi_rank = INT_MAX; + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(filename); + + if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HDassert(H5FD_MPIO == H5P_peek_driver(plist)); + + /* Get the MPI communicator and info from the fapl */ + if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI info object") + if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator") + + /* Get the MPI rank of this process */ + if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank))) + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mpi_code) + + /* Set up a barrier */ + if (MPI_SUCCESS != (mpi_code = MPI_Barrier(comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) + + /* Delete the file */ + if (mpi_rank == 0) + if (MPI_SUCCESS != (mpi_code = MPI_File_delete(filename, info))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_delete failed", mpi_code) + + /* Set up a barrier (don't want processes to run ahead of the delete) */ + if (MPI_SUCCESS != (mpi_code = MPI_Barrier(comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__mpio_delete() */ + +/*------------------------------------------------------------------------- * Function: H5FD__mpio_mpi_rank * * Purpose: Returns the MPI rank for a process diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 9226624..9347eab 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -142,41 +142,43 @@ static herr_t H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_multi_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_multi_unlock(H5FD_t *_file); +static herr_t H5FD_multi_delete(const char *filename, hid_t fapl_id); /* The class struct */ static const H5FD_class_t H5FD_multi_g = { - "multi", /*name */ - HADDR_MAX, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_multi_term, /*terminate */ - H5FD_multi_sb_size, /*sb_size */ - H5FD_multi_sb_encode, /*sb_encode */ - H5FD_multi_sb_decode, /*sb_decode */ - sizeof(H5FD_multi_fapl_t), /*fapl_size */ - H5FD_multi_fapl_get, /*fapl_get */ - H5FD_multi_fapl_copy, /*fapl_copy */ - H5FD_multi_fapl_free, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_multi_open, /*open */ - H5FD_multi_close, /*close */ - H5FD_multi_cmp, /*cmp */ - H5FD_multi_query, /*query */ - H5FD_multi_get_type_map, /*get_type_map */ - H5FD_multi_alloc, /*alloc */ - H5FD_multi_free, /*free */ - H5FD_multi_get_eoa, /*get_eoa */ - H5FD_multi_set_eoa, /*set_eoa */ - H5FD_multi_get_eof, /*get_eof */ - H5FD_multi_get_handle, /*get_handle */ - H5FD_multi_read, /*read */ - H5FD_multi_write, /*write */ - H5FD_multi_flush, /*flush */ - H5FD_multi_truncate, /*truncate */ - H5FD_multi_lock, /*lock */ - H5FD_multi_unlock, /*unlock */ - H5FD_FLMAP_DEFAULT /*fl_map */ + "multi", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_multi_term, /* terminate */ + H5FD_multi_sb_size, /* sb_size */ + H5FD_multi_sb_encode, /* sb_encode */ + H5FD_multi_sb_decode, /* sb_decode */ + sizeof(H5FD_multi_fapl_t), /* fapl_size */ + H5FD_multi_fapl_get, /* fapl_get */ + H5FD_multi_fapl_copy, /* fapl_copy */ + H5FD_multi_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD_multi_open, /* open */ + H5FD_multi_close, /* close */ + H5FD_multi_cmp, /* cmp */ + H5FD_multi_query, /* query */ + H5FD_multi_get_type_map, /* get_type_map */ + H5FD_multi_alloc, /* alloc */ + H5FD_multi_free, /* free */ + H5FD_multi_get_eoa, /* get_eoa */ + H5FD_multi_set_eoa, /* set_eoa */ + H5FD_multi_get_eof, /* get_eof */ + H5FD_multi_get_handle, /* get_handle */ + H5FD_multi_read, /* read */ + H5FD_multi_write, /* write */ + H5FD_multi_flush, /* flush */ + H5FD_multi_truncate, /* truncate */ + H5FD_multi_lock, /* lock */ + H5FD_multi_unlock, /* unlock */ + H5FD_multi_delete, /* del */ + H5FD_FLMAP_DEFAULT /* fl_map */ }; /*------------------------------------------------------------------------- @@ -1950,8 +1952,8 @@ compute_next(H5FD_multi_t *file) * *------------------------------------------------------------------------- */ -/* Disable warning for "format not a string literal" here -QAK */ -/* +/* Disable warning for "format not a string literal" here + * * This pragma only needs to surround the snprintf() call with * tmp in the code below, but early (4.4.7, at least) gcc only * allows diagnostic pragmas to be toggled outside of functions. @@ -1962,7 +1964,8 @@ open_members(H5FD_multi_t *file) { char tmp[H5FD_MULT_MAX_FILE_NAME_LEN]; int nerrors = 0; - static const char *func = "(H5FD_multi)open_members"; /* Function Name for error reporting */ + int nchars; + static const char *func = "(H5FD_multi)open_members"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1971,11 +1974,11 @@ open_members(H5FD_multi_t *file) if (file->memb[mt]) continue; /*already open*/ assert(file->fa.memb_name[mt]); - /* Note: This truncates the user's filename down to only sizeof(tmp) - * characters. -QK & JK, 2013/01/17 - */ - sprintf(tmp, file->fa.memb_name[mt], file->name); - tmp[sizeof(tmp) - 1] = '\0'; + + nchars = snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name); + if (nchars < 0 || nchars >= (int)sizeof(tmp)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_BADVALUE, + "filename is too long and would be truncated", -1); H5E_BEGIN_TRY { @@ -1993,6 +1996,53 @@ open_members(H5FD_multi_t *file) return 0; } + +/*------------------------------------------------------------------------- + * Function: H5FD_multi_delete + * + * Purpose: Delete a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_multi_delete(const char *filename, hid_t fapl_id) +{ + char full_filename[H5FD_MULT_MAX_FILE_NAME_LEN]; + int nchars; + const H5FD_multi_fapl_t *fa; + static const char * func = "H5FD_multi_delete"; /* Function Name for error reporting */ + + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + assert(filename); + + /* Quiet compiler */ + (void)fapl_id; + + /* Get the driver info */ + fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); + assert(fa); + + /* Delete each member file using the underlying fapl */ + UNIQUE_MEMBERS (fa->memb_map, mt) { + assert(fa->memb_name[mt]); + assert(fa->memb_fapl[mt] >= 0); + + nchars = snprintf(full_filename, sizeof(full_filename), fa->memb_name[mt], filename); + if (nchars < 0 || nchars >= (int)sizeof(full_filename)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_BADVALUE, + "filename is too long and would be truncated", -1); + + if (H5FDdelete(full_filename, fa->memb_fapl[mt]) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_BADVALUE, "error deleting member files", -1); + } + END_MEMBERS; + + return 0; +} /* end H5FD_multi_delete() */ H5_GCC_DIAG_ON("format-nonliteral") #ifdef H5private_H diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 10d8069..6dfb7b4 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -135,6 +135,7 @@ H5_DLL herr_t H5FD_flush(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_truncate(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw); H5_DLL herr_t H5FD_unlock(H5FD_t *file); +H5_DLL herr_t H5FD_delete(const char *name, hid_t fapl_id); H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle); H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr); diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index edcea52..0fcfcf3 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -299,6 +299,7 @@ typedef struct H5FD_class_t { herr_t (*truncate)(H5FD_t *file, hid_t dxpl_id, hbool_t closing); herr_t (*lock)(H5FD_t *file, hbool_t rw); herr_t (*unlock)(H5FD_t *file); + herr_t (*del)(const char *name, hid_t fapl); H5FD_mem_t fl_map[H5FD_MEM_NTYPES]; } H5FD_class_t; @@ -377,6 +378,7 @@ H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); H5_DLL herr_t H5FDunlock(H5FD_t *file); +H5_DLL herr_t H5FDdelete(const char *name, hid_t fapl_id); /* Allows querying a VFD ID for features before the file is opened */ H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/); diff --git a/src/H5FDros3.c b/src/H5FDros3.c index ae6ac59..6e116ee 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -266,6 +266,7 @@ static const H5FD_class_t H5FD_ros3_g = { H5FD__ros3_truncate, /* truncate */ NULL, /* lock */ NULL, /* unlock */ + NULL, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 6fe1282..d823e3c 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -138,6 +138,7 @@ static herr_t H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, h static herr_t H5FD__sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__sec2_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__sec2_unlock(H5FD_t *_file); +static herr_t H5FD__sec2_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_sec2_g = { "sec2", /* name */ @@ -171,6 +172,7 @@ static const H5FD_class_t H5FD_sec2_g = { H5FD__sec2_truncate, /* truncate */ H5FD__sec2_lock, /* lock */ H5FD__sec2_unlock, /* unlock */ + H5FD__sec2_delete, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1041,3 +1043,28 @@ H5FD__sec2_unlock(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__sec2_unlock() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__sec2_delete + * + * Purpose: Delete a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__sec2_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(filename); + + if (HDremove(filename) < 0) + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__sec2_delete() */ diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index b607087..298edfb 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -162,6 +162,7 @@ static const H5FD_class_t H5FD_splitter_g = { H5FD__splitter_truncate, /* truncate */ H5FD__splitter_lock, /* lock */ H5FD__splitter_unlock, /* unlock */ + NULL, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 3d0332f..6631325 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -180,6 +180,7 @@ static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_stdio_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_stdio_unlock(H5FD_t *_file); +static herr_t H5FD_stdio_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_stdio_g = { "stdio", /* name */ @@ -213,6 +214,7 @@ static const H5FD_class_t H5FD_stdio_g = { H5FD_stdio_truncate, /* truncate */ H5FD_stdio_lock, /* lock */ H5FD_stdio_unlock, /* unlock */ + H5FD_stdio_delete, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1200,6 +1202,34 @@ H5FD_stdio_unlock(H5FD_t *_file) return 0; } /* end H5FD_stdio_unlock() */ +/*------------------------------------------------------------------------- + * Function: H5FD_stdio_delete + * + * Purpose: Delete a file + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_stdio_delete(const char *filename, hid_t /*UNUSED*/ fapl_id) +{ + static const char *func = "H5FD_stdio_delete"; /* Function Name for error reporting */ + + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + assert(filename); + + /* Quiet compiler */ + (void)fapl_id; + + if (remove(filename) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTDELETEFILE, "can't delete file)", -1); + + return 0; +} /* end H5FD_stdio_delete() */ + #ifdef H5private_H /* * This is not related to the functionality of the driver code. diff --git a/src/H5Fint.c b/src/H5Fint.c index ed6b9c1..e1be2b6 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2352,6 +2352,31 @@ done: } /* end H5F__close() */ /*------------------------------------------------------------------------- + * Function: H5F_delete + * + * Purpose: Deletes a file. + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +herr_t +H5F_delete(const char *filename, hid_t fapl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(filename); + + /* Delete the file */ + if (H5FD_delete(filename, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_delete() */ + +/*------------------------------------------------------------------------- * Function: H5F_try_close * * Purpose: Attempts to close a file due to one of several actions: diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 5c5937b..7044835 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -830,6 +830,7 @@ 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); diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index c4e4744..fd86414 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -387,8 +387,13 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t /* H5Fdelete */ case H5VL_FILE_DELETE: { - HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, - "H5Fdelete() is currently not supported in the native VOL connector") + 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 *); + + /* Call private routine */ + if ((*ret = H5F_delete(name, fapl_id)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file check") break; } diff --git a/test/cache_logging.c b/test/cache_logging.c index 448e12b..93d4505 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -16,7 +16,8 @@ #include "h5test.h" #define LOG_LOCATION "cache_logging.out" -#define FILE_NAME "cache_logging" + +const char *FILENAME[] = {"cache_logging", NULL}; #define N_GROUPS 100 @@ -50,7 +51,7 @@ test_logging_api(void) TESTING("metadata cache log api calls"); fapl = h5_fileaccess(); - h5_fixname(FILE_NAME, fapl, filename, sizeof filename); + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Set up metadata cache logging */ is_enabled = TRUE; @@ -84,8 +85,6 @@ test_logging_api(void) TEST_ERROR; if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; - if (H5Pclose(fapl) < 0) - TEST_ERROR; /* Check to see if the logging flags were set correctly */ is_enabled = FALSE; @@ -127,10 +126,19 @@ test_logging_api(void) if (H5Fclose(fid) < 0) TEST_ERROR; + HDremove(LOG_LOCATION); + h5_clean_files(FILENAME, fapl); + PASSED(); return 0; error: + H5E_BEGIN_TRY + { + H5Pclose(fapl); + } + H5E_END_TRY + return 1; } /* test_logging_api() */ diff --git a/test/h5test.c b/test/h5test.c index 64eb784..2a54982 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -190,65 +190,22 @@ h5_clean_files(const char *base_name[], hid_t fapl) * *------------------------------------------------------------------------- */ -/* Disable warning for "format not a string literal" here -QAK */ -/* - * This pragma only needs to surround the snprintf() calls with - * sub_filename 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") void h5_delete_test_file(const char *base_name, hid_t fapl) { - char filename[1024]; /* VFD-dependent filename to delete */ - char sub_filename[2048]; /* sub-files in multi & family VFDs */ - hid_t driver = -1; /* VFD ID */ + char filename[1024]; /* VFD-dependent filename to delete */ /* Get the VFD-dependent filename */ if (NULL == h5_fixname(base_name, fapl, filename, sizeof(filename))) return; - driver = H5Pget_driver(fapl); - - if (driver == H5FD_FAMILY) { - int j; - for (j = 0; /*void*/; j++) { - HDsnprintf(sub_filename, sizeof(sub_filename), filename, j); - - /* If we can't access the file, it probably doesn't exist - * and we are done deleting the sub-files. - */ - if (HDaccess(sub_filename, F_OK) < 0) - break; - - HDremove(sub_filename); - } /* end for */ - } - else if (driver == H5FD_CORE) { - hbool_t backing; /* Whether the core file has backing store */ - - H5Pget_fapl_core(fapl, NULL, &backing); - - /* If the file was stored to disk with bacing store, remove it */ - if (backing) - HDremove(filename); - } - else if (driver == H5FD_MULTI) { - H5FD_mem_t mt; - - HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); - HDremove(sub_filename); - } + H5E_BEGIN_TRY + { + H5Fdelete(filename, fapl); } - else { - HDremove(filename); - } /* end driver selection tree */ + H5E_END_TRY; } /* end h5_delete_test_file() */ -H5_GCC_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: h5_delete_all_test_files @@ -1963,6 +1920,7 @@ static const H5FD_class_t H5FD_dummy_g = { NULL, /* truncate */ NULL, /* lock */ NULL, /* unlock */ + NULL, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/test/tfile.c b/test/tfile.c index 1861291..6a52392 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1918,10 +1918,6 @@ test_file_delete(hid_t fapl_id) /* HDF5 FILE */ /*************/ - /* This is just a placeholder until the native VOL connector supports - * H5Fdelete(). - */ - /* Get fapl-dependent filename */ h5_fixname(FILE_DELETE, fapl_id, filename, sizeof(filename)); @@ -1937,19 +1933,20 @@ test_file_delete(hid_t fapl_id) is_hdf5 = H5Fis_accessible(filename, fapl_id); VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); - /* Attempt to delete the file - should fail */ + /* Delete the file */ + ret = H5Fdelete(filename, fapl_id); + VERIFY(ret, SUCCEED, "H5Fdelete"); + + /* Verify that the file is NO LONGER an HDF5 file */ + /* This should fail since there is no file */ H5E_BEGIN_TRY { - ret = H5Fdelete(filename, fapl_id); + is_hdf5 = H5Fis_accessible(filename, fapl_id); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Fdelete"); - - /* Verify that the file still exists */ - is_hdf5 = H5Fis_accessible(filename, fapl_id); - VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); + VERIFY(is_hdf5, FAIL, "H5Fis_accessible"); - /* Actually delete the test file */ + /* Just in case deletion fails - silent on errors */ h5_delete_test_file(FILE_DELETE, fapl_id); /*****************/ diff --git a/test/vfd.c b/test/vfd.c index f129c5d..6b851a2 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -340,7 +340,7 @@ test_core(void) if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; - /* Retrieve the access property list... */ + /* Retrieve the access property list */ if ((fapl_id_out = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -553,6 +553,38 @@ test_core(void) TEST_ERROR; h5_delete_test_file(FILENAME[1], fapl_id); + /************************************************************************ + * Check that delete behavior works correctly + ************************************************************************/ + + /* Create and close a file */ + if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0) + TEST_ERROR; + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + /* Try to delete the file with the backing store off (shouldn't delete anything) */ + if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0) + TEST_ERROR; + if (H5Fdelete(filename, fapl_id) < 0) + TEST_ERROR; + if (-1 == HDaccess(filename, F_OK)) + FAIL_PUTS_ERROR("file deleted when backing store set to FALSE"); + + /* Try to delete the file with the backing store on (should work) */ + if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0) + TEST_ERROR; + if (H5Fdelete(filename, fapl_id) < 0) + TEST_ERROR; + if (0 == HDaccess(filename, F_OK)) + FAIL_PUTS_ERROR("file not deleted when backing store set to TRUE"); + + /************************************************************************ + * Clean up + ************************************************************************/ + /* Close the fapl */ if (H5Pclose(fapl_id) < 0) TEST_ERROR; diff --git a/testpar/t_file.c b/testpar/t_file.c index 629c24c..8dea120 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -948,3 +948,58 @@ test_file_properties(void) VRFY((mpi_ret >= 0), "MPI_Info_free succeeded"); } /* end test_file_properties() */ + +void +test_delete(void) +{ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ + hbool_t is_coll; + const char *filename = NULL; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + htri_t is_hdf5 = FAIL; /* Whether a file is an HDF5 file */ + herr_t ret; /* Generic return value */ + + filename = (const char *)GetTestParameters(); + + /* set up MPI parameters */ + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + /* setup file access plist */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl_id != H5I_INVALID_HID), "H5Pcreate"); + ret = H5Pset_fapl_mpio(fapl_id, comm, info); + VRFY((SUCCEED == ret), "H5Pset_fapl_mpio"); + + /* create the file */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + VRFY((fid != H5I_INVALID_HID), "H5Fcreate"); + + /* close the file */ + ret = H5Fclose(fid); + VRFY((SUCCEED == ret), "H5Fclose"); + + /* Verify that the file is an HDF5 file */ + is_hdf5 = H5Fis_accessible(filename, fapl_id); + VRFY((TRUE == is_hdf5), "H5Fis_accessible"); + + /* Delete the file */ + ret = H5Fdelete(filename, fapl_id); + VRFY((SUCCEED == ret), "H5Fdelete"); + + /* Verify that the file is NO LONGER an HDF5 file */ + /* This should fail since there is no file */ + H5E_BEGIN_TRY + { + is_hdf5 = H5Fis_accessible(filename, fapl_id); + } + H5E_END_TRY; + VRFY((is_hdf5 != SUCCEED), "H5Fis_accessible"); + + /* Release file-access plist */ + ret = H5Pclose(fapl_id); + VRFY((SUCCEED == ret), "H5Pclose"); + +} /* end test_delete() */ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index e24e1e4..1ead1b8 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -350,6 +350,8 @@ main(int argc, char **argv) AddTest("props", test_file_properties, NULL, "Coll Metadata file property settings", PARATESTFILE); + AddTest("delete", test_delete, NULL, "MPI-IO VFD file delete", PARATESTFILE); + AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, "dataset independent read", PARATESTFILE); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 007fac0..10e3027 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -236,6 +236,7 @@ void test_plist_ed(void); void external_links(void); void zero_dim_dset(void); void test_file_properties(void); +void test_delete(void); void multiple_dset_write(void); void multiple_group_write(void); void multiple_group_read(void); diff --git a/tools/src/misc/h5delete.c b/tools/src/misc/h5delete.c index 607b25e..3c4f8d5 100644 --- a/tools/src/misc/h5delete.c +++ b/tools/src/misc/h5delete.c @@ -59,13 +59,6 @@ main(int argc, const char *argv[]) } H5E_END_TRY; - /* The native VOL connector does not implement the H5Fdelete() call - * at this time, so try to remove the file via the POSIX remove(3) - * call on failures. - */ - if (ret < 0) - ret = HDremove(name); - if (ret < 0 && !quiet) HDfprintf(stderr, "Unable to delete storage at: %s\n", name); -- cgit v0.12 From b2c78e15cf2e78221c0f04fa47107f9ce94393fe Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 19 Apr 2021 07:28:32 -0500 Subject: Cleanup CMake code for doxygen and perl shell scripts (#552) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- CMakeLists.txt | 8 ++++++++ doxygen/Doxyfile.in | 1 + src/CMakeLists.txt | 44 ++++++++++++++++++++++++++------------------ test/CMakeTests.cmake | 3 +-- test/ShellTests.cmake | 3 +-- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99dc035..0771ac6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -508,6 +508,14 @@ else () endif () #----------------------------------------------------------------------------- +# perl is used in some optional src and tests, check availability +find_package (Perl) +if (PERL_FOUND) + set (H5_PERL_FOUND YES) +endif () +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- # Option to Build Static executables #----------------------------------------------------------------------------- option (BUILD_STATIC_EXECS "Build Static Executables" OFF) diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in index 24fc4ba..2395d6c 100644 --- a/doxygen/Doxyfile.in +++ b/doxygen/Doxyfile.in @@ -263,6 +263,7 @@ TAB_SIZE = 4 ALIASES = +@INCLUDE_PATH = @DOXYGEN_INCLUDE_ALIASES_PATH@ @INCLUDE = @DOXYGEN_INCLUDE_ALIASES@ # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 06b0c8c..a07122d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -991,8 +991,7 @@ set (H5_PUBLIC_GENERATED_HEADERS option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON) if (HDF5_GENERATE_HEADERS) set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE) - find_package (Perl) - if (PERL_FOUND) + if (H5_PERL_FOUND) execute_process ( COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt OUTPUT_VARIABLE SCRIPT_OUTPUT ) @@ -1369,34 +1368,43 @@ endif () if (DOXYGEN_FOUND) set (DOXYGEN_PACKAGE ${HDF5_PACKAGE}) set (DOXYGEN_VERSION_STRING ${HDF5_VERSION_STRING}) - set (DOXYGEN_INCLUDE_ALIASES ${HDF5_DOXYGEN_DIR}/aliases) + 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}/shared) + set (DOXYGEN_INPUT_DIRECTORY "${HDF5_SRC_DIR} ${HDF5_DOXYGEN_DIR}/dox ${HDF5_GENERATED_SOURCE_DIR}/shared") set (DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES) set (DOXYGEN_MACRO_EXPANSION YES) set (DOXYGEN_OUTPUT_DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs) +# This configure and custom target work together # Replace variables inside @@ with the current values - configure_file(${HDF5_DOXYGEN_DIR}/Doxyfile.in Doxyfile @ONLY) - - doxygen_add_docs(hdf5lib_doc -# ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${HDF5_DOXYGEN_DIR}/dox - ${DOXYGEN_INPUT_DIRECTORY} - ALL - WORKING_DIRECTORY ${HDF5_SRC_DIR} - COMMENT "Generating HDF5 library Source Documentation" - ) - install( + 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 + 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 +## ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${HDF5_DOXYGEN_DIR}/dox +# ${DOXYGEN_INPUT_DIRECTORY} +# ALL +# 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 ) - if(NOT TARGET doxygen) - add_custom_target(doxygen) - endif() + if (NOT TARGET doxygen) + add_custom_target (doxygen) + endif () - add_dependencies(doxygen hdf5lib_doc) + add_dependencies (doxygen hdf5lib_doc) endif () diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 242c918..d3e0788 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -889,8 +889,7 @@ if (ENABLE_EXTENDED_TESTS) #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") - find_package (Perl) - if (PERL_FOUND) + if (H5_PERL_FOUND) add_test ( NAME H5TEST-testflushrefresh-clear-objects COMMAND ${CMAKE_COMMAND} -E remove flushrefresh.h5 diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 4676184..4d23de3 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -23,8 +23,7 @@ if (UNIX) ############################################################################## # configure scripts to test dir ############################################################################## - find_package (Perl) - if (PERL_FOUND) + if (H5_PERL_FOUND) configure_file(${HDF5_TEST_SOURCE_DIR}/testflushrefresh.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh @ONLY) endif () configure_file(${HDF5_TEST_SOURCE_DIR}/test_usecases.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh @ONLY) -- cgit v0.12 From d3384b2e8e5fafd9f3aa90e738ca18d5ddeeb3c1 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 19 Apr 2021 14:51:18 -0700 Subject: Fixes incorrect usage of H5I_BADID (#554) * Committing clang-format changes * Fixes incorrect use of H5I_BADID Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- hl/c++/src/H5PacketTable.h | 2 +- hl/src/H5TB.c | 342 ++++++++++++++++++++++----------------------- src/H5R.c | 2 +- src/H5Rdeprec.c | 2 +- test/reserved.c | 6 +- 5 files changed, 177 insertions(+), 177 deletions(-) diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index a73b4c9..acd0ccf 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -35,7 +35,7 @@ class H5_HLCPPDLL PacketTable { */ PacketTable() { - table_id = H5I_BADID; + table_id = H5I_INVALID_HID; } /* "Open" Constructor diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 1ac162f..efa61a3 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -57,11 +57,11 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi hsize_t nrecords, size_t type_size, const char *field_names[], const size_t *field_offset, const hid_t *field_types, hsize_t chunk_size, void *fill_data, int compress, const void *buf) { - hid_t did = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t mem_type_id = H5I_BADID; - hid_t plist_id = H5I_BADID; - hid_t attr_id = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t mem_type_id = H5I_INVALID_HID; + hid_t plist_id = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; hsize_t dims[1]; hsize_t dims_chunk[1]; hsize_t maxdims[1] = {H5S_UNLIMITED}; @@ -129,17 +129,17 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi /* terminate access to the data space. */ if (H5Sclose(sid) < 0) goto out; - sid = H5I_BADID; + sid = H5I_INVALID_HID; /* end access to the dataset */ if (H5Dclose(did) < 0) goto out; - did = H5I_BADID; + did = H5I_INVALID_HID; /* end access to the property list */ if (H5Pclose(plist_id) < 0) goto out; - plist_id = H5I_BADID; + plist_id = H5I_INVALID_HID; /*------------------------------------------------------------------------- * set the conforming table attributes @@ -196,24 +196,24 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi if (H5Aclose(attr_id) < 0) goto out; - attr_id = H5I_BADID; + attr_id = H5I_INVALID_HID; } /* end for */ /* terminate access to the data space. */ if (H5Sclose(sid) < 0) goto out; - sid = H5I_BADID; + sid = H5I_INVALID_HID; /* end access to the dataset */ if (H5Dclose(did) < 0) goto out; - did = H5I_BADID; + did = H5I_INVALID_HID; } /* end if */ /* release the datatype. */ if (H5Tclose(mem_type_id) < 0) goto out; - mem_type_id = H5I_BADID; + mem_type_id = H5I_INVALID_HID; ret_val = 0; @@ -267,9 +267,9 @@ herr_t H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, const void *buf) { - hid_t did = H5I_BADID; - hid_t tid = H5I_BADID; - hid_t mem_type_id = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t mem_type_id = H5I_INVALID_HID; hsize_t nrecords_orig; hsize_t nfields; herr_t ret_val = -1; @@ -332,11 +332,11 @@ herr_t H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, const void *buf) { - hid_t did = H5I_BADID; - hid_t tid = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; - hid_t mem_type_id = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; + hid_t mem_type_id = H5I_INVALID_HID; hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; @@ -425,14 +425,14 @@ H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_nam hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, const void *buf) { - hid_t did = H5I_BADID; - hid_t tid = H5I_BADID; - hid_t write_type_id = H5I_BADID; - hid_t member_type_id = H5I_BADID; - hid_t nmtype_id = H5I_BADID; - hid_t m_sid = H5I_BADID; - hid_t file_space_id = H5I_BADID; - hid_t preserve_id = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t write_type_id = H5I_INVALID_HID; + hid_t member_type_id = H5I_INVALID_HID; + hid_t nmtype_id = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; + hid_t file_space_id = H5I_INVALID_HID; + hid_t preserve_id = H5I_INVALID_HID; hssize_t nfields; hssize_t i, j; hsize_t count[1]; @@ -510,10 +510,10 @@ H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_nam /* close */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; if (H5Tclose(nmtype_id) < 0) goto out; - nmtype_id = H5I_BADID; + nmtype_id = H5I_INVALID_HID; } /* end if */ H5free_memory(member_name); @@ -583,14 +583,14 @@ H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, con hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, const void *buf) { - hid_t did = H5I_BADID; - hid_t tid = H5I_BADID; - hid_t write_type_id = H5I_BADID; - hid_t member_type_id = H5I_BADID; - hid_t nmtype_id = H5I_BADID; - hid_t m_sid = H5I_BADID; - hid_t file_space_id = H5I_BADID; - hid_t preserve_id = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t write_type_id = H5I_INVALID_HID; + hid_t member_type_id = H5I_INVALID_HID; + hid_t nmtype_id = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; + hid_t file_space_id = H5I_INVALID_HID; + hid_t preserve_id = H5I_INVALID_HID; hsize_t count[1]; hsize_t offset[1]; hsize_t i; @@ -663,10 +663,10 @@ H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, con /* close */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; if (H5Tclose(nmtype_id) < 0) goto out; - nmtype_id = H5I_BADID; + nmtype_id = H5I_INVALID_HID; H5free_memory(member_name); member_name = NULL; @@ -747,10 +747,10 @@ herr_t H5TBread_table(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset, const size_t *field_sizes, void *dst_buf) { - hid_t did = H5I_BADID; - hid_t ftype_id = H5I_BADID; - hid_t mem_type_id = H5I_BADID; - hid_t sid = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t ftype_id = H5I_INVALID_HID; + hid_t mem_type_id = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; hsize_t dims[1]; herr_t ret_val = -1; @@ -820,9 +820,9 @@ herr_t H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, void *buf) { - hid_t did = H5I_BADID; - hid_t ftype_id = H5I_BADID; - hid_t mem_type_id = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t ftype_id = H5I_INVALID_HID; + hid_t mem_type_id = H5I_INVALID_HID; hsize_t nrecords_orig; hsize_t nfields; herr_t ret_val = -1; @@ -887,13 +887,13 @@ H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_name hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, void *buf) { - hid_t did = H5I_BADID; - hid_t ftype_id = H5I_BADID; - hid_t mem_type_id = H5I_BADID; - hid_t mtype_id = H5I_BADID; - hid_t nmtype_id = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t ftype_id = H5I_INVALID_HID; + hid_t mem_type_id = H5I_INVALID_HID; + hid_t mtype_id = H5I_INVALID_HID; + hid_t nmtype_id = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; hssize_t nfields; hsize_t count[1]; hsize_t offset[1]; @@ -960,10 +960,10 @@ H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_name /* close */ if (H5Tclose(mtype_id) < 0) goto out; - mtype_id = H5I_BADID; + mtype_id = H5I_INVALID_HID; if (H5Tclose(nmtype_id) < 0) goto out; - nmtype_id = H5I_BADID; + nmtype_id = H5I_INVALID_HID; j++; } /* end if */ @@ -1044,13 +1044,13 @@ H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, cons hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, void *buf) { - hid_t did = H5I_BADID; - hid_t tid = H5I_BADID; - hid_t read_type_id = H5I_BADID; - hid_t member_type_id = H5I_BADID; - hid_t nmtype_id = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t read_type_id = H5I_INVALID_HID; + hid_t member_type_id = H5I_INVALID_HID; + hid_t nmtype_id = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; @@ -1117,10 +1117,10 @@ H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, cons /* close the member type */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; if (H5Tclose(nmtype_id) < 0) goto out; - nmtype_id = H5I_BADID; + nmtype_id = H5I_INVALID_HID; H5free_memory(member_name); member_name = NULL; @@ -1198,11 +1198,11 @@ out: herr_t H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords) { - hid_t did = H5I_BADID; - hid_t tid = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; - hid_t mem_type_id = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; + hid_t mem_type_id = H5I_INVALID_HID; hsize_t nfields; hsize_t ntotal_records; hsize_t read_start; @@ -1294,16 +1294,16 @@ H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr /* close */ if (H5Sclose(m_sid) < 0) goto out; - m_sid = H5I_BADID; + m_sid = H5I_INVALID_HID; if (H5Tclose(mem_type_id) < 0) goto out; - mem_type_id = H5I_BADID; + mem_type_id = H5I_INVALID_HID; if (H5Sclose(sid) < 0) goto out; - sid = H5I_BADID; + sid = H5I_INVALID_HID; if (H5Tclose(tid) < 0) goto out; - tid = H5I_BADID; + tid = H5I_INVALID_HID; } /* read_nrecords */ /*------------------------------------------------------------------------- @@ -1361,11 +1361,11 @@ herr_t H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, void *buf) { - hid_t did = H5I_BADID; - hid_t tid = H5I_BADID; - hid_t mem_type_id = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t mem_type_id = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; hsize_t nfields; hsize_t ntotal_records; hsize_t read_nrecords; @@ -1442,10 +1442,10 @@ H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr /* terminate access to the dataspace */ if (H5Sclose(m_sid) < 0) goto out; - m_sid = H5I_BADID; + m_sid = H5I_INVALID_HID; if (H5Sclose(sid) < 0) goto out; - sid = H5I_BADID; + sid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * write the "pushed down" records @@ -1513,10 +1513,10 @@ herr_t H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords, const char *dset_name2, hsize_t start2) { - hid_t did = H5I_BADID; - hid_t tid = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; @@ -1643,24 +1643,24 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c const char *dset_name3) { /* identifiers for the 1st dataset. */ - hid_t did_1 = H5I_BADID; - hid_t tid_1 = H5I_BADID; - hid_t sid_1 = H5I_BADID; - hid_t pid_1 = H5I_BADID; + hid_t did_1 = H5I_INVALID_HID; + hid_t tid_1 = H5I_INVALID_HID; + hid_t sid_1 = H5I_INVALID_HID; + hid_t pid_1 = H5I_INVALID_HID; /* identifiers for the 2nd dataset. */ - hid_t did_2 = H5I_BADID; - hid_t tid_2 = H5I_BADID; - hid_t sid_2 = H5I_BADID; - hid_t pid_2 = H5I_BADID; + hid_t did_2 = H5I_INVALID_HID; + hid_t tid_2 = H5I_INVALID_HID; + hid_t sid_2 = H5I_INVALID_HID; + hid_t pid_2 = H5I_INVALID_HID; /* identifiers for the 3rd dataset. */ - hid_t did_3 = H5I_BADID; - hid_t tid_3 = H5I_BADID; - hid_t sid_3 = H5I_BADID; - hid_t pid_3 = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; - hid_t member_type_id = H5I_BADID; - hid_t attr_id = H5I_BADID; + hid_t did_3 = H5I_INVALID_HID; + hid_t tid_3 = H5I_INVALID_HID; + hid_t sid_3 = H5I_INVALID_HID; + hid_t pid_3 = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; + hid_t member_type_id = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; @@ -1807,17 +1807,17 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c if (H5Aclose(attr_id) < 0) goto out; - attr_id = H5I_BADID; + attr_id = H5I_INVALID_HID; if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; } /* end for */ /* close data space. */ if (H5Sclose(sid) < 0) goto out; - sid = H5I_BADID; + sid = H5I_INVALID_HID; } /* end if */ /*------------------------------------------------------------------------- @@ -1856,7 +1856,7 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c */ if (H5Sclose(m_sid) < 0) goto out; - m_sid = H5I_BADID; + m_sid = H5I_INVALID_HID; HDfree(tmp_buf); tmp_buf = NULL; @@ -1999,25 +1999,25 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi hsize_t position, const void *fill_data, const void *buf) { /* identifiers for the 1st, original dataset */ - hid_t did_1 = H5I_BADID; - hid_t tid_1 = H5I_BADID; - hid_t sid_1 = H5I_BADID; - hid_t pid_1 = H5I_BADID; - hid_t msid_1 = H5I_BADID; + hid_t did_1 = H5I_INVALID_HID; + hid_t tid_1 = H5I_INVALID_HID; + hid_t sid_1 = H5I_INVALID_HID; + hid_t pid_1 = H5I_INVALID_HID; + hid_t msid_1 = H5I_INVALID_HID; /* identifiers for the 2nd, new dataset */ - hid_t did_2 = H5I_BADID; - hid_t tid_2 = H5I_BADID; - hid_t sid_2 = H5I_BADID; - hid_t pid_2 = H5I_BADID; - hid_t msid_2 = H5I_BADID; + hid_t did_2 = H5I_INVALID_HID; + hid_t tid_2 = H5I_INVALID_HID; + hid_t sid_2 = H5I_INVALID_HID; + hid_t pid_2 = H5I_INVALID_HID; + hid_t msid_2 = H5I_INVALID_HID; /* identifiers for the 3rd, final dataset */ - hid_t did_3 = H5I_BADID; - hid_t tid_3 = H5I_BADID; - hid_t sid_3 = H5I_BADID; - hid_t member_type_id = H5I_BADID; - hid_t write_type_id = H5I_BADID; - hid_t preserve_id = H5I_BADID; - hid_t attr_id = H5I_BADID; + hid_t did_3 = H5I_INVALID_HID; + hid_t tid_3 = H5I_INVALID_HID; + hid_t sid_3 = H5I_INVALID_HID; + hid_t member_type_id = H5I_INVALID_HID; + hid_t write_type_id = H5I_INVALID_HID; + hid_t preserve_id = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; size_t member_size; size_t new_member_size = 0; size_t total_size; @@ -2157,7 +2157,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi /* close the member type */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; } /* end else */ } /* end for */ @@ -2307,12 +2307,12 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi if (H5Aclose(attr_id) < 0) goto out; - attr_id = H5I_BADID; + attr_id = H5I_INVALID_HID; /* close the member type */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; } /* end for */ /*------------------------------------------------------------------------- @@ -2334,11 +2334,11 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi if (H5Aclose(attr_id) < 0) goto out; - attr_id = H5I_BADID; + attr_id = H5I_INVALID_HID; if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; } /* end fill_data */ ret_val = 0; @@ -2415,23 +2415,23 @@ herr_t H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name) { /* identifiers for the 1st original dataset */ - hid_t did_1 = H5I_BADID; - hid_t tid_1 = H5I_BADID; - hid_t sid_1 = H5I_BADID; - hid_t pid_1 = H5I_BADID; + hid_t did_1 = H5I_INVALID_HID; + hid_t tid_1 = H5I_INVALID_HID; + hid_t sid_1 = H5I_INVALID_HID; + hid_t pid_1 = H5I_INVALID_HID; /* identifiers for the 2nd new dataset */ - hid_t did_2 = H5I_BADID; - hid_t tid_2 = H5I_BADID; - hid_t sid_2 = H5I_BADID; - hid_t pid_2 = H5I_BADID; + hid_t did_2 = H5I_INVALID_HID; + hid_t tid_2 = H5I_INVALID_HID; + hid_t sid_2 = H5I_INVALID_HID; + hid_t pid_2 = H5I_INVALID_HID; /* identifiers for the 3rd final dataset */ - hid_t did_3 = H5I_BADID; - hid_t tid_3 = H5I_BADID; - hid_t member_type_id = H5I_BADID; - hid_t preserve_id = H5I_BADID; - hid_t read_type_id = H5I_BADID; - hid_t write_type_id = H5I_BADID; - hid_t attr_id = H5I_BADID; + hid_t did_3 = H5I_INVALID_HID; + hid_t tid_3 = H5I_INVALID_HID; + hid_t member_type_id = H5I_INVALID_HID; + hid_t preserve_id = H5I_INVALID_HID; + hid_t read_type_id = H5I_INVALID_HID; + hid_t write_type_id = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; size_t member_size; size_t type_size1; size_t type_size2; @@ -2515,7 +2515,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name) /* close the member type */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; H5free_memory(member_name); member_name = NULL; @@ -2598,7 +2598,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name) /* close the member type */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; } /* end if */ H5free_memory(member_name); @@ -2682,22 +2682,22 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name) /* end access to the property list */ if (H5Pclose(preserve_id) < 0) goto out; - preserve_id = H5I_BADID; + preserve_id = H5I_INVALID_HID; /* close the member type */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; /* close the read type */ if (H5Tclose(read_type_id) < 0) goto out; - read_type_id = H5I_BADID; + read_type_id = H5I_INVALID_HID; /* close the write type */ if (H5Tclose(write_type_id) < 0) goto out; - write_type_id = H5I_BADID; + write_type_id = H5I_INVALID_HID; HDfree(tmp_buf); tmp_buf = NULL; @@ -2769,18 +2769,18 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name) if (H5Aclose(attr_id) < 0) goto out; - attr_id = H5I_BADID; + attr_id = H5I_INVALID_HID; /* close the member type */ if (H5Tclose(member_type_id) < 0) goto out; - member_type_id = H5I_BADID; + member_type_id = H5I_INVALID_HID; } /* end for */ /* close data space. */ if (H5Sclose(sid_1) < 0) goto out; - sid_1 = H5I_BADID; + sid_1 = H5I_INVALID_HID; } /* end if */ ret_val = 0; @@ -2962,9 +2962,9 @@ out: herr_t H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords) { - hid_t tid = H5I_BADID; - hid_t sid = H5I_BADID; - hid_t did = H5I_BADID; + hid_t tid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; hsize_t dims[1]; int num_members; herr_t ret_val = -1; @@ -3008,7 +3008,7 @@ H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_ /* terminate access to the dataspace */ if (H5Sclose(sid) < 0) goto out; - sid = H5I_BADID; + sid = H5I_INVALID_HID; *nrecords = dims[0]; } /* end if */ @@ -3048,11 +3048,11 @@ herr_t H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes, size_t *field_offsets, size_t *type_size) { - hid_t did = H5I_BADID; /* dataset ID */ - hid_t tid = H5I_BADID; /* file type ID */ - hid_t n_tid = H5I_BADID; /* native type ID */ - hid_t m_tid = H5I_BADID; /* member type ID */ - hid_t nm_tid = H5I_BADID; /* native member ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t tid = H5I_INVALID_HID; /* file type ID */ + hid_t n_tid = H5I_INVALID_HID; /* native type ID */ + hid_t m_tid = H5I_INVALID_HID; /* member type ID */ + hid_t nm_tid = H5I_INVALID_HID; /* native member ID */ hssize_t nfields; hssize_t i; herr_t ret_val = -1; @@ -3111,10 +3111,10 @@ H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], siz /* close the member types */ if (H5Tclose(m_tid) < 0) goto out; - m_tid = H5I_BADID; + m_tid = H5I_INVALID_HID; if (H5Tclose(nm_tid) < 0) goto out; - nm_tid = H5I_BADID; + nm_tid = H5I_INVALID_HID; } /* end for */ ret_val = 0; @@ -3267,9 +3267,9 @@ static hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset, const size_t *field_sizes, hid_t ftype_id) { - hid_t mem_type_id = H5I_BADID; - hid_t mtype_id = H5I_BADID; - hid_t nmtype_id = H5I_BADID; + hid_t mem_type_id = H5I_INVALID_HID; + hid_t mtype_id = H5I_INVALID_HID; + hid_t nmtype_id = H5I_INVALID_HID; size_t size_native; hsize_t nfields = 0; char ** fnames = NULL; @@ -3310,10 +3310,10 @@ H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size, const si goto out; if (H5Tclose(mtype_id) < 0) goto out; - mtype_id = H5I_BADID; + mtype_id = H5I_INVALID_HID; if (H5Tclose(nmtype_id) < 0) goto out; - nmtype_id = H5I_BADID; + nmtype_id = H5I_INVALID_HID; } /* end for */ ret_val = mem_type_id; @@ -3364,8 +3364,8 @@ herr_t H5TB_common_append_records(hid_t dataset_id, hid_t mem_type_id, size_t nrecords, hsize_t orig_table_size, const void *buf) { - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; hsize_t count[1]; hsize_t offset[1]; hsize_t dims[1]; @@ -3429,8 +3429,8 @@ herr_t H5TB_common_read_records(hid_t dataset_id, hid_t mem_type_id, hsize_t start, size_t nrecords, hsize_t table_size, void *buf) { - hid_t sid = H5I_BADID; - hid_t m_sid = H5I_BADID; + hid_t sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; diff --git a/src/H5R.c b/src/H5R.c index 5301743..f23b993 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -185,7 +185,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_BADID) || (space_id == H5S_ALL)) + if ((space_id == H5I_INVALID_HID) || (space_id == H5S_ALL)) 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") diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index b5d0d44..d5f5a7d 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -449,7 +449,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; /* Retrieve space */ - if (space_id == H5I_BADID) + if (space_id == H5I_INVALID_HID) 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") diff --git a/test/reserved.c b/test/reserved.c index 1ea73a6..6e41a16 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -126,7 +126,7 @@ rsrv_heap(void) /* If we can read a dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). */ - if (dataset_id == H5I_BADID) + if (dataset_id == H5I_INVALID_HID) TEST_ERROR; if (H5Dclose(dataset_id) < 0) @@ -268,7 +268,7 @@ rsrv_ohdr(void) /* If we can read the dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). */ - if (dataset_id == H5I_BADID) + if (dataset_id == H5I_INVALID_HID) TEST_ERROR; if (H5Dclose(dataset_id) < 0) @@ -432,7 +432,7 @@ rsrv_vlen(void) /* If we can read the dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). */ - if (dataset_id == H5I_BADID) + if (dataset_id == H5I_INVALID_HID) TEST_ERROR; if (H5Dclose(dataset_id) < 0) -- cgit v0.12 From fc5c567fdce94765c9db904295ca8879a8e91752 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 20 Apr 2021 04:55:05 -0700 Subject: CMake no longer builds the C++ library by default (#555) * Committing clang-format changes * CMake no longer builds C++ library by default Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- CMakeLists.txt | 2 +- config/cmake/cacheinit.cmake | 2 ++ release_docs/INSTALL_CMake.txt | 2 +- release_docs/RELEASE.txt | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0771ac6..306f701 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1106,7 +1106,7 @@ endif () # Option to build HDF5 C++ Library #----------------------------------------------------------------------------- if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") - option (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" ON) + option (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF) if (HDF5_BUILD_CPP_LIB) # check for unsupported options if (HDF5_ENABLE_PARALLEL) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index fc85277..e423deb 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -21,6 +21,8 @@ set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace (can be empty)" FORCE) +set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build C++ support" FORCE) + set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) set (HDF5_INSTALL_MOD_FORTRAN "NO" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" FORCE) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index f42f780..6f30f45 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -734,7 +734,7 @@ BUILD_STATIC_EXECS "Build Static Executables" OFF BUILD_TESTING "Build HDF5 Unit Testing" ON ---------------- HDF5 Build Options --------------------- -HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" ON +HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF HDF5_BUILD_JAVA "Build JAVA support" OFF diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index edf39f8..359f222 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,13 @@ New Features Configuration: ------------- + - CMake no longer builds the C++ library by default + + HDF5_BUILD_CPP_LIB now defaults to OFF, which is in line with the + Autotools build defaults. + + (DER - 2021/04/20) + - Removal of pre-VS2015 work-arounds HDF5 now requires Visual Studio 2015 or greater, so old work-around -- cgit v0.12 From 9a8b91eb30156738a8ba382add78f1721d7eb6cf Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 20 Apr 2021 17:42:52 -0500 Subject: CMake advanced options for clang needs an OPTION command #556 (#557) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 306f701..f4cad5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -526,12 +526,18 @@ if (BUILD_STATIC_EXECS) endif () endif () +option (HDF5_ENABLE_ANALYZER_TOOLS "enable the use of Clang tools" OFF) +mark_as_advanced (HDF5_ENABLE_ANALYZER_TOOLS) if (HDF5_ENABLE_ANALYZER_TOOLS) include (${HDF5_SOURCE_DIR}/config/sanitizer/tools.cmake) endif () +option (HDF5_ENABLE_SANITIZERS "execute the Clang sanitizer" OFF) +mark_as_advanced (HDF5_ENABLE_SANITIZERS) if (HDF5_ENABLE_SANITIZERS) include (${HDF5_SOURCE_DIR}/config/sanitizer/sanitizers.cmake) endif () +option (HDF5_ENABLE_FORMATTERS "format source files" OFF) +mark_as_advanced (HDF5_ENABLE_FORMATTERS) if (HDF5_ENABLE_FORMATTERS) include (${HDF5_SOURCE_DIR}/config/sanitizer/formatting.cmake) endif () -- cgit v0.12 From 99d5505ad1129fcad29c6c28bc689fe6bcf3b778 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 20 Apr 2021 23:10:04 -0400 Subject: Added more C++11 override keywords (#485) * Added more C++11 override keywords * Format updates in src/H5Tconv.c. * Committing clang-format changes Co-authored-by: Larry Knox Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/src/H5ArrayType.h | 6 +++--- c++/src/H5AtomType.h | 4 ++-- c++/src/H5Attribute.h | 18 +++++++++--------- c++/src/H5CompType.h | 6 +++--- c++/src/H5DaccProp.h | 4 ++-- c++/src/H5DataSet.h | 18 +++++++++--------- c++/src/H5DataSpace.h | 2 +- c++/src/H5DataType.h | 10 +++++----- c++/src/H5DcreatProp.h | 4 ++-- c++/src/H5DxferProp.h | 4 ++-- c++/src/H5EnumType.h | 6 +++--- c++/src/H5FaccProp.h | 4 ++-- c++/src/H5FcreatProp.h | 4 ++-- c++/src/H5File.h | 2 +- c++/src/H5FloatType.h | 6 +++--- c++/src/H5IntType.h | 6 +++--- c++/src/H5LaccProp.h | 4 ++-- c++/src/H5LcreatProp.h | 4 ++-- c++/src/H5OcreatProp.h | 4 ++-- c++/src/H5PredType.h | 4 ++-- c++/src/H5PropList.h | 10 +++++----- c++/src/H5StrType.h | 6 +++--- c++/src/H5VarLenType.h | 6 +++--- 23 files changed, 71 insertions(+), 71 deletions(-) diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index 4302352..b93ae4a 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -37,7 +37,7 @@ class H5_DLLCPP ArrayType : public DataType { // Returns an ArrayType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const; + virtual DataType *decode() const H5_OVERRIDE; // Returns the number of dimensions of this array datatype. int getArrayNDims() const; @@ -49,7 +49,7 @@ class H5_DLLCPP ArrayType : public DataType { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("ArrayType"); } @@ -61,7 +61,7 @@ class H5_DLLCPP ArrayType : public DataType { ArrayType(const hid_t existing_id); // Noop destructor - virtual ~ArrayType(); + virtual ~ArrayType() H5_OVERRIDE; // Default constructor ArrayType(); diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index 84da5e9..e00a308 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -58,7 +58,7 @@ class H5_DLLCPP AtomType : public DataType { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("AtomType"); } @@ -68,7 +68,7 @@ class H5_DLLCPP AtomType : public DataType { AtomType(const AtomType &original); // Noop destructor - virtual ~AtomType(); + virtual ~AtomType() H5_OVERRIDE; #endif // DOXYGEN_SHOULD_SKIP_THIS protected: diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index 41e5a31..71bfa14 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -38,7 +38,7 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { Attribute(const hid_t attr_id); // Closes this attribute. - virtual void close(); + virtual void close() H5_OVERRIDE; // Gets the name of this attribute. ssize_t getName(char *attr_name, size_t buf_size = 0) const; @@ -50,13 +50,13 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { ssize_t getName(size_t buf_size, H5std_string &attr_name) const; // Gets a copy of the dataspace for this attribute. - virtual DataSpace getSpace() const; + virtual DataSpace getSpace() const H5_OVERRIDE; // Returns the amount of storage size required for this attribute. - virtual hsize_t getStorageSize() const; + virtual hsize_t getStorageSize() const H5_OVERRIDE; // Returns the in memory size of this attribute's data. - virtual size_t getInMemDataSize() const; + virtual size_t getInMemDataSize() const H5_OVERRIDE; // Reads data from this attribute. void read(const DataType &mem_type, void *buf) const; @@ -68,21 +68,21 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("Attribute"); } // Gets the attribute id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // Destructor: properly terminates access to this attribute. - virtual ~Attribute(); + virtual ~Attribute() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: // Sets the attribute id. - virtual void p_setId(const hid_t new_id); + virtual void p_setId(const hid_t new_id) H5_OVERRIDE; #endif // DOXYGEN_SHOULD_SKIP_THIS private: @@ -92,7 +92,7 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific // sub-types - virtual hid_t p_get_type() const; + virtual hid_t p_get_type() const H5_OVERRIDE; // Reads variable or fixed len strings from this attribute. void p_read_variable_len(const DataType &mem_type, H5std_string &strg) const; diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 6a4c093..4424d89 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -45,7 +45,7 @@ class H5_DLLCPP CompType : public DataType { // Returns a CompType object via DataType* by decoding the binary // object description of this type. - virtual DataType *decode() const; + virtual DataType *decode() const H5_OVERRIDE; // Returns the type class of the specified member of this compound // datatype. It provides to the user a way of knowing what type @@ -108,13 +108,13 @@ class H5_DLLCPP CompType : public DataType { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("CompType"); } // Noop destructor. - virtual ~CompType(); + virtual ~CompType() H5_OVERRIDE; private: // Contains common code that is used by the member functions diff --git a/c++/src/H5DaccProp.h b/c++/src/H5DaccProp.h index 7d6b250..398918d 100644 --- a/c++/src/H5DaccProp.h +++ b/c++/src/H5DaccProp.h @@ -38,7 +38,7 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("DSetAccPropList"); } @@ -51,7 +51,7 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList { DSetAccPropList(const hid_t plist_id); // Noop destructor. - virtual ~DSetAccPropList(); + virtual ~DSetAccPropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index c745470..619bc30 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -28,7 +28,7 @@ namespace H5 { class H5_DLLCPP DataSet : public H5Object, public AbstractDs { public: // Close this dataset. - virtual void close(); + virtual void close() H5_OVERRIDE; // Extends the dataset with unlimited dimension. void extend(const hsize_t *size) const; @@ -53,16 +53,16 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { haddr_t getOffset() const; // Gets the dataspace of this dataset. - virtual DataSpace getSpace() const; + virtual DataSpace getSpace() const H5_OVERRIDE; // Determines whether space has been allocated for a dataset. void getSpaceStatus(H5D_space_status_t &status) const; // Returns the amount of storage size required for this dataset. - virtual hsize_t getStorageSize() const; + virtual hsize_t getStorageSize() const H5_OVERRIDE; // Returns the in memory size of this attribute's data. - virtual size_t getInMemDataSize() const; + virtual size_t getInMemDataSize() const H5_OVERRIDE; // Returns the number of bytes required to store VL data. hsize_t getVlenBufSize(const DataType &type, const DataSpace &space) const; @@ -100,7 +100,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("DataSet"); } @@ -121,15 +121,15 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { DataSet(const hid_t existing_id); // Gets the dataset id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // Destructor: properly terminates access to this dataset. - virtual ~DataSet(); + virtual ~DataSet() H5_OVERRIDE; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the dataset id. - virtual void p_setId(const hid_t new_id); + virtual void p_setId(const hid_t new_id) H5_OVERRIDE; #endif // DOXYGEN_SHOULD_SKIP_THIS private: @@ -139,7 +139,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific // sub-types - virtual hid_t p_get_type() const; + virtual hid_t p_get_type() const H5_OVERRIDE; // Reads variable or fixed len strings from this dataset. void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 470de74..5583baa 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -127,7 +127,7 @@ class H5_DLLCPP DataSpace : public IdComponent { static void deleteConstants(); // Destructor: properly terminates access to this dataspace. - virtual ~DataSpace(); + virtual ~DataSpace() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 49f5348..7dd371b 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -47,7 +47,7 @@ class H5_DLLCPP DataType : public H5Object { // PropList& plist = PropList::DEFAULT); // Closes this datatype. - virtual void close(); + virtual void close() H5_OVERRIDE; // Copies an existing datatype to this datatype object. void copy(const DataType &like_type); @@ -133,7 +133,7 @@ class H5_DLLCPP DataType : public H5Object { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("DataType"); } @@ -148,10 +148,10 @@ class H5_DLLCPP DataType : public H5Object { bool hasBinaryDesc() const; // Gets the datatype id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // Destructor: properly terminates access to this datatype. - virtual ~DataType(); + virtual ~DataType() H5_OVERRIDE; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -162,7 +162,7 @@ class H5_DLLCPP DataType : public H5Object { hid_t p_decode() const; // Sets the datatype id. - virtual void p_setId(const hid_t new_id); + virtual void p_setId(const hid_t new_id) H5_OVERRIDE; // Opens a datatype and returns the id. hid_t p_opentype(const H5Location &loc, const char *dtype_name) const; diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index 820c0d1..a576518 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -128,7 +128,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("DSetCreatPropList"); } @@ -141,7 +141,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { DSetCreatPropList(const hid_t plist_id); // Noop destructor. - virtual ~DSetCreatPropList(); + virtual ~DSetCreatPropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 1e4d668..3925a57 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -100,7 +100,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("DSetMemXferPropList"); } @@ -113,7 +113,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { DSetMemXferPropList(const hid_t plist_id); // Noop destructor - virtual ~DSetMemXferPropList(); + virtual ~DSetMemXferPropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 484405a..2501e4b 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -41,7 +41,7 @@ class H5_DLLCPP EnumType : public DataType { // Returns an EnumType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const; + virtual DataType *decode() const H5_OVERRIDE; // Returns the number of members in this enumeration datatype. int getNmembers() const; @@ -68,7 +68,7 @@ class H5_DLLCPP EnumType : public DataType { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("EnumType"); } @@ -82,7 +82,7 @@ class H5_DLLCPP EnumType : public DataType { // Copy constructor: same as the original EnumType. EnumType(const EnumType &original); - virtual ~EnumType(); + virtual ~EnumType() H5_OVERRIDE; }; // end of EnumType } // namespace H5 diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 998f870..53c7799 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -137,7 +137,7 @@ class H5_DLLCPP FileAccPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("FileAccPropList"); } @@ -150,7 +150,7 @@ class H5_DLLCPP FileAccPropList : public PropList { FileAccPropList(const hid_t plist_id); // Noop destructor - virtual ~FileAccPropList(); + virtual ~FileAccPropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 00ae0b1..65daf8f 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -78,7 +78,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("FileCreatPropList"); } @@ -91,7 +91,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { FileCreatPropList(const hid_t plist_id); // Noop destructor - virtual ~FileCreatPropList(); + virtual ~FileCreatPropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 6126eec..bdd7b84 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -117,7 +117,7 @@ class H5_DLLCPP H5File : public Group { virtual hid_t getId() const H5_OVERRIDE; // H5File destructor. - virtual ~H5File(); + virtual ~H5File() H5_OVERRIDE; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index c76be95..e8df757 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -36,7 +36,7 @@ class H5_DLLCPP FloatType : public AtomType { // Returns an FloatType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const; + virtual DataType *decode() const H5_OVERRIDE; // Retrieves the exponent bias of a floating-point type. size_t getEbias() const; @@ -64,7 +64,7 @@ class H5_DLLCPP FloatType : public AtomType { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("FloatType"); } @@ -79,7 +79,7 @@ class H5_DLLCPP FloatType : public AtomType { FloatType(const FloatType &original); // Noop destructor. - virtual ~FloatType(); + virtual ~FloatType() H5_OVERRIDE; }; // end of FloatType } // namespace H5 diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 185c8f0..f0f30ac 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -36,7 +36,7 @@ class H5_DLLCPP IntType : public AtomType { // Returns an IntType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const; + virtual DataType *decode() const H5_OVERRIDE; // Retrieves the sign type for an integer type H5T_sign_t getSign() const; @@ -46,7 +46,7 @@ class H5_DLLCPP IntType : public AtomType { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("IntType"); } @@ -61,7 +61,7 @@ class H5_DLLCPP IntType : public AtomType { IntType(const IntType &original); // Noop destructor. - virtual ~IntType(); + virtual ~IntType() H5_OVERRIDE; }; // end of IntType } // namespace H5 diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h index 4fa516c..65a9673 100644 --- a/c++/src/H5LaccProp.h +++ b/c++/src/H5LaccProp.h @@ -32,7 +32,7 @@ class H5_DLLCPP LinkAccPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("LinkAccPropList"); } @@ -52,7 +52,7 @@ class H5_DLLCPP LinkAccPropList : public PropList { size_t getNumLinks() const; // Noop destructor - virtual ~LinkAccPropList(); + virtual ~LinkAccPropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h index aea38e7..c0c66a4 100644 --- a/c++/src/H5LcreatProp.h +++ b/c++/src/H5LcreatProp.h @@ -32,7 +32,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("LinkCreatPropList"); } @@ -59,7 +59,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList { H5T_cset_t getCharEncoding() const; // Noop destructor - virtual ~LinkCreatPropList(); + virtual ~LinkCreatPropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h index 7f6d411..0aa825b 100644 --- a/c++/src/H5OcreatProp.h +++ b/c++/src/H5OcreatProp.h @@ -44,7 +44,7 @@ class H5_DLLCPP ObjCreatPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("ObjCreatPropList"); } @@ -57,7 +57,7 @@ class H5_DLLCPP ObjCreatPropList : public PropList { ObjCreatPropList(const hid_t plist_id); // Noop destructor - virtual ~ObjCreatPropList(); + virtual ~ObjCreatPropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index b40d2b3..c4ac6b2 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -29,7 +29,7 @@ class H5_DLLCPP PredType : public AtomType { public: ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("PredType"); } @@ -42,7 +42,7 @@ class H5_DLLCPP PredType : public AtomType { PredType(const PredType &original); // Noop destructor - virtual ~PredType(); + virtual ~PredType() H5_OVERRIDE; /*! \brief This dummy function do not inherit from DataType - it will throw a DataTypeIException if invoked. diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 12c8b4b..2df326b 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -38,7 +38,7 @@ class H5_DLLCPP PropList : public IdComponent { bool operator==(const PropList &rhs) const; // Close this property list. - virtual void close(); + virtual void close() H5_OVERRIDE; // Close a property list class. void closeClass() const; @@ -102,7 +102,7 @@ class H5_DLLCPP PropList : public IdComponent { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("PropList"); } @@ -114,10 +114,10 @@ class H5_DLLCPP PropList : public IdComponent { PropList(const PropList &original); // Gets the property list id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // Destructor: properly terminates access to this property list. - virtual ~PropList(); + virtual ~PropList() H5_OVERRIDE; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -128,7 +128,7 @@ class H5_DLLCPP PropList : public IdComponent { hid_t id; // HDF5 property list id // Sets the property list id. - virtual void p_setId(const hid_t new_id); + virtual void p_setId(const hid_t new_id) H5_OVERRIDE; private: static PropList *DEFAULT_; diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index d272c53..3e4013a 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -42,7 +42,7 @@ class H5_DLLCPP StrType : public AtomType { // Returns an StrType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const; + virtual DataType *decode() const H5_OVERRIDE; // Retrieves the character set type of this string datatype. H5T_cset_t getCset() const; @@ -58,7 +58,7 @@ class H5_DLLCPP StrType : public AtomType { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("StrType"); } @@ -73,7 +73,7 @@ class H5_DLLCPP StrType : public AtomType { StrType(const StrType &original); // Noop destructor. - virtual ~StrType(); + virtual ~StrType() H5_OVERRIDE; }; // end of StrType } // namespace H5 diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index f767e0e..583b9cd 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -33,11 +33,11 @@ class H5_DLLCPP VarLenType : public DataType { // Returns an VarLenType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const; + virtual DataType *decode() const H5_OVERRIDE; ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("VarLenType"); } @@ -53,7 +53,7 @@ class H5_DLLCPP VarLenType : public DataType { VarLenType(const H5Location &loc, const H5std_string &name); // Noop destructor - virtual ~VarLenType(); + virtual ~VarLenType() H5_OVERRIDE; // Default constructor VarLenType(); -- cgit v0.12 From 3707675c0376e3866bc6eb7b926c9e7e2f9b3bec Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 21 Apr 2021 11:23:34 -0500 Subject: Update top-level COPYING file and remove COPYING files from subdirectories (#561) * Modify temporary rpath for testing in java example scripts. * Update URL in source file Copyright headers for web copy of COPYING (license) file. * Add release_docs/code-conventions.md file. * Add script to test h5py. * Fix script error. * Add file h5pytest.yml. * Test declaration of counter variables in for loops. * Committing clang-format changes * Committing clang-format changes * Added [] to line 126 of H5LTanalyze.l. Ran bin/genparser with flex v2.6.4 and Bison v3.0.4 on jelly. * Revert "Added [] to line 126 of H5LTanalyze.l." This reverts commit e4a9cee441efa75b16a8ee030c86189e186dd266. * Revert extra commits to match canonical develop. * Update top-level COPYING file and remove COPYING files from subdirectories. * Remove subdirectory COPYING files from MANIFEST. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- COPYING | 6 ++++++ MANIFEST | 18 ------------------ bin/COPYING | 13 ------------- c++/COPYING | 13 ------------- config/COPYING | 13 ------------- fortran/COPYING | 13 ------------- hl/COPYING | 13 ------------- hl/c++/COPYING | 13 ------------- hl/fortran/COPYING | 13 ------------- hl/src/COPYING | 13 ------------- hl/test/COPYING | 13 ------------- hl/tools/COPYING | 13 ------------- java/COPYING | 13 ------------- release_docs/COPYING | 13 ------------- src/COPYING | 13 ------------- test/COPYING | 13 ------------- testpar/COPYING | 13 ------------- tools/COPYING | 13 ------------- tools/test/perform/COPYING | 13 ------------- utils/COPYING | 12 ------------ 20 files changed, 6 insertions(+), 251 deletions(-) delete mode 100755 bin/COPYING delete mode 100644 c++/COPYING delete mode 100644 config/COPYING delete mode 100644 fortran/COPYING delete mode 100644 hl/COPYING delete mode 100644 hl/c++/COPYING delete mode 100644 hl/fortran/COPYING delete mode 100644 hl/src/COPYING delete mode 100644 hl/test/COPYING delete mode 100644 hl/tools/COPYING delete mode 100644 java/COPYING delete mode 100644 release_docs/COPYING delete mode 100644 src/COPYING delete mode 100644 test/COPYING delete mode 100644 testpar/COPYING delete mode 100644 tools/COPYING delete mode 100644 tools/test/perform/COPYING delete mode 100644 utils/COPYING diff --git a/COPYING b/COPYING index da64ef8..9d32232 100644 --- a/COPYING +++ b/COPYING @@ -67,6 +67,12 @@ under Prime Contract No. DE-AC02-05CH11231. ----------------------------------------------------------------------------- +Portions of HDF5 were developed with support from Lawrence Livermore +National Laboratory and the United States Department of Energy under +Prime Contract No. DE-AC52-07NA27344. + +----------------------------------------------------------------------------- + Portions of HDF5 were developed with support from the University of California, Lawrence Livermore National Laboratory (UC LLNL). The following statement applies to those portions of the product and must diff --git a/MANIFEST b/MANIFEST index fb43579..9b0ce1c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -63,7 +63,6 @@ ./m4/ax_try_compile_java.m4 ./m4/ax_try_run_java.m4 -./bin/COPYING ./bin/bbrelease _DO_NOT_DISTRIBUTE_ ./bin/buildhdf5 ./bin/checkapi _DO_NOT_DISTRIBUTE_ @@ -122,7 +121,6 @@ ./bin/pkgscrpts/makeInternalREADME.pl _DO_NOT_DISTRIBUTE_ ./bin/pkgscrpts/makeOuterREADME.pl _DO_NOT_DISTRIBUTE_ -./config/COPYING ./config/BlankForm ./config/apple ./config/cce-fflags @@ -283,7 +281,6 @@ # #------------------------------------------------------------------------------ -./fortran/COPYING ./fortran/Makefile.am ./fortran/robodoc.rc @@ -415,7 +412,6 @@ # #------------------------------------------------------------------------------ -./c++/COPYING ./c++/Makefile.am ./c++/examples/chunks.cpp @@ -546,7 +542,6 @@ # #------------------------------------------------------------------------------ -./release_docs/COPYING ./release_docs/HISTORY-1_0-1_8_0_rc3.txt ./release_docs/HISTORY-1_8_0-1_10_0.txt ./release_docs/HISTORY-1_10_0-1_12_0.txt @@ -569,7 +564,6 @@ ./src/hdf5.lnt _DO_NOT_DISTRIBUTE_ ./src/hdf5-win.lnt _DO_NOT_DISTRIBUTE_ ./src/hdf5-lin.lnt _DO_NOT_DISTRIBUTE_ -./src/COPYING ./src/H5.c ./src/H5checksum.c ./src/H5dbg.c @@ -1076,7 +1070,6 @@ ./src/H5win32defs.h ./test/AtomicWriterReader.txt -./test/COPYING ./test/H5srcdir.h ./test/H5srcdir_str.h.in ./test/Makefile.am @@ -1437,7 +1430,6 @@ ./test/testfiles/plist_files/strcpl_64be ./test/testfiles/plist_files/strcpl_64le -./testpar/COPYING ./testpar/Makefile.am ./testpar/t_bigio.c ./testpar/t_cache.c @@ -1469,7 +1461,6 @@ ./testpar/testphdf5.c ./testpar/testphdf5.h -./tools/COPYING ./tools/Makefile.am ./tools/src/Makefile.am ./tools/test/Makefile.am @@ -2893,7 +2884,6 @@ ./tools/testfiles/h5mkgrp_single_p.ls ./tools/testfiles/h5mkgrp_single_l.ls -./tools/test/perform/COPYING ./tools/test/perform/Makefile.am ./tools/test/perform/build_h5perf_alone.sh ./tools/test/perform/build_h5perf_serial_alone.sh @@ -2918,7 +2908,6 @@ ./tools/test/perform/zip_perf.c # Utils directory -./utils/COPYING ./utils/Makefile.am # Mirror VFD utilities @@ -2930,7 +2919,6 @@ ./utils/mirror_vfd/mirror_writer.c # high level libraries -./hl/COPYING ./hl/Makefile.am ./hl/examples/Makefile.am ./hl/examples/ex_ds1.c @@ -2957,7 +2945,6 @@ ./hl/examples/ptExampleFL.c ./hl/examples/run-hl-ex.sh ./hl/examples/run-hlc-ex.sh.in -./hl/src/COPYING ./hl/src/Makefile.am ./hl/src/H5DO.c ./hl/src/H5DOpublic.h @@ -2986,7 +2973,6 @@ ./hl/src/H5TBprivate.h ./hl/src/H5TBpublic.h ./hl/src/hdf5_hl.h -./hl/test/COPYING ./hl/test/H5srcdir_str.h.in ./hl/test/Makefile.am ./hl/test/dsdata.txt @@ -3022,7 +3008,6 @@ ./hl/test/usa.wri # tools -./hl/tools/COPYING ./hl/tools/Makefile.am ./hl/tools/gif2h5/Makefile.am ./hl/tools/gif2h5/decompress.c @@ -3087,7 +3072,6 @@ ./hl/tools/testfiles/w-help1.ddl # hl fortran -./hl/fortran/COPYING ./hl/fortran/Makefile.am ./hl/fortran/examples/Makefile.am ./hl/fortran/examples/run-hlfortran-ex.sh.in @@ -3112,7 +3096,6 @@ ./hl/fortran/test/tsttable.F90 # hl c++ -./hl/c++/COPYING ./hl/c++/Makefile.am ./hl/c++/examples/Makefile.am ./hl/c++/examples/ptExampleFL.cpp @@ -3125,7 +3108,6 @@ ./hl/c++/test/Makefile.am # java -./java/COPYING ./java/Makefile.am ./java/CMakeLists.txt diff --git a/bin/COPYING b/bin/COPYING deleted file mode 100755 index 97969da..0000000 --- a/bin/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/c++/COPYING b/c++/COPYING deleted file mode 100644 index 97969da..0000000 --- a/c++/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/config/COPYING b/config/COPYING deleted file mode 100644 index 97969da..0000000 --- a/config/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/fortran/COPYING b/fortran/COPYING deleted file mode 100644 index 97969da..0000000 --- a/fortran/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/hl/COPYING b/hl/COPYING deleted file mode 100644 index 97969da..0000000 --- a/hl/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/hl/c++/COPYING b/hl/c++/COPYING deleted file mode 100644 index 97969da..0000000 --- a/hl/c++/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/hl/fortran/COPYING b/hl/fortran/COPYING deleted file mode 100644 index 97969da..0000000 --- a/hl/fortran/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/hl/src/COPYING b/hl/src/COPYING deleted file mode 100644 index 97969da..0000000 --- a/hl/src/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/hl/test/COPYING b/hl/test/COPYING deleted file mode 100644 index 97969da..0000000 --- a/hl/test/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/hl/tools/COPYING b/hl/tools/COPYING deleted file mode 100644 index 97969da..0000000 --- a/hl/tools/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/java/COPYING b/java/COPYING deleted file mode 100644 index 97969da..0000000 --- a/java/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/release_docs/COPYING b/release_docs/COPYING deleted file mode 100644 index 97969da..0000000 --- a/release_docs/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/COPYING b/src/COPYING deleted file mode 100644 index 97969da..0000000 --- a/src/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/test/COPYING b/test/COPYING deleted file mode 100644 index 97969da..0000000 --- a/test/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/testpar/COPYING b/testpar/COPYING deleted file mode 100644 index 97969da..0000000 --- a/testpar/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/tools/COPYING b/tools/COPYING deleted file mode 100644 index 97969da..0000000 --- a/tools/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/tools/test/perform/COPYING b/tools/test/perform/COPYING deleted file mode 100644 index 97969da..0000000 --- a/tools/test/perform/COPYING +++ /dev/null @@ -1,13 +0,0 @@ - - Copyright by The HDF Group and - The Board of Trustees of the University of Illinois. - All rights reserved. - - The files and subdirectories in this directory are 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/utils/COPYING b/utils/COPYING deleted file mode 100644 index 9cec22f..0000000 --- a/utils/COPYING +++ /dev/null @@ -1,12 +0,0 @@ - - Copyright by The HDF Group. - All rights reserved. - - The files and subdirectories in this directory are 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. - -- cgit v0.12 From cb7a0e13b8b5641d1e6ba31c5f70146b17bd77df Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Thu, 22 Apr 2021 08:01:55 -0500 Subject: Fix set_tests_properties for parallel t_pflush tests (#569) --- testpar/CMakeVFDTests.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 32f9337..5fac4ea 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -58,9 +58,9 @@ macro (ADD_VFD_TEST vfdname resultcode) WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} ) endforeach () - set_tests_properties (MPI_TEST_VFD-${vfdname}-pflush1 PROPERTIES WILL_FAIL "true") + set_tests_properties (MPI_TEST_VFD-${vfdname}-t_pflush1 PROPERTIES WILL_FAIL "true") #set_property (TEST MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") - set_tests_properties (MPI_TEST_VFD-${vfdname}-pflush2 PROPERTIES DEPENDS MPI_TEST_VFD-${vfdname}-pflush1) + set_tests_properties (MPI_TEST_VFD-${vfdname}-t_pflush2 PROPERTIES DEPENDS MPI_TEST_VFD-${vfdname}-t_pflush1) endif () endmacro () -- cgit v0.12 From 12082e728de7481144db7ea3cca6f38acf0a7cac Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 23 Apr 2021 21:22:29 -0500 Subject: CMake changes to byproducts - ninja warnings (#568) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- CMakeInstallation.cmake | 3 +- fortran/src/CMakeLists.txt | 43 +++++++-------- fortran/test/CMakeLists.txt | 14 ++--- hl/fortran/src/CMakeLists.txt | 12 ++--- src/CMakeLists.txt | 118 +++++++++++++++++++++--------------------- test/ShellTests.cmake | 4 ++ 6 files changed, 98 insertions(+), 96 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index bff0c49..d811ea5 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -205,7 +205,6 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) if (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs") set (release_files ${HDF5_SOURCE_DIR}/release_docs/USING_HDF5_CMake.txt - ${HDF5_SOURCE_DIR}/release_docs/COPYING ${HDF5_SOURCE_DIR}/release_docs/RELEASE.txt ) if (WIN32) @@ -263,9 +262,9 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}") set (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}") set (CPACK_PACKAGE_VERSION_PATCH "") + set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") if (EXISTS "${HDF5_SOURCE_DIR}/release_docs") set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") - set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") endif () set (CPACK_PACKAGE_RELOCATABLE TRUE) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 37b5157..258efe8 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -73,22 +73,20 @@ add_executable (H5match_types ) target_include_directories (H5match_types PRIVATE "${HDF5_SRC_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 +add_custom_command (TARGET H5match_types POST_BUILD + BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} DEPENDS H5match_types ) if (NOT ONLY_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + add_custom_command (TARGET H5match_types POST_BUILD + BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) @@ -96,13 +94,12 @@ if (NOT ONLY_SHARED_LIBS) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) endif () if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 + add_custom_command (TARGET H5match_types POST_BUILD + BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) @@ -210,39 +207,39 @@ set (f90_F_GEN_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90 ) -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/H5_gen.F90 +add_custom_command (TARGET H5_buildiface POST_BUILD + BYPRODUCTS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} DEPENDS ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 file" ) if (NOT ONLY_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + add_custom_command (TARGET H5_buildiface POST_BUILD + BYPRODUCTS H5_gen.F90 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/static/H5_gen.F90" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMENT "Generating the H5_gen.F90 file" ) add_custom_target (H5gen ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) endif () if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 + add_custom_command (TARGET H5_buildiface POST_BUILD + BYPRODUCTS H5_gen.F90 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMENT "Generating the H5_gen.F90 shared file" ) add_custom_target (H5genSH ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 + DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 PROPERTIES GENERATED TRUE) endif () diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 40aef6d..147746c 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -91,27 +91,27 @@ if (HDF5_ENABLE_FORMATTERS) endif () if (NOT BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + add_custom_command (TARGET H5_test_buildiface POST_BUILD + BYPRODUCTS tf_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static DEPENDS H5_test_buildiface - COMMENT "Generating the tf_gen.F90 file" + COMMENT "Generating the tf_gen.F90 static file" ) add_custom_target (H5testgen ALL - DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + DEPENDS H5_test_buildiface ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 ) set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) else () - add_custom_command ( - OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 + add_custom_command (TARGET H5_test_buildiface POST_BUILD + BYPRODUCTS tf_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 shared file" ) add_custom_target (H5testgenSH ALL - DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 + DEPENDS H5_test_buildiface ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 ) set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) endif () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 0b7795b..38529b4 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -114,15 +114,15 @@ set (HDF5_HL_F90_F_BASE_SOURCES ) if (NOT ONLY_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + add_custom_command (TARGET H5HL_buildiface POST_BUILD + BYPRODUCTS $H5LTff_gen.F90 H5TBff_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" ) add_custom_target (H5HLgen ALL - DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + DEPENDS H5HL_buildiface ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 ) set_source_files_properties ( ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 @@ -131,15 +131,15 @@ if (NOT ONLY_SHARED_LIBS) ) endif () if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 + add_custom_command (TARGET H5HL_buildiface POST_BUILD + BYPRODUCTS H5LTff_gen.F90 H5TBff_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/shared DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files" ) add_custom_target (H5HLgenSH ALL - DEPENDS ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 + DEPENDS H5HL_buildiface ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 ) set_source_files_properties ( ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a07122d..0c92bb2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1051,7 +1051,9 @@ if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$,$>:ws2_32.lib> - PRIVATE $<$:"-O0"> + ) + target_compile_options(H5detect + PRIVATE "$<$:-O0>" ) if (HDF5_BATCH_H5DETECT) @@ -1060,77 +1062,68 @@ if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY ) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - COMMAND ${HDF5_BATCH_CMD} - ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} - COMMAND ${CMAKE_COMMAND} - ARGS -E echo "Executed batch command to create H5Tinit.c" + OUTPUT gen_SRCS.stamp1 + COMMAND ${HDF5_BATCH_CMD} + ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} + BYPRODUCTS H5Tinit.c gen_SRCS.stamp1 + COMMAND ${CMAKE_COMMAND} + ARGS -E echo "Executed batch command to create H5Tinit.c" COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 + ARGS -E touch gen_SRCS.stamp1 DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) add_custom_target (gen_H5Tinit COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/wait_H5Tinit.cmake ) - if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" - COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 - DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) - endif () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) else () - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + add_custom_command (TARGET H5detect POST_BUILD + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ARGS H5Tinit.c + BYPRODUCTS H5Tinit.c gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 + ARGS -E touch gen_SRCS.stamp1 DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + COMMENT "Create H5Tinit.c" ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 + add_custom_command (TARGET H5detect POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + ARGS -E copy_if_different H5Tinit.c shared/H5Tinit.c + BYPRODUCTS shared/H5Tinit.c shared/shared_gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 - DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS -E touch shared/shared_gen_SRCS.stamp1 + DEPENDS H5detect H5Tinit.c WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + COMMENT "Copy H5Tinit.c to shared folder" ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () endif () - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) else () add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 + OUTPUT gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS -E touch gen_SRCS.stamp1 + DEPENDS H5Tinit.c WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + COMMENT "Touch existing H5Tinit.c" ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 + OUTPUT shared/shared_gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + ARGS -E copy_if_different H5Tinit.c shared/H5Tinit.c + BYPRODUCTS shared/H5Tinit.c shared/shared_gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 - DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS -E touch shared/shared_gen_SRCS.stamp1 + DEPENDS H5Tinit.c WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + COMMENT "Copy existing H5Tinit.c to shared folder" ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () @@ -1149,7 +1142,9 @@ target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_ TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$,$>:ws2_32.lib> - PRIVATE $<$:"-O0"> +) +target_compile_options(H5make_libsettings + PRIVATE "$<$:-O0>" ) #----------------------------------------------------------------------------- @@ -1159,27 +1154,27 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_SRC_LIBSETTINGS_FORMAT H5make_libsettings) endif () -add_custom_command ( - OUTPUT ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c - ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ - ARGS ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c +add_custom_command (TARGET H5make_libsettings POST_BUILD + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ARGS H5lib_settings.c + BYPRODUCTS H5lib_settings.c gen_SRCS.stamp2 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2 + ARGS -E touch gen_SRCS.stamp2 DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_SRC_BINARY_DIR} + COMMENT "Create H5lib_settings.c" ) set_source_files_properties (${HDF5_SRC_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c - ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2 + add_custom_command (TARGET H5make_libsettings POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_SRC_BINARY_DIR}/H5lib_settings.c" "${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c" + ARGS -E copy_if_different H5lib_settings.c shared/H5lib_settings.c + BYPRODUCTS shared/H5lib_settings.c shared/shared_gen_SRCS.stamp2 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2 - DEPENDS ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c + ARGS -E touch shared/shared_gen_SRCS.stamp2 + DEPENDS H5make_libsettings H5lib_settings.c WORKING_DIRECTORY ${HDF5_SRC_BINARY_DIR} + COMMENT "Copy H5lib_settings.c to shared folder" ) set_source_files_properties (${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () @@ -1193,7 +1188,10 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- if (NOT ONLY_SHARED_LIBS) set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c) - add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) + add_custom_target (gen_${HDF5_LIB_TARGET} ALL + DEPENDS H5make_libsettings ${gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2 + COMMENT "Generation target files" + ) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIB_TARGET} @@ -1229,7 +1227,10 @@ endif () if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c) - add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2) + add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL + DEPENDS H5make_libsettings ${shared_gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2 + COMMENT "Shared generation target files" + ) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIBSH_TARGET} @@ -1373,7 +1374,7 @@ if (DOXYGEN_FOUND) 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}/shared") + 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) @@ -1383,6 +1384,7 @@ if (DOXYGEN_FOUND) 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 ) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 4d23de3..b28bbd6 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -197,18 +197,22 @@ if (UNIX) # testvdsswmr.sh: vds_swmr* add_test (H5SHELL-testflushrefresh ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh) set_tests_properties (H5SHELL-testflushrefresh PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (H5SHELL-test_usecases ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh) set_tests_properties (H5SHELL-test_usecases PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (H5SHELL-testswmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.sh) set_tests_properties (H5SHELL-testswmr PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (H5SHELL-testvdsswmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh) set_tests_properties (H5SHELL-testvdsswmr PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -- cgit v0.12 From 1d680fe04c545d601678d876ad22dea7bfc31edd Mon Sep 17 00:00:00 2001 From: Gerd Heber Date: Mon, 26 Apr 2021 14:07:29 -0500 Subject: Merge doxygen2 into develop (#553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed warnings and started H5Epublic.h. * Include H5FD* headers to correctly resolve references. * Doxygen2 (#330) * H5Eauto_is_v2. * Added a few more calls. * Added a few more H5E calls. * First cut of H5E v2. * Added the deprecated v1 calls. * Updated spacing. * Once more. * Taking some inspiration from Eigen3. * Add doxygen for the assigned functions: H5Pregister1,H5Pinsert1,H5Pen… (#352) * Add doxygen for the assigned functions: H5Pregister1,H5Pinsert1,H5Pencode1, H5Pget_filter_by_id1,H5Pget_version, H5Pset_file_space,H5Pget_file_space. Someone already adds H5Pget_filter1. Also fixs an extra parameter 'close' call back function for HPregister2. * doxygen work. fixs format by using clang-format. * doxgen work for H5Pregister1 etc. Addressed Barbara and Gerd's comments. For Quincey's comments, since we are not supposed to change the source code. I leave this to future improvements. * added documentation for H5P APIs (#350) * add documenation for H5Pget_buffer,H5Pget_data_transform,H5Pget_edc_check,H5Pget_hyper_vector_size,H5Pget_preserve,H5Pget_type_conv_cb,H5Pget_vlen_mem_manager,H5Pset_btree_ratios * format corrections * fixed grammer * fixed herr_t * Better name. * A fresh look. * add doxygen to H5Ppublic.h * use attention instead of warning * Add doxygen comments in H5Ppublic.h (#375) * Add doxygen comments in H5Ppublic.h * H5Pset_meta_block_size * H5Pset_metadata_read_attempts * H5Pset_multi_type * H5Pset_object_flush_cb * H5Pset_sieve_buf_size * H5Pset_small_data_block_size * H5Pset_all_coll_metadata_ops * H5Pget_all_coll_metadata_ops * Add DOXYGEN_EXAMPLES_DIR to src/CMakeLists.txt * Fix clang-format errors * Fix filenames in doxygen/examples * add doxygen to H5Ppublic.h (#378) * add doxygen to H5Ppublic.h * use attention instead of warning Co-authored-by: Kimmy Mu * Revert "add doxygen to H5Ppublic.h (#378)" This reverts commit 2ee1821b138a5c00b15ea57ce9e950367480f5f2. * Updated Doxygen variables. * I forgot to copy two images. * Enable desktop search by default. * Add my assigned Doxygen documentation. * Remove whitespace at EOL. Appease clang-format. * Addressed Chris' comments. * Added an alias for asynchronous functions. * One space is enough for all of us. * Slightly restructured RM page. * address some issues * reformatting * Style external links. * reformatting * reformatting * Added "Metadata Caching in HDF5" as a technical note example. * Revise this soon! * Added specification examples. * Fixed references. * Added H5AC cache image stuff and file format study. * Added older FMT versions. Where did 1.0 go? * Updated C/C++ note and replaced ambiguous labels. * Reformat source with clang v10.0.1. * Added the VFL technical note. * Added what I believe might be called version 1.0 of the format. * Added the remaining specs. * Added H5Z callback documentation and fixed a few mistakes. * Added dox for deprecated H5G calls and fixed a few snippet blockIDs. * clang-format happy? * Ok? * Bonus track: Deprecated H5D functions. * Carry over the more detailed group description. * Added documentation for the missing and deprecated H5R calls. * Life is easier and less repetitive w/ snippets. Use them! * Eliminate the snippet block ID artifacts in the HTML rendering. * Fixed snippet HTML artifacts and added a few missing calls. * Under 20 H5Ps to go! * Almost complete! * "This is a form of pedantry up with which I will not put." (Churchill) * Let's not waste as much space on bulleted lists! * First complete (?) draft of the Doxygen-based RM. * Completeness check and minor fixes along the way. * Pedantry. * Adding missing H5FD calls checkpoint. * Pedantry. * More pedantry. * Added H5Pset_fapl_log. * First draft of H5ES. * Fixed warnings. * Prep. for map module. * First cut of the map module. * Pedantry. * Possible H5F introduction. * Fix the indentation. * Pedantry. * Ditto. * Thanks to the reviewers for their comments. * Added missing images. * Line numbers are a distraction here. * More examples, references, and clean-up. Don't repeat yourself! * Clang pedantry. * Ditto. * More reviewer comments... * Templatized references and cleaned up \todos. * Committing clang-format changes * Fixed MANIFEST. * Addressed Quincey's comments. (OCPLs) * Fixed a few more \todo items. * Fixed more \todo items. * Added attribute life cycle. * Forgot the examples file. * Committing clang-format changes * Pedantry. * Live and learn! * Added a sample H5D life cycle. * Committing clang-format changes * Pedantry. Co-authored-by: kyang2014 Co-authored-by: Scot Breitenfeld Co-authored-by: Kimmy Mu Co-authored-by: Christopher Hogan Co-authored-by: jya-kmu <53388330+jya-kmu@users.noreply.github.com> Co-authored-by: David Young Co-authored-by: Larry Knox Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 50 +- configure.ac | 24 +- doxygen/Doxyfile.in | 35 +- doxygen/aliases | 63 +- doxygen/dox/About.dox | 11 + doxygen/dox/Cookbook.dox | 5 + doxygen/dox/DDLBNF110.dox | 650 + doxygen/dox/DDLBNF112.dox | 653 + doxygen/dox/FileFormatSpec.dox | 23 + doxygen/dox/GettingStarted.dox | 3 + doxygen/dox/H5Fget_info.dox | 7 +- doxygen/dox/H5Lget_info.dox | 5 +- doxygen/dox/H5Lget_info_by_idx.dox | 5 +- doxygen/dox/H5Literate.dox | 4 +- doxygen/dox/H5Literate_by_name.dox | 4 +- doxygen/dox/H5Lvisit.dox | 4 +- doxygen/dox/H5Lvisit_by_name.dox | 4 +- doxygen/dox/MetadataCachingInHDF5.dox | 1020 + doxygen/dox/OtherSpecs.dox | 11 + doxygen/dox/Overview.dox | 32 + doxygen/dox/ReferenceManual.dox | 43 + doxygen/dox/Specifications.dox | 22 + doxygen/dox/TechnicalNotes.dox | 20 + doxygen/dox/api-compat-macros.dox | 1 - doxygen/dox/mainpage.dox | 44 - doxygen/dox/maybe_metadata_reads.dox | 82 + doxygen/examples/FF-IH_FileGroup.gif | Bin 0 -> 3407 bytes doxygen/examples/FF-IH_FileObject.gif | Bin 0 -> 2136 bytes doxygen/examples/FileFormatSpecChunkDiagram.jpg | Bin 0 -> 29237 bytes doxygen/examples/H5.format.1.0.html | 4050 ++++ doxygen/examples/H5.format.1.1.html | 6439 ++++++ doxygen/examples/H5.format.2.0.html | 14902 ++++++++++++++ doxygen/examples/H5.format.html | 20400 +++++++++++++++++++ doxygen/examples/H5A_examples.c | 145 + doxygen/examples/H5D_examples.c | 173 + doxygen/examples/H5F_examples.c | 187 + doxygen/examples/H5Pget_metadata_read_attempts.1.c | 22 + doxygen/examples/H5Pget_metadata_read_attempts.2.c | 44 + doxygen/examples/H5Pget_metadata_read_attempts.3.c | 44 + doxygen/examples/H5Pget_object_flush_cb.c | 41 + doxygen/examples/H5Pset_metadata_read_attempts.c | 59 + doxygen/examples/H5Pset_object_flush_cb.c | 41 + doxygen/examples/ImageSpec.html | 1203 ++ doxygen/examples/PaletteExample1.gif | Bin 0 -> 2731 bytes doxygen/examples/Palettes.fm.anc.gif | Bin 0 -> 4748 bytes doxygen/examples/TableSpec.html | 193 + doxygen/examples/ThreadSafeLibrary.html | 787 + doxygen/examples/VFL.html | 1601 ++ doxygen/hdf5_footer.html | 21 + doxygen/hdf5_header.html | 61 + doxygen/hdf5_navtree_hacks.js | 246 + doxygen/hdf5doxy.css | 251 + doxygen/hdf5doxy_layout.xml | 182 + doxygen/img/FF-IH_FileGroup.gif | Bin 0 -> 3407 bytes doxygen/img/FF-IH_FileObject.gif | Bin 0 -> 2136 bytes doxygen/img/FileFormatSpecChunkDiagram.jpg | Bin 0 -> 29237 bytes doxygen/img/HDFG-logo.png | Bin 4541 -> 1689 bytes doxygen/img/PaletteExample1.gif | Bin 0 -> 2731 bytes doxygen/img/Palettes.fm.anc.gif | Bin 0 -> 4748 bytes doxygen/img/ftv2node.png | Bin 0 -> 86 bytes doxygen/img/ftv2pnode.png | Bin 0 -> 229 bytes src/CMakeLists.txt | 1 + src/H5ACpublic.h | 343 +- src/H5Amodule.h | 40 +- src/H5Apublic.h | 193 +- src/H5Cpublic.h | 23 +- src/H5Dmodule.h | 38 +- src/H5Dpublic.h | 415 +- src/H5ESmodule.h | 33 + src/H5ESpublic.h | 167 +- src/H5Emodule.h | 29 + src/H5Epublic.h | 788 +- src/H5FDcore.h | 64 +- src/H5FDdirect.h | 63 +- src/H5FDfamily.h | 52 +- src/H5FDhdfs.h | 14 +- src/H5FDlog.h | 405 +- src/H5FDmirror.h | 14 +- src/H5FDmpi.h | 8 +- src/H5FDmpio.h | 225 +- src/H5FDmulti.h | 219 +- src/H5FDpublic.h | 88 +- src/H5FDros3.h | 14 +- src/H5FDsplitter.h | 14 +- src/H5FDstdio.h | 16 +- src/H5FDwindows.h | 30 + src/H5Fmodule.h | 30 +- src/H5Fpublic.h | 588 +- src/H5Gmodule.h | 91 +- src/H5Gpublic.h | 826 +- src/H5Ipublic.h | 22 +- src/H5Lmodule.h | 2 + src/H5Lpublic.h | 76 +- src/H5MMpublic.h | 5 + src/H5Mmodule.h | 45 + src/H5Mpublic.h | 373 +- src/H5Opublic.h | 227 +- src/H5PLpublic.h | 6 +- src/H5Pmodule.h | 5 +- src/H5Ppublic.h | 3246 ++- src/H5Rpublic.h | 492 +- src/H5Spublic.h | 8 +- src/H5Tmodule.h | 4 - src/H5Tpublic.h | 114 +- src/H5VLconnector.h | 9 +- src/H5VLmodule.h | 4 + src/H5VLpublic.h | 14 +- src/H5Zmodule.h | 8 +- src/H5Zpublic.h | 145 +- src/H5public.h | 150 +- 110 files changed, 61921 insertions(+), 1782 deletions(-) create mode 100644 doxygen/dox/About.dox create mode 100644 doxygen/dox/Cookbook.dox create mode 100644 doxygen/dox/DDLBNF110.dox create mode 100644 doxygen/dox/DDLBNF112.dox create mode 100644 doxygen/dox/FileFormatSpec.dox create mode 100644 doxygen/dox/GettingStarted.dox create mode 100644 doxygen/dox/MetadataCachingInHDF5.dox create mode 100644 doxygen/dox/OtherSpecs.dox create mode 100644 doxygen/dox/Overview.dox create mode 100644 doxygen/dox/ReferenceManual.dox create mode 100644 doxygen/dox/Specifications.dox create mode 100644 doxygen/dox/TechnicalNotes.dox delete mode 100644 doxygen/dox/mainpage.dox create mode 100644 doxygen/dox/maybe_metadata_reads.dox create mode 100644 doxygen/examples/FF-IH_FileGroup.gif create mode 100644 doxygen/examples/FF-IH_FileObject.gif create mode 100644 doxygen/examples/FileFormatSpecChunkDiagram.jpg create mode 100644 doxygen/examples/H5.format.1.0.html create mode 100644 doxygen/examples/H5.format.1.1.html create mode 100644 doxygen/examples/H5.format.2.0.html create mode 100644 doxygen/examples/H5.format.html create mode 100644 doxygen/examples/H5A_examples.c create mode 100644 doxygen/examples/H5D_examples.c create mode 100644 doxygen/examples/H5F_examples.c create mode 100644 doxygen/examples/H5Pget_metadata_read_attempts.1.c create mode 100644 doxygen/examples/H5Pget_metadata_read_attempts.2.c create mode 100644 doxygen/examples/H5Pget_metadata_read_attempts.3.c create mode 100644 doxygen/examples/H5Pget_object_flush_cb.c create mode 100644 doxygen/examples/H5Pset_metadata_read_attempts.c create mode 100644 doxygen/examples/H5Pset_object_flush_cb.c create mode 100644 doxygen/examples/ImageSpec.html create mode 100644 doxygen/examples/PaletteExample1.gif create mode 100644 doxygen/examples/Palettes.fm.anc.gif create mode 100644 doxygen/examples/TableSpec.html create mode 100644 doxygen/examples/ThreadSafeLibrary.html create mode 100644 doxygen/examples/VFL.html create mode 100644 doxygen/hdf5_footer.html create mode 100644 doxygen/hdf5_header.html create mode 100644 doxygen/hdf5_navtree_hacks.js create mode 100644 doxygen/hdf5doxy.css create mode 100644 doxygen/hdf5doxy_layout.xml create mode 100644 doxygen/img/FF-IH_FileGroup.gif create mode 100644 doxygen/img/FF-IH_FileObject.gif create mode 100644 doxygen/img/FileFormatSpecChunkDiagram.jpg create mode 100644 doxygen/img/PaletteExample1.gif create mode 100644 doxygen/img/Palettes.fm.anc.gif create mode 100644 doxygen/img/ftv2node.png create mode 100644 doxygen/img/ftv2pnode.png diff --git a/MANIFEST b/MANIFEST index 9b0ce1c..f7a4983 100644 --- a/MANIFEST +++ b/MANIFEST @@ -207,7 +207,12 @@ ./doxygen/aliases ./doxygen/Doxyfile.in -./doxygen/dox/api-compat-macros.dox +./doxygen/dox/About.dox +./doxygen/dox/Cookbook.dox +./doxygen/dox/DDLBNF110.dox +./doxygen/dox/DDLBNF112.dox +./doxygen/dox/FileFormatSpec.dox +./doxygen/dox/GettingStarted.dox ./doxygen/dox/H5AC_cache_config_t.dox ./doxygen/dox/H5Acreate.dox ./doxygen/dox/H5Aiterate.dox @@ -224,12 +229,53 @@ ./doxygen/dox/H5Ovisit_by_name.dox ./doxygen/dox/H5Ovisit.dox ./doxygen/dox/H5Sencode.dox -./doxygen/dox/mainpage.dox +./doxygen/dox/MetadataCachingInHDF5.dox +./doxygen/dox/OtherSpecs.dox +./doxygen/dox/Overview.dox +./doxygen/dox/ReferenceManual.dox +./doxygen/dox/Specifications.dox +./doxygen/dox/TechnicalNotes.dox +./doxygen/dox/api-compat-macros.dox +./doxygen/dox/maybe_metadata_reads.dox ./doxygen/dox/rm-template.dox +./doxygen/examples/FF-IH_FileGroup.gif +./doxygen/examples/FF-IH_FileObject.gif +./doxygen/examples/FileFormatSpecChunkDiagram.jpg +./doxygen/examples/H5Pset_metadata_read_attempts.c +./doxygen/examples/H5Pset_object_flush_cb.c +./doxygen/examples/H5.format.1.0.html +./doxygen/examples/H5.format.1.1.html +./doxygen/examples/H5.format.2.0.html +./doxygen/examples/H5.format.html +./doxygen/examples/H5A_examples.c +./doxygen/examples/H5D_examples.c ./doxygen/examples/H5Fclose.c ./doxygen/examples/H5Fcreate.c +./doxygen/examples/H5F_examples.c +./doxygen/examples/H5Pget_metadata_read_attempts.1.c +./doxygen/examples/H5Pget_metadata_read_attempts.2.c +./doxygen/examples/H5Pget_metadata_read_attempts.3.c +./doxygen/examples/H5Pget_object_flush_cb.c +./doxygen/examples/ImageSpec.html +./doxygen/examples/PaletteExample1.gif +./doxygen/examples/Palettes.fm.anc.gif +./doxygen/examples/TableSpec.html +./doxygen/examples/ThreadSafeLibrary.html +./doxygen/examples/VFL.html ./doxygen/examples/hello_hdf5.c +./doxygen/hdf5_footer.html +./doxygen/hdf5_header.html +./doxygen/hdf5_navtree_hacks.js +./doxygen/hdf5doxy.css +./doxygen/hdf5doxy_layout.xml +./doxygen/img/FF-IH_FileGroup.gif +./doxygen/img/FF-IH_FileObject.gif +./doxygen/img/FileFormatSpecChunkDiagram.jpg ./doxygen/img/HDFG-logo.png +./doxygen/img/PaletteExample1.gif +./doxygen/img/Palettes.fm.anc.gif +./doxygen/img/ftv2node.png +./doxygen/img/ftv2pnode.png ./examples/Attributes.txt ./examples/Makefile.am diff --git a/configure.ac b/configure.ac index d769ddc..b6694ad 100644 --- a/configure.ac +++ b/configure.ac @@ -95,12 +95,12 @@ AC_CONFIG_COMMANDS([pubconf], [ sed 's/#define /#define H5_/' pubconf if test ! -f src/H5pubconf.h; then - /bin/mv -f pubconf src/H5pubconf.h + mv -f pubconf src/H5pubconf.h elif (diff pubconf src/H5pubconf.h >/dev/null); then rm -f pubconf echo "src/H5pubconf.h is unchanged" else - /bin/mv -f pubconf src/H5pubconf.h + mv -f pubconf src/H5pubconf.h fi echo "Post process src/libhdf5.settings" sed '/^#/d' < src/libhdf5.settings > libhdf5.settings.TMP @@ -1116,16 +1116,34 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then AC_SUBST([DOXYGEN_OPTIMIZE_OUTPUT_FOR_C]) AC_SUBST([DOXYGEN_MACRO_EXPANSION]) AC_SUBST([DOXYGEN_OUTPUT_DIRECTORY]) + AC_SUBST([DOXYGEN_EXAMPLES_DIRECTORY]) + AC_SUBST([DOXYGEN_LAYOUT_FILE]) + AC_SUBST([DOXYGEN_HTML_HEADER]) + AC_SUBST([DOXYGEN_HTML_FOOTER]) + AC_SUBST([DOXYGEN_HTML_EXTRA_STYLESHEET]) + AC_SUBST([DOXYGEN_HTML_EXTRA_FILES]) + AC_SUBST([DOXYGEN_SERVER_BASED_SEARCH]) + AC_SUBST([DOXYGEN_EXTERNAL_SEARCH]) + AC_SUBST([DOXYGEN_SEARCHENGINE_URL]) DOXYGEN_PACKAGE=${PACKAGE_NAME} DOXYGEN_VERSION_STRING=${PACKAGE_VERSION} DOXYGEN_INCLUDE_ALIASES='$(SRCDIR)/doxygen/aliases' DOXYGEN_PROJECT_LOGO='$(SRCDIR)/doxygen/img/HDFG-logo.png' - DOXYGEN_PROJECT_BRIEF="C-API Reference" + DOXYGEN_PROJECT_BRIEF= DOXYGEN_INPUT_DIRECTORY='$(SRCDIR) $(SRCDIR)/doxygen/dox' DOXYGEN_OPTIMIZE_OUTPUT_FOR_C=YES DOXYGEN_MACRO_EXPANSION=YES DOXYGEN_OUTPUT_DIRECTORY=hdf5lib_docs + DOXYGEN_EXAMPLES_DIRECTORY='$(SRCDIR)/doxygen/examples' + DOXYGEN_LAYOUT_FILE='$(SRCDIR)/doxygen/hdf5doxy_layout.xml' + DOXYGEN_HTML_HEADER='$(SRCDIR)/doxygen/hdf5_header.html' + DOXYGEN_HTML_FOOTER='$(SRCDIR)/doxygen/hdf5_footer.html' + DOXYGEN_HTML_EXTRA_STYLESHEET='$(SRCDIR)/doxygen/hdf5doxy.css' + DOXYGEN_HTML_EXTRA_FILES='$(SRCDIR)/doxygen/hdf5_navtree_hacks.js $(SRCDIR)/doxygen/img/ftv2node.png $(SRCDIR)/doxygen/img/ftv2pnode.png' + DOXYGEN_SERVER_BASED_SEARCH=NO + DOXYGEN_EXTERNAL_SEARCH=NO + DOXYGEN_SEARCHENGINE_URL= DX_INIT_DOXYGEN([HDF5], [../doxygen/Doxyfile], [hdf5lib_docs]) diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in index 2395d6c..b1cb955 100644 --- a/doxygen/Doxyfile.in +++ b/doxygen/Doxyfile.in @@ -738,7 +738,7 @@ FILE_VERSION_FILTER = # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. -LAYOUT_FILE = +LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@ # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib @@ -855,7 +855,16 @@ INPUT_ENCODING = UTF-8 FILE_PATTERNS = H5*public.h \ H5*module.h \ + H5FDcore.h \ + H5FDdirect.h \ + H5FDfamily.h \ + H5FDlog.h \ + H5FDmpi.h \ H5FDmpio.h \ + H5FDmulti.h \ + H5FDsec2.h \ + H5FDstdio.h \ + H5FDwindows.h \ H5VLconnector.h \ H5VLconnector_passthru.h \ H5VLnative.h \ @@ -908,7 +917,7 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = ../src ../examples ../test examples +EXAMPLE_PATH = ../src ../examples ../test @DOXYGEN_EXAMPLES_DIRECTORY@ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -1169,7 +1178,7 @@ HTML_FILE_EXTENSION = .html # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_HEADER = +HTML_HEADER = @DOXYGEN_HTML_HEADER@ # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard @@ -1179,7 +1188,7 @@ HTML_HEADER = # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_FOOTER = +HTML_FOOTER = @DOXYGEN_HTML_FOOTER@ # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of @@ -1204,7 +1213,7 @@ HTML_STYLESHEET = # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_STYLESHEET = +HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@ # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note @@ -1214,7 +1223,7 @@ HTML_EXTRA_STYLESHEET = # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_FILES = +HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@ # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to @@ -1272,7 +1281,7 @@ HTML_DYNAMIC_MENUS = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_DYNAMIC_SECTIONS = NO +HTML_DYNAMIC_SECTIONS = YES # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand @@ -1484,7 +1493,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -DISABLE_INDEX = NO +DISABLE_INDEX = YES # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag @@ -1632,7 +1641,7 @@ MATHJAX_CODEFILE = # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. -SEARCHENGINE = NO +SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using JavaScript. There @@ -1644,7 +1653,7 @@ SEARCHENGINE = NO # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. -SERVER_BASED_SEARCH = YES +SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@ # When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP # script for searching. Instead the search results are written to an XML file @@ -1660,7 +1669,7 @@ SERVER_BASED_SEARCH = YES # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. -EXTERNAL_SEARCH = NO +EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@ # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will return the search results when EXTERNAL_SEARCH is enabled. @@ -1671,7 +1680,7 @@ EXTERNAL_SEARCH = NO # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. -SEARCHENGINE_URL = +SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@ # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed # search data is written to a file for indexing by an external tool. With the @@ -2168,7 +2177,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = +PREDEFINED = H5_HAVE_PARALLEL # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/doxygen/aliases b/doxygen/aliases index 2255c9b..af43902 100644 --- a/doxygen/aliases +++ b/doxygen/aliases @@ -1,3 +1,5 @@ +ALIASES += THG="The HDF Group" + ################################################################################ # Styling ################################################################################ @@ -35,6 +37,15 @@ ALIASES += op{1}="\param[in] \1 Callback function" ALIASES += op_data="\param[in,out] op_data User-defined callback function context" ALIASES += op_data{1}="\param[in,out] \1 User-defined callback function context" +ALIASES += op_data_in="\param[in] op_data User-defined callback function context" +ALIASES += op_data_in{1}="\param[in] \1 User-defined callback function context" + +################################################################################ +# Asynchronous +################################################################################ + +ALIASES += async_variant_of{1}="Asynchronous version of \1()" + ################################################################################ # Attributes ################################################################################ @@ -67,6 +78,13 @@ ALIASES += file_type_id{1}="\param[in] \1 Datatype (in-file) identifier" ALIASES += mem_type_id{1}="\param[in] \1 Datatype (in-memory) identifier" ################################################################################ +# Errors +################################################################################ + +ALIASES += estack_id="\param[in] estack_id Error stack identifier" +ALIASES += estack_id{1}="\param[in] \1 Error stack identifier" + +################################################################################ # Files ################################################################################ @@ -103,6 +121,13 @@ ALIASES += fg_loc_id="\loc_id. The identifier may be that of a file or group." ALIASES += fg_loc_id{1}="\loc_id{\1}. The identifier may be that of a file or group." ################################################################################ +# Maps +################################################################################ + +ALIASES += map_id="\param[in] map_id Map identifier" +ALIASES += map_id{1}="\param[in] \1 Map identifier" + +################################################################################ # Property lists ################################################################################ @@ -121,6 +146,9 @@ ALIASES += dcpl_id{1}="\param[in] \1 Dataset creation property list identifier" ALIASES += dxpl_id="\param[in] dxpl_id Dataset transfer property list identifier" ALIASES += dxpl_id{1}="\param[in] \1 Dataset transfer property list identifier" +ALIASES += gacpl_id="\param[in] plist_id File, group, dataset, datatype, link, or attribute access property list identifier" +ALIASES += gacpl_id{1}="\param[in] \1 File, group, dataset, datatype, link, or attribute access property list identifier" + ALIASES += gapl_id="\param[in] gapl_id Group access property list identifier" ALIASES += gapl_id{1}="\param[in] \1 Group access property list identifier" @@ -133,9 +161,18 @@ ALIASES += lapl_id{1}="\param[in] \1 Link access property list identifier" ALIASES += lcpl_id="\param[in] lcpl_id Link creation property list identifier" ALIASES += lcpl_id{1}="\param[in] \1 Link creation property list identifier" +ALIASES += mapl_id="\param[in] mapl_id Map access property list identifier" +ALIASES += mapl_id{1}="\param[in] \1 Map access property list identifier" + +ALIASES += mcpl_id="\param[in] mcpl_id Map creation property list identifier" +ALIASES += mcpl_id{1}="\param[in] \1 Map creation property list identifier" + ALIASES += oapl_id="\param[in] oapl_id Object access property list identifier" ALIASES += oapl_id{1}="\param[in] \1 Object access property list identifier" +ALIASES += ocpl_id="\param[in] oapl_id Object creation property list identifier" +ALIASES += ocpl_id{1}="\param[in] \1 Object creation property list identifier" + ALIASES += plist_id="\param[in] plist_id Property list identifier" ALIASES += plist_id{1}="\param[in] \1 Property list identifier" @@ -173,7 +210,8 @@ ALIASES += fgdta_loc_obj_id{1}="\loc_obj_id{\1}. The identifier may be that of a ALIASES += app_file="\param[in] app_file For internal use only, not a visible user parameter" ALIASES += app_func="\param[in] app_func For internal use only, not a visible user parameter" ALIASES += app_line="\param[in] app_line For internal use only, not a visible user parameter" -ALIASES += es_id="\param[in] es_id The event set ID to add this asynchronous operation to. H5ES_NONE may be used for synchronous execution." +ALIASES += es_id="\param[in] es_id Event set identifier" +ALIASES += es_id{1}="\param[in] \1 Event set identifier" ################################################################################ # Others @@ -181,11 +219,32 @@ ALIASES += es_id="\param[in] es_id The event set ID to add this asynchronous ope ALIASES += estack_id="\param[in] estack_id Error stack identifier" ALIASES += estack_id{1}="\param[in] \1 Error stack identifier" +ALIASES += cpp_c_api_note="\attention \Bold{C++ Developers using HDF5 C-API functions beware:}\n Several functions in this C-API take function pointers or callbacks as arguments. Examples include H5Pset_elink_cb(), H5Pset_type_conv_cb(), H5Tconvert(), and H5Ewalk2(). Application code must ensure that those callback functions return normally such to allow the HDF5 to manage its resources and maintain a consistent state. For instance, those functions must not use the C \c setjmp / \c longjmp mechanism to leave those callback functions. Within the context of C++, any exceptions thrown within the callback function must be caught, such as with a \Code{catch(…)} statement. Any exception state can be placed within the provided user data function call arguments, and may be thrown again once the calling function has returned. Exceptions raised and not handled inside the callback are not supported as it might leave the HDF5 library in an inconsistent state. Similarly, using C++20 coroutines cannot be used as callbacks, since they do not support plain return statements. If a callback function yields execution to another C++20 coroutine calling HDF5 functions as well, this may lead to undefined behavior." +ALIASES += sa_metadata_ops="\sa \li H5Pget_all_coll_metadata_ops() \li H5Pget_coll_metadata_write() \li H5Pset_all_coll_metadata_ops() \li H5Pset_coll_metadata_write() \li \ref maybe_metadata_reads" + +################################################################################ +# References +################################################################################ + +ALIASES += ref_cons_semantics="Enabling a Strict Consistency Semantics Model in Parallel HDF5" +ALIASES += ref_dld_filters="HDF5 Dynamically Loaded Filters" +ALIASES += ref_file_image_ops="HDF5 File Image Operations" +ALIASES += ref_filter_pipe="Data Flow Pipeline for H5Dread()" +ALIASES += ref_group_impls="Group implementations in HDF5" +ALIASES += ref_h5lib_relver="HDF5 Library Release Version Numbers" +ALIASES += ref_mdc_in_hdf5="Metadata Caching in HDF5" +ALIASES += ref_mdc_logging="Metadata Cache Logging" +ALIASES += ref_news_112="New Features in HDF5 Release 1.12" +ALIASES += ref_h5ocopy="Copying Committed Datatypes with H5Ocopy()" +ALIASES += ref_sencode_fmt_change="RFC H5Secnode() / H5Sdecode() Format Change" +ALIASES += ref_vlen_strings="\Emph{Creating variable-length string datatypes}" +ALIASES += ref_vol_doc="VOL documentation" ################################################################################ # The Usual Suspects ################################################################################ +ALIASES += click4more="(Click on a enumerator, field, or type for more information.)" ALIASES += csets="
#H5T_CSET_ASCIIUS ASCII
#H5T_CSET_UTF8UTF-8 Unicode encoding
" ALIASES += datatype_class=" \li #H5T_INTEGER \li #H5T_FLOAT \li #H5T_STRING \li #H5T_BITFIELD \li #H5T_OPAQUE \li #H5T_COMPOUND \li #H5T_REFERENCE \li #H5T_ENUM \li #H5T_VLEN \li #H5T_ARRAY" ALIASES += file_access="
#H5F_ACC_RDWRFile was opened with read/write access.
#H5F_ACC_RDONLYFile was opened with read-only access.
#H5F_ACC_SWMR_WRITEFile was opened with read/write access for a single-writer/multiple-reader (SWMR) scenario. Note that the writer process must also open the file with the #H5F_ACC_RDWR flag.
#H5F_ACC_SWMR_READFile was opened with read-only access for a single-writer/multiple-reader (SWMR) scenario. Note that the reader process must also open the file with the #H5F_ACC_RDONLY flag.
" @@ -201,5 +260,5 @@ ALIASES += scopes=" + * + * + * + * + * + * + * + * + *
#H5F_SCOPE_GLOBALFlushes the entire v ALIASES += sign_prop="
#H5T_SGN_NONE0Unsigned integer type
#H5T_SGN_21Two's complement signed integer type
" ALIASES += storage_type="
#H5G_STORAGE_TYPE_COMPACTCompact storage
#H5G_STORAGE_TYPE_DENSEIndexed storage
#H5G_STORAGE_TYPE_SYMBOL_TABLESymbol tables, the original HDF5 structure
" ALIASES += str_pad_type="
#H5T_STR_NULLTERM0Null terminate (as C does)
#H5T_STR_NULLPAD1Pad with zeros
#H5T_STR_SPACEPAD2Pad with spaces (as FORTRAN does)
" -ALIASES += virtual=" \see Supporting Functions: \li H5Pget_layout() \li H5Pset_layout() \li H5Sget_regular_hyperslab() \li H5Sis_regular_hyperslab() \li H5Sselect_hyperslab() \see VDS Functions: \li H5Pget_virtual_count() \li H5Pget_virtual_dsetname() \li H5Pget_virtual_filename() \li H5Pget_virtual_prefix() \li H5Pget_virtual_printf_gap() \li H5Pget_virtual_srcspace() \li H5Pget_virtual_view() \li H5Pget_virtual_vspace() \li H5Pset_virtual \li H5Pset_virtual_prefix() \li H5Pset_virtual_printf_gap() \li H5Pset_virtual_view()" +ALIASES += see_virtual=" \see Supporting Functions: H5Pget_layout(), H5Pset_layout(), H5Sget_regular_hyperslab(), H5Sis_regular_hyperslab(), H5Sselect_hyperslab() \see VDS Functions: H5Pget_virtual_count(), H5Pget_virtual_dsetname(), H5Pget_virtual_filename(), H5Pget_virtual_prefix(), H5Pget_virtual_printf_gap(), H5Pget_virtual_srcspace(), H5Pget_virtual_view(), H5Pget_virtual_vspace(), H5Pset_virtual(), H5Pset_virtual_prefix(), H5Pset_virtual_printf_gap(), H5Pset_virtual_view()" ALIASES += obj_info_fields="
FlagPurpose
#H5O_INFO_BASICFill in the fileno, addr, type, and rc fields
#H5O_INFO_TIMEFill in the atime, mtime, ctime, and btime fields
#H5O_INFO_NUM_ATTRS Fill in the num_attrs field
#H5O_INFO_HDRFill in the num_attrs field
#H5O_INFO_META_SIZEFill in the meta_size field
#H5O_INFO_ALL#H5O_INFO_BASIC | #H5O_INFO_TIME | #H5O_INFO_NUM_ATTRS | #H5O_INFO_HDR | #H5O_INFO_META_SIZE
" diff --git a/doxygen/dox/About.dox b/doxygen/dox/About.dox new file mode 100644 index 0000000..3be9202 --- /dev/null +++ b/doxygen/dox/About.dox @@ -0,0 +1,11 @@ +/** \page About About + +The implementation of this documentation set is based on the fantastic work of the +Eigen project. +Please refer to their GitLab repository +and the online version of their +Doxygen-based documentation. +Not only does Eigen set a standard as a piece of software, but also as an example +of documentation done right. + +*/ \ No newline at end of file diff --git a/doxygen/dox/Cookbook.dox b/doxygen/dox/Cookbook.dox new file mode 100644 index 0000000..4abc896 --- /dev/null +++ b/doxygen/dox/Cookbook.dox @@ -0,0 +1,5 @@ +/** \page Cookbook Cookbook + + Healthy, everyday recipes for every taste and budget... + + */ \ No newline at end of file diff --git a/doxygen/dox/DDLBNF110.dox b/doxygen/dox/DDLBNF110.dox new file mode 100644 index 0000000..f7e4267 --- /dev/null +++ b/doxygen/dox/DDLBNF110.dox @@ -0,0 +1,650 @@ +/** \page DDLBNF110 DDL in BNF through HDF5 1.10 + +\todo Revise this & break it up! + +\section intro110 Introduction + +This document contains the data description language (DDL) for an HDF5 file. The +description is in Backus-Naur Form (BNF). + +\section expo110 Explanation of Symbols + +This section contains a brief explanation of the symbols used in the DDL. + +\code{.unparsed} +::= defined as + a token with the name tname + | one of or + opt zero or one occurrence of + * zero or more occurrence of + + one or more occurrence of + [0-9] an element in the range between 0 and 9 + '[' the token within the quotes (used for special characters) + TBD To Be Decided +\endcode + +\section ddl110 The DDL + +\code{.unparsed} + ::= HDF5 { opt } + + ::= + + ::= SUPER_BLOCK { + SUPERBLOCK_VERSION + FREELIST_VERSION + SYMBOLTABLE_VERSION + OBJECTHEADER_VERSION + OFFSET_SIZE + LENGTH_SIZE + BTREE_RANK + BTREE_LEAF + ISTORE_K + + USER_BLOCK { + USERBLOCK_SIZE + } + } + + ::= FILE_SPACE_STRATEGY + FREE_SPACE_PERSIST + FREE_SPACE_SECTION_THRESHOLD + FILE_SPACE_PAGE_SIZE + + ::= H5F_FSPACE_STRATEGY_FSM_AGGR | H5F_FSPACE_STRATEGY_PAGE | + H5F_FSPACE_STRATEGY_AGGR | H5F_FSPACE_STRATEGY_NONE | + Unknown strategy + + ::= GROUP "/" { + * + opt + opt + * + * + } + + ::= | | | + + ::= DATATYPE { + + } + + ::= the assigned name for anonymous named type is + in the form of #oid, where oid is the object id + of the type + + ::= | | | one of or + opt zero or one occurrence of + * zero or more occurrence of + + one or more occurrence of + [0-9] an element in the range between 0 and 9 + '[' the token within the quotes (used for special characters) + TBD To Be Decided +\endcode + +\section ddl112 The DDL + +\code{.unparsed} + ::= HDF5 { opt } + + ::= + + ::= SUPER_BLOCK { + SUPERBLOCK_VERSION + FREELIST_VERSION + SYMBOLTABLE_VERSION + OBJECTHEADER_VERSION + OFFSET_SIZE + LENGTH_SIZE + BTREE_RANK + BTREE_LEAF + ISTORE_K + + USER_BLOCK { + USERBLOCK_SIZE + } + } + + ::= FILE_SPACE_STRATEGY + FREE_SPACE_PERSIST + FREE_SPACE_SECTION_THRESHOLD + FILE_SPACE_PAGE_SIZE + + ::= H5F_FSPACE_STRATEGY_FSM_AGGR | H5F_FSPACE_STRATEGY_PAGE | + H5F_FSPACE_STRATEGY_AGGR | H5F_FSPACE_STRATEGY_NONE | + Unknown strategy + + ::= GROUP "/" { + * + opt + opt + * + * + } + + ::= | | | + + ::= DATATYPE { + + } + + ::= the assigned name for anonymous named type is + in the form of #oid, where oid is the object id + of the type + + ::= | | download it as a tgz archive for offline reading. + +This is the documention set for HDF5 in terms of specifications and software +developed and maintained by The HDF +Group. It is impractical to document the entire HDF5 ecosystem in one place, +and you should also consult the documentation sets of the many outstanding +community projects. + +For a first contact with HDF5, the best place is to have a look at the \link +GettingStarted getting started \endlink page that shows you how to write and +compile your first program with HDF5. + +The \b main \b documentation is organized by documentation flavor. Most +technical documentation consists to varying degrees of information related to +tasks, concepts, or reference material. As its title +suggests, the \link RM Reference Manual \endlink is 100% reference material, +while the \link Cookbook \endlink is focused on tasks. The different guide-type +documents cover a mix of tasks, concepts, and reference, to help a certain +audience succeed. + +Finally, do not miss the search engine (top right-hand corner)! If you are +looking for a specific function, it'll take you there directly. If unsure, it'll +give you an idea of what's on offer and a few promising leads. + +\par ToDo List + There is plenty of unfinished business. + +*/ diff --git a/doxygen/dox/ReferenceManual.dox b/doxygen/dox/ReferenceManual.dox new file mode 100644 index 0000000..596a224 --- /dev/null +++ b/doxygen/dox/ReferenceManual.dox @@ -0,0 +1,43 @@ +/** \page RM Reference Manual + +The functions provided by the HDF5 C-API are grouped into the following +\Emph{modules}: + +\li \ref H5A "Attributes" — Management of HDF5 attributes (\ref H5A) +\li \ref H5D "Datasets" — Management of HDF5 datasets (\ref H5D) +\li \ref H5S "Dataspaces" — Management of HDF5 dataspaces which describe the shape of datasets and attributes (\ref H5S) +\li \ref H5T "Datatypes" — Management of datatypes which describe elements of datasets and attributes (\ref H5T) +\li \ref H5E "Error Handling" — Functions for handling HDF5 errors (\ref H5E) +\li \ref H5ES "Event Sets" — Functions for handling HDF5 event sets (\ref H5ES) +\li \ref H5F "Files" — Management of HDF5 files (\ref H5F) +\li \ref H5Z "Filters" — Configuration of filters that process data during I/O operation (\ref H5Z) +\li \ref H5G "Groups" — Management of groups in HDF5 files (\ref H5G) +\li \ref H5I "Identifiers" — Management of object identifiers and object names (\ref H5I) +\li \ref H5 "Library" — General purpose library functions (\ref H5) +\li \ref H5L "Links" — Management of links in HDF5 groups (\ref H5L) +\li \ref H5M "Maps" — Management of HDF5 maps (\ref H5M) +\li \ref H5O "Objects" — Management of objects in HDF5 files (\ref H5O) +\li \ref H5PL "Plugins" — Programmatic control over dynamically loaded plugins (\ref H5PL) +\li \ref H5P "Property Lists" — Management of property lists to control HDF5 library behavior (\ref H5P) +\li \ref H5R "References" — Management of references to specific objects and data regions in an HDF5 file (\ref H5R) +\li \ref H5VL "Virtual Object Layer" — Management of the Virtual Object Layer (\ref H5VL) + +\par Asynchronous Functions + A subset of functions has \ref ASYNC "asynchronous variants". + +\par API Versioning + See \ref api-compat-macros + +\par Deprecated Functions and Types + A list of deprecated functions and types can be found + here. + +\par Etiquette + Here are a few simple rules to follow: + \li \Bold{Handle discipline:} If you acquire a handle (by creation or copy), \Emph{you own it!} (..., i.e., you have to close it.) + \li \Bold{Dynamic memory allocation:} ... + \li \Bold{Use of locations:} Identifier + name combo + +\cpp_c_api_note + +*/ \ No newline at end of file diff --git a/doxygen/dox/Specifications.dox b/doxygen/dox/Specifications.dox new file mode 100644 index 0000000..4ae48d0 --- /dev/null +++ b/doxygen/dox/Specifications.dox @@ -0,0 +1,22 @@ +/** \page SPEC Specifications + +\section DDL + +\li \ref DDLBNF110 "DDL in BNF through HDF5 1.10" +\li \ref DDLBNF112 "DDL in BNF for HDF5 1.12 and above" + +\section File Format + +\li \ref FMT1 "HDF5 File Format Specification Version 1.0" +\li \ref FMT11 "HDF5 File Format Specification Version 1.1" +\li \ref FMT2 "HDF5 File Format Specification Version 2.0" +\li \ref FMT3 "HDF5 File Format Specification Version 3.0" + +\section Other + +\li \ref IMG "HDF5 Image and Palette Specification Version 1.2" +\li \ref TBL "HDF5 Table Specification Version 1.0" +\li + HDF5 Dimension Scale Specification + +*/ \ No newline at end of file diff --git a/doxygen/dox/TechnicalNotes.dox b/doxygen/dox/TechnicalNotes.dox new file mode 100644 index 0000000..2bda175 --- /dev/null +++ b/doxygen/dox/TechnicalNotes.dox @@ -0,0 +1,20 @@ +/** \page TN Technical Notes + +\li \link api-compat-macros API Compatibility Macros \endlink +\li \ref TNMDC "Metadata Caching in HDF5" +\li \ref MT "Thread Safe library" +\li \ref VFL "Virtual File Layer" + + */ + +/** \page MT HDF5 Thread Safe library + +\htmlinclude ThreadSafeLibrary.html + +*/ + +/** \page VFL HDF5 Virtual File Layer + +\htmlinclude VFL.html + +*/ diff --git a/doxygen/dox/api-compat-macros.dox b/doxygen/dox/api-compat-macros.dox index 6b85ccb..4a1578d 100644 --- a/doxygen/dox/api-compat-macros.dox +++ b/doxygen/dox/api-compat-macros.dox @@ -1,5 +1,4 @@ /** \page api-compat-macros API Compatibility Macros - \tableofcontents \section audience Audience The target audience for this document has existing applications that use the diff --git a/doxygen/dox/mainpage.dox b/doxygen/dox/mainpage.dox deleted file mode 100644 index eda967b..0000000 --- a/doxygen/dox/mainpage.dox +++ /dev/null @@ -1,44 +0,0 @@ -/*! \mainpage HDF5 C-API Reference - * - * The HDF5 C-API provides applications with fine-grained control over all - * aspects HDF5 functionality. This functionality is grouped into the following - * \Emph{modules}: - * \li \ref H5A "Attributes" — Management of HDF5 attributes (\ref H5A) - * \li \ref H5D "Datasets" — Management of HDF5 datasets (\ref H5D) - * \li \ref H5S "Dataspaces" — Management of HDF5 dataspaces which describe the shape of datasets and attributes (\ref H5S) - * \li \ref H5T "Datatypes" — Management of datatypes which describe elements of datasets and attributes (\ref H5T) - * \li \ref H5E "Error Handling" — Functions for handling errors that occur within HDF5 (\ref H5E) - * \li \ref H5F "Files" — Management of HDF5 files (\ref H5F) - * \li \ref H5Z "Filters" — Configuration of filters that process data during I/O operation (\ref H5Z) - * \li \ref H5G "Groups" — Management of groups in HDF5 files (\ref H5G) - * \li \ref H5I "Identifiers" — Management of object identifiers and object names (\ref H5I) - * \li \ref H5 "Library" — General purpose library functions (\ref H5) - * \li \ref H5L "Links" — Management of links in HDF5 groups (\ref H5L) - * \li \ref H5O "Objects" — Management of objects in HDF5 files (\ref H5O) - * \li \ref H5PL "Plugins" — Programmatic control over dynamically loaded plugins (\ref H5PL) - * \li \ref H5P "Property Lists" — Management of property lists to control HDF5 library behavior (\ref H5P) - * \li \ref H5R "References" — Management of references to specific objects and data regions in an HDF5 file (\ref H5R) - * \li \ref H5VL "Virtual Object Layer" — Management of the Virtual Object Layer (\ref H5VL) - * - * Here are a few simple rules to follow: - * - * \li \Bold{Handle discipline:} If you acquire a handle (by creation or coopy), \Emph{you own it!} (..., i.e., you have to close it.) - * \li \Bold{Dynamic memory allocation:} ... - * \li \Bold{Use of locations:} Identifier + name combo - * - * \attention \Bold{C++ Developers using HDF5 C-API functions beware:}\n - * 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. - * 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().\n - * 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++ \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. - * - * \todo Fix the search form for server deployments. - * \todo Make it mobile-friendly - * - */ \ No newline at end of file diff --git a/doxygen/dox/maybe_metadata_reads.dox b/doxygen/dox/maybe_metadata_reads.dox new file mode 100644 index 0000000..25c905f --- /dev/null +++ b/doxygen/dox/maybe_metadata_reads.dox @@ -0,0 +1,82 @@ +/** + * \page maybe_metadata_reads Functions with No Access Property List Parameter that May Generate Metadata Reads + * + * \ingroup GACPL + * + * Currently there are several operations in HDF5 that can issue metadata reads + * from the metadata cache, but that take no property list. It is therefore not + * possible to set a collective requirement individually for those operations. The + * only solution with the HDF5 1.10.0 release is to set the collective requirement + * globally on H5Fopen() or H5Fcreate() for all metadata operations to be + * collective. + * + * The following is a list of those functions in the HDF5 library. This list is + * integral to the discussion in the H5Pset_all_coll_metadata_ops() entry: + * + *
+ *
+ * H5Awrite()
+ * H5Aread()
+ * H5Arename()
+ * H5Aiterate2()
+ * H5Adelete()
+ * H5Aexists()
+ *
+ * H5Dget_space_status()
+ * H5Dget_storage_size()
+ * H5Dset_extent()
+ * H5Ddebug()
+ * H5Dclose()
+ * H5Dget_create_plist()
+ * H5Dget_space()   (when dataset is a virtual dataset)
+ *
+ * H5Gget_create_plist()
+ * H5Gget_info()
+ * H5Gclose()
+ *
+ * H5Literate()
+ * H5Lvisit()
+ *
+ * H5Rcreate()
+ * H5Rdereference2()   (when reference is an object reference)
+ * H5Rget_region()
+ * H5Rget_obj_type2()
+ * H5Rget_name()
+ *
+ * H5Ocopy()
+ * H5Oopen_by_addr()
+ * H5Oincr_refcount()
+ * H5Odecr_refcount()
+ * H5Oget_info()
+ * H5Oset_comment()
+ * H5Ovisit()
+ *
+ * H5Fis_hdf5()
+ * H5Fflush()
+ * H5Fclose()
+ * H5Fget_file_image()
+ * H5Freopen()
+ * H5Fget_freespace()
+ * H5Fget_info2()
+ * H5Fget_free_sections()
+ * H5Fmount()
+ * H5Funmount()
+ *
+ * H5Iget_name()
+ *
+ * H5Tget_create_plist()
+ * H5Tclose()
+ *
+ * H5Zunregister()
+ * 
+ * + * In addition, \b most deprecated functions fall into this category. + * + * The HDF Group may address the above limitation in a future major release, but + * no decision has been made at this time. Such a change might, for example, + * include adding new versions of some or all the above functions with an extra + * property list parameter to allow an individual setting for the collective + * calling requirement. + * + * \sa_metadata_ops + */ diff --git a/doxygen/examples/FF-IH_FileGroup.gif b/doxygen/examples/FF-IH_FileGroup.gif new file mode 100644 index 0000000..b0d76f5 Binary files /dev/null and b/doxygen/examples/FF-IH_FileGroup.gif differ diff --git a/doxygen/examples/FF-IH_FileObject.gif b/doxygen/examples/FF-IH_FileObject.gif new file mode 100644 index 0000000..8eba623 Binary files /dev/null and b/doxygen/examples/FF-IH_FileObject.gif differ diff --git a/doxygen/examples/FileFormatSpecChunkDiagram.jpg b/doxygen/examples/FileFormatSpecChunkDiagram.jpg new file mode 100644 index 0000000..03fd90a Binary files /dev/null and b/doxygen/examples/FileFormatSpecChunkDiagram.jpg differ diff --git a/doxygen/examples/H5.format.1.0.html b/doxygen/examples/H5.format.1.0.html new file mode 100644 index 0000000..2d3ffbe --- /dev/null +++ b/doxygen/examples/H5.format.1.0.html @@ -0,0 +1,4050 @@ + + + + HDF5 File Format Specification + + + + +
+ + + +
+
    +
  1. Introduction +
  2. Disk Format Level 0 - File Signature and Super Block +
  3. Disk Format Level 1 - File Infrastructure + +
      +
    1. Disk Format Level 1A - B-link Trees and B-tree Nodes +
    2. Disk Format Level 1B - Group +
    3. Disk Format Level 1C - Group Entry +
    4. Disk Format Level 1D - Local Heaps +
    5. Disk Format Level 1E - Global Heap +
    6. Disk Format Level 1F - Free-space Index +
    +
    +
  4. Disk Format Level 2 - Data Objects + +
      +
    1. Disk Format Level 2a - Data Object Headers +
        +
      1. Name: NIL +
      2. Name: Simple Dataspace + +
      3. Name: Datatype +
      4. Name: Data Storage - Fill Value +
      5. Name: Reserved - not assigned yet +
      +
    +
    +
+
   +
    + +
  1. Disk Format Level 2 - Data Objects + (Continued) +
      +
    1. Disk Format Level 2a - Data Object Headers(Continued) +
        +
      1. Name: Data Storage - Compact +
      2. Name: Data Storage - External Data Files +
      3. Name: Data Storage - Layout +
      4. Name: Reserved - not assigned yet +
      5. Name: Reserved - not assigned yet +
      6. Name: Data Storage - Filter Pipeline +
      7. Name: Attribute +
      8. Name: Object Name +
      9. Name: Object Modification Date and Time +
      10. Name: Shared Object Message +
      11. Name: Object Header Continuation +
      12. Name: Group Message +
      +
    2. Disk Format: Level 2b - Shared Data Object Headers +
    3. Disk Format: Level 2c - Data Object Data Storage +
    +
    +
+
+
+ +

+ + +

Introduction

+ + + + + + + +
  +
+ HDF5 Groups +
 
  + Figure 1: Relationships among the HDF5 root group, other groups, and objects +
+
 
  + HDF5 Objects +  
  + Figure 2: HDF5 objects -- datasets, datatypes, or dataspaces +
+
 
+ + +

The format of an HDF5 file on disk encompasses several + key ideas of the HDF4 and AIO file formats as well as + addressing some shortcomings therein. The new format is + more self-describing than the HDF4 format and is more + uniformly applied to data objects in the file. + +

An HDF5 file appears to the user as a directed graph. + The nodes of this graph are the higher-level HDF5 objects + that are exposed by the HDF5 APIs: + +

    +
  • Groups +
  • Datasets +
  • Datatypes +
  • Dataspaces +
+ +

At the lowest level, as information is actually written to the disk, + an HDF5 file is made up of the following objects: +

    +
  • A super block +
  • B-tree nodes (containing either symbol nodes or raw data chunks) +
  • Object headers + +
  • Collections +
  • Local heaps +
  • Free space +
+ + The HDF5 library uses these lower-level objects to represent the + higher-level objects that are then presented to the user or + to applications through the APIs. + For instance, a group is an object header that contains a message that + points to a local heap and to a B-tree which points to symbol nodes. + A dataset is an object header that contains messages that describe + datatype, space, layout, filters, external files, fill value, etc + with the layout message pointing to either a raw data chunk or to a + B-tree that points to raw data chunks. + + +

This Document

+ +

This document describes the lower-level data objects; + the higher-level objects and their properties are described + in the HDF5 User's Guide. + + + + + + +

Three levels of information comprise the file format. + Level 0 contains basic information for identifying and + defining information about the file. Level 1 information contains + the group information (stored as a B-tree) and is used as the + index for all the objects in the file. Level 2 is the rest + of the file and contains all of the data objects, with each object + partitioned into header information, also known as + meta information, and data. + +

The sizes of various fields in the following layout tables are + determined by looking at the number of columns the field spans + in the table. There are three exceptions: (1) The size may be + overridden by specifying a size in parentheses, (2) the size of + addresses is determined by the Size of Offsets field + in the super block, and (3) the size of size fields is determined + by the Size of Lengths field in the super block. + + + +

+

+ + +

+ Disk Format: Level 0 - File Signature and Super Block

+ +

The super block may begin at certain predefined offsets within + the HDF5 file, allowing a block of unspecified content for + users to place additional information at the beginning (and + end) of the HDF5 file without limiting the HDF5 library's + ability to manage the objects within the file itself. This + feature was designed to accommodate wrapping an HDF5 file in + another file format or adding descriptive information to the + file without requiring the modification of the actual file's + information. The super block is located by searching for the + HDF5 file signature at byte offset 0, byte offset 512 and at + successive locations in the file, each a multiple of two of + the previous location, i.e. 0, 512, 1024, 2048, etc. + +

The super block is composed of a file signature, followed by + super block and group version numbers, information + about the sizes of offset and length values used to describe + items within the file, the size of each group page, + and a group entry for the root object in the file. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ HDF5 Super Block Layout +
bytebytebytebyte

HDF5 File Signature (8 bytes)

Version # of Super BlockVersion # of Global Free-space StorageVersion # of GroupReserved
Version # of Shared Header Message FormatSize of OffsetsSize of LengthsReserved (zero)
Group Leaf Node KGroup Internal Node K
File Consistency Flags
Base Address*
Address of Global Free-space Heap*
End of File Address*
Driver Information Block Address*
Root Group Address*
+ + + +
+
+ (Items marked with an asterisk (*) in the above table +
+ are of the size specified in "Size of Offsets.") +
+
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
File SignatureThis field contains a constant value and can be used to + quickly identify a file as being an HDF5 file. The + constant value is designed to allow easy identification of + an HDF5 file and to allow certain types of data corruption + to be detected. The file signature of an HDF5 file always + contains the following values: + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
decimal13772687013102610
hexadecimal894844460d0a1a0a
ASCII C Notation\211HDF\r\n\032\n
+
+
+ + This signature both identifies the file as an HDF5 file + and provides for immediate detection of common + file-transfer problems. The first two bytes distinguish + HDF5 files on systems that expect the first two bytes to + identify the file type uniquely. The first byte is + chosen as a non-ASCII value to reduce the probability + that a text file may be misrecognized as an HDF5 file; + also, it catches bad file transfers that clear bit + 7. Bytes two through four name the format. The CR-LF + sequence catches bad file transfers that alter newline + sequences. The control-Z character stops file display + under MS-DOS. The final line feed checks for the inverse + of the CR-LF translation problem. (This is a direct + descendent of the PNG file signature.)
Version Number of the Super BlockThis value is used to determine the format of the + information in the super block. When the format of the + information in the super block is changed, the version number + is incremented to the next integer and can be used to + determine how the information in the super block is + formatted.
Version Number of the Global Free-space HeapThis value is used to determine the format of the + information in the Global Free-space Heap.
Version Number of the GroupThis value is used to determine the format of the + information in the Group. When the format of + the information in the Group is changed, the + version number is incremented to the next integer and can be + used to determine how the information in the Group + is formatted.
Version Number of the Shared Header Message FormatThis value is used to determine the format of the + information in a shared object header message, which is + stored in the global small-data heap. Since the format + of the shared header messages differs from the private + header messages, a version number is used to identify changes + in the format.
Size of OffsetsThis value contains the number of bytes used to store + addresses in the file. The values for the addresses of + objects in the file are offsets relative to a base address, + usually the address of the super block signature. This + allows a wrapper to be added after the file is created + without invalidating the internal offset locations.
Size of LengthsThis value contains the number of bytes used to store + the size of an object.
Group Leaf Node KEach leaf node of a group B-tree will have at + least this many entries but not more than twice this + many. If a group has a single leaf node then it + may have fewer entries.
Group Internal Node KEach internal node of a group B-tree will have + at least K pointers to other nodes but not more than 2K + pointers. If the group has only one internal + node then it might have fewer than K pointers.
Bytes per B-tree PageThis value contains the number of bytes used for symbol + pairs per page of the B-trees used in the file. All + B-tree pages will have the same size per page. +
+ For 32-bit file offsets, 340 objects is the maximum + per 4KB page; for 64-bit file offset, 254 objects will fit + per 4KB page. In general, the equation is: +
+    <number of objects> = +
       + FLOOR((<page size> - <offset size>) / +
          + (<Symbol size> + <offset size>)) + - 1
File Consistency FlagsThis value contains flags to indicate information + about the consistency of the information contained + within the file. Currently, the following bit flags are + defined: +
    +
  • Bit 0 set indicates that the file is opened for + write-access. +
  • Bit 1 set indicates that the file has + been verified for consistency and is guaranteed to be + consistent with the format defined in this document. +
  • Bits 2-31 are reserved for future use. +
+ Bit 0 should be + set as the first action when a file is opened for write + access and should be cleared only as the final action + when closing a file. Bit 1 should be cleared during + normal access to a file and only set after the file's + consistency is guaranteed by the library or a + consistency utility.
Base AddressThis is the absolute file address of the first byte of + the HDF5 data within the file. The library currently + constrains this value to be the absolute file address + of the super block itself when creating new files; + future versions of the library may provide greater + flexibility. Unless otherwise noted, + all other file addresses are relative to this base + address.
Address of Global Free-space HeapFree-space management is not yet defined in the HDF5 + file format and is not handled by the library. + Currently this field always contains the + undefined address 0xfff...ff. + +
End of File AddressThis is the relative file address of the first byte past + the end of all HDF5 data. It is used to determine whether a + file has been accidently truncated and as an address where + file data allocation can occur if the free list is not + used.
Driver Information Block AddressThis is the relative file address of the file driver + information block which contains driver-specific + information needed to reopen the file. If there is no + driver information block then this entry should be the + undefined address (all bits set).
Root Group AddressThis is the address of the root group (described later + in this document), which serves as the entry point into + the group graph.
+
+ + +

The file driver information block is an optional region of the + file which contains information needed by the file driver in + order to reopen a file. The format of the file driver information + block is: + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Driver Information Block +
bytebytebytebyte
VersionReserved (zero)
Driver Information Size (4 bytes)

Driver Identification (8 bytes)



Driver Information


+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
VersionThe version number of the driver information block. The + file format documented here is version zero.
Driver Information SizeThe size in bytes of the Driver Information part of this + structure.
Driver IdentificationThis is an eight-byte ASCII string without null + termination which identifies the driver and version number + of the Driver Information block. The predefined drivers + supplied with the HDF5 library are identified by the + letters NCSA followed by the first four characters of + the driver name. If the Driver Information block is not + the original version then the last letter(s) of the + identification will be replaced by a version number in + ASCII. + For example, the various versions of the family driver + will be identified by NCSAfami, NCSAfam0, + NCSAfam1, etc. + (NCSAfami is simply NCSAfamily truncated + to eight characters. Subsequent identifiers will be created by + substituting sequential numerical values for the final character, + starting with zero.) +

+ Identification for user-defined drivers + is arbitrary but should be unique.

Driver InformationDriver information is stored in a format defined by the + file driver and encoded/decoded by the driver callbacks + invoked from the H5FD_sb_encode and + H5FD_sb_decode functions.
+
+ + +

+

+ + +

+ Disk Format: Level 1 - File Infrastructure

+

Disk Format: Level 1A - B-link Trees and B-tree Nodes

+ +

B-link trees allow flexible storage for objects which tend to grow + in ways that cause the object to be stored discontiguously. B-trees + are described in various algorithms books including "Introduction to + Algorithms" by Thomas H. Cormen, Charles E. Leiserson, and Ronald + L. Rivest. The B-link tree, in which the sibling nodes at a + particular level in the tree are stored in a doubly-linked list, + is described in the "Efficient Locking for Concurrent Operations + on B-trees" paper by Phillip Lehman and S. Bing Yao as published + in the ACM Transactions on Database Systems, Vol. 6, + No. 4, December 1981. + +

The B-link trees implemented by the file format contain one more + key than the number of children. In other words, each child + pointer out of a B-tree node has a left key and a right key. + The pointers out of internal nodes point to sub-trees while + the pointers out of leaf nodes point to symbol nodes and + raw data chunks. + Aside from that difference, internal nodes and leaf nodes + are identical. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ B-tree Nodes +
bytebytebytebyte
Node Signature
Node TypeNode LevelEntries Used
Address of Left Sibling
Address of Right Sibling
Key 0 (variable size)
Address of Child 0
Key 1 (variable size)
Address of Child 1
...
Key 2K (variable size)
Address of Child 2K
Key 2K+1 (variable size)
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Node SignatureThe ASCII character string TREE is + used to indicate the + beginning of a B-link tree node. This gives file + consistency checking utilities a better chance of + reconstructing a damaged file.
Node TypeEach B-link tree points to a particular type of data. + This field indicates the type of data as well as + implying the maximum degree K of the tree and + the size of each Key field. +
+
+
0 +
This tree points to group nodes. +
1 +
This tree points to a new data chunk. +
+
Node LevelThe node level indicates the level at which this node + appears in the tree (leaf nodes are at level zero). Not + only does the level indicate whether child pointers + point to sub-trees or to data, but it can also be used + to help file consistency checking utilities reconstruct + damanged trees.
Entries UsedThis determines the number of children to which this + node points. All nodes of a particular type of tree + have the same maximum degree, but most nodes will point + to less than that number of children. The valid child + pointers and keys appear at the beginning of the node + and the unused pointers and keys appear at the end of + the node. The unused pointers and keys have undefined + values.
Address of Left SiblingThis is the file address of the left sibling of the + current node relative to the super block. If the current + node is the left-most node at this level then this field + is the undefined address (all bits set).
Address of Right SiblingThis is the file address of the right sibling of the + current node relative to the super block. If the current + node is the right-most node at this level then this + field is the undefined address (all bits set).
Keys and Child PointersEach tree has 2K+1 keys with 2K + child pointers interleaved between the keys. The number + of keys and child pointers actually containing valid + values is determined by the Entries Used field. If + that field is N then the B-link tree contains + N child pointers and N+1 keys.
KeyThe format and size of the key values is determined by + the type of data to which this tree points. The keys are + ordered and are boundaries for the contents of the child + pointer; that is, the key values represented by child + N fall between Key N and Key + N+1. Whether the interval is open or closed on + each end is determined by the type of data to which the + tree points. +

+ The format of the key depends on the node type. + For nodes of node type 1, the key is formatted as follows: +

+ + + + + + + + + + + +
Bytes 1-4Size of chunk in bytes.
Bytes 4-8Filter mask, a 32-bit bitfield indicating which + filters have been applied to that chunk.
N fields of 8 bytes eachA 64-bit index indicating the offset of the + chunk within the dataset where N is the number + of dimensions of the dataset. For example, if + a chunk in a 3-dimensional dataset begins at the + position [5,5,5], there will be three + such 8-bit indices, each with the value of + 5.
+
+

+ For nodes of node type 0, the key is formatted as follows: +

+ + + + + +
A single field of Size of Lengths + bytesIndicates the byte offset into the local heap + for the first object name in the subtree which + that key describes.
+
+
Child PointersThe tree node contains file addresses of subtrees or + data depending on the node level. Nodes at Level 0 point + to data addresses, either data chunk or group nodes. + Nodes at non-zero levels point to other nodes of the + same B-tree.
+
+ +

+ Each B-tree node looks like this: + +

+ + + + + + + + + + + + + +
key[0]  child[0]  key[1]  child[1]  key[2]  ...  ...  key[N-1]  child[N-1]  key[N]
+
+ + where child[i] is a pointer to a sub-tree (at a level + above Level 0) or to data (at Level 0). + Each key[i] describes an item stored by the B-tree + (a chunk or an object of a group node). The range of values + represented by child[i] are indicated by key[i] + and key[i+1]. + + +

The following question must next be answered: + "Is the value described by key[i] contained in + child[i-1] or in child[i]?" + The answer depends on the type of tree. + In trees for groups (node type 0) the object described by + key[i] is the greatest object contained in + child[i-1] while in chunk trees (node type 1) the + chunk described by key[i] is the least chunk in + child[i]. + +

That means that key[0] for group trees is sometimes unused; + it points to offset zero in the heap, which is always the + empty string and compares as "less-than" any valid object name. + +

And key[N] for chunk trees is sometimes unused; + it contains a chunk offset which compares as "greater-than" + any other chunk offset and has a chunk byte size of zero + to indicate that it is not actually allocated. + + +

Disk Format: Level 1B - Group and Symbol Nodes

+ +

A group is an object internal to the file that allows + arbitrary nesting of objects (including other groups). + A group maps a set of names to a set of file + address relative to the base address. Certain meta data + for an object to which the group points can be duplicated + in the group symbol table in addition to the object header. + +

An HDF5 object name space can be stored hierarchically by + partitioning the name into components and storing each + component in a group. The group entry for a + non-ultimate component points to the group containing + the next component. The group entry for the last + component points to the object being named. + +

A group is a collection of group nodes pointed + to by a B-link tree. Each group node contains entries + for one or more symbols. If an attempt is made to add a + symbol to an already full group node containing + 2K entries, then the node is split and one node + contains K symbols and the other contains + K+1 symbols. + +

+

+ + + + + + + + + + + + + + + + + + + +
+ Group Node (A Leaf of a B-tree) +
bytebytebytebyte
Node Signature
Version NumberReserved for Future UseNumber of Symbols


Group Entries


+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Node SignatureThe ASCII character string SNOD is + used to indicate the + beginning of a group node. This gives file + consistency checking utilities a better chance of + reconstructing a damaged file.
Version NumberThe version number for the group node. This + document describes version 1.
Number of SymbolsAlthough all group nodes have the same length, + most contain fewer than the maximum possible number of + symbol entries. This field indicates how many entries + contain valid data. The valid entries are packed at the + beginning of the group node while the remaining + entries contain undefined values.
Group EntriesEach symbol has an entry in the group node. + The format of the entry is described below.
+
+ +

+ Disk Format: Level 1C - Group Entry

+ +

Each group entry in a group node is designed + to allow for very fast browsing of stored objects. + Toward that design goal, the group entries + include space for caching certain constant meta data from the + object header. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Group Entry +
bytebytebytebyte
Name Offset (<size> bytes)
Object Header Address
Cache Type
Reserved


Scratch-pad Space (16 bytes)


+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Name OffsetThis is the byte offset into the group local + heap for the name of the object. The name is null + terminated.
Object Header AddressEvery object has an object header which serves as a + permanent location for the object's meta data. In addition + to appearing in the object header, some meta data can be + cached in the scratch-pad space.
Cache TypeThe cache type is determined from the object header. + It also determines the format for the scratch-pad space. +
+
+
0 +
No data is cached by the group entry. This + is guaranteed to be the case when an object header + has a link count greater than one. + +
1 +
Object header meta data is cached in the group + entry. This implies that the group + entry refers to another group. + +
2 +
The entry is a symbolic link. The first four bytes + of the scratch-pad space are the offset into the local + heap for the link value. The object header address + will be undefined. + +
N +
Other cache values can be defined later and + libraries that do not understand the new values will + still work properly. +
+
ReservedThese four bytes are present so that the scratch-pad + space is aligned on an eight-byte boundary. They are + always set to zero.
Scratch-pad SpaceThis space is used for different purposes, depending + on the value of the Cache Type field. Any meta-data + about a dataset object represented in the scratch-pad + space is duplicated in the object header for that + dataset. This meta data can include the datatype + and the size of the dataspace for a dataset whose datatype + is atomic and whose dataspace is fixed and less than + four dimensions. + Furthermore, no data is cached in the group + entry scratch-pad space if the object header for + the group entry has a link count greater than + one.
+
+ +

Format of the Scratch-pad Space

+ +

The group entry scratch-pad space is formatted + according to the value in the Cache Type field. + +

If the Cache Type field contains the value zero + (0) then no information is + stored in the scratch-pad space. + +

If the Cache Type field contains the value one + (1), then the scratch-pad space + contains cached meta data for another object header + in the following format: + +

+

+ + + + + + + + + + + + + + +
+ Object Header Scratch-pad Format +
bytebytebytebyte
Address of B-tree
Address of Name Heap
+
+ +

+

+ + + + + + + + + + + + + + + +
Field NameDescription
Address of B-treeThis is the file address for the root of the + group's B-tree.
Address of Name HeapThis is the file address for the group's local + heap, in which are stored the symbol names.
+
+ + +

If the Cache Type field contains the value two + (2), then the scratch-pad space + contains cached meta data for another symbolic link + in the following format: + +

+

+ + + + + + + + + + + + + +
+ Symbolic Link Scratch-pad Format +
bytebytebytebyte
Offset to Link Value
+
+ +

+

+ + + + + + + + + + +
Field NameDescription
Offset to Link ValueThe value of a symbolic link (that is, the name of the + thing to which it points) is stored in the local heap. + This field is the 4-byte offset into the local heap for + the start of the link value, which is null terminated.
+
+ +

Disk Format: Level 1D - Local Heaps

+ +

A heap is a collection of small heap objects. Objects can be + inserted and removed from the heap at any time. + The address of a heap does not change once the heap is created. + References to objects are stored in the group table; + the names of those objects are stored in the local heap. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Local Heaps +
bytebytebytebyte
Heap Signature
Reserved (zero)
Data Segment Size
Offset to Head of Free-list (<size> bytes)
Address of Data Segment
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Heap SignatureThe ASCII character string HEAP + is used to indicate the + beginning of a heap. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file.
Data Segment SizeThe total amount of disk memory allocated for the heap + data. This may be larger than the amount of space + required by the object stored in the heap. The extra + unused space holds a linked list of free blocks.
Offset to Head of Free-listThis is the offset within the heap data segment of the + first free block (or all 0xff bytes if there is no free + block). The free block contains <size> bytes that + are the offset of the next free chunk (or all 0xff bytes + if this is the last free chunk) followed by <size> + bytes that store the size of this free chunk.
Address of Data SegmentThe data segment originally starts immediately after + the heap header, but if the data segment must grow as a + result of adding more objects, then the data segment may + be relocated, in its entirety, to another part of the + file.
+
+ +

Objects within the heap should be aligned on an 8-byte boundary. + +

Disk Format: Level 1E - Global Heap

+ +

Each HDF5 file has a global heap which stores various types of + information which is typically shared between datasets. The + global heap was designed to satisfy these goals: + +

    +
  1. Repeated access to a heap object must be efficient without + resulting in repeated file I/O requests. Since global heap + objects will typically be shared among several datasets, it is + probable that the object will be accessed repeatedly. + +

    +
  2. Collections of related global heap objects should result in + fewer and larger I/O requests. For instance, a dataset of + void pointers will have a global heap object for each + pointer. Reading the entire set of void pointer objects + should result in a few large I/O requests instead of one small + I/O request for each object. + +

    +
  3. It should be possible to remove objects from the global heap + and the resulting file hole should be eligible to be reclaimed + for other uses. +

    +
+ +

The implementation of the heap makes use of the memory + management already available at the file level and combines that + with a new top-level object called a collection to + achieve Goal B. The global heap is the set of all collections. + Each global heap object belongs to exactly one collection and + each collection contains one or more global heap objects. For + the purposes of disk I/O and caching, a collection is treated as + an atomic object. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ A Global Heap Collection +
bytebytebytebyte
Magic Number
VersionReserved
Collection Size

Global Heap Object 1 + (described below)


Global Heap Object 2


...


Global Heap Object N


Global Heap Object 0 (free space)

+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Magic NumberThe magic number for global heap collections are the + four bytes G, C, O, + and L.
VersionEach collection has its own version number so that new + collections can be added to old files. This document + describes version zero of the collections. +
Collection Data SizeThis is the size in bytes of the entire collection + including this field. The default (and minimum) + collection size is 4096 bytes which is a typical file + system block size and which allows for 170 16-byte heap + objects plus their overhead.
Object 1 through NThe objects are stored in any order with no + intervening unused space.
Object 0Object 0 (zero), when present, represents the free space in + the collection. Free space always appears at the end of + the collection. If the free space is too small to store + the header for Object 0 (described below) then the + header is implied and the collection contains no free space. +
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Global Heap Object +
bytebytebytebyte
Object IDReference Count
Reserved
Object Data Size

Object Data

+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Object IDEach object has a unique identification number within a + collection. The identification numbers are chosen so that + new objects have the smallest value possible with the + exception that the identifier 0 always refers to the + object which represents all free space within the + collection.
Reference CountAll heap objects have a reference count field. An + object which is referenced from some other part of the + file will have a positive reference count. The reference + count for Object 0 is always zero.
ReservedZero padding to align next field on an 8-byte + boundary.
Object Size This is the size of the the fields + above plus the object data stored for the object. The + actual storage size is rounded up to a multiple of + eight.
Object DataThe object data is treated as a one-dimensional array + of bytes to be interpreted by the caller.
+
+ +

Disk Format: Level 1F - Free-space Heap

+ +

The Free-space Index is a collection of blocks of data, + dispersed throughout the file, which are currently not used by + any file objects. + +

The super block contains a pointer to root of the free-space description; + that pointer is currently (i.e., in HDF5 Release 1.2) required + to be the undefined address 0xfff...ff. + +

The free-sapce index is not otherwise publicly defined at this time. + + + + + +

+

+ + +

Disk Format: Level 2 - Data Objects

+ +

Data objects contain the real information in the file. These + objects compose the scientific data and other information which + are generally thought of as "data" by the end-user. All the + other information in the file is provided as a framework for + these data objects. + +

A data object is composed of header information and data + information. The header information contains the information + needed to interpret the data information for the data object as + well as additional "meta-data" or pointers to additional + "meta-data" used to describe or annotate each data object. + +

+ Disk Format: Level 2a - Data Object Headers

+ +

The header information of an object is designed to encompass + all the information about an object which would be desired to be + known, except for the data itself. This information includes + the dimensionality, number-type, information about how the data + is stored on disk (in external files, compressed, broken up in + blocks, etc.), as well as other information used by the library + to speed up access to the data objects or maintain a file's + integrity. The header of each object is not necessarily located + immediately prior to the object's data in the file and in fact + may be located in any position in the file. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Object Headers +
bytebytebytebyte
Version # of Object HeaderReservedNumber of Header Messages
Object Reference Count

Total Object Header Size

Header Message Type #1Size of Header Message Data #1
FlagsReserved

Header Message Data #1

.
.
.
Header Message Type #nSize of Header Message Data #n
FlagsReserved

Header Message Data #n

+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version number of the object headerThis value is used to determine the format of the + information in the object header. When the format of the + information in the object header is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted.
ReservedAlways set to zero.
Number of header messagesThis value determines the number of messages listed in + this object header. This provides a fast way for software + to prepare storage for the messages in the header.
Object Reference CountThis value specifies the number of references to this + object within the current file. References to the + data object from external files are not tracked.
Total Object Header SizeThis value specifies the total number of bytes of header + message data following this length field for the current + message as well as any continuation data located elsewhere + in the file.
Header Message TypeThe header message type specifies the type of + information included in the header message data following + the type along with a small amount of other information. + Bit 15 of the message type is set if the message is + constant (constant messages cannot be changed since they + may be cached in group entries throughout the + file). The header message types for the pre-defined + header messages will be included in further discussion + below.
Size of Header Message DataThis value specifies the number of bytes of header + message data following the header message type and length + information for the current message. The size includes + padding bytes to make the message a multiple of eight + bytes.
FlagsThis is a bit field with the following definition: +
+
0 +
If set, the message data is constant. This is used + for messages like the datatype message of a dataset. +
1 +
If set, the message is stored in the global heap and + the Header Message Data field contains a Shared Object + message and the Size of Header Message Data field + contains the size of that Shared Object message. +
2-7 +
Reserved +
+
Header Message DataThe format and length of this field is determined by the + header message type and size respectively. Some header + message types do not require any data and this information + can be eliminated by setting the length of the message to + zero. The data is padded with enough zeros to make the + size a multiple of eight.
+
+ +

The header message types and the message data associated with + them compose the critical "meta-data" about each object. Some + header messages are required for each object while others are + optional. Some optional header messages may also be repeated + several times in the header itself, the requirements and number + of times allowed in the header will be noted in each header + message description below. + +

The following is a list of currently defined header messages: + +


+

Name: NIL

+ Type: 0x0000
+ Length: varies
+ Status: Optional, may be repeated.
+ Purpose and Description: The NIL message is used to + indicate a message + which is to be ignored when reading the header messages for a data object. + [Probably one which has been deleted for some reason.]
+ Format of Data: Unspecified.
+ + + + +
+

Name: Simple Dataspace

+ + Type: 0x0001
+ Length: Varies according to the number of dimensions, + as described in the following table
+ Status: The Simple Dataspace message is required + and may not be repeated. This message is currently used with + datasets and named dataspaces.
+ +

The Simple Dataspace message describes the number + of dimensions and size of each dimension that the data object + has. This message is only used for datasets which have a + simple, rectilinear grid layout; datasets requiring a more + complex layout (irregularly structured or unstructured grids, etc.) + must use the Complex Dataspace message for expressing + the space the dataset inhabits. + (Note: The Complex Dataspace functionality is + not yet implemented (as of HDF5 Release 1.2). It is not described + in this document.) + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Simple Dataspace Message +
bytebytebytebyte
VersionDimensionalityFlagsReserved
Reserved
Dimension Size #1 (<size> bytes)
.
.
.
Dimension Size #n (<size> bytes)
Dimension Maximum #1 (<size> bytes)
.
.
.
Dimension Maximum #n (<size> bytes)
Permutation Index #1
.
.
.
Permutation Index #n
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version This value is used to determine the format of the + Simple Dataspace Message. When the format of the + information in the message is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted.
DimensionalityThis value is the number of dimensions that the data + object has.
FlagsThis field is used to store flags to indicate the + presence of parts of this message. Bit 0 (the least + significant bit) is used to indicate that maximum + dimensions are present. Bit 1 is used to indicate that + permutation indices are present for each dimension.
Dimension Size #n (<size> bytes)This value is the current size of the dimension of the + data as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension.
Dimension Maximum #n (<size> bytes)This value is the maximum size of the dimension of the + data as stored in the file. This value may be the special + value <UNLIMITED> (all bits set) which indicates + that the data may expand along this dimension + indefinitely. If these values are not stored, the maximum + value of each dimension is assumed to be the same as the + current size value.
Permutation Index #n (4 bytes)This value is the index permutation used to map + each dimension from the canonical representation to an + alternate axis for each dimension. If these values are + not stored, the first dimension stored in the list of + dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension.
+
+ + + + + + + +
+

Name: Datatype

+ + Type: 0x0003
+ Length: variable
+ Status: One required per dataset or named datatype
+ +

The datatype message defines the datatype for each data point + of a dataset. A datatype can describe an atomic type like a + fixed- or floating-point type or a compound type like a C + struct. A datatype does not, however, describe how data points + are combined to produce a dataset. Datatypes are stored on disk + as a datatype message, which is a list of datatype classes and + their associated properties. + +

+

+ + + + + + + + + + + + + + + + + + + + + + +
+ Datatype Message +
bytebytebytebyte
Type Class and VersionClass Bit Field
Size in Bytes (4 bytes)


Properties


+
+ +

The Class Bit Field and Properties fields vary depending + on the Type Class, which is the low-order four bits of the Type + Class and Version field (the high-order four bits are the + version, which should be set to the value one). The type class + is one of 0 (fixed-point number), 1 (floating-point number), + 2 (date and time), 3 (text string), 4 (bit field), 5 (opaque), + 6 (compound), 7 (reference), 8 (enumeration), or 9 (variable-length). + The Class Bit Field is zero and the size of the + Properties field is zero except for the cases noted here. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bit Field for Fixed-point Numbers (Class 0) +
BitsMeaning
0Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.
1, 2Padding type. Bit 1 is the lo_pad type and bit 2 + is the hi_pad type. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.
3Signed. If this bit is set then the fixed-point + number is in 2's complement form.
4-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + + +
+ Properties for Fixed-point Numbers (Class 0) +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bit Field for Floating-point Numbers (Class 1) +
BitsMeaning
0Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.
1, 2, 3Padding type. Bit 1 is the low bits pad type, bit 2 + is the high bits pad type, and bit 3 is the internal bits + pad type. If a datum has unused bits at either or between + the sign bit, exponent, or mantissa, then the value of bit + 1, 2, or 3 is copied to those locations.
4-5Normalization. The value can be 0 if there is no + normalization, 1 if the most significant bit of the + mantissa is always set (except for 0.0), and 2 if the most + signficant bit of the mantissa is not stored but is + implied to be set. The value 3 is reserved and will not + appear in this field.
6-7Reserved (zero).
8-15Sign. This is the bit position of the sign + bit.
16-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Properties for Floating-point Numbers (Class 1) +
ByteByteByteByte
Bit OffsetBit Precision
Exponent LocationExponent Size in BitsMantissa LocationMantissa Size in Bits
Exponent Bias
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + +
+ Bit Field for Strings (Class 3) +
BitsMeaning
0-3Padding type. This four-bit value determines the + type of padding to use for the string. The values are: + +
+
0 Null terminate. +
A zero byte marks the end of the string and is + guaranteed to be present after converting a long + string to a short string. When converting a short + string to a long string the value is padded with + additional null characters as necessary. + +

+
1 Null pad. +
Null characters are added to the end of the value + during conversions from short values to long values + but conversion in the opposite direction simply + truncates the value. + +

+
2 Space pad. +
Space characters are added to the end of the value + during conversions from short values to long values + but conversion in the opposite direction simply + truncates the value. This is the Fortran + representation of the string. + +

+
3-15 Reserved. +
These values are reserved for future use. +
+
4-7Character Set. The character set to use for + encoding the string. The only character set supported is + the 8-bit ASCII (zero) so no translations have been defined + yet.
8-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + +
+ Bit Field for Bitfield Types (Class 4) +
BitsMeaning
0Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.
1, 2Padding type. Bit 1 is the lo_pad type and bit 2 + is the hi_pad type. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.
3-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + + +
+ Properties for Bitfield Types (Class 4) +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +

+

+ + + + + + + + + + + + +
+ Bit Field for Opaque Types (Class 5) +
BitsMeaning
0-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + +
+ Properties for Opaque Types (Class 5) +
ByteByteByteByte

Null-terminated ASCII Tag
+ (multiple of 8 bytes)

+
+ +

+

+ + + + + + + + + + + + + + + + +
+ Bit Field for Compound Types (Class 6) +
BitsMeaning
0-15Number of Members. This field contains the number + of members defined for the compound datatype. The member + definitions are listed in the Properties field of the data + type message. +
15-23Reserved (zero).
+
+ +

The Properties field of a compound datatype is a list of the + member definitions of the compound datatype. The member + definitions appear one after another with no intervening bytes. + The member types are described with a recursive datatype + message. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Properties for Compound Types (Class 6) +
ByteByteByteByte


Name (null terminated, multiple of + eight bytes)


Byte Offset of Member in Compound Instance
Dimensionalityreserved
Dimension Permutation
Reserved
Size of Dimension 0 (required)
Size of Dimension 1 (required)
Size of Dimension 2 (required)
Size of Dimension 3 (required)


Member Type Message


+
+ +

+

+ + + + + + + + + + + + + + + + + +
+ Bit Field for Enumeration Types (Class 8) +
BitsMeaning
0-15Number of Members. The number of name/value + pairs defined for the enumeration type.
16-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + +
+ Properties for Enumeration Types (Class 8) +
ByteByteByteByte

Parent Type


Names


Values

+
+ +
+ + + + + + + + + + + +
Parent Type:Each enumeration type is based on some parent type, + usually an integer. The information for that parent type is + described recursively by this field.
Names:The name for each name/value pair. Each name is + stored as a null terminated ASCII string in a multiple of + eight bytes. The names are in no particular order.
Values:The list of values in the same order as the names. + The values are packed (no inter-value padding) and the + size of each value is determined by the parent type.
+
+ + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bit Field for Variable-length Types (Class 9) +
BitsMeaning
0-3
Type
+
0 Variable-length sequence
+
This variable-length datatype can be of any sequence + of data. Variable-length sequences do not have padding + or character set information.
+
1 Variable-length string
+
This variable-length datatype is composed of a series of + characters. Variable-length strings have padding and + character set information.
+
4-7
Padding type (variable-length string only)
+
This four-bit value determines the type of padding + used for variable-length strings. The values are the same + as for the string padding type, as follows:
+
0 Null terminate
+
A zero byte marks the end of a string and is guaranteed + to be present after converting a long string to a short + string. When converting a short string to a long string, + the value is padded with additional null characters + as necessary. +
1 Null pad
+
Null characters are added to the end of the value + during conversion from a short string to a longer string. + Conversion from a long string to a shorter string + simply truncates the value.
+
2 Space pad
+
Space characters are added to the end of the value + during conversion from a short string to a longer string. + Conversion from a long string to a shorter string simply + truncates the value. + This is the Fortran representation of the string. +
+
3-15 Reserved
+
These values are reserved for future use.
+
8-11
Character set (variable-length string only)
+
This four-bit value specifies the character set + to be used for encoding the string.
+
0 8-bit ASCII
+
As of this writing (July 2002, Release 1.4.4), + 8-bit ASCII is the only character set supported. + Therefore, no translations have been defined.
+
12-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + + +
+ Properties for Variable-length Types (Class 9) +
ByteByteByteByte

Parent Type

+
+ +
+ + + + + +
Parent Type:Each variable-length type is based on + some parent type. The information for that parent type is + described recursively by this field.
+
+ + + +

+ + + + +


+

Name: Data Storage - Fill Value

+ Type: 0x0004
+ Length: varies
+ Status: Optional, may not be repeated.
+ +

The fill value message stores a single data point value which + is returned to the application when an uninitialized data point + is read from the dataset. The fill value is interpretted with + the same datatype as the dataset. If no fill value message is + present then a fill value of all zero is assumed. + +

+

+ + + + + + + + + + + + + + + + + +
+ Fill Value Message +
bytebytebytebyte
Size (4 bytes)

Fill Value

+
+ +

+

+ + + + + + + + + + + + + + + +
Field NameDescription
Size (4 bytes)This is the size of the Fill Value field in bytes.
Fill ValueThe fill value. The bytes of the fill value are + interpreted using the same datatype as for the dataset.
+
+ +
+

Name: Reserved - Not Assigned Yet

+ Type: 0x0005
+ Length: N/A
+ Status: N/A
+ + + +
+

Name: Data Storage - Compact

+ + Type: 0x0006
+ Length: varies
+ Status: Optional, may not be repeated.
+ +

This message indicates that the data for the data object is + stored within the current HDF file by including the actual + data as the header data for this message. The data is + stored internally in + the normal format, i.e. in one chunk, uncompressed, etc. + +

Note that one and only one of the Data Storage headers can be + stored for each data object. + +

Format of Data: The message data is actually composed + of dataset data, so the format will be determined by the dataset + format. + + + +


+

Name: Data Storage - + External Data Files

+ Type: 0x0007
+ Length: varies
+ Status: Optional, may not be repeated.
+ +

Purpose and Description: The external object message + indicates that the data for an object is stored outside the HDF5 + file. The filename of the object is stored as a Universal + Resource Location (URL) of the actual filename containing the + data. An external file list record also contains the byte offset + of the start of the data within the file and the amount of space + reserved in the file for that data. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ External File List Message +
bytebytebytebyte
VersionReserved
Allocated SlotsUsed Slots

Heap Address


Slot Definitions...

+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version This value is used to determine the format of the + External File List Message. When the format of the + information in the message is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted.
ReservedThis field is reserved for future use.
Allocated SlotsThe total number of slots allocated in the message. Its + value must be at least as large as the value contained in + the Used Slots field.
Used SlotsThe number of initial slots which contain valid + information. The remaining slots are zero filled.
Heap AddressThis is the address of a local name heap which contains + the names for the external files. The name at offset zero + in the heap is always the empty string.
Slot DefinitionsThe slot definitions are stored in order according to + the array addresses they represent. If more slots have + been allocated than what has been used then the defined + slots are all at the beginning of the list.
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + +
+ External File List Slot +
bytebytebytebyte

Name Offset (<size> bytes)


File Offset (<size> bytes)


Size

+
+ +

+

+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Name Offset (<size> bytes)The byte offset within the local name heap for the name + of the file. File names are stored as a URL which has a + protocol name, a host name, a port number, and a file + name: + protocol:port//host/file. + If the protocol is omitted then "file:" is assumed. If + the port number is omitted then a default port for that + protocol is used. If both the protocol and the port + number are omitted then the colon can also be omitted. If + the double slash and host name are omitted then + "localhost" is assumed. The file name is the only + mandatory part, and if the leading slash is missing then + it is relative to the application's current working + directory (the use of relative names is not + recommended).
File Offset (<size> bytes)This is the byte offset to the start of the data in the + specified file. For files that contain data for a single + dataset this will usually be zero.
SizeThis is the total number of bytes reserved in the + specified file for raw data storage. For a file that + contains exactly one complete dataset which is not + extendable, the size will usually be the exact size of the + dataset. However, by making the size larger one allows + HDF5 to extend the dataset. The size can be set to a value + larger than the entire file since HDF5 will read zeros + past the end of the file without failing.
+
+ + +
+

Name: Data Storage - Layout

+ + Type: 0x0008
+ Length: varies
+ Status: Required for datasets, may not be repeated. + +

Purpose and Description: Data layout describes how the + elements of a multi-dimensional array are arranged in the linear + address space of the file. Two types of data layout are + supported: + +

    +
  1. The array can be stored in one contiguous area of the file. + The layout requires that the size of the array be constant and + does not permit chunking, compression, checksums, encryption, + etc. The message stores the total size of the array and the + offset of an element from the beginning of the storage area is + computed as in C. + +
  2. The array domain can be regularly decomposed into chunks and + each chunk is allocated separately. This layout supports + arbitrary element traversals, compression, encryption, and + checksums, and the chunks can be distributed across external + raw data files (these features are described in other + messages). The message stores the size of a chunk instead of + the size of the entire array; the size of the entire array can + be calculated by traversing the B-tree that stores the chunk + addresses. +
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Data Layout Message +
bytebytebytebyte
VersionDimensionalityLayout ClassReserved
Reserved

Address

Dimension 0 (4-bytes)
Dimension 1 (4-bytes)
...
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
VersionA version number for the layout message. This + documentation describes version one.
DimensionalityAn array has a fixed dimensionality. This field + specifies the number of dimension size fields later in the + message.
Layout ClassThe layout class specifies how the other fields of the + layout message are to be interpreted. A value of one + indicates contiguous storage while a value of two + indicates chunked storage. Other values will be defined + in the future.
AddressFor contiguous storage, this is the address of the first + byte of storage. For chunked storage this is the address + of the B-tree that is used to look up the addresses of the + chunks.
DimensionsFor contiguous storage the dimensions define the entire + size of the array while for chunked storage they define + the size of a single chunk.
+
+ + +
+

Name: Reserved - Not Assigned Yet

+ Type: 0x0009
+ Length: N/A
+ Status: N/A
+ Purpose and Description: N/A
+ Format of Data: N/A + +
+

Name: Reserved - Not Assigned Yet

+ Type: 0x000A
+ Length: N/A
+ Status: N/A
+ Purpose and Description: N/A
+ Format of Data: N/A + +
+

Name: Data Storage - Filter Pipeline

+ Type: 0x000B
+ Length: varies
+ Status: Optional, may not be repeated. + +

Purpose and Description: This message describes the + filter pipeline which should be applied to the data stream by + providing filter identification numbers, flags, a name, an + client data. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ Filter Pipeline Message +
bytebytebytebyte
VersionNumber of FiltersReserved
Reserved

Filter List

+
+ +

+

+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription
VersionThe version number for this message. This document + describes version one.
Number of FiltersThe total number of filters described by this + message. The maximum possible number of filters in a + message is 32.
Filter ListA description of each filter. A filter description + appears in the next table.
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Filter Pipeline Message +
bytebytebytebyte
Filter IdentificationName Length
FlagsClient Data Number of Values

Name


Client Data

Padding
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Filter IdentificationThis is a unique (except in the case of testing) + identifier for the filter. Values from zero through 255 + are reserved for filters defined by the NCSA HDF5 + library. Values 256 through 511 have been set aside for + use when developing/testing new filters. The remaining + values are allocated to specific filters by contacting the + HDF5 Development + Team.
Name LengthEach filter has an optional null-terminated ASCII name + and this field holds the length of the name including the + null termination padded with nulls to be a multiple of + eight. If the filter has no name then a value of zero is + stored in this field.
FlagsThe flags indicate certain properties for a filter. The + bit values defined so far are: + +
+
bit 1 +
If set then the filter is an optional filter. + During output, if an optional filter fails it will be + silently removed from the pipeline. +
+
Client Data Number of ValuesEach filter can store a few integer values to control + how the filter operates. The number of entries in the + Client Data array is stored in this field.
NameIf the Name Length field is non-zero then it will + contain the size of this field, a multiple of eight. This + field contains a null-terminated, ASCII character + string to serve as a comment/name for the filter.
Client DataThis is an array of four-byte integers which will be + passed to the filter function. The Client Data Number of + Values determines the number of elements in the + array.
PaddingFour bytes of zeros are added to the message at this + point if the Client Data Number of Values field contains + an odd number.
+
+ +
+

Name: Attribute

+ Type: 0x000C
+ Length: varies
+ Status: Optional, may be repeated.
+ +

Purpose and Description: The Attribute + message is used to list objects in the HDF file which are used + as attributes, or "meta-data" about the current object. An + attribute is a small dataset; it has a name, a datatype, a data + space, and raw data. Since attributes are stored in the object + header they must be relatively small (<64kb) and can be + associated with any type of object which has an object header + (groups, datasets, named types and spaces, etc.). + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Attribute Message +
bytebytebytebyte
VersionReservedName Size
Type SizeSpace Size

Name


Type


Space


Data

+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
VersionVersion number for the message. This document describes + version 1 of attribute messages.
ReservedThis field is reserved for later use and is set to + zero.
Name SizeThe length of the attribute name in bytes including the + null terminator. Note that the Name field below may + contain additional padding not represented by this + field.
Type SizeThe length of the datatype description in the Type + field below. Note that the Type field may contain + additional padding not represented by this field.
Space SizeThe length of the dataspace description in the Space + field below. Note that the Space field may contain + additional padding not represented by this field.
NameThe null-terminated attribute name. This field is + padded with additional null characters to make it a + multiple of eight bytes.
TypeThe datatype description follows the same format as + described for the datatype object header message. This + field is padded with additional zero bytes to make it a + multiple of eight bytes.
SpaceThe dataspace description follows the same format as + described for the dataspace object header message. This + field is padded with additional zero bytes to make it a + multiple of eight bytes.
DataThe raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. This + field is not padded with additional zero + bytes.
+
+ +
+

Name: Object Name

+ +

Type: 0x000D
+ Length: varies
+ Status: Optional, may not be repeated. + +

Purpose and Description: The object name or comment is + designed to be a short description of an object. An object name + is a sequence of non-zero (\0) ASCII characters with no other + formatting included by the library. + +

+

+ + + + + + + + + + + + + +
+ Name Message +
bytebytebytebyte

Name

+
+ +

+

+ + + + + + + + + + +
Field NameDescription
NameA null terminated ASCII character string.
+
+ +
+

Name: Object Modification Date & Time

+ +

Type: 0x000E
+ Length: fixed
+ Status: Optional, may not be repeated. + +

Purpose and Description: The object modification date + and time is a timestamp which indicates (using ISO-8601 date and + time format) the last modification of an object. The time is + updated when any object header message changes according to the + system clock where the change was posted. + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Modification Time Message +
bytebytebytebyte
Year
MonthDay of Month
HourMinute
SecondReserved
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
YearThe four-digit year as an ASCII string. For example, + 1998. All fields of this message should be interpreted + as coordinated universal time (UTC)
MonthThe month number as a two digit ASCII string where + January is 01 and December is 12.
Day of MonthThe day number within the month as a two digit ASCII + string. The first day of the month is 01.
HourThe hour of the day as a two digit ASCII string where + midnight is 00 and 11:00pm is 23.
MinuteThe minute of the hour as a two digit ASCII string where + the first minute of the hour is 00 and + the last is 59.
SecondThe second of the minute as a two digit ASCII string + where the first second of the minute is 00 + and the last is 59.
ReservedThis field is reserved and should always be zero.
+
+ +
+

Name: Shared Object Message

+ Type: 0x000F
+ Length: 4 Bytes
+ Status: Optional, may be repeated. + +

A constant message can be shared among several object headers + by writing that message in the global heap and having the object + headers all point to it. The pointing is accomplished with a + Shared Object message which is understood directly by the object + header layer of the library. It is also possible to have a + message of one object header point to a message in some other + object header, but care must be exercised to prevent cycles. + +

If a message is shared, then the message appears in the global + heap and its message ID appears in the Header Message Type + field of the object header. Also, the Flags field in the object + header for that message will have bit two set (the + H5O_FLAG_SHARED bit). The message body in the + object header will be that of a Shared Object message defined + here and not that of the pointed-to message. + +

+

+ + + + + + + + + + + + + + + + + + + +
+ Shared Message Message +
byte + byte + byte + byte +
VersionFlagsReserved
Reserved

Pointer

+
+ +

+

+ + + + + + + + + + + + + + + + + + + +
Field NameDescription
VersionThe version number for the message. This document + describes version one of shared messages.
FlagsThe Shared Message message points to a message which is + shared among multiple object headers. The Flags field + describes the type of sharing: + +
+
Bit 0 +
If this bit is clear then the actual message is the + first message in some other object header; otherwise + the actual message is stored in the global heap. + +
Bits 2-7 +
Reserved (always zero) +
+
PointerThis field points to the actual message. The format of + the pointer depends on the value of the Flags field. If + the actual message is in the global heap then the pointer + is the file address of the global heap collection that + holds the message, and a four-byte index into that + collection. Otherwise the pointer is a group entry + that points to some other object header.
+
+ + +
+

Name: Object Header Continuation

+Type: 0x0010
+Length: fixed
+Status: Optional, may be repeated.
+Purpose and Description: The object header continuation is the location +in the file of more header messages for the current data object. This can be +used when header blocks are large, or likely to change over time.
+Format of Data:

+ The object header continuation is formatted as follows (assuming a 4-byte +length & offset are being used in the current file): + +

+

+ + + + + + + + + + + + + +
+HDF5 Object Header Continuation Message Layout +
bytebytebytebyte
Header Continuation Offset
Header Continuation Length
+
+ +

+

+
The elements of the Header Continuation Message are described below: +
+
+
Header Continuation Offset: (<offset> bytes) +
This value is the offset in bytes from the beginning of the file where the +header continuation information is located. +
Header Continuation Length: (<length> bytes) +
This value is the length in bytes of the header continuation information in +the file. +
+
+ + + +
+

Name: Group Message

+Type: 0x0011
+Length: fixed
+Status: Required for groups, may not be repeated.
+Purpose and Description: Each group has a B-tree and a +name heap which are pointed to by this message.
+Format of data: +

The group message is formatted as follows: + +

+

+ + + + + + + + + + + + + + +
+HDF5 Object Header Group Message Layout +
bytebytebytebyte
B-tree Address
Heap Address
+
+ +

+

+
The elements of the Group Message are described below: +
+
+
B-tree Address (<offset> bytes) +
This value is the offset in bytes from the beginning of the file +where the B-tree is located. +
Heap Address (<offset> bytes) +
This value is the offset in bytes from the beginning of the file +where the group name heap is located. +
+
+ +

Disk Format: Level 2b - Shared Data Object Headers

+

In order to share header messages between several dataset objects, object +header messages may be placed into the global heap. Since these +messages require additional information beyond the basic object header message +information, the format of the shared message is detailed below. + +

+

+ + + + + + + + + + + + + +
+HDF5 Shared Object Header Message +
bytebytebytebyte
Reference Count of Shared Header Message

Shared Object Header Message

+
+ +

+

+
The elements of the shared object header message are described below: +
+
+
Reference Count of Shared Header Message: (32-bit unsigned integer) +
This value is used to keep a count of the number of dataset objects which +refer to this message from their dataset headers. When this count reaches zero, +the shared message header may be removed from the global heap. +
Shared Object Header Message: (various lengths) +
The data stored for the shared object header message is formatted in the +same way as the private object header messages described in the object header +description earlier in this document and begins with the header message Type. +
+
+ + +

Disk Format: Level 2c - Data Object Data Storage

+

The data for an object is stored separately from the header +information in the file and may not actually be located in the HDF5 file +itself if the header indicates that the data is stored externally. The +information for each record in the object is stored according to the +dimensionality of the object (indicated in the dimensionality header message). +Multi-dimensional data is stored in C order [same as current scheme], i.e. the +"last" dimension changes fastest. +

Data whose elements are composed of simple number-types are stored in +native-endian IEEE format, unless they are specifically defined as being stored +in a different machine format with the architecture-type information from the +number-type header message. This means that each architecture will need to +[potentially] byte-swap data values into the internal representation for that +particular machine. +

Data with a "variable" sized number-type is stored in a data heap +internal to the HDF5 file. Global heap identifiers are stored in the +data object storage. +

Data whose elements are composed of pointer number-types are stored in several +different ways depending on the particular pointer type involved. Simple +pointers are just stored as the dataset offset of the object being pointed to with the +size of the pointer being the same number of bytes as offsets in the file. +Partial-object pointers are stored as a heap-ID which points to the following +information within the file-heap: an offset of the object pointed to, number-type +information (same format as header message), dimensionality information (same +format as header message), sub-set start and end information (i.e. a coordinate +location for each), and field start and end names (i.e. a [pointer to the] +string indicating the first field included and a [pointer to the] string name +for the last field). + +

Data of a compound datatype is stored as a contiguous stream of the items +in the structure, with each item formatted according to its datatype. + + + diff --git a/doxygen/examples/H5.format.1.1.html b/doxygen/examples/H5.format.1.1.html new file mode 100644 index 0000000..ebbbe8e --- /dev/null +++ b/doxygen/examples/H5.format.1.1.html @@ -0,0 +1,6439 @@ + + + + HDF5 File Format Specification Version 1.1 + + + + + + +

+ + + +
+
    +
  1. Introduction +
  2. Disk Format Level 0 - File Metadata + +
      +
    1. Disk Format Level 0A - File Signature and Super Block +
    2. Disk Format Level 0B - File Driver Info +
    +
    +
  3. Disk Format Level 1 - File Infrastructure + +
      +
    1. Disk Format Level 1A - B-link Trees and B-tree Nodes +
    2. Disk Format Level 1B - Group +
    3. Disk Format Level 1C - Group Entry +
    4. Disk Format Level 1D - Local Heaps +
    5. Disk Format Level 1E - Global Heap +
    6. Disk Format Level 1F - Free-space Index +
    +
    +
  4. Disk Format Level 2 - Data Objects + +
      +
    1. Disk Format Level 2a - Data Object Headers +
        +
      1. Name: NIL +
      2. Name: Simple Dataspace + +
      3. Name: Reserved - not assigned yet +
      4. Name: Datatype +
      5. Name: Data Storage - Fill Value (Old) +
      6. Name: Data Storage - Fill Value +
      +
    +
    +
+
   +
    + +
  1. Disk Format Level 2 - Data Objects + (Continued) +
      +
    1. Disk Format Level 2a - Data Object Headers(Continued) +
        + +
      1. Name: Reserved - not assigned yet +
      2. Name: Data Storage - External Data Files +
      3. Name: Data Storage - Layout +
      4. Name: Reserved - not assigned yet +
      5. Name: Reserved - not assigned yet +
      6. Name: Data Storage - Filter Pipeline +
      7. Name: Attribute +
      8. Name: Object Comment +
      9. Name: Object Modification Date and Time (Old) +
      10. Name: Shared Object Message +
      11. Name: Object Header Continuation +
      12. Name: Group Message +
      13. Name: Object Modification Date and Time +
      +
    2. Disk Format: Level 2b - Data Object Data Storage +
    +
    +
  2. Appendix +
+
+
+ +
+
+ + +

Introduction

+ + + + + + + +
  +
+ HDF5 Groups +
 
  + Figure 1: Relationships among the HDF5 root group, other groups, and objects +
+
 
  + HDF5 Objects +  
  + Figure 2: HDF5 objects -- datasets, datatypes, or dataspaces +
+
 
+ + +

The format of an HDF5 file on disk encompasses several + key ideas of the HDF4 and AIO file formats as well as + addressing some shortcomings therein. The new format is + more self-describing than the HDF4 format and is more + uniformly applied to data objects in the file. + +

An HDF5 file appears to the user as a directed graph. + The nodes of this graph are the higher-level HDF5 objects + that are exposed by the HDF5 APIs: + +

    +
  • Groups +
  • Datasets +
  • Named datatypes +
+ +

At the lowest level, as information is actually written to the disk, + an HDF5 file is made up of the following objects: +

    +
  • A super block +
  • B-tree nodes (containing either symbol nodes or raw data chunks) +
  • Object headers +
  • A global heap +
  • Local heaps +
  • Free space +
+ +

The HDF5 library uses these low-level objects to represent the + higher-level objects that are then presented to the user or + to applications through the APIs. + For instance, a group is an object header that contains a message that + points to a local heap and to a B-tree which points to symbol nodes. + A dataset is an object header that contains messages that describe + datatype, space, layout, filters, external files, fill value, etc + with the layout message pointing to either a raw data chunk or to a + B-tree that points to raw data chunks. + + +

This Document

+ +

This document describes the lower-level data objects; + the higher-level objects and their properties are described + in the HDF5 User's Guide. + +

Three levels of information comprise the file format. + Level 0 contains basic information for identifying and + defining information about the file. Level 1 information contains + the information about the pieces of a file shared by many objects + in the file (such as a B-trees and heaps). Level 2 is the rest + of the file and contains all of the data objects, with each object + partitioned into header information, also known as + metadata, and data. + +

The sizes of various fields in the following layout tables are + determined by looking at the number of columns the field spans + in the table. There are three exceptions: (1) The size may be + overridden by specifying a size in parentheses, (2) the size of + addresses is determined by the Size of Offsets field + in the super block and is indicated in this document with a + superscripted 'O', and (3) the size of length fields is determined + by the Size of Lengths field in the super block and is + indicated in this document with a superscripted 'L'. + +

Values for all fields in this document should be treated as unsigned + integers, unless otherwise noted in the description of a field. + Additionally, all metadata fields are stored in little-endian byte + order. +

+ +
+
+ +

+ Disk Format: Level 0 - File Metadata

+ +

+ Disk Format: Level 0A - File Signature and Super Block

+ +

The super block may begin at certain predefined offsets within + the HDF5 file, allowing a block of unspecified content for + users to place additional information at the beginning (and + end) of the HDF5 file without limiting the HDF5 library's + ability to manage the objects within the file itself. This + feature was designed to accommodate wrapping an HDF5 file in + another file format or adding descriptive information to the + file without requiring the modification of the actual file's + information. The super block is located by searching for the + HDF5 file signature at byte offset 0, byte offset 512 and at + successive locations in the file, each a multiple of two of + the previous location, i.e. 0, 512, 1024, 2048, etc. + +

The super block is composed of a file signature, followed by + super block and group version numbers, information + about the sizes of offset and length values used to describe + items within the file, the size of each group page, + and a group entry for the root object in the file. + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ HDF5 Super Block Layout +
bytebytebytebyte

HDF5 File Signature (8 bytes)

Version # of Super BlockVersion # of Global Free-space StorageVersion # of Root Group Symbol Table EntryReserved (zero)
Version # of Shared Header Message FormatSize of OffsetsSize of LengthsReserved (zero)
Group Leaf Node KGroup Internal Node K
File Consistency Flags
Indexed Storage Internal Node K1Reserved (zero)1
Base AddressO
Address of Global Free-space HeapO
End of File AddressO
Driver Information Block AddressO
Root Group Symbol Table Entry
+ + + + +
+ (Items marked with an 'O' the above table are +
+ of the size specified in "Size of Offsets.") +
+ (Items marked with an '1' the above table are +
+ new in version 1 of the superblock) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
HDF5 File Signature +

This field contains a constant value and can be used to + quickly identify a file as being an HDF5 file. The + constant value is designed to allow easy identification of + an HDF5 file and to allow certain types of data corruption + to be detected. The file signature of an HDF5 file always + contains the following values: +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Decimal:13772687013102610
Hexadecimal:894844460d0a1a0a
ASCII C Notation:\211HDF\r\n\032\n
+
+
+ +

This signature both identifies the file as an HDF5 file + and provides for immediate detection of common + file-transfer problems. The first two bytes distinguish + HDF5 files on systems that expect the first two bytes to + identify the file type uniquely. The first byte is + chosen as a non-ASCII value to reduce the probability + that a text file may be misrecognized as an HDF5 file; + also, it catches bad file transfers that clear bit + 7. Bytes two through four name the format. The CR-LF + sequence catches bad file transfers that alter newline + sequences. The control-Z character stops file display + under MS-DOS. The final line feed checks for the inverse + of the CR-LF translation problem. (This is a direct + descendent of the PNG file + signature.) +

+ +

This field is present in version 0+ of the superblock. +

+
Version Number of the Super Block +

This value is used to determine the format of the + information in the super block. When the format of the + information in the super block is changed, the version number + is incremented to the next integer and can be used to + determine how the information in the super block is + formatted. +

+ +

Values of 0 and 1 are defined for this field. +

+ +

This field is present in version 0+ of the superblock. +

+
Version Number of the File Free-space Information +

This value is used to determine the format of the + information in the File Free-space Information. +

+

The only value currently valid in this field is '0', which + indicates that the free space index is formatted as described + below. +

+ +

This field is present in version 0+ of the superblock. +

+
Version Number of the Root Group Symbol Table Entry +

This value is used to determine the format of the + information in the Root Group Symbol Table Entry. When the + format of the information in that field is changed, the + version number is incremented to the next integer and can be + used to determine how the information in the field + is formatted. +

+

The only value currently valid in this field is '0', which + indicates that the root group symbol table entry is formatted as + described below. +

+ +

This field is present in version 0+ of the superblock. +

+
Version Number of the Shared Header Message Format +

This value is used to determine the format of the + information in a shared object header message. Since the format + of the shared header messages differs from the other private + header messages, a version number is used to identify changes + in the format. +

+

The only value currently valid in this field is '0', which + indicates that shared header messages are formatted as + described below. +

+ +

This field is present in version 0+ of the superblock. +

+
Size of Offsets +

This value contains the number of bytes used to store + addresses in the file. The values for the addresses of + objects in the file are offsets relative to a base address, + usually the address of the super block signature. This + allows a wrapper to be added after the file is created + without invalidating the internal offset locations. +

+ +

This field is present in version 0+ of the superblock. +

+
Size of Lengths +

This value contains the number of bytes used to store + the size of an object. +

+ +

This field is present in version 0+ of the superblock. +

+
Group Leaf Node K +

Each leaf node of a group B-tree will have at + least this many entries but not more than twice this + many. If a group has a single leaf node then it + may have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 0+ of the superblock. +

+
Group Internal Node K +

Each internal node of a group B-tree will have at + least this many entries but not more than twice this + many. If the group has only one internal + node then it might have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 0+ of the superblock. +

+
File Consistency Flags +

This value contains flags to indicate information + about the consistency of the information contained + within the file. Currently, the following bit flags are + defined: +

    +
  • Bit 0 set indicates that the file is opened for + write-access. +
  • Bit 1 set indicates that the file has + been verified for consistency and is guaranteed to be + consistent with the format defined in this document. +
  • Bits 2-31 are reserved for future use. +
+ Bit 0 should be + set as the first action when a file is opened for write + access and should be cleared only as the final action + when closing a file. Bit 1 should be cleared during + normal access to a file and only set after the file's + consistency is guaranteed by the library or a + consistency utility. +

+ +

This field is present in version 0+ of the superblock. +

+
Indexed Storage Internal Node K +

Each internal node of a indexed storage B-tree will have at + least this many entries but not more than twice this + many. If the group has only one internal + node then it might have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 1+ of the superblock. +

+
Base Address +

This is the absolute file address of the first byte of + the HDF5 data within the file. The library currently + constrains this value to be the absolute file address + of the super block itself when creating new files; + future versions of the library may provide greater + flexibility. When opening an existing file and this address does + not match the offset of the superblock, the library assumes + that the entire contents of the HDF5 file have been adjusted in + the file and adjusts the base address and end of file address to + reflect their new positions in the file. Unless otherwise noted, + all other file addresses are relative to this base + address. +

+ +

This field is present in version 0+ of the superblock. +

+
Address of Global Free-space Index +

Free-space management is not yet defined in the HDF5 + file format and is not handled by the library. + Currently this field always contains the + undefined address. +

+ +

This field is present in version 0+ of the superblock. +

+
End of File Address +

This is the absolute file address of the first byte past + the end of all HDF5 data. It is used to determine whether a + file has been accidently truncated and as an address where + file data allocation can occur if space from the free list is + not used. +

+ +

This field is present in version 0+ of the superblock. +

+
Driver Information Block Address +

This is the relative file address of the file driver + information block which contains driver-specific + information needed to reopen the file. If there is no + driver information block then this entry should be the + undefined address. +

+ +

This field is present in version 0+ of the superblock. +

+
Root Group Symbol Table Entry +

This is the symbol table entry + of the root group, which serves as the entry point into + the group graph for the file. +

+ +

This field is present in version 0+ of the superblock. +

+
+
+ +

+ Disk Format: Level 0B - File Driver Info

+ +

The file driver information block is an optional region of the + file which contains information needed by the file driver in + order to reopen a file. The format of the file driver information + block is: + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Driver Information Block +
bytebytebytebyte
VersionReserved (zero)
Driver Information Size (4 bytes)

Driver Identification (8 bytes)



Driver Information (n bytes)


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version +

The version number of the driver information block. The + file format documented here is version zero. +

+
Driver Information Size +

The size in bytes of the Driver Information part of this + structure. +

+
Driver Identification +

This is an eight-byte ASCII string without null + termination which identifies the driver and version number + of the Driver Information block. The predefined drivers + supplied with the HDF5 library are identified by the + letters NCSA followed by the first four characters of + the driver name. If the Driver Information block is not + the original version then the last letter(s) of the + identification will be replaced by a version number in + ASCII. +

+

+ For example, the various versions of the multi driver + will be identified by NCSAmult. + (NCSAmult is simply NCSAmulti truncated + to eight characters. Subsequent identifiers will be created by + substituting sequential numerical values for the final character, + starting with zero.) multi driver is the only default driver that + is encoded in this field. +

+

+ Identification for user-defined drivers + is eight-byte long and arbitrary but should be unique and avoid + the four character prefix "NCSA". +

+
Driver InformationDriver information is encoded/decoded in a format defined by the + file driver. multi driver is the only default driver that has driver + information stored in this field. Its format is explained in the + following block.
+
+ +
+

Multi driver has the following format:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Multi Driver Message +
bytebytebytebyte
Member MappingMember MappingMember MappingMember Mapping
Member MappingMember MappingReservedReserved

Address of Member File 1


End of Address for Member File 1


Address of Member File 2


End of Address for Member File 2


... ...


Name of Member File 1


Name of Member File 2


... ...

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Member Mapping

Multi driver enables different types of HDF5 data and + metadata to be written to separate files. These files are viewed by the + library as a single virtual HDF5 file with a single file address. + It allows maximal 6 files to be created. + In sequence, these Member Mapping fields are for super block, + B-tree, raw data, global heap, local heap, + and object header. More than one type of data can be written to the + same file.

+

These Member Mapping fields are integer values from 1 to 6 + indicating how the data can be mapped to or merged with another type of + data. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Member MappingDescription
1The super block data.
2The B-tree data.
3The raw data.
4The global heap data.
5The local heap data.
6The object header data.

+ For example, if the third field has the value 3 and all the rest have the + value 1, it means there are two files, one for raw data, one for super block, + B-tree, global heap, local heap, and object header. +
Reserved

These fields are reserved and should always be zero.

Address of Member File

Specifies the virtual address. A normally eight-byte integer with + the value from 0 (zero) to maximal value, + at which the member file starts.

End of Address for Member File

The end of allocated address for the member file. A normally eight-byte + integer value.

Name of Member File

The null-terminated name of member file. Its length should be multiples of + 8 bytes. Additional bytes will be padded with NULLs. The default naming + convention is %%s-X.h5, where X is one of the letters + s (for super block), b (for B-tree), r (for raw data), + g (for global heap), l (for local heap), and o (for + object header). The name for the whole HDF5 file will substitute the %s + in the string. +

+
+
+ +
+
+ +

+ Disk Format: Level 1 - File Infrastructure

+

Disk Format: Level 1A - B-link Trees and B-tree Nodes

+ +

B-link trees allow flexible storage for objects which tend to grow + in ways that cause the object to be stored discontiguously. B-trees + are described in various algorithms books including "Introduction to + Algorithms" by Thomas H. Cormen, Charles E. Leiserson, and Ronald + L. Rivest. The B-link tree, in which the sibling nodes at a + particular level in the tree are stored in a doubly-linked list, + is described in the "Efficient Locking for Concurrent Operations + on B-trees" paper by Phillip Lehman and S. Bing Yao as published + in the ACM Transactions on Database Systems, Vol. 6, + No. 4, December 1981. + +

The B-link trees implemented by the file format contain one more + key than the number of children. In other words, each child + pointer out of a B-tree node has a left key and a right key. + The pointers out of internal nodes point to sub-trees while + the pointers out of leaf nodes point to symbol nodes and + raw data chunks. + Aside from that difference, internal nodes and leaf nodes + are identical. + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ B-tree Nodes +
bytebytebytebyte
Signature
Node TypeNode LevelEntries Used
Address of Left SiblingO
Address of Right SiblingO
Key 0 (variable size)
Address of Child 0O
Key 1 (variable size)
Address of Child 1O
...
Key 2K (variable size)
Address of Child 2KO
Key 2K+1 (variable size)
+ + + +
+ (Items marked with an 'O' the above table are +
+ of the size specified in "Size of Offsets.") +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Signature +

The ASCII character string "TREE" is + used to indicate the + beginning of a B-link tree node. This gives file + consistency checking utilities a better chance of + reconstructing a damaged file. +

+
Node Type +

Each B-link tree points to a particular type of data. + This field indicates the type of data as well as + implying the maximum degree K of the tree and + the size of each Key field. +

+ + + + + + + + + + + + + + +
Node TypeDescription
0This tree points to group nodes.
1This tree points to raw data chunk nodes.
+
Node Level +

The node level indicates the level at which this node + appears in the tree (leaf nodes are at level zero). Not + only does the level indicate whether child pointers + point to sub-trees or to data, but it can also be used + to help file consistency checking utilities reconstruct + damanged trees. +

+
Entries Used +

This determines the number of children to which this + node points. All nodes of a particular type of tree + have the same maximum degree, but most nodes will point + to less than that number of children. The valid child + pointers and keys appear at the beginning of the node + and the unused pointers and keys appear at the end of + the node. The unused pointers and keys have undefined + values. +

+
Address of Left Sibling +

This is the relative file address of the left sibling of + the current node. If the current + node is the left-most node at this level then this field + is the undefined address. +

+
Address of Right Sibling +

This is the relative file address of the right sibling of + the current node. If the current + node is the right-most node at this level then this + field is the undefined address. +

+
Keys and Child Pointers +

Each tree has 2K+1 keys with 2K + child pointers interleaved between the keys. The number + of keys and child pointers actually containing valid + values is determined by the node's Entries Used field. + If that field is N then the B-link tree contains + N child pointers and N+1 keys. +

+
Key +

The format and size of the key values is determined by + the type of data to which this tree points. The keys are + ordered and are boundaries for the contents of the child + pointer; that is, the key values represented by child + N fall between Key N and Key + N+1. Whether the interval is open or closed on + each end is determined by the type of data to which the + tree points. +

+ +

+ The format of the key depends on the node type. + For nodes of node type 0 (group nodes), the key is formatted as + follows: +

+ + + + + +
A single field of Size of Lengths + bytes:Indicates the byte offset into the local heap + for the first object name in the subtree which + that key describes. +
+
+

+ +

+ For nodes of node type 1 (chunked raw data nodes), the key is + formatted as follows: +

+ + + + + + + + + + + + + +
Bytes 1-4:Size of chunk in bytes.
Bytes 4-8:Filter mask, a 32-bit bitfield indicating which + filters have been skipped for this chunk. Each filter + has an index number in the pipeline (starting at 0, with + the first filter to apply) and if that filter is skipped, + the bit corresponding to it's index is set.
N 64-bit fields:A 64-bit index indicating the offset of the + chunk within the dataset where N is the number + of dimensions of the dataset. For example, if + a chunk in a 3-dimensional dataset begins at the + position [5,5,5], there will be three + such 64-bit indices, each with the value of + 5.
+
+

+
Child Pointer +

The tree node contains file addresses of subtrees or + data depending on the node level. Nodes at Level 0 point + to data addresses, either raw data chunk or group nodes. + Nodes at non-zero levels point to other nodes of the + same B-tree. +

+

For raw data chunk nodes, the child pointer is the address + of a single raw data chunk. For group nodes, the child pointer + points to a symbol table, which contains + information for multiple symbol table entries. +

+
+
+ +

+ Conceptually, each B-tree node looks like this: +

+ + + + + + + + + + + + + +
key[0] child[0] key[1] child[1] key[2] ... ... key[N-1] child[N-1] key[N]
+
+
+ + where child[i] is a pointer to a sub-tree (at a level + above Level 0) or to data (at Level 0). + Each key[i] describes an item stored by the B-tree + (a chunk or an object of a group node). The range of values + represented by child[i] is indicated by key[i] + and key[i+1]. + + +

The following question must next be answered: + "Is the value described by key[i] contained in + child[i-1] or in child[i]?" + The answer depends on the type of tree. + In trees for groups (node type 0) the object described by + key[i] is the greatest object contained in + child[i-1] while in chunk trees (node type 1) the + chunk described by key[i] is the least chunk in + child[i]. + +

That means that key[0] for group trees is sometimes unused; + it points to offset zero in the heap, which is always the + empty string and compares as "less-than" any valid object name. + +

And key[N] for chunk trees is sometimes unused; + it contains a chunk offset which compares as "greater-than" + any other chunk offset and has a chunk byte size of zero + to indicate that it is not actually allocated. + + +

Disk Format: Level 1B - Group and Symbol Nodes

+ +

A group is an object internal to the file that allows + arbitrary nesting of objects within the file (including other groups). + A group maps a set of names in the group to a set of relative + file addresses where objects with those names are located in + the file. Certain metadata for an object to which the group points + can be cached in the group's symbol table in addition to the + object's header. + +

An HDF5 object name space can be stored hierarchically by + partitioning the name into components and storing each + component in a group. The group entry for a + non-ultimate component points to the group containing + the next component. The group entry for the last + component points to the object being named. + +

A group is a collection of group nodes pointed + to by a B-link tree. Each group node contains entries + for one or more symbols. If an attempt is made to add a + symbol to an already full group node containing + 2K entries, then the node is split and one node + contains K symbols and the other contains + K+1 symbols. + +
+

+ + + + + + + + + + + + + + + + + + + +
+ Group Node (A Leaf of a B-tree) +
bytebytebytebyte
Signature
Version NumberReserved (0)Number of Symbols


Group Entries


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Signature +

The ASCII character string "SNOD" is + used to indicate the + beginning of a group node. This gives file + consistency checking utilities a better chance of + reconstructing a damaged file. +

+
Version Number +

The version number for the group node. This + document describes version 1. (There is no version '0' + of the group node) +

+
Number of Symbols +

Although all group nodes have the same length, + most contain fewer than the maximum possible number of + symbol entries. This field indicates how many entries + contain valid data. The valid entries are packed at the + beginning of the group node while the remaining + entries contain undefined values. +

+
Group Entries +

Each symbol has an entry in the group node. + The format of the entry is described below. + There are 2K entries in each group node, where + K is the "Group Leaf Node K" value from the + super block. +

+
+
+ +

+ Disk Format: Level 1C - Group Entry

+ +

Each group entry in a group node is designed + to allow for very fast browsing of stored objects. + Toward that design goal, the group entries + include space for caching certain constant metadata from the + object header. + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Group Entry +
bytebytebytebyte
Name OffsetO
Object Header AddressO
Cache Type
Reserved


Scratch-pad Space (16 bytes)


+ + + +
+ (Items marked with an 'O' the above table are +
+ of the size specified in "Size of Offsets.") +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Name Offset +

This is the byte offset into the group local + heap for the name of the object. The name is null + terminated. +

+
Object Header Address +

Every object has an object header which serves as a + permanent location for the object's metadata. In addition + to appearing in the object header, some metadata can be + cached in the scratch-pad space. +

+
Cache Type +

The cache type is determined from the object header. + It also determines the format for the scratch-pad space: +
+ + + + + + + + + + + + + + + + + + + + + +
Type:Description:
0No data is cached by the group entry. This + is guaranteed to be the case when an object header + has a link count greater than one. +
1Object header metadata is cached in the group + entry. This implies that the group + entry refers to another group. +
2The entry is a symbolic link. The first four bytes + of the scratch-pad space are the offset into the local + heap for the link value. The object header address + will be undefined. +
NOther cache values can be defined later and + libraries that do not understand the new values will + still work properly. +
+

+
Reserved +

These four bytes are present so that the scratch-pad + space is aligned on an eight-byte boundary. They are + always set to zero. +

+
Scratch-pad Space +

This space is used for different purposes, depending + on the value of the Cache Type field. Any metadata + about a dataset object represented in the scratch-pad + space is duplicated in the object header for that + dataset. This metadata can include the datatype + and the size of the dataspace for a dataset whose datatype + is atomic and whose dataspace is fixed and less than + four dimensions. +

+

+ Furthermore, no data is cached in the group + entry scratch-pad space if the object header for + the group entry has a link count greater than + one. +

+
+
+ +

Format of the Scratch-pad Space

+ +

The group entry scratch-pad space is formatted + according to the value in the Cache Type field. + +

If the Cache Type field contains the value zero + (0) then no information is + stored in the scratch-pad space. + +

If the Cache Type field contains the value one + (1), then the scratch-pad space + contains cached metadata for another object header + in the following format: + +
+

+ + + + + + + + + + + + + + +
+ Object Header Scratch-pad Format +
bytebytebytebyte
Address of B-treeO
Address of Name HeapO
+ + + +
+ (Items marked with an 'O' the above table are +
+ of the size specified in "Size of Offsets.") +
+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription
Address of B-tree +

This is the file address for the root of the + group's B-tree. +

+
Address of Name Heap +

This is the file address for the group's local + heap, in which are stored the group's symbol names. +

+
+
+ + +

If the Cache Type field contains the value two + (2), then the scratch-pad space + contains cached metadata for another symbolic link + in the following format: + +
+

+ + + + + + + + + + + + + +
+ Symbolic Link Scratch-pad Format +
bytebytebytebyte
Offset to Link Value
+
+ +
+
+ + + + + + + + + + +
Field NameDescription
Offset to Link Value +

The value of a symbolic link (that is, the name of the + thing to which it points) is stored in the local heap. + This field is the 4-byte offset into the local heap for + the start of the link value, which is null terminated. +

+
+
+ +

Disk Format: Level 1D - Local Heaps

+ +

A heap is a collection of small heap objects. Objects can be + inserted and removed from the heap at any time. + The address of a heap does not change once the heap is created. + References to objects are stored in the group table; + the names of those objects are stored in the local heap. +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Local Heap +
bytebytebytebyte
Signature
VersionReserved (zero)
Data Segment SizeL
Offset to Head of Free-listL
Address of Data SegmentO
+ + + + +
+ (Items marked with an 'L' the above table are +
+ of the size specified in "Size of Lengths.") +
+ (Items marked with an 'O' the above table are +
+ of the size specified in "Size of Offsets.") +
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Signature +

The ASCII character string "HEAP" + is used to indicate the + beginning of a heap. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+
Version +

Each local heap has its own version number so that new + heaps can be added to old files. This document + describes version zero (0) of the local heap. +

+
Data Segment Size +

The total amount of disk memory allocated for the heap + data. This may be larger than the amount of space + required by the objects stored in the heap. The extra + unused space in the heap holds a linked list of free blocks. +

+
Offset to Head of Free-list +

This is the offset within the heap data segment of the + first free block (or the + undefined address if there is no + free block). The free block contains "Size of Lengths" bytes that + are the offset of the next free block (or the + value '1' if this is the + last free block) followed by "Size of Lengths" bytes that store + the size of this free block. The size of the free block includes + the space used to store the offset of the next free block and + the of the current block, making the minimum size of a free block + 2 * "Size of Lengths". +

+
Address of Data Segment +

The data segment originally starts immediately after + the heap header, but if the data segment must grow as a + result of adding more objects, then the data segment may + be relocated, in its entirety, to another part of the + file. +

+
+
+ +

Objects within the heap should be aligned on an 8-byte boundary. + +

Disk Format: Level 1E - Global Heap

+ +

Each HDF5 file has a global heap which stores various types of + information which is typically shared between datasets. The + global heap was designed to satisfy these goals: + +

    +
  1. Repeated access to a heap object must be efficient without + resulting in repeated file I/O requests. Since global heap + objects will typically be shared among several datasets, it is + probable that the object will be accessed repeatedly. +
  2. Collections of related global heap objects should result in + fewer and larger I/O requests. For instance, a dataset of + object references will have a global heap object for each + reference. Reading the entire set of object references + should result in a few large I/O requests instead of one small + I/O request for each reference. +
  3. It should be possible to remove objects from the global heap + and the resulting file hole should be eligible to be reclaimed + for other uses. +
+

+ +

The implementation of the heap makes use of the memory + management already available at the file level and combines that + with a new top-level object called a collection to + achieve Goal B. The global heap is the set of all collections. + Each global heap object belongs to exactly one collection and + each collection contains one or more global heap objects. For + the purposes of disk I/O and caching, a collection is treated as + an atomic object. +

+ +

The HDF5 library creates global heap collections as needed, so there may + be multiple collections throughout the file. The set of all of them is + abstractly called the "global heap", although they don't actually link + to each other, and there is no global place in the file where you can + discover all of the collections. The collections are found simply by + finding a reference to one through another object in the file (eg. + variable-length datatype elements, etc). +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ A Global Heap Collection +
bytebytebytebyte
Signature
VersionReserved (zero)
Collection SizeL

Global Heap Object 1


Global Heap Object 2


...


Global Heap Object N


Global Heap Object 0 (free space)

+ + + +
+ (Items marked with an 'L' the above table are +
+ of the size specified in "Size of Lengths.") +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Signature +

The ASCII character string "GCOL" + is used to indicate the + beginning of a collection. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+
Version +

Each collection has its own version number so that new + collections can be added to old files. This document + describes version one (1) of the collections (there is no + version zero (0)). +

+
Collection Size +

This is the size in bytes of the entire collection + including this field. The default (and minimum) + collection size is 4096 bytes which is a typical file + system block size. This allows for 127 16-byte heap + objects plus their overhead (the collection header of 16 bytes + and the 16 bytes of information about each heap object). +

+
Global Heap Object 1 through N +

The objects are stored in any order with no + intervening unused space. +

+
Global Heap Object 0 +

Global Heap Object 0 (zero), when present, represents the free + space in the collection. Free space always appears at the end of + the collection. If the free space is too small to store the header + for Object 0 (described below) then the header is implied and the + collection contains no free space. +

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Global Heap Object +
bytebytebytebyte
Heap Object IDReference Count
Reserved
Object SizeL

Object Data

+ + + +
+ (Items marked with an 'L' the above table are +
+ of the size specified in "Size of Lengths.") +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Heap Object ID +

Each object has a unique identification number within a + collection. The identification numbers are chosen so that + new objects have the smallest value possible with the + exception that the identifier 0 always refers to the + object which represents all free space within the + collection. +

+
Reference Count +

All heap objects have a reference count field. An + object which is referenced from some other part of the + file will have a positive reference count. The reference + count for Object 0 is always zero. +

+
Reserved +

Zero padding to align next field on an 8-byte boundary. +

+
Object Size +

This is the size of the object data stored for the object. + The actual storage space allocated for the object data is rounded + up to a multiple of eight. +

+
Object Data +

The object data is treated as a one-dimensional array + of bytes to be interpreted by the caller. +

+
+
+ +

Disk Format: Level 1F - Free-space Index

+ +

The free-space index is a collection of blocks of data, + dispersed throughout the file, which are currently not used by + any file objects. + +

The super block contains a pointer to root of the free-space description; + that pointer is currently required to be the + undefined address. + +

The format of the free-space index is not defined at this time. + + + +
+


+ +

Disk Format: Level 2 - Data Objects

+ +

Data objects contain the real information in the file. These + objects compose the scientific data and other information which + are generally thought of as "data" by the end-user. All the + other information in the file is provided as a framework for + these data objects. +

+ +

A data object is composed of header information and data + information. The header information contains the information + needed to interpret the data information for the data object as + well as additional "metadata" or pointers to additional + "metadata" used to describe or annotate each data object. +

+ +

+ Disk Format: Level 2A - Data Object Headers

+ +

The header information of an object is designed to encompass + all the information about an object, except for the data itself. + This information includes + the dataspace, datatype, information about how the data + is stored on disk (in external files, compressed, broken up in + blocks, etc.), as well as other information used by the library + to speed up access to the data objects or maintain a file's + integrity. Information stored by user applications as attributes + is also stored in the object's header. The header of each object is + not necessarily located immediately prior to the object's data in the + file and in fact may be located in any position in the file. The order + of the messages in an object header is not significant. +

+ +

Header messages are aligned on 8-byte boundaries. +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Object Headers +
bytebytebytebyte
VersionReserved (zero)Number of Header Messages
Object Reference Count
Object Header Size
Header Message Type #1Size of Header Message Data #1
Header Message #1 FlagsReserved (zero)

Header Message Data #1

.
.
.
Header Message Type #nSize of Header Message Data #n
Header Message #n FlagsReserved (zero)

Header Message Data #n

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version +

This value is used to determine the format of the + information in the object header. When the format of the + information in the object header is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted. This + document describes version one (1) (there was no version + zero (0)). +

+
Number of Header Messages +

This value determines the number of messages listed in + object headers for this object. This value includes the messages + in continuation messages for this object. +

+
Object Reference Count +

This value specifies the number of "hard links" to this object + within the current file. References to the object from external + files, "soft links" in this file and object references in this + file are not tracked. +

+
Object Header Size +

This value specifies the number of bytes of header message data + following this length field that contain object header messages + for this object header. This value does not include the size of + object header continuation blocks for this object elsewhere in the + file. +

+
Header Message Type +

This value specifies the type of information included in the + following header message data. The header message types for the + pre-defined header messages are included in sections below. +

+
Size of Header Message Data +

This value specifies the number of bytes of header + message data following the header message type and length + information for the current message. The size includes + padding bytes to make the message a multiple of eight + bytes. +

+
Header Message Flags +

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, the message data is constant. This is used + for messages like the datatype message of a dataset. +
1If set, the message is stored in the global heap. + The Header Message Data field contains a Shared Object + message and the Size of Header Message Data field + contains the size of that Shared Object message. +
2-7Reserved
+

+
Header Message Data +

The format and length of this field is determined by the + header message type and size respectively. Some header + message types do not require any data and this information + can be eliminated by setting the length of the message to + zero. The data is padded with enough zeros to make the + size a multiple of eight. +

+
+
+ +

The header message types and the message data associated with + them compose the critical "metadata" about each object. Some + header messages are required for each object while others are + optional. Some optional header messages may also be repeated + several times in the header itself, the requirements and number + of times allowed in the header will be noted in each header + message description below. +

+ +

The following is a list of currently defined header messages: +

+ +
+

Name: NIL

+ +

Header Message Type: 0x0000 +

+

Length: varies +

+

Status: Optional, may be repeated. +

+

Purpose and Description: The NIL message is used to indicate a + message which is to be ignored when reading the header messages for a + data object. [Possibly one which has been deleted for some reason.] +

+

Format of Data: Unspecified. +

+ +
+

Name: Simple Dataspace

+ +

Header Message Type: 0x0001 +

+

Length: Varies according to the number of dimensions, + as described in the following table. +

+

Status: Required for dataset objects, may not be + repeated. +

+

Description: The simple dataspace message describes the + number of dimensions (i.e. "rank") and size of each dimension that the + data object has. This message is only used for datasets which have a + simple, rectilinear grid layout; datasets requiring a more complex + layout (irregularly structured or unstructured grids, etc.) must use + the Complex Dataspace message for expressing the space the + dataset inhabits. (Note: The Complex Dataspace + functionality is not yet implemented and it is not described in this + document.) +

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Simple Dataspace Message +
bytebytebytebyte
VersionDimensionalityFlagsReserved
Reserved
Dimension #1 SizeL
.
.
.
Dimension #n SizeL
Dimension #1 Maximum SizeL
.
.
.
Dimension #n Maximum SizeL
Permutation Index #1L
.
.
.
Permutation Index #nL
+ + + +
+ (Items marked with an 'L' the above table are +
+ of the size specified in "Size of Lengths.") +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version +

This value is used to determine the format of the + Simple Dataspace Message. When the format of the + information in the message is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted. This + document describes version one (1) (there was no version + zero (0)). +

+
Dimensionality +

This value is the number of dimensions that the data + object has. +

+
Flags +

This field is used to store flags to indicate the + presence of parts of this message. Bit 0 (the least + significant bit) is used to indicate that maximum + dimensions are present. Bit 1 is used to indicate that + permutation indices are present. +

+
Dimension #n Size +

This value is the current size of the dimension of the + data as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+
Dimension #n Maximum Size +

This value is the maximum size of the dimension of the + data as stored in the file. This value may be the special + "unlimited" size which indicates + that the data may expand along this dimension indefinitely. + If these values are not stored, the maximum size of each + dimension is assumed to be the dimension's current size. +

+
Permutation Index #n +

This value is the index permutation used to map + each dimension from the canonical representation to an + alternate axis for each dimension. If these values are + not stored, the first dimension stored in the list of + dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+
+
+ +

+ + + +
+

Name: Reserved - Not Assigned Yet

+ Header Message Type: 0x0002
+ Length: N/A
+ Status: N/A
+ Format of Data: N/A
+ +

Purpose and Description: This message type was skipped during + the initial specification of the file format and may be used in a + future expansion to the format. + + +


+

Name: Datatype

+ +

Header Message Type: 0x0003 +

+

Length: variable +

+

Status: Required for dataset or named datatype objects, + may not be repeated. +

+ +

Description: The datatype message defines the datatype + for each element of a dataset. A datatype can describe an atomic type + like a fixed- or floating-point type or a compound type like a C + struct. + Datatypes messages are stored + as a list of datatype classes and + their associated properties. +

+ +

Datatype messages that are part of a dataset object, + do not describe how elements are related to one another, the dataspace + message is used for that purpose. Datatype messages that are part of + a named datatype message describe an "abstract" datatype that can be + used by other objects in the file. +

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Datatype Message +
bytebytebytebyte
Class and VersionClass Bit Field, Bits 0-7Class Bit Field, Bits 8-15Class Bit Field, Bits 16-23
Size


Properties


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Class and Version +

The version of the datatype message and the datatype's class + information are packed together in this field. The version + number is packed in the top 4 bits of the field and the class + is contained in the bottom 4 bits. +

+

The version number information is used for changes in the + format of the datatype message and is described here: + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used +
1Used by early versions of the library to encode + compound datatypes with explicit array fields. + See the compound datatype description below for + further details. +
2The current version used by the library. +
+

+

The class of the datatype determines the format for the class + bit field and properties portion of the datatype message, which + are described below. The + following classes are currently defined: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Fixed-Point
1Floating-Point
2Time
3String
4Bitfield
5Opaque
6Compound
7Reference
8Enumerated
9Variable-Length
10Array
+

+
Class Bit Fields +

The information in these bit fields is specific to each datatype + class and is described below. All bits not defined for a + datatype class are set to zero. +

+
Size +

The size of the datatype in bytes. +

+
Properties +

This variable-sized field encodes information specific to each + datatype class and is described below. If there is no + property information specified for a datatype class, the size + of this field is zero. +

+
+
+

+ +

Class specific information for Fixed-Point Numbers (Class 0): + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.
1, 2Padding type. Bit 1 is the lo_pad type and bit 2 + is the hi_pad type. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.
3Signed. If this bit is set then the fixed-point + number is in 2's complement form.
4-23Reserved (zero).
+
+ +
+
+ + + + + + + + + + + + + + +
+ Property Descriptions +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription
Bit Offset +

The bit offset of the first significant bit of the fixed-point + value within the datatype. The bit offset specifies the number + of bits "to the right of" the value. +

+
Bit Precision +

The number of bits of precision of the fixed-point value + within the datatype. +

+
+
+

+ +

Class specific information for Floating-Point Numbers (Class 1): + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.
1, 2, 3Padding type. Bit 1 is the low bits pad type, bit 2 + is the high bits pad type, and bit 3 is the internal bits + pad type. If a datum has unused bits at either end or between + the sign bit, exponent, or mantissa, then the value of bit + 1, 2, or 3 is copied to those locations.
4-5Normalization. The value can be 0 if there is no + normalization, 1 if the most significant bit of the + mantissa is always set (except for 0.0), and 2 if the most + signficant bit of the mantissa is not stored but is + implied to be set. The value 3 is reserved and will not + appear in this field.
6-7Reserved (zero).
8-15Sign Location. This is the bit position of the sign + bit. Bits are numbered with the least significant bit zero.
16-23Reserved (zero).
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Property Descriptions +
ByteByteByteByte
Bit OffsetBit Precision
Exponent LocationExponent SizeMantissa LocationMantissa Size
Exponent Bias
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Bit Offset +

The bit offset of the first significant bit of the floating-point + value within the datatype. The bit offset specifies the number + of bits "to the right of" the value. +

+
Bit Precision +

The number of bits of precision of the floating-point value + within the datatype. +

+
Exponent Location +

The bit position of the exponent field. Bits are numbered with + the least significant bit number zero. +

+
Exponent Size +

The size of the exponent field in bits. +

+
Mantissa Location +

The bit position of the mantissa field. Bits are numbered with + the least significant bit number zero. +

+
Mantissa Size +

The size of the mantissa field in bits. +

+
Exponent Bias +

The bias of the exponent field. +

+
+
+

+ +

Class specific information for Time (Class 2): + +
+

+ + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.
1-23Reserved (zero).
+
+ +
+
+ + + + + + + + + + + +
+ Property Descriptions +
ByteByte
Bit Precision
+
+ +
+
+ + + + + + + + + + + +
Field NameDescription
Bit Precision +

The number of bits of precision of the time value. +

+
+
+

+ +

Class specific information for Strings (Class 3): + +
+

+ + + + + + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0-3Padding type. This four-bit value determines the + type of padding to use for the string. The values are: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Null Terminate: A zero byte marks the end of the + string and is guaranteed to be present after + converting a long string to a short string. When + converting a short string to a long string the value is + padded with additional null characters as necessary. +
1Null Pad: Null characters are added to the end of + the value during conversions from short values to long + values but conversion in the opposite direction simply + truncates the value. +
2Space Pad: Space characters are added to the end of + the value during conversions from short values to long + values but conversion in the opposite direction simply + truncates the value. This is the Fortran + representation of the string. +
3-15Reserved +
+
4-7Character Set. The character set to use for + encoding the string. The only character set supported is + the 8-bit ASCII (zero) so no translations have been defined + yet.
8-23Reserved (zero).
+
+ +

There are no properties defined for the string class. +

+

+ +

Class specific information for Bitfields (Class 4): + +
+

+ + + + + + + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.
1, 2Padding type. Bit 1 is the lo_pad type and bit 2 + is the hi_pad type. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.
3-23Reserved (zero).
+
+ +
+
+ + + + + + + + + + + + + + +
+ Property Description +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription
Bit Offset +

The bit offset of the first significant bit of the bitfield + within the datatype. The bit offset specifies the number + of bits "to the right of" the value. +

+
Bit Precision +

The number of bits of precision of the bitfield + within the datatype. +

+
+
+

+ +

Class specific information for Opaque (Class 5): + +
+

+ + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0-7Length of ASCII tag in bytes.
8-23Reserved (zero).
+
+ +
+
+ + + + + + + + + + + + + +
+ Property Description +
ByteByteByteByte

ASCII Tag
+
+
+ +
+
+ + + + + + + + + + +
Field NameDescription
ASCII Tag +

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+
+
+

+ +

Class specific information for Compound (Class 6): + +
+

+ + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0-15Number of Members. This field contains the number + of members defined for the compound datatype. The member + definitions are listed in the Properties field of the data + type message. +
15-23Reserved (zero).
+
+

+ +

The Properties field of a compound datatype is a list of the + member definitions of the compound datatype. The member + definitions appear one after another with no intervening bytes. + The member types are described with a recursive datatype + message. + +

Note that the property descriptions are different for different + versions of the datatype version. Additionally note that the version + 0 properties are deprecated and have been replaced with the version + 1 properties in versions of the HDF5 library from the 1.4 release + onward. + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Properties Description for Datatype Version 1 +
ByteByteByteByte

Name

Byte Offset of Member
DimensionalityReserved (zero)
Dimension Permutation
Reserved (zero)
Dimension #1 Size (required)
Dimension #2 Size (required)
Dimension #3 Size (required)
Dimension #4 Size (required)

Member Type Message

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Name +

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+
Byte Offset of Member +

This is the byte offset of the member within the datatype. +

+
Dimensionality +

If set to zero, this field indicates a scalar member. If set + to a value greater than zero, this field indicates that the + member is an array of values. For array members, the size of + the array is indicated by the 'Size of Dimension n' field in + this message. +

+
Dimension Permutation +

This field was intended to allow an array field to have + it's dimensions permuted, but this was never implemented. + This field should always be set to zero. +

+
Dimension #n Size +

This field is the size of a dimension of the array field as + stored in the file. The first dimension stored in the list of + dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+
Member Type Message +

This field is a datatype message describing the datatype of + the member. +

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Properties Description for Datatype Version 2 +
ByteByteByteByte

Name

Byte Offset of Member

Member Type Message

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Name +

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+
Byte Offset of Member +

This is the byte offset of the member within the datatype. +

+
Member Type Message +

This field is a datatype message describing the datatype of + the member. +

+
+
+

+ +

Class specific information for Reference (Class 7): + +
+

+ + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0-3Type. This four-bit value contains the type of reference + described. The values defined are: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Object Reference: A reference to another object in this + HDF5 file. +
1Dataset Region Reference: A reference to a region within + a dataset in this HDF5 file. +
2Internal Reference: A reference to a region within the + current dataset. (Not currently implemented) +
3-15Reserved +
+ +
15-23Reserved (zero).
+
+ +

There are no properties defined for the reference class. +

+

+ +

Class specific information for Enumeration (Class 8): + +
+

+ + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0-15Number of Members. The number of name/value + pairs defined for the enumeration type.
16-23Reserved (zero).
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Property Description +
ByteByteByteByte

Base Type


Names


Values

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Base Type +

Each enumeration type is based on some parent type, usually an + integer. The information for that parent type is described + recursively by this field. +

+
Names +

The name for each name/value pair. Each name is stored as a null + terminated ASCII string in a multiple of eight bytes. The names + are in no particular order. +

+
Values +

The list of values in the same order as the names. The values + are packed (no inter-value padding) and the size of each value + is determined by the parent type. +

+
+
+

+ + +

Class specific information for Variable-Length (Class 9): + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bit Field Description +
BitsMeaning
0-3Type. This four-bit value contains the type of + variable-length datatype described. The values defined are: + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Sequence: A variable-length sequence of any sequence of + data. Variable-length sequences do not have padding or + character set information. +
1String: A variable-length sequence of characters. + Variable-length strings have padding and character set + information. +
2-15Reserved +
+ +
4-7Padding type. (variable-length string only) + This four-bit value determines the type of padding + used for variable-length strings. The values are the same + as for the string padding type, as follows: + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Null terminate: A zero byte marks the end of a string + and is guaranteed to be present after converting a long + string to a short string. When converting a short string + to a long string, the value is padded with additional null + characters as necessary. +
1Null pad: Null characters are added to the end of the + value during conversion from a short string to a longer + string. Conversion from a long string to a shorter string + simply truncates the value. +
2Space pad: Space characters are added to the end of the + value during conversion from a short string to a longer + string. Conversion from a long string to a shorter string + simply truncates the value. This is the Fortran + representation of the string. +
3-15Reserved +
+ + This value is set to zero for variable-length sequences. + +
8-11Character Set. (variable-length string only) + This four-bit value specifies the character set + to be used for encoding the string: + + + + + + + + + + + + + + + +
ValueDescription
0ASCII: As of this writing (July 2003, Release 1.6.0), + 8-bit ASCII is the only character set supported. Therefore, + no translations have been defined. +
1-15Reserved +
+ + This value is set to zero for variable-length sequences. + +
12-23Reserved (zero).
+
+ +
+
+ + + + + + + + + + + + + + +
+ Property Description +
ByteByteByteByte

Base Type

+
+ +
+
+ + + + + + + + + + + +
Field NameDescription
Base Type +

Each variable-length type is based on some parent type. The + information for that parent type is described recursively by + this field. +

+
+
+

+ +

Class specific information for Array (Class 10): + +

There are no bit fields defined for the array class. +

+ +

Note that the dimension information defined in the property for this + datatype class is independent of dataspace information for a dataset. + The dimension information here describes the dimensionality of the + information within a data element (or a component of an element, if the + array datatype is nested within another datatype) and the dataspace for a + dataset describes the location of the elements in a dataset. +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Property Description +
ByteByteByteByte
DimensionalityReserved (zero)
Dimension #1 Size
.
.
.
Dimension #n Size
Permutation Index #1
.
.
.
Permutation Index #n

Base Type

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Dimensionality +

This value is the number of dimensions that the array has. +

+
Dimension #n Size +

This value is the size of the dimension of the array + as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+
Permutation Index #n +

This value is the index permutation used to map + each dimension from the canonical representation to an + alternate axis for each dimension. Currently, dimension + permutations are not supported and these indices should be set + to the index position minus one (i.e. the first dimension should + be set to 0, the second dimension should be set to 1, etc.) +

+
Base Type +

Each array type is based on some parent type. The + information for that parent type is described recursively by + this field. +

+
+
+ +

+ +
+

Name: Data Storage - Fill Value (Old)

+ +

Header Message Type: 0x0004 +

+

Length: varies +

+

Status: Optional, may not be repeated. +

+ +

Description: The fill value message stores a single + data value which is returned to the application when an uninitialized + data element is read from a dataset. The fill value is interpreted + with the same datatype as the dataset. If no fill value message is + present then a fill value of all zero bytes is assumed. +

+ +

This fill value message is deprecated in favor of the "new" + fill value message (Message Type 0x0005) and is only written to the + file for forward compatibility with versions of the HDF5 library before + the 1.6.0 version. Additionally, it only appears for datasets with a + user defined fill value (as opposed to the library default fill value + or an explicitly set "undefined" fill value). +

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + +
+ Fill Value Message (Old) +
bytebytebytebyte
Size

Fill Value

+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription
Size +

This is the size of the Fill Value field in bytes. +

+
Fill Value +

The fill value. The bytes of the fill value are interpreted + using the same datatype as for the dataset. +

+
+
+

+ +
+

Name: Data Storage - Fill Value

+ +

Header Message Type: 0x0005 +

+

Length: varies +

+

Status: Required for dataset objects, may not be repeated. +

+ +

Description: The fill value message stores a single + data value which is returned to the application when an uninitialized + data element is read from a dataset. The fill value is interpreted + with the same datatype as the dataset. +

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Fill Value Message +
bytebytebytebyte
VersionSpace Allocation TimeFill Value Write TimeFill Value Defined
Size

Fill Value

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version +

The version number information is used for changes in the + format of the fill value message and is described here: + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used +
1Used by version 1.6.x of the library to encode + fill values. In this version, the Size field is + always present. +
2The current version used by the library (version + 1.7.3 or later). In this version, the Size and + Fill Value fields are + only present if the Fill Value Defined field is set + to 1. +
+

+
Space Allocation Time +

When the storage space for the dataset's raw data will be + allocated. The allowed values are: + + + + + + + + + + + + + + + + + + +
ValueDescription
1Early allocation. Storage space for the entire dataset + should be allocated in the file when the dataset is + created. +
2Late allocation. Storage space for the entire dataset + should not be allocated until the dataset is written + to. +
3Incremental allocation. Storage space for the + dataset should not be allocated until the portion + of the dataset is written to. This is currently + used in conjunction with chunked data storage for + datasets. +
+

+
Fill Value Write Time +

At the time that storage space for the dataset's raw data is + allocated, this value indicates whether the fill value should + be written to the raw data storage elements. The allowed values + are: + + + + + + + + + + + + + + + + + + +
ValueDescription
0On allocation. The fill value is always written to + the raw data storage when the storage space is allocated. +
1Never. The fill value should never be written to + the raw data storage. +
2Fill value written if set by user. The fill value + will be written to the raw data storage when the storage + space is allocated only if the user explicitly set + the fill value. If the fill value is the library + default or is undefined, it will not be written to + the raw data storage. +
+

+
Fill Value Defined +

This value indicates if a fill value is defined for this + dataset. If this value is 0, the fill value is undefined. + If this value is 1, a fill value is defined for this dataset. + For version 2 or later of the fill value message, this value + controls the presence of the Size field. +

+
Size +

This is the size of the Fill Value field in bytes. This field + is not present if the Version field is >1 and the Fill Value + Defined field is set to 0. +

+
Fill Value +

The fill value. The bytes of the fill value are interpreted + using the same datatype as for the dataset. This field is + not present if the Version field is >1 and the Fill Value + Defined field is set to 0. +

+
+
+

+ + + +
+

Name: Reserved - Not Assigned Yet

+

Header Message Type: 0x0006

+

Length: N/A

+

Status: N/A

+

Format of Data: N/A

+ +

Purpose and Description: This message type was skipped during + the initial specification of the file format and may be used in a + future expansion to the format.

+ +
+

Name: Data Storage - + External Data Files

+

Header Message Type: 0x0007

+

Length: varies

+

Status: Optional, may not be repeated.

+ +

Purpose and Description: The external object message + indicates that the data for an object is stored outside the HDF5 + file. The filename of the object is stored as a Universal + Resource Location (URL) of the actual filename containing the + data. An external file list record also contains the byte offset + of the start of the data within the file and the amount of space + reserved in the file for that data.

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ External File List Message +
bytebytebytebyte
VersionReserved
Allocated SlotsUsed Slots

Heap Address


Slot Definitions...

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version +

The version number information is used for changes in the format of External File + List Message and is described here: + + + + + + + + + + + +
VersionDescription
0Never used. +
1The current version used by the library. +
+

+
Reserved +

This field is reserved for future use.

+
Allocated Slots +

The total number of slots allocated in the message. Its value must be at least as + large as the value contained in the Used Slots field. (The current library simply + uses the number of Used Slots for this message)

+
Used Slots +

The number of initial slots which contains valid information.

+
Heap Address +

This is the address of a local heap which contains the names for the external + files (The local heap information can be found in Disk Format Level 1D in this + document). The name at offset zero in the heap is always the empty string.

+
Slot Definitions +

The slot definitions are stored in order according to the array addresses they + represent.

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ External File List Slot +
bytebytebytebyte

Name Offset(<size> bytes)


File Offset(<size> bytes)


Size

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Name Offset(<size> bytes) +

The byte offset within the local name heap for the name + of the file. File names are stored as a URL which has a + protocol name, a host name, a port number, and a file + name: + protocol:port//host/file. + If the protocol is omitted then "file:" is assumed. If + the port number is omitted then a default port for that + protocol is used. If both the protocol and the port + number are omitted then the colon can also be omitted. If + the double slash and host name are omitted then + "localhost" is assumed. The file name is the only + mandatory part, and if the leading slash is missing then + it is relative to the application's current working + directory (the use of relative names is not + recommended).

+
File Offset(<size> bytes) +

This is the byte offset to the start of the data in the + specified file. For files that contain data for a single + dataset this will usually be zero.

+
Size +

This is the total number of bytes reserved in the + specified file for raw data storage. For a file that + contains exactly one complete dataset which is not + extendable, the size will usually be the exact size of the + dataset. However, by making the size larger one allows + HDF5 to extend the dataset. The size can be set to a value + larger than the entire file since HDF5 will read zeros + past the end of the file without failing.

+
+
+ + +
+

Name: Data Storage - Layout

+ +

Header Message Type: 0x0008

+

Length: varies

+

Status: Required for datasets, may not be repeated.

+ +

Purpose and Description: Data layout describes how the + elements of a multi-dimensional array are arranged in the linear + address space of the file. Three types of data layout are + supported: + +

    +
  1. Contiguous: The array can be stored in one contiguous area of the file. + The layout requires that the size of the array be constant and + does not permit chunking, compression, checksums, encryption, + etc. The message stores the total size of the array and the + offset of an element from the beginning of the storage area is + computed as in C. + +
  2. Chunked: The array domain can be regularly decomposed into chunks and + each chunk is allocated separately. This layout supports + arbitrary element traversals, compression, encryption, and + checksums, and the chunks can be distributed across external + raw data files (these features are described in other + messages). The message stores the size of a chunk instead of + the size of the entire array; the size of the entire array can + be calculated by traversing the B-tree that stores the chunk + addresses. + +
  3. Compact: The array can be stored in one contiguous block, as part of + this object header message (this is called "compact" storage below). +
+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Data Layout Message (Versions 1 and 2) +
bytebytebytebyte
VersionDimensionalityLayout ClassReserved
Reserved

Address

Dimension 0 (4-bytes)
Dimension 1 (4-bytes)
...
Dataset Element Size (optional)
Compact Data Size (4-bytes)

Compact Data...

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version +

The version number information is used for changes in the format of the data + layout message and is described here:

+ + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by version 1.4 and before of the library to encode layout information. + Data space is always allocated when the data set is created.
2Used by version 1.6.x of the library to encode layout information. + Data space is allocated only when it is necessary.
+
Dimensionality

An array has a fixed dimensionality. This field + specifies the number of dimension size fields later in the + message.

Layout Class

The layout class specifies how the other fields of the + layout message are to be interpreted. A value of one + indicates contiguous storage, a value of two indicates chunked storage, + while a value of zero indicates compact storage. Other values will be defined + in the future.

Address

For contiguous storage, this is the address of the first + byte of storage. For chunked storage this is the address + of the B-tree that is used to look up the addresses of the + chunks. This field is not present for compact storage. + If the version for this message is set to 2, the address + may have the "undefined address" value, to indicate that + storage has not yet been allocated for this array.

Dimensions

For contiguous and compact storage the dimensions define + the entire size of the array while for chunked storage they define + the size of a single chunk. In all cases, they are in units of + array elements (not bytes). The first dimension stored in the list + of dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+
Dataset Element Size

The size of a dataset element, in bytes. This field is only + present for chunked storage. +

+
Compact Data Size

This field is only present for compact data storage. + It contains the size of the raw data for the dataset array.

Compact Data

This field is only present for compact data storage. + It contains the raw data for the dataset array.

+
+ +
+

Version 3 of this message re-structured the format into specific + properties that are required for each layout class. + +
+

+ + + + + + + + + + + + + + + + + + + +
+ Data Layout Message (Version 3) +
bytebytebytebyte
VersionLayout Class 

Properties

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version +

The version number information is used for changes in the format of layout message + and is described here:

+ + + + + + + + + + +
VersionDescription
3Used by the version 1.6.3 and later of the library to store properties + for each layout class.
+
Layout Class

The layout class specifies how the other fields of the layout message are to be + interpreted. A value of one indicates contiguous storage, a value of two + indicates chunked storage, while a value of zero indicates compact storage.

Properties

This variable-sized field encodes information specific to each + layout class and is described below. If there is no property + information specified for a layout class, the size of this field + is zero bytes.

+
+ +
+

Class-specific information for compact layout (Class 0): (Note: The dimensionality information + is in the Dataspace message) + +
+

+ + + + + + + + + + + + + + + + + + +
+ Property Descriptions +
bytebytebytebyte
Size 

Raw Data...

+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription
Size

This field contains the size of the raw data for the dataset array.

Raw Data

This field contains the raw data for the dataset array.

+
+ +
+

Class-specific information for contiguous layout (Class 1): (Note: The dimensionality information + is in the Dataspace message) + +
+

+ + + + + + + + + + + + + + + + + +
+ Property Descriptions +
bytebytebytebyte

Address


Size

+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription
Address

This is the address of the first byte of raw data storage. + The address may have the "undefined address" value, to indicate + that storage has not yet been allocated for this array.

Size

This field contains the size allocated to store the raw data.

+
+ +
+

Class-specific information for chunked layout (Class 2): + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Property Descriptions +
bytebytebytebyte
Dimensionality 

Address

Dimension 0 (4-bytes)
Dimension 1 (4-bytes)
...
Dataset Element Size
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Dimensionality

A chunk has a fixed dimensionality. This field specifies + the number of dimension size fields later in the message.

Address

This is the address of the B-tree that is used to look up the addresses of the + chunks. The address may have the "undefined address" value, to indicate that + storage has not yet been allocated for this array.

Dimensions

These values define the dimension size of a single chunk, in + units of array elements (not bytes). The first dimension stored in + the list of dimensions is the slowest changing dimension and the + last dimension stored is the fastest changing dimension. +

+
Dataset Element Size

The size of a dataset element, in bytes. +

+
+
+ +
+

Name: Reserved - Not Assigned Yet

+

Header Message Type: 0x0009

+

Length: N/A

+

Status: N/A

+

Format of Data: N/A

+ +

Purpose and Description: This message type was skipped during the initial + specification of the file format and may be used in a future expansion to the format. + +


+

Name: Reserved - Not Assigned Yet

+

Header Message Type: 0x0009

+

Length: N/A

+

Status: N/A

+

Format of Data: N/A

+ +

Purpose and Description: This message type was skipped during the initial + specification of the file format and may be used in a future expansion to the format. + +


+

Name: Data Storage - Filter Pipeline

+

Header Message Type: 0x000B

+

Length: varies

+

Status: Optional, may not be repeated.

+ +

Description: This message describes the + filter pipeline which should be applied to the data stream by + providing filter identification numbers, flags, a name, and + client data.

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ Filter Pipeline Message +
bytebytebytebyte
VersionNumber of FiltersReserved
Reserved

Filter List

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version

The version number for this message. This document + describes version 1.

Number of Filters

The total number of filters described by this + message. The maximum possible number of filters in a + message is 32.

Filter List

A description of each filter. A filter description + appears in the next table.

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Filter Description +
bytebytebytebyte
Filter IdentificationName Length
FlagsNumber of Values for Client Data

Name


Client Data

Padding
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Filter Identification +

+ This value, often referred to as a filter identifier, + is designed to be a unique identifier for the filter. + Values from zero through 32,767 are reserved for filters + supported by The HDF Group in the HDF5 library and for + filters requested and supported by third parties. + Filters supported by The HDF Group are documented immediately + below. Information on 3rd-party filters can be found at + + https://support.hdfgroup.org/services/contributions.html#filters. + 1 +

+ To request a filter identifier, please contact + The HDF Group’s Help Desk at + . + You will be asked to provide the following information: +

    +
  1. Contact information for the developer requesting the + new identifier +
  2. A short description of the new filter +
  3. Links to any relevant information, including licensing + information +
+

+ Values from 32768 to 65535 are reserved for non-distributed uses + (for example, internal company usage) or for application usage + when testing a feature. The HDF Group does not track or document + the use of the filters with identifiers from this range. + +

+ The filters currently in library version 1.6.5 are + listed below: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentificationNameDescription
1deflateGZIP deflate compression
2shuffleData element shuffling
3fletcher32Fletcher32 checksum
4szipSZIP compression
+

Name Length

Each filter has an optional null-terminated ASCII name + and this field holds the length of the name including the + null termination padded with nulls to be a multiple of + eight. If the filter has no name then a value of zero is + stored in this field.

Flags

The flags indicate certain properties for a filter. The + bit values defined so far are:

+ + + + + + + + + + +
ValueDescription
bit 1If set then the filter is an optional filter. + During output, if an optional filter fails it will be + silently removed from the pipeline.
+
Client Data Number of Values

Each filter can store a few integer values to control + how the filter operates. The number of entries in the + Client Data array is stored in this field.

Name

If the Name Length field is non-zero then it will + contain the size of this field, a multiple of eight. This + field contains a null-terminated, ASCII character + string to serve as a comment/name for the filter.

Client Data

This is an array of four-byte integers which will be + passed to the filter function. The Client Data Number of + Values determines the number of elements in the array.

Padding

Four bytes of zeros are added to the message at this + point if the Client Data Number of Values field contains + an odd number.

+
+

+


+ 1If you are reading + an earlier version of this document, this link may have changed. + If the link does not work, use the latest version of this document + on The HDF Group’s website, + + https://support.hdfgroup.org/HDF5/doc/H5.format.html; + the link there will always be correct. + (Return) +

+ +
+

Name: Attribute

+

Header Message Type: 0x000C +

Length: varies +

Status: Optional, may be repeated. + +

Description: The Attribute + message is used to list objects in the HDF file which are used + as attributes, or "metadata" about the current object. An + attribute is a small dataset; it has a name, a datatype, a data + space, and raw data. Since attributes are stored in the object + header they must be relatively small (<64KB) and can be + associated with any type of object which has an object header + (groups, datasets, named types and spaces, etc.). + +

Note: Attributes on an object must have unique names. (The HDF5 library + currently enforces this by causing the creation of an attribute with + a duplicate name to fail). Attributes on different objects may have the + same name, however. + +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Attribute Message (Version 1) +
bytebytebytebyte
VersionReservedName Size
Datatype SizeDataspace Size

Name


Datatype


Dataspace


Data

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version

The version number information is used for changes in the format of the + attribute message and is described here:

+ + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by the library before version 1.6 to encode attribute message. + This version does not support shared data type.
+
Reserved

This field is reserved for later use and is set to + zero.

Name Size

The length of the attribute name in bytes including the + null terminator. Note that the Name field below may + contain additional padding not represented by this + field.

Datatype Size

The length of the datatype description in the Datatype + field below. Note that the Datatype field may contain + additional padding not represented by this field.

Dataspace Size

The length of the dataspace description in the Dataspace + field below. Note that the Dataspace field may contain + additional padding not represented by this field.

Name

The null-terminated attribute name. This field is + padded with additional null characters to make it a + multiple of eight bytes.

Datatype

The datatype description follows the same format as + described for the datatype object header message. This + field is padded with additional zero bytes to make it a + multiple of eight bytes.

Dataspace

The dataspace description follows the same format as + described for the dataspace object header message. This + field is padded with additional zero bytes to make it a + multiple of eight bytes.

Data

The raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. This + field is not padded with additional bytes.

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Attribute Message (Version 2) +
bytebytebytebyte
VersionFlagName Size
Type SizeSpace Size

Name


Type


Space


Data

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version

The version number information is used for changes in the format of the + attribute message and is described here:

+ + + + + + + + + + +
VersionDescription
2Used by the library of version 1.6.x and after to encode attribute message. + This version supports shared data type. The fields of name, type, and space + are not padded with additional bytes of zero.
+
Flag

This field indicates whether the data type of this attribute is shared:

+ + + + + + + + + + + + + + + +
ValueDescription
0Datatype is not shared.
1Datatype is shared.
+
Name Size

The length of the attribute name in bytes including the + null terminator.

Datatype Size

The length of the datatype description in the Datatype + field below.

Dataspace Size

The length of the dataspace description in the Dataspace + field below.

Name

The null-terminated attribute name. This field is not + padded with additional bytes.

Datatype

The datatype description follows the same format as + described for the datatype object header message. This + field is not padded with additional bytes.

Dataspace

The dataspace description follows the same format as + described for the dataspace object header message. This + field is not padded with additional bytes.

Data

The raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. This + field is not padded with additional zero + bytes.

+
+ +
+

Name: Object Comment

+ +

Header Message Type: 0x000D

+

Length: varies

+

Status: Optional, may not be repeated.

+ +

Description: The object comment is + designed to be a short description of an object. An object comment + is a sequence of non-zero (\0) ASCII characters with no other + formatting included by the library.

+ +

Format of Data: +
+

+ + + + + + + + + + + + + +
+ Name Message +
bytebytebytebyte

Comment

+
+ +
+
+ + + + + + + + + + +
Field NameDescription
NameA null terminated ASCII character string.
+
+ +
+

Name: Object Modification Date & Time (Old)

+ +

Header Message Type: 0x000E

+

Length: fixed

+

Status: Optional, may not be repeated.

+ +

Description: The object modification date + and time is a timestamp which indicates (using ISO-8601 date and + time format) the last modification of an object. The time is + updated when any object header message changes according to the + system clock where the change was posted. + +

This modification time message is deprecated in favor of the "new" + modification time message (Message Type 0x0012) and is no longer written + to the file in versions of the HDF5 library after the 1.6.0 version. +

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Modification Time Message +
bytebytebytebyte
Year
MonthDay of Month
HourMinute
SecondReserved
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Year

The four-digit year as an ASCII string. For example, + 1998. All fields of this message should be interpreted + as coordinated universal time (UTC)

Month

The month number as a two digit ASCII string where + January is 01 and December is 12.

Day of Month

The day number within the month as a two digit ASCII + string. The first day of the month is 01.

Hour

The hour of the day as a two digit ASCII string where + midnight is 00 and 11:00pm is 23.

Minute

The minute of the hour as a two digit ASCII string where + the first minute of the hour is 00 and + the last is 59.

Second

The second of the minute as a two digit ASCII string + where the first second of the minute is 00 + and the last is 59.

Reserved

This field is reserved and should always be zero.

+
+ +
+

Name: Shared Object Message

+

Header Message Type: 0x000F

+

Length: Fixed

+

Status: Optional, may be repeated.

+ +

Description: A constant message can be shared among + several object headers. A Shared Object Message contains the address of + the object message to be shared. Care must be exercised to prevent cycles when a + message of one object header points to a message in some other object header. + Starting from Version 2 of the Shared Object Message, the Flags + field becomes unused. +

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + + + +
+ Shared Object Message (Version 1) +
byte + byte + byte + byte +
VersionFlagsReserved
Reserved

Pointer

+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version

The version number is used when there are changes in the format + of a shared object message and is described here:

+ + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by the library before version 1.6.1. In this version, + the Flags field is used to indicate whether the actual message is + stored in the global heap (never implemented). The Pointer field + either contains the the header message address in the global heap + (never implemented) or the address of the shared object header.
+
Flags

The Shared Message message points to a message which is + shared among multiple object headers. The Flags field + describes the type of sharing:

+ + + + + + + + + + + + + + + +
BitDescription
0If this bit is clear then the actual message is the + first message in some other object header; otherwise + the actual message is stored in the global heap (never + implemented).
2-7Reserved (always zero)
+
Pointer

The address of the object header + containing the message to be shared.

+
+ +
+
+ + + + + + + + + + + + + + + +
+ Shared Object Message (Version 2) +
byte + byte + byte + byte +
VersionFlags 

Pointer

+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version

The version number is used when there are changes in the format + of a shared object message and is described here:

+ + + + + + + + + + +
VersionDescription
2Used by the library of version 1.6.1 and after. In this version, + The Flags field is not used and the Pointer field contains the address + of the object header containing the message to be shared.
+
Flags

Unused.

Pointer

The address of the object header + containing the message to be shared.

+
+ + +
+

Name: Object Header Continuation

+

Header Message Type: 0x0010

+

Length: fixed

+

Status: Optional, may be repeated.

+

Description: The object header continuation is the location + in the file of more header messages for the current data object. This can be + used when header blocks become too large or are likely to change over time.

+ +

Format of Data: +
+

+ + + + + + + + + + + + + + + + + +
+ Object Header Continuation Message +
bytebytebytebyte

Offset


Length

+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription
Offset

This value is the offset in bytes from the beginning of the file where the + header continuation information is located.

Length

This value is the length in bytes of the header continuation information in + the file.

+
+ +
+

Name: Group Message

+

Header Message Type: 0x0011

+

Length: fixed

+

Status: Required for groups, may not be repeated.

+

Description: Each group has a B-tree and a + name heap which are pointed to by this message.

+

Format of data: + +
+

+ + + + + + + + + + + + + + + + + +
+ Group Message +
bytebytebytebyte

B-tree Address


Heap Address

+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription
B-tree Address

This value is the offset in bytes from the beginning of the file + where the B-tree is located.

Heap Address

This value is the offset in bytes from the beginning of the file + where the group name heap is located.

+
+ +
+

Name: Object Modification Date & Time

+ +

Header Message Type: 0x0012

+

Length: Fixed

+

Status: Optional, may not be repeated.

+ +

Description: The object modification date + and time is a timestamp which indicates the last modification of an object. + The time is updated when any object header message changes according to the + system clock where the change was posted. +

+ +

Format of Data: +

+ + + + + + + + + + + + + + + + + + +
+ Modification Time Message +
bytebytebytebyte
VersionReserved
Seconds After Epoch
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription
Version

The version number is used for changes in the format of Object Modification Time + and is described here:

+ + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by Version 1.6.1 and after of the library to encode time. In + this version, the time is the seconds after Epoch.
+
Reserved

This field is reserved and should always be zero.

Seconds After Epoch

The number of seconds since 0 hours, 0 minutes, 0 seconds, + January 1, 1970, Coordinated Universal Time.

+
+ +
+

Disk Format: Level 2b - Data Object Data Storage

+

The data for an object is stored separately from the header +information in the file and may not actually be located in the HDF5 file +itself if the header indicates that the data is stored externally. The +information for each record in the object is stored according to the +dimensionality of the object (indicated in the dimensionality header message). +Multi-dimensional data is stored in C order [same as current scheme], i.e. the +"last" dimension changes fastest. +

Data whose elements are composed of simple number-types are stored in +native-endian IEEE format, unless they are specifically defined as being stored +in a different machine format with the architecture-type information from the +number-type header message. This means that each architecture will need to +[potentially] byte-swap data values into the internal representation for that +particular machine. +

Data with a variable-length datatype is stored in the global heap +of the HDF5 file. Global heap identifiers are stored in the +data object storage. +

Data whose elements are composed of pointer number-types are stored in several +different ways depending on the particular pointer type involved. Simple +pointers are just stored as the dataset offset of the object being pointed to with the +size of the pointer being the same number of bytes as offsets in the file. +Dataset region references are stored as a heap-ID which points to the following +information within the file-heap: an offset of the object pointed to, number-type +information (same format as header message), dimensionality information (same +format as header message), sub-set start and end information (i.e. a coordinate +location for each), and field start and end names (i.e. a [pointer to the] +string indicating the first field included and a [pointer to the] string name +for the last field). + +

Data of a compound datatype is stored as a contiguous stream of the items +in the structure, with each item formatted according to its datatype.

+ +
+

Appendix

+

Definitions of various terms used in this document. +

+

The "undefined address" for a file is a +file address with all bits set, i.e. 0xffff...ff. +

The "unlimited size" for a size is a +value with all bits set, i.e. 0xffff...ff. + + + diff --git a/doxygen/examples/H5.format.2.0.html b/doxygen/examples/H5.format.2.0.html new file mode 100644 index 0000000..3653489 --- /dev/null +++ b/doxygen/examples/H5.format.2.0.html @@ -0,0 +1,14902 @@ + + + + + HDF5 File Format Specification Version 2.0 + + + + +

+ + + + + + + +
+
    +
  1. Introduction
  2. + +
      +
    1. This Document
    2. +
    3. Changes for HDF5 1.10
    4. +
    +
    + +
  3. Disk Format: Level 0 - File Metadata
  4. + +
      +
    1. Disk Format: Level 0A - Format Signature and Superblock
    2. +
    3. Disk Format: Level 0B - File Driver Info
    4. +
    5. Disk Format: Level 0C - Superblock Extension
    6. +
    +
    +
  5. Disk Format: Level 1 - File Infrastructure
  6. + +
      +
    1. Disk Format: Level 1A - B-trees and B-tree + Nodes
    2. +
        +
      1. Disk Format: Level 1A1 - Version 1 + B-trees (B-link Trees)
      2. +
      3. Disk Format: Level 1A2 - Version 2 + B-trees
      4. +
      +
    3. Disk Format: Level 1B - Group Symbol Table Nodes
    4. +
    5. Disk Format: Level 1C - Symbol Table Entry
    6. +
    7. Disk Format: Level 1D - Local Heaps
    8. +
    9. Disk Format: Level 1E - Global Heap
    10. +
    11. Disk Format: Level 1F - Fractal Heap
    12. +
    13. Disk Format: Level 1G - Free-space Manager
    14. +
    15. Disk Format: Level 1H - Shared Object Header Message Table
    16. +
    +
    +
  7. Disk Format: Level 2 - Data Objects
  8. + +
      +
    1. Disk Format: Level 2A - Data Object Headers
    2. +
        +
      1. Disk Format: Level 2A1 - Data Object Header Prefix
      2. +
          +
        1. Version 1 Data Object Header Prefix
        2. +
        3. Version 2 Data Object Header Prefix
        4. +
        +
      3. Disk Format: Level 2A2 - Data Object Header Messages
      4. +
          +
        1. The NIL Message
        2. +
        3. The Dataspace Message
        4. +
        5. The Link Info Message
        6. +
        +
      +
    +
    +
+
  +
    +
  1. Disk Format: Level 2 - Data + Objects (Continued)
  2. +
      +
    1. Disk Format: Level 2A - Data Object + Headers (Continued)
    2. +
        +
      1. Disk Format: Level 2A2 - + Data Object Header Messages (Continued)
      2. +
          +
        1. The Datatype Message
        2. +
        3. The Data Storage - + Fill Value (Old) Message
        4. +
        5. The Data Storage - + Fill Value Message
        6. +
        7. The Link Message
        8. +
        9. The Data Storage - + External Data Files Message
        10. +
        11. The Data Storage - + Layout Message
        12. +
        13. The Bogus Message
        14. +
        15. The Group Info + Message
        16. +
        17. The Data Storage - + Filter Pipeline Message
        18. +
        19. The Attribute + Message
        20. +
        21. The Object Comment + Message
        22. +
        23. The Object + Modification Time (Old) Message
        24. +
        25. The Shared Message + Table Message
        26. +
        27. The Object Header + Continuation Message
        28. +
        29. The Symbol + Table Message
        30. +
        31. The Object + Modification Time Message
        32. +
        33. The B-tree + ‘K’ Values Message
        34. +
        35. The Driver Info + Message
        36. +
        37. The Attribute Info + Message
        38. +
        39. The Object Reference + Count Message
        40. +
        41. The File Space Info + Message
        42. +
        +
      +
    3. Disk Format: Level 2B - Data Object Data Storage
    4. +
    +
    +
  3. Appendix A: Definitions
  4. +
  5. Appendix B: File Memory Allocation Types
  6. +
+
+
+ + + +
+
+
+

I. Introduction

+ + + + + + + +
  +
+ HDF5 Groups +
 
  + Figure 1: Relationships among the HDF5 root group, other groups, and objects +
+
 
  + HDF5 Objects +  
  + Figure 2: HDF5 objects -- datasets, datatypes, or dataspaces +
+
 
+ + +

The format of an HDF5 file on disk encompasses several + key ideas of the HDF4 and AIO file formats as well as + addressing some shortcomings therein. The new format is + more self-describing than the HDF4 format and is more + uniformly applied to data objects in the file.

+ +

An HDF5 file appears to the user as a directed graph. + The nodes of this graph are the higher-level HDF5 objects + that are exposed by the HDF5 APIs:

+ +
    +
  • Groups
  • +
  • Datasets
  • +
  • Committed (formerly Named) datatypes
  • +
+ +

At the lowest level, as information is actually written to the disk, + an HDF5 file is made up of the following objects:

+
    +
  • A superblock
  • +
  • B-tree nodes
  • +
  • Heap blocks
  • +
  • Object headers
  • +
  • Object data
  • +
  • Free space
  • +
+ +

The HDF5 Library uses these low-level objects to represent the + higher-level objects that are then presented to the user or + to applications through the APIs. For instance, a group is an + object header that contains a message that points to a local + heap (for storing the links to objects in the group) and to a + B-tree (which indexes the links). A dataset is an object header + that contains messages that describe datatype, dataspace, layout, + filters, external files, fill value, and other elements with the + layout message pointing to either a raw data chunk or to a + B-tree that points to raw data chunks.

+ + +
+

I.A. This Document

+ +

This document describes the lower-level data objects; + the higher-level objects and their properties are described + in the HDF5 User’s Guide.

+ +

Three levels of information comprise the file format. + Level 0 contains basic information for identifying and + defining information about the file. Level 1 information contains + the information about the pieces of a file shared by many objects + in the file (such as a B-trees and heaps). Level 2 is the rest + of the file and contains all of the data objects, with each object + partitioned into header information, also known as + metadata, and data.

+ +

The sizes of various fields in the following layout tables are + determined by looking at the number of columns the field spans + in the table. There are three exceptions: (1) The size may be + overridden by specifying a size in parentheses, (2) the size of + addresses is determined by the Size of Offsets field + in the superblock and is indicated in this document with a + superscripted ‘O’, and (3) the size of length fields is determined + by the Size of Lengths field in the superblock and is + indicated in this document with a superscripted ‘L’.

+ +

Values for all fields in this document should be treated as unsigned + integers, unless otherwise noted in the description of a field. + Additionally, all metadata fields are stored in little-endian byte + order. +

+ +

All checksums used in the format are computed with the + Jenkins’ + lookup3 algorithm. +

+ +

Whenever a bit flag or field is mentioned for an entry, bits are + numbered from the lowest bit position in the entry. +

+ +

Various tables in this document aligned with “This space inserted + only to align table nicely”. These entries in the table are just + to make the table presentation nicer and do not represent any values + or padding in the file. +

+ + +
+

I.B. Changes for HDF5 1.10

+ +

As of October 2015, changes in the file format for HDF5 1.10 + have not yet been finalized.

+ + + +
+
+
+

+II. Disk Format: Level 0 - File Metadata

+ +
+

+II.A. Disk Format: Level 0A - Format Signature and Superblock

+ +

The superblock may begin at certain predefined offsets within + the HDF5 file, allowing a block of unspecified content for + users to place additional information at the beginning (and + end) of the HDF5 file without limiting the HDF5 Library’s + ability to manage the objects within the file itself. This + feature was designed to accommodate wrapping an HDF5 file in + another file format or adding descriptive information to an HDF5 + file without requiring the modification of the actual file’s + information. The superblock is located by searching for the + HDF5 format signature at byte offset 0, byte offset 512, and at + successive locations in the file, each a multiple of two of + the previous location; in other words, at these byte offsets: + 0, 512, 1024, 2048, and so on.

+ +

The superblock is composed of the format signature, followed by a + superblock version number and information that is specific to each + version of the superblock. + Currently, there are three versions of the superblock format. + Version 0 is the default format, while version 1 is basically the same + as version 0 with additional information when a non-default B-tree ‘K’ + value is stored. Version 2 is the latest format, with some fields + eliminated or compressed and with superblock extension and checksum + support.

+ +

Version 0 and 1 of the superblock are described below:

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Superblock (Versions 0 and 1) +
bytebytebytebyte

Format Signature (8 bytes)

Version # of SuperblockVersion # of File’s Free Space StorageVersion # of Root Group Symbol Table EntryReserved (zero)
Version # of Shared Header Message FormatSize of OffsetsSize of LengthsReserved (zero)
Group Leaf Node KGroup Internal Node K
File Consistency Flags
Indexed Storage Internal Node K1Reserved (zero)1

Base AddressO


Address of File Free space InfoO


End of File AddressO


Driver Information Block AddressO

Root Group Symbol Table Entry
+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in “Size of Offsets.”) +
  + (Items marked with a ‘1’ in the above table are + new in version 1 of the superblock) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Format Signature

This field contains a constant value and can be used to + quickly identify a file as being an HDF5 file. The + constant value is designed to allow easy identification of + an HDF5 file and to allow certain types of data corruption + to be detected. The file signature of an HDF5 file always + contains the following values:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Decimal:13772687013102610
Hexadecimal:894844460d0a1a0a
ASCII C Notation:\211HDF\r\n\032\n
+
+

This signature both identifies the file as an HDF5 file + and provides for immediate detection of common + file-transfer problems. The first two bytes distinguish + HDF5 files on systems that expect the first two bytes to + identify the file type uniquely. The first byte is + chosen as a non-ASCII value to reduce the probability + that a text file may be misrecognized as an HDF5 file; + also, it catches bad file transfers that clear bit + 7. Bytes two through four name the format. The CR-LF + sequence catches bad file transfers that alter newline + sequences. The control-Z character stops file display + under MS-DOS. The final line feed checks for the inverse + of the CR-LF translation problem. (This is a direct + descendent of the + PNG file + signature.)

+

This field is present in version 0+ of the superblock. +

Version Number of the Superblock

This value is used to determine the format of the + information in the superblock. When the format of the + information in the superblock is changed, the version number + is incremented to the next integer and can be used to + determine how the information in the superblock is + formatted.

+ +

Values of 0, 1 and 2 are defined for this field. (The format + of version 2 is described below, not here) +

+ +

This field is present in version 0+ of the superblock. +

+

Version Number of the File’s Free Space + Information

+

This value is used to determine the format of the + file’s free space information. +

+

The only value currently valid in this field is ‘0’, which + indicates that the file’s free space is as described + below. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

Version Number of the Root Group Symbol Table + Entry

This value is used to determine the format of the + information in the Root Group Symbol Table Entry. When the + format of the information in that field is changed, the + version number is incremented to the next integer and can be + used to determine how the information in the field + is formatted.

+

The only value currently valid in this field is ‘0’, + which indicates that the root group symbol table entry is + formatted as described below.

+

This field is present in version 0 and 1 of the + superblock.

+

Version Number of the Shared Header Message Format

This value is used to determine the format of the + information in a shared object header message. Since the format + of the shared header messages differs from the other private + header messages, a version number is used to identify changes + in the format. +

+

The only value currently valid in this field is ‘0’, which + indicates that shared header messages are formatted as + described below. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

Size of Offsets

This value contains the number of bytes used to store + addresses in the file. The values for the addresses of + objects in the file are offsets relative to a base address, + usually the address of the superblock signature. This + allows a wrapper to be added after the file is created + without invalidating the internal offset locations. +

+ +

This field is present in version 0+ of the superblock. +

+

Size of Lengths

This value contains the number of bytes used to store + the size of an object. +

+

This field is present in version 0+ of the superblock. +

+

Group Leaf Node K

+

Each leaf node of a group B-tree will have at + least this many entries but not more than twice this + many. If a group has a single leaf node then it + may have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

Group Internal Node K

+

Each internal node of a group B-tree will have at + least this many entries but not more than twice this + many. If the group has only one internal + node then it might have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

File Consistency Flags

+

This value contains flags to indicate information + about the consistency of the information contained + within the file. Currently, the following bit flags are + defined: +

    +
  • Bit 0 set indicates that the file is opened for + write-access.
  • +
  • Bit 1 set indicates that the file has + been verified for consistency and is guaranteed to be + consistent with the format defined in this document.
  • +
  • Bits 2-31 are reserved for future use.
  • +
+ Bit 0 should be + set as the first action when a file is opened for write + access and should be cleared only as the final action + when closing a file. Bit 1 should be cleared during + normal access to a file and only set after the file’s + consistency is guaranteed by the library or a + consistency utility. +

+ +

This field is present in version 0+ of the superblock. +

+

Indexed Storage Internal Node K

+

Each internal node of an indexed storage B-tree will have at + least this many entries but not more than twice this + many. If the index storage B-tree has only one internal + node then it might have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 1 of the superblock. +

+

Base Address

+

This is the absolute file address of the first byte of + the HDF5 data within the file. The library currently + constrains this value to be the absolute file address + of the superblock itself when creating new files; + future versions of the library may provide greater + flexibility. When opening an existing file and this address does + not match the offset of the superblock, the library assumes + that the entire contents of the HDF5 file have been adjusted in + the file and adjusts the base address and end of file address to + reflect their new positions in the file. Unless otherwise noted, + all other file addresses are relative to this base + address. +

+ +

This field is present in version 0+ of the superblock. +

+

Address of Global Free-space Index

+

The file’s free space is not persistent for version 0 and 1 of + the superblock. + Currently this field always contains the + undefined address. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

End of File Address

+

This is the absolute file address of the first byte past + the end of all HDF5 data. It is used to determine whether a + file has been accidently truncated and as an address where + file data allocation can occur if space from the free list is + not used. +

+ +

This field is present in version 0+ of the superblock. +

+

Driver Information Block Address

+

This is the relative file address of the file driver + information block which contains driver-specific + information needed to reopen the file. If there is no + driver information block then this entry should be the + undefined address. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

Root Group Symbol Table Entry

+

This is the symbol table entry + of the root group, which serves as the entry point into + the group graph for the file. +

+ +

This field is present in version 0 and 1 of the superblock. +

+
+
+ +
+

Version 2 of the superblock is described below:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Superblock (Version 2) +
bytebytebytebyte

Format Signature (8 bytes)

Version # of SuperblockSize of OffsetsSize of LengthsFile Consistency Flags

Base AddressO


Superblock Extension AddressO


End of File AddressO


Root Group Object Header AddressO

Superblock Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in “Size of Offsets.”) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Format Signature

+

This field is the same as described for versions 0 and 1 of the + superblock. +

Version Number of the Superblock

+

This field has a value of 2 and has the same meaning as for + versions 0 and 1. +

+

Size of Offsets

+

This field is the same as described for versions 0 and 1 of the + superblock. +

+

Size of Lengths

+

This field is the same as described for versions 0 and 1 of the + superblock. +

+

File Consistency Flags

+

This field is the same as described for versions 0 and 1 except + that it is smaller (the number of reserved bits has been reduced + from 30 to 6). +

+

Base Address

+

This field is the same as described for versions 0 and 1 of the + superblock. +

+

Superblock Extension Address

+

The field is the address of the object header for the + superblock extension. + If there is no extension then this entry should be the + undefined address. +

+

End of File Address

+

This field is the same as described for versions 0 and 1 of the + superblock. +

+

Root Group Object Header Address

+

This is the address of + the root group object header, + which serves as the entry point into the group graph for the file. +

+

Superblock Checksum

+

The checksum for the superblock. +

+
+
+ +
+

+II.B. Disk Format: Level 0B - File Driver Info

+ +

The driver information block is an optional region of the + file which contains information needed by the file driver + to reopen a file. The format is described below:

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Driver Information Block +
bytebytebytebyte
VersionReserved
Driver Information Size

Driver Identification (8 bytes)



Driver Information (variable size)


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

The version number of the Driver Information Block. + This document describes version 0. +

+

Driver Information Size

+

The size in bytes of the Driver Information field. +

+

Driver Identification

+

This is an eight-byte ASCII string without null + termination which identifies the driver and/or version number + of the Driver Information Block. The predefined driver encoded + in this field by the HDF5 Library is identified by the + letters NCSA followed by the first four characters of + the driver name. If the Driver Information block is not + the original version then the last letter(s) of the + identification will be replaced by a version number in + ASCII, starting with 0. +

+

+ Identification for user-defined drivers is also eight-byte long. + It can be arbitrary but should be unique to avoid + the four character prefix “NCSA”. +

+

Driver Information

Driver information is stored in a format defined by the + file driver (see description below).
+
+ +
+ The two drivers encoded in the Driver Identification field are as follows: +
    +
  • + Multi driver: +

    + The identifier for this driver is “NCSAmulti”. + This driver provides a mechanism for segregating raw data and different types of metadata + into multiple files. + These files are viewed by the library as a single virtual HDF5 file with a single file address. + A maximum of 6 files will be created for the following data: + superblock, B-tree, raw data, global heap, local heap, and object header. + More than one type of data can be written to the same file. +

  • +
  • + Family driver +

    + The identifier for this driver is “NCSAfami” and is encoded in this field for library version 1.8 and after. + This driver is designed for systems that do not support files larger than 2 gigabytes + by splitting the HDF5 file address space across several smaller files. + It does nothing to segregate metadata and raw data; + they are mixed in the address space just as they would be in a single contiguous file. +

  • +
+

The format of the Driver Information field for the + above two drivers are described below:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Multi Driver Information +
bytebytebytebyte
Member MappingMember MappingMember MappingMember Mapping
Member MappingMember MappingReservedReserved

Address of Member File 1


End of Address for Member File 1


Address of Member File 2


End of Address for Member File 2


... ...


Address of Member File N


End of Address for Member File N


Name of Member File 1 (variable size)


Name of Member File 2 (variable size)


... ...


Name of Member File N (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Member Mapping

These fields are integer values from 1 to 6 + indicating how the data can be mapped to or merged with another type of + data. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Member MappingDescription
1The superblock data.
2The B-tree data.
3The raw data.
4The global heap data.
5The local heap data.
6The object header data.

+

For example, if the third field has the value 3 and all the rest have the + value 1, it means there are two files: one for raw data, and one for superblock, + B-tree, global heap, local heap, and object header.

+

Reserved

These fields are reserved and should always be zero.

Address of Member File N

This field Specifies the virtual address at which the member file starts.

+

N is the number of member files.

+

End of Address for Member File N

This field is the end of the allocated address for the member file. +

Name of Member File N

This field is the null-terminated name of the member file and + its length should be multiples of 8 bytes. + Additional bytes will be padded with NULLs. The default naming + convention is %s-X.h5, where X is one of the letters + s (for superblock), b (for B-tree), r (for raw data), + g (for global heap), l (for local heap), and o (for + object header). The name of the whole HDF5 file will substitute the %s + in the string. +

+
+
+ +
+
+ + + + + + + + + + + + + + +
+ Family Driver Information +
bytebytebytebyte

Size of Member File

+
+ +
+
+ + + + + + + + + + +
Field NameDescription

Size of Member File

This field is the size of the member file in the family of files.

+
+ +
+

+II.C. Disk Format: Level 0C - Superblock Extension

+ +

The superblock extension is used to store superblock metadata + which is either optional, or added after the version of the superblock + was defined. Superblock extensions may only exist when version 2+ of + superblock is used. A superblock extension is an object header which may + hold the following messages:

+ + + + +
+
+
+

+III. Disk Format: Level 1 - File Infrastructure

+ +
+

+III.A. Disk Format: Level 1A - B-trees and B-tree Nodes

+ +

B-trees allow flexible storage for objects which tend to grow + in ways that cause the object to be stored discontiguously. B-trees + are described in various algorithms books including “Introduction to + Algorithms” by Thomas H. Cormen, Charles E. Leiserson, and Ronald + L. Rivest. B-trees are used in several places in the HDF5 file format, + when an index is needed for another data structure.

+ +

The version 1 B-tree structure described below is the original index + structure, but are limited by some bugs in our implementation (mainly in + how they handle deleting records). The version 1 B-trees are being phased + out in favor of the version 2 B-trees described below, although both + types of structures may be found in the same file, depending on + application settings when creating the file.

+ +
+

+III.A.1. Disk Format: Level 1A1 - Version 1 B-trees (B-link Trees)

+ +

Version 1 B-trees in HDF5 files an implementation of the B-link tree, + in which the sibling nodes at a particular level in the tree are stored + in a doubly-linked list, is described in the “Efficient Locking for + Concurrent Operations on B-trees” paper by Phillip Lehman and S. Bing Yao + as published in the ACM Transactions on Database Systems, + Vol. 6, No. 4, December 1981.

+ +

The B-link trees implemented by the file format contain one more + key than the number of children. In other words, each child + pointer out of a B-tree node has a left key and a right key. + The pointers out of internal nodes point to sub-trees while + the pointers out of leaf nodes point to symbol nodes and + raw data chunks. + Aside from that difference, internal nodes and leaf nodes + are identical.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ B-link Tree Nodes +
bytebytebytebyte
Signature
Node TypeNode LevelEntries Used

Address of Left SiblingO


Address of Right SiblingO

Key 0 (variable size)

Address of Child 0O

Key 1 (variable size)

Address of Child 1O

...
Key 2K (variable size)

Address of Child 2KO

Key 2K+1 (variable size)
+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “TREE” is + used to indicate the + beginning of a B-link tree node. This gives file + consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Node Type

+

Each B-link tree points to a particular type of data. + This field indicates the type of data as well as + implying the maximum degree K of the tree and + the size of each Key field. + + + + + + + + + + + + + + + +
Node TypeDescription
0This tree points to group nodes.
1This tree points to raw data chunk nodes.

+

Node Level

+

The node level indicates the level at which this node + appears in the tree (leaf nodes are at level zero). Not + only does the level indicate whether child pointers + point to sub-trees or to data, but it can also be used + to help file consistency checking utilities reconstruct + damaged trees. +

+

Entries Used

+

This determines the number of children to which this + node points. All nodes of a particular type of tree + have the same maximum degree, but most nodes will point + to less than that number of children. The valid child + pointers and keys appear at the beginning of the node + and the unused pointers and keys appear at the end of + the node. The unused pointers and keys have undefined + values. +

+

Address of Left Sibling

+

This is the relative file address of the left sibling of + the current node. If the current + node is the left-most node at this level then this field + is the undefined address. +

+

Address of Right Sibling

+

This is the relative file address of the right sibling of + the current node. If the current + node is the right-most node at this level then this + field is the undefined address. +

+

Keys and Child Pointers

+

Each tree has 2K+1 keys with 2K + child pointers interleaved between the keys. The number + of keys and child pointers actually containing valid + values is determined by the node’s Entries Used field. + If that field is N then the B-link tree contains + N child pointers and N+1 keys. +

+

Key

+

The format and size of the key values is determined by + the type of data to which this tree points. The keys are + ordered and are boundaries for the contents of the child + pointer; that is, the key values represented by child + N fall between Key N and Key + N+1. Whether the interval is open or closed on + each end is determined by the type of data to which the + tree points. +

+ +

+ The format of the key depends on the node type. + For nodes of node type 0 (group nodes), the key is formatted as + follows: + + + + + + +
A single field of Size of Lengths + bytes:Indicates the byte offset into the local heap + for the first object name in the subtree which + that key describes. +
+

+ + +

+ For nodes of node type 1 (chunked raw data nodes), the key is + formatted as follows: + + + + + + + + + + + + + + +
Bytes 1-4:Size of chunk in bytes.
Bytes 4-8:Filter mask, a 32-bit bit field indicating which + filters have been skipped for this chunk. Each filter + has an index number in the pipeline (starting at 0, with + the first filter to apply) and if that filter is skipped, + the bit corresponding to its index is set.
(D + 1) 64-bit fields:The offset of the + chunk within the dataset where D is the number + of dimensions of the dataset, and the last value is the + offset within the dataset’s datatype and should always be + zero. For example, if + a chunk in a 3-dimensional dataset begins at the + position [5,5,5], there will be three + such 64-bit values, each with the value of + 5, followed by a 0 value.
+

+ +

Child Pointer

+

The tree node contains file addresses of subtrees or + data depending on the node level. Nodes at Level 0 point + to data addresses, either raw data chunks or group nodes. + Nodes at non-zero levels point to other nodes of the + same B-tree. +

+

For raw data chunk nodes, the child pointer is the address + of a single raw data chunk. For group nodes, the child pointer + points to a symbol table, which contains + information for multiple symbol table entries. +

+
+
+ +

+ Conceptually, each B-tree node looks like this:

+
+ + + + + + + + + + + + + +
key[0] child[0] key[1] child[1] key[2] ... ... key[N-1] child[N-1] key[N]
+
+
+ + where child[i] is a pointer to a sub-tree (at a level + above Level 0) or to data (at Level 0). + Each key[i] describes an item stored by the B-tree + (a chunk or an object of a group node). The range of values + represented by child[i] is indicated by key[i] + and key[i+1]. + + +

The following question must next be answered: + “Is the value described by key[i] contained in + child[i-1] or in child[i]?” + The answer depends on the type of tree. + In trees for groups (node type 0) the object described by + key[i] is the greatest object contained in + child[i-1] while in chunk trees (node type 1) the + chunk described by key[i] is the least chunk in + child[i].

+ +

That means that key[0] for group trees is sometimes unused; + it points to offset zero in the heap, which is always the + empty string and compares as “less-than” any valid object name.

+ +

And key[N] for chunk trees is sometimes unused; + it contains a chunk offset which compares as “greater-than” + any other chunk offset and has a chunk byte size of zero + to indicate that it is not actually allocated.

+ +
+

+III.A.2. Disk Format: Level 1A2 - Version 2 B-trees

+ +

Version 2 B-trees are “traditional” B-trees, with one major difference. + Instead of just using a simple pointer (or address in the file) to a + child of an internal node, the pointer to the child node contains two + additional pieces of information: the number of records in the child + node itself, and the total number of records in the child node and + all its descendants. Storing this additional information allows fast + array-like indexing to locate the nth record in the B-tree.

+ +

The entry into a version 2 B-tree is a header which contains global + information about the structure of the B-tree. The root node + address + field in the header points to the B-tree root node, which is either an + internal or leaf node, depending on the value in the header’s + depth field. An internal node consists of records plus + pointers to further leaf or internal nodes in the tree. A leaf node + consists of solely of records. The format of the records depends on + the B-tree type (stored in the header).

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree Header +
bytebytebytebyte
Signature
VersionTypeThis space inserted only to align table nicely
Node Size
Record SizeDepth
Split PercentMerge PercentThis space inserted only to align table nicely

Root Node AddressO

Number of Records in Root NodeThis space inserted only to align table nicely

Total Number of Records in B-treeL

Checksum
+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “BTHD” is + used to indicate the header of a version 2 B-link tree node. +

+

Version

+

The version number for this B-tree header. This document + describes version 0. +

+

Type

+

This field indicates the type of B-tree: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0A “testing” B-tree, this value should not be + used for storing records in actual HDF5 files. +
1This B-tree is used for indexing indirectly accessed, + non-filtered ‘huge’ fractal heap objects. +
2This B-tree is used for indexing indirectly accessed, + filtered ‘huge’ fractal heap objects. +
3This B-tree is used for indexing directly accessed, + non-filtered ‘huge’ fractal heap objects. +
4This B-tree is used for indexing directly accessed, + filtered ‘huge’ fractal heap objects. +
5This B-tree is used for indexing the ‘name’ field for + links in indexed groups. +
6This B-tree is used for indexing the ‘creation order’ + field for links in indexed groups. +
7This B-tree is used for indexing shared object header + messages. +
8This B-tree is used for indexing the ‘name’ field for + indexed attributes. +
9This B-tree is used for indexing the ‘creation order’ + field for indexed attributes. +

+

The format of records for each type is described below.

+

Node Size

+

This is the size in bytes of all B-tree nodes. +

+

Record Size

+

This field is the size in bytes of the B-tree record. +

+

Depth

+

This is the depth of the B-tree. +

+

Split Percent

+

The percent full that a node needs to increase above before it + is split. +

+

Merge Percent

+

The percent full that a node needs to be decrease below before it + is split. +

+

Root Node Address

+

This is the address of the root B-tree node. A B-tree with + no records will have the undefined + address in this field. +

+

Number of Records in Root Node

+

This is the number of records in the root node. +

+

Total Number of Records in B-tree

+

This is the total number of records in the entire B-tree. +

+

Checksum

+

This is the checksum for the B-tree header. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree Internal Node +
bytebytebytebyte
Signature
VersionTypeRecords 0, 1, 2...N-1 (variable size)

Child Node Pointer 0O


Number of Records N0 for Child Node 0 (variable size)

Total Number of Records for Child Node 0 (optional, variable size)

Child Node Pointer 1O


Number of Records N1 for Child Node 1 (variable size)

Total Number of Records for Child Node 1 (optional, variable size)
...

Child Node Pointer NO


Number of Records Nn for Child Node N (variable size)

Total Number of Records for Child Node N (optional, variable size)
Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “BTIN” is + used to indicate the internal node of a B-link tree. +

+

Version

+

The version number for this B-tree internal node. + This document describes version 0. +

+

Type

+

This field is the type of the B-tree node. It should always + be the same as the B-tree type in the header. +

+

Records

+

The size of this field is determined by the number of records + for this node and the record size (from the header). The format + of records depends on the type of B-tree. +

+

Child Node Pointer

+

This field is the address of the child node pointed to by the + internal node. +

+

Number of Records in Child Node

+

This is the number of records in the child node pointed to by + the corresponding Node Pointer. +

+

The number of bytes used to store this field is determined by + the maximum possible number of records able to be stored in the + child node. +

+

+ The maximum number of records in a child node is computed + in the following way: + +

    +
  • Subtract the fixed size overhead for + the child node (for example, its signature, version, + checksum, and so on and one pointer triplet + of information for the child node (because there is one + more pointer triplet than records in each internal node)) + from the size of nodes for the B-tree.
  • +
  • Divide that result by the size of a record plus the + pointer triplet of information stored to reach each + child node from this node. +
+ +

+

+ Note that leaf nodes do not encode any + child pointer triplets, so the maximum number of records in a + leaf node is just the node size minus the leaf node overhead, + divided by the record size. +

+

+ Also note that the first level of internal nodes above the + leaf nodes do not encode the Total Number of Records in Child + Node value in the child pointer triplets (since it is the + same as the Number of Records in Child Node), so the + maximum number of records in these nodes is computed with the + equation above, but using (Child Pointer, Number of + Records in Child Node) pairs instead of triplets. +

+

+ The number of + bytes used to encode this field is the least number of bytes + required to encode the maximum number of records in a child + node value for the child nodes below this level + in the B-tree. +

+

+ For example, if the maximum number of child records is + 123, one byte will be used to encode these values in this + node; if the maximum number of child records is + 20000, two bytes will be used to encode these values in this + node; and so on. The maximum number of bytes used to + encode these values is 8 (in other words, an unsigned + 64-bit integer). +

+

Total Number of Records in Child Node

+

This is the total number of records for the node pointed to by + the corresponding Node Pointer and all its children. + This field exists only in nodes whose depth in the B-tree node + is greater than 1 (in other words, the “twig” + internal nodes, just above leaf nodes, do not store this + field in their child node pointers). +

+

The number of bytes used to store this field is determined by + the maximum possible number of records able to be stored in the + child node and its descendants. +

+

+ The maximum possible number of records able to be stored in a + child node and its descendants is computed iteratively, in the + following way: The maximum number of records in a leaf node + is computed, then that value is used to compute the maximum + possible number of records in the first level of internal nodes + above the leaf nodes. Multiplying these two values together + determines the maximum possible number of records in child node + pointers for the level of nodes two levels above leaf nodes. + This process is continued up to any level in the B-tree. +

+

+ The number of bytes used to encode this value is computed in + the same way as for the Number of Records in Child Node + field. +

+

Checksum

+

This is the checksum for this node. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree Leaf Node +
bytebytebytebyte
Signature
VersionTypeRecord 0, 1, 2...N-1 (variable size)
Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “BTLF“ is + used to indicate the leaf node of a version 2 B-link tree. +

+

Version

+

The version number for this B-tree leaf node. + This document describes version 0. +

+

Type

+

This field is the type of the B-tree node. It should always + be the same as the B-tree type in the header. +

+

Records

+

The size of this field is determined by the number of records + for this node and the record size (from the header). The format + of records depends on the type of B-tree. +

+

Checksum

+

This is the checksum for this node. +

+
+
+ +
+

The record layout for each stored (in other words, non-testing) + B-tree type is as follows:

+ +
+ + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 1 Record Layout - Indirectly Accessed, Non-Filtered, + ‘Huge’ Fractal Heap Objects +
bytebytebytebyte

Huge Object AddressO


Huge Object LengthL


Huge Object IDL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Huge Object Address

+

The address of the huge object in the file. +

+

Huge Object Length

+

The length of the huge object in the file. +

+

Huge Object ID

+

The heap ID for the huge object. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 2 Record Layout - Indirectly Accessed, Filtered, + ‘Huge’ Fractal Heap Objects +
bytebytebytebyte

Filtered Huge Object AddressO


Filtered Huge Object LengthL

Filter Mask

Filtered Huge Object Memory SizeL


Huge Object IDL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Filtered Huge Object Address

+

The address of the filtered huge object in the file. +

+

Filtered Huge Object Length

+

The length of the filtered huge object in the file. +

+

Filter Mask

+

A 32-bit bit field indicating which filters have been skipped for + this chunk. Each filter has an index number in the pipeline + (starting at 0, with the first filter to apply) and if that + filter is skipped, the bit corresponding to its index is set. +

+

Filtered Huge Object Memory Size

+

The size of the de-filtered huge object in memory. +

+

Huge Object ID

+

The heap ID for the huge object. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 3 Record Layout - Directly Accessed, Non-Filtered, + ‘Huge’ Fractal Heap Objects +
bytebytebytebyte

Huge Object AddressO


Huge Object LengthL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription

Huge Object Address

+

The address of the huge object in the file. +

+

Huge Object Length

+

The length of the huge object in the file. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 4 Record Layout - Directly Accessed, Filtered, + ‘Huge’ Fractal Heap Objects +
bytebytebytebyte

Filtered Huge Object AddressO


Filtered Huge Object LengthL

Filter Mask

Filtered Huge Object Memory SizeL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Filtered Huge Object Address

+

The address of the filtered huge object in the file. +

+

Filtered Huge Object Length

+

The length of the filtered huge object in the file. +

+

Filter Mask

+

A 32-bit bit field indicating which filters have been skipped for + this chunk. Each filter has an index number in the pipeline + (starting at 0, with the first filter to apply) and if that + filter is skipped, the bit corresponding to its index is set. +

+

Filtered Huge Object Memory Size

+

The size of the de-filtered huge object in memory. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 5 Record Layout - Link Name for Indexed Group +
bytebytebytebyte
Hash of Name
ID (bytes 1-4)
ID (bytes 5-7)
+
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription

Hash

+

This field is hash value of the name for the link. The hash + value is the Jenkins’ lookup3 checksum algorithm applied to + the link’s name. +

+

ID

+

This is a 7-byte sequence of bytes and is the heap ID for the + link record in the group’s fractal heap.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 6 Record Layout - Creation Order for Indexed Group +
bytebytebytebyte

Creation Order (8 bytes)

ID (bytes 1-4)
ID (bytes 5-7)
+
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription

Creation Order

+

This field is the creation order value for the link. +

+

ID

+

This is a 7-byte sequence of bytes and is the heap ID for the + link record in the group’s fractal heap.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 7 Record Layout - Shared Object Header Messages (Sub-Type 0 - Message in Heap) +
bytebytebytebyte
Message LocationThis space inserted only to align table nicely
Hash
Reference Count

Heap ID (8 bytes)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Message Location

+

This field Indicates the location where the message is stored: + + + + + + + + + + + + + +
ValueDescription
0Shared message is stored in shared message index heap. +
1Shared message is stored in object header. +

+

Hash

+

This field is hash value of the shared message. The hash + value is the Jenkins’ lookup3 checksum algorithm applied to + the shared message.

+

Reference Count

+

The number of objects which reference this message.

+

Heap ID

+

This is an 8-byte sequence of bytes and is the heap ID for the + shared message in the shared message index’s fractal heap.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 7 Record Layout - Shared Object Header Messages (Sub-Type 1 - Message in Object Header) +
bytebytebytebyte
Message LocationThis space inserted only to align table nicely
Hash
Reserved (zero)Message TypeObject Header Index

Object Header AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Message Location

+

This field Indicates the location where the message is stored: + + + + + + + + + + + + + +
ValueDescription
0Shared message is stored in shared message index heap. +
1Shared message is stored in object header. +

+

Hash

+

This field is hash value of the shared message. The hash + value is the Jenkins’ lookup3 checksum algorithm applied to + the shared message.

+

Message Type

+

The object header message type of the shared message.

+

Object Header Index

+

This field indicates that the shared message is the nth message + of its type in the specified object header.

+

Object Header Address

+

The address of the object header containing the shared message.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 8 Record Layout - Attribute Name for Indexed Attributes +
bytebytebytebyte

Heap ID (8 bytes)

Message FlagsThis space inserted only to align table nicely
Creation Order
Hash of Name
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Heap ID

+

This is an 8-byte sequence of bytes and is the heap ID for the + attribute in the object’s attribute fractal heap.

+

Message Flags

The object header message flags for the attribute message.

+

Creation Order

+

This field is the creation order value for the attribute. +

+

Hash

+

This field is hash value of the name for the attribute. The hash + value is the Jenkins’ lookup3 checksum algorithm applied to + the attribute’s name. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ Version 2 B-tree, Type 9 Record Layout- Creation Order for Indexed Attributes +
bytebytebytebyte

Heap ID (8 bytes)

Message FlagsThis space inserted only to align table nicely
Creation Order
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Heap ID

+

This is an 8-byte sequence of bytes and is the heap ID for the + attribute in the object’s attribute fractal heap.

+

Message Flags

+

The object header message flags for the attribute message.

+

Creation Order

+

This field is the creation order value for the attribute. +

+
+
+ + +
+

+III.B. Disk Format: Level 1B - Group Symbol Table Nodes

+ +

A group is an object internal to the file that allows + arbitrary nesting of objects within the file (including other groups). + A group maps a set of link names in the group to a set of relative + file addresses of objects in the file. Certain metadata for an object to + which the group points can be cached in the group’s symbol table entry in + addition to being in the object’s header.

+ +

An HDF5 object name space can be stored hierarchically by + partitioning the name into components and storing each + component as a link in a group. The link for a + non-ultimate component points to the group containing + the next component. The link for the last + component points to the object being named.

+ +

One implementation of a group is a collection of symbol table nodes + indexed by a B-link tree. Each symbol table node contains entries + for one or more links. If an attempt is made to add a link to an already + full symbol table node containing 2K entries, then the node is + split and one node contains K symbols and the other contains + K+1 symbols.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Symbol Table Node (A Leaf of a B-link tree) +
bytebytebytebyte
Signature
Version NumberReserved (zero)Number of Symbols


Group Entries


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “SNOD” is + used to indicate the + beginning of a symbol table node. This gives file + consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Version Number

+

The version number for the symbol table node. This + document describes version 1. (There is no version ‘0’ + of the symbol table node) +

+

Number of Entries

+

Although all symbol table nodes have the same length, + most contain fewer than the maximum possible number of + link entries. This field indicates how many entries + contain valid data. The valid entries are packed at the + beginning of the symbol table node while the remaining + entries contain undefined values. +

+

Symbol Table Entries

+

Each link has an entry in the symbol table node. + The format of the entry is described below. + There are 2K entries in each group node, where + K is the “Group Leaf Node K” value from the + superblock. +

+
+
+ +
+

+III.C. Disk Format: Level 1C - Symbol Table Entry

+ +

Each symbol table entry in a symbol table node is designed + to allow for very fast browsing of stored objects. + Toward that design goal, the symbol table entries + include space for caching certain constant metadata from the + object header.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Symbol Table Entry +
bytebytebytebyte

Link Name OffsetO


Object Header AddressO

Cache Type
Reserved (zero)


Scratch-pad Space (16 bytes)


+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Link Name Offset

+

This is the byte offset into the group’s local + heap for the name of the link. The name is null + terminated. +

+

Object Header Address

+

Every object has an object header which serves as a + permanent location for the object’s metadata. In addition + to appearing in the object header, some of the object’s metadata + can be cached in the scratch-pad space. +

+

Cache Type

+

The cache type is determined from the object header. + It also determines the format for the scratch-pad space: + + + + + + + + + + + + + + + + + + +
TypeDescription
0No data is cached by the group entry. This + is guaranteed to be the case when an object header + has a link count greater than one. +
1Group object header metadata is cached in the + scratch-pad space. This implies that the symbol table + entry refers to another group. +
2The entry is a symbolic link. The first four bytes + of the scratch-pad space are the offset into the local + heap for the link value. The object header address + will be undefined. +

+ +

Reserved

+

These four bytes are present so that the scratch-pad + space is aligned on an eight-byte boundary. They are + always set to zero. +

+

Scratch-pad Space

+

This space is used for different purposes, depending + on the value of the Cache Type field. Any metadata + about an object represented in the scratch-pad + space is duplicated in the object header for that + object. +

+

+ Furthermore, no data is cached in the group + entry scratch-pad space if the object header for + the object has a link count greater than one. +

+
+
+ +
+

Format of the Scratch-pad Space

+ +

The symbol table entry scratch-pad space is formatted + according to the value in the Cache Type field.

+ +

If the Cache Type field contains the value zero + (0) then no information is + stored in the scratch-pad space.

+ +

If the Cache Type field contains the value one + (1), then the scratch-pad space + contains cached metadata for another object header + in the following format:

+ +
+ + + + + + + + + + + + + + + + + +
+ Object Header Scratch-pad Format +
bytebytebytebyte

Address of B-treeO


Address of Name HeapO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription

Address of B-tree

+

This is the file address for the root of the + group’s B-tree. +

+

Address of Name Heap

+

This is the file address for the group’s local + heap, in which are stored the group’s symbol names. +

+
+
+ + +
+

If the Cache Type field contains the value two + (2), then the scratch-pad space + contains cached metadata for a symbolic link + in the following format:

+ +
+ + + + + + + + + + + + + +
+ Symbolic Link Scratch-pad Format +
bytebytebytebyte
Offset to Link Value
+
+ +
+
+ + + + + + + + + + +
Field NameDescription

Offset to Link Value

+

The value of a symbolic link (that is, the name of the + thing to which it points) is stored in the local heap. + This field is the 4-byte offset into the local heap for + the start of the link value, which is null terminated. +

+
+
+ +
+

+III.D. Disk Format: Level 1D - Local Heaps

+ +

A local heap is a collection of small pieces of data that are particular + to a single object in the HDF5 file. Objects can be + inserted and removed from the heap at any time. + The address of a heap does not change once the heap is created. + For example, a group stores addresses of objects in symbol table nodes + with the names of links stored in the group’s local heap. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Local Heap +
bytebytebytebyte
Signature
VersionReserved (zero)

Data Segment SizeL


Offset to Head of Free-listL


Address of Data SegmentO

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “HEAP” + is used to indicate the + beginning of a heap. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

Each local heap has its own version number so that new + heaps can be added to old files. This document + describes version zero (0) of the local heap. +

+

Data Segment Size

+

The total amount of disk memory allocated for the heap + data. This may be larger than the amount of space + required by the objects stored in the heap. The extra + unused space in the heap holds a linked list of free blocks. +

+

Offset to Head of Free-list

+

This is the offset within the heap data segment of the + first free block (or the + undefined address if there is no + free block). The free block contains “Size of Lengths” bytes that + are the offset of the next free block (or the + value ‘1’ if this is the + last free block) followed by “Size of Lengths” bytes that store + the size of this free block. The size of the free block includes + the space used to store the offset of the next free block and + the size of the current block, making the minimum size of a free + block 2 * “Size of Lengths”. +

+

Address of Data Segment

+

The data segment originally starts immediately after + the heap header, but if the data segment must grow as a + result of adding more objects, then the data segment may + be relocated, in its entirety, to another part of the + file. +

+
+
+ +

Objects within a local heap should be aligned on an 8-byte boundary.

+ +
+

+III.E. Disk Format: Level 1E - Global Heap

+ +

Each HDF5 file has a global heap which stores various types of + information which is typically shared between datasets. The + global heap was designed to satisfy these goals:

+ +
    +
  1. Repeated access to a heap object must be efficient without + resulting in repeated file I/O requests. Since global heap + objects will typically be shared among several datasets, it is + probable that the object will be accessed repeatedly.
  2. +
  3. Collections of related global heap objects should result in + fewer and larger I/O requests. For instance, a dataset of + object references will have a global heap object for each + reference. Reading the entire set of object references + should result in a few large I/O requests instead of one small + I/O request for each reference.
  4. +
  5. It should be possible to remove objects from the global heap + and the resulting file hole should be eligible to be reclaimed + for other uses.
  6. +
+ + +

The implementation of the heap makes use of the memory management + already available at the file level and combines that with a new + object called a collection to achieve goal B. The global heap + is the set of all collections. Each global heap object belongs to + exactly one collection and each collection contains one or more global + heap objects. For the purposes of disk I/O and caching, a collection is + treated as an atomic object, addressing goal A. +

+ +

When a global heap object is deleted from a collection (which occurs + when its reference count falls to zero), objects located after the + deleted object in the collection are packed down toward the beginning + of the collection and the collection’s global heap object 0 is created + (if possible) or its size is increased to account for the recently + freed space. There are no gaps between objects in each collection, + with the possible exception of the final space in the collection, if + it is not large enough to hold the header for the collection’s global + heap object 0. These features address goal C. +

+ +

The HDF5 Library creates global heap collections as needed, so there may + be multiple collections throughout the file. The set of all of them is + abstractly called the “global heap”, although they do not actually link + to each other, and there is no global place in the file where you can + discover all of the collections. The collections are found simply by + finding a reference to one through another object in the file. For + example, data of variable-length datatype elements is stored in the + global heap and is accessed via a global heap ID. The format for + global heap IDs is described at the end of this section. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ A Global Heap Collection +
bytebytebytebyte
Signature
VersionReserved (zero)

Collection SizeL


Global Heap Object 1


Global Heap Object 2


...


Global Heap Object N


Global Heap Object 0 (free space)

+ + + + + +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “GCOL” + is used to indicate the + beginning of a collection. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

Each collection has its own version number so that new + collections can be added to old files. This document + describes version one (1) of the collections (there is no + version zero (0)). +

+

Collection Size

+

This is the size in bytes of the entire collection + including this field. The default (and minimum) + collection size is 4096 bytes which is a typical file + system block size. This allows for 127 16-byte heap + objects plus their overhead (the collection header of 16 bytes + and the 16 bytes of information about each heap object). +

+

Global Heap Object 1 through N

+

The objects are stored in any order with no + intervening unused space. +

+

Global Heap Object 0

+

Global Heap Object 0 (zero), when present, represents the free + space in the collection. Free space always appears at the end of + the collection. If the free space is too small to store the header + for Object 0 (described below) then the header is implied and the + collection contains no free space. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Global Heap Object +
bytebytebytebyte
Heap Object IndexReference Count
Reserved (zero)

Object SizeL


Object Data

+ + + + + +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Heap Object Index

+

Each object has a unique identification number within a + collection. The identification numbers are chosen so that + new objects have the smallest value possible with the + exception that the identifier 0 always refers to the + object which represents all free space within the + collection. +

+

Reference Count

+

All heap objects have a reference count field. An + object which is referenced from some other part of the + file will have a positive reference count. The reference + count for Object 0 is always zero. +

+

Reserved

+

Zero padding to align next field on an 8-byte boundary. +

+

Object Size

+

This is the size of the object data stored for the object. + The actual storage space allocated for the object data is rounded + up to a multiple of eight. +

+

Object Data

+

The object data is treated as a one-dimensional array + of bytes to be interpreted by the caller. +

+
+ +
+ +
+

+ The format for the ID used to locate an object in the global heap is + described here:

+ +
+ + + + + + + + + + + + + + + + + +
+ Global Heap ID +
bytebytebytebyte

Collection AddressO

Object Index
+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription

Collection Address

+

This field is the address of the global heap collection + where the data object is stored. +

+

ID

+

This field is the index of the data object within the + global heap collection. +

+
+
+ + +
+

+III.F. Disk Format: Level 1F - Fractal Heap

+ +

+ Each fractal heap consists of a header and zero or more direct and + indirect blocks (described below). The header contains general + information as well as + initialization parameters for the doubling table. The Root + Block Address in the header points to the first direct or + indirect block in the heap. +

+ +

+ Fractal heaps are based on a data structure called a doubling + table. A doubling table provides a mechanism for quickly + extending an array-like data structure that minimizes the number of + empty blocks in the heap, while retaining very fast lookup of any + element within the array. More information on fractal heaps and + doubling tables can be found in the RFC + “Private + Heaps in HDF5.” +

+ +

+ The fractal heap implements the doubling table structure with + indirect and direct blocks. + Indirect blocks in the heap do not actually contain data for + objects in the heap, their “size” is abstract - + they represent the indexing structure for locating the + direct blocks in the doubling table. + Direct blocks + contain the actual data for objects stored in the heap. +

+ +

+ All indirect blocks have a constant number of block entries in each + row, called the width of the doubling table (stored in + the heap header). + + The number + of rows for each indirect block in the heap is determined by the + size of the block that the indirect block represents in the + doubling table (calculation of this is shown below) and is + constant, except for the “root” + indirect block, which expands and shrinks its number of rows as + needed. +

+ +

+ Blocks in the first two rows of an indirect block + are Starting Block Size number of bytes in size, + and the blocks in each subsequent row are twice the size of + the blocks in the previous row. In other words, blocks in + the third row are twice the Starting Block Size, + blocks in the fourth row are four times the + Starting Block Size, and so on. Entries for + blocks up to the Maximum Direct Block Size point to + direct blocks, and entries for blocks greater than that size + point to further indirect blocks (which have their own + entries for direct and indirect blocks). +

+ +

+ The number of rows of blocks, nrows, in an + indirect block of size iblock_size is given by the + following expression: +

+ nrows = (log2(iblock_size) - + log2(<Starting Block Size> * + <Width>)) + 1 +

+ +

+ The maximum number of rows of direct blocks, max_dblock_rows, + in any indirect block of a fractal heap is given by the + following expression: +

+ max_dblock_rows = + (log2(<Max. Direct Block Size>) - + log2(<Starting Block Size>)) + 2 +

+ +

+ Using the computed values for nrows and + max_dblock_rows, along with the Width of the + doubling table, the number of direct and indirect block entries + (K and N in the indirect block description, below) + in an indirect block can be computed: +

+ K = MIN(nrows, max_dblock_rows) * + Width + +

+ If nrows is less than or equal to max_dblock_rows, + N is 0. Otherwise, N is simply computed: +

+ N = K - (max_dblock_rows * + Width) +

+ +

+ The size indirect blocks on disk is determined by the number + of rows in the indirect block (computed above). The size of direct + blocks on disk is exactly the size of the block in the doubling + table. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fractal Heap Header +
bytebytebytebyte
Signature
VersionThis space inserted only to align table nicely
Heap ID LengthI/O Filters’ Encoded Length
FlagsThis space inserted only to align table nicely
Maximum Size of Managed Objects

Next Huge Object IDL


v2 B-tree Address of Huge ObjectsO


Amount of Free Space in Managed BlocksL


Address of Managed Block Free Space ManagerO


Amount of Managed Space in HeapL


Amount of Allocated Managed Space in HeapL


Offset of Direct Block Allocation Iterator in Managed SpaceL


Number of Managed Objects in HeapL


Size of Huge Objects in HeapL


Number of Huge Objects in HeapL


Size of Tiny Objects in HeapL


Number of Tiny Objects in HeapL

Table WidthThis space inserted only to align table nicely

Starting Block SizeL


Maximum Direct Block SizeL

Maximum Heap SizeStarting # of Rows in Root Indirect Block

Address of Root BlockO

Current # of Rows in Root Indirect BlockThis space inserted only to align table nicely

Size of Filtered Root Direct Block (optional)L

I/O Filter Mask (optional)
I/O Filter Information (optional, variable size)
Checksum
+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “FRHP” + is used to indicate the + beginning of a fractal heap header. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

This document describes version 0.

+

Heap ID Length

+

This is the length in bytes of heap object IDs for this heap.

+

I/O Filters’ Encoded Length

+

This is the size in bytes of the encoded I/O Filter Information. +

+

Flags

+

This field is the heap status flag and is a bit field + indicating additional information about the fractal heap. + + + + + + + + + + + + + + + + + + +
Bit(s)Description
0If set, the ID value to use for huge object has wrapped + around. If the value for the Next Huge Object ID + has wrapped around, each new huge object inserted into the + heap will require a search for an ID value. +
1If set, the direct blocks in the heap are checksummed. +
2-7Reserved

+ +

Maximum Size of Managed Objects

+

This is the maximum size of managed objects allowed in the heap. + Objects greater than this this are ‘huge’ objects and will be + stored in the file directly, rather than in a direct block for + the heap. +

+

Next Huge Object ID

+

This is the next ID value to use for a huge object in the heap. +

+

v2 B-tree Address of Huge Objects

+

This is the address of the v2 B-tree + used to track huge objects in the heap. The type of records + stored in the v2 B-tree will + be determined by whether the address & length of a huge object + can fit into a heap ID (if yes, it is a “directly” accessed + huge object) and whether there is a filter used on objects + in the heap. +

+

Amount of Free Space in Managed Blocks

+

This is the total amount of free space in managed direct blocks + (in bytes). +

+

Address of Managed Block Free Space Manager

+

This is the address of the + Free-space Manager for + managed blocks. +

+

Amount of Managed Space in Heap

+

This is the total amount of managed space in the heap (in bytes), + essentially the upper bound of the heap’s linear address space. +

+

Amount of Allocated Managed Space in Heap

+

This is the total amount of managed space (in bytes) actually + allocated in + the heap. This can be less than the Amount of Managed Space + in Heap field, if some direct blocks in the heap’s linear + address space are not allocated. +

+

Offset of Direct Block Allocation Iterator in Managed Space

+

This is the linear heap offset where the next direct + block should be allocated at (in bytes). This may be less than + the Amount of Managed Space in Heap value because the + heap’s address space is increased by a “row” of direct blocks + at a time, rather than by single direct block increments. +

+

Number of Managed Objects in Heap

+

This is the number of managed objects in the heap. +

+

Size of Huge Objects in Heap

+

This is the total size of huge objects in the heap (in bytes). +

+

Number of Huge Objects in Heap

+

This is the number of huge objects in the heap. +

+

Size of Tiny Objects in Heap

+

This is the total size of tiny objects that are packed in heap + IDs (in bytes). +

+

Number of Tiny Objects in Heap

+

This is the number of tiny objects that are packed in heap IDs. +

+

Table Width

+

This is the number of columns in the doubling table for managed + blocks. This value must be a power of two. +

+

Starting Block Size

+

This is the starting block size to use in the doubling table for + managed blocks (in bytes). This value must be a power of two. +

+

Maximum Direct Block Size

+

This is the maximum size allowed for a managed direct block. + Objects inserted into the heap that are larger than this value + (less the # of bytes of direct block prefix/suffix) + are stored as ‘huge’ objects. This value must be a power of + two. +

+

Maximum Heap Size

+

This is the maximum size of the heap’s linear address space for + managed objects (in bytes). The value stored is the log2 of + the actual value, that is: the # of bits of the address space. + ‘Huge’ and ‘tiny’ objects are not counted in this value, since + they do not store objects in the linear address space of the + heap. +

+

Starting # of Rows in Root Indirect Block

+

This is the starting number of rows for the root indirect block. + A value of 0 indicates that the root indirect block will have + the maximum number of rows needed to address the heap’s Maximum + Heap Size. +

+

Address of Root Block

+

This is the address of the root block for the heap. It can + be the undefined address if + there is no data in the heap. It either points to a direct + block (if the Current # of Rows in the Root Indirect Block + value is 0), or an indirect block. +

+

Current # of Rows in Root Indirect Block

+

This is the current number of rows in the root indirect block. + A value of 0 indicates that Address of Root Block + points to direct block instead of indirect block. +

+

Size of Filtered Root Direct Block

+

This is the size of the root direct block, if filters are + applied to heap objects (in bytes). This field is only + stored in the header if the I/O Filters’ Encoded Length + is greater than 0. +

+

I/O Filter Mask

+

This is the filter mask for the root direct block, if filters + are applied to heap objects. This mask has the same format as + that used for the filter mask in chunked raw data records in a + v1 B-tree. + This field is only + stored in the header if the I/O Filters’ Encoded Length + is greater than 0. +

+

I/O Filter Information

+

This is the I/O filter information encoding direct blocks and + huge objects, if filters are applied to heap objects. This + field is encoded as a Filter Pipeline + message. + The size of this field is determined by I/O Filters’ + Encoded Length. +

+

Checksum

+

This is the checksum for the header.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fractal Heap Direct Block +
bytebytebytebyte
Signature
VersionThis space inserted only to align table nicely

Heap Header AddressO

Block Offset (variable size)
Checksum (optional)

Object Data (variable size)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “FHDB” + is used to indicate the + beginning of a fractal heap direct block. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

This document describes version 0.

+

Heap Header Address

+

This is the address for the fractal heap header that this + block belongs to. This field is principally used for file + integrity checking. +

+

Block Offset

+

This is the offset of the block within the fractal heap’s + address space (in bytes). The number of bytes used to encode + this field is the Maximum Heap Size (in the heap’s + header) divided by 8 and rounded up to the next highest integer, + for values that are not a multiple of 8. This value is + principally used for file integrity checking. +

+

Checksum

+

This is the checksum for the direct block.

+

This field is only present if bit 1 of Flags in the + heap’s header is set.

+

Object Data

+

This section of the direct block stores the actual data for + objects in the heap. The size of this section is determined by + the direct block’s size minus the size of the other fields + stored in the direct block (for example, the Signature, + Version, and others including the Checksum if it is + present). +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fractal Heap Indirect Block +
bytebytebytebyte
Signature
VersionThis space inserted only to align table nicely

Heap Header AddressO

Block Offset (variable size)

Child Direct Block #0 AddressO


Size of Filtered Direct Block #0 (optional) L

Filter Mask for Direct Block #0 (optional)

Child Direct Block #1 AddressO


Size of Filtered Direct Block #1 (optional)L

Filter Mask for Direct Block #1 (optional)
...

Child Direct Block #K-1 AddressO


Size of Filtered Direct Block #K-1 (optional)L

Filter Mask for Direct Block #K-1 (optional)

Child Indirect Block #0 AddressO


Child Indirect Block #1 AddressO

...

Child Indirect Block #N-1 AddressO

Checksum
+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “FHIB” is used to + indicate the beginning of a fractal heap indirect block. This + gives file consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Version

+

This document describes version 0.

+

Heap Header Address

+

This is the address for the fractal heap header that this + block belongs to. This field is principally used for file + integrity checking. +

+

Block Offset

+

This is the offset of the block within the fractal heap’s + address space (in bytes). The number of bytes used to encode + this field is the Maximum Heap Size (in the heap’s + header) divided by 8 and rounded up to the next highest integer, + for values that are not a multiple of 8. This value is + principally used for file integrity checking. +

+

Child Direct Block #K Address

+

This field is the address of the child direct block. + The size of the [uncompressed] direct block can be computed by + its offset in the heap’s linear address space. +

+

Size of Filtered Direct Block #K

+

This is the size of the child direct block after passing through + the I/O filters defined for this heap (in bytes). If no I/O + filters are present for this heap, this field is not present. +

+

Filter Mask for Direct Block #K

+

This is the I/O filter mask for the filtered direct block. + This mask has the same format as that used for the filter mask + in chunked raw data records in a v1 B-tree. + If no I/O filters are present for this heap, this field is not + present. +

+

Child Indirect Block #N Address

+

This field is the address of the child indirect block. + The size of the indirect block can be computed by + its offset in the heap’s linear address space. +

+

Checksum

+

This is the checksum for the indirect block.

+
+ +
+ +
+

An object in the fractal heap is identified by means of a fractal heap ID, + which encodes information to locate the object in the heap. + Currently, the fractal heap stores an object in one of three ways, + depending on the object’s size:

+ +
+ + + + + + + + + + + + + + + + + + + + +
TypeDescription
Tiny +

When an object is small enough to be encoded in the heap ID, the + object’s data is embedded in the fractal heap ID itself. There are + 2 sub-types for this type of object: normal and extended. The + sub-type for tiny heap IDs depends on whether the heap ID is large + enough to store objects greater than 16 bytes or not. If the + heap ID length is 18 bytes or smaller, the ‘normal’ tiny heap ID + form is used. If the heap ID length is greater than 18 bytes in + length, the “extented” form is used. See format description below + for both sub-types. +

+
Huge +

When the size of an object is larger than Maximum Size of + Managed Objects in the Fractal Heap Header, the + object’s data is stored on its own in the file and the object + is tracked/indexed via a version 2 B-tree. All huge objects + for a particular fractal heap use the same v2 B-tree. All huge + objects for a particular fractal heap use the same format for + their huge object IDs. +

+ +

Depending on whether the IDs for a heap are large enough to hold + the object’s retrieval information and whether I/O pipeline filters + are applied to the heap’s objects, 4 sub-types are derived for + huge object IDs for this heap:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Sub-typeDescription
Directly accessed, non-filtered +

The object’s address and length are embedded in the + fractal heap ID itself and the object is directly accessed + from them. This allows the object to be accessed without + resorting to the B-tree. +

+
Directly accessed, filtered +

The filtered object’s address, length, filter mask and + de-filtered size are embedded in the fractal heap ID itself + and the object is accessed directly with them. This allows + the object to be accessed without resorting to the B-tree. +

+
Indirectly accessed, non-filtered +

The object is located by using a B-tree key embedded in + the fractal heap ID to retrieve the address and length from + the version 2 B-tree for huge objects. Then, the address + and length are used to access the object. +

+
Indirectly accessed, filtered +

The object is located by using a B-tree key embedded in + the fractal heap ID to retrieve the filtered object’s + address, length, filter mask and de-filtered size from the + version 2 B-tree for huge objects. Then, this information + is used to access the object. +

+
+
+ +
Managed +

When the size of an object does not meet the above two + conditions, the object is stored and managed via the direct and + indirect blocks based on the doubling table. +

+
+
+ + +

The specific format for each type of heap ID is described below: +

+ +
+ + + + + + + + + + + + + + + + + + + +
Fractal Heap ID for Tiny Objects (sub-type 1 - ‘Normal’) +
bytebytebytebyte
Version, Type & LengthThis space inserted only to align table nicely

Data (variable size)
+
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription

Version, Type & Length

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Tiny objects have a value of 2. +
0-3The length of the tiny object. The value stored + is one less than the actual length (since zero-length + objects are not allowed to be stored in the heap). + For example, an object of actual length 1 has an + encoded length of 0, an object of actual length 2 + has an encoded length of 1, and so on. +

+ +

Data

+

This is the data for the object. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + +
Fractal Heap ID for Tiny Objects (sub-type 2 - ‘Extended’) +
bytebytebytebyte
Version, Type & LengthExtended LengthThis space inserted only to align table nicely
Data (variable size)
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version, Type & Length

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Tiny objects have a value of 2. +
0-3These 4 bits, together with the next byte, form an + unsigned 12-bit integer for holding the length of the + object. These 4-bits are bits 8-11 of the 12-bit integer. + See description for the Extended Length field below. +

+ +

Extended Length

+

This byte, together with the 4 bits in the previous byte, + forms an unsigned 12-bit integer for holding the length of + the tiny object. These 8 bits are bits 0-7 of the 12-bit + integer formed. The value stored is one less than the actual + length (since zero-length objects are not allowed to be + stored in the heap). For example, an object of actual length + 1 has an encoded length of 0, an object of actual length + 2 has an encoded length of 1, and so on. +

+

Data

+

This is the data for the object. +

+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + +
Fractal Heap ID for Huge Objects (sub-type 1 & 2): indirectly accessed, non-filtered/filtered +
bytebytebytebyte
Version & TypeThis space inserted only to align table nicely

v2 B-tree KeyL (variable size)

+ + + + + +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription

Version & Type

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Huge objects have a value of 1. +
0-3Reserved. +

+ +

v2 B-tree Key

This field is the B-tree key for retrieving the information + from the version 2 B-tree for huge objects needed to access the + object. See the description of v2 B-tree + records sub-type 1 & 2 for a description of the fields. New key + values are derived from Next Huge Object ID in the + Fractal Heap Header.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Fractal Heap ID for Huge Objects (sub-type 3): directly accessed, non-filtered +
bytebytebytebyte
Version & TypeThis space inserted only to align table nicely

Address O


Length L

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version & Type

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Huge objects have a value of 1. +
0-3Reserved. +

+ +

Address

This field is the address of the object in the file.

+

Length

This field is the length of the object in the file.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Fractal Heap ID for Huge Objects (sub-type 4): directly accessed, filtered +
bytebytebytebyte
Version & TypeThis space inserted only to align table nicely

Address O


Length L

Filter Mask

De-filtered Size L

+ + + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
 (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version & Type

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Huge objects have a value of 1. +
0-3Reserved. +

+ +

Address

This field is the address of the filtered object in the file.

+

Length

This field is the length of the filtered object in the file.

+

Filter Mask

This field is the I/O pipeline filter mask for the + filtered object in the file.

+

Filtered Size

This field is the size of the de-filtered object in the file.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
Fractal Heap ID for Managed Objects +
bytebytebytebyte
Version & TypeThis space inserted only to align table nicely
Offset (variable size)
Length (variable size)
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version & Type

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Managed objects have a value of 0. +
0-3Reserved. +

+

Offset

This field is the offset of the object in the heap. + This field’s size is the minimum number of bytes + necessary to encode the Maximum Heap Size value + (from the Fractal Heap Header). For example, if the + value of the Maximum Heap Size is less than 256 bytes, + this field is 1 byte in length, a Maximum Heap Size + of 256-65535 bytes uses a 2 byte length, and so on.

Length

This field is the length of the object in the heap. It + is determined by taking the minimum value of Maximum + Direct Block Size and Maximum Size of Managed + Objects in the Fractal Heap Header. Again, + the minimum number of bytes needed to encode that value is + used for the size of this field.

+
+ +
+

+III.G. Disk Format: Level 1G - Free-space Manager

+ +

+ Free-space managers are used to describe space within a heap or + the entire HDF5 file that is not currently used for that heap or + file. +

+ +

+ The free-space manager header contains metadata information + about the space being tracked, along with the address of the list + of free space sections which actually describes the free + space. The header records information about free-space sections being + tracked, creation parameters for handling free-space sections of a + client, and section information used to locate the collection of + free-space sections. +

+ +

+ The free-space section list stores a collection of + free-space sections that is specific to each client of the + free-space manager. + + For example, the fractal heap is a client of the free space manager + and uses it to track unused space within the heap. There are 4 + types of section records for the fractal heap, each of which has + its own format, listed below. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Free-space Manager Header +
bytebytebytebyte
Signature
VersionClient IDThis space inserted only to align table nicely

Total Space TrackedL


Total Number of SectionsL


Number of Serialized SectionsL


Number of Un-Serialized SectionsL

Number of Section ClassesThis space inserted only to align table nicely
Shrink PercentExpand Percent
Size of Address SpaceThis space inserted only to align table nicely

Maximum Section Size L


Address of Serialized Section ListO


Size of Serialized Section List UsedL


Allocated Size of Serialized Section ListL

Checksum
+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “FSHD” is used to + indicate the beginning of the Free-space Manager Header. + This gives file consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Version

+

This is the version number for the Free-space Manager Header + and this document describes version 0.

+

Client ID

+

This is the client ID for identifying the user of this + free-space manager: + + + + + + + + + + + + + + + + + + + +
IDDescription
0Fractal heap +
1File +
2+Reserved. +

+ +

Total Space Tracked

+

This is the total amount of free space being tracked, in bytes. +

+

Total Number of Sections

+

This is the total number of free-space sections being tracked. +

+

Number of Serialized Sections

+

This is the number of serialized free-space sections being + tracked. +

+

Number of Un-Serialized Sections

+

This is the number of un-serialized free-space sections being + managed. Un-serialized sections are created by the free-space + client when the list of sections is read in. +

+

Number of Section Classes

+

This is the number of section classes handled by this free space + manager for the free-space client. +

+

Shrink Percent

+

This is the percent of current size to shrink the allocated + serialized free-space section list. +

+

Expand Percent

+

This is the percent of current size to expand the allocated + serialized free-space section list. +

+

Size of Address Space

+

This is the size of the address space that free-space sections + are within. This is stored as the log2 of the + actual value (in other words, the number of bits required + to store values within that address space). +

+

Maximum Section Size

+

This is the maximum size of a section to be tracked. +

+

Address of Serialized Section List

+

This is the address where the serialized free-space section + list is stored. +

+

Size of Serialized Section List Used

+

This is the size of the serialized free-space section + list used (in bytes). This value must be less than + or equal to the allocated size of serialized section + list, below. +

+

Allocated Size of Serialized Section List

+

This is the size of serialized free-space section list + actually allocated (in bytes). +

+

Checksum

+

This is the checksum for the free-space manager header.

+
+
+ +
+

The free-space sections being managed are stored in a + free-space section list, described below. The sections + in the free-space section list are stored in the following way: + a count of the number of sections describing a particular size of + free space and the size of the free-space described (in bytes), + followed by a list of section description records; then another + section count and size, followed by the list of section + descriptions for that size; and so on.

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Free-space Section List +
bytebytebytebyte
Signature
VersionThis space inserted only to align table nicely

Free-space Manager Header AddressO

Number of Section Records in Set #0 (variable size)
Size of Free-space Section Described in Record Set #0 (variable size)
Record Set #0 Section Record #0 Offset(variable size)
Record Set #0 Section Record #0 TypeThis space inserted only to align table nicely
Record Set #0 Section Record #0 Data (variable size)
...
Record Set #0 Section Record #K-1 Offset(variable size)
Record Set #0 Section Record #K-1 TypeThis space inserted only to align table nicely
Record Set #0 Section Record #K-1 Data (variable size)
Number of Section Records in Set #1 (variable size)
Size of Free-space Section Described in Record Set #1 (variable size)
Record Set #1 Section Record #0 Offset(variable size)
Record Set #1 Section Record #0 TypeThis space inserted only to align table nicely
Record Set #1 Section Record #0 Data (variable size)
...
Record Set #1 Section Record #K-1 Offset(variable size)
Record Set #1 Section Record #K-1 TypeThis space inserted only to align table nicely
Record Set #1 Section Record #K-1 Data (variable size)
...
...
Number of Section Records in Set #N-1 (variable size)
Size of Free-space Section Described in Record Set #N-1 (variable size)
Record Set #N-1 Section Record #0 Offset(variable size)
Record Set #N-1 Section Record #0 TypeThis space inserted only to align table nicely
Record Set #N-1 Section Record #0 Data (variable size)
...
Record Set #N-1 Section Record #K-1 Offset(variable size)
Record Set #N-1 Section Record #K-1 TypeThis space inserted only to align table nicely
Record Set #N-1 Section Record #K-1 Data (variable size)
Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “FSSE” is used to + indicate the beginning of the Free-space Section Information. + This gives file consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Version

+

This is the version number for the Free-space Section List + and this document describes version 0.

+

Free-space Manager Header Address

+

This is the address of the Free-space Manager Header. + This field is principally used for file + integrity checking. +

+

Number of Section Records for Set #N

+

This is the number of free-space section records for set #N. + The length of this field is the minimum number of bytes needed + to store the number of serialized sections (from the + free-space manager header). +

+ +

+ The number of sets of free-space section records is + determined by the size of serialized section list in + the free-space manager header. +

+

Section Size for Record Set #N

+

This is the size (in bytes) of the free-space section described + for all the section records in set #N. +

+ +

+ The length of this field is the minimum number of bytes needed + to store the maximum section size (from the + free-space manager header). +

+

Record Set #N Section #K Offset

+

This is the offset (in bytes) of the free-space section within + the client for the free-space manager. +

+ +

+ The length of this field is the minimum number of bytes needed + to store the size of address space (from the + free-space manager header). +

+

Record Set #N Section #K Type

+

This is the type of the section record, used to decode the + record set #N section #K data information. The defined + record type for file client is: + + + + + + + + + + + + + + + +
TypeDescription
0File’s section (a range of actual bytes in file) +
1+Reserved. +

+ +

The defined record types for a fractal heap client are: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
0Fractal heap “single” section +
1Fractal heap “first row” section +
2Fractal heap “normal row” section +
3Fractal heap “indirect” section +
4+Reserved. +

+ +

Record Set #N Section #K Data

+

This is the section-type specific information for each record + in the record set, described below. +

+

Checksum

+

This is the checksum for the Free-space Section List. +

+
+
+ +
+

+ The section-type specific data for each free-space section record is + described below: +

+ +
+ + + + + + +
+ File’s Section Data Record +
No additional record data stored
+
+ +
+
+
+ + + + + + +
+ Fractal Heap “Single” Section Data Record +
No additional record data stored
+
+ +
+
+
+ + + + + + +
+ Fractal Heap “First Row” Section Data Record +
Same format as “indirect” section data
+
+ +
+
+
+ + + + + + +
+ Fractal Heap “Normal Row” Section Data Record +
No additional record data stored
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Fractal Heap “Indirect” Section Data Record +
bytebytebytebyte
Fractal Heap Indirect Block Offset (variable size)
Block Start RowBlock Start Column
Number of BlocksThis space inserted only to align table nicely
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Fractal Heap Block Offset

+

The offset of the indirect block in the fractal heap’s address + space containing the empty blocks. +

+

+ The number of bytes used to encode this field is the minimum + number of bytes needed to encode values for the Maximum + Heap Size (in the fractal heap’s header). +

+

Block Start Row

+

This is the row that the empty blocks start in. +

+

Block Start Column

+

This is the column that the empty blocks start in. +

+

Number of Blocks

+

This is the number of empty blocks covered by the section. +

+
+
+ +
+

+III.H. Disk Format: Level 1H - Shared Object Header Message Table

+ +

+ The shared object header message table is used to locate + object + header messages that are shared between two or more object headers + in the file. Shared object header messages are stored and indexed + in the file in one of two ways: indexed sequentially in a + shared header message list or indexed with a v2 B-tree. + The shared messages themselves are either stored in a fractal + heap (when two or more objects share the message), or remain in an + object’s header (when only one object uses the message currently, + but the message can be shared in the future). +

+ +

+ The shared object header message table + contains a list of shared message index headers. Each index header + records information about the version of the index format, the index + storage type, flags for the message types indexed, the number of + messages in the index, the address where the index resides, + and the fractal heap address if shared messages are stored there. +

+ +

+ Each index can be either a list or a v2 B-tree and may transition + between those two forms as the number of messages in the index + varies. Each shared message record contains information used to + locate the shared message from either a fractal heap or an object + header. The types of messages that can be shared are: Dataspace, + Datatype, Fill Value, Filter Pipeline and Attribute. +

+ +

+ The shared object header message table is pointed to + from a shared message table message + in the superblock extension for a file. This message stores the + version of the table format, along with the number of index headers + in the table. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Shared Object Header Message Table +
bytebytebytebyte
Signature
Version for index #0Index Type for index #0Message Type Flags for index #0
Minimum Message Size for index #0
List Cutoff for index #0v2 B-tree Cutoff for index #0
Number of Messages for index #0This space inserted only to align table nicely

Index AddressO for index #0


Fractal Heap AddressO for index #0

...
...
Version for index #N-1Index Type for index #N-1Message Type Flags for index #N-1
Minimum Message Size for index #N-1
List Cutoff for index #N-1v2 B-tree Cutoff for index #N-1
Number of Messages for index #N-1This space inserted only to align table nicely

Index AddressO for index #N-1


Fractal Heap AddressO for index #N-1

Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “SMTB” is used to + indicate the beginning of the Shared Object Header Message table. + This gives file consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Version for index #N

+

This is the version number for the list of shared object header message + indexes and this document describes version 0.

+

Index Type for index #N

+

The type of index can be an unsorted list or a v2 B-tree. +

+

Message Type Flags for index #N

+

This field indicates the type of messages tracked in the index, + as follows: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitsDescription
0If set, the index tracks Dataspace Messages. +
1If set, the message tracks Datatype Messages. +
2If set, the message tracks Fill Value Messages. +
3If set, the message tracks Filter Pipeline Messages. +
4If set, the message tracks Attribute Messages. +
5-15Reserved (zero). +

+ + +

+ An index can track more than one type of message, but each type + of message can only by in one index. +

+

Minimum Message Size for index #N

+

This is the message size sharing threshold for the index. + If the encoded size of the message is less than this value, the + message is not shared. +

+

List Cutoff for index #N

+

This is the cutoff value for the indexing of messages to + switch from a list to a v2 B-tree. If the number of messages + is greater than this value, the index should be a v2 B-tree. +

+

v2 B-tree Cutoff for index #N

+

This is is the cutoff value for the indexing of messages to + switch from a v2 B-tree back to a list. If the number of + messages is less than this value, the index should be a list. +

+

Number of Messages for index #N

+

The number of shared messages being tracked for the index. +

+

Index Address for index #N

+

This field is the address of the list or v2 B-tree where the + index nodes reside. +

+

Fractal Heap Address for index #N

+

This field is the address of the fractal heap if shared messages + are stored there. +

+

Checksum

+

This is the checksum for the table.

+
+
+ +
+

+ Shared messages are indexed either with a shared message record + list, described below, or using a v2 B-tree (using record type 7). + The number of records in the shared message record list is + determined in the index’s entry in the shared object header message + table. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Shared Message Record List +
bytebytebytebyte
Signature
Shared Message Record #0
Shared Message Record #1
...
Shared Message Record #N-1
Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “SMLI” is used to + indicate the beginning of a list of index nodes. + This gives file consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Shared Message Record #N

+

The record for locating the shared message, either in the + fractal heap for the index, or an object header (see format for + index nodes below). +

+

Checksum

+

This is the checksum for the list. +

+
+
+ +
+

+ The record for each shared message in an index is stored in one of the + following forms: +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Shared Message Record, for messages stored in a fractal heap +
bytebytebytebyte
Message LocationThis space inserted only to align table nicely
Hash Value
Reference Count

Fractal Heap ID

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Message Location

+

This has a value of 0 indicating that the message is stored in + the heap. +

+

Hash Value

+

This is the hash value for the message. +

+

Reference Count

+

This is the number of times the message is used in the file. +

+

Fractal Heap ID

+

This is an 8-byte fractal heap ID for the message as stored in + the fractal heap for the index. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Shared Message Record, for messages stored in an object header +
bytebytebytebyte
Message LocationThis space inserted only to align table nicely
Hash Value
ReservedMessage TypeCreation Index

Object Header AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Message Location

+

This has a value of 1 indicating that the message is stored in + an object header. +

+

Hash Value

+

This is the hash value for the message. +

+

Message Type

+

This is the message type in the object header. +

+

Creation Index

+

This is the creation index of the message within the object + header. +

+

Object Header Address

+

This is the address of the object header where the message is + located. +

+
+
+ + + +
+
+
+

+IV. Disk Format: Level 2 - Data Objects

+ +

Data objects contain the “real” user-visible information in the file. + These objects compose the scientific data and other information which + are generally thought of as “data” by the end-user. All the + other information in the file is provided as a framework for + storing and accessing these data objects. +

+ +

A data object is composed of header and data + information. The header information contains the information + needed to interpret the data information for the object as + well as additional “metadata” or pointers to additional + “metadata” used to describe or annotate each object. +

+ +
+

+IV.A. Disk Format: Level 2A - Data Object Headers

+ +

The header information of an object is designed to encompass + all of the information about an object, except for the data itself. + This information includes the dataspace, the datatype, information + about how the data is stored on disk (in external files, compressed, + broken up in blocks, and so on), as well as other information used + by the library to speed up access to the data objects or maintain + a file’s integrity. Information stored by user applications + as attributes is also stored in the object’s header. The header + of each object is not necessarily located immediately prior to the + object’s data in the file and in fact may be located in any + position in the file. The order of the messages in an object header + is not significant.

+ +

Object headers are composed of a prefix and a set of messages. The + prefix contains the information needed to interpret the messages and + a small amount of metadata about the object, and the messages contain + the majority of the metadata about the object. +

+ +
+

+IV.A.1. Disk Format: Level 2A1 - Data Object Header Prefix

+ +
+

+IV.A.1.a. Version 1 Data Object Header Prefix

+ +

Header messages are aligned on 8-byte boundaries for version 1 + object headers. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Version 1 Object Header +
bytebytebytebyte
VersionReserved (zero)Total Number of Header Messages
Object Reference Count
Object Header Size
Header Message Type #1Size of Header Message Data #1
Header Message #1 FlagsReserved (zero)

Header Message Data #1

.
.
.
Header Message Type #nSize of Header Message Data #n
Header Message #n FlagsReserved (zero)

Header Message Data #n

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

This value is used to determine the format of the + information in the object header. When the format of the + object header is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted. This + is version one (1) (there was no version zero (0)) of the + object header. +

+

Total Number of Header Messages

+

This value determines the total number of messages listed in + object headers for this object. This value includes the messages + in continuation messages for this object. +

+

Object Reference Count

+

This value specifies the number of “hard links” to this object + within the current file. References to the object from external + files, “soft links” in this file and object references in this + file are not tracked. +

+

Object Header Size

+

This value specifies the number of bytes of header message data + following this length field that contain object header messages + for this object header. This value does not include the size of + object header continuation blocks for this object elsewhere in the + file. +

+

Header Message #n Type

+

This value specifies the type of information included in the + following header message data. The message types for + header messages are defined in sections below. +

+

Size of Header Message #n Data

+

This value specifies the number of bytes of header + message data following the header message type and length + information for the current message. The size includes + padding bytes to make the message a multiple of eight + bytes. +

+

Header Message #n Flags

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, the message data is constant. This is used + for messages like the datatype message of a dataset. +
1If set, the message is shared and stored + in another location than the object header. The Header + Message Data field contains a Shared Message + (described in the Data Object Header Messages + section below) + and the Size of Header Message Data field + contains the size of that Shared Message. +
2If set, the message should not be shared. +
3If set, the HDF5 decoder should fail to open this object + if it does not understand the message’s type and the file + is open with permissions allowing write access to the file. + (Normally, unknown messages can just be ignored by HDF5 + decoders) +
4If set, the HDF5 decoder should set bit 5 of this + message’s flags (in other words, this bit field) + if it does not understand the message’s type + and the object is modified in any way. (Normally, + unknown messages can just be ignored by HDF5 + decoders) +
5If set, this object was modified by software that did not + understand this message. + (Normally, unknown messages should just be ignored by HDF5 + decoders) (Can be used to invalidate an index or a similar + feature) +
6If set, this message is shareable. +
7If set, the HDF5 decoder should always fail to open this + object if it does not understand the message’s type (whether + it is open for read-only or read-write access). (Normally, + unknown messages can just be ignored by HDF5 decoders) +

+ +

Header Message #n Data

+

The format and length of this field is determined by the + header message type and size respectively. Some header + message types do not require any data and this information + can be eliminated by setting the length of the message to + zero. The data is padded with enough zeroes to make the + size a multiple of eight. +

+
+
+ +
+

+IV.A.1.b. Version 2 Data Object Header Prefix

+ +

Note that the “total number of messages” field has been dropped from + the data object header prefix in this version. The number of messages + in the data object header is just determined by the messages encountered + in all the object header blocks.

+ +

Note also that the fields and messages in this version of data object + headers have no alignment or padding bytes inserted - they are + stored packed together.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 Object Header +
bytebytebytebyte
Signature
VersionFlagsThis space inserted only to align table nicely
Access time (optional)
Modification Time (optional)
Change Time (optional)
Birth Time (optional)
Maximum # of compact attributes (optional)Minimum # of dense attributes (optional)
Size of Chunk #0 (variable size)This space inserted only to align table nicely
Header Message Type #1Size of Header Message Data #1Header Message #1 Flags
Header Message #1 Creation Order (optional)This space inserted only to align table nicely

Header Message Data #1

.
.
.
Header Message Type #nSize of Header Message Data #nHeader Message #n Flags
Header Message #n Creation Order (optional)This space inserted only to align table nicely

Header Message Data #n

Gap (optional, variable size)
Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “OHDR” + is used to indicate the + beginning of an object header. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

This field has a value of 2 indicating version 2 of the object header. +

+

Flags

+

This field is a bit field indicating additional information + about the object header. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bit(s)Description
0-1This two bit field determines the size of the + Size of Chunk #0 field. The values are: + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0The Size of Chunk #0 field is 1 byte. +
1The Size of Chunk #0 field is 2 bytes. +
2The Size of Chunk #0 field is 4 bytes. +
3The Size of Chunk #0 field is 8 bytes. +

+
2If set, attribute creation order is tracked.
3If set, attribute creation order is indexed.
4If set, non-default attribute storage phase change + values are stored.
5If set, access, modification, change and birth times + are stored.
6-7Reserved

+ +

Access Time

+

This 32-bit value represents the number of seconds after the + UNIX epoch when the object’s raw data was last accessed + (in other words, read or written). +

+

This field is present if bit 5 of flags is set. +

+

Modification Time

+

This 32-bit value represents the number of seconds after + the UNIX epoch when the object’s raw data was last + modified (in other words, written). +

+

This field is present if bit 5 of flags is set. +

+

Change Time

+

This 32-bit value represents the number of seconds after the + UNIX epoch when the object’s metadata was last changed. +

+

This field is present if bit 5 of flags is set. +

+

Birth Time

+

This 32-bit value represents the number of seconds after the + UNIX epoch when the object was created. +

+

This field is present if bit 5 of flags is set. +

+

Maximum # of compact attributes

+

This is the maximum number of attributes to store in the compact + format before switching to the indexed format. +

+

This field is present if bit 4 of flags is set. +

+

Minimum # of dense attributes

+

This is the minimum number of attributes to store in the indexed + format before switching to the compact format. +

+

This field is present if bit 4 of flags is set. +

+

Size of Chunk #0

+

+ This unsigned value specifies the number of bytes of header + message data following this field that contain object header + information. +

+

+ This value does not include the size of object header + continuation blocks for this object elsewhere in the file. +

+

+ The length of this field varies depending on bits 0 and 1 of + the flags field. +

+

Header Message #n Type

+

Same format as version 1 of the object header, described above. +

+

Size of Header Message #n Data

+

This value specifies the number of bytes of header + message data following the header message type and length + information for the current message. The size of messages + in this version does not include any padding bytes. +

+

Header Message #n Flags

+

Same format as version 1 of the object header, described above. +

+

Header Message #n Creation Order

+

This field stores the order that a message of a given type + was created in. +

+

This field is present if bit 2 of flags is set. +

+

Header Message #n Data

+

Same format as version 1 of the object header, described above. +

+

Gap

+

A gap in an object header chunk is inferred by the end of the + messages for the chunk before the beginning of the chunk’s + checksum. Gaps are always smaller than the size of an + object header message prefix (message type + message size + + message flags). +

+

Gaps are formed when a message (typically an attribute message) + in an earlier chunk is deleted and a message from a later + chunk that does not quite fit into the free space is moved + into the earlier chunk. +

+

Checksum

+

This is the checksum for the object header chunk. +

+
+
+ +

The header message types and the message data associated with + them compose the critical “metadata” about each object. Some + header messages are required for each object while others are + optional. Some optional header messages may also be repeated + several times in the header itself, the requirements and number + of times allowed in the header will be noted in each header + message description below. +

+ + +
+

+IV.A.2. Disk Format: Level 2A2 - Data Object Header Messages

+ +

Data object header messages are small pieces of metadata that are + stored in the data object header for each object in an HDF5 file. + Data object header messages provide the metadata required to describe + an object and its contents, as well as optional pieces of metadata + that annotate the meaning or purpose of the object. +

+ +

Data object header messages are either stored directly in the data + object header for the object or are shared between multiple objects + in the file. When a message is shared, a flag in the Message Flags + indicates that the actual Message Data + portion of that message is stored in another location (such as another + data object header, or a heap in the file) and the Message Data + field contains the information needed to locate the actual information + for the message. +

+ +

+ The format of shared message data is described here:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Shared Message (Version 1) +
bytebytebytebyte
VersionTypeReserved (zero)
Reserved (zero)

AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number is used when there are changes in the format + of a shared object message and is described here: + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by the library before version 1.6.1. +

+

Type

The type of shared message location: + + + + + + + + + + +
ValueDescription
0Message stored in another object’s header (a committed + message). +

+

Address

The address of the object header + containing the message to be shared.

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Shared Message (Version 2) +
bytebytebytebyte
VersionTypeThis space inserted only to align table nicely

AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number is used when there are changes in the format + of a shared object message and is described here: + + + + + + + + + + +
VersionDescription
2Used by the library of version 1.6.1 and after. +

+

Type

The type of shared message location: + + + + + + + + + + +
ValueDescription
0Message stored in another object’s header (a committed + message). +

+

Address

The address of the object header + containing the message to be shared.

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Shared Message (Version 3) +
bytebytebytebyte
VersionTypeThis space inserted only to align table nicely
Location (variable size)
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number indicates changes in the format of shared + object message and is described here: + + + + + + + + + + +
VersionDescription
3Used by the library of version 1.8 and after. In this + version, the Type field can indicate that + the message is stored in the fractal heap. +

+

Type

The type of shared message location: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Message is not shared and is not shareable. +
1Message stored in file’s shared object header message + heap (a shared message). +
2Message stored in another object’s header (a committed + message). +
3Message stored is not shared, but is sharable. +

+

Location

This field contains either a Size of Offsets-bytes + address of the object header + containing the message to be shared, or an 8-byte fractal heap ID + for the message in the file’s shared object header message + heap. +

+
+
+ + +

The following is a list of currently defined header messages: +

+ +
+

IV.A.2.a. The NIL Message

+ + +
+ + + + + + + + +
Header Message Name: NIL
Header Message Type: 0x0000
Length: Varies
Status: Optional; may be repeated.
Description:The NIL message is used to indicate a message which is to be + ignored when reading the header messages for a data object. + [Possibly one which has been deleted for some reason.] +
Format of Data: Unspecified
+ + + +
+

IV.A.2.b. The Dataspace Message

+ + +
+ + + + + + + + + + +
Header Message Name: Dataspace
Header Message Type: 0x0001
Length: Varies according to the number of + dimensions, as described in the following table.
Status: Required for dataset objects; + may not be repeated.
Description:The dataspace message describes the number of dimensions (in + other words, “rank”) and size of each dimension that + the data object has. This message is only used for datasets which + have a simple, rectilinear, array-like layout; datasets requiring + a more complex layout are not yet supported. +
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Dataspace Message - Version 1 +
bytebytebytebyte
VersionDimensionalityFlagsReserved
Reserved

Dimension #1 SizeL

.
.
.

Dimension #n SizeL


Dimension #1 Maximum SizeL (optional)

.
.
.

Dimension #n Maximum SizeL (optional)


Permutation Index #1L (optional)

.
.
.

Permutation Index #nL (optional)

+ + + + + +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

This value is used to determine the format of the + Dataspace Message. When the format of the + information in the message is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted. This + document describes version one (1) (there was no version + zero (0)). +

+

Dimensionality

+

This value is the number of dimensions that the data + object has. +

+

Flags

+

This field is used to store flags to indicate the + presence of parts of this message. Bit 0 (the least + significant bit) is used to indicate that maximum + dimensions are present. Bit 1 is used to indicate that + permutation indices are present. +

+

Dimension #n Size

+

This value is the current size of the dimension of the + data as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+

Dimension #n Maximum Size

+

This value is the maximum size of the dimension of the + data as stored in the file. This value may be the special + “unlimited” size which indicates + that the data may expand along this dimension indefinitely. + If these values are not stored, the maximum size of each + dimension is assumed to be the dimension’s current size. +

+

Permutation Index #n

+

This value is the index permutation used to map + each dimension from the canonical representation to an + alternate axis for each dimension. If these values are + not stored, the first dimension stored in the list of + dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+
+
+ + + +
+

Version 2 of the dataspace message dropped the optional + permutation index value support, as it was never implemented in the + HDF5 Library:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Dataspace Message - Version 2 +
bytebytebytebyte
VersionDimensionalityFlagsType

Dimension #1 SizeL

.
.
.

Dimension #n SizeL


Dimension #1 Maximum SizeL (optional)

.
.
.

Dimension #n Maximum SizeL (optional)

+ + + + + +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

This value is used to determine the format of the + Dataspace Message. This field should be ‘2’ for version 2 + format messages. +

+

Dimensionality

+

This value is the number of dimensions that the data object has. +

+

Flags

+

This field is used to store flags to indicate the + presence of parts of this message. Bit 0 (the least + significant bit) is used to indicate that maximum + dimensions are present. +

+

Type

+

This field indicates the type of the dataspace: + + + + + + + + + + + + + + + + + + +
ValueDescription
0A scalar dataspace; in other words, + a dataspace with a single, dimensionless element. +
1A simple dataspace; in other words, + a dataspace with a rank > 0 and an appropriate # of + dimensions. +
2A null dataspace; in other words, + a dataspace with no elements. +

+

Dimension #n Size

+

This value is the current size of the dimension of the + data as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+

Dimension #n Maximum Size

+

This value is the maximum size of the dimension of the + data as stored in the file. This value may be the special + “unlimited” size which indicates + that the data may expand along this dimension indefinitely. + If these values are not stored, the maximum size of each + dimension is assumed to be the dimension’s current size. +

+
+
+ + + + + +
+

IV.A.2.c. The Link Info Message

+ + +
+ + + + + + + + +
Header Message Name: Link Info
Header Message Type: 0x002
Length: Varies
Status: Optional; may not be + repeated.
Description:The link info message tracks variable information about the + current state of the links for a “new style” + group’s behavior. Variable information will be stored in + this message and constant information will be stored in the + Group Info message. +
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Link Info +
bytebytebytebyte
VersionFlagsThis space inserted only to align table nicely

Maximum Creation Index (8 bytes, optional)


Fractal Heap AddressO


Address of v2 B-tree for Name IndexO


Address of v2 B-tree for Creation Order IndexO (optional)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

The version number for this message. This document describes + version 0.

+

Flags

This field determines various optional aspects of the link + info message: + + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, creation order for the links is tracked. +
1If set, creation order for the links is indexed. +
2-7Reserved

+ +

Maximum Creation Index

This 64-bit value is the maximum creation order index value + stored for a link in this group.

+

This field is present if bit 0 of flags is set.

+

Fractal Heap Address

+

+ This is the address of the fractal heap to store dense links. + Each link stored in the fractal heap is stored as a + Link Message. +

+

+ If there are no links in the group, or the group’s links + are stored “compactly” (as object header messages), this + value will be the undefined + address. +

+

Address of v2 B-tree for Name Index

This is the address of the version 2 B-tree to index names of links.

+

If there are no links in the group, or the group’s links + are stored “compactly” (as object header messages), this + value will be the undefined + address. +

+

Address of v2 B-tree for Creation Order Index

This is the address of the version 2 B-tree to index creation order of links.

+

If there are no links in the group, or the group’s links + are stored “compactly” (as object header messages), this + value will be the undefined + address. +

+

This field exists if bit 1 of flags is set.

+
+
+ + +
+

IV.A.2.d. The Datatype Message

+ + +
+ + + + + + + + +
Header Message Name: Datatype
Header Message Type: 0x0003 +
Length: Variable
Status: Required for dataset or committed + datatype (formerly named datatype) objects; may not be repeated. +
Description:

The datatype message defines the datatype for each element + of a dataset or a common datatype for sharing between multiple + datasets. A datatype can describe an atomic type like a fixed- + or floating-point type or more complex types like a C struct + (compound datatype), array (array datatype) or C++ vector + (variable-length datatype).

+

Datatype messages that are part of a dataset object do not + describe how elements are related to one another; the dataspace + message is used for that purpose. Datatype messages that are part of + a committed datatype (formerly named datatype) message describe + a common datatype that can be shared by multiple datasets in the + file.

+
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Datatype Message +
bytebytebytebyte
Class and VersionClass Bit Field, Bits 0-7Class Bit Field, Bits 8-15Class Bit Field, Bits 16-23
Size


Properties


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Class and Version

+

The version of the datatype message and the datatype’s class + information are packed together in this field. The version + number is packed in the top 4 bits of the field and the class + is contained in the bottom 4 bits. +

+

The version number information is used for changes in the + format of the datatype message and is described here: + + + + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used +
1Used by early versions of the library to encode + compound datatypes with explicit array fields. + See the compound datatype description below for + further details. +
2Used when an array datatype needs to be encoded. +
3Used when a VAX byte-ordered type needs to be + encoded. Packs various other datatype classes more + efficiently also. +

+ +

The class of the datatype determines the format for the class + bit field and properties portion of the datatype message, which + are described below. The + following classes are currently defined: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Fixed-Point
1Floating-Point
2Time
3String
4Bit field
5Opaque
6Compound
7Reference
8Enumerated
9Variable-Length
10Array

+ +

Class Bit Fields

+

The information in these bit fields is specific to each datatype + class and is described below. All bits not defined for a + datatype class are set to zero. +

+

Size

+

The size of a datatype element in bytes. +

+

Properties

+

This variable-sized sequence of bytes encodes information + specific to each datatype class and is described for each class + below. If there is no property information specified for a + datatype class, the size of this field is zero bytes. +

+
+
+ + +
+

Class specific information for Fixed-Point Numbers (Class 0):

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fixed-point Bit Field Description +
BitsMeaning

0

Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.

1, 2

Padding type. Bit 1 is the lo_pad bit and bit 2 + is the hi_pad bit. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.

3

Signed. If this bit is set then the fixed-point + number is in 2’s complement form.

4-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + + +
+ Fixed-Point Property Description +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription

Bit Offset

+

The bit offset of the first significant bit of the fixed-point + value within the datatype. The bit offset specifies the number + of bits “to the right of” the value (which are set to the + lo_pad bit value). +

+

Bit Precision

+

The number of bits of precision of the fixed-point value + within the datatype. This value, combined with the datatype + element’s size and the Bit Offset field specifies the number + of bits “to the left of” the value (which are set to the + hi_pad bit value). +

+
+
+ + +
+

Class specific information for Floating-Point Numbers (Class 1):

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Floating-Point Bit Field Description +
BitsMeaning

0, 6

Byte Order. These two non-contiguous bits specify the + “endianness” of the bytes in the datatype element. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bit 6Bit 0Description
00Byte order is little-endian +
01Byte order is big-endian +
10Reserved +
11Byte order is VAX-endian +

+

1, 2, 3

Padding type. Bit 1 is the low bits pad type, bit 2 + is the high bits pad type, and bit 3 is the internal bits + pad type. If a datum has unused bits at either end or between + the sign bit, exponent, or mantissa, then the value of bit + 1, 2, or 3 is copied to those locations.

4-5

Mantissa Normalization. This 2-bit bit field specifies + how the most significant bit of the mantissa is managed. + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0No normalization +
1The most significant bit of the mantissa is always set + (except for 0.0). +
2The most significant bit of the mantissa is not stored, + but is implied to be set. +
3Reserved. +

+

7

Reserved (zero).

8-15

Sign Location. This is the bit position of the sign + bit. Bits are numbered with the least significant bit zero.

16-23

Reserved (zero).

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Floating-Point Property Description +
ByteByteByteByte
Bit OffsetBit Precision
Exponent LocationExponent SizeMantissa LocationMantissa Size
Exponent Bias
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Bit Offset

+

The bit offset of the first significant bit of the floating-point + value within the datatype. The bit offset specifies the number + of bits “to the right of” the value. +

+

Bit Precision

+

The number of bits of precision of the floating-point value + within the datatype. +

+

Exponent Location

+

The bit position of the exponent field. Bits are numbered with + the least significant bit number zero. +

+

Exponent Size

+

The size of the exponent field in bits. +

+

Mantissa Location

+

The bit position of the mantissa field. Bits are numbered with + the least significant bit number zero. +

+

Mantissa Size

+

The size of the mantissa field in bits. +

+

Exponent Bias

+

The bias of the exponent field. +

+
+
+ + +
+

Class specific information for Time (Class 2):

+ + +
+ + + + + + + + + + + + + + + + + +
+ Time Bit Field Description +
BitsMeaning

0

Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.

1-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + +
+ Time Property Description +
ByteByte
Bit Precision
+
+ +
+
+ + + + + + + + + + + +
Field NameDescription

Bit Precision

+

The number of bits of precision of the time value. +

+
+
+ + +
+

Class specific information for Strings (Class 3):

+ + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ String Bit Field Description +
BitsMeaning

0-3

Padding type. This four-bit value determines the + type of padding to use for the string. The values are: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Null Terminate: A zero byte marks the end of the + string and is guaranteed to be present after + converting a long string to a short string. When + converting a short string to a long string the value is + padded with additional null characters as necessary. +
1Null Pad: Null characters are added to the end of + the value during conversions from short values to long + values but conversion in the opposite direction simply + truncates the value. +
2Space Pad: Space characters are added to the end of + the value during conversions from short values to long + values but conversion in the opposite direction simply + truncates the value. This is the Fortran + representation of the string. +
3-15Reserved +

+

4-7

Character Set. The character set used to + encode the string. + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0ASCII character set encoding +
1UTF-8 character set encoding +
2-15Reserved +

+

8-23

Reserved (zero).

+
+ +

There are no properties defined for the string class. +

+ + +

Class specific information for bit fields (Class 4):

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ Bitfield Bit Field Description +
BitsMeaning

0

Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.

1, 2

Padding type. Bit 1 is the lo_pad type and bit 2 + is the hi_pad type. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.

3-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + + +
+ Bit Field Property Description +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription

Bit Offset

+

The bit offset of the first significant bit of the bit field + within the datatype. The bit offset specifies the number + of bits “to the right of” the value. +

+

Bit Precision

+

The number of bits of precision of the bit field + within the datatype. +

+
+
+ + +
+

Class specific information for Opaque (Class 5):

+ +
+ + + + + + + + + + + + + + + + + +
+ Opaque Bit Field Description +
BitsMeaning

0-7

Length of ASCII tag in bytes.

8-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + +
+ Opaque Property Description +
ByteByteByteByte

ASCII Tag
+
+
+ +
+
+ + + + + + + + + + +
Field NameDescription

ASCII Tag

+

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+
+
+ + +
+

Class specific information for Compound (Class 6):

+ +
+ + + + + + + + + + + + + + + + + +
+ Compound Bit Field Description +
BitsMeaning

0-15

Number of Members. This field contains the number + of members defined for the compound datatype. The member + definitions are listed in the Properties field of the data + type message.

16-23

Reserved (zero).

+
+ + +

The Properties field of a compound datatype is a list of the + member definitions of the compound datatype. The member + definitions appear one after another with no intervening bytes. + The member types are described with a (recursively) encoded datatype + message.

+ +

Note that the property descriptions are different for different + versions of the datatype version. Additionally note that the version + 0 datatype encoding is deprecated and has been replaced with later + encodings in versions of the HDF5 Library from the 1.4 release + onward.

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Compound Properties Description for Datatype Version 1 +
ByteByteByteByte

Name

Byte Offset of Member
DimensionalityReserved (zero)
Dimension Permutation
Reserved (zero)
Dimension #1 Size (required)
Dimension #2 Size (required)
Dimension #3 Size (required)
Dimension #4 Size (required)

Member Type Message

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Name

+

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+

Byte Offset of Member

+

This is the byte offset of the member within the datatype. +

+

Dimensionality

+

If set to zero, this field indicates a scalar member. If set + to a value greater than zero, this field indicates that the + member is an array of values. For array members, the size of + the array is indicated by the ‘Size of Dimension n’ field in + this message. +

+

Dimension Permutation

+

This field was intended to allow an array field to have + its dimensions permuted, but this was never implemented. + This field should always be set to zero. +

+

Dimension #n Size

+

This field is the size of a dimension of the array field as + stored in the file. The first dimension stored in the list of + dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+

Member Type Message

+

This field is a datatype message describing the datatype of + the member. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Compound Properties Description for Datatype Version 2 +
ByteByteByteByte

Name

Byte Offset of Member

Member Type Message

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Name

+

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+

Byte Offset of Member

+

This is the byte offset of the member within the datatype. +

+

Member Type Message

+

This field is a datatype message describing the datatype of + the member. +

+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Compound Properties Description for Datatype Version 3 +
ByteByteByteByte

Name

Byte Offset of Member (variable size)

Member Type Message

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Name

This NUL-terminated string provides a description for the + opaque type. It is not NUL-padded to a multiple of 8 + bytes.

Byte Offset of Member

This is the byte offset of the member within the datatype. + The field size is the minimum number of bytes necessary, + based on the size of the datatype element. For example, a + datatype element size of less than 256 bytes uses a 1 byte + length, a datatype element size of 256-65535 bytes uses a + 2 byte length, and so on.

Member Type Message

This field is a datatype message describing the datatype of + the member.

+
+ + +
+

Class specific information for Reference (Class 7):

+ +
+ + + + + + + + + + + + + + + + + +
+ Reference Bit Field Description +
BitsMeaning

0-3

Type. This four-bit value contains the type of reference + described. The values defined are: + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Object Reference: A reference to another object in this + HDF5 file. +
1Dataset Region Reference: A reference to a region within + a dataset in this HDF5 file. +
2-15Reserved +

+ +

4-23

Reserved (zero).

+
+ +

There are no properties defined for the reference class. +

+ + +
+

Class specific information for Enumeration (Class 8):

+ +
+ + + + + + + + + + + + + + + + + +
+ Enumeration Bit Field Description +
BitsMeaning

0-15

Number of Members. The number of name/value + pairs defined for the enumeration type.

16-23

Reserved (zero).

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Enumeration Property Description for Datatype Versions 1 & 2 +
ByteByteByteByte

Base Type


Names


Values

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Base Type

+

Each enumeration type is based on some parent type, usually an + integer. The information for that parent type is described + recursively by this field. +

+

Names

+

The name for each name/value pair. Each name is stored as a null + terminated ASCII string in a multiple of eight bytes. The names + are in no particular order. +

+

Values

+

The list of values in the same order as the names. The values + are packed (no inter-value padding) and the size of each value + is determined by the parent type. +

+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Enumeration Property Description for Datatype Version 3 +
ByteByteByteByte

Base Type


Names


Values

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Base Type

+

Each enumeration type is based on some parent type, usually an + integer. The information for that parent type is described + recursively by this field. +

+

Names

+

The name for each name/value pair. Each name is stored as a null + terminated ASCII string, not padded to a multiple of + eight bytes. The names are in no particular order. +

+

Values

+

The list of values in the same order as the names. The values + are packed (no inter-value padding) and the size of each value + is determined by the parent type. +

+
+
+ + + +
+

Class specific information for Variable-Length (Class 9):

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Variable-Length Bit Field Description +
BitsMeaning

0-3

Type. This four-bit value contains the type of + variable-length datatype described. The values defined are: + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Sequence: A variable-length sequence of any datatype. + Variable-length sequences do not have padding or + character set information. +
1String: A variable-length sequence of characters. + Variable-length strings have padding and character set + information. +
2-15Reserved +

+ +

4-7

Padding type. (variable-length string only) + This four-bit value determines the type of padding + used for variable-length strings. The values are the same + as for the string padding type, as follows: + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Null terminate: A zero byte marks the end of a string + and is guaranteed to be present after converting a long + string to a short string. When converting a short string + to a long string, the value is padded with additional null + characters as necessary. +
1Null pad: Null characters are added to the end of the + value during conversion from a short string to a longer + string. Conversion from a long string to a shorter string + simply truncates the value. +
2Space pad: Space characters are added to the end of the + value during conversion from a short string to a longer + string. Conversion from a long string to a shorter string + simply truncates the value. This is the Fortran + representation of the string. +
3-15Reserved +

+ +

This value is set to zero for variable-length sequences.

+ +

8-11

Character Set. (variable-length string only) + This four-bit value specifies the character set + to be used for encoding the string: + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0ASCII character set encoding +
1UTF-8 character set encoding +
2-15Reserved +

+ +

This value is set to zero for variable-length sequences.

+ +

12-23

Reserved (zero).

+
+ +
+
+
+ + + + + + + + + + + + + + +
+ Variable-Length Property Description +
ByteByteByteByte

Base Type

+
+ +
+
+ + + + + + + + + + + +
Field NameDescription

Base Type

+

Each variable-length type is based on some parent type. The + information for that parent type is described recursively by + this field. +

+
+
+ + +
+

Class specific information for Array (Class 10):

+ +

There are no bit fields defined for the array class. +

+ +

Note that the dimension information defined in the property for this + datatype class is independent of dataspace information for a dataset. + The dimension information here describes the dimensionality of the + information within a data element (or a component of an element, if the + array datatype is nested within another datatype) and the dataspace for a + dataset describes the size and locations of the elements in a dataset. +

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Array Property Description for Datatype Version 2 +
ByteByteByteByte
DimensionalityReserved (zero)
Dimension #1 Size
.
.
.
Dimension #n Size
Permutation Index #1
.
.
.
Permutation Index #n

Base Type

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Dimensionality

+

This value is the number of dimensions that the array has. +

+

Dimension #n Size

+

This value is the size of the dimension of the array + as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+

Permutation Index #n

+

This value is the index permutation used to map + each dimension from the canonical representation to an + alternate axis for each dimension. Currently, dimension + permutations are not supported, and these indices should + be set to the index position minus one. In other words, + the first dimension should be set to 0, the second dimension + should be set to 1, and so on. +

+

Base Type

+

Each array type is based on some parent type. The + information for that parent type is described recursively by + this field. +

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Array Property Description for Datatype Version 3 +
ByteByteByteByte
DimensionalityThis space inserted only to align table nicely
Dimension #1 Size
.
.
.
Dimension #n Size

Base Type

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Dimensionality

+

This value is the number of dimensions that the array has. +

+

Dimension #n Size

+

This value is the size of the dimension of the array + as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+

Base Type

+

Each array type is based on some parent type. The + information for that parent type is described recursively by + this field. +

+
+
+ + + +
+

IV.A.2.e. The Data Storage - +Fill Value (Old) Message

+ + +
+ + + + + + + + +
Header Message Name: Fill Value + (old)
Header Message Type: 0x0004
Length: Varies
Status: Optional; may not be + repeated.
Description:

The fill value message stores a single data value which + is returned to the application when an uninitialized data element + is read from a dataset. The fill value is interpreted with the + same datatype as the dataset. If no fill value message is present + then a fill value of all zero bytes is assumed.

+

This fill value message is deprecated in favor of the + “new” fill value message (Message Type 0x0005) and + is only written to the file for forward compatibility with + versions of the HDF5 Library before the 1.6.0 version. + Additionally, it only appears for datasets with a user-defined + fill value (as opposed to the library default fill value or an + explicitly set “undefined” fill value).

+
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + +
+ Fill Value Message (Old) +
bytebytebytebyte
Size

Fill Value (optional, variable size)

+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription

Size

+

This is the size of the Fill Value field in bytes. +

+

Fill Value

+

The fill value. The bytes of the fill value are interpreted + using the same datatype as for the dataset. +

+
+
+ + +
+

IV.A.2.f. The Data Storage - +Fill Value Message

+ + +
+ + + + + + + + +
Header Message Name: Fill + Value
Header Message Type: 0x0005
Length: Varies
Status: Required for dataset objects; + may not be repeated.
Description:The fill value message stores a single data value which is + returned to the application when an uninitialized data element + is read from a dataset. The fill value is interpreted with the + same datatype as the dataset.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Fill Value Message - Versions 1 & 2 +
bytebytebytebyte
VersionSpace Allocation TimeFill Value Write TimeFill Value Defined
Size (optional)

Fill Value (optional, variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

The version number information is used for changes in the + format of the fill value message and is described here: + + + + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used +
1Initial version of this message. +
2In this version, the Size and Fill Value fields are + only present if the Fill Value Defined field is set + to 1. +
3This version packs the other fields in the message + more efficiently than version 2. +

+

+

Space Allocation Time

+

When the storage space for the dataset’s raw data will be + allocated. The allowed values are: + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Not used. +
1Early allocation. Storage space for the entire dataset + should be allocated in the file when the dataset is + created. +
2Late allocation. Storage space for the entire dataset + should not be allocated until the dataset is written + to. +
3Incremental allocation. Storage space for the + dataset should not be allocated until the portion + of the dataset is written to. This is currently + used in conjunction with chunked data storage for + datasets. +

+ +

Fill Value Write Time

+

At the time that storage space for the dataset’s raw data is + allocated, this value indicates whether the fill value should + be written to the raw data storage elements. The allowed values + are: + + + + + + + + + + + + + + + + + + +
ValueDescription
0On allocation. The fill value is always written to + the raw data storage when the storage space is allocated. +
1Never. The fill value should never be written to + the raw data storage. +
2Fill value written if set by user. The fill value + will be written to the raw data storage when the storage + space is allocated only if the user explicitly set + the fill value. If the fill value is the library + default or is undefined, it will not be written to + the raw data storage. +

+ +

Fill Value Defined

+

This value indicates if a fill value is defined for this + dataset. If this value is 0, the fill value is undefined. + If this value is 1, a fill value is defined for this dataset. + For version 2 or later of the fill value message, this value + controls the presence of the Size and Fill Value fields. +

+

Size

+

This is the size of the Fill Value field in bytes. This field + is not present if the Version field is greater than 1, + and the Fill Value Defined field is set to 0. +

+

Fill Value

+

The fill value. The bytes of the fill value are interpreted + using the same datatype as for the dataset. This field is + not present if the Version field is greater than 1, + and the Fill Value Defined field is set to 0. +

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Fill Value Message - Version 3 +
bytebytebytebyte
VersionFlagsThis space inserted only to align table nicely
Size (optional)

Fill Value (optional, variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

The version number information is used for changes in the + format of the fill value message and is described here: + + + + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used +
1Initial version of this message. +
2In this version, the Size and Fill Value fields are + only present if the Fill Value Defined field is set + to 1. +
3This version packs the other fields in the message + more efficiently than version 2. +

+ +

Flags

+

When the storage space for the dataset’s raw data will be + allocated. The allowed values are: + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitsDescription
0-1Space Allocation Time, with the same + values as versions 1 and 2 of the message. +
2-3Fill Value Write Time, with the same + values as versions 1 and 2 of the message. +
4Fill Value Undefined, indicating that the fill + value has been marked as “undefined” for this dataset. + Bits 4 and 5 cannot both be set. +
5Fill Value Defined, with the same values as + versions 1 and 2 of the message. + Bits 4 and 5 cannot both be set. +
6-7Reserved (zero). +

+ +

Size

+

This is the size of the Fill Value field in bytes. This field + is not present if the Version field is greater than 1, + and the Fill Value Defined flag is set to 0. +

+

Fill Value

+

The fill value. The bytes of the fill value are interpreted + using the same datatype as for the dataset. This field is + not present if the Version field is greater than 1, + and the Fill Value Defined flag is set to 0. +

+
+
+ + +
+

IV.A.2.g. The Link Message

+ + +
+ + + + + + + + +
Header Message Name: Link
Header Message Type: 0x0006
Length: Varies
Status: Optional; may be + repeated.
Description:

This message encodes the information for a link in a + group’s object header, when the group is storing its links + “compactly”, or in the group’s fractal heap, + when the group is storing its links “densely”.

+

A group is storing its links compactly when the fractal heap + address in the Link Info + Message is set to the “undefined address” + value.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Link Message +
bytebytebytebyte
VersionFlagsLink type (optional)This space inserted only to align table nicely

Creation Order (8 bytes, optional)

Link Name Character Set (optional)Length of Link Name (variable size)This space inserted only to align table nicely
Link Name (variable size)

Link Information (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This document describes version 1.

+

Flags

This field contains information about the link and controls + the presence of other fields below. + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitsDescription
0-1Determines the size of the Length of Link Name + field. + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0The size of the Length of Link Name + field is 1 byte. +
1The size of the Length of Link Name + field is 2 bytes. +
2The size of the Length of Link Name + field is 4 bytes. +
3The size of the Length of Link Name + field is 8 bytes. +
+
2Creation Order Field Present: if set, the Creation + Order field is present. If not set, creation order + information is not stored for links in this group. +
3Link Type Field Present: if set, the link is not + a hard link and the Link Type field is present. + If not set, the link is a hard link. +
4Link Name Character Set Field Present: if set, the + link name is not represented with the ASCII character + set and the Link Name Character Set field is + present. If not set, the link name is represented with + the ASCII character set. +
5-7Reserved (zero). +

+ +

Link type

This is the link class type and can be one of the following + values: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0A hard link (should never be stored in the file) +
1A soft link. +
2-63Reserved for future HDF5 internal use. +
64An external link. +
65-255Reserved, but available for user-defined link types. +

+ +

This field is present if bit 3 of Flags is set.

+

Creation Order

This 64-bit value is an index of the link’s creation time within + the group. Values start at 0 when the group is created an increment + by one for each link added to the group. Removing a link from a + group does not change existing links’ creation order field. +

+

This field is present if bit 2 of Flags is set.

+

Link Name Character Set

This is the character set for encoding the link’s name: + + + + + + + + + + + + + + + +
ValueDescription
0ASCII character set encoding (this should never be stored + in the file) +
1UTF-8 character set encoding +

+ +

This field is present if bit 4 of Flags is set.

+

Length of link name

This is the length of the link’s name. The size of this field + depends on bits 0 and 1 of Flags.

+

Link name

This is the name of the link, non-NULL terminated.

+

Link information

The format of this field depends on the link type.

+

For hard links, the field is formatted as follows: + + + + + + +
Size of Offsets bytes:The address of the object header for the object that the + link points to. +
+

+ +

+ For soft links, the field is formatted as follows: + + + + + + + + + + +
Bytes 1-2:Length of soft link value.
Length of soft link value bytes:A non-NULL-terminated string storing the value of the + soft link. +
+

+ +

+ For external links, the field is formatted as follows: + + + + + + + + + + +
Bytes 1-2:Length of external link value.
Length of external link value bytes:The first byte contains the version number in the + upper 4 bits and flags in the lower 4 bits for the external + link. Both version and flags are defined to be zero in + this document. The remaining bytes consist of two + NULL-terminated strings, with no padding between them. + The first string is the name of the HDF5 file containing + the object linked to and the second string is the full path + to the object linked to, within the HDF5 file’s + group hierarchy. +
+

+ +

+ For user-defined links, the field is formatted as follows: + + + + + + + + + + +
Bytes 1-2:Length of user-defined data.
Length of user-defined link value bytes:The data supplied for the user-defined link type.
+

+ +
+
+ +
+

IV.A.2.h. The Data Storage - +External Data Files Message

+ + +
+ + + + + + + + +
Header Message Name: External + Data Files
Header Message Type: 0x0007
Length: Varies
Status: Optional; may not be + repeated.
Description:The external data storage message indicates that the data + for an object is stored outside the HDF5 file. The filename of + the object is stored as a Universal Resource Location (URL) of + the actual filename containing the data. An external file list + record also contains the byte offset of the start of the data + within the file and the amount of space reserved in the file + for that data.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ External File List Message +
bytebytebytebyte
VersionReserved (zero)
Allocated SlotsUsed Slots

Heap AddressO


Slot Definitions...

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

The version number information is used for changes in the format of + External Data Storage Message and is described here: + + + + + + + + + + + + + +
VersionDescription
0Never used.
1The current version used by the library.

+ +

Allocated Slots

+

The total number of slots allocated in the message. Its value must be at least as + large as the value contained in the Used Slots field. (The current library simply + uses the number of Used Slots for this message)

+

Used Slots

+

The number of initial slots which contains valid information.

+

Heap Address

+

This is the address of a local heap which contains the names for the external + files (The local heap information can be found in Disk Format Level 1D in this + document). The name at offset zero in the heap is always the empty string.

+

Slot Definitions

+

The slot definitions are stored in order according to the array addresses they + represent.

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ External File List Slot +
bytebytebytebyte

Name Offset in Local HeapL


Offset in External Data FileL


Data Size in External FileL

+ + + + + +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Name Offset in Local Heap

+

The byte offset within the local name heap for the name + of the file. File names are stored as a URL which has a + protocol name, a host name, a port number, and a file + name: + protocol:port//host/file. + If the protocol is omitted then “file:” is assumed. If + the port number is omitted then a default port for that + protocol is used. If both the protocol and the port + number are omitted then the colon can also be omitted. If + the double slash and host name are omitted then + “localhost” is assumed. The file name is the only + mandatory part, and if the leading slash is missing then + it is relative to the application’s current working + directory (the use of relative names is not + recommended). +

+

Offset in External Data File

+

This is the byte offset to the start of the data in the + specified file. For files that contain data for a single + dataset this will usually be zero.

+

Data Size in External File

+

This is the total number of bytes reserved in the + specified file for raw data storage. For a file that + contains exactly one complete dataset which is not + extendable, the size will usually be the exact size of the + dataset. However, by making the size larger one allows + HDF5 to extend the dataset. The size can be set to a value + larger than the entire file since HDF5 will read zeroes + past the end of the file without failing.

+
+
+ + +
+

IV.A.2.i. The Data Storage - Layout +Message

+ + +
+ + + + + + + + +
Header Message Name: Data Storage - + Layout
Header Message Type: 0x0008
Length: Varies
Status: Required for datasets; may not + be repeated.
Description:Data layout describes how the elements of a multi-dimensional + array are stored in the HDF5 file. Three types of data layout + are supported: +
    +
  1. Contiguous: The array is stored in one contiguous area of + the file. This layout requires that the size of the array be + constant: data manipulations such as chunking, compression, + checksums, or encryption are not permitted. The message stores + the total storage size of the array. The offset of an element + from the beginning of the storage area is computed as in a C + array.
  2. +
  3. Chunked: The array domain is regularly decomposed into + chunks, and each chunk is allocated and stored separately. This + layout supports arbitrary element traversals, compression, + encryption, and checksums. (these features are described + in other messages). The message stores the size of a chunk + instead of the size of the entire array; the storage size of + the entire array can be calculated by traversing the B-tree + that stores the chunk addresses.
  4. +
  5. Compact: The array is stored in one contiguous block, as + part of this object header message.
  6. +
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Data Layout Message (Versions 1 and 2) +
bytebytebytebyte
VersionDimensionalityLayout ClassReserved (zero)
Reserved (zero)

Data AddressO (optional)

Dimension 0 Size
Dimension 1 Size
...
Dimension #n Size
Dataset Element Size (optional)
Compact Data Size (optional)

Compact Data... (variable size, optional)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

The version number information is used for changes in the format of the data + layout message and is described here: + + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by version 1.4 and before of the library to encode layout information. + Data space is always allocated when the data set is created.
2Used by version 1.6.x of the library to encode layout information. + Data space is allocated only when it is necessary.

+

Dimensionality

An array has a fixed dimensionality. This field + specifies the number of dimension size fields later in the + message. The value stored for chunked storage is 1 greater than + the number of dimensions in the dataset’s dataspace. + For example, 2 is stored for a 1 dimensional dataset. +

+

Layout Class

The layout class specifies the type of storage for the data + and how the other fields of the layout message are to be + interpreted. + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Compact Storage +
1Contiguous Storage +
2Chunked Storage +
+

+

Data Address

For contiguous storage, this is the address of the raw + data in the file. For chunked storage this is the address + of the v1 B-tree that is used to look up the addresses of the + chunks. This field is not present for compact storage. + If the version for this message is greater than 1, the address + may have the “undefined address” value, to indicate that + storage has not yet been allocated for this array.

+

Dimension #n Size

For contiguous and compact storage the dimensions define + the entire size of the array while for chunked storage they define + the size of a single chunk. In all cases, they are in units of + array elements (not bytes). The first dimension stored in the list + of dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+

Dataset Element Size

The size of a dataset element, in bytes. This field is only + present for chunked storage. +

+

Compact Data Size

This field is only present for compact data storage. + It contains the size of the raw data for the dataset array, in + bytes.

+

Compact Data

This field is only present for compact data storage. + It contains the raw data for the dataset array.

+
+
+ +
+

Version 3 of this message re-structured the format into specific + properties that are required for each layout class.

+ + +
+ + + + + + + + + + + + + + + + + + + +
+ Data Layout Message (Version 3) +
bytebytebytebyte
VersionLayout ClassThis space inserted only to align table nicely

Properties (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

+

The version number information is used for changes in the format of layout message + and is described here: + + + + + + + + + + +
VersionDescription
3Used by the version 1.6.3 and later of the library to store properties + for each layout class.

+

Layout Class

The layout class specifies the type of storage for the data + and how the other fields of the layout message are to be + interpreted. + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Compact Storage +
1Contiguous Storage +
2Chunked Storage +
+

+

Properties

This variable-sized field encodes information specific to each + layout class and is described below. If there is no property + information specified for a layout class, the size of this field + is zero bytes.

+
+ +
+

Class-specific information for compact layout (Class 0): (Note: The dimensionality information + is in the Dataspace message)

+ + +
+ + + + + + + + + + + + + + + + + + +
+ Compact Storage Property Description +
bytebytebytebyte
SizeThis space inserted only to align table nicely

Raw Data... (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription

Size

This field contains the size of the raw data for the dataset + array, in bytes. +

+

Raw Data

This field contains the raw data for the dataset array.

+
+ + +
+

Class-specific information for contiguous layout (Class 1): (Note: The dimensionality information + is in the Dataspace message)

+ + +
+ + + + + + + + + + + + + + + + + +
+ Contiguous Storage Property Description +
bytebytebytebyte

AddressO


SizeL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription

Address

This is the address of the raw data in the file. + The address may have the “undefined address” value, to indicate + that storage has not yet been allocated for this array.

Size

This field contains the size allocated to store the raw data, + in bytes. +

+
+
+ + +
+

Class-specific information for chunked layout (Class 2):

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Chunked Storage Property Description +
bytebytebytebyte
DimensionalityThis space inserted only to align table nicely

AddressO

Dimension 0 Size
Dimension 1 Size
...
Dimension #n Size
Dataset Element Size
+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Dimensionality

A chunk has a fixed dimensionality. This field specifies + the number of dimension size fields later in the message.

Address

This is the address of the v1 B-tree that is used to look up the + addresses of the chunks that actually store portions of the array + data. The address may have the “undefined address” value, to + indicate that storage has not yet been allocated for this array.

Dimension #n Size

These values define the dimension size of a single chunk, in + units of array elements (not bytes). The first dimension stored in + the list of dimensions is the slowest changing dimension and the + last dimension stored is the fastest changing dimension. +

+

Dataset Element Size

The size of a dataset element, in bytes. +

+
+
+ +
+

IV.A.2.j. The Bogus Message

+ + +
+ + + + + + + + +
Header Message Name: Bogus
Header Message Type: 0x0009
Length: 4 bytes
Status: For testing only; should never + be stored in a valid file.
Description:This message is used for testing the HDF5 Library’s + response to an “unknown” message type and should + never be encountered in a valid HDF5 file.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + +
+ Bogus Message +
bytebytebytebyte
Bogus Value
+
+ +
+
+ + + + + + + + + + +
Field NameDescription

Bogus Value

+

This value should always be: 0xdeadbeef.

+
+
+ +
+

IV.A.2.k. The Group Info Message +

+ + +
+ + + + + + + + +
Header Message Name: Group Info
Header Message Type: 0x000A
Length: Varies
Status: Optional; may not be + repeated.
Description:

This message stores information for the constants defining + a “new style” group’s behavior. Constant + information will be stored in this message and variable + information will be stored in the + Link Info message.

+

Note: the “estimated entry” information below is + used when determining the size of the object header for the + group when it is created.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Group Info Message +
bytebytebytebyte
VersionFlagsLink Phase Change: Maximum Compact Value (optional)
Link Phase Change: Minimum Dense Value (optional)Estimated Number of Entries (optional)
Estimated Link Name Length of Entries (optional)This space inserted only to align table nicely
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This document describes version 0.

+

Flags

This is the group information flag with the following definition: + + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, link phase change values are stored. +
1If set, the estimated entry information is non-default + and is stored. +
2-7Reserved

+

Link Phase Change: Maximum Compact Value

The is the maximum number of links to store “compactly” (in + the group’s object header).

+

This field is present if bit 0 of Flags is set.

+

Link Phase Change: Minimum Dense Value

This is the minimum number of links to store “densely” (in + the group’s fractal heap). The fractal heap’s address is + located in the Link Info + message.

+

This field is present if bit 0 of Flags is set.

+

Estimated Number of Entries

This is the estimated number of entries in groups.

+

If this field is not present, the default value of 4 + will be used for the estimated number of group entries.

+

This field is present if bit 1 of Flags is set.

+

Estimated Link Name Length of Entries

This is the estimated length of entry name.

+

If this field is not present, the default value of 8 + will be used for the estimated link name length of group entries.

+

This field is present if bit 1 of Flags is set.

+
+
+

+ +
+

IV.A.2.l. The Data Storage - Filter +Pipeline Message

+ + +
+ + + + + + + + +
Header Message Name: + Data Storage - Filter Pipeline
Header Message Type: 0x000B
Length: Varies
Status: Optional; may not be + repeated.
Description:

This message describes the filter pipeline which should + be applied to the data stream by providing filter identification + numbers, flags, a name, and client data.

+

This message may be present in the object headers of both + dataset and group objects. For datasets, it specifies the + filters to apply to raw data. For groups, it specifies the + filters to apply to the group’s fractal heap. Currently, + only datasets using chunked data storage use the filter + pipeline on their raw data.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Filter Pipeline Message - Version 1 +
bytebytebytebyte
VersionNumber of FiltersReserved (zero)
Reserved (zero)

Filter Description List (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This table + describes version 1.

Number of Filters

The total number of filters described in this + message. The maximum possible number of filters in a + message is 32.

Filter Description List

A description of each filter. A filter description + appears in the next table.

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Filter Description +
bytebytebytebyte
Filter Identification ValueName Length
FlagsNumber Client Data Values

Name (variable size, optional)


Client Data (variable size, optional)

Padding (variable size, optional)
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Filter Identification Value

+

+ This value, often referred to as a filter identifier, + is designed to be a unique identifier for the filter. + Values from zero through 32,767 are reserved for filters + supported by The HDF Group in the HDF5 Library and for + filters requested and supported by third parties. + Filters supported by The HDF Group are documented immediately + below. Information on 3rd-party filters can be found at + The HDF Group’s + + Contributions page.

+ +

+ To request a filter identifier, please contact + The HDF Group’s Help Desk at + The HDF Group Help Desk. + You will be asked to provide the following information:

+
    +
  1. Contact information for the developer requesting the + new identifier
  2. +
  3. A short description of the new filter
  4. +
  5. Links to any relevant information, including licensing + information
  6. +
+

+ Values from 32768 to 65535 are reserved for non-distributed uses + (for example, internal company usage) or for application usage + when testing a feature. The HDF Group does not track or document + the use of the filters with identifiers from this range.

+ +

+ The filters currently in library version 1.8.0 are + listed below: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentificationNameDescription
0N/AReserved
1deflateGZIP deflate compression
2shuffleData element shuffling
3fletcher32Fletcher32 checksum
4szipSZIP compression
5nbitN-bit packing
6scaleoffsetScale and offset encoded values
+

Name Length

Each filter has an optional null-terminated ASCII name + and this field holds the length of the name including the + null termination padded with nulls to be a multiple of + eight. If the filter has no name then a value of zero is + stored in this field.

Flags

The flags indicate certain properties for a filter. The + bit values defined so far are: + + + + + + + + + + + + + + + +
BitDescription
0If set then the filter is an optional filter. + During output, if an optional filter fails it will be + silently skipped in the pipeline.
1-15Reserved (zero)

+

Number of Client Data Values

Each filter can store integer values to control + how the filter operates. The number of entries in the + Client Data array is stored in this field.

Name

If the Name Length field is non-zero then it will + contain the size of this field, padded to a multiple of eight. This + field contains a null-terminated, ASCII character + string to serve as a comment/name for the filter.

Client Data

This is an array of four-byte integers which will be + passed to the filter function. The Client Data Number of + Values determines the number of elements in the array.

Padding

Four bytes of zeroes are added to the message at this + point if the Client Data Number of Values field contains + an odd number.

+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
+ Filter Pipeline Message - Version 2 +
bytebytebytebyte
VersionNumber of FiltersThis space inserted only to align table nicely

Filter Description List (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This table + describes version 2.

Number of Filters

The total number of filters described in this + message. The maximum possible number of filters in a + message is 32.

Filter Description List

A description of each filter. A filter description + appears in the next table.

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Filter Description +
bytebytebytebyte
Filter Identification ValueName Length (optional)
FlagsNumber Client Data Values

Name (variable size, optional)


Client Data (variable size, optional)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Filter Identification Value

+

+ This value, often referred to as a filter identifier, + is designed to be a unique identifier for the filter. + Values from zero through 32,767 are reserved for filters + supported by The HDF Group in the HDF5 Library and for + filters requested and supported by third parties. + Filters supported by The HDF Group are documented immediately + below. Information on 3rd-party filters can be found at + The HDF Group’s + + Contributions page.

+ +

+ To request a filter identifier, please contact + The HDF Group’s Help Desk at + The HDF Group Help Desk. + You will be asked to provide the following information:

+
    +
  1. Contact information for the developer requesting the + new identifier
  2. +
  3. A short description of the new filter
  4. +
  5. Links to any relevant information, including licensing + information
  6. +
+

+ Values from 32768 to 65535 are reserved for non-distributed uses + (for example, internal company usage) or for application usage + when testing a feature. The HDF Group does not track or document + the use of the filters with identifiers from this range.

+ +

+ The filters currently in library version 1.8.0 are + listed below: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentificationNameDescription
0N/AReserved
1deflateGZIP deflate compression
2shuffleData element shuffling
3fletcher32Fletcher32 checksum
4szipSZIP compression
5nbitN-bit packing
6scaleoffsetScale and offset encoded values
+

Name Length

Each filter has an optional null-terminated ASCII name + and this field holds the length of the name including the + null termination padded with nulls to be a multiple of + eight. If the filter has no name then a value of zero is + stored in this field.

+

Filters with IDs less than 256 (in other words, filters + that are defined in this format documentation) do not store + the Name Length or Name fields. +

+

Flags

The flags indicate certain properties for a filter. The + bit values defined so far are: + + + + + + + + + + + + + + + +
BitDescription
0If set then the filter is an optional filter. + During output, if an optional filter fails it will be + silently skipped in the pipeline.
1-15Reserved (zero)

+

Number of Client Data Values

Each filter can store integer values to control + how the filter operates. The number of entries in the + Client Data array is stored in this field.

Name

If the Name Length field is non-zero then it will + contain the size of this field, not padded to a multiple + of eight. This field contains a non-null-terminated, + ASCII character string to serve as a comment/name for the filter. +

+

Filters that are defined in this format documentation + such as deflate and shuffle do not store the Name + Length or Name fields. +

+

Client Data

This is an array of four-byte integers which will be + passed to the filter function. The Client Data Number of + Values determines the number of elements in the array.

+
+
+ +
+

IV.A.2.m. The Attribute Message

+ + +
+ + + + + + + + +
Header Message Name: Attribute
Header Message Type: 0x000C
Length: Varies
Status: Optional; may be + repeated.
Description:

The Attribute message is used to store objects + in the HDF5 file which are used as attributes, or + “metadata” about the current object. An attribute + is a small dataset; it has a name, a datatype, a dataspace, and + raw data. Since attributes are stored in the object header, they + should be relatively small (in other words, less than 64KB). + They can be associated with any type of object which has an + object header (groups, datasets, or committed (named) + datatypes).

+

In 1.8.x versions of the library, attributes can be larger + than 64KB. See the + + “Special Issues” section of the Attributes chapter + in the HDF5 User’s Guide for more information.

+

Note: Attributes on an object must have unique names: + the HDF5 Library currently enforces this by causing the + creation of an attribute with a duplicate name to fail. + Attributes on different objects may have the same name, + however.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Attribute Message (Version 1) +
bytebytebytebyte
VersionReserved (zero)Name Size
Datatype SizeDataspace Size

Name (variable size)


Datatype (variable size)


Dataspace (variable size)


Data (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number information is used for changes in the format of the + attribute message and is described here: + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by the library before version 1.6 to encode attribute message. + This version does not support shared datatypes.

+

Name Size

The length of the attribute name in bytes including the + null terminator. Note that the Name field below may + contain additional padding not represented by this + field.

Datatype Size

The length of the datatype description in the Datatype + field below. Note that the Datatype field may contain + additional padding not represented by this field.

Dataspace Size

The length of the dataspace description in the Dataspace + field below. Note that the Dataspace field may contain + additional padding not represented by this field.

Name

The null-terminated attribute name. This field is + padded with additional null characters to make it a + multiple of eight bytes.

Datatype

The datatype description follows the same format as + described for the datatype object header message. This + field is padded with additional zero bytes to make it a + multiple of eight bytes.

Dataspace

The dataspace description follows the same format as + described for the dataspace object header message. This + field is padded with additional zero bytes to make it a + multiple of eight bytes.

Data

The raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. This + field is not padded with additional bytes.

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Attribute Message (Version 2) +
bytebytebytebyte
VersionFlagsName Size
Datatype SizeDataspace Size

Name (variable size)


Datatype (variable size)


Dataspace (variable size)


Data (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number information is used for changes in the + format of the attribute message and is described here: + + + + + + + + + + +
VersionDescription
2Used by the library of version 1.6.x and after to encode + attribute messages. + This version supports shared datatypes. The fields of + name, datatype, and dataspace are not padded with + additional bytes of zero. +

+

Flags

This bit field contains extra information about + interpreting the attribute message: + + + + + + + + + + + + + + + + +
BitDescription
0If set, datatype is shared.
1If set, dataspace is shared.

+

Name Size

The length of the attribute name in bytes including the + null terminator.

Datatype Size

The length of the datatype description in the Datatype + field below.

Dataspace Size

The length of the dataspace description in the Dataspace + field below.

Name

The null-terminated attribute name. This field is not + padded with additional bytes.

Datatype

The datatype description follows the same format as + described for the datatype object header message. +

+

If the + Flag field indicates this attribute’s datatype is + shared, this field will contain a “shared message” encoding + instead of the datatype encoding. +

+

This field is not padded with additional bytes. +

+

Dataspace

The dataspace description follows the same format as + described for the dataspace object header message. +

+

If the + Flag field indicates this attribute’s dataspace is + shared, this field will contain a “shared message” encoding + instead of the dataspace encoding. +

+

This field is not padded with additional bytes.

+

Data

The raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. +

+

This field is not padded with additional zero bytes. +

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Attribute Message (Version 3) +
bytebytebytebyte
VersionFlagsName Size
Datatype SizeDataspace Size
Name Character Set EncodingThis space inserted only to align table nicely

Name (variable size)


Datatype (variable size)


Dataspace (variable size)


Data (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number information is used for changes in the + format of the attribute message and is described here: + + + + + + + + + + +
VersionDescription
3Used by the library of version 1.8.x and after to + encode attribute messages. + This version supports attributes with non-ASCII names. +

+

Flags

This bit field contains extra information about + interpreting the attribute message: + + + + + + + + + + + + + + + + +
BitDescription
0If set, datatype is shared.
1If set, dataspace is shared.

+

Name Size

The length of the attribute name in bytes including the + null terminator.

Datatype Size

The length of the datatype description in the Datatype + field below.

Dataspace Size

The length of the dataspace description in the Dataspace + field below.

Name Character Set Encoding

The character set encoding for the attribute’s name: + + + + + + + + + + + + + + + +
ValueDescription
0ASCII character set encoding +
1UTF-8 character set encoding +
+

+

Name

The null-terminated attribute name. This field is not + padded with additional bytes.

Datatype

The datatype description follows the same format as + described for the datatype object header message. +

+

If the + Flag field indicates this attribute’s datatype is + shared, this field will contain a “shared message” encoding + instead of the datatype encoding. +

+

This field is not padded with additional bytes. +

+

Dataspace

The dataspace description follows the same format as + described for the dataspace object header message. +

+

If the + Flag field indicates this attribute’s dataspace is + shared, this field will contain a “shared message” encoding + instead of the dataspace encoding. +

+

This field is not padded with additional bytes.

+

Data

The raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. +

+

This field is not padded with additional zero bytes. +

+
+
+ +
+

IV.A.2.n. The Object Comment +Message

+ + +
+ + + + + + + + +
Header Message Name: Object + Comment
Header Message Type: 0x000D
Length: Varies
Status: Optional; may not be + repeated.
Description:The object comment is designed to be a short description of + an object. An object comment is a sequence of non-zero + (\0) ASCII characters with no other formatting + included by the library.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + +
+ Name Message +
bytebytebytebyte

Comment (variable size)

+
+ +
+
+ + + + + + + + + + +
Field NameDescription

Name

A null terminated ASCII character string.

+
+ +
+

IV.A.2.o. The Object +Modification Time (Old) Message

+ + +
+ + + + + + + + +
Header Message Name: Object + Modification Time (Old)
Header Message Type: 0x000E
Length: Fixed
Status: Optional; may not be + repeated.
Description:

The object modification date and time is a timestamp + which indicates (using ISO-8601 date and time format) the last + modification of an object. The time is updated when any object + header message changes according to the system clock where the + change was posted. All fields of this message should be + interpreted as coordinated universal time (UTC).

+

This modification time message is deprecated in favor of + the “new” Object + Modification Time message and is no longer written to the + file in versions of the HDF5 Library after the 1.6.0 + version.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Modification Time Message +
bytebytebytebyte
Year
MonthDay of Month
HourMinute
SecondReserved
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Year

The four-digit year as an ASCII string. For example, + 1998. +

Month

The month number as a two digit ASCII string where + January is 01 and December is 12.

Day of Month

The day number within the month as a two digit ASCII + string. The first day of the month is 01.

Hour

The hour of the day as a two digit ASCII string where + midnight is 00 and 11:00pm is 23.

Minute

The minute of the hour as a two digit ASCII string where + the first minute of the hour is 00 and + the last is 59.

Second

The second of the minute as a two digit ASCII string + where the first second of the minute is 00 + and the last is 59.

Reserved

This field is reserved and should always be zero.

+
+ +
+

IV.A.2.p. The Shared Message Table +Message

+ + +
+ + + + + + + + +
Header Message Name: Shared Message + Table
Header Message Type: 0x000F
Length: Fixed
Status: Optional; may not be + repeated.
Description:This message is used to locate the table of shared object + header message (SOHM) indexes. Each index consists of information + to find the shared messages from either the heap or object header. + This message is only found in the superblock + extension.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Shared Message Table Message +
bytebytebytebyte
VersionThis space inserted only to align table nicely

Shared Object Header Message Table AddressO

Number of IndicesThis space inserted only to align table nicely
+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This document describes version 0.

Shared Object Header Message Table Address

This field is the address of the master table for shared + object header message indexes.

+

Number of Indices

This field is the number of indices in the master table. +

+
+ +
+

IV.A.2.q. The Object Header +Continuation Message

+ + +
+ + + + + + + + +
Header Message Name: Object Header + Continuation
Header Message Type: 0x0010
Length: Fixed
Status: Optional; may be + repeated.
Description:The object header continuation is the location in the file + of a block containing more header messages for the current data + object. This can be used when header blocks become too large or + are likely to change over time.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + +
+ Object Header Continuation Message +
bytebytebytebyte

OffsetO


LengthL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription

Offset

This value is the address in the file where the + header continuation block is located.

Length

This value is the length in bytes of the header continuation + block in the file.

+
+
+ +

The format of the header continuation block that this message points + to depends on the version of the object header that the message is + contained within. +

+ +

+ Continuation blocks for version 1 object headers have no special + formatting information; they are merely a list of object header + message info sequences (type, size, flags, reserved bytes and data + for each message sequence). See the description + of Version 1 Data Object Header Prefix. +

+ +

Continuation blocks for version 2 object headers do have + special formatting information as described here + (see also the description of + Version 2 Data Object Header Prefix.): +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Version 2 Object Header Continuation Block +
bytebytebytebyte
Signature
Header Message Type #1Size of Header Message Data #1Header Message #1 Flags
Header Message #1 Creation Order (optional)This space inserted only to align table nicely

Header Message Data #1

.
.
.
Header Message Type #nSize of Header Message Data #nHeader Message #n Flags
Header Message #n Creation Order (optional)This space inserted only to align table nicely

Header Message Data #n

Gap (optional, variable size)
Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Signature

+

The ASCII character string “OCHK” + is used to indicate the + beginning of an object header continuation block. This gives file + consistency checking utilities a better chance of reconstructing a + damaged file. +

+

Header Message #n Type

+

Same format as version 1 of the object header, described above. +

Size of Header Message #n Data

+

Same format as version 1 of the object header, described above. +

Header Message #n Flags

+

Same format as version 1 of the object header, described above. +

Header Message #n Creation Order

+

This field stores the order that a message of a given type + was created in.

+

This field is present if bit 2 of flags is set.

+

Header Message #n Data

+

Same format as version 1 of the object header, described above. +

Gap

+

A gap in an object header chunk is inferred by the end of the + messages for the chunk before the beginning of the chunk’s + checksum. Gaps are always smaller than the size of an + object header message prefix (message type + message size + + message flags).

+

Gaps are formed when a message (typically an attribute message) + in an earlier chunk is deleted and a message from a later + chunk that does not quite fit into the free space is moved + into the earlier chunk.

+

Checksum

+

This is the checksum for the object header chunk. +

+
+
+ +
+

IV.A.2.r. The Symbol Table +Message

+ + +
+ + + + + + + + +
Header Message Name: Symbol Table + Message
Header Message Type: 0x0011
Length: Fixed
Status: Required for + “old style” groups; may not be repeated.
Description:Each “old style” group has a v1 B-tree and a + local heap for storing symbol table entries, which are located + with this message.
Format of data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + +
+ Symbol Table Message +
bytebytebytebyte

v1 B-tree AddressO


Local Heap AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription

v1 B-tree Address

This value is the address of the v1 B-tree containing the + symbol table entries for the group.

Local Heap Address

This value is the address of the local heap containing + the link names for the symbol table entries for the group.

+
+ +
+

IV.A.2.s. The Object +Modification Time Message

+ + +
+ + + + + + + + +
Header Message Name: Object + Modification Time
Header Message Type: 0x0012
Length: Fixed
Status: Optional; may not be + repeated.
Description:The object modification time is a timestamp which indicates + the time of the last modification of an object. The time is + updated when any object header message changes according to + the system clock where the change was posted.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + +
+ Modification Time Message +
bytebytebytebyte
VersionReserved (zero)
Seconds After UNIX Epoch
+
+ +
+
+ + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number is used for changes in the format of Object Modification Time + and is described here: + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by Version 1.6.1 and after of the library to encode time. In + this version, the time is the seconds after Epoch.

+

Seconds After UNIX Epoch

A 32-bit unsigned integer value that stores the number of + seconds since 0 hours, 0 minutes, 0 seconds, January 1, 1970, + Coordinated Universal Time.

+
+ +
+

IV.A.2.t. The B-tree +‘K’ Values Message

+ + +
+ + + + + + + + +
Header Message Name: B-tree + ‘K’ Values
Header Message Type: 0x0013
Length: Fixed
Status: Optional; may not be + repeated.
Description:This message retrieves non-default ‘K’ values + for internal and leaf nodes of a group or indexed storage v1 + B-trees. This message is only found in the superblock + extension.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + +
+ B-tree ‘K’ Values Message +
bytebytebytebyte
VersionIndexed Storage Internal Node KThis space inserted only to align table nicely
Group Internal Node KGroup Leaf Node K
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This document describes + version 0.

+

Indexed Storage Internal Node K

This is the node ‘K’ value for each internal node of an + indexed storage v1 B-tree. See the description of this field + in version 0 and 1 of the superblock as well the section on + v1 B-trees. +

+

Group Internal Node K

This is the node ‘K’ value for each internal node of a group + v1 B-tree. See the description of this field in version 0 and + 1 of the superblock as well as the section on v1 B-trees. +

+

Group Leaf Node K

This is the node ‘K’ value for each leaf node of a group v1 + B-tree. See the description of this field in version 0 and 1 + of the superblock as well as the section on v1 B-trees. +

+
+
+ +
+

IV.A.2.u. The Driver Info +Message

+ + +
+ + + + + + + + + +
Header Message Name: Driver + Info
Header Message Type: 0x0014
Length: Varies
Status: Optional; may not be + repeated.
+ Description:This message contains information needed by the file driver + to reopen a file. This message is only found in the + superblock extension: see the + “Disk Format: Level 0C - Superblock Extension” + section for more information. For more information on the fields + in the driver info message, see the + “Disk Format : Level 0B - File Driver Info” + section; those who use the multi and family file drivers will + find this section particularly helpful.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Driver Info Message +
bytebytebytebyte
VersionThis space inserted only to align table nicely

Driver Identification
Driver Information SizeThis space inserted only to align table nicely


Driver Information (variable size)


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This document describes + version 0.

+

Driver Identification

This is an eight-byte ASCII string without null termination which + identifies the driver. +

+

Driver Information Size

The size in bytes of the Driver Information field of this + message.

+

Driver Information

Driver information is stored in a format defined by the file driver.

+
+
+ +
+

IV.A.2.v. The Attribute Info +Message

+ + +
+ + + + + + + + +
Header Message Name: Attribute + Info
Header Message Type: 0x0015
Length: Varies
Status: Optional; may not be + repeated.
Description:This message stores information about the attributes on an + object, such as the maximum creation index for the attributes + created and the location of the attribute storage when the + attributes are stored “densely”.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Attribute Info Message +
bytebytebytebyte
VersionFlagsMaximum Creation Index (optional)

Fractal Heap AddressO


Attribute Name v2 B-tree AddressO


Attribute Creation Order v2 B-tree AddressO (optional)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This document describes + version 0.

+

Flags

This is the attribute index information flag with the + following definition: + + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, creation order for attributes is tracked. +
1If set, creation order for attributes is indexed. +
2-7Reserved

+ +

Maximum Creation Index

The is the maximum creation order index value for the + attributes on the object.

+

This field is present if bit 0 of Flags is set.

+

Fractal Heap Address

This is the address of the fractal heap to store dense + attributes.

+

Attribute Name v2 B-tree Address

This is the address of the version 2 B-tree to index the + names of densely stored attributes.

+

Attribute Creation Order v2 B-tree Address

This is the address of the version 2 B-tree to index the + creation order of densely stored attributes.

+

This field is present if bit 1 of Flags is set.

+
+
+ +
+

IV.A.2.w. The Object Reference +Count Message

+ + +
+ + + + + + + + +
Header Message Name: Object Reference + Count
Header Message Type: 0x0016
Length: Fixed
Status: Optional; may not be + repeated.
Description:This message stores the number of hard links (in groups or + objects) pointing to an object: in other words, its + reference count.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + +
+ Object Reference Count +
bytebytebytebyte
VersionThis space inserted only to align table nicely
Reference count
+
+ +
+
+ + + + + + + + + + + + + + + + +
Field NameDescription

Version

The version number for this message. This document describes + version 0.

+

Reference Count

The unsigned 32-bit integer is the reference count for the + object. This message is only present in “version 2” + (or later) object headers, and if not present those object + header versions, the reference count for the object is assumed + to be 1.

+
+
+ +
+

IV.A.2.x. The File Space Info +Message

+ + +
+ + + + + + + + +
Header Message Name: File Space + Info
Header Message Type: 0x0018
Length: Fixed
Status: Optional; may not be + repeated.
+ Description:This message stores the file space management strategy (see + description below) that the library uses in handling file space + request for the file. It also contains the free-space section + threshold used by the library’s free-space managers for + the file. If the strategy is 1, this message also contains the + addresses of the file’s free-space managers which track + free space for each type of file space allocation. There are + six basic types of file space allocation: superblock, B-tree, + raw data, global heap, local heap, and object header. See the + description of Free-space + Manager as well the description of allocation types in + Appendix B.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ File Space Info +
bytebytebytebyte
VersionStrategyThresholdL
Super-block Free-space Manager AddressO
B-tree Free-space Manager AddressO
Raw Data Free-space Manager AddressO
Global Heap Free-space Manager AddressO
Local Heap Free-space Manager AddressO
Object Header Free-space Manager AddressO
+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are of the size + specified in “Size of Offsets” field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are of the size + specified in “Size of Lengths” field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameDescription

Version

This is the version number of this message. This document describes + version 0.

+

Strategy

This is the file space management strategy for the file. + There are four types of strategies: + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
1With this strategy, the HDF5 Library’s free-space managers track the + free space that results from the manipulation of HDF5 objects + in the HDF5 file. The free space information is saved when the + file is closed, and reloaded when the file is reopened. +
+ When space is needed for file metadata or raw data, + the HDF5 Library first requests space from the library’s free-space + managers. If the request is not satisfied, the library requests space + from the aggregators. If the request is still not satisfied, + the library requests space from the virtual file driver. + That is, the library will use all of the mechanisms for allocating + space. +
2This is the HDF5 Library’s default file space management strategy. + With this strategy, the library’s free-space managers track the free space + that results from the manipulation of HDF5 objects in the HDF5 file. + The free space information is NOT saved when the file is closed and + the free space that exists upon file closing becomes unaccounted + space in the file. +
+ As with strategy #1, the library will try all of the mechanisms + for allocating space. When space is needed for file metadata or + raw data, the library first requests space from the free-space + managers. If the request is not satisfied, the library requests + space from the aggregators. If the request is still not satisfied, + the library requests space from the virtual file driver. +
3With this strategy, the HDF5 Library does not track free space that results + from the manipulation of HDF5 objects in the HDF5 file and + the free space becomes unaccounted space in the file. +
+ When space is needed for file metadata or raw data, + the library first requests space from the aggregators. + If the request is not satisfied, the library requests space from + the virtual file driver. +
4With this strategy, the HDF5 Library does not track free space that results + from the manipulation of HDF5 objects in the HDF5 file and + the free space becomes unaccounted space in the file. +
+ When space is needed for file metadata or raw data, + the library requests space from the virtual file driver. +

+

Threshold

This is the free-space section threshold. + The library’s free-space managers will track only + free-space sections with size greater than or equal to + threshold. The default is to track free-space + sections of all sizes.

+

Superblock Free-space Manager Address

This is the address of the free-space manager for + H5FD_MEM_SUPER allocation type. +

+

B-tree Free-space Manager Address

This is the address of the free-space manager for + H5FD_MEM_BTREE allocation type. +

+

Raw Data Free-space Manager Address

This is the address of the free-space manager for + H5FD_MEM_DRAW allocation type. +

+

Global Heap Free-space Manager Address

This is the address of the free-space manager for + H5FD_MEM_GHEAP allocation type. +

+

Local Heap Free-space Manager Address

This is the address of the free-space manager for + H5FD_MEM_LHEAP allocation type. +

+

Object Header Free-space Manager Address

This is the address of the free-space manager for + H5FD_MEM_OHDR allocation type. +

+
+
+
+ + +
+

+IV.B. Disk Format: Level 2B - Data Object Data Storage

+ +

The data for an object is stored separately from its header + information in the file and may not actually be located in the HDF5 file + itself if the header indicates that the data is stored externally. The + information for each record in the object is stored according to the + dimensionality of the object (indicated in the dataspace header message). + Multi-dimensional array data is stored in C order; in other words, the + “last” dimension changes fastest.

+ +

Data whose elements are composed of atomic datatypes are stored in IEEE + format, unless they are specifically defined as being stored in a different + machine format with the architecture-type information from the datatype + header message. This means that each architecture will need to [potentially] + byte-swap data values into the internal representation for that particular + machine.

+ +

Data with a variable-length datatype is stored in the global heap + of the HDF5 file. Global heap identifiers are stored in the + data object storage.

+ +

Data whose elements are composed of reference datatypes are stored in + several different ways depending on the particular reference type involved. + Object pointers are just stored as the offset of the object header being + pointed to with the size of the pointer being the same number of bytes as + offsets in the file.

+ +

Dataset region references are stored as a heap-ID which points to +the following information within the file-heap: an offset of the object +pointed to, number-type information (same format as header message), +dimensionality information (same format as header message), sub-set start +and end information (in other words, a coordinate location for each), +and field start and end names (in other words, a [pointer to the] string +indicating the first field included and a [pointer to the] string name +for the last field).

+ +

Data of a compound datatype is stored as a contiguous stream of the items + in the structure, with each item formatted according to its datatype.

+ + + +
+
+
+

+V. Appendix A: Definitions

+ +

Definitions of various terms used in this document are included in +this section.

+ +
+ + + + + + + + + + + + + + + + +
TermDefinition
Undefined AddressThe undefined + address for a file is a file address with all bits + set: in other words, 0xffff...ff.
Unlimited SizeThe unlimited size + for a size is a value with all bits set: in other words, + 0xffff...ff.
+
+ + + +
+
+
+

+VI. Appendix B: File Memory Allocation Types

+ +

There are six basic types of file memory allocation as follows: +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic Allocation TypeDescription
H5FD_MEM_SUPERFile memory allocated for Superblock.
H5FD_MEM_BTREEFile memory allocated for B-tree.
H5FD_MEM_DRAWFile memory allocated for raw data.
H5FD_MEM_GHEAPFile memory allocated for Global Heap.
H5FD_MEM_LHEAPFile memory allocated for Local Heap.
H5FD_MEM_OHDRFile memory allocated for Object Header.
+
+ +

There are other file memory allocation types that are mapped to the +above six basic allocation types because they are similar in nature. +The mapping is listed in the following table: +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic Allocation TypeMapping of Allocation Types to Basic Allocation Types
H5FD_MEM_SUPERnone
H5FD_MEM_BTREEH5FD_MEM_SOHM_INDEX
H5FD_MEM_DRAWH5FD_MEM_FHEAP_HUGE_OBJ
H5FD_MEM_GHEAPnone
H5FD_MEM_LHEAPH5FD_MEM_FHEAP_DBLOCK, H5FD_MEM_FSPACE_SINFO
H5FD_MEM_OHDRH5FD_MEM_FHEAP_HDR, H5FD_MEM_FHEAP_IBLOCK, H5FD_MEM_FSPACE_HDR, H5FD_MEM_SOHM_TABLE
+
+ +

Allocation types that are mapped to basic allocation types are described below: +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Allocation TypeDescription
H5FD_MEM_FHEAP_HDRFile memory allocated for Fractal Heap Header.
H5FD_MEM_FHEAP_DBLOCKFile memory allocated for Fractal Heap Direct Blocks.
H5FD_MEM_FHEAP_IBLOCKFile memory allocated for Fractal Heap Indirect Blocks.
H5FD_MEM_FHEAP_HUGE_OBJFile memory allocated for huge objects in the fractal heap.
H5FD_MEM_FSPACE_HDRFile memory allocated for Free-space Manager Header.
H5FD_MEM_FSPACE_SINFOFile memory allocated for Free-space Section List of the free-space manager.
H5FD_MEM_SOHM_TABLEFile memory allocated for Shared Object Header Message Table.
H5FD_MEM_SOHM_INDEXFile memory allocated for Shared Message Record List.
+
+ + diff --git a/doxygen/examples/H5.format.html b/doxygen/examples/H5.format.html new file mode 100644 index 0000000..e16805f --- /dev/null +++ b/doxygen/examples/H5.format.html @@ -0,0 +1,20400 @@ + + + + HDF5 File Format Specification Version 3.0 + + + + + + + + + + + +
+ + + + + + + +
+
    +
  1. Introduction
  2. + +
      +
    1. This Document
    2. +
    3. Changes for HDF5 1.12
    4. +
    5. Changes for HDF5 1.10
    6. +
    +
    + +
  3. Disk Format: Level 0 - File Metadata
  4. + +
      +
    1. Disk Format: Level 0A - Format Signature + and Superblock
    2. +
    3. Disk Format: Level 0B - File Driver + Info
    4. +
    5. Disk Format: Level 0C - Superblock + Extension
    6. +
    +
    +
  5. Disk Format: Level 1 - File Infrastructure
  6. + +
      +
    1. Disk Format: Level 1A - B-trees and B-tree + Nodes +
        +
      1. Disk Format: Level 1A1 - Version 1 + B-trees
      2. +
      3. Disk Format: Level 1A2 - Version 2 + B-trees
      4. +
      +
    2. +
    3. Disk Format: Level 1B - Group Symbol + Table Nodes
    4. +
    5. Disk Format: Level 1C - Symbol + Table Entry
    6. +
    7. Disk Format: Level 1D - Local Heaps
    8. +
    9. Disk Format: Level 1E - Global Heap
    10. +
    11. Disk Format: Level 1F - Global Heap + Block for Virtual Datasets
    12. +
    13. Disk Format: Level 1G - Fractal Heap
    14. +
    15. Disk Format: Level 1H - Free-space + Manager
    16. +
    17. Disk Format: Level 1I - Shared Object + Header Message Table
    18. +
    +
    +
  7. Disk Format: Level 2 - Data Objects
  8. + +
      +
    1. Disk Format: Level 2A - Data Object Headers
    2. +
        +
      1. Disk Format: Level 2A1 - + Data Object Header Prefix +
          +
        1. Version 1 Data + Object Header Prefix
        2. +
        3. Version 2 Data + Object Header Prefix
        4. +
        +
      2. +
      3. Disk Format: Level 2A2 - + Data Object Header Messages
      4. +
          +
        1. The NIL Message
        2. +
        3. The Dataspace Message
        4. +
        5. The Link Info Message
        6. +
        7. The Datatype Message
        8. +
        9. The Data Storage - + Fill Value (Old) Message
        10. +
        +
      +
    +
    +
+
  +
    +
  1. Disk Format: Level 2 - Data + Objects (Continued)
  2. +
      +
    1. Disk Format: Level 2A - Data Object + Headers (Continued) +
        +
      1. Disk Format: Level 2A2 - + Data Object Header Messages (Continued)
      2. +
          +
        1. The Data Storage - + Fill Value Message
        2. +
        3. The Link Message
        4. +
        5. The Data Storage - + External Data Files Message
        6. +
        7. The Data Layout Message
        8. +
        9. The Bogus Message
        10. +
        11. The Group Info + Message
        12. +
        13. The Data Storage - + Filter Pipeline Message
        14. +
        15. The Attribute + Message
        16. +
        17. The Object Comment + Message
        18. +
        19. The Object + Modification Time (Old) Message
        20. +
        21. The Shared Message + Table Message
        22. +
        23. The Object Header + Continuation Message
        24. +
        25. The Symbol + Table Message
        26. +
        27. The Object + Modification Time Message
        28. +
        29. The B-tree + ‘K’ Values Message
        30. +
        31. The Driver Info + Message
        32. +
        33. The Attribute Info + Message
        34. +
        35. The Object Reference + Count Message
        36. +
        37. The File Space Info + Message
        38. +
        +
      +
    2. +
    3. Disk Format: Level 2B - Data Object Data Storage
    4. +
    +
    +
  3. Appendix A: Definitions
  4. +
  5. Appendix B: File Space Allocation + Types
  6. +
  7. + Appendix C: Types of Indexes for Dataset Chunks
  8. + +
      +
    1. The Single Chunk Index
    2. +
    3. The Implicit Index
    4. +
    5. The Fixed Array Index
    6. +
    7. The Extensible Array Index
    8. +
    9. The Version 2 B-trees Index
    10. +
    +
    +
  9. + Appendix D: Encoding for Dataspace and Reference
  10. + +
      +
    1. Dataspace Encoding
    2. +
    3. Reference Encoding (Revised)
    4. +
    5. Reference Encoding (Backward Compatibility)
    6. +
    +
    +
+
+
+ + +

I. Introduction

+ + + + + + + +
  +
+ HDF5 Groups +
 
  + Figure 1: Relationships among the HDF5 root group, other groups, and objects +
+
 
  + HDF5 Objects +  
  + Figure 2: HDF5 objects -- datasets, datatypes, or dataspaces +
+
 
+ + +

The format of an HDF5 file on disk encompasses several + key ideas of the HDF4 and AIO file formats as well as + addressing some shortcomings therein. The new format is + more self-describing than the HDF4 format and is more + uniformly applied to data objects in the file.

+ +

An HDF5 file appears to the user as a directed graph. + The nodes of this graph are the higher-level HDF5 objects + that are exposed by the HDF5 APIs:

+ +
    +
  • Groups
  • +
  • Datasets
  • +
  • Committed (formerly Named) datatypes
  • +
+ +

At the lowest level, as information is actually written to the disk, + an HDF5 file is made up of the following objects:

+
    +
  • A superblock
  • +
  • B-tree nodes
  • +
  • Heap blocks
  • +
  • Object headers
  • +
  • Object data
  • +
  • Free space
  • +
+ +

The HDF5 Library uses these low-level objects to represent the + higher-level objects that are then presented to the user or + to applications through the APIs. For instance, a group is an + object header that contains a message that points to a local + heap (for storing the links to objects in the group) and to a + B-tree (which indexes the links). A dataset is an object header + that contains messages that describe the datatype, dataspace, + layout, filters, external files, fill value, and other elements + with the layout message pointing to either a raw data chunk or + to a B-tree that points to raw data chunks.

+ + +

I.A. This Document

+ +

This document describes the lower-level data objects; + the higher-level objects and their properties are described + in the HDF5 User’s Guide.

+ +

Three levels of information comprise the file format. + Level 0 contains basic information for identifying and + defining information about the file. Level 1 information contains + the information about the pieces of a file shared by many objects + in the file (such as B-trees and heaps). Level 2 is the rest + of the file and contains all of the data objects with each object + partitioned into header information, also known as + metadata, and data.

+ +

The various components of the lower-level data objects are + described in pairs of tables. The first table shows the format + layout, and the second table describes the fields. The titles + of format layout tables begin with “Layout”. The + titles of the tables where the fields are described begin with + “Fields”. For example, the table that describes the + format of the version 2 B-tree header has + a title of “Layout: Version 2 B-tree Header”, and the + fields in the version 2 B-tree header are described in the table + titled “Fields: Version 2 B-tree Header”. + +

The sizes of various fields in the following layout tables are + determined by looking at the number of columns the field spans + in the table. There are exceptions:

+
    +
  • The size may be overridden by specifying a size in + parentheses
  • +
  • The size of addresses is determined by the + Size of Offsets field + in the superblock and is indicated in this document with a + superscripted ‘O’
  • +
  • The size of length fields is determined by the + Size of Lengths field in + the superblock and is indicated in this document with a + superscripted ‘L’
  • +
+ +

Values for all fields in this document should be treated as unsigned + integers, unless otherwise noted in the description of a field. + Additionally, all metadata fields are stored in little-endian byte + order. +

+ +

All checksums used in the format are computed with the + Jenkins’ + lookup3 algorithm. +

+ +

Whenever a bit flag or field is mentioned for an entry, bits are + numbered from the lowest bit position in the entry. +

+ +

Various format tables in this document have cells with + “This space inserted only to align table nicely”. These + entries in the table are just to make the table presentation nicer + and do not represent any values or padding in the file. +

+ + +

I.B. Changes for HDF5 1.12

+

The following sections have been + changed or added for the 1.12 release:

+ + + + +

I.C. Changes for HDF5 1.10

+ +

The following sections have been + changed or added for the 1.10 release:

+ + + + +

+ II. Disk Format: Level 0 - File Metadata

+ + + +

+ II.A. Disk Format: Level 0A - Format Signature and Superblock

+ +

The superblock may begin at certain predefined offsets within + the HDF5 file, allowing a block of unspecified content for + users to place additional information at the beginning (and + end) of the HDF5 file without limiting the HDF5 Library’s + ability to manage the objects within the file itself. This + feature was designed to accommodate wrapping an HDF5 file in + another file format or adding descriptive information to an HDF5 + file without requiring the modification of the actual file’s + information. The superblock is located by searching for the + HDF5 format signature at byte offset 0, byte offset 512, and at + successive locations in the file, each a multiple of two of + the previous location; in other words, at these byte offsets: + 0, 512, 1024, 2048, and so on.

+ +

The superblock is composed of the format signature, followed by a + superblock version number and information that is specific to each + version of the superblock. + +

Currently, there are four versions of the superblock format: +

    +
  • Version 0 is the default format.
  • +
  • Version 1 is the same as version 0 but with the + “Indexed Storage Internal Node K” field + for storing non-default B-tree ‘K’ value.
  • +
  • Version 2 has some fields eliminated and compressed from + superblock format versions 0 and 1. It has added checksum support + and superblock extension to store additional superblock + metadata.
  • +
  • Version 3 is the same as version 2 except that the field + “File Consistency Flags” is used for file + locking. This format version will enable support for the latest + version.
  • +
+ +

Versions 0 and 1 of the superblock are described below:

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Superblock (Versions 0 and 1) +
bytebytebytebyte

Format Signature + (8 bytes)

Version # of SuperblockVersion # of File’s Free Space StorageVersion # of Root Group Symbol Table EntryReserved (zero)
Version Number of Shared Header Message FormatSize of OffsetsSize of LengthsReserved (zero)
Group Leaf Node KGroup Internal Node K
File Consistency Flags
Indexed Storage Internal Node K1Reserved + (zero)1

Base AddressO


Address of File Free space InfoO


End of File AddressO


Driver Information Block AddressO

Root Group Symbol Table Entry
+ + + + + + + + +
  + (Items marked with a ‘1’ in the above table are + new in version 1 of the superblock.) +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Superblock (Versions 0 and 1) +
Field NameDescription

Format Signature

This field contains a constant value and can be used to + quickly identify a file as being an HDF5 file. The + constant value is designed to allow easy identification of + an HDF5 file and to allow certain types of data corruption + to be detected. The file signature of an HDF5 file always + contains the following values:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Decimal:13772687013102610
Hexadecimal:894844460d0a1a0a
ASCII C Notation:\211HDF\r\n\032\n
+
+

This signature both identifies the file as an HDF5 file + and provides for immediate detection of common + file-transfer problems. The first two bytes distinguish + HDF5 files on systems that expect the first two bytes to + identify the file type uniquely. The first byte is + chosen as a non-ASCII value to reduce the probability + that a text file may be misrecognized as an HDF5 file; + also, it catches bad file transfers that clear bit + 7. Bytes two through four name the format. The CR-LF + sequence catches bad file transfers that alter newline + sequences. The control-Z character stops file display + under MS-DOS. The final line feed checks for the inverse + of the CR-LF translation problem. (This is a direct + descendent of the + PNG file + signature.)

+

This field is present in version 0+ of the superblock. +

Version Number of the Superblock

This value is used to determine the format of the + information in the superblock. When the format of the + information in the superblock is changed, the version number + is incremented to the next integer and can be used to + determine how the information in the superblock is + formatted.

+ +

Values of 0, 1 and 2 are defined for this field (the + format of version 2 is described below, not here). +

+ +

This field is present in version 0+ of the superblock. +

+

Version Number of the File’s Free Space + Information

+

This value is used to determine the format of the + file’s free space information. +

+

The only value currently valid in this field is ‘0’, which + indicates that the file’s free space is as described + below. +

+ +

This field is present in versions 0 and 1 of the + superblock. +

+

Version Number of the Root Group Symbol Table + Entry

This value is used to determine the format of the + information in the Root Group Symbol Table Entry. When the + format of the information in that field is changed, the + version number is incremented to the next integer and can be + used to determine how the information in the field + is formatted.

+

The only value currently valid in this field is ‘0’, + which indicates that the root group symbol table entry is + formatted as described below.

+

This field is present in version 0 and 1 of the + superblock.

+

Version Number of the Shared Header Message Format

This value is used to determine the format of the + information in a shared object header message. Since the format + of the shared header messages differs from the other private + header messages, a version number is used to identify changes + in the format. +

+

The only value currently valid in this field is ‘0’, which + indicates that shared header messages are formatted as + described below. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

Size of Offsets

This value contains the number of bytes used to store + addresses in the file. The values for the addresses of + objects in the file are offsets relative to a base address, + usually the address of the superblock signature. This + allows a wrapper to be added after the file is created + without invalidating the internal offset locations. +

+ +

This field is present in version 0+ of the superblock. +

+

Size of Lengths

This value contains the number of bytes used to store + the size of an object. +

+

This field is present in version 0+ of the superblock. +

+

Group Leaf Node K

+

Each leaf node of a group B-tree will have at + least this many entries but not more than twice this + many. If a group has a single leaf node then it + may have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

Group Internal Node K

+

Each internal node of a group B-tree will have at + least this many entries but not more than twice this + many. If the group has only one internal + node then it might have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

File Consistency Flags

+

This field is unused and should be ignored. +

+

This field is present in version 0+ of the superblock. +

+

Indexed Storage Internal Node K

+

Each internal node of an indexed storage B-tree will have at + least this many entries but not more than twice this + many. If the index storage B-tree has only one internal + node then it might have fewer entries. +

+

This value must be greater than zero. +

+

See the description of B-trees below. +

+ +

This field is present in version 1 of the superblock. +

+

Base Address

+

This is the absolute file address of the first byte of + the HDF5 data within the file. The library currently + constrains this value to be the absolute file address + of the superblock itself when creating new files; + future versions of the library may provide greater + flexibility. When opening an existing file and this address does + not match the offset of the superblock, the library assumes + that the entire contents of the HDF5 file have been adjusted in + the file and adjusts the base address and end of file address to + reflect their new positions in the file. Unless otherwise noted, + all other file addresses are relative to this base + address. +

+ +

This field is present in version 0+ of the superblock. +

+

Address of Global Free-space Index

+

The file’s free space is not persistent for version 0 and 1 of + the superblock. + Currently this field always contains the + undefined address. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

End of File Address

+

This is the absolute file address of the first byte past + the end of all HDF5 data. It is used to determine whether a + file has been accidently truncated and as an address where + file data allocation can occur if space from the free list is + not used. +

+ +

This field is present in version 0+ of the superblock. +

+

Driver Information Block Address

+

This is the relative file address of the file driver + information block which contains driver-specific + information needed to reopen the file. If there is no + driver information block then this entry should be the + undefined address. +

+ +

This field is present in version 0 and 1 of the superblock. +

+

Root Group Symbol Table Entry

+

This is the symbol table entry + of the root group, which serves as the entry point into + the group graph for the file. +

+ +

This field is present in version 0 and 1 of the superblock. +

+
+
+ +
+
+
+

Versions 2 and 3 of the superblock are described below:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Superblock (Versions 2 and 3) +
bytebytebytebyte

Format Signature + (8 bytes)

Version # of SuperblockSize of OffsetsSize of LengthsFile Consistency Flags

Base AddressO


Superblock Extension AddressO


End of File AddressO


Root Group Object Header AddressO

Superblock Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Superblock (Versions 2 and 3) +
Field NameDescription

Format Signature

+

This field is the same as described for versions 0 and 1 of the + superblock. +

Version Number of the Superblock

+

This field has a value of 2 and has the same meaning as for + versions 0 and 1. +

+

Size of Offsets

+

This field is the same as described for + versions 0 and 1 of the + superblock. +

+

Size of Lengths

+

This field is the same as described for + versions 0 and 1 of the + superblock. +

+

File Consistency Flags

+

For superblock version + 2: This field is unused and should be ignored.

+

For superblock version + 3: This value contains flags to ensure file consistency for + file locking. Currently, the following bit flags are defined: +

    +
  • Bit 0 if set indicates that the file has been opened for + write access.
  • +
  • Bit 1 is reserved for future use.
  • +
  • Bit 2 if set indicates that the file has been opened for + single-writer/multiple-reader (SWMR) write access.
  • +
  • Bits 3-7 are reserved for future use.
  • +
+

+ Bit 0 should be set as the first action when a file has been + opened for write access. Bit 2 should be set when a file + has been opened for SWMR write access. These two bits should + be cleared only as the final action when closing a file. +

+

This field is present in version 0+ of the superblock. +

+

The size of this + field has been reduced from 4 bytes in superblock format + versions 0 and 1 to 1 byte. +

+

Base Address

+

This field is the same as described for versions 0 and + 1 of the superblock. +

+

Superblock Extension Address

+

The field is the address of the object header for the + superblock extension. + If there is no extension then this entry should be the + undefined address. +

+

End of File Address

+

This field is the same as described for versions 0 and 1 of the + superblock. +

+

Root Group Object Header Address

+

This is the address of + the root group object header, + which serves as the entry point into the group graph for the file. +

+

Superblock Checksum

+

The checksum for the superblock. +

+
+
+ +
+ +

+ II.B. Disk Format: Level 0B - File Driver Info

+ +

The driver information block is an optional region of the + file which contains information needed by the file driver + to reopen a file. The format is described below:

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Driver Information Block +
bytebytebytebyte
VersionReserved
Driver Information Size

Driver Identification + (8 bytes)



Driver Information + (variable size)


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Driver Information Block +
Field NameDescription

Version

+

The version number of the Driver Information Block. + This document describes version 0. +

+

Driver Information Size

+

The size in bytes of the Driver Information field. +

+

Driver Identification

+

This is an eight-byte ASCII string without null + termination which identifies the driver and/or version number + of the Driver Information Block. The predefined driver encoded + in this field by the HDF5 Library is identified by the + letters NCSA followed by the first four characters of + the driver name. If the Driver Information block is not + the original version then the last letter(s) of the + identification will be replaced by a version number in + ASCII, starting with 0. +

+

+ Identification for user-defined drivers is also eight-byte long. + It can be arbitrary but should be unique to avoid + the four character prefix “NCSA”. +

+

Driver Information

Driver information is stored in a format defined by the + file driver (see description below).
+
+ +
+

The two drivers encoded in the Driver Identification + field are as follows:

+
    +
  • + Multi driver: +

    + The identifier for this driver is “NCSAmulti”. + This driver provides a mechanism for segregating raw data and different types of metadata + into multiple files. + These files are viewed by the library as a single virtual HDF5 file with a single file address. + A maximum of 6 files will be created for the following data: + superblock, B-tree, raw data, global heap, local heap, and object header. + More than one type of data can be written to the same file. +

  • +
  • + Family driver +

    + The identifier for this driver is “NCSAfami” and is encoded in this field for library version 1.8 and after. + This driver is designed for systems that do not support files larger than 2 gigabytes + by splitting the HDF5 file address space across several smaller files. + It does nothing to segregate metadata and raw data; + they are mixed in the address space just as they would be in a single contiguous file. +

  • +
+

The format of the Driver Information field for the + above two drivers are described below:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Multi Driver Information +
bytebytebytebyte
Member MappingMember MappingMember MappingMember Mapping
Member MappingMember MappingReservedReserved

Address of Member File 1


End of Address for Member File 1


Address of Member File 2


End of Address for Member File 2


... ...


Address of Member File N


End of Address for Member File N


Name of Member File 1 + (variable size)


Name of Member File 2 + (variable size)


... ...


Name of Member File N + (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Multi Driver Information +
Field NameDescription

Member Mapping

These fields are integer values from 1 to 6 + indicating how the data can be mapped to or merged with another type of + data. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Member MappingDescription
1The superblock data.
2The B-tree data.
3The raw data.
4The global heap data.
5The local heap data.
6The object header data.

+

For example, if the third field has the value 3 and all the rest have the + value 1, it means there are two files: one for raw data, and one for superblock, + B-tree, global heap, local heap, and object header.

+

Reserved

These fields are reserved and should always be zero.

Address of Member File N

This field Specifies the virtual address at which the member file starts.

+

N is the number of member files.

+

End of Address for Member File N

This field is the end of the allocated address for the member file. +

Name of Member File N

This field is the null-terminated name of the member file and + its length should be multiples of 8 bytes. + Additional bytes will be padded with NULLs. The default naming + convention is %s-X.h5, where X is one of the letters + s (for superblock), b (for B-tree), r (for raw data), + g (for global heap), l (for local heap), and o (for + object header). The name of the whole HDF5 file will substitute the %s + in the string. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + +
+ Layout: Family Driver Information +
bytebytebytebyte

Size of Member File

+
+ +
+
+ + + + + + + + + + + +
+ Fields: Family Driver Information +
Field NameDescription

Size of Member File

This field is the size of the member file in the family of files.

+
+ +

+ II.C. Disk Format: Level 0C - Superblock Extension

+ +

The superblock extension is used to store superblock metadata + which is either optional, or added after the version of the superblock + was defined. Superblock extensions may only exist when version 2 + or later of the superblock is used. A superblock extension is an object + header which may hold the following messages:

+ + + + +

+ III. Disk Format: Level 1 - File Infrastructure

+ +

+ III.A. Disk Format: Level 1A - B-trees and B-tree Nodes

+ +

B-trees allow flexible storage for objects which tend to grow + in ways that cause the object to be stored discontiguously. B-trees + are described in various algorithms books including “Introduction to + Algorithms” by Thomas H. Cormen, Charles E. Leiserson, and Ronald + L. Rivest. B-trees are used in several places in the HDF5 file format, + when an index is needed for another data structure.

+ +

The version 1 B-tree structure described below is the original + index structure. The version 1 B-trees are being phased out in + favor of the version 2 B-trees described below. Note that both + types of structures may be found in the same file depending on + the application settings when creating the file.

+ +

+ III.A.1. Disk Format: Level 1A1 - Version 1 B-trees

+ +

Version 1 B-trees in HDF5 files are an implementation of the + B-link tree. The sibling nodes at a particular level in + the tree are stored in a doubly-linked list. See the + “Efficient Locking for Concurrent Operations on B-trees” + paper by Phillip Lehman and S. Bing Yao as published in the + ACM Transactions on Database Systems, Vol. 6, No. 4, + December 1981.

+ +

The B-trees implemented by the file format contain one more + key than the number of children. In other words, each child + pointer out of a B-tree node has a left key and a right key. + The pointers out of internal nodes point to sub-trees while + the pointers out of leaf nodes point to symbol nodes and + raw data chunks. + Aside from that difference, internal nodes and leaf nodes + are identical.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: B-tree Nodes +
bytebytebytebyte
Signature
Node TypeNode LevelEntries Used

Address of Left SiblingO


Address of Right SiblingO

Key 1 (variable size)

Address of Child 1O

Key 2 (variable size)

Address of Child 2O

...
Key 2K (variable size)

Address of Child 2KO

Key 2K+1 + (variable size)
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: B-tree Nodes +
Field NameDescription

Signature

+

The ASCII character string “TREE” + is used to indicate the beginning of a B-tree node. This + gives file consistency checking utilities a better chance + of reconstructing a damaged file. +

+

Node Type

+

Each B-tree points to a particular type of data. + This field indicates the type of data as well as + implying the maximum degree K of the tree and + the size of each Key field. + + + + + + + + + + + + + + + +
Node TypeDescription
0This tree points to group nodes.
1This tree points to raw data chunk nodes.

+

Node Level

+

The node level indicates the level at which this node + appears in the tree (leaf nodes are at level zero). Not + only does the level indicate whether child pointers + point to sub-trees or to data, but it can also be used + to help file consistency checking utilities reconstruct + damaged trees. +

+

Entries Used

+

This determines the number of children to which this + node points. All nodes of a particular type of tree + have the same maximum degree, but most nodes will point + to less than that number of children. The valid child + pointers and keys appear at the beginning of the node + and the unused pointers and keys appear at the end of + the node. The unused pointers and keys have undefined + values. +

+

Address of Left Sibling

+

This is the relative file address of the left sibling of + the current node. If the current + node is the left-most node at this level then this field + is the undefined address. +

+

Address of Right Sibling

+

This is the relative file address of the right sibling of + the current node. If the current + node is the right-most node at this level then this + field is the undefined address. +

+

Keys and Child Pointers

+

Each tree has 2K+1 keys with 2K + child pointers interleaved between the keys. The number + of keys and child pointers actually containing valid + values is determined by the node’s Entries + Used field. If that field is N, then the + B-tree contains N child pointers and + N+1 keys. +

+

Key

+

The format and size of the key values is determined by + the type of data to which this tree points. The keys are + ordered and are boundaries for the contents of the child + pointer; that is, the key values represented by child + N fall between Key N and Key + N+1. Whether the interval is open or closed on + each end is determined by the type of data to which the + tree points. +

+ +

+ The format of the key depends on the node type. + For nodes of node type 0 (group nodes), the key is formatted as + follows: + + + + + + +
A single field of + Size of Lengths + bytes:Indicates the byte offset into the local heap + for the first object name in the subtree which + that key describes. +
+

+ + +

+ For nodes of node type 1 (chunked raw data nodes), the key is + formatted as follows: + + + + + + + + + + + + + + +
Bytes 1-4:Size of chunk in bytes.
Bytes 4-8:Filter mask, a 32-bit bit field indicating which + filters have been skipped for this chunk. Each filter + has an index number in the pipeline (starting at 0, with + the first filter to apply) and if that filter is skipped, + the bit corresponding to its index is set.
(D + 1) 64-bit fields:The offset of the + chunk within the dataset where D is the number + of dimensions of the dataset, and the last value is the + offset within the dataset’s datatype and should + always be zero. For example, if + a chunk in a 3-dimensional dataset begins at the + position [5,5,5], there will be three + such 64-bit values, each with the value of + 5, followed by a 0 value.
+

+ +

Child Pointer

+

The tree node contains file addresses of subtrees or + data depending on the node level. Nodes at Level 0 point + to data addresses, either raw data chunks or group nodes. + Nodes at non-zero levels point to other nodes of the + same B-tree. +

+

For raw data chunk nodes, the child pointer is the address + of a single raw data chunk. For group nodes, the child pointer + points to a symbol table, which contains + information for multiple symbol table entries. +

+
+
+ +

+ Conceptually, each B-tree node looks like this:

+
+ + + + + + + + + + + + + +
key[0] child[0] key[1] child[1] key[2] ... ... key[N-1] child[N-1] key[N]
+
+
+ + where child[i] is a pointer to a sub-tree (at a level + above Level 0) or to data (at Level 0). + Each key[i] describes an item stored by the B-tree + (a chunk or an object of a group node). The range of values + represented by child[i] is indicated by key[i] + and key[i+1]. + + +

The following question must next be answered: + “Is the value described by key[i] contained in + child[i-1] or in child[i]?” + The answer depends on the type of tree. + In trees for groups (node type 0), the object described by + key[i] is the greatest object contained in + child[i-1] while in chunk trees (node type 1) the + chunk described by key[i] is the least chunk in + child[i].

+ +

That means that key[0] for group trees is sometimes unused; + it points to offset zero in the heap, which is always the + empty string and compares as “less-than” any valid + object name.

+ +

And key[N] for chunk trees is sometimes unused; + it contains a chunk offset which compares as “greater-than” + any other chunk offset and has a chunk byte size of zero + to indicate that it is not actually allocated.

+ +

+ III.A.2. Disk Format: Level 1A2 - Version 2 B-trees

+ +

Version 2 (v2) B-trees are “traditional” B-trees + with one major difference. Instead of just using a simple pointer + (or address in the file) to a child of an internal node, the pointer + to the child node contains two additional pieces of information: + the number of records in the child node itself, and the total number + of records in the child node and all its descendants. Storing this + additional information allows fast array-like indexing to locate + the nth record in the B-tree.

+ +

The entry into a version 2 B-tree is a header which contains global + information about the structure of the B-tree. The root node + address + field in the header points to the B-tree root node, which is either an + internal or leaf node, depending on the value in the header’s + depth field. An internal node consists of records plus + pointers to further leaf or internal nodes in the tree. A leaf node + consists of solely of records. The format of the records depends on + the B-tree type (stored in the header).

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree Header +
bytebytebytebyte
Signature
VersionTypeThis space inserted only to align table nicely
Node Size
Record SizeDepth
Split PercentMerge PercentThis space inserted only to align table nicely

Root Node AddressO

Number of Records in Root NodeThis space inserted only to align table nicely

Total Number of Records in B-treeL

Checksum
+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree Header +
Field NameDescription

Signature

+

The ASCII character string “BTHD” + is used to indicate the header of a version 2 (v2) B-tree + node. +

+

Version

+

The version number for this B-tree header. This document + describes version 0. +

+

Type

+

This field indicates the type of B-tree: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0This B-tree is used for testing only. This + value should not be used for storing + records in actual HDF5 files. +
1This B-tree is used for indexing indirectly accessed, + non-filtered ‘huge’ fractal heap objects. +
2This B-tree is used for indexing indirectly accessed, + filtered ‘huge’ fractal heap objects. +
3This B-tree is used for indexing directly accessed, + non-filtered ‘huge’ fractal heap objects. +
4This B-tree is used for indexing directly accessed, + filtered ‘huge’ fractal heap objects. +
5This B-tree is used for indexing the ‘name’ field for + links in indexed groups. +
6This B-tree is used for indexing the ‘creation order’ + field for links in indexed groups. +
7This B-tree is used for indexing shared object header + messages. +
8This B-tree is used for indexing the ‘name’ field for + indexed attributes. +
9This B-tree is used for indexing the ‘creation order’ + field for indexed attributes. +
10This B-tree is used for indexing chunks of + datasets with no filters and with more than one + dimension of unlimited extent. +
11This B-tree is used for indexing chunks of + datasets with filters and more than one dimension + of unlimited extent. +

+

The format of records for each type is described below.

+

Node Size

+

This is the size in bytes of all B-tree nodes. +

+

Record Size

+

This field is the size in bytes of the B-tree record. +

+

Depth

+

This is the depth of the B-tree. +

+

Split Percent

+

The percent full that a node needs to increase above before it + is split. +

+

Merge Percent

+

The percent full that a node needs to be decrease below before it + is split. +

+

Root Node Address

+

This is the address of the root B-tree node. A B-tree with + no records will have the undefined + address in this field. +

+

Number of Records in Root Node

+

This is the number of records in the root node. +

+

Total Number of Records in B-tree

+

This is the total number of records in the entire B-tree. +

+

Checksum

+

This is the checksum for the B-tree header. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree Internal Node +
bytebytebytebyte
Signature
VersionTypeRecords 0, 1, 2...N-1 (variable size)

Child Node Pointer 0O


Number of Records N0 for Child + Node 0 (variable size)

Total Number of Records for Child Node 0 + (optional, variable size)

Child Node Pointer 1O


Number of Records N1 for + Child Node 1 (variable size)

Total Number of Records for Child Node 1 + (optional, variable size)
...

Child Node Pointer NO


Number of Records Nn for + Child Node N (variable size)

Total Number of Records for Child Node N + (optional, variable size)
Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree Internal Node +
Field NameDescription

Signature

+

The ASCII character string “BTIN” is + used to indicate the internal node of a B-tree. +

+

Version

+

The version number for this B-tree internal node. + This document describes version 0. +

+

Type

+

This field is the type of the B-tree node. It should always + be the same as the B-tree type in the header. +

+

Records

+

The size of this field is determined by the number of records + for this node and the record size (from the header). The format + of records depends on the type of B-tree. +

+

Child Node Pointer

+

This field is the address of the child node pointed to by the + internal node. +

+

Number of Records in Child Node

+

This is the number of records in the child node pointed to by + the corresponding Node Pointer. +

+

The number of bytes used to store this field is determined by + the maximum possible number of records able to be stored in the + child node. +

+

+ The maximum number of records in a child node is computed + in the following way: + +

    +
  • Subtract the fixed size overhead for + the child node (for example, its signature, version, + checksum, and so on and one pointer triplet + of information for the child node (because there is one + more pointer triplet than records in each internal node)) + from the size of nodes for the B-tree.
  • +
  • Divide that result by the size of a record plus the + pointer triplet of information stored to reach each + child node from this node.
  • +
+ +

+

+ Note that leaf nodes do not encode any + child pointer triplets, so the maximum number of records in a + leaf node is just the node size minus the leaf node overhead, + divided by the record size. +

+

+ Also note that the first level of internal nodes above the + leaf nodes do not encode the Total Number of Records in Child + Node value in the child pointer triplets (since it is the + same as the Number of Records in Child Node), so the + maximum number of records in these nodes is computed with the + equation above, but using (Child Pointer, Number of + Records in Child Node) pairs instead of triplets. +

+

+ The number of + bytes used to encode this field is the least number of bytes + required to encode the maximum number of records in a child + node value for the child nodes below this level + in the B-tree. +

+

+ For example, if the maximum number of child records is + 123, one byte will be used to encode these values in this + node; if the maximum number of child records is + 20000, two bytes will be used to encode these values in this + node; and so on. The maximum number of bytes used to + encode these values is 8 (in other words, an unsigned + 64-bit integer). +

+

Total Number of Records in Child Node

+

This is the total number of records for the node pointed to by + the corresponding Node Pointer and all its children. + This field exists only in nodes whose depth in the B-tree node + is greater than 1 (in other words, the “twig” + internal nodes, just above leaf nodes, do not store this + field in their child node pointers). +

+

The number of bytes used to store this field is determined by + the maximum possible number of records able to be stored in the + child node and its descendants. +

+

+ The maximum possible number of records able to be stored in a + child node and its descendants is computed iteratively, in the + following way: The maximum number of records in a leaf node + is computed, then that value is used to compute the maximum + possible number of records in the first level of internal nodes + above the leaf nodes. Multiplying these two values together + determines the maximum possible number of records in child node + pointers for the level of nodes two levels above leaf nodes. + This process is continued up to any level in the B-tree. +

+

+ The number of bytes used to encode this value is computed in + the same way as for the Number of Records in Child Node + field. +

+

Checksum

+

This is the checksum for this node. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree Leaf Node +
bytebytebytebyte
Signature
VersionTypeRecord 0, 1, 2...N-1 (variable size)
Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree Leaf Node +
Field NameDescription

Signature

+

The ASCII character string “BTLF“ + is used to indicate the leaf node of a version 2 (v2) B-tree. +

+

Version

+

The version number for this B-tree leaf node. + This document describes version 0. +

+

Type

+

This field is the type of the B-tree node. It should always + be the same as the B-tree type in the header. +

+

Records

+

The size of this field is determined by the number of records + for this node and the record size (from the header). The format + of records depends on the type of B-tree. +

+

Checksum

+

This is the checksum for this node. +

+
+
+ +
+
+
+

The record layout for each stored (in other words, non-testing) + B-tree type is as follows:

+ +
+ + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 1 Record Layout - Indirectly + Accessed, Non-filtered, ‘Huge’ Fractal Heap Objects +
bytebytebytebyte

Huge Object AddressO


Huge Object LengthL


Huge Object IDL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 1 Record Layout - Indirectly + Accessed, Non-filtered, ‘Huge’ Fractal Heap Objects +
Field NameDescription

Huge Object Address

+

The address of the huge object in the file. +

+

Huge Object Length

+

The length of the huge object in the file. +

+

Huge Object ID

+

The heap ID for the huge object. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 2 Record Layout - Indirectly + Accessed, Filtered, ‘Huge’ Fractal Heap Objects +
bytebytebytebyte

Filtered Huge Object AddressO


Filtered Huge Object LengthL

Filter Mask

Filtered Huge Object Memory SizeL


Huge Object IDL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 2 Record Layout - Indirectly + Accessed, Filtered, ‘Huge’ Fractal Heap Objects +
Field NameDescription

Filtered Huge Object Address

+

The address of the filtered huge object in the file. +

+

Filtered Huge Object Length

+

The length of the filtered huge object in the file. +

+

Filter Mask

+

A 32-bit bit field indicating which filters have been skipped for + this chunk. Each filter has an index number in the pipeline + (starting at 0, with the first filter to apply) and if that + filter is skipped, the bit corresponding to its index is set. +

+

Filtered Huge Object Memory Size

+

The size of the de-filtered huge object in memory. +

+

Huge Object ID

+

The heap ID for the huge object. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 3 Record Layout - Directly + Accessed, Non-filtered, ‘Huge’ Fractal Heap Objects +
bytebytebytebyte

Huge Object AddressO


Huge Object LengthL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 3 Record Layout - Directly + Accessed, Non-filtered, ‘Huge’ Fractal Heap Objects +
Field NameDescription

Huge Object Address

+

The address of the huge object in the file. +

+

Huge Object Length

+

The length of the huge object in the file. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 4 Record Layout - Directly + Accessed, Filtered, ‘Huge’ Fractal Heap Objects +
bytebytebytebyte

Filtered Huge Object AddressO


Filtered Huge Object LengthL

Filter Mask

Filtered Huge Object Memory SizeL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 4 Record Layout - Directly + Accessed, Filtered, ‘Huge’ Fractal Heap Objects +
Field NameDescription

Filtered Huge Object Address

+

The address of the filtered huge object in the file. +

+

Filtered Huge Object Length

+

The length of the filtered huge object in the file. +

+

Filter Mask

+

A 32-bit bit field indicating which filters have been skipped for + this chunk. Each filter has an index number in the pipeline + (starting at 0, with the first filter to apply) and if that + filter is skipped, the bit corresponding to its index is set. +

+

Filtered Huge Object Memory Size

+

The size of the de-filtered huge object in memory. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 5 Record Layout - Link Name + for Indexed Group +
bytebytebytebyte
Hash of Name
ID (bytes 1-4)
ID (bytes 5-7)
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 5 Record Layout - Link Name + for Indexed Group +
Field NameDescription

Hash

+

This field is hash value of the name for the link. The hash + value is the Jenkins’ lookup3 checksum algorithm applied to + the link’s name. +

+

ID

+

This is a 7-byte sequence of bytes and is the heap ID for the + link record in the group’s fractal heap.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 6 Record Layout - Creation + Order for Indexed Group +
bytebytebytebyte

Creation Order + (8 bytes)

ID (bytes 1-4)
ID (bytes 5-7)
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 6 Record Layout - Creation + Order for Indexed Group +
Field NameDescription

Creation Order

+

This field is the creation order value for the link. +

+

ID

+

This is a 7-byte sequence of bytes and is the heap ID for the + link record in the group’s fractal heap.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 7 Record Layout - Shared + Object Header Messages (Sub-type 0 - Message in Heap) +
bytebytebytebyte
Message LocationThis space inserted only to align table nicely
Hash
Reference Count

Heap ID (8 bytes)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 7 Record Layout - Shared + Object Header Messages (Sub-type 0 - Message in Heap) +
Field NameDescription

Message Location

+

This field Indicates the location where the message is stored: + + + + + + + + + + + + + +
ValueDescription
0Shared message is stored in shared message index heap. +
1Shared message is stored in object header. +

+

Hash

+

This field is hash value of the shared message. The hash + value is the Jenkins’ lookup3 checksum algorithm applied to + the shared message.

+

Reference Count

+

The number of objects which reference this message.

+

Heap ID

+

This is an 8-byte sequence of bytes and is the heap ID for the + shared message in the shared message index’s fractal heap.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 7 Record Layout - Shared + Object Header Messages (Sub-type 1 - Message in Object Header) +
bytebytebytebyte
Message LocationThis space inserted only to align table nicely
Hash
Reserved (zero)Message TypeObject Header Index

Object Header AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 7 Record Layout - Shared + Object Header Messages (Sub-type 1 - Message in Object Header) +
Field NameDescription

Message Location

+

This field Indicates the location where the message is stored: + + + + + + + + + + + + + +
ValueDescription
0Shared message is stored in shared message index heap. +
1Shared message is stored in object header. +

+

Hash

+

This field is hash value of the shared message. The hash + value is the Jenkins’ lookup3 checksum algorithm applied to + the shared message.

+

Message Type

+

The object header message type of the shared message.

+

Object Header Index

+

This field indicates that the shared message is the nth message + of its type in the specified object header.

+

Object Header Address

+

The address of the object header containing the shared message.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 8 Record Layout - Attribute + Name for Indexed Attributes +
bytebytebytebyte

Heap ID (8 bytes)

Message FlagsThis space inserted only to align table nicely
Creation Order
Hash of Name
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 8 Record Layout - Attribute + Name for Indexed Attributes +
Field NameDescription

Heap ID

+

This is an 8-byte sequence of bytes and is the heap ID for the + attribute in the object’s attribute fractal heap.

+

Message Flags

The object header message flags for the attribute message.

+

Creation Order

+

This field is the creation order value for the attribute. +

+

Hash

+

This field is hash value of the name for the attribute. The hash + value is the Jenkins’ lookup3 checksum algorithm applied to + the attribute’s name. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 B-tree, Type 9 Record Layout - Creation + Order for Indexed Attributes +
bytebytebytebyte

Heap ID (8 bytes)

Message Flags + This space inserted only to align table nicely
Creation Order
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 9 Record Layout - Creation + Order for Indexed Attributes +
Field NameDescription

Heap ID

+

This is an 8-byte sequence of bytes and is the heap ID for the + attribute in the object’s attribute fractal heap.

+

Message Flags

+

The object header message flags for the attribute message.

+

Creation Order

+

This field is the creation order value for the attribute. +

+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Layout: Version 2 B-tree, Type 10 Record Layout - + Non-filtered Dataset Chunks +
bytebytebytebyte

AddressO


Dimension 0 Scaled Offset + (8 bytes)


Dimension 1 Scaled Offset + (8 bytes)


...


Dimension #n Scaled Offset + (8 bytes)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 10 Record Layout - + Non-filtered Dataset Chunks +
Field NameDescription

Address

+

This field is the address of the dataset chunk in the file.

+

Dimension #n Scaled Offset

+

This field is the scaled offset of the chunk within the + dataset. n is the number of dimensions for the + dataset. The first scaled offset stored in the list is for + the slowest changing dimension, and the last scaled offset + stored is for the fastest changing dimension. Scaled offset + is calculated by dividing the chunk dimension sizes into + the chunk offsets.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Layout: Version 2 B-tree, Type 11 Record Layout - Filtered + Dataset Chunks +
bytebytebytebyte

AddressO


Chunk Size + (variable size; at most 8 bytes)

Filter Mask

Dimension 0 Scaled Offset + (8 bytes)


Dimension 1 Scaled Offset + (8 bytes)


...


Dimension #n Scaled Offset + (8 bytes)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 B-tree, Type 11 Record Layout - Filtered + Dataset Chunks +
Field NameDescription

Address

+

This field is the address of the dataset chunk in the file.

+

Chunk Size

+

This field is the size of the dataset chunk in bytes.

+

Filter Mask

+

This field is the filter mask which indicates the filter + to skip for the dataset chunk. Each filter has an index + number in the pipeline and if that filter is skipped, + the bit corresponding to its index is set.

+

Dimension #n Scaled Offset

+

This field is the scaled offset of the chunk within + the dataset. n is the number of dimensions for + the dataset. The first scaled offset stored in the list + is for the slowest changing dimension, and the last scaled + offset stored is for the fastest changing dimension.

+
+
+ +

+ III.B. Disk Format: Level 1B - Group Symbol Table Nodes

+ +

A group is an object internal to the file that allows + arbitrary nesting of objects within the file (including other + groups). A group maps a set of link names in the group to a set + of relative file addresses of objects in the file. Certain metadata + for an object to which the group points can be cached in the + group’s symbol table entry in addition to being in the + object’s header.

+ +

An HDF5 object name space can be stored hierarchically by + partitioning the name into components and storing each + component as a link in a group. The link for a + non-ultimate component points to the group containing + the next component. The link for the last + component points to the object being named.

+ +

One implementation of a group is a collection of symbol table + nodes indexed by a B-tree. Each symbol table node contains entries + for one or more links. If an attempt is made to add a link to an + already full symbol table node containing 2K entries, then + the node is split and one node contains K symbols and the + other contains K+1 symbols.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Symbol Table Node (A Leaf of a B-tree) +
bytebytebytebyte
Signature
Version NumberReserved (zero)Number of Symbols


Group Entries


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Symbol Table Node (A Leaf of a B-tree) +
Field NameDescription

Signature

+

The ASCII character string “SNOD” is + used to indicate the + beginning of a symbol table node. This gives file + consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Version Number

+

The version number for the symbol table node. This + document describes version 1. (There is no version ‘0’ + of the symbol table node) +

+

Number of Entries

+

Although all symbol table nodes have the same length, + most contain fewer than the maximum possible number of + link entries. This field indicates how many entries + contain valid data. The valid entries are packed at the + beginning of the symbol table node while the remaining + entries contain undefined values. +

+

Symbol Table Entries

+

Each link has an entry in the symbol table node. + The format of the entry is described below. + There are 2K entries in each group node, where + K is the “Group Leaf Node K” value from the + superblock. +

+
+
+ +

+ III.C. Disk Format: Level 1C - Symbol Table Entry

+ +

Each symbol table entry in a symbol table node is designed + to allow for very fast browsing of stored objects. + Toward that design goal, the symbol table entries + include space for caching certain constant metadata from the + object header.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Symbol Table Entry +
bytebytebytebyte

Link Name OffsetO


Object Header AddressO

Cache Type
Reserved (zero)


Scratch-pad Space + (16 bytes)


+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Symbol Table Entry +
Field NameDescription

Link Name Offset

+

This is the byte offset into the group’s local + heap for the name of the link. The name is null + terminated. +

+

Object Header Address

+

Every object has an object header which serves as a + permanent location for the object’s metadata. In addition + to appearing in the object header, some of the object’s metadata + can be cached in the scratch-pad space. +

+

Cache Type

+

The cache type is determined from the object header. + It also determines the format for the scratch-pad space: + + + + + + + + + + + + + + + + + + +
TypeDescription
0No data is cached by the group entry. This + is guaranteed to be the case when an object header + has a link count greater than one. +
1Group object header metadata is cached in the + scratch-pad space. This implies that the symbol table + entry refers to another group. +
2The entry is a symbolic link. The first four bytes + of the scratch-pad space are the offset into the local + heap for the link value. The object header address + will be undefined. +

+ +

Reserved

+

These four bytes are present so that the scratch-pad + space is aligned on an eight-byte boundary. They are + always set to zero. +

+

Scratch-pad Space

+

This space is used for different purposes, depending + on the value of the Cache Type field. Any metadata + about an object represented in the scratch-pad + space is duplicated in the object header for that + object. +

+

+ Furthermore, no data is cached in the group + entry scratch-pad space if the object header for + the object has a link count greater than one. +

+
+
+ +

Format of the Scratch-pad Space

+ +

The symbol table entry scratch-pad space is formatted + according to the value in the Cache Type field.

+ +

If the Cache Type field contains the value zero + (0) then no information is + stored in the scratch-pad space.

+ +

If the Cache Type field contains the value one + (1), then the scratch-pad space + contains cached metadata for another object header + in the following format:

+ +
+ + + + + + + + + + + + + + + + + +
+ Layout: Object Header Scratch-pad Format +
bytebytebytebyte

Address of B-treeO


Address of Name HeapO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Object Header Scratch-pad Format +
Field NameDescription

Address of B-tree

+

This is the file address for the root of the + group’s B-tree. +

+

Address of Name Heap

+

This is the file address for the group’s local + heap, in which are stored the group’s symbol names. +

+
+
+ + +
+
+
+

If the Cache Type field contains the value two + (2), then the scratch-pad space + contains cached metadata for a symbolic link + in the following format:

+ +
+ + + + + + + + + + + + + +
+ Layout: Symbolic Link Scratch-pad Format +
bytebytebytebyte
Offset to Link Value
+
+ +
+
+ + + + + + + + + + + +
+ Fields: Symbolic Link Scratch-pad Format +
Field NameDescription

Offset to Link Value

+

The value of a symbolic link (that is, the name of the + thing to which it points) is stored in the local heap. + This field is the 4-byte offset into the local heap for + the start of the link value, which is null terminated. +

+
+
+ +

+ III.D. Disk Format: Level 1D - Local Heaps

+ +

A local heap is a collection of small pieces of data that are particular + to a single object in the HDF5 file. Objects can be + inserted and removed from the heap at any time. + The address of a heap does not change once the heap is created. + For example, a group stores addresses of objects in symbol table nodes + with the names of links stored in the group’s local heap. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Local Heap +
bytebytebytebyte
Signature
VersionReserved (zero)

Data Segment SizeL


Offset to Head of Free-listL


Address of Data SegmentO

+ + + + + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Local Heap +
Field NameDescription

Signature

+

The ASCII character string “HEAP” + is used to indicate the + beginning of a heap. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

Each local heap has its own version number so that new + heaps can be added to old files. This document + describes version zero (0) of the local heap. +

+

Data Segment Size

+

The total amount of disk memory allocated for the heap + data. This may be larger than the amount of space + required by the objects stored in the heap. The extra + unused space in the heap holds a linked list of free blocks. +

+

Offset to Head of Free-list

+

This is the offset within the heap data segment of the + first free block (or the + undefined address if there is no + free block). The free block contains + Size of Lengths bytes that + are the offset of the next free block (or the + value ‘1’ if this is the + last free block) followed by Size of Lengths bytes that store + the size of this free block. The size of the free block includes + the space used to store the offset of the next free block and + the size of the current block, making the minimum size of a free + block 2 * Size of Lengths. +

+

Address of Data Segment

+

The data segment originally starts immediately after + the heap header, but if the data segment must grow as a + result of adding more objects, then the data segment may + be relocated, in its entirety, to another part of the + file. +

+
+
+ +

Objects within a local heap should be aligned on an 8-byte boundary.

+ +

+ III.E. Disk Format: Level 1E - Global Heap

+ +

Each HDF5 file has a global heap which stores various types of + information which is typically shared between datasets. The + global heap was designed to satisfy these goals:

+ +
    +
  1. Repeated access to a heap object must be efficient without + resulting in repeated file I/O requests. Since global heap + objects will typically be shared among several datasets, it is + probable that the object will be accessed repeatedly.
  2. +
  3. Collections of related global heap objects should result in + fewer and larger I/O requests. For instance, a dataset of + object references will have a global heap object for each + reference. Reading the entire set of object references + should result in a few large I/O requests instead of one small + I/O request for each reference.
  4. +
  5. It should be possible to remove objects from the global heap + and the resulting file hole should be eligible to be reclaimed + for other uses.
  6. +
+ + +

The implementation of the heap makes use of the memory management + already available at the file level and combines that with a new + object called a collection to achieve goal B. The global heap + is the set of all collections. Each global heap object belongs to + exactly one collection, and each collection contains one or more global + heap objects. For the purposes of disk I/O and caching, a collection is + treated as an atomic object, addressing goal A. +

+ +

When a global heap object is deleted from a collection (which + occurs when its reference count falls to zero), objects located + after the deleted object in the collection are packed down toward + the beginning of the collection, and the collection’s + global heap object 0 is created (if possible), or its size is + increased to account for the recently freed space. There are + no gaps between objects in each collection, with the possible + exception of the final space in the collection, if it is not + large enough to hold the header for the collection’s + global heap object 0. These features address goal C. +

+ +

The HDF5 Library creates global heap collections as needed, so there may + be multiple collections throughout the file. The set of all of them is + abstractly called the “global heap”, although they do not actually link + to each other, and there is no global place in the file where you can + discover all of the collections. The collections are found simply by + finding a reference to one through another object in the file. For + example, data of variable-length datatype elements is stored in the + global heap and is accessed via a global heap ID. The format for + global heap IDs is described at the end of this section. +

+ +

For more information on global heaps for virtual datasets, see + “Disk Format: Level 1F - Global Heap + Block for Virtual Datasets.”

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: A Global Heap Collection +
bytebytebytebyte
Signature
VersionReserved (zero)

Collection SizeL


Global Heap Object 1


Global Heap Object 2


...


Global Heap Object N


Global Heap Object 0 (free space)

+ + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: A Global Heap Collection +
Field NameDescription

Signature

+

The ASCII character string “GCOL” + is used to indicate the + beginning of a collection. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

Each collection has its own version number so that new + collections can be added to old files. This document + describes version one (1) of the collections (there is no + version zero (0)). +

+

Collection Size

+

This is the size in bytes of the entire collection + including this field. The default (and minimum) + collection size is 4096 bytes which is a typical file + system block size. This allows for 127 16-byte heap + objects plus their overhead (the collection header of 16 bytes + and the 16 bytes of information about each heap object). +

+

Global Heap Object 1 through N

+

The objects are stored in any order with no + intervening unused space. +

+

Global Heap Object 0

+

Global Heap Object 0 (zero), when present, represents the free + space in the collection. Free space always appears at the end of + the collection. If the free space is too small to store the header + for Object 0 (described below) then the header is implied and is not + written. +

+ The field Object Size for Object 0 indicates the + amount of possible free space in the collection including the 16-byte + header size of Object 0. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Global Heap Object +
bytebytebytebyte
Heap Object IndexReference Count
Reserved (zero)

Object SizeL


Object Data

+ + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Global Heap Object +
Field NameDescription

Heap Object Index

+

Each object has a unique identification number within a + collection. The identification numbers are chosen so that + new objects have the smallest value possible with the + exception that the identifier 0 always refers to the + object which represents all free space within the + collection. +

+

Reference Count

+

All heap objects have a reference count field. An + object which is referenced from some other part of the + file will have a positive reference count. The reference + count for Object 0 is always zero. +

+

Reserved

+

Zero padding to align next field on an 8-byte boundary. +

+

Object Size

+

This is the size of the object data stored for the object. + The actual storage space allocated for the object data is rounded + up to a multiple of eight. +

+

Object Data

+

The object data is treated as a one-dimensional array + of bytes to be interpreted by the caller. +

+
+ +
+ +
+
+
+

+ + The format for the ID used to locate an object in the global heap is + described here:

+ +
+ + + + + + + + + + + + + + + + + +
+ Layout: Global Heap ID +
bytebytebytebyte

Collection AddressO

Object Index
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Global Heap ID +
Field NameDescription

Collection Address

+

This field is the address of the global heap collection + where the data object is stored. +

+

ID

+

This field is the index of the data object within the + global heap collection. +

+
+
+ + + +

III.F. Disk Format: Level 1F - Global + Heap Block for Virtual Datasets

+ +

The layout for the global heap block used with virtual datasets is + described below. For more information on global heaps, see + “Disk Format: Level 1E - Global Heap.”

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Global Heap Block for Virtual Dataset +
bytebytebytebyte
VersionThis space inserted + only to align table nicely

Num EntriesL


Source Filename #1 (variable size)


Source Dataset #1 (variable + size)


Source Selection #1 (variable + size)


Virtual Selection #1 (variable + size)

.
.
.

Source Filename #n (variable + size)


Source Dataset #n (variable + size)


Source Selection #n (variable + size)


Virtual Selection #n (variable + size)

Checksum
+ + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Global Heap Block for Virtual Dataset +
Field NameDescription

Version

+

The version number for the block; the value is 0.

+

Num Entries

The number of entries in the block.

+

Source Filename #n

+

The source file name where the source dataset is located. +

+

Source Dataset #n

The source dataset name that is mapped to the + virtual dataset.

Source Selection #n

+

The dataspace selection in the + source dataset that is mapped to the virtual selection. +

+

Virtual Selection #n

+

This is the dataspace selection in the virtual dataset that is + mapped to the source selection. +

+

Checksum

+

This is the checksum for the block.

+
+
+
+ +

+ III.G. Disk Format: Level 1G - Fractal Heap

+ +

+ Each fractal heap consists of a header and zero or more direct and + indirect blocks (described below). The header contains general + information as well as + initialization parameters for the doubling table. The Address + of Root Block field in the header points to the first direct or + indirect block in the heap. +

+ +

+ Fractal heaps are based on a data structure called a doubling + table. A doubling table provides a mechanism for quickly + extending an array-like data structure that minimizes the number of + empty blocks in the heap, while retaining very fast lookup of any + element within the array. More information on fractal heaps and + doubling tables can be found in the RFC + “Private + Heaps in HDF5.” +

+ +

+ The fractal heap implements the doubling table structure with + indirect and direct blocks. + Indirect blocks in the heap do not actually contain data for + objects in the heap, their “size” is abstract - + they represent the indexing structure for locating the + direct blocks in the doubling table. + Direct blocks + contain the actual data for objects stored in the heap. +

+ +

+ All indirect blocks have a constant number of block entries in each + row, called the width of the doubling table + (see Table Width field in the header). + + The number + of rows for each indirect block in the heap is determined by the + size of the block that the indirect block represents in the + doubling table (calculation of this is shown below) and is + constant, except for the “root” + indirect block, which expands and shrinks its number of rows as + needed. +

+ +

+ Blocks in the first two rows of an indirect block + are Starting Block Size number of bytes in size. + For example, if the row width of the doubling table is 4, + then the first eight block entries in the + indirect block are Starting Block Size number of bytes in size. + The blocks in each subsequent row are twice the size of + the blocks in the previous row. In other words, blocks in + the third row are twice the Starting Block Size, + blocks in the fourth row are four times the + Starting Block Size, and so on. Entries for + blocks up to the Maximum Direct Block Size point to + direct blocks, and entries for blocks greater than that size + point to further indirect blocks (which have their own + entries for direct and indirect blocks). + Starting Block Size and + Maximum Direct Block Size are fields + stored in the header. +

+ +

+ The number of rows of blocks, nrows, in an + indirect block is calculated by the following expression: +

+ nrows = (log2(block_size) - + log2(<Starting Block Size>)) + 1 +

+where block_size is the size of the block that the indirect block +represents in the doubling table. +For example, to represent a block with block_size equals to 1024, +and Starting Block Size equals to 256, +three rows are needed. +

+ The maximum number of rows of direct blocks, max_dblock_rows, + in any indirect block of a fractal heap is given by the + following expression: +

+ max_dblock_rows = + (log2(<Maximum Direct Block Size>) - + log2(<Starting Block Size>)) + 2 +

+

+ Using the computed values for nrows and + max_dblock_rows, along with the width of the + doubling table, the number of direct and indirect block entries + (K and N in the indirect block description, below) + in an indirect block can be computed: +

+ K = MIN(nrows, max_dblock_rows) * + <Table Width> + +

+ If nrows is less than or equal to max_dblock_rows, + N is 0. Otherwise, N is simply computed: +

+ N = K - (max_dblock_rows * + <Table Width>) +

+ +

+ The size of indirect blocks on disk is determined by the number + of rows in the indirect block (computed above). The size of direct + blocks on disk is exactly the size of the block in the doubling + table. +

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap Header +
bytebytebytebyte
Signature
VersionThis space inserted only to align table nicely
Heap ID LengthI/O Filters’ Encoded Length
FlagsThis space inserted only to align table nicely
Maximum Size of Managed Objects

Next Huge Object IDL


v2 B-tree Address of Huge ObjectsO


Amount of Free Space in Managed BlocksL


Address of Managed Block Free Space ManagerO


Amount of Managed Space in HeapL


Amount of Allocated Managed Space in HeapL


Offset of Direct Block Allocation Iterator in Managed SpaceL


Number of Managed Objects in HeapL


Size of Huge Objects in HeapL


Number of Huge Objects in HeapL


Size of Tiny Objects in HeapL


Number of Tiny Objects in HeapL

Table WidthThis space inserted only to align table nicely

Starting Block SizeL


Maximum Direct Block SizeL

Maximum Heap SizeStarting # of Rows in Root Indirect Block

Address of Root BlockO

Current # of Rows in Root Indirect BlockThis space inserted only to align table nicely

Size of Filtered Root Direct Block (optional)L

I/O Filter Mask (optional)
I/O Filter Information (optional, variable size)
Checksum
+ + + + + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap Header +
Field NameDescription

Signature

+

The ASCII character string “FRHP” + is used to indicate the + beginning of a fractal heap header. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

This document describes version 0.

+

Heap ID Length

+

This is the length in bytes of heap object IDs for this heap.

+

I/O Filters’ Encoded Length

+

This is the size in bytes of the encoded I/O Filter Information. +

+

Flags

+

This field is the heap status flag and is a bit field + indicating additional information about the fractal heap. + + + + + + + + + + + + + + + + + + +
Bit(s)Description
0If set, the ID value to use for huge object has wrapped + around. If the value for the Next Huge Object ID + has wrapped around, each new huge object inserted into the + heap will require a search for an ID value. +
1If set, the direct blocks in the heap are checksummed. +
2-7Reserved

+ +

Maximum Size of Managed Objects

+

This is the maximum size of managed objects allowed in the heap. + Objects greater than this this are ‘huge’ objects and will be + stored in the file directly, rather than in a direct block for + the heap. +

+

Next Huge Object ID

+

This is the next ID value to use for a huge object in the heap. +

+

v2 B-tree Address of Huge Objects

+

This is the address of the v2 B-tree + used to track huge objects in the heap. The type of records + stored in the v2 B-tree will + be determined by whether the address and length of a huge object + can fit into a heap ID (if yes, it is a “directly” accessed + huge object) and whether there is a filter used on objects + in the heap. +

+

Amount of Free Space in Managed Blocks

+

This is the total amount of free space in managed direct blocks + (in bytes). +

+

Address of Managed Block Free Space Manager

+

This is the address of the + Free-space Manager for + managed blocks. +

+

Amount of Managed Space in Heap

+

This is the total amount of managed space in the heap (in bytes), + essentially the upper bound of the heap’s linear address space. +

+

Amount of Allocated Managed Space in Heap

+

This is the total amount of managed space (in bytes) actually + allocated in + the heap. This can be less than the Amount of Managed Space + in Heap field, if some direct blocks in the heap’s linear + address space are not allocated. +

+

Offset of Direct Block Allocation Iterator in Managed Space

+

This is the linear heap offset where the next direct + block should be allocated at (in bytes). This may be less than + the Amount of Managed Space in Heap value because the + heap’s address space is increased by a “row” of direct blocks + at a time, rather than by single direct block increments. +

+

Number of Managed Objects in Heap

+

This is the number of managed objects in the heap. +

+

Size of Huge Objects in Heap

+

This is the total size of huge objects in the heap (in bytes). +

+

Number of Huge Objects in Heap

+

This is the number of huge objects in the heap. +

+

Size of Tiny Objects in Heap

+

This is the total size of tiny objects that are packed in heap + IDs (in bytes). +

+

Number of Tiny Objects in Heap

+

This is the number of tiny objects that are packed in heap IDs. +

+

Table Width

+

This is the number of columns in the doubling table for managed + blocks. This value must be a power of two. +

+

Starting Block Size

+

This is the starting block size to use in the doubling table for + managed blocks (in bytes). This value must be a power of two. +

+

Maximum Direct Block Size

+

This is the maximum size allowed for a managed direct block. + Objects inserted into the heap that are larger than this value + (less the number of bytes of direct block prefix/suffix) + are stored as ‘huge’ objects. This value must be a power of + two. +

+

Maximum Heap Size

+

This is the maximum size of the heap’s linear address space for + managed objects (in bytes). The value stored is the log2 of + the actual value, that is: the number of bits of the address space. + ‘Huge’ and ‘tiny’ objects are not counted in this value, since + they do not store objects in the linear address space of the + heap. +

+

Starting # of Rows in Root Indirect Block

+

This is the starting number of rows for the root indirect block. + A value of 0 indicates that the root indirect block will have + the maximum number of rows needed to address the heap’s Maximum + Heap Size. +

+

Address of Root Block

+

This is the address of the root block for the heap. It can + be the undefined address if + there is no data in the heap. It either points to a direct + block (if the Current # of Rows in the Root Indirect + Block value is 0), or an indirect block. +

+

Current # of Rows in Root Indirect Block

+

This is the current number of rows in the root indirect block. + A value of 0 indicates that Address of Root Block + points to direct block instead of indirect block. +

+

Size of Filtered Root Direct Block

+

This is the size of the root direct block, if filters are + applied to heap objects (in bytes). This field is only + stored in the header if the I/O Filters’ Encoded Length + is greater than 0. +

+

I/O Filter Mask

+

This is the filter mask for the root direct block, if filters + are applied to heap objects. This mask has the same format as + that used for the filter mask in chunked raw data records in a + v1 B-tree. + This field is only + stored in the header if the I/O Filters’ Encoded Length + is greater than 0. +

+

I/O Filter Information

+

This is the I/O filter information encoding direct blocks and + huge objects, if filters are applied to heap objects. This + field is encoded as a Filter Pipeline + message. + The size of this field is determined by I/O Filters’ + Encoded Length. +

+

Checksum

+

This is the checksum for the header.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap Direct Block +
bytebytebytebyte
Signature
VersionThis space inserted only to align table nicely

Heap Header AddressO

Block Offset (variable size)
Checksum (optional)

Object Data (variable size)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap Direct Block +
Field NameDescription

Signature

+

The ASCII character string “FHDB” + is used to indicate the + beginning of a fractal heap direct block. This gives file consistency + checking utilities a better chance of reconstructing a + damaged file. +

+

Version

+

This document describes version 0.

+

Heap Header Address

+

This is the address for the fractal heap header that this + block belongs to. This field is principally used for file + integrity checking. +

+

Block Offset

+

This is the offset of the block within the fractal heap’s + address space (in bytes). The number of bytes used to encode + this field is the Maximum Heap Size (in the heap’s + header) divided by 8 and rounded up to the next highest integer, + for values that are not a multiple of 8. This value is + principally used for file integrity checking. +

+

Checksum

+

This is the checksum for the direct block.

+

This field is only present if bit 1 of Flags in the + heap’s header is set.

+

Object Data

+

This section of the direct block stores the actual data for + objects in the heap. The size of this section is determined by + the direct block’s size minus the size of the other fields + stored in the direct block (for example, the Signature, + Version, and others including the Checksum if it is + present). +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap Indirect Block +
bytebytebytebyte
Signature
VersionThis space inserted only to align table nicely

Heap Header AddressO

Block Offset (variable size)

Child Direct Block #0 AddressO


Size of Filtered Direct Block #0 (optional) L

Filter Mask for Direct Block #0 (optional)

Child Direct Block #1 AddressO


Size of Filtered Direct Block #1 (optional)L

Filter Mask for Direct Block #1 (optional)
...

Child Direct Block #K-1 AddressO


Size of Filtered Direct Block #K-1 (optional)L

Filter Mask for Direct Block #K-1 (optional)

Child Indirect Block #0 AddressO


Child Indirect Block #1 AddressO

...

Child Indirect Block #N-1 AddressO

Checksum
+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap Indirect Block +
Field NameDescription

Signature

+

The ASCII character string “FHIB” is used to + indicate the beginning of a fractal heap indirect block. This + gives file consistency checking utilities a better chance of + reconstructing a damaged file. +

+

Version

+

This document describes version 0.

+

Heap Header Address

+

This is the address for the fractal heap header that this + block belongs to. This field is principally used for file + integrity checking. +

+

Block Offset

+

This is the offset of the block within the fractal heap’s + address space (in bytes). The number of bytes used to encode + this field is the Maximum Heap Size (in the heap’s + header) divided by 8 and rounded up to the next highest integer, + for values that are not a multiple of 8. This value is + principally used for file integrity checking. +

+

Child Direct Block #K Address

+

This field is the address of the child direct block. + The size of the [uncompressed] direct block can be computed by + its offset in the heap’s linear address space. +

+

Size of Filtered Direct Block #K

+

This is the size of the child direct block after passing through + the I/O filters defined for this heap (in bytes). If no I/O + filters are present for this heap, this field is not present. +

+

Filter Mask for Direct Block #K

+

This is the I/O filter mask for the filtered direct block. + This mask has the same format as that used for the filter mask + in chunked raw data records in a v1 B-tree. + If no I/O filters are present for this heap, this field is not + present. +

+

Child Indirect Block #N Address

+

This field is the address of the child indirect block. + The size of the indirect block can be computed by + its offset in the heap’s linear address space. +

+

Checksum

+

This is the checksum for the indirect block.

+
+ +
+ +
+

An object in the fractal heap is identified by means of a fractal heap ID, + which encodes information to locate the object in the heap. + Currently, the fractal heap stores an object in one of three ways, + depending on the object’s size:

+ +
+ + + + + + + + + + + + + + + + + + + + +
TypeDescription
Tiny +

When an object is small enough to be encoded in the + heap ID, the object’s data is embedded in the fractal + heap ID itself. There are two sub-types for this type of + object: normal and extended. The sub-type for tiny heap + IDs depends on whether the heap ID is large enough to + store objects greater than 16 bytes or not. If the + heap ID length is 18 bytes or smaller, the + ‘normal’ tiny heap ID form is used. If the + heap ID length is greater than 18 bytes in length, the + “extended” form is used. See the format + description below for both sub-types. +

+
Huge +

When the size of an object is larger than Maximum Size of + Managed Objects in the Fractal Heap Header, the + object’s data is stored on its own in the file and the object + is tracked/indexed via a version 2 B-tree. All huge objects + for a particular fractal heap use the same v2 B-tree. All huge + objects for a particular fractal heap use the same format for + their huge object IDs. +

+ +

Depending on whether the IDs for a heap are large enough to hold + the object’s retrieval information and whether I/O pipeline filters + are applied to the heap’s objects, 4 sub-types are derived for + huge object IDs for this heap:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Sub-typeDescription
Directly accessed, non-filtered +

The object’s address and length are embedded in the + fractal heap ID itself and the object is directly accessed + from them. This allows the object to be accessed without + resorting to the B-tree. +

+
Directly accessed, filtered +

The filtered object’s address, length, filter mask and + de-filtered size are embedded in the fractal heap ID itself + and the object is accessed directly with them. This allows + the object to be accessed without resorting to the B-tree. +

+
Indirectly accessed, non-filtered +

The object is located by using a B-tree key embedded in + the fractal heap ID to retrieve the address and length from + the version 2 B-tree for huge objects. Then, the address + and length are used to access the object. +

+
Indirectly accessed, filtered +

The object is located by using a B-tree key embedded in + the fractal heap ID to retrieve the filtered object’s + address, length, filter mask and de-filtered size from the + version 2 B-tree for huge objects. Then, this information + is used to access the object. +

+
+
+ +
Managed +

When the size of an object does not meet the above two + conditions, the object is stored and managed via the direct and + indirect blocks based on the doubling table. +

+
+
+ + +
+

The specific format for each type of heap ID is described below: +

+ +
+ + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap ID for Tiny Objects (Sub-type 1 - + ‘Normal’) +
bytebytebytebyte
Version, Type, and LengthThis space inserted only to align table nicely

Data (variable size)
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap ID for Tiny Objects (Sub-type 1 - + ‘Normal’) +
Field NameDescription

Version, Type, and Length

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Tiny objects have a value of 2. +
0-3The length of the tiny object. The value stored + is one less than the actual length (since zero-length + objects are not allowed to be stored in the heap). + For example, an object of actual length 1 has an + encoded length of 0, an object of actual length 2 + has an encoded length of 1, and so on. +

+ +

Data

+

This is the data for the object. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap ID for Tiny Objects (Sub-type 2 - + ‘Extended’) +
bytebytebytebyte
Version, Type, and LengthExtended LengthThis space inserted only to align table nicely
Data (variable size)
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap ID for Tiny Objects (Sub-type 2 - + ‘Extended’) +
Field NameDescription

Version, Type, and Length

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Tiny objects have a value of 2. +
0-3These 4 bits, together with the next byte, form an + unsigned 12-bit integer for holding the length of the + object. These 4-bits are bits 8-11 of the 12-bit integer. + See description for the Extended Length field below. +

+ +

Extended Length

+

This byte, together with the 4 bits in the previous byte, + forms an unsigned 12-bit integer for holding the length of + the tiny object. These 8 bits are bits 0-7 of the 12-bit + integer formed. The value stored is one less than the actual + length (since zero-length objects are not allowed to be + stored in the heap). For example, an object of actual length + 1 has an encoded length of 0, an object of actual length + 2 has an encoded length of 1, and so on. +

+

Data

+

This is the data for the object. +

+
+
+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap ID for Huge Objects (Sub-types 1 and 2): + Indirectly Accessed, Non-filtered/Filtered +
bytebytebytebyte
Version and TypeThis space inserted + only to align table nicely

v2 B-tree KeyL (variable size)

+ + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap ID for Huge Objects (Sub-types 1 and 2): + Indirectly Accessed, Non-filtered/Filtered +
Field NameDescription

Version and Type

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Huge objects have a value of 1. +
0-3Reserved. +

+ +

v2 B-tree Key

This field is the B-tree key for retrieving the information + from the version 2 B-tree for huge objects needed to access the + object. See the description of v2 B-tree + records sub-types 1 and 2 for a description of the fields. New key + values are derived from Next Huge Object ID in the + Fractal Heap Header.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap ID for Huge Objects (Sub-type 3): + Directly Accessed, Non-filtered +
bytebytebytebyte
Version and TypeThis space inserted only to align table nicely

Address O


Length L

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap ID for Huge Objects (Sub-type 3): + Directly Accessed, Non-filtered +
Field NameDescription

Version and Type

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Huge objects have a value of 1. +
0-3Reserved. +

+ +

Address

This field is the address of the object in the file.

+

Length

This field is the length of the object in the file.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap ID for Huge Objects (Sub-type 4): + Directly Accessed, Filtered +
bytebytebytebyte
Version and TypeThis space inserted only to align table nicely

Address O


Length L

Filter Mask

De-filtered Size L

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap ID for Huge Objects (Sub-type 4): + Directly Accessed, Filtered +
Field NameDescription

Version and Type

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Huge objects have a value of 1. +
0-3Reserved. +

+ +

Address

This field is the address of the filtered object in the file.

+

Length

This field is the length of the filtered object in the file.

+

Filter Mask

This field is the I/O pipeline filter mask for the + filtered object in the file.

+

Filtered Size

This field is the size of the de-filtered object in the file.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap ID for Managed Objects +
bytebytebytebyte
Version and TypeThis space inserted only to align table nicely
Offset (variable size)
Length (variable size)
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap ID for Managed Objects +
Field NameDescription

Version and Type

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + +
BitDescription
6-7The current version of ID format. This document + describes version 0. +
4-5The ID type. Managed objects have a value of 0. +
0-3Reserved. +

+

Offset

This field is the offset of the object in the heap. + This field’s size is the minimum number of bytes + necessary to encode the Maximum Heap Size value + (from the Fractal Heap Header). For example, if the + value of the Maximum Heap Size is less than 256 bytes, + this field is 1 byte in length, a Maximum Heap Size + of 256-65535 bytes uses a 2 byte length, and so on.

Length

This field is the length of the object in the heap. It + is determined by taking the minimum value of Maximum + Direct Block Size and Maximum Size of Managed + Objects in the Fractal Heap Header. Again, + the minimum number of bytes needed to encode that value is + used for the size of this field.

+
+ +

+ III.H. Disk Format: Level 1H - Free-space Manager

+ +

+ Free-space managers are used to describe space within a heap or + the entire HDF5 file that is not currently used for that heap or + file. +

+ +

+ The free-space manager header contains metadata information + about the space being tracked, along with the address of the list + of free space sections which actually describes the free + space. The header records information about free-space sections being + tracked, creation parameters for handling free-space sections of a + client, and section information used to locate the collection of + free-space sections. +

+ +

+ The free-space section list stores a collection of + free-space sections that is specific to each client of the + free-space manager. + + For example, the fractal heap is a client of the free space manager + and uses it to track unused space within the heap. There are 4 + types of section records for the fractal heap, each of which has + its own format, listed below. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Free-space Manager Header +
bytebytebytebyte
Signature
VersionClient IDThis space inserted only to align table nicely

Total Space TrackedL


Total Number of SectionsL


Number of Serialized SectionsL


Number of Un-Serialized SectionsL

Number of Section ClassesThis space inserted only to align table nicely
Shrink PercentExpand Percent
Size of Address SpaceThis space inserted only to align table nicely

Maximum Section Size L


Address of Serialized Section ListO


Size of Serialized Section List UsedL


Allocated Size of Serialized Section ListL

Checksum
+ + + + + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Free-space Manager Header +
Field NameDescription

Signature

+

The ASCII character string “FSHD” + is used to indicate the beginning of the Free-space Manager + Header. This gives file consistency checking utilities a + better chance of reconstructing a damaged file. +

+

Version

+

This is the version number for the Free-space Manager Header + and this document describes version 0.

+

Client ID

+

This is the client ID for identifying the user of this + free-space manager: + + + + + + + + + + + + + + + + + + + +
IDDescription
0Fractal heap +
1File +
2+Reserved. +

+ +

Total Space Tracked

+

This is the total amount of free space being tracked, in bytes. +

+

Total Number of Sections

+

This is the total number of free-space sections being tracked. +

+

Number of Serialized Sections

+

This is the number of serialized free-space sections being + tracked. +

+

Number of Un-Serialized Sections

+

This is the number of un-serialized free-space sections being + managed. Un-serialized sections are created by the free-space + client when the list of sections is read in. +

+

Number of Section Classes

+

This is the number of section classes handled by this free space + manager for the free-space client. +

+

Shrink Percent

+

This is the percent of current size to shrink the allocated + serialized free-space section list. +

+

Expand Percent

+

This is the percent of current size to expand the allocated + serialized free-space section list. +

+

Size of Address Space

+

This is the size of the address space that free-space sections + are within. This is stored as the log2 of the + actual value (in other words, the number of bits required + to store values within that address space). +

+

Maximum Section Size

+

This is the maximum size of a section to be tracked. +

+

Address of Serialized Section List

+

This is the address where the serialized free-space section + list is stored. +

+

Size of Serialized Section List Used

+

This is the size of the serialized free-space section + list used (in bytes). This value must be less than + or equal to the allocated size of serialized section + list, below. +

+

Allocated Size of Serialized Section List

+

This is the size of serialized free-space section list + actually allocated (in bytes). +

+

Checksum

+

This is the checksum for the free-space manager header.

+
+
+ +
+

The free-space sections being managed are stored in a + free-space section list, described below. The sections + in the free-space section list are stored in the following way: + a count of the number of sections describing a particular size of + free space and the size of the free-space described (in bytes), + followed by a list of section description records; then another + section count and size, followed by the list of section + descriptions for that size; and so on.

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Free-space Section List +
bytebytebytebyte
Signature
VersionThis space inserted only to align table nicely

Free-space Manager Header AddressO

Number of Section Records in Set #0 (variable size)
Size of Free-space Section Described in Record Set #0 (variable size)
Record Set #0 Section Record #0 Offset(variable size)
Record Set #0 Section Record #0 TypeThis space inserted only to align table nicely
Record Set #0 Section Record #0 Data (variable size)
...
Record Set #0 Section Record #K-1 Offset(variable size)
Record Set #0 Section Record #K-1 TypeThis space inserted only to align table nicely
Record Set #0 Section Record #K-1 Data (variable size)
Number of Section Records in Set #1 (variable size)
Size of Free-space Section Described in Record Set #1 (variable size)
Record Set #1 Section Record #0 Offset(variable size)
Record Set #1 Section Record #0 TypeThis space inserted only to align table nicely
Record Set #1 Section Record #0 Data (variable size)
...
Record Set #1 Section Record #K-1 Offset(variable size)
Record Set #1 Section Record #K-1 TypeThis space inserted only to align table nicely
Record Set #1 Section Record #K-1 Data (variable size)
...
...
Number of Section Records in Set #N-1 (variable size)
Size of Free-space Section Described in Record Set #N-1 (variable size)
Record Set #N-1 Section Record #0 Offset(variable size)
Record Set #N-1 Section Record #0 TypeThis space inserted only to align table nicely
Record Set #N-1 Section Record #0 Data (variable size)
...
Record Set #N-1 Section Record #K-1 Offset(variable size)
Record Set #N-1 Section Record #K-1 TypeThis space inserted only to align table nicely
Record Set #N-1 Section Record #K-1 Data (variable size)
Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Free-space Section List +
Field NameDescription

Signature

+

The ASCII character string “FSSE” + is used to indicate the beginning of the Free-space Section + Information. This gives file consistency checking utilities + a better chance of reconstructing a damaged file. +

+

Version

+

This is the version number for the Free-space Section List + and this document describes version 0.

+

Free-space Manager Header Address

+

This is the address of the Free-space Manager Header. + This field is principally used for file + integrity checking. +

+

Number of Section Records for Set #N

+

This is the number of free-space section records for set #N. + The length of this field is the minimum number of bytes needed + to store the number of serialized sections (from the + free-space manager header). +

+ +

+ The number of sets of free-space section records is + determined by the size of serialized section list in + the free-space manager header. +

+

Section Size for Record Set #N

+

This is the size (in bytes) of the free-space section described + for all the section records in set #N. +

+ +

+ The length of this field is the minimum number of bytes needed + to store the maximum section size (from the + free-space manager header). +

+

Record Set #N Section #K Offset

+

This is the offset (in bytes) of the free-space section within + the client for the free-space manager. +

+ +

+ The length of this field is the minimum number of bytes needed + to store the size of address space (from the + free-space manager header). +

+

Record Set #N Section #K Type

+

This is the type of the section record, used to decode the + record set #N section #K data information. The defined + record type for file client is: + + + + + + + + + + + + + + + +
TypeDescription
0File’s section (a range of actual bytes in file) +
1+Reserved. +

+ +

The defined record types for a fractal heap client are: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
0Fractal heap “single” section +
1Fractal heap “first row” section +
2Fractal heap “normal row” section +
3Fractal heap “indirect” section +
4+Reserved. +

+ +

Record Set #N Section #K Data

+

This is the section-type specific information for each record + in the record set, described below. +

+

Checksum

+

This is the checksum for the Free-space Section List. +

+
+
+ +
+

+ The section-type specific data for each free-space section record is + described below: +

+ +
+ + + + + + +
+ Layout: File’s Section Data Record +
No additional record data stored
+
+ +
+
+
+
+ + + + + + +
+ Layout: Fractal Heap “Single” Section Data Record +
No additional record data stored
+
+ +
+
+
+
+ + + + + + +
+ Layout: Fractal Heap “First Row” Section Data + Record +
Same format as “indirect” + section data
+
+ +
+
+
+
+ + + + + + +
+ Layout: Fractal Heap “Normal Row” Section Data + Record +
No additional record data stored
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fractal Heap “Indirect” Section + Data Record +
bytebytebytebyte
Fractal Heap Indirect Block Offset (variable size)
Block Start RowBlock Start Column
Number of BlocksThis space inserted only to align table nicely
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fractal Heap “Indirect” Section + Data Record +
Field NameDescription

Fractal Heap Block Offset

+

The offset of the indirect block in the fractal heap’s address + space containing the empty blocks. +

+

+ The number of bytes used to encode this field is the minimum + number of bytes needed to encode values for the Maximum + Heap Size (in the fractal heap’s header). +

+

Block Start Row

+

This is the row that the empty blocks start in. +

+

Block Start Column

+

This is the column that the empty blocks start in. +

+

Number of Blocks

+

This is the number of empty blocks covered by the section. +

+
+
+ +

+ III.I. Disk Format: Level 1I - Shared Object Header Message Table

+ +

+ The shared object header message table is used to locate + object + header messages that are shared between two or more object headers + in the file. Shared object header messages are stored and indexed + in the file in one of two ways: indexed sequentially in a + shared header message list or indexed with a v2 B-tree. + The shared messages themselves are either stored in a fractal + heap (when two or more objects share the message), or remain in an + object’s header (when only one object uses the message currently, + but the message can be shared in the future). +

+ +

+ The shared object header message table + contains a list of shared message index headers. Each index header + records information about the version of the index format, the index + storage type, flags for the message types indexed, the number of + messages in the index, the address where the index resides, + and the fractal heap address if shared messages are stored there. +

+ +

+ Each index can be either a list or a v2 B-tree and may transition + between those two forms as the number of messages in the index + varies. Each shared message record contains information used to + locate the shared message from either a fractal heap or an object + header. The types of messages that can be shared are: Dataspace, + Datatype, Fill Value, Filter Pipeline and Attribute. +

+ +

+ The shared object header message table is pointed to + from a shared message table message + in the superblock extension for a file. This message stores the + version of the table format, along with the number of index headers + in the table. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Shared Object Header Message Table +
bytebytebytebyte
Signature
Version for index #0Index Type for index #0Message Type Flags for index #0
Minimum Message Size for index #0
List Cutoff for index #0v2 B-tree Cutoff for index #0
Number of Messages for index #0This space inserted only to align table nicely

Index AddressO for index #0


Fractal Heap AddressO for index #0

...
...
Version for index #N-1Index Type for index #N-1Message Type Flags for index #N-1
Minimum Message Size for index #N-1
List Cutoff for index #N-1v2 B-tree Cutoff for index #N-1
Number of Messages for index #N-1This space inserted only to align table nicely

Index AddressO for index #N-1


Fractal Heap AddressO for index #N-1

Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Shared Object Header Message Table +
Field NameDescription

Signature

+

The ASCII character string “SMTB” + is used to indicate the beginning of the Shared Object + Header Message table. This gives file consistency checking + utilities a better chance of reconstructing a damaged file. +

+

Version for index #N

+

This is the version number for the list of shared object header message + indexes and this document describes version 0.

+

Index Type for index #N

+

The type of index can be an unsorted list or a v2 B-tree. +

+

Message Type Flags for index #N

+

This field indicates the type of messages tracked in the index, + as follows: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitsDescription
0If set, the index tracks Dataspace Messages. +
1If set, the message tracks Datatype Messages. +
2If set, the message tracks Fill Value Messages. +
3If set, the message tracks Filter Pipeline Messages. +
4If set, the message tracks Attribute Messages. +
5-15Reserved (zero). +

+ + +

+ An index can track more than one type of message, but each type + of message can only by in one index. +

+

Minimum Message Size for index #N

+

This is the message size sharing threshold for the index. + If the encoded size of the message is less than this value, the + message is not shared. +

+

List Cutoff for index #N

+

This is the cutoff value for the indexing of messages to + switch from a list to a v2 B-tree. If the number of messages + is greater than this value, the index should be a v2 B-tree. +

+

v2 B-tree Cutoff for index #N

+

This is the cutoff value for the indexing of messages + to switch from a v2 B-tree back to a list. If the number + of messages is less than this value, the index should be + a list. +

+

Number of Messages for index #N

+

The number of shared messages being tracked for the index. +

+

Index Address for index #N

+

This field is the address of the list or v2 B-tree where the + index nodes reside. +

+

Fractal Heap Address for index #N

+

This field is the address of the fractal heap if shared messages + are stored there. +

+

Checksum

+

This is the checksum for the table.

+
+
+ +
+

+ Shared messages are indexed either with a shared message record + list, described below, or using a v2 B-tree (using record type 7). + The number of records in the shared message record list is + determined in the index’s entry in the shared object header message + table. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Shared Message Record List +
bytebytebytebyte
Signature
Shared Message Record #0
Shared Message Record #1
...
Shared Message Record #N-1
Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Shared Message Record List +
Field NameDescription

Signature

+

The ASCII character string “SMLI” + is used to indicate the beginning of a list of index nodes. + This gives file consistency checking utilities a better + chance of reconstructing a damaged file. +

+

Shared Message Record #N

+

The record for locating the shared message, either in the + fractal heap for the index, or an object header (see format for + index nodes below). +

+

Checksum

+

This is the checksum for the list. +

+
+
+ +
+

+ The record for each shared message in an index is stored in one + of the following forms: +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Shared Message Record for Messages Stored in a + Fractal Heap +
bytebytebytebyte
Message LocationThis space inserted only to align table nicely
Hash Value
Reference Count

Fractal Heap ID

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Shared Message Record for Messages Stored in a + Fractal Heap +
Field NameDescription

Message Location

+

This has a value of 0 indicating that the message is stored in + the heap. +

+

Hash Value

+

This is the hash value for the message. +

+

Reference Count

+

This is the number of times the message is used in the file. +

+

Fractal Heap ID

+

This is an 8-byte fractal heap ID for the message as stored in + the fractal heap for the index. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Shared Message Record for Messages Stored in an + Object Header +
bytebytebytebyte
Message LocationThis space inserted only to align table nicely
Hash Value
ReservedMessage TypeCreation Index

Object Header AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Shared Message Record for Messages Stored in an + Object Header +
Field NameDescription

Message Location

+

This has a value of 1 indicating that the message is stored in + an object header. +

+

Hash Value

+

This is the hash value for the message. +

+

Message Type

+

This is the message type in the object header. +

+

Creation Index

+

This is the creation index of the message within the object + header. +

+

Object Header Address

+

This is the address of the object header where the message is + located. +

+
+
+ +

+ IV. Disk Format: Level 2 - Data Objects

+ +

Data objects contain the “real” user-visible information in the file. + These objects compose the scientific data and other information which + are generally thought of as “data” by the end-user. All the + other information in the file is provided as a framework for + storing and accessing these data objects. +

+ +

A data object is composed of header and data + information. The header information contains the information + needed to interpret the data information for the object as + well as additional “metadata” or pointers to additional + “metadata” used to describe or annotate each object. +

+ +

+ IV.A. Disk Format: Level 2A - Data Object Headers

+ +

The header information of an object is designed to encompass + all of the information about an object, except for the data itself. + This information includes the dataspace, the datatype, information + about how the data is stored on disk (in external files, compressed, + broken up in blocks, and so on), as well as other information used + by the library to speed up access to the data objects or maintain + a file’s integrity. Information stored by user applications + as attributes is also stored in the object’s header. The header + of each object is not necessarily located immediately prior to the + object’s data in the file and in fact may be located in any + position in the file. The order of the messages in an object header + is not significant.

+ +

Object headers are composed of a prefix and a set of messages. The + prefix contains the information needed to interpret the messages and + a small amount of metadata about the object, and the messages contain + the majority of the metadata about the object. +

+ +

+ IV.A.1. Disk Format: Level 2A1 - Data Object Header Prefix

+ + + +

+ IV.A.1.a. Version 1 Data Object Header Prefix

+ +

Header messages are aligned on 8-byte boundaries for version 1 + object headers. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 1 Object Header +
bytebytebytebyte
VersionReserved (zero)Total Number of Header Messages
Object Reference Count
Object Header Size
Reserved (zero)
Header Message Type #1Size of Header Message Data #1
Header Message #1 FlagsReserved (zero)

Header Message Data #1

.
.
.
Header Message Type #nSize of Header Message Data #n
Header Message #n FlagsReserved (zero)

Header Message Data #n

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 1 Object Header +
Field NameDescription

Version

+

This value is used to determine the format of the + information in the object header. When the format of the + object header is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted. This + is version one (1) (there was no version zero (0)) of the + object header. +

+

Total Number of Header Messages

+

This value determines the total number of messages listed in + object headers for this object. This value includes the messages + in continuation messages for this object. +

+

Object Reference Count

+

This value specifies the number of “hard links” to this object + within the current file. References to the object from external + files, “soft links” in this file and object references in this + file are not tracked. +

+

Object Header Size

+

This value specifies the number of bytes of header message data + following this length field that contain object header messages + for this object header. This value does not include the size of + object header continuation blocks for this object elsewhere in the + file. +

+

Header Message #n Type

+

This value specifies the type of information included in the + following header message data. The message types for + header messages are defined in sections below. +

+

Size of Header Message #n Data

+

This value specifies the number of bytes of header + message data following the header message type and length + information for the current message. The size includes + padding bytes to make the message a multiple of eight + bytes. +

+

Header Message #n Flags

+

This is a bit field with the following definition: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, the message data is constant. This is used + for messages like the datatype message of a dataset. +
1If set, the message is shared and stored + in another location than the object header. The Header + Message Data field contains a Shared Message + (described in the Data Object Header Messages + section below) + and the Size of Header Message Data field + contains the size of that Shared Message. +
2If set, the message should not be shared. +
3If set, the HDF5 decoder should fail to open this object + if it does not understand the message’s type and the file + is open with permissions allowing write access to the file. + (Normally, unknown messages can just be ignored by HDF5 + decoders) +
4If set, the HDF5 decoder should set bit 5 of this + message’s flags (in other words, this bit field) + if it does not understand the message’s type + and the object is modified in any way. (Normally, + unknown messages can just be ignored by HDF5 + decoders) +
5If set, this object was modified by software that did not + understand this message. + (Normally, unknown messages should just be ignored by HDF5 + decoders) (Can be used to invalidate an index or a similar + feature) +
6If set, this message is shareable. +
7If set, the HDF5 decoder should always fail to open this + object if it does not understand the message’s type (whether + it is open for read-only or read-write access). (Normally, + unknown messages can just be ignored by HDF5 decoders) +

+ +

Header Message #n Data

+

The format and length of this field is determined by the + header message type and size respectively. Some header + message types do not require any data and this information + can be eliminated by setting the length of the message to + zero. The data is padded with enough zeroes to make the + size a multiple of eight. +

+
+
+ +

+ IV.A.1.b. Version 2 Data Object Header Prefix

+ +

Note that the “total number of messages” field has been dropped from + the data object header prefix in this version. The number of messages + in the data object header is just determined by the messages encountered + in all the object header blocks.

+ +

Note also that the fields and messages in this version of data object + headers have no alignment or padding bytes inserted - they are + stored packed together.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 Object Header +
bytebytebytebyte
Signature
VersionFlagsThis space inserted only to align table nicely
Access time (optional)
Modification Time (optional)
Change Time (optional)
Birth Time (optional)
Maximum # of compact attributes (optional)Minimum # of dense attributes (optional)
Size of Chunk #0 (variable size)This space inserted only to align table nicely
Header Message Type #1Size of Header Message Data #1Header Message #1 Flags
Header Message #1 Creation Order (optional)This space inserted only to align table nicely

Header Message Data #1

.
.
.
Header Message Type #nSize of Header Message Data #nHeader Message #n Flags
Header Message #n Creation Order (optional)This space inserted only to align table nicely

Header Message Data #n

Gap (optional, variable size)
Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 Object Header +
Field NameDescription

Signature

+

The ASCII character string “OHDR” + is used to indicate the beginning of an object header. This + gives file consistency checking utilities a better chance + of reconstructing a damaged file. +

+

Version

+

This field has a value of 2 indicating version 2 of the object header. +

+

Flags

+

This field is a bit field indicating additional information + about the object header. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bit(s)Description
0-1This two bit field determines the size of the + Size of Chunk #0 field. The values are: + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0The Size of Chunk #0 field is 1 byte. +
1The Size of Chunk #0 field is 2 bytes. +
2The Size of Chunk #0 field is 4 bytes. +
3The Size of Chunk #0 field is 8 bytes. +
+
2If set, attribute creation order is tracked.
3If set, attribute creation order is indexed.
4If set, non-default attribute storage phase change + values are stored.
5If set, access, modification, change and birth times + are stored.
6-7Reserved

+ +

Access Time

+

This 32-bit value represents the number of seconds after the + UNIX epoch when the object’s raw data was last accessed + (in other words, read or written). +

+

This field is present if bit 5 of flags is set. +

+

Modification Time

+

This 32-bit value represents the number of seconds after + the UNIX epoch when the object’s raw data was last + modified (in other words, written). +

+

This field is present if bit 5 of flags is set. +

+

Change Time

+

This 32-bit value represents the number of seconds after the + UNIX epoch when the object’s metadata was last changed. +

+

This field is present if bit 5 of flags is set. +

+

Birth Time

+

This 32-bit value represents the number of seconds after the + UNIX epoch when the object was created. +

+

This field is present if bit 5 of flags is set. +

+

Maximum # of compact attributes

+

This is the maximum number of attributes to store in the compact + format before switching to the indexed format. +

+

This field is present if bit 4 of flags is set. +

+

Minimum # of dense attributes

+

This is the minimum number of attributes to store in the indexed + format before switching to the compact format. +

+

This field is present if bit 4 of flags is set. +

+

Size of Chunk #0

+

+ This unsigned value specifies the number of bytes of header + message data following this field that contain object header + information. +

+

+ This value does not include the size of object header + continuation blocks for this object elsewhere in the file. +

+

+ The length of this field varies depending on bits 0 and 1 of + the flags field. +

+

Header Message #n Type

+

Same format as version 1 of the object header, described above. +

+

Size of Header Message #n Data

+

This value specifies the number of bytes of header + message data following the header message type and length + information for the current message. The size of messages + in this version does not include any padding bytes. +

+

Header Message #n Flags

+

Same format as version 1 of the object header, described above. +

+

Header Message #n Creation Order

+

This field stores the order that a message of a given type + was created in. +

+

This field is present if bit 2 of flags is set. +

+

Header Message #n Data

+

Same format as version 1 of the object header, described above. +

+

Gap

+

A gap in an object header chunk is inferred by the end of the + messages for the chunk before the beginning of the chunk’s + checksum. Gaps are always smaller than the size of an + object header message prefix (message type + message size + + message flags). +

+

Gaps are formed when a message (typically an attribute message) + in an earlier chunk is deleted and a message from a later + chunk that does not quite fit into the free space is moved + into the earlier chunk. +

+

Checksum

+

This is the checksum for the object header chunk. +

+
+
+ +

The header message types and the message data associated with + them compose the critical “metadata” about each object. Some + header messages are required for each object while others are + optional. Some optional header messages may also be repeated + several times in the header itself, the requirements and number + of times allowed in the header will be noted in each header + message description below. +

+ + +

+ IV.A.2. Disk Format: Level 2A2 - Data Object Header Messages

+ +

Data object header messages are small pieces of metadata that are + stored in the data object header for each object in an HDF5 file. + Data object header messages provide the metadata required to describe + an object and its contents, as well as optional pieces of metadata + that annotate the meaning or purpose of the object. +

+ +

Data object header messages are either stored directly in the data + object header for the object or are shared between multiple objects + in the file. When a message is shared, a flag in the Message Flags + indicates that the actual Message Data + portion of that message is stored in another location (such as another + data object header, or a heap in the file) and the Message Data + field contains the information needed to locate the actual information + for the message. +

+ +

+ The format of shared message data is described here:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Shared Message (Version 1) +
bytebytebytebyte
VersionTypeReserved (zero)
Reserved (zero)

AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Shared Message (Version 1) +
Field NameDescription

Version

The version number is used when there are changes in the format + of a shared object message and is described here: + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by the library before version 1.6.1. +

+

Type

The type of shared message location: + + + + + + + + + + +
ValueDescription
0Message stored in another object’s header (a committed + message). +

+

Address

The address of the object header + containing the message to be shared.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ Layout: Shared Message (Version 2) +
bytebytebytebyte
VersionTypeThis space inserted only to align table nicely

AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Shared Message (Version 2) +
Field NameDescription

Version

The version number is used when there are changes in the format + of a shared object message and is described here: + + + + + + + + + + +
VersionDescription
2Used by the library of version 1.6.1 and after. +

+

Type

The type of shared message location: + + + + + + + + + + +
ValueDescription
0Message stored in another object’s header (a committed + message). +

+

Address

The address of the object header + containing the message to be shared.

+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Layout: Shared Message (Version 3) +
bytebytebytebyte
VersionTypeThis space inserted only to align table nicely
Location (variable size)
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Shared Message (Version 3) +
Field NameDescription

Version

The version number indicates changes in the format of shared + object message and is described here: + + + + + + + + + + +
VersionDescription
3Used by the library of version 1.8 and after. In this + version, the Type field can indicate that + the message is stored in the fractal heap. +

+

Type

The type of shared message location: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Message is not shared and is not shareable. +
1Message stored in file’s shared object header message + heap (a shared message). +
2Message stored in another object’s header (a committed + message). +
3Message stored is not shared, but is sharable. +

+

Location

This field contains either a + Size of Offsets-bytes address of the object header + containing the message to be shared, or an 8-byte fractal heap + ID for the message in the file’s shared object header + message heap. +

+
+
+ + +

The following is a list of currently defined header messages: +

+ +

IV.A.2.a. The NIL Message

+ + +
+ + + + + + + + +
Header Message Name: NIL
Header Message Type: 0x0000
Length: Varies
Status: Optional; may be repeated.
Description:The NIL message is used to indicate a message which is to be + ignored when reading the header messages for a data object. + [Possibly one which has been deleted for some reason.] +
Format of Data: Unspecified
+ + + +

IV.A.2.b. The Dataspace Message

+ + +
+ + + + + + + + + + +
Header Message Name: Dataspace
Header Message Type: 0x0001
Length: Varies according to the number of + dimensions, as described in the following table.
Status: Required for dataset objects; + may not be repeated.
Description:The dataspace message describes the number of dimensions (in + other words, “rank”) and size of each dimension that + the data object has. This message is only used for datasets which + have a simple, rectilinear, array-like layout; datasets requiring + a more complex layout are not yet supported. +
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Dataspace Message - Version 1 +
bytebytebytebyte
VersionDimensionalityFlagsReserved
Reserved

Dimension #1 SizeL

.
.
.

Dimension #n SizeL


Dimension #1 Maximum SizeL (optional)

.
.
.

Dimension #n Maximum SizeL (optional)


Permutation Index #1L (optional)

.
.
.

Permutation Index #nL (optional)

+ + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Dataspace Message - Version 1 +
Field NameDescription

Version

+

This value is used to determine the format of the + Dataspace Message. When the format of the + information in the message is changed, the version number + is incremented and can be used to determine how the + information in the object header is formatted. This + document describes version one (1) (there was no version + zero (0)). +

+

Dimensionality

+

This value is the number of dimensions that the data + object has. +

+

Flags

+

This field is used to store flags to indicate the + presence of parts of this message. Bit 0 (the least + significant bit) is used to indicate that maximum + dimensions are present. Bit 1 is used to indicate that + permutation indices are present. +

+

Dimension #n Size

+

This value is the current size of the dimension of the + data as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+

Dimension #n Maximum Size

+

This value is the maximum size of the dimension of the + data as stored in the file. This value may be the special + “unlimited” size which indicates + that the data may expand along this dimension indefinitely. + If these values are not stored, the maximum size of each + dimension is assumed to be the dimension’s current size. +

+

Permutation Index #n

+

This value is the index permutation used to map + each dimension from the canonical representation to an + alternate axis for each dimension. If these values are + not stored, the first dimension stored in the list of + dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+
+
+ + + +
+

Version 2 of the dataspace message dropped the optional + permutation index value support, as it was never implemented in the + HDF5 Library:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Dataspace Message - Version 2 +
bytebytebytebyte
VersionDimensionalityFlagsType

Dimension #1 SizeL

.
.
.

Dimension #n SizeL


Dimension #1 Maximum SizeL (optional)

.
.
.

Dimension #n Maximum SizeL (optional)

+ + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Dataspace Message - Version 2 +
Field NameDescription

Version

+

This value is used to determine the format of the + Dataspace Message. This field should be ‘2’ for version 2 + format messages. +

+

Dimensionality

+

This value is the number of dimensions that the data object has. +

+

Flags

+

This field is used to store flags to indicate the + presence of parts of this message. Bit 0 (the least + significant bit) is used to indicate that maximum + dimensions are present. +

+

Type

+

This field indicates the type of the dataspace: + + + + + + + + + + + + + + + + + + +
ValueDescription
0A scalar dataspace; in other words, + a dataspace with a single, dimensionless element. +
1A simple dataspace; in other words, + a dataspace with a rank greater than 0 and an + appropriate number of dimensions. +
2A null dataspace; in other words, + a dataspace with no elements. +

+

Dimension #n Size

+

This value is the current size of the dimension of the + data as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+

Dimension #n Maximum Size

+

This value is the maximum size of the dimension of the + data as stored in the file. This value may be the special + “unlimited” size which indicates + that the data may expand along this dimension indefinitely. + If these values are not stored, the maximum size of each + dimension is assumed to be the dimension’s current size. +

+
+
+ + + + + +

IV.A.2.c. The Link Info Message

+ + +
+ + + + + + + + +
Header Message Name: Link Info
Header Message Type: 0x002
Length: Varies
Status: Optional; may not be + repeated.
Description:The link info message tracks variable information about the + current state of the links for a “new style” + group’s behavior. Variable information will be stored in + this message and constant information will be stored in the + Group Info message. +
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Link Info +
bytebytebytebyte
VersionFlagsThis space inserted only to align table nicely

Maximum Creation Index (8 bytes, optional)


Fractal Heap AddressO


Address of v2 B-tree for Name IndexO


Address of v2 B-tree for Creation Order IndexO (optional)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Link Info +
Field NameDescription

Version

+

The version number for this message. This document describes + version 0.

+

Flags

This field determines various optional aspects of the link + info message: + + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, creation order for the links is tracked. +
1If set, creation order for the links is indexed. +
2-7Reserved

+ +

Maximum Creation Index

This 64-bit value is the maximum creation order index value + stored for a link in this group.

+

This field is present if bit 0 of flags is set.

+

Fractal Heap Address

+

+ This is the address of the fractal heap to store dense links. + Each link stored in the fractal heap is stored as a + Link Message. +

+

+ If there are no links in the group, or the group’s links + are stored “compactly” (as object header messages), this + value will be the undefined + address. +

+

Address of v2 B-tree for Name Index

This is the address of the version 2 B-tree to index names of links.

+

If there are no links in the group, or the group’s links + are stored “compactly” (as object header messages), this + value will be the undefined + address. +

+

Address of v2 B-tree for Creation Order Index

This is the address of the version 2 B-tree to index creation order of links.

+

If there are no links in the group, or the group’s links + are stored “compactly” (as object header messages), this + value will be the undefined + address. +

+

This field exists if bit 1 of flags is set.

+
+
+ + +

IV.A.2.d. The Datatype Message

+ + +
+ + + + + + + + +
Header Message Name: Datatype
Header Message Type: 0x0003 +
Length: Variable
Status: Required for dataset or committed + datatype (formerly named datatype) objects; may not be repeated. +
Description:

The datatype message defines the datatype for each element + of a dataset or a common datatype for sharing between multiple + datasets. A datatype can describe an atomic type like a fixed- + or floating-point type or more complex types like a C struct + (compound datatype), array (array datatype), or C++ vector + (variable-length datatype).

+

Datatype messages that are part of a dataset object do not + describe how elements are related to one another; the dataspace + message is used for that purpose. Datatype messages that are part of + a committed datatype (formerly named datatype) message describe + a common datatype that can be shared by multiple datasets in the + file.

+
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Datatype Message +
bytebytebytebyte
Class and VersionClass Bit Field, Bits 0-7Class Bit Field, Bits 8-15Class Bit Field, Bits 16-23
Size


Properties


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Datatype Message +
Field NameDescription

Class and Version

+

The version of the datatype message and the datatype’s class + information are packed together in this field. The version + number is packed in the top 4 bits of the field and the class + is contained in the bottom 4 bits. +

+

The version number information is used for changes in the + format of the datatype message and is described here: + + + + + + + + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used +
1Used by early versions of the library to encode + compound datatypes with explicit array fields. + See the compound datatype description below for + further details. +
2Used when an array datatype needs to be encoded. +
3Used when a VAX byte-ordered type needs to be + encoded. Packs various other datatype classes more + efficiently also. +
4Used to encode the revised reference datatype. +

+ +

The class of the datatype determines the format for the class + bit field and properties portion of the datatype message, which + are described below. The + following classes are currently defined: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Fixed-Point
1Floating-Point
2 Time
3String
4Bit field
5Opaque
6Compound
7Reference
8Enumerated
9Variable-Length
10Array

+ +

Class Bit Fields

+

The information in these bit fields is specific to each datatype + class and is described below. All bits not defined for a + datatype class are set to zero. +

+

Size

+

The size of a datatype element in bytes. +

+

Properties

+

This variable-sized sequence of bytes encodes information + specific to each datatype class and is described for each class + below. If there is no property information specified for a + datatype class, the size of this field is zero bytes. +

+
+
+ + +
+
+ +

Class specific information for the Fixed-point Numbers class + (Class 0):

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bits: Fixed-point Bit Field Description +
BitsMeaning

0

Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.

1, 2

Padding type. Bit 1 is the lo_pad bit and bit 2 + is the hi_pad bit. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.

3

Signed. If this bit is set then the fixed-point + number is in 2’s complement form.

4-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + + +
+ Layout: Fixed-point Property Description +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Fixed-point Property Description +
Field NameDescription

Bit Offset

+

The bit offset of the first significant bit of the fixed-point + value within the datatype. The bit offset specifies the number + of bits “to the right of” the value (which are set to the + lo_pad bit value). +

+

Bit Precision

+

The number of bits of precision of the fixed-point value + within the datatype. This value, combined with the datatype + element’s size and the Bit Offset field specifies the number + of bits “to the left of” the value (which are set to the + hi_pad bit value). +

+
+
+ + +
+
+ +

Class specific information for the Floating-point Numbers class + (Class 1):

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bits: Floating-point Bit Field Description +
BitsMeaning

0, 6

Byte Order. These two non-contiguous bits specify the + “endianness” of the bytes in the datatype element. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bit 6Bit 0Description
00Byte order is little-endian +
01Byte order is big-endian +
10Reserved +
11Byte order is VAX-endian +

+

1, 2, 3

Padding type. Bit 1 is the low bits pad type, bit 2 + is the high bits pad type, and bit 3 is the internal bits + pad type. If a datum has unused bits at either end or between + the sign bit, exponent, or mantissa, then the value of bit + 1, 2, or 3 is copied to those locations.

4-5

Mantissa Normalization. This 2-bit bit field specifies + how the most significant bit of the mantissa is managed. + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0No normalization +
1The most significant bit of the mantissa is always set + (except for 0.0). +
2The most significant bit of the mantissa is not stored, + but is implied to be set. +
3Reserved. +

+

7

Reserved (zero).

8-15

Sign Location. This is the bit position of the sign + bit. Bits are numbered with the least significant bit zero.

16-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Floating-point Property Description +
ByteByteByteByte
Bit OffsetBit Precision
Exponent LocationExponent SizeMantissa LocationMantissa Size
Exponent Bias
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Floating-point Property Description +
Field NameDescription

Bit Offset

+

The bit offset of the first significant bit of the floating-point + value within the datatype. The bit offset specifies the number + of bits “to the right of” the value. +

+

Bit Precision

+

The number of bits of precision of the floating-point value + within the datatype. +

+

Exponent Location

+

The bit position of the exponent field. Bits are numbered with + the least significant bit number zero. +

+

Exponent Size

+

The size of the exponent field in bits. +

+

Mantissa Location

+

The bit position of the mantissa field. Bits are numbered with + the least significant bit number zero. +

+

Mantissa Size

+

The size of the mantissa field in bits. +

+

Exponent Bias

+

The bias of the exponent field. +

+
+
+ + +
+
+ +

Class specific information for the Time class (Class 2):

+ + +
+ + + + + + + + + + + + + + + + + +
+ Bits: Time Bit Field Description +
BitsMeaning

0

Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.

1-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + +
+ Layout: Time Property Description +
ByteByte
Bit Precision
+
+ +
+
+ + + + + + + + + + + + +
+ Fields: Time Property Description +
Field NameDescription

Bit Precision

+

The number of bits of precision of the time value. +

+
+
+ + +
+ +

Class specific information for the Strings class (Class 3):

+ + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ Bits: String Bit Field Description +
BitsMeaning

0-3

Padding type. This four-bit value determines the + type of padding to use for the string. The values are: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Null Terminate: A zero byte marks the end of the + string and is guaranteed to be present after + converting a long string to a short string. When + converting a short string to a long string the value is + padded with additional null characters as necessary. +
1Null Pad: Null characters are added to the end of + the value during conversions from short values to long + values but conversion in the opposite direction simply + truncates the value. +
2Space Pad: Space characters are added to the end of + the value during conversions from short values to long + values but conversion in the opposite direction simply + truncates the value. This is the Fortran + representation of the string. +
3-15Reserved +

+

4-7

Character Set. The character set used to + encode the string. + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0ASCII character set encoding +
1UTF-8 character set encoding +
2-15Reserved +

+

8-23

Reserved (zero).

+
+ +

There are no properties defined for the string class. +

+ +
+
+ +

Class specific information for the Bit Fields class (Class 4):

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ Bits: Bitfield Bit Field Description +
BitsMeaning

0

Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.

1, 2

Padding type. Bit 1 is the lo_pad type and bit 2 + is the hi_pad type. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.

3-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + + +
+ Layout: Bit Field Property Description +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Bit Field Property Description +
Field NameDescription

Bit Offset

+

The bit offset of the first significant bit of the bit field + within the datatype. The bit offset specifies the number + of bits “to the right of” the value. +

+

Bit Precision

+

The number of bits of precision of the bit field + within the datatype. +

+
+
+ + +
+
+ +

Class specific information for the Opaque class (Class 5):

+ +
+ + + + + + + + + + + + + + + + + +
+ Bits: Opaque Bit Field Description +
BitsMeaning

0-7

Length of ASCII tag in bytes.

8-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + +
+ Layout: Opaque Property Description +
ByteByteByteByte

ASCII Tag
+
+
+ +
+
+ + + + + + + + + + + +
+ Fields: Opaque Property Description +
Field NameDescription

ASCII Tag

+

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+
+
+ + +
+
+ +

Class specific information for the Compound class (Class 6):

+ +
+ + + + + + + + + + + + + + + + + +
+ Bits: Compound Bit Field Description +
BitsMeaning

0-15

Number of Members. This field contains the number + of members defined for the compound datatype. The member + definitions are listed in the Properties field of the data + type message.

16-23

Reserved (zero).

+
+ + +

The Properties field of a compound datatype is a list of the + member definitions of the compound datatype. The member + definitions appear one after another with no intervening bytes. + The member types are described with a (recursively) encoded datatype + message.

+ +

Note that the property descriptions are different for different + versions of the datatype version. Additionally note that the version + 0 datatype encoding is deprecated and has been replaced with later + encodings in versions of the HDF5 Library from the 1.4 release + onward.

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Compound Properties Description for Datatype Version 1 +
ByteByteByteByte

Name

Byte Offset of Member
DimensionalityReserved (zero)
Dimension Permutation
Reserved (zero)
Dimension #1 Size (required)
Dimension #2 Size (required)
Dimension #3 Size (required)
Dimension #4 Size (required)

Member Type Message

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Compound Properties Description for Datatype Version 1 +
Field NameDescription

Name

+

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+

Byte Offset of Member

+

This is the byte offset of the member within the datatype. +

+

Dimensionality

+

If set to zero, this field indicates a scalar member. If set + to a value greater than zero, this field indicates that the + member is an array of values. For array members, the size of + the array is indicated by the ‘Size of Dimension n’ field in + this message. +

+

Dimension Permutation

+

This field was intended to allow an array field to have + its dimensions permuted, but this was never implemented. + This field should always be set to zero. +

+

Dimension #n Size

+

This field is the size of a dimension of the array field as + stored in the file. The first dimension stored in the list of + dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+

Member Type Message

+

This field is a datatype message describing the datatype of + the member. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Compound Properties Description for Datatype Version 2 +
ByteByteByteByte

Name

Byte Offset of Member

Member Type Message

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Compound Properties Description for Datatype Version 2 +
Field NameDescription

Name

+

This NUL-terminated string provides a description for the + opaque type. It is NUL-padded to a multiple of 8 bytes. +

+

Byte Offset of Member

+

This is the byte offset of the member within the datatype. +

+

Member Type Message

+

This field is a datatype message describing the datatype of + the member. +

+
+
+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Compound Properties Description for Datatype Version 3 +
ByteByteByteByte

Name

Byte Offset of Member (variable size)

Member Type Message

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Compound Properties Description for Datatype Version 3 +
Field NameDescription

Name

This NUL-terminated string provides a description for the + opaque type. It is not NUL-padded to a multiple of 8 + bytes.

Byte Offset of Member

This is the byte offset of the member within the datatype. + The field size is the minimum number of bytes necessary, + based on the size of the datatype element. For example, a + datatype element size of less than 256 bytes uses a 1 byte + length, a datatype element size of 256-65535 bytes uses a + 2 byte length, and so on.

Member Type Message

This field is a datatype message describing the datatype of + the member.

+
+ + +
+
+ +

Class specific information for the Reference class (Class 7):

+ +
+ + + + + + + + + + + + + + + + + +
+ Bits: Reference Bit Field Description for Datatype Version < 4 +
BitsMeaning

0-3

Type. This four-bit value contains the reference types which are supported for + backward compatibility. The values defined are: + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Object Reference (H5R_OBJECT1): A reference to another object in this + HDF5 file. +
1Dataset Region Reference (H5R_DATASET_REGION1): A reference to a region within + a dataset in this HDF5 file. +
2-15Reserved +

+ +

4-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Bits: Reference Bit Field Description for Datatype Version 4 +
BitsMeaning

0-3

Type. This four-bit value contains the revised reference types. + The values defined are: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
2Object Reference (H5R_OBJECT2): A reference to another object + in this file or an external file. +
3Dataset Region Reference (H5R_DATASET_REGION2): A reference to a region within + a dataset in this file or an external file. +
4Attribute Reference (H5R_ATTR): A reference to an attribute attached to an + object in this file or an external file. +
5-15Reserved +

+ +

4-7

Version. This four-bit value contains the version for encoding + the revised reference types. The values defined are: + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Unused +
1The version for encoding the revised reference types: Object Reference (2), + Dataset Region Reference (3) and Attribute Reference (4). +
2-15Reserved +

+ +

8-23

Reserved (zero).

+
+ +

There are no properties defined for the reference class. +

+ + +
+
+ +

Class specific information for the Enumeration class (Class 8):

+ +
+ + + + + + + + + + + + + + + + + +
+ Bits: Enumeration Bit Field Description +
BitsMeaning

0-15

Number of Members. The number of name/value + pairs defined for the enumeration type.

16-23

Reserved (zero).

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Enumeration Property Description for Datatype Versions + 1 and 2 +
ByteByteByteByte

Base Type


Names


Values

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Enumeration Property Description for Datatype Versions + 1 and 2 +
Field NameDescription

Base Type

+

Each enumeration type is based on some parent type, usually an + integer. The information for that parent type is described + recursively by this field. +

+

Names

+

The name for each name/value pair. Each name is stored as a null + terminated ASCII string in a multiple of eight bytes. The names + are in no particular order. +

+

Values

+

The list of values in the same order as the names. The values + are packed (no inter-value padding) and the size of each value + is determined by the parent type. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Enumeration Property Description for Datatype Version 3 +
ByteByteByteByte

Base Type


Names


Values

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Enumeration Property Description for Datatype Version 3 +
Field NameDescription

Base Type

+

Each enumeration type is based on some parent type, usually an + integer. The information for that parent type is described + recursively by this field. +

+

Names

+

The name for each name/value pair. Each name is stored as a null + terminated ASCII string, not padded to a multiple of + eight bytes. The names are in no particular order. +

+

Values

+

The list of values in the same order as the names. The values + are packed (no inter-value padding) and the size of each value + is determined by the parent type. +

+
+
+ + + +
+ +

Class specific information for the Variable-length class (Class 9):

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Bits: Variable-length Bit Field Description +
BitsMeaning

0-3

Type. This four-bit value contains the type of + variable-length datatype described. The values defined are: + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Sequence: A variable-length sequence of any datatype. + Variable-length sequences do not have padding or + character set information. +
1String: A variable-length sequence of characters. + Variable-length strings have padding and character set + information. +
2-15Reserved +

+ +

4-7

Padding type. (variable-length string only) + This four-bit value determines the type of padding + used for variable-length strings. The values are the same + as for the string padding type, as follows: + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Null terminate: A zero byte marks the end of a string + and is guaranteed to be present after converting a long + string to a short string. When converting a short string + to a long string, the value is padded with additional null + characters as necessary. +
1Null pad: Null characters are added to the end of the + value during conversion from a short string to a longer + string. Conversion from a long string to a shorter string + simply truncates the value. +
2Space pad: Space characters are added to the end of the + value during conversion from a short string to a longer + string. Conversion from a long string to a shorter string + simply truncates the value. This is the Fortran + representation of the string. +
3-15Reserved +

+ +

This value is set to zero for variable-length sequences.

+ +

8-11

Character Set. (variable-length string only) + This four-bit value specifies the character set + to be used for encoding the string: + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0ASCII character set encoding +
1UTF-8 character set encoding +
2-15Reserved +

+ +

This value is set to zero for variable-length sequences.

+ +

12-23

Reserved (zero).

+
+ +
+
+ + + + + + + + + + + + + + +
+ Layout: Variable-length Property Description +
ByteByteByteByte

Base Type

+
+ +
+
+ + + + + + + + + + + + +
+ Fields: Variable-length Property Description +
Field NameDescription

Base Type

+

Each variable-length type is based on some parent type. The + information for that parent type is described recursively by + this field. +

+
+
+ + +
+
+ +

Class specific information for the Array class (Class 10):

+ +

There are no bit fields defined for the array class. +

+ +

Note that the dimension information defined in the property for this + datatype class is independent of dataspace information for a dataset. + The dimension information here describes the dimensionality of the + information within a data element (or a component of an element, if the + array datatype is nested within another datatype) and the dataspace for a + dataset describes the size and locations of the elements in a dataset. +

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Array Property Description for Datatype Version 2 +
ByteByteByteByte
DimensionalityReserved (zero)
Dimension #1 Size
.
.
.
Dimension #n Size
Permutation Index #1
.
.
.
Permutation Index #n

Base Type

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Array Property Description for Datatype Version 2 +
Field NameDescription

Dimensionality

+

This value is the number of dimensions that the array has. +

+

Dimension #n Size

+

This value is the size of the dimension of the array + as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+

Permutation Index #n

+

This value is the index permutation used to map + each dimension from the canonical representation to an + alternate axis for each dimension. Currently, dimension + permutations are not supported, and these indices should + be set to the index position minus one. In other words, + the first dimension should be set to 0, the second dimension + should be set to 1, and so on. +

+

Base Type

+

Each array type is based on some parent type. The + information for that parent type is described recursively by + this field. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Array Property Description for Datatype Version 3 +
ByteByteByteByte
DimensionalityThis space inserted only to align table nicely
Dimension #1 Size
.
.
.
Dimension #n Size

Base Type

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Array Property Description for Datatype Version 3 +
Field NameDescription

Dimensionality

+

This value is the number of dimensions that the array has. +

+

Dimension #n Size

+

This value is the size of the dimension of the array + as stored in the file. The first dimension stored in + the list of dimensions is the slowest changing dimension + and the last dimension stored is the fastest changing + dimension. +

+

Base Type

+

Each array type is based on some parent type. The + information for that parent type is described recursively by + this field. +

+
+
+ + + +

IV.A.2.e. The Data Storage - + Fill Value (Old) Message

+ + +
+ + + + + + + + +
Header Message Name: Fill Value + (old)
Header Message Type: 0x0004
Length: Varies
Status: Optional; may not be + repeated.
Description:

The fill value message stores a single data value which + is returned to the application when an uninitialized data element + is read from a dataset. The fill value is interpreted with the + same datatype as the dataset. If no fill value message is present + then a fill value of all zero bytes is assumed.

+

This fill value message is deprecated in favor of the + “new” fill value message (Message Type 0x0005) and + is only written to the file for forward compatibility with + versions of the HDF5 Library before the 1.6.0 version. + Additionally, it only appears for datasets with a user-defined + fill value (as opposed to the library default fill value or an + explicitly set “undefined” fill value).

+
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + +
+ Layout: Fill Value Message (Old) +
bytebytebytebyte
Size

Fill Value (optional, variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Fill Value Message (Old) +
Field NameDescription

Size

+

This is the size of the Fill Value field in bytes. +

+

Fill Value

+

The fill value. The bytes of the fill value are interpreted + using the same datatype as for the dataset. +

+
+
+ + +

IV.A.2.f. The Data Storage - + Fill Value Message

+ + +
+ + + + + + + + +
Header Message Name: Fill + Value
Header Message Type: 0x0005
Length: Varies
Status: Required for dataset objects; + may not be repeated.
Description:The fill value message stores a single data value which is + returned to the application when an uninitialized data element + is read from a dataset. The fill value is interpreted with the + same datatype as the dataset.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fill Value Message - Versions 1 and 2 +
bytebytebytebyte
VersionSpace Allocation TimeFill Value Write TimeFill Value Defined
Size (optional)

Fill Value (optional, variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fill Value Message - Versions 1 and 2 +
Field NameDescription

Version

+

The version number information is used for changes in the + format of the fill value message and is described here: + + + + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used +
1Initial version of this message. +
2In this version, the Size and Fill Value fields are + only present if the Fill Value Defined field is set + to 1. +
3This version packs the other fields in the message + more efficiently than version 2. +

+ +

Space Allocation Time

+

When the storage space for the dataset’s raw data will be + allocated. The allowed values are: + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Not used. +
1Early allocation. Storage space for the entire dataset + should be allocated in the file when the dataset is + created. +
2Late allocation. Storage space for the entire dataset + should not be allocated until the dataset is written + to. +
3Incremental allocation. Storage space for the + dataset should not be allocated until the portion + of the dataset is written to. This is currently + used in conjunction with chunked data storage for + datasets. +

+ +

Fill Value Write Time

+

At the time that storage space for the dataset’s raw data is + allocated, this value indicates whether the fill value should + be written to the raw data storage elements. The allowed values + are: + + + + + + + + + + + + + + + + + + +
ValueDescription
0On allocation. The fill value is always written to + the raw data storage when the storage space is allocated. +
1Never. The fill value should never be written to + the raw data storage. +
2Fill value written if set by user. The fill value + will be written to the raw data storage when the storage + space is allocated only if the user explicitly set + the fill value. If the fill value is the library + default or is undefined, it will not be written to + the raw data storage. +

+ +

Fill Value Defined

+

This value indicates if a fill value is defined for this + dataset. If this value is 0, the fill value is undefined. + If this value is 1, a fill value is defined for this dataset. + For version 2 or later of the fill value message, this value + controls the presence of the Size and Fill Value fields. +

+

Size

+

This is the size of the Fill Value field in bytes. This field + is not present if the Version field is greater than 1, + and the Fill Value Defined field is set to 0. +

+

Fill Value

+

The fill value. The bytes of the fill value are interpreted + using the same datatype as for the dataset. This field is + not present if the Version field is greater than 1, + and the Fill Value Defined field is set to 0. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fill Value Message - Version 3 +
bytebytebytebyte
VersionFlagsThis space inserted only to align table nicely
Size (optional)

Fill Value (optional, variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fill Value Message - Version 3 +
Field NameDescription

Version

+

The version number information is used for changes in the + format of the fill value message and is described here: + + + + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used +
1Initial version of this message. +
2In this version, the Size and Fill Value fields are + only present if the Fill Value Defined field is set + to 1. +
3This version packs the other fields in the message + more efficiently than version 2. +

+ +

Flags

+

When the storage space for the dataset’s raw data will be + allocated. The allowed values are: + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitsDescription
0-1Space Allocation Time, with the same + values as versions 1 and 2 of the message. +
2-3Fill Value Write Time, with the same + values as versions 1 and 2 of the message. +
4Fill Value Undefined, indicating that the fill + value has been marked as “undefined” for this dataset. + Bits 4 and 5 cannot both be set. +
5Fill Value Defined, with the same values as + versions 1 and 2 of the message. + Bits 4 and 5 cannot both be set. +
6-7Reserved (zero). +

+ +

Size

+

This is the size of the Fill Value field in bytes. This field + is not present if the Version field is greater than 1, + and the Fill Value Defined flag is set to 0. +

+

Fill Value

+

The fill value. The bytes of the fill value are interpreted + using the same datatype as for the dataset. This field is + not present if the Version field is greater than 1, + and the Fill Value Defined flag is set to 0. +

+
+
+ + +

IV.A.2.g. The Link Message

+ + +
+ + + + + + + + +
Header Message Name: Link
Header Message Type: 0x0006
Length: Varies
Status: Optional; may be + repeated.
Description:

This message encodes the information for a link in a + group’s object header, when the group is storing its links + “compactly”, or in the group’s fractal heap, + when the group is storing its links “densely”.

+

A group is storing its links compactly when the fractal heap + address in the Link Info + Message is set to the “undefined address” + value.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Link Message +
bytebytebytebyte
VersionFlagsLink type (optional)This space inserted only to align table nicely

Creation Order (8 bytes, optional)

Link Name Character Set (optional)Length of Link Name (variable size)This space inserted only to align table nicely
Link Name (variable size)

Link Information (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Link Message +
Field NameDescription

Version

The version number for this message. This document describes version 1.

+

Flags

This field contains information about the link and controls + the presence of other fields below. + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitsDescription
0-1Determines the size of the Length of Link Name + field. + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0The size of the Length of Link Name + field is 1 byte. +
1The size of the Length of Link Name + field is 2 bytes. +
2The size of the Length of Link Name + field is 4 bytes. +
3The size of the Length of Link Name + field is 8 bytes. +
+
2Creation Order Field Present: if set, the Creation + Order field is present. If not set, creation order + information is not stored for links in this group. +
3Link Type Field Present: if set, the link is not + a hard link and the Link Type field is present. + If not set, the link is a hard link. +
4Link Name Character Set Field Present: if set, the + link name is not represented with the ASCII character + set and the Link Name Character Set field is + present. If not set, the link name is represented with + the ASCII character set. +
5-7Reserved (zero). +

+ +

Link type

This is the link class type and can be one of the following + values: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0A hard link (should never be stored in the file) +
1A soft link. +
2-63Reserved for future HDF5 internal use. +
64An external link. +
65-255Reserved, but available for user-defined link types. +

+ +

This field is present if bit 3 of Flags is set.

+

Creation Order

This 64-bit value is an index of the link’s creation time within + the group. Values start at 0 when the group is created an increment + by one for each link added to the group. Removing a link from a + group does not change existing links’ creation order field. +

+

This field is present if bit 2 of Flags is set.

+

Link Name Character Set

This is the character set for encoding the link’s name: + + + + + + + + + + + + + + + +
ValueDescription
0ASCII character set encoding (this should never be stored + in the file) +
1UTF-8 character set encoding +

+ +

This field is present if bit 4 of Flags is set.

+

Length of link name

This is the length of the link’s name. The size of this field + depends on bits 0 and 1 of Flags.

+

Link name

This is the name of the link, non-NULL terminated.

+

Link information

The format of this field depends on the link type.

+

For hard links, the field is formatted as follows: + + + + + + +
+ Size of Offsets bytes:The address of the object header for the object that the + link points to. +
+

+ +

+ For soft links, the field is formatted as follows: + + + + + + + + + + +
Bytes 1-2:Length of soft link value.
Length of soft link value bytes:A non-NULL-terminated string storing the value of the + soft link. +
+

+ +

+ For external links, the field is formatted as follows: + + + + + + + + + + +
Bytes 1-2:Length of external link value.
Length of external link value bytes:The first byte contains the version number in the + upper 4 bits and flags in the lower 4 bits for the external + link. Both version and flags are defined to be zero in + this document. The remaining bytes consist of two + NULL-terminated strings, with no padding between them. + The first string is the name of the HDF5 file containing + the object linked to and the second string is the full path + to the object linked to, within the HDF5 file’s + group hierarchy. +
+

+ +

+ For user-defined links, the field is formatted as follows: + + + + + + + + + + +
Bytes 1-2:Length of user-defined data.
Length of user-defined link value bytes:The data supplied for the user-defined link type.
+

+ +
+
+ +

IV.A.2.h. The Data Storage - + External Data Files Message

+ + +
+ + + + + + + + +
Header Message Name: External + Data Files
Header Message Type: 0x0007
Length: Varies
Status: Optional; may not be + repeated.
Description:The external data storage message indicates that the data + for an object is stored outside the HDF5 file. The filename of + the object is stored as a Universal Resource Location (URL) of + the actual filename containing the data. An external file list + record also contains the byte offset of the start of the data + within the file and the amount of space reserved in the file + for that data.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: External File List Message +
bytebytebytebyte
VersionReserved (zero)
Allocated SlotsUsed Slots

Heap AddressO


Slot Definitions...

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: External File List Message +
Field NameDescription

Version

+

The version number information is used for changes in the format of + External Data Storage Message and is described here: + + + + + + + + + + + + + +
VersionDescription
0Never used.
1The current version used by the library.

+ +

Allocated Slots

+

The total number of slots allocated in the message. Its value must be at least as + large as the value contained in the Used Slots field. (The current library simply + uses the number of Used Slots for this message)

+

Used Slots

+

The number of initial slots which contains valid information.

+

Heap Address

+

This is the address of a local heap which contains the names for the external + files (The local heap information can be found in Disk Format Level 1D in this + document). The name at offset zero in the heap is always the empty string.

+

Slot Definitions

+

The slot definitions are stored in order according to the array addresses they + represent.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Layout: External File List Slot +
bytebytebytebyte

Name Offset in Local HeapL


Offset in External Data FileL


Data Size in External FileL

+ + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: External File List Slot +
Field NameDescription

Name Offset in Local Heap

+

The byte offset within the local name heap for the name + of the file. File names are stored as a URL which has a + protocol name, a host name, a port number, and a file + name: + protocol:port//host/file. + If the protocol is omitted then “file:” is assumed. If + the port number is omitted then a default port for that + protocol is used. If both the protocol and the port + number are omitted then the colon can also be omitted. If + the double slash and host name are omitted then + “localhost” is assumed. The file name is the only + mandatory part, and if the leading slash is missing then + it is relative to the application’s current working + directory (the use of relative names is not + recommended). +

+

Offset in External Data File

+

This is the byte offset to the start of the data in the + specified file. For files that contain data for a single + dataset this will usually be zero.

+

Data Size in External File

+

This is the total number of bytes reserved in the + specified file for raw data storage. For a file that + contains exactly one complete dataset which is not + extendable, the size will usually be the exact size of the + dataset. However, by making the size larger one allows + HDF5 to extend the dataset. The size can be set to a value + larger than the entire file since HDF5 will read zeroes + past the end of the file without failing.

+
+
+ + +

IV.A.2.i. The Data Layout Message

+ + +
+ + + + + + + + +
Header Message Name: Data Layout
Header Message Type: 0x0008
Length: Varies
Status: Required for datasets; may not + be repeated.
Description:The Data Layout message + describes how the elements of a multi-dimensional array are stored + in the HDF5 file. Four types of data layout are supported: +
    +
  1. Contiguous: The array is stored in one contiguous area of + the file. This layout requires that the size of the array be + constant: data manipulations such as chunking, compression, + checksums, or encryption are not permitted. The message stores + the total storage size of the array. The offset of an element + from the beginning of the storage area is computed as in a C + array.
  2. +
  3. Chunked: The array domain is regularly decomposed into + chunks, and each chunk is allocated and stored separately. This + layout supports arbitrary element traversals, compression, + encryption, and checksums (these features are described + in other messages). The message stores the size of a chunk + instead of the size of the entire array; the storage size of + the entire array can be calculated by traversing the chunk index + that stores the chunk addresses.
  4. +
  5. Compact: The array is stored in one contiguous block as + part of this object header message.
  6. +
  7. Virtual: This is only supported for version 4 of the Data + Layout message. The message stores information that is used to + locate the global heap collection containing the Virtual Dataset + (VDS) mapping information. The mapping associates the VDS to + the source dataset elements that are stored across a collection + of HDF5 files.
  8. +
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Data Layout Message (Versions 1 and 2) +
bytebytebytebyte
VersionDimensionalityLayout ClassReserved (zero)
Reserved (zero)

Data AddressO (optional)

Dimension 1 Size
Dimension 2 Size
...
Dimension #n Size
Dataset Element Size (optional)
Compact Data Size (optional)

Compact Data... (variable size, optional)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Data Layout Message (Versions 1 and 2) +
Field NameDescription

Version

+

The version number information is used for changes in the format of the data + layout message and is described here: + + + + + + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by version 1.4 and before of the library to encode layout information. + Data space is always allocated when the data set is created.
2Used by version 1.6.[0,1,2] of the library to encode layout information. + Data space is allocated only when it is necessary.

+

Dimensionality

An array has a fixed dimensionality. This field + specifies the number of dimension size fields later in the + message. The value stored for chunked storage is 1 greater than + the number of dimensions in the dataset’s dataspace. + For example, 2 is stored for a 1 dimensional dataset. +

+

Layout Class

The layout class specifies the type of storage for the data + and how the other fields of the layout message are to be + interpreted. + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Compact Storage +
1Contiguous Storage +
2Chunked Storage +
+

+

Data Address

For contiguous storage, this is the address of the raw + data in the file. For chunked storage this is the address + of the v1 B-tree that is used to look up the addresses of the + chunks. This field is not present for compact storage. + If the version for this message is greater than 1, the address + may have the “undefined address” value, to indicate that + storage has not yet been allocated for this array.

+

Dimension #n Size

For contiguous and compact storage the dimensions define + the entire size of the array while for chunked storage they define + the size of a single chunk. In all cases, they are in units of + array elements (not bytes). The first dimension stored in the list + of dimensions is the slowest changing dimension and the last + dimension stored is the fastest changing dimension. +

+

Dataset Element Size

The size of a dataset element, in bytes. This field is only + present for chunked storage. +

+

Compact Data Size

This field is only present for compact data storage. + It contains the size of the raw data for the dataset array, in + bytes.

+

Compact Data

This field is only present for compact data storage. + It contains the raw data for the dataset array.

+
+
+ +
+

Version 3 of this message re-structured the format into specific + properties that are required for each layout class.

+ + +
+ + + + + + + + + + + + + + + + + + + +
+ Layout: Data Layout Message (Version 3) +
bytebytebytebyte
VersionLayout ClassThis space inserted only to align table nicely

Properties (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Data Layout Message (Version 3) +
Field NameDescription

Version

+

The version number information is used for changes in the format of layout message + and is described here: + + + + + + + + + + +
VersionDescription
3Used by the version 1.6.3 and later of the library to store properties + for each layout class.

+

Layout Class

The layout class specifies the type of storage for the data + and how the other fields of the layout message are to be + interpreted. + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Compact Storage +
1Contiguous Storage +
2Chunked Storage +
+

+

Properties

This variable-sized field encodes information specific to each + layout class and is described below. If there is no property + information specified for a layout class, the size of this field + is zero bytes.

+
+ +
+ +

Class-specific information for compact storage (layout class 0): (Note: The dimensionality information + is in the Dataspace message)

+ + +
+ + + + + + + + + + + + + + + + + + +
+ Layout: Compact Storage Property Description +
bytebytebytebyte
SizeThis space inserted only to align table nicely

Raw Data... (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Compact Storage Property Description +
Field NameDescription

Size

This field contains the size of the raw data for the dataset + array, in bytes. +

+

Raw Data

This field contains the raw data for the dataset array.

+
+ + +
+ +

Class-specific information for contiguous storage (layout class 1): + (Note: The dimensionality information is in the Dataspace message)

+ + +
+ + + + + + + + + + + + + + + + + +
+ Layout: Contiguous Storage Property Description +
bytebytebytebyte

AddressO


SizeL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Contiguous Storage Property Description +
Field NameDescription

Address

This is the address of the raw data in the file. + The address may have the “undefined address” value, to indicate + that storage has not yet been allocated for this array.

Size

This field contains the size allocated to store the raw data, + in bytes. +

+
+
+ + +
+

Class-specific information for chunked storage (layout class 2):

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Chunked Storage Property Description +
bytebytebytebyte
DimensionalityThis space inserted only to align table nicely

AddressO

Dimension 0 Size
Dimension 1 Size
...
Dimension #n Size
Dataset Element Size
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Chunked Storage Property Description +
Field NameDescription

Dimensionality

A chunk has a fixed dimensionality. This field specifies + the number of dimension size fields later in the message.

Address

This is the address of the v1 B-tree + that is used to look up the + addresses of the chunks that actually store portions of the array + data. The address may have the “undefined address” value, to + indicate that storage has not yet been allocated for this array.

Dimension #n Size

These values define the dimension size of a single chunk, in + units of array elements (not bytes). The first dimension stored in + the list of dimensions is the slowest changing dimension and the + last dimension stored is the fastest changing dimension. +

+

Dataset Element Size

The size of a dataset element, in bytes. +

+
+
+ + +
+ +

+ Version 4 of this message is similar to version 3 but has + additional information for the virtual layout class as well as + indexing information for the chunked layout class.

+ +
+ + + + + + + + + + + + + + + + + + + +
+ Layout: Data Layout Message (Version 4) +
bytebytebytebyte
VersionLayout ClassThis space inserted + only to align table nicely

Properties (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Data Layout Message (Version 4) +
Field NameDescription

Version

+

The value for this field is 4 and is used by version 1.10.0 + and later of the library to store properties for each layout + class and indexing information for the chunked layout. +

+

Layout Class

The layout class specifies the type of storage for the data + and how the other fields of the layout message are to be + interpreted. + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Compact Storage +
1Contiguous Storage +
2Chunked Storage +
3Virtual Storage +
+

+

Properties

This variable-sized field encodes information specific to a + layout class as follows: + + + + + + + + + + + + + + + + + + + + + + + + + +
Layout ClassDescription
Compact StorageSee Compact Storage + Property Description for the version 3 +Data Layout message. +
Contiguous StorageSee Contiguous Storage + Property Description for the version 3 +Data Layout message. +
Chunked StorageSee Chunked Storage + Property Description below. +
Virtual StorageSee Virtual Storage + Property Description below. +
+ +

+
+ +
+ +

Class-specific information for chunked storage (layout + class 2):

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Chunked Storage Property Description +
bytebytebytebyte
FlagsDimensionalityDimension Size Encoded LengthThis space inserted to align table nicely
Dimension 0 Size (variable size)
Dimension 1 Size (variable size)
...
Dimension #n Size (variable size)
Chunk Indexing TypeThis space inserted only to align table nicely
Indexing Type Information (variable size)

AddressO

+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Chunked Storage Property Description +
Field NameDescription

Flags

This is the chunked layout feature flag:

+ + + + + + + + + + + + + + + + + +
ValueDescription
DONT_FILTER_PARTIAL_BOUND_CHUNKS (bit 0)Do not apply filter to a partial edge chunk. + +
SINGLE_INDEX_WITH_FILTER (bit 1)A filtered chunk for Single Chunk indexing. +
+ +

Dimensionality

A chunk has fixed dimension. This field specifies + the number of Dimension Size fields later in the message.

Dimension Size Encoded Length

+

This is the size in bytes used to encode Dimension Size. +

+

Dimension #n Size

These values define the dimension size of a single chunk, in + units of array elements (not bytes). The first dimension stored in + the list of dimensions is the slowest changing dimension and the + last dimension stored is the fastest changing dimension. +

+

Chunk Indexing Type

There are five indexing types used to look up addresses + of the chunks. For more information on each type, see + “Appendix C: Types of Indexes for + Dataset Chunks.” + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
1Single Chunk indexing type. +
2Implicit indexing type. +
3Fixed Array indexing type. +
4Extensible Array indexing type. +
5Version 2 B-tree indexing type. +
+

+

Indexing Type Information

This variable-sized field encodes information specific to + an indexing type. More information on what is encoded with + each type can be found below this table. +

+

+

Address

This is the address specific to an indexing type. + The address may be undefined if the chunk or index storage is not allocated yet. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
Single Chunk indexAddress of the single chunk.
Implicit indexAddress of the array of dataset chunks.
Fixed Array indexAddress of the index.
Extensible Array indexAddress of the index.
Version 2 B-tree indexAddress of the index.
+ +

+
+
+ +
+ +
    +
  1. + + Index-specific information for Single Chunk: +
  2. + +

    The following information exists only when the chunk is filtered. + In other words, when DONT_FILTER_PARTIAL_BOUND_CHUNKS + (bit 0) is enabled in the field flags.

    + +
    + + + + + + + + + + + + + + + + + + +
    + Layout: Single Chunk Indexing Information +
    bytebytebytebyte

    Size of filtered chunkL

    Filters for chunk
    + + + + + +
      + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
    +
    + +
    +
    + + + + + + + + + + + + + + + + +
    + Fields: Single Chunk Indexing Information +
    Field NameDescription

    Size of filtered chunk

    This field is the size of a filtered chunk.

    Filters for chunk

    This field contains filters for the chunk.

    +
    +

    + +
    + +
  3. + + Index-specific information for Implicit: +
  4. + +
    + + + + + + + + + + + + + + +
    + Layout: Implicit Indexing Information +
    bytebytebytebyte
    + No specific indexing information
    +
    + +
    +
  5. + + Index-specific information for Fixed Array: +
  6. + +
    + + + + + + + + + + + + + + + +
    + Layout: Fixed Array Indexing Information +
    bytebytebytebyte
    Page BitsThis space inserted only to align table nicely
    +
    + +
    +
    + + + + + + + + + + + + +
    + Fields: Fixed Array Indexing Information +
    Field NameDescription

    Page Bits

    This field contains the number of bits needed to store the + maximum number of elements in a data block page.

    +
    +

    + +
    +
  7. + + Index-specific information for Extensible Array: +
  8. + +
    + + + + + + + + + + + + + + + + + + + + + +
    + Layout: Extensible Array Indexing Information +
    bytebytebytebyte
    Max BitsIndex ElementsMin PointersMin Elements
    Page BitsThis space inserted only to align table nicely
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Fields: Extensible Array Indexing Information +
    Field NameDescription

    Max Bits

    This field contains the number of bits needed to store the maximum number of elements + in the array. +

    +

    Index Elements

    This field contains the number of elements to store in the + index block. +

    +

    Min Pointers

    This field contains the minimum number of data block pointers + for a superblock. +

    +

    Min Elements

    This field contains the minimum number of elements per data block. +

    +

    Page Bits

    This field contains the number of bits needed to store the + maximum number of elements in a data block page. +

    +
    +
    +

    +
    + +
  9. + + Index-specific information for Version 2 B-tree: +
  10. + +
    + + + + + + + + + + + + + + + + + + + +
    + Layout: Version 2 B-tree Indexing Information +
    bytebytebytebyte
    Node Size
    Split PercentMerge Percent + This space inserted only to align table nicely
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    + Fields: Version 2 B-tree Indexing Information +
    Field NameDescription

    Node Size

    This field is the size in bytes of a B-tree node. +

    +

    Split Percent

    This field is the percentage full of a B-tree node at which to split the node.

    Merge Percent

    This field is the percentage full of a B-tree node at which to merge the node.

    +
    +
+ + + +
+ +

+ Class-specific information for virtual storage (layout class 3):

+ +
+ + + + + + + + + + + + + + + + + + +
+ Layout: Virtual Storage Property Description +
bytebytebytebyte

AddressO

Index
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Virtual Storage Property Description +
Field NameDescription

Address

This is the address of the global heap collection where + the VDS mapping entries are stored. + See “Disk Format: Level 1F - + Global Heap Block for Virtual Datasets.” +

Index

This is the index of the data object within the global heap collection. +

+
+
+ +

IV.A.2.j. The Bogus Message

+ + +
+ + + + + + + + +
Header Message Name: Bogus
Header Message Type: 0x0009
Length: 4 bytes
Status: For testing only; should never + be stored in a valid file.
Description:This message is used for testing the HDF5 Library’s + response to an “unknown” message type and should + never be encountered in a valid HDF5 file.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + +
+ Layout: Bogus Message +
bytebytebytebyte
Bogus Value
+
+ +
+
+ + + + + + + + + + + +
+ Fields: Bogus Message +
Field NameDescription

Bogus Value

+

This value should always be: 0xdeadbeef.

+
+
+ +

IV.A.2.k. The Group Info Message +

+ + +
+ + + + + + + + +
Header Message Name: Group Info
Header Message Type: 0x000A
Length: Varies
Status: Optional; may not be + repeated.
Description:

This message stores information for the constants defining + a “new style” group’s behavior. Constant + information will be stored in this message and variable + information will be stored in the + Link Info message.

+

Note: the “estimated entry” information below is + used when determining the size of the object header for the + group when it is created.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Group Info Message +
bytebytebytebyte
VersionFlagsLink Phase Change: Maximum Compact Value (optional)
Link Phase Change: Minimum Dense Value (optional)Estimated Number of Entries (optional)
Estimated Link Name Length of Entries (optional)This space inserted only to align table nicely
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Group Info Message +
Field NameDescription

Version

The version number for this message. This document describes version 0.

+

Flags

This is the group information flag with the following definition: + + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, link phase change values are stored. +
1If set, the estimated entry information is non-default + and is stored. +
2-7Reserved

+

Link Phase Change: Maximum Compact Value

The is the maximum number of links to store “compactly” (in + the group’s object header).

+

This field is present if bit 0 of Flags is set.

+

Link Phase Change: Minimum Dense Value

This is the minimum number of links to store “densely” (in + the group’s fractal heap). The fractal heap’s address is + located in the Link Info + message.

+

This field is present if bit 0 of Flags is set.

+

Estimated Number of Entries

This is the estimated number of entries in groups.

+

If this field is not present, the default value of 4 + will be used for the estimated number of group entries.

+

This field is present if bit 1 of Flags is set.

+

Estimated Link Name Length of Entries

This is the estimated length of entry name.

+

If this field is not present, the default value of 8 + will be used for the estimated link name length of group entries.

+

This field is present if bit 1 of Flags is set.

+
+
+ + +

IV.A.2.l. The Data Storage - Filter + Pipeline Message

+ + +
+ + + + + + + + +
Header Message Name: + Data Storage - Filter Pipeline
Header Message Type: 0x000B
Length: Varies
Status: Optional; may not be + repeated.
Description:

This message describes the filter pipeline which should + be applied to the data stream by providing filter identification + numbers, flags, a name, and client data.

+

This message may be present in the object headers of both + dataset and group objects. For datasets, it specifies the + filters to apply to raw data. For groups, it specifies the + filters to apply to the group’s fractal heap. Currently, + only datasets using chunked data storage use the filter + pipeline on their raw data.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Filter Pipeline Message - Version 1 +
bytebytebytebyte
VersionNumber of FiltersReserved (zero)
Reserved (zero)

Filter Description List (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Filter Pipeline Message - Version 1 +
Field NameDescription

Version

The version number for this message. This table + describes version 1.

Number of Filters

The total number of filters described in this + message. The maximum possible number of filters in a + message is 32.

Filter Description List

A description of each filter. A filter description + appears in the next table.

+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Filter Description - Version 1 +
bytebytebytebyte
Filter Identification ValueName Length
FlagsNumber Client Data Values

Name (variable size, optional)


Client Data (variable size, optional)

Padding (variable size, optional)
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Filter Description - Version 1 +
Field NameDescription

Filter Identification Value

+

+ This value, often referred to as a filter identifier, + is designed to be a unique identifier for the filter. + Values from zero through 32,767 are reserved for filters + supported by The HDF Group in the HDF5 Library and for + filters requested and supported by third parties. + Filters supported by The HDF Group are documented immediately + below. Information on 3rd-party filters can be found at + The HDF Group’s + + Contributions page.

+ +

+ To request a filter identifier, please contact + The HDF Group’s Help Desk at + The HDF Group Help Desk. + You will be asked to provide the following information:

+
    +
  1. Contact information for the developer requesting the + new identifier
  2. +
  3. A short description of the new filter
  4. +
  5. Links to any relevant information, including licensing + information
  6. +
+

+ Values from 32768 to 65535 are reserved for non-distributed uses + (for example, internal company usage) or for application usage + when testing a feature. The HDF Group does not track or document + the use of the filters with identifiers from this range.

+ +

+ The filters currently in library version 1.8.0 are + listed below: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentificationNameDescription
0N/AReserved
1deflateGZIP deflate compression
2shuffleData element shuffling
3fletcher32Fletcher32 checksum
4szipSZIP compression
5nbitN-bit packing
6scaleoffsetScale and offset encoded values
+

Name Length

Each filter has an optional null-terminated ASCII name + and this field holds the length of the name including the + null termination padded with nulls to be a multiple of + eight. If the filter has no name then a value of zero is + stored in this field.

Flags

The flags indicate certain properties for a filter. The + bit values defined so far are: + + + + + + + + + + + + + + + +
BitDescription
0If set then the filter is an optional filter. + During output, if an optional filter fails it will be + silently skipped in the pipeline.
1-15Reserved (zero)

+

Number of Client Data Values

Each filter can store integer values to control + how the filter operates. The number of entries in the + Client Data array is stored in this field.

Name

If the Name Length field is non-zero then it will + contain the size of this field, padded to a multiple of eight. This + field contains a null-terminated, ASCII character string to serve + as a comment/name for the filter.

Client Data

This is an array of four-byte integers which will be + passed to the filter function. The Client Data Number of + Values determines the number of elements in the array.

Padding

Four bytes of zeroes are added to the message at this + point if the Client Data Number of Values field contains + an odd number.

+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Layout: Filter Pipeline Message - Version 2 +
bytebytebytebyte
VersionNumber of FiltersThis space inserted only to align table nicely

Filter Description List (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Fields: Filter Pipeline Message - Version 2 +
Field NameDescription

Version

The version number for this message. This table + describes version 2.

Number of Filters

The total number of filters described in this + message. The maximum possible number of filters in a + message is 32.

Filter Description List

A description of each filter. A filter description + appears in the next table.

+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Filter Description - Version 2 +
bytebytebytebyte
Filter Identification ValueName Length (optional)
FlagsNumber Client Data Values

Name (variable size, optional)


Client Data (variable size, optional)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Filter Description - Version 2 +
Field NameDescription

Filter Identification Value

+

+ This value, often referred to as a filter identifier, + is designed to be a unique identifier for the filter. + Values from zero through 32,767 are reserved for filters + supported by The HDF Group in the HDF5 Library and for + filters requested and supported by third parties. + Filters supported by The HDF Group are documented immediately + below. Information on 3rd-party filters can be found at + The HDF Group’s + + Contributions page.

+ +

+ To request a filter identifier, please contact + The HDF Group’s Help Desk at + The HDF Group Help Desk. + You will be asked to provide the following information:

+
    +
  1. Contact information for the developer requesting the + new identifier
  2. +
  3. A short description of the new filter
  4. +
  5. Links to any relevant information, including licensing + information
  6. +
+

+ Values from 32768 to 65535 are reserved for non-distributed uses + (for example, internal company usage) or for application usage + when testing a feature. The HDF Group does not track or document + the use of the filters with identifiers from this range.

+ +

+ The filters currently in library version 1.8.0 are + listed below: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentificationNameDescription
0N/AReserved
1deflateGZIP deflate compression
2shuffleData element shuffling
3fletcher32Fletcher32 checksum
4szipSZIP compression
5nbitN-bit packing
6scaleoffsetScale and offset encoded values
+

Name Length

Each filter has an optional null-terminated ASCII name + and this field holds the length of the name including the + null termination padded with nulls to be a multiple of + eight. If the filter has no name then a value of zero is + stored in this field.

+

Filters with IDs less than 256 (in other words, filters + that are defined in this format documentation) do not store + the Name Length or Name fields. +

+

Flags

The flags indicate certain properties for a filter. The + bit values defined so far are: + + + + + + + + + + + + + + + +
BitDescription
0If set then the filter is an optional filter. + During output, if an optional filter fails it will be + silently skipped in the pipeline.
1-15Reserved (zero)

+

Number of Client Data Values

Each filter can store integer values to control + how the filter operates. The number of entries in the + Client Data array is stored in this field.

Name

If the Name Length field is non-zero, then it will + contain the size of this field, not padded to a multiple + of eight. This field contains a non-null-terminated, + ASCII character string to serve as a comment/name for the filter. +

+

Filters that are defined in this format documentation + such as deflate and shuffle do not store the Name + Length or Name fields. +

+

Client Data

This is an array of four-byte integers which will be + passed to the filter function. The Client Data Number of + Values determines the number of elements in the array.

+
+
+ +

IV.A.2.m. The Attribute Message

+ + +
+ + + + + + + + +
Header Message Name: Attribute
Header Message Type: 0x000C
Length: Varies
Status: Optional; may be + repeated.
Description:

The Attribute message is used to store objects + in the HDF5 file which are used as attributes, or + “metadata” about the current object. An attribute + is a small dataset; it has a name, a datatype, a dataspace, and + raw data. Since attributes are stored in the object header, they + should be relatively small (in other words, less than 64KB). + They can be associated with any type of object which has an + object header (groups, datasets, or committed (named) + datatypes).

+

In 1.8.x versions of the library, attributes can be larger + than 64KB. See the + + “Special Issues” section of the Attributes chapter + in the HDF5 User’s Guide for more information.

+

Note: Attributes on an object must have unique names: + the HDF5 Library currently enforces this by causing the + creation of an attribute with a duplicate name to fail. + Attributes on different objects may have the same name, + however.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Attribute Message (Version 1) +
bytebytebytebyte
VersionReserved (zero)Name Size
Datatype SizeDataspace Size

Name (variable size)


Datatype (variable size)


Dataspace (variable size)


Data (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Attribute Message (Version 1) +
Field NameDescription

Version

The version number information is used for changes in the format of the + attribute message and is described here: + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by the library before version 1.6 to encode attribute message. + This version does not support shared datatypes.

+

Name Size

The length of the attribute name in bytes including the + null terminator. Note that the Name field below may + contain additional padding not represented by this + field.

Datatype Size

The length of the datatype description in the Datatype + field below. Note that the Datatype field may contain + additional padding not represented by this field.

Dataspace Size

The length of the dataspace description in the Dataspace + field below. Note that the Dataspace field may contain + additional padding not represented by this field.

Name

The null-terminated attribute name. This field is + padded with additional null characters to make it a + multiple of eight bytes.

Datatype

The datatype description follows the same format as + described for the datatype object header message. This + field is padded with additional zero bytes to make it a + multiple of eight bytes.

Dataspace

The dataspace description follows the same format as + described for the dataspace object header message. This + field is padded with additional zero bytes to make it a + multiple of eight bytes.

Data

The raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. This + field is not padded with additional bytes.

+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Attribute Message (Version 2) +
bytebytebytebyte
VersionFlagsName Size
Datatype SizeDataspace Size

Name (variable size)


Datatype (variable size)


Dataspace (variable size)


Data (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Attribute Message (Version 2) +
Field NameDescription

Version

The version number information is used for changes in the + format of the attribute message and is described here: + + + + + + + + + + +
VersionDescription
2Used by the library of version 1.6.x and after to encode + attribute messages. + This version supports shared datatypes. The fields of + name, datatype, and dataspace are not padded with + additional bytes of zero. +

+

Flags

This bit field contains extra information about + interpreting the attribute message: + + + + + + + + + + + + + + + + +
BitDescription
0If set, datatype is shared.
1If set, dataspace is shared.

+

Name Size

The length of the attribute name in bytes including the + null terminator.

Datatype Size

The length of the datatype description in the Datatype + field below.

Dataspace Size

The length of the dataspace description in the Dataspace + field below.

Name

The null-terminated attribute name. This field is not + padded with additional bytes.

Datatype

The datatype description follows the same format as + described for the datatype object header message. +

+

If the + Flag field indicates this attribute’s datatype is + shared, this field will contain a “shared message” encoding + instead of the datatype encoding. +

+

This field is not padded with additional bytes. +

+

Dataspace

The dataspace description follows the same format as + described for the dataspace object header message. +

+

If the + Flag field indicates this attribute’s dataspace is + shared, this field will contain a “shared message” encoding + instead of the dataspace encoding. +

+

This field is not padded with additional bytes.

+

Data

The raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. +

+

This field is not padded with additional zero bytes. +

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Attribute Message (Version 3) +
bytebytebytebyte
VersionFlagsName Size
Datatype SizeDataspace Size
Name Character Set EncodingThis space inserted only to align table nicely

Name (variable size)


Datatype (variable size)


Dataspace (variable size)


Data (variable size)

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Attribute Message (Version 3) +
Field NameDescription

Version

The version number information is used for changes in the + format of the attribute message and is described here: + + + + + + + + + + +
VersionDescription
3Used by the library of version 1.8.x and after to + encode attribute messages. + This version supports attributes with non-ASCII names. +

+

Flags

This bit field contains extra information about + interpreting the attribute message: + + + + + + + + + + + + + + + + +
BitDescription
0If set, datatype is shared.
1If set, dataspace is shared.

+

Name Size

The length of the attribute name in bytes including the + null terminator.

Datatype Size

The length of the datatype description in the Datatype + field below.

Dataspace Size

The length of the dataspace description in the Dataspace + field below.

Name Character Set Encoding

The character set encoding for the attribute’s name: + + + + + + + + + + + + + + + +
ValueDescription
0ASCII character set encoding +
1UTF-8 character set encoding +
+

+

Name

The null-terminated attribute name. This field is not + padded with additional bytes.

Datatype

The datatype description follows the same format as + described for the datatype object header message. +

+

If the + Flag field indicates this attribute’s datatype is + shared, this field will contain a “shared message” encoding + instead of the datatype encoding. +

+

This field is not padded with additional bytes. +

+

Dataspace

The dataspace description follows the same format as + described for the dataspace object header message. +

+

If the + Flag field indicates this attribute’s dataspace is + shared, this field will contain a “shared message” encoding + instead of the dataspace encoding. +

+

This field is not padded with additional bytes.

+

Data

The raw data for the attribute. The size is determined + from the datatype and dataspace descriptions. +

+

This field is not padded with additional zero bytes. +

+
+
+ +

IV.A.2.n. The Object Comment + Message

+ + +
+ + + + + + + + +
Header Message Name: Object + Comment
Header Message Type: 0x000D
Length: Varies
Status: Optional; may not be + repeated.
Description:The object comment is designed to be a short description of + an object. An object comment is a sequence of non-zero + (\0) ASCII characters with no other formatting + included by the library.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + +
+ Layout: Object Comment Message +
bytebytebytebyte

Comment (variable size)

+
+ +
+
+ + + + + + + + + + + +
+ Fields: Object Comment Message +
Field NameDescription

Name

A null terminated ASCII character string.

+
+ +

IV.A.2.o. The Object + Modification Time (Old) Message

+ + +
+ + + + + + + + +
Header Message Name: Object + Modification Time (Old)
Header Message Type: 0x000E
Length: Fixed
Status: Optional; may not be + repeated.
Description:

The object modification date and time is a timestamp + which indicates (using ISO-8601 date and time format) the last + modification of an object. The time is updated when any object + header message changes according to the system clock where the + change was posted. All fields of this message should be + interpreted as coordinated universal time (UTC).

+

This modification time message is deprecated in favor of + the “new” Object + Modification Time message and is no longer written to the + file in versions of the HDF5 Library after the 1.6.0 + version.

Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Modification Time Message (Old) +
bytebytebytebyte
Year
MonthDay of Month
HourMinute
SecondReserved
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Modification Time Message (Old) +
Field NameDescription

Year

The four-digit year as an ASCII string. For example, + 1998. +

Month

The month number as a two digit ASCII string where + January is 01 and December is 12.

Day of Month

The day number within the month as a two digit ASCII + string. The first day of the month is 01.

Hour

The hour of the day as a two digit ASCII string where + midnight is 00 and 11:00pm is 23.

Minute

The minute of the hour as a two digit ASCII string where + the first minute of the hour is 00 and + the last is 59.

Second

The second of the minute as a two digit ASCII string + where the first second of the minute is 00 + and the last is 59.

Reserved

This field is reserved and should always be zero.

+
+ +

IV.A.2.p. The Shared Message Table + Message

+ + +
+ + + + + + + + +
Header Message Name: Shared Message + Table
Header Message Type: 0x000F
Length: Fixed
Status: Optional; may not be + repeated.
Description:This message is used to locate the table of shared object + header message (SOHM) indexes. Each index consists of information + to find the shared messages from either the heap or object header. + This message is only found in the superblock + extension.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Shared Message Table Message +
bytebytebytebyte
VersionThis space inserted only to align table nicely

Shared Object Header Message Table AddressO

Number of IndicesThis space inserted only to align table nicely
+ + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Shared Message Table Message +
Field NameDescription

Version

The version number for this message. This document describes version 0.

Shared Object Header Message Table Address

This field is the address of the master table for shared + object header message indexes.

+

Number of Indices

This field is the number of indices in the master table. +

+
+ +

IV.A.2.q. The Object Header + Continuation Message

+ + +
+ + + + + + + + +
Header Message Name: Object Header + Continuation
Header Message Type: 0x0010
Length: Fixed
Status: Optional; may be + repeated.
Description:The object header continuation is the location in the file + of a block containing more header messages for the current data + object. This can be used when header blocks become too large or + are likely to change over time.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + +
+ Layout: Object Header Continuation Message +
bytebytebytebyte

OffsetO


LengthL

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Object Header Continuation Message +
Field NameDescription

Offset

This value is the address in the file where the + header continuation block is located.

Length

This value is the length in bytes of the header continuation + block in the file.

+
+
+ +

The format of the header continuation block that this message points + to depends on the version of the object header that the message is + contained within. +

+ +

+ Continuation blocks for version 1 object headers have no special + formatting information; they are merely a list of object header + message info sequences (type, size, flags, reserved bytes and data + for each message sequence). See the description + of Version 1 Data Object Header Prefix. +

+ +

Continuation blocks for version 2 object headers do have + special formatting information as described here + (see also the description of + Version 2 Data Object Header Prefix.): +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 Object Header Continuation Block +
bytebytebytebyte
Signature
Header Message Type #1Size of Header Message Data #1Header Message #1 Flags
Header Message #1 Creation Order (optional)This space inserted only to align table nicely

Header Message Data #1

.
.
.
Header Message Type #nSize of Header Message Data #nHeader Message #n Flags
Header Message #n Creation Order (optional)This space inserted only to align table nicely

Header Message Data #n

Gap (optional, variable size)
Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 Object Header Continuation Block +
Field NameDescription

Signature

+

The ASCII character string “OCHK” + is used to indicate the beginning of an object header + continuation block. This gives file consistency checking + utilities a better chance of reconstructing a damaged file. +

+

Header Message #n Type

+

Same format as version 1 of the object header, described above. +

Size of Header Message #n Data

+

Same format as version 1 of the object header, described above. +

Header Message #n Flags

+

Same format as version 1 of the object header, described above. +

Header Message #n Creation Order

+

This field stores the order that a message of a given type + was created in.

+

This field is present if bit 2 of flags is set.

+

Header Message #n Data

+

Same format as version 1 of the object header, described above. +

Gap

+

A gap in an object header chunk is inferred by the end of the + messages for the chunk before the beginning of the chunk’s + checksum. Gaps are always smaller than the size of an + object header message prefix (message type + message size + + message flags).

+

Gaps are formed when a message (typically an attribute message) + in an earlier chunk is deleted and a message from a later + chunk that does not quite fit into the free space is moved + into the earlier chunk.

+

Checksum

+

This is the checksum for the object header chunk. +

+
+
+ +

IV.A.2.r. The Symbol Table + Message

+ + +
+ + + + + + + + +
Header Message Name: Symbol Table + Message
Header Message Type: 0x0011
Length: Fixed
Status: Required for + “old style” groups; may not be repeated.
Description:Each “old style” group has a v1 B-tree and a + local heap for storing symbol table entries, which are located + with this message.
Format of data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + +
+ Layout: Symbol Table Message +
bytebytebytebyte

v1 B-tree AddressO


Local Heap AddressO

+ + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Symbol Table Message +
Field NameDescription

v1 B-tree Address

This value is the address of the v1 B-tree containing the + symbol table entries for the group.

Local Heap Address

This value is the address of the local heap containing + the link names for the symbol table entries for the group.

+
+ +

IV.A.2.s. The Object + Modification Time Message

+ + +
+ + + + + + + + +
Header Message Name: Object + Modification Time
Header Message Type: 0x0012
Length: Fixed
Status: Optional; may not be + repeated.
Description:The object modification time is a timestamp which indicates + the time of the last modification of an object. The time is + updated when any object header message changes according to + the system clock where the change was posted.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + +
+ Layout: Modification Time Message +
bytebytebytebyte
VersionReserved (zero)
Seconds After UNIX Epoch
+
+ +
+
+ + + + + + + + + + + + + + + + +
+ Fields: Modification Time Message +
Field NameDescription

Version

The version number is used for changes in the format of Object Modification Time + and is described here: + + + + + + + + + + + + + + + +
VersionDescription
0Never used.
1Used by Version 1.6.1 and after of the library to encode time. In + this version, the time is the seconds after Epoch.

+

Seconds After UNIX Epoch

A 32-bit unsigned integer value that stores the number of + seconds since 0 hours, 0 minutes, 0 seconds, January 1, 1970, + Coordinated Universal Time.

+
+ +

IV.A.2.t. The B-tree + ‘K’ Values Message

+ + +
+ + + + + + + + +
Header Message Name: B-tree + ‘K’ Values
Header Message Type: 0x0013
Length: Fixed
Status: Optional; may not be + repeated.
Description:This message retrieves non-default ‘K’ values + for internal and leaf nodes of a group or indexed storage v1 + B-trees. This message is only found in the superblock + extension.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + +
+ Layout: B-tree ‘K’ Values Message +
bytebytebytebyte
VersionIndexed Storage Internal Node KThis space inserted only to align table nicely
Group Internal Node KGroup Leaf Node K
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: B-tree ‘K’ Values Message +
Field NameDescription

Version

The version number for this message. This document describes + version 0.

+

Indexed Storage Internal Node K

This is the node ‘K’ value for each internal node of an + indexed storage v1 B-tree. See the description of this field + in version 0 and 1 of the superblock as well the section on + v1 B-trees. +

+

Group Internal Node K

This is the node ‘K’ value for each internal node of a group + v1 B-tree. See the description of this field in version 0 and + 1 of the superblock as well as the section on v1 B-trees. +

+

Group Leaf Node K

This is the node ‘K’ value for each leaf node of a group v1 + B-tree. See the description of this field in version 0 and 1 + of the superblock as well as the section on v1 B-trees. +

+
+
+ +

IV.A.2.u. The Driver Info + Message

+ + +
+ + + + + + + + + +
Header Message Name: Driver + Info
Header Message Type: 0x0014
Length: Varies
Status: Optional; may not be + repeated.
+ Description:This message contains information needed by the file driver + to reopen a file. This message is only found in the + superblock extension: see the + “Disk Format: Level 0C - Superblock Extension” + section for more information. For more information on the fields + in the driver info message, see the + “Disk Format: Level 0B - File Driver Info” + section; those who use the multi and family file drivers will + find this section particularly helpful.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Driver Info Message +
bytebytebytebyte
VersionThis space inserted only to align table nicely

Driver Identification
Driver Information SizeThis space inserted only to align table nicely


Driver Information (variable size)


+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Driver Info Message +
Field NameDescription

Version

The version number for this message. This document describes + version 0.

+

Driver Identification

This is an eight-byte ASCII string without null termination which + identifies the driver. +

+

Driver Information Size

The size in bytes of the Driver Information field of this + message.

+

Driver Information

Driver information is stored in a format defined by the file driver.

+
+
+ +

IV.A.2.v. The Attribute Info + Message

+ + +
+ + + + + + + + +
Header Message Name: Attribute + Info
Header Message Type: 0x0015
Length: Varies
Status: Optional; may not be + repeated.
Description:This message stores information about the attributes on an + object, such as the maximum creation index for the attributes + created and the location of the attribute storage when the + attributes are stored “densely”.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Attribute Info Message +
bytebytebytebyte
VersionFlagsMaximum Creation Index (optional)

Fractal Heap AddressO


Attribute Name v2 B-tree AddressO


Attribute Creation Order v2 B-tree AddressO (optional)

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Attribute Info Message +
Field NameDescription

Version

The version number for this message. This document describes + version 0.

+

Flags

This is the attribute index information flag with the + following definition: + + + + + + + + + + + + + + + + + + + +
BitDescription
0If set, creation order for attributes is tracked. +
1If set, creation order for attributes is indexed. +
2-7Reserved

+ +

Maximum Creation Index

The is the maximum creation order index value for the + attributes on the object.

+

This field is present if bit 0 of Flags is set.

+

Fractal Heap Address

This is the address of the fractal heap to store dense + attributes. + Each attribute stored in the fractal heap is described by + the Attribute Message. +

+

Attribute Name v2 B-tree Address

This is the address of the version 2 B-tree to index the + names of densely stored attributes.

+

Attribute Creation Order v2 B-tree Address

This is the address of the version 2 B-tree to index the + creation order of densely stored attributes.

+

This field is present if bit 1 of Flags is set.

+
+
+ +

IV.A.2.w. The Object Reference + Count Message

+ + +
+ + + + + + + + +
Header Message Name: Object Reference + Count
Header Message Type: 0x0016
Length: Fixed
Status: Optional; may not be + repeated.
Description:This message stores the number of hard links (in groups or + objects) pointing to an object: in other words, its + reference count.
Format of Data: See the tables + below.
+ + +
+ + + + + + + + + + + + + + + + + + +
+ Layout: Object Reference Count +
bytebytebytebyte
VersionThis space inserted only to align table nicely
Reference count
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Object Reference Count +
Field NameDescription

Version

The version number for this message. This document describes + version 0.

+

Reference Count

The unsigned 32-bit integer is the reference count for the + object. This message is only present in “version 2” + (or later) object headers, and if not present those object + header versions, the reference count for the object is assumed + to be 1.

+
+
+ +
+ +

IV.A.2.x. The File Space Info + Message

+ +
+ + + + + + + +

+

+
Header Message Name: File Space + Info
Header Message Type: 0x0017
Length: Fixed
Status: Optional; may not be + repeated.
+ Description:This message stores the file space management information + that the library uses in handling file space + requests for the file. Version 0 of the message is used for release 1.10.0 only. + Version 1 of the message is used for release 1.10.1+. + There is no File Space Info message before release 1.10 as the library does + not track file space across multiple file opens. +

+ Note that version 0 is deprecated starting release 1.10.1. + That means when the 1.10.1+ library opens an HDF5 file with a version 0 message, + the library will decode and map the message to version 1. + On file close, it will encode the message as a version 1 message. +

+ The library uses the following three mechanisms to manage file space in an HDF5 file: +

    +
  • Free-space managers +
    They track free-space sections of various sizes in the file that are not currently + allocated. Each free-space manager corresponds to a file space type. + There are two main groups of file space types: metadata and raw data. + Metadata is further divided into five types: superblock, B-tree, global heap, + local heap, and object header. + See the description of Free-space + Manager as well the description of file space allocation types in + Appendix B +
  • +
  • Aggregators +
    The library manages two aggregators, one for metadata and one for raw data. + Aggregator is a contiguous block of free-space in the file. + The size of each aggregator is tunable via public routines + H5Pset_meta_block_size and H5Pset_small_data_block_size respectively. +
  • +
  • Virtual file drivers +
    The library's virtual file driver interface dispatches requests for additional + space to the allocation routine of the file driver associated with the file. + For example, if the sec2 file driver is being used, its allocation routine will + increase the size of the file to service the requests. +
  • +
+

+ For release 1.10.0, the library derives the following four file space strategies + based on the mechanisms: +

    +
  • H5F_FILE_SPACE_ALL +
      +
    • Mechanisms used: free-space managers, aggregators, and virtual file drivers
    • +
    • Does not persist free-space across file opens
    • +
    • This strategy is the library default
    • +
    +
  • +
  • H5F_FILE_SPACE_ALL_PERSIST
  • +
      +
    • Mechanisms used: free-space managers, aggregators, and virtual file drivers
    • +
    • Persist free-space across file opens
    • +
    +
  • H5F_FILE_SPACE_AGGR_VFD
  • +
      +
    • Mechanisms used: aggregators and virtual file drivers
    • +
    • Does not persist free-space across file opens
    • +
    +
  • H5F_FILE_SPACE_VFD
  • +
      +
    • Mechanisms used: virtual file drivers
    • +
    • Does not persist free-space across file opens
    • +
    +
+ For release 1.10.1+, the free-space manager mechanism is modified to handle paged aggregation + which aggregates small metadata and raw data allocations into constant-sized well-aligned pages + to allow efficient I/O accesses. + With the support of this feature, the library derives the following four file space strategies: +
    +
  • H5F_FSPACE_STRATEGY_FSM_AGGR
  • +
      +
    • Mechanisms used: free-space managers, aggregators, and virtual file drivers
    • +
    • This strategy is the library default
    • +
    +
  • H5F_FSPACE_STRATEGY_PAGE
  • +
      +
    • Mechanisms used: free-space managers with embedded paged aggregation and virtual file drivers
    • +
    +
  • H5F_FSPACE_STRATEGY_AGGR
  • +
      +
    • Mechanisms used: aggregators and virtual file drivers
    • +
    +
  • H5F_FSPACE_STRATEGY_NONE
  • +
      +
    • Mechanisms used: virtual file drivers
    • +
    +
+ The default is not persisting free-space across file opens for the above four strategies. + User can use the public routine H5Pset_file_space_strategy to request + persisting free-space. +
Format of Data: See the tables + below.
+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: File Space Info - Version 0 +
bytebytebytebyte
VersionStrategyThresholdL

Free-space manager addressO for H5FD_MEM_SUPER


Free-space manager address0 for H5FD_MEM_BTREE


Free-space manager address0 for H5FD_MEM_DRAW


Free-space manager address0 for H5FD_MEM_GHEAP


Free-space manager address0 for H5FD_MEM_LHEAP


Free-space manager address0 for H5FD_MEM_OHDR

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: File Space Info +
Field NameDescription

Version

This is version 0 of this message.

+

Strategy

This is the file space strategy used to manage file space. + There are four types: + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
1H5F_FILE_SPACE_ALL_PERSIST
2H5F_FILE_SPACE_ALL
3H5F_FILE_SPACE_AGGR_VFD
4H5F_FILE_SPACE_VFD

+

Threshold

This is the smallest free-space section size that the + free-space manager will track. +

Free-space manager addresses

These are the six free-space manager addresses for the + six file space allocation types: +

    +
  • H5FD_MEM_SUPER
  • +
  • H5FD_MEM_BTREE
  • +
  • H5FD_MEM_DRAW
  • +
  • H5FD_MEM_GHEAP
  • +
  • H5FD_MEM_LHEAP
  • +
  • H5FD_MEM_OHDR
  • +
+ Note that these six fields exist only if the value for the field + “Strategy” is H5F_FILE_SPACE_ALL_PERSIST. +

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: File Space Info - Version 1 +
bytebytebytebyte
VersionStrategyPersisting free-spaceThis space inserted only to align table nicely
Free-space Section ThresholdL
File Space Page Size
Page-end Metadata thresholdThis space inserted only to align table nicely

EOA0


AddressO of small-sized free-space manager for H5FD_MEM_SUPER


AddressO of small-sized free-space manager for H5FD_MEM_BTREE


AddressO of small-sized free-space manager for H5FM_MEM_DRAW


AddressO of small-sized free-space manager for H5FD_MEM_GHEAP


AddressO of small-sized free-space manager for H5FD_MEM_LHEAP


AddressO of small-sized free-space manager for H5FD_MEM_OHDR


AddressO of large-sized free-space manager for H5FD_MEM_SUPER


AddressO of large-sized free-space manager for H5FD_MEM_BTREE


AddressO of large-sized free-space manager for H5FM_MEM_DRAW


AddressO of large-sized free-space manager for H5FD_MEM_GHEAP


AddressO of large-sized free-space manager for H5FD_MEM_LHEAP


AddressO of large-sized free-space manager for H5FD_MEM_OHDR

+ + + + + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: File Space Info +
Field NameDescription

Version

This is version 1 of this message.

+

Strategy

This is the file space strategy used to manage file space. + There are four types: + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0H5F_FSPACE_STRATEGY_FSM_AGGR
1H5F_FSPACE_STRATEGY_PAGE
2H5F_FSPACE_STRATEGY_AGGR
3H5F_FSPACE_STRATEGY_NONE

+

Persisting free-space

True or false in persisting free-space. +

Free-space Section Threshold

This is the smallest free-space section size that the + free-space manager will track. +

File space page size

This is the file space page size, which is used when the paged aggregation feature + is enabled. +

Page-end metadata threshold

This is the smallest free-space section size at the end of a page that + the free-space manager will track. This is used when the paged aggregation feature + is enabled. +

EOA

The EOA before the allocation of free-space manager header and section info for the + self-referential free-space managers when persisting free-space. +
+ Note that self-referential free-space managers are managers that involve file space + allocation for the managers' free-space header and section info. +

Addresses of small-sized free-space managers

These are the addresses of the six small-sized free-space managers for + the six file space allocation types: +

+
    +
  • H5FD_MEM_SUPER
  • +
  • H5FD_MEM_BTREE
  • +
  • H5FD_MEM_DRAW
  • +
  • H5FD_MEM_GHEAP
  • +
  • H5FD_MEM_LHEAP
  • +
  • H5FD_MEM_OHDR
  • +
+ Note that these six fields exist only if the value for the field + “Persisting free-space” is true. + +

Addresses of large-sized free-space managers

These are the addresses of the six large-sized free-space managers for + the six file space allocation types: +

+
    +
  • H5FD_MEM_SUPER
  • +
  • H5FD_MEM_BTREE
  • +
  • H5FD_MEM_DRAW
  • +
  • H5FD_MEM_GHEAP
  • +
  • H5FD_MEM_LHEAP
  • +
  • H5FD_MEM_OHDR
  • +
+ Note that these six fields exist only if the value for the field + “Persisting free-space” is true. + +
+
+ +

+ IV.B. Disk Format: Level 2B - Data Object Data Storage

+ +

The data for an object is stored separately from its header + information in the file and may not actually be located in the HDF5 file + itself if the header indicates that the data is stored externally. The + information for each record in the object is stored according to the + dimensionality of the object (indicated in the dataspace header message). + Multi-dimensional array data is stored in C order; in other words, the + “last” dimension changes fastest.

+ +

Data whose elements are composed of atomic datatypes are stored in IEEE + format, unless they are specifically defined as being stored in a different + machine format with the architecture-type information from the datatype + header message. This means that each architecture will need to [potentially] + byte-swap data values into the internal representation for that particular + machine.

+ +

Data with a variable-length datatype is stored in the global heap + of the HDF5 file. Global heap identifiers are stored in the + data object storage.

+ +

Data whose elements are composed of reference datatypes are stored in + several different ways depending on the particular reference type involved. + Object pointers are just stored as the offset of the object header being + pointed to with the size of the pointer being the same number of bytes as + offsets in the file.

+ +

Dataset region references are stored as a heap-ID which points to + the following information within the file-heap: an offset of the object + pointed to, number-type information (same format as header message), + dimensionality information (same format as header message), sub-set start + and end information (in other words, a coordinate location for each), + and field start and end names (in other words, a [pointer to the] string + indicating the first field included and a [pointer to the] string name + for the last field).

+ +

Data of a compound datatype is stored as a contiguous stream of the items + in the structure, with each item formatted according to its datatype. +

+ Description of datatypes for variable-length, references and compound classes can be found + in Datatype Message. +

+ Information about global heap and heap ID can be found in Global Heap. +

+ For reference datatype, + see also the encoding description for Reference Encoding (Revised) and + Reference Encoding (Backward Compatibility) in Appendix D. +

+ +

+ V. Appendix A: Definitions

+ +

Definitions of various terms used in this document are included in + this section.

+ +
+ + + + + + + + + + + + + + + + +
TermDefinition
Undefined AddressThe undefined + address for a file is a file address with all bits + set: in other words, 0xffff...ff.
Unlimited SizeThe unlimited size + for a size is a value with all bits set: in other words, + 0xffff...ff.
+
+ + +

+ VI. Appendix B: File Space Allocation Types

+ +

There are six basic types of file space allocation as follows: +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic Allocation TypeDescription
H5FD_MEM_SUPERFile space allocated for Superblock.
H5FD_MEM_BTREEFile space allocated for B-tree.
H5FD_MEM_DRAWFile space allocated for raw data.
H5FD_MEM_GHEAPFile space allocated for Global Heap.
H5FD_MEM_LHEAPFile space allocated for Local Heap.
H5FD_MEM_OHDRFile space allocated for Object Header.
+
+ +
+

There are other file space allocation types that are mapped to the + above six basic types because they are similar in nature. + The mapping and the corresponding description are listed in the following two tables: +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic Allocation TypeMapping of Allocation Types to Basic Allocation Types
H5FD_MEM_SUPERnone
H5FD_MEM_BTREEH5FD_MEM_SOHM_INDEX
H5FD_MEM_DRAWH5FD_MEM_FHEAP_HUGE_OBJ
H5FD_MEM_GHEAPnone
H5FD_MEM_LHEAPH5FD_MEM_FHEAP_DBLOCK, H5FD_MEM_FSPACE_SINFO
H5FD_MEM_OHDRH5FD_MEM_FHEAP_HDR, H5FD_MEM_FHEAP_IBLOCK, H5FD_MEM_FSPACE_HDR, H5FD_MEM_SOHM_TABLE
+
+ +
+

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Allocation TypeDescription
H5FD_MEM_FHEAP_HDRFile space allocated for Fractal Heap Header.
H5FD_MEM_FHEAP_DBLOCKFile space allocated for Fractal Heap Direct Blocks.
H5FD_MEM_FHEAP_IBLOCKFile space allocated for Fractal Heap Indirect Blocks.
H5FD_MEM_FHEAP_HUGE_OBJFile space allocated for huge objects in the fractal heap.
H5FD_MEM_FSPACE_HDRFile space allocated for Free-space Manager Header.
H5FD_MEM_FSPACE_SINFOFile space allocated for Free-space Section List of the free-space manager.
H5FD_MEM_SOHM_TABLEFile space allocated for Shared Object Header Message Table.
H5FD_MEM_SOHM_INDEXFile space allocated for Shared Message Record List.
+
+ +

VII. Appendix C: + Types of Indexes for Dataset Chunks

+ +

For an HDF5 file without the latest format enabled, the library + uses the Version 1 B-tree to index dataset + chunks.

+ +

For an HDF5 file with the latest format enabled, the library uses + one of the following five indexing types depending on a chunked + dataset’s dimension specification and the way it is extended. +

+ + +

VII.A. The Single Chunk Index

+ +

The Single Chunk index can be used when the dataset fulfills + the following condition:

+ +
    +
  • the current, maximum, and chunk dimension sizes are all the same
  • +
+ +

The dataset has only one chunk, and the address of the single + chunk is stored in the version 4 Data Layout message. + See the Chunked Storage Property + Description layout and field description tables.

+ + +

VII.B. The Implicit Index

+ +

The Implicit index can be used when the dataset fulfills + the following conditions:

+ +
    +
  • fixed maximum dimension sizes
  • +
  • no filter applied to the dataset
  • +
  • the timing for the space allocation of the dataset chunks is + H5P_ALLOC_TIME_EARLY
  • +
+ +

Since the dataset’s dimension sizes are known and storage space + is to be allocated early, an array of dataset chunks are allocated + based on the maximum dimension sizes when the dataset is created. + The base address of the array is stored in the version 4 + Data Layout message. See the + Chunked Storage Property + Description layout and field description tables. +

+ +

When accessing a dataset chunk with a specified offset, the + address of the chunk in the array is computed as below:

+ +

base address + (size of a chunk in bytes * chunk index + associated with the offset)

+ +

A chunk index starts at 0 and increases according to the + fastest changing dimension, then the next fastest, and so on. + + The chunk index for a dataset chunk offset is computed as below: +

    +
  1. Calculate the scaled offset for each dimension in + scaled_offset: +
    +
    +        scaled_offset = chunk_offset/chunk_dims
    +    
  2. +
  3. Calculate the # of chunks for each dimension in + nchunks: +
    +
    +        nchunks = (curr_dims + chunk_dims - 1)/chunk_dims
    +    
  4. + +
  5. Calculate the down chunks for each dimension in + down_chunks: +
    +
    +        /* n is the # of dimensions */
    +        for(i = (int)(n-1), acc = 1; i >= 0; i--) {
    +        down_chunks[i] = acc;
    +        acc *= nchunks[i];
    +        }
    +      
    +
  6. + +
  7. Calculate the chunk index in chunk_index: +
    +
    +        /* n is the # of dimensions */
    +        for(u = 0, chunk_index = 0; u < n; u++)
    +                                        chunk_index += down_chunks[u] * scaled_offset[u];
    +                                        
    +
  8. +
+

+ For example, for a 2-dimensional dataset with + curr_dims[4,5] and chunk_dims[3,2], + there will be a total of 6 chunks, with 3 chunks in the fastest + changing dimension and 2 chunks in the slowest changing dimension. + See the figure below. + The chunk index for the chunk offset [3,4] + is computed as below: +

    + +
  1. scaled_offset[0] = 1, scaled_offset[1] = 2
  2. +
  3. nchunks[0] = 2, nchunks[1] = 3
  4. +
  5. down_chunks[0] = 3, down_chunks[1] = 1
  6. +
  7. chunk_index = 5
  8. +
    +
+ + + + + + + + + +
+
+ Chunk Diagram
+
+ Figure 3. Implicit index chunk diagram +
+ + + + + + +

VII.C. The Fixed Array Index

+ +

The Fixed Array index can be used when the dataset fulfills + the following condition:

+
    +
  • fixed maximum dimension sizes
  • +
+ +

Since the maximum number of chunks is known, an array of + in-file-on-disk addresses based on the maximum number of chunks is + allocated when data is written to the dataset. To access a dataset + chunk with a specified offset, the + chunk index associated with the offset +is calculated. The index is mapped into the array to locate the +disk address for the chunk.

+ +

The Fixed Array (FA) index structure provides space and speed + improvements in locating chunks over index structures that handle + more dynamic data accesses like a + Version 2 B-tree index. + The entry into the Fixed Array is the Fixed Array header which + contains metadata about the entries stored in the array. The + header contains a pointer to a data block which stores the array + of entries that describe the dataset chunks. For greater efficiency, + the array will be divided into multiple pages if the number of + entries exceeds a threshold value. The space for the data block + and possibly data block pages are allocated as a single contiguous + block of space.

+ +

The content of the data block depends on whether paging is + activated or not. When paging is not used, elements that describe + the chunks are stored in the data block. If paging is turned on, + the data block contains a bitmap indicating which pages are + initialized. Then subsequent data block pages will contain the + entries that describe the chunks.

+ +

An entry describes either a filtered or non-filtered dataset + chunk. The formats for both element types are described below. +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fixed Array Header +
bytebytebytebyte
Signature
VersionClient IDEntry SizePage Bits

Max Num + EntriesL


Data Block + AddressO

Checksum
+ + + + + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fixed Array Header +
Field NameDescription

Signature

+

The ASCII character string “FAHD” + is used to indicate the beginning of a Fixed Array header. + This gives file consistency checking utilities a better + chance of reconstructing a damaged file. +

+

Version

+

This document describes version 0.

+

Client ID

+

The ID for identifying the client of the + Fixed Array: + + + + + + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
2+Reserved +
+

+

Entry Size

+

The size in bytes of an entry in the Fixed Array. +

+

Page Bits

+

The number of bits needed to store the maximum + number of entries in a + data block page.

+

Max Num Entries

+

The maximum number of entries in the Fixed + Array.

+

Data Block Address

+

The address of the data block in the Fixed Array. +

+

Checksum

+

The checksum for the header.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Fixed Array Data Block +
bytebytebytebyte
Signature
VersionClient IDThis space inserted + only to align table nicely

Header AddressO


Page Bitmap (variable size and + optional)


Elements (variable size and + optional)

Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Fixed Array Data Block +
Field NameDescription

Signature

+

The ASCII character string “FADB” + is used to indicate the beginning of a Fixed Array data + block. This gives file consistency checking utilities a + better chance of reconstructing a damaged file. +

+

Version

+

This document describes version 0.

+

Client ID

+

The ID for identifying the client of the + Fixed Array: + + + + + + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
2+Reserved. +
+

+

Header Address

+

The address of the Fixed Array header. Principally used + for file integrity checking. +

+

Page Bitmap

A bitmap indicating which data block pages are initialized.

+

Exists only if the data block is paged.

Elements

+

Contains the elements stored in the data block + and exists only if the data block is not paged. + There are two element types: + + + + + + + + + + + + + + +
IDDescription
0Non-filtered + dataset chunks +
1Filtered dataset + chunks +
+

+

Checksum

+

The checksum for the Fixed Array data block.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + +
+ Layout: Fixed Array Data Block Page +
bytebytebytebyte

Elements (variable + size)

Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Fixed Array Data Block Page +
Field NameDescription

Elements

+

Contains the elements stored in the data block page. + There are two element types: + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
+

+

Checksum

+

The checksum for a Fixed Array data block page.

+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + +
+ Layout: Data Block Element for Non-filtered Dataset Chunk +
bytebytebytebyte

AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + +
+ Fields: Data Block Element for Non-filtered Dataset Chunk +
Field NameDescription

Address

The address of the dataset chunk in the file. +

+
+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Data Block Element for Filtered Dataset Chunk +
bytebytebytebyte

AddressO


Chunk Size (variable size; at most + 8 bytes)

Filter Mask
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Data Block Element for Filtered Dataset Chunk +
Field NameDescription

Address

The address of the dataset chunk in the file. +

+

Chunk Size

The size of the dataset chunk in bytes. +

+

Filter Mask

Indicates the filter to skip for the dataset chunk. Each + filter has an index number in the pipeline; if that filter is + skipped, the bit corresponding to its index is set. +

+
+
+ + +

VII.D. The Extensible Array Index

+ +

The Extensible Array index can be used when the dataset + fulfills the following condition:

+ +
    +
  • only one dimension of unlimited extent
  • +
+ +

The Extensible Array (EA) is a data structure that is used as a + chunk index in datasets where the dataspace has a single + unlimited dimension. In other words, one dimension is set to + H5S_UNLIMITED, and the other dimensions are any number + of fixed-size dimensions. The idea behind the extensible array is + that a particular data object can be located via a lightweight + indexing structure of fixed depth for a given address space. This + indexing structure requires only a few (2-3) file operations per + element lookup and gives good cache performance. Unlike the B-tree + structure, the extensible array is optimized for appends. Where a + B-tree would always add at the rightmost node under these + circumstances, either creating a deep tree (version 1) or requiring + expensive rebalances to correct (version 2), the extensible array + has already mapped out a pre-balanced internal structure. This + optimized internal structure is instantiated as needed when chunk + records are inserted into the structure.

+ + + + + + + +

An Extensible Array consists of a header, an index block, + secondary blocks, data blocks, and (optional) data block pages. The + general scheme is that the index block is used to reference a + secondary block, which is, in turn, used to reference the data block + page where the chunk information is stored. The data blocks will + be paged for efficiency when their size passes a threshold value. + These pages are laid out contiguously on the disk after the data + block, are initialized as needed, and are tracked via bitmaps + stored in the secondary block. The number of secondary and data + blocks/pages in a chunk index varies as they are allocated as + needed and the first few are (conceptually) stored in parent + elements as an optimization.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Extensible Array Header +
bytebytebytebyte
Signature
VersionClient IDElement SizeMax Nelmts Bits
Index Blk ElmtsData Blk Min ElmtsSecondary Blk Min Data PtrsMax Data Blk Page Nelmts Bits

Num Secondary BlksL


Secondary Blk SizeL


Num Data BlksL


Data Blk SizeL


Max Index SetL


Num ElementsL


Index Block AddressO

Checksum
+ + + + + + + + +
  + (Items marked with an ‘L’ in the above table are + of the size specified in the Size + of Lengths field in the superblock.) +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Extensible Array Header +
Field NameDescription

Signature

+

The ASCII character string “EAHD” + is used to indicate the beginning of an Extensible Array + header. This gives file consistency checking utilities a + better chance of reconstructing a damaged file. +

+

Version

+

This document describes version 0.

+

Client ID

+

The ID for identifying the client of the + Fixed Array: + + + + + + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
2+Reserved. +
+

+

Element Size

+

The size in bytes of an element in the Extensible Array. +

+

Max Nelmts Bits

+

The number of bits needed to store the + maximum number of elements in the Extensible Array.

+

Index Blk Elmts

+

The number of elements to store in the index block. +

+

Data Blk Min Elmts

+

The minimum number of elements per data block. +

+

Secondary Blk Min Data Ptrs

+

The minimum number of data block pointers for a + secondary block. +

+

Max Dblk Page Nelmts Bits

+

The number of bits needed to store the maximum number + of elements in a data block page. +

+

Num Secondary Blks

+

The number of secondary blocks created. +

+

Secondary Blk Size

+

The size of the secondary blocks created. +

+

Num Data Blks

+

The number of data blocks created. +

+

Data Blk Size

+

The size of the data blocks created. +

+

Max Index Set

+

The maximum index set. +

+

Num Elmts

+

The number of elements realized. +

+

Index Block Address

+

The address of the index block. +

+

Checksum

+

The checksum for the header.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Extensible Array Index Block +
bytebytebytebyte
Signature
VersionClient IDThis space inserted + only to align table nicely

Header AddressO


Elements (variable size and + optional)


Data Block Addresses (variable + size and optional)


Secondary Block Addresses (variable + size and optional)

Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Extensible Array Index Block +
Field NameDescription

Signature

+

The ASCII character string “EAIB” + is used to indicate the beginning of an Extensible Array + Index Block. This gives file consistency checking utilities + a better chance of reconstructing a damaged file. +

+

Version

+

This document describes version 0.

+

Client ID

+

The client ID for identifying the user of the + Extensible Array: + + + + + + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
2+Reserved. +
+

+

Header Address

+

The address of the Extensible Array header. Principally + used for file integrity checking.

+

Elements

+

Contains the elements that are stored directly in + the index block. An optimization to avoid unnecessary + secondary blocks. +
+
+ There are two element types: + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
+

+

Data Block Addresses

+

Contains the addresses of the data blocks + that are stored directly in the Index Block. An + optimization to avoid unnecessary secondary blocks.

+

Secondary Block Addresses

+

Contains the addresses of the secondary + blocks.

+

Checksum

+

The checksum for the Extensible Array Index Block.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Extensible Array Secondary Block +
bytebytebytebyte
Signature
VersionClient IDThis space inserted + only to align table nicely

Header AddressO


Block Offset (variable + size)


Page Bitmap (variable size and + optional)


Data Block Addresses (variable + size and optional)

Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Extensible Array Secondary Block +
Field NameDescription

Signature

+

The ASCII character string “EASB” + is used to indicate the beginning of an Extensible Array + Secondary Block. This gives file consistency checking utilities + a better chance of reconstructing a damaged file. +

+

Version

+

This document describes version 0.

+

Client ID

+

The ID for identifying the client of the + Extensible Array: + + + + + + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
2+Reserved. +
+

+

Header Address

+

The address of the Extensible Array header. Principally + used for file integrity checking.

+

Block Offset

+

Stores the offset of the block in the array. +

+

Page Bitmap

+

A bitmap indicating which + data block pages are initialized. +

+ Exists only if the data block is paged. +

Data Block Addresses

+

Contains the addresses of the data blocks + referenced by this secondary block.

+

Checksum

+

The checksum for the Extensible Array + Secondary Block.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Extensible Array Data Block +
bytebytebytebyte
Signature
VersionClient IDThis space inserted + only to align table nicely

Header AddressO


Block Offset (variable + size)


Elements (variable size and + optional)

Checksum
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Extensible Array Data Block +
Field NameDescription

Signature

+

The ASCII character string “EADB” + is used to indicate the beginning of an Extensible Array + data block. This gives file consistency checking utilities + a better chance of reconstructing a damaged file. +

+

Version

+

This document describes version 0.

+

Client ID

+

The ID for identifying the client of the + Extensible Array: + + + + + + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
2+Reserved. +
+

+

Header Address

+

The address of the Extensible Array header. Principally + used for file integrity checking. +

+

Block Offset

+

The offset of the block in the array. +

Elements

+

Contains the elements stored in the data block and + exists only if the data block is not paged. +
+
+ There are two element types: + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
+

+

Checksum

+

The checksum for the Extensible Array data block.

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + +
+ Layout: Extensible Array Data Block Page +
bytebytebytebyte

Elements (variable + size)

Checksum
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Extensible Array Data Block Page +
Field NameDescription

Elements

+

Contains the elements stored in the data block + page.

+

+ There are two element types: + + + + + + + + + + + + + + +
IDDescription
0Non-filtered dataset chunks +
1Filtered dataset chunks +
+

+

Checksum

+

The checksum for an Extensible Array data block + page.

+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + +
+ Layout: Data Block Element for Non-filtered Dataset Chunk +
bytebytebytebyte

AddressO

+ + + + + +
+
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + +
+ Fields: Data Block Element for Non-filtered Dataset Chunk +
Field NameDescription

Address

The address of the dataset chunk in the file. +

+
+
+

+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Data Block Element for Filtered Dataset Chunk +
bytebytebytebyte

AddressO


Chunk Size (variable size; at + most 8 bytes)

Filter Mask
+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Data Block Element for Filtered Dataset Chunk +
Field NameDescription

Address

The address of the dataset chunk in the file. +

+

Chunk Size

The size of the dataset chunk in bytes. +

+

Filter Mask

Indicates the filter to skip for the dataset chunk. + Each filter has an index number in the pipeline; if that + filter is skipped, the bit corresponding to its index is set. +

+
+
+ + +

VII.E. The Version 2 B-trees Index

+ +

The Version 2 B-trees index can be used when the dataset + fulfills the following condition:

+ +
    +
  • more than one dimension of unlimited extent
  • +
+ +

Version 2 B-trees can be used to index various objects in the + library. See “Version 2 B-trees” + for more information. The B-tree types 10 + and 11 record layouts are for + indexing dataset chunks.

+ +

VIII. Appendix D: + Encoding for dataspace and reference

+ + +

VIII.A. Dataspace Encoding

+H5Sencode is a public routine that encodes a dataspace description into a buffer while +H5Sdecode is the corresponding routine that decodes the description encoded in the buffer. +

+ See the reference manual description for these two public routines. + +
+
+
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Dataspace Description for H5Sencode/H5Sdecode +
bytebytebytebyte
Dataspace IDEncode VersionSize of SizeThis space inserted + only to align table nicely

Size of Extent +



Dataspace Message + (variable size) +



Dataspace Selection + (variable size) +

+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Dataspace Description for H5Sencode/H5Sdecode +
Field NameDescription

Dataspace ID

+

The datspace message ID which is 1.

+

Encode Version

+

H5S_ENCODE_VERSION which is 0. +

+

Size of Size

+

The number of bytes used to store the size of an object. +

+

Size of Extent

+

Size of the dataspace message. +

+

Dataspace Message

+

The dataspace message information. See + Dataspace Message.

+

+

Dataspace Selection

+

The dataspace selection information. See + Dataspace Selection.

+
+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + +
+ Layout: Dataspace Selection +
bytebytebytebyte
Selection Type

Selection Info (variable + size)

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + +
+ Fields: Dataspace Selection +
Field NameDescription

Selection Type

+

There are 4 types of selection: + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0H5S_SEL_NONE: Nothing selected +
1H5S_SEL_POINTS: Sequence of points selected +
2H5S_SEL_HYPER: Hyperslab selected +
3H5S_SEL_ALL: Entire extent selected +
+

Selection Info

+

There are 4 types of selection info: + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
0Selection info for H5S_SEL_NONE +
1Selection info for H5S_SEL_POINTS +
2Selection info for H5S_SEL_HYPER +
3Selection for H5S_SEL_ALL +
+

+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + +
+ Layout: Selection Info for H5S_SEL_NONE +
bytebytebytebyte
Version

Reserved (zero, 8 bytes)

+
+ +
+
+
+ + + + + + + + + + + +
+ Fields: Selection Info for H5S_SEL_NONE +
Field NameDescription

Version

The version number for the H5S_SEL_NONE Selection Info. + The value is 1.

+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + +
+ Layout: Selection Info for H5S_SEL_POINTS +
bytebytebytebyte
Version


Points Selection Info (variable size) +


+
+ +
+
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Selection Info for H5S_SEL_POINTS +
Field NameDescription

Version

The version number for the H5S_SEL_POINTS Selection Info. + The value is either 1 or 2.

Points Selection Info

Depending on version: + + + + + + + + + + + + + + + + +
VersionDescription
1See Version 1 Points Selection Info +
2See Version 2 Points Selection Info +
+

+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 1 Points Selection Info +
bytebytebytebyte
Reserved (zero)
Length
Rank
Num Points
Point #1: coordinate #1
.
.
.
Point #1: coordinate #u
.
.
.
Point #n: coordinate #1
.
.
.
Point #n: coordinate #u
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 1 Points Selection Info +
Field NameDescription

Length

The size in bytes from Length to the end of the + selection info.

Rank

The number of dimensions.

Num Points

The number of points in the selection.

Point #n: coordinate #u

The array of points in the selection. +

The points selected are #1 to #n where n is Num Points. +

The list of coordinates for each point are #1 to #u where u is + Rank.

+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 Points Selection Info +
bytebytebytebyte
Encode SizeThis space inserted only to align table nicely +
Rank
Num Points

(2, 4 or 8 bytes)

Point #1: coordinate #1

(2, 4 or 8 bytes)

.
.
.
Point #1: coordinate #u

(2, 4 or 8 bytes)

.
.
.
Point #n: coordinate #1

(2, 4 or 8 bytes)

.
.
.
Point #n: coordinate #u

(2, 4 or 8 bytes)

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 Points Selection Info +
Field NameDescription

Encode Size

The size for encoding the points selection info which can be 2, 4 or 8 bytes. +

Rank

The number of dimensions.

Num Points

The number of points in the selection. +

The field Encode Size indicates the size of this field

Point #n: coordinate #u

The array of points in the selection. +

The points selected are #1 to #n where n is Num Points. +

The list of coordinates for each point are #1 to #u where u is + Rank. +

The field Encode Size indicates the size of this field

+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + +
+ Layout: Selection Info for H5S_SEL_HYPER +
bytebytebytebyte
Version

Hyperslab Selection Info + (variable size)

+
+ +
+
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Selection Info for H5S_SEL_HYPER +
Field NameDescription

Version

The version number for the H5S_SEL_HYPER selection info. + The value is 1, 2 or 3.

Hyperslab Selection Info

Depending on version: + + + + + + + + + + + + + + + + + + + + +
VersionDescription
1See Version 1 Hyperslab Selection Info. +
2See Version 2 Hyperslab Selection Info +
3See Version 3 Hyperslab Selection Info +
+

+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 1 Hyperslab Selection Info +
bytebytebytebyte
Reserved
Length
Rank
Num Blocks
Starting Offset #1 for Block #1
.
.
.
Starting Offset #n for Block #1
Ending Offset #1 for Block #1
.
.
.
Ending Offset #n for Block #1
.
.
.
.
.
.
.
.
.
Starting Offset #1 for Block #u
.
.
.
Starting Offset #n for Block #u
Ending Offset #1 for Block #u
.
.
.
Ending Offset #n for Block #u
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 1 Hyperslab Selection Info +
Field NameDescription

Length

The size in bytes from the field Rank to the + end of the Selection Info.

Rank

The number of dimensions in the dataspace.

Num Blocks

The number of blocks in the selection.

Starting Offset #n for Block #u

The offset #n of the starting element in block #u. +

#n is from 1 to Rank. +

#u is from 1 to Num Blocks moving from the fastest + changing dimension to the slowest changing dimension. +

Ending Offset #n for Block #u

The offset #n of the ending element in block #u. +

#n is from 1 to Rank. +

#u is from 1 to Num Blocks moving from the fastest + changing dimension to the slowest changing dimension. +

+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 2 Hyperslab Selection Info +
bytebytebytebyte
FlagsThis space inserted + only to align table nicely
Length
Rank
Start #1 (8 bytes)

Stride #1 (8 bytes)

Count #1 (8 bytes)

Block #1 (8 bytes)

.
.
.
Start #n (8 bytes)

Stride #n (8 bytes)

Count #n (8 bytes)

Block #n (8 bytes)

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 2 Hyperslab Selection Info +
Field NameDescription

Flags

This is a bit field with the following definition. + Currently, this is always set to 0x1. +

+ + + + + + + + + + +
BitDescription
0If set, it a a regular hyperslab, otherwise, irregular. +
+

Length

The size in bytes from the field Rank to the + end of the Selection Info.

Rank

The number of dimensions in the dataspace.

Start #n

The offset of the starting element in the block. +

#n is from 1 to Rank. +

Stride #n

The number of elements to move in each dimension. +

#n is from 1 to Rank. +

Count #n

The number of blocks to select in each dimension. +

#n is from 1 to Rank. +

Block #n

The size (in elements) of each block in each dimension. +

#n is from 1 to Rank. +

+
+ + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 3 Hyperslab Selection Info +
bytebytebytebyte
FlagsEncode SizeThis space inserted + only to align table nicely
Rank

Regular/Irregular Hyperslab Selection Info +

(variable size)

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 3 Hyperslab Selection Info +
Field NameDescription

Flags

This is a bit field with the following definition: +

+ + + + + + + + + + +
BitDescription
0If set, it is a regular hyperslab, otherwise, irregular. +
+

Encode Size

The size for encoding hyperslab selection info, which can 2, 4 or 8 bytes.

Rank

The number of dimensions in the dataspace.

Regular/Irregular Hyperslab Selection Info

This is the selection info for version 3 hyperslab which can be regular or irregular. +

If bit 0 of the field Flags is set, + See Version 3 Regular Hyperslab Selection Info +

Otherwise, see Version 3 Irregular Hyperslab Selection Info +

+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 3 Regular Hyperslab Selection Info +
bytebytebytebyte
Start #1

(2, 4 or 8 bytes)

Stride #1

(2, 4 or 8 bytes)

Count #1

(2, 4 or 8 bytes)

Block #1

(2, 4 or 8 bytes)

.
.
.
Start #n

(2, 4 or 8 bytes)

Stride #n

(2, 4 or 8 bytes)

Count #n

(2, 4 or 8 bytes)

Block #n

(2, 4 or 8 bytes)

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Version 3 Regular Hyperslab Selection Info +
Field NameDescription

Start #n

The offset of the starting element in the block. +

#n is from 1 to Rank. +

The field Encode Size indicates the size of this field. +

Stride #n

The number of elements to move in each dimension. +

#n is from 1 to Rank. +

The field Encode Size indicates the size of this field. +

Count #n

The number of blocks to select in each dimension. +

#n is from 1 to Rank. +

The field Encode Size indicates the size of this field. +

Block #n

The size (in elements) of each block in each dimension. +

#n is from 1 to Rank. +

The field Encode Size indicates the size of this field. +

+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Version 3 Irregular Hyperslab Selection Info +
bytebytebytebyte
Num Blocks

(2, 4 or 8 bytes)

Starting Offset #1 for Block #1

(2, 4 or 8 bytes)

.
.
.
Starting Offset #n for Block #1

(2, 4 or 8 bytes)

Ending Offset #1 for Block #1

(2, 4 or 8 bytes)

.
.
.
Ending Offset #n for Block #1

(2, 4 or 8 bytes)

.
.
.
.
.
.
.
.
.
Starting Offset #1 for Block #u

(2, 4 or 8 bytes)

.
.
.
Starting Offset #n for Block #u

(2, 4 or 8 bytes)

Ending Offset #1 for Block #u

(2, 4 or 8 bytes)

.
.
.
Ending Offset #n for Block #u

(2, 4 or 8 bytes)

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + +
+ Fields: Version 3 Irregular Hyperslab Selection Info +

Num Blocks

The number of blocks in the selection. +

The field Encode Size indicates the size of this field

Starting Offset #n for Block #u

The offset #n of the starting element in block #u. +

#n is from 1 to Rank. +

#u is from 1 to Num Blocks moving from the fastest + changing dimension to the slowest changing dimension. +

The field Encode Size indicates the size of this field +

Ending Offset #n for Block #u

The offset #n of the ending element in block #u. +

#n is from 1 to Rank. +

#u is from 1 to Num Blocks moving from the fastest + changing dimension to the slowest changing dimension. +

The field Encode Size indicates the size of this field +

+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + +
+ Layout: Selection Info for H5S_SEL_ALL +
bytebytebytebyte
Version

Reserved (zero, + 8 bytes)

+
+ +
+
+
+ + + + + + + + + + + +
+ Fields: Selection Info for H5S_SEL_ALL +
Field NameDescription

Version

The version number for the H5S_SEL_ALL Selection Info; + the value is 1.

+
+ + +

VIII.B. Reference Encoding (Revised)

+

+
+ For the following reference type, + the Reference Header and Reference Block are stored together as the dataset's raw data: +

    +
  • Object Reference (H5R_OBJECT2) (without reference to an external file)
  • +
+

+ For the following reference types, + the Reference Header plus the Global Heap ID are stored + as the dataset's raw data in the file. + The global heap ID is used to locate the Reference Block stored in the global heap: +

    +
  • Object Reference (H5R_OBJECT2) (with reference to an external file)
  • +
  • Dataset Region Reference (H5R_DATASET_REGION2) (with/without reference to an external file)
  • +
  • Attribute Reference (H5R_ATTR) (with/without reference to an external file)
  • +
+
+
+ +
+ + + + + + + + + + + + + + + + +
+ Layout: Reference Header +
bytebytebytebyte
Reference TypeFlagsThis space inserted + only to align table nicely
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Reference Header +
Field NameDescription

Reference Type

+

There are 3 types of references: + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
2H5R_OBJECT2: Object Reference +
3H5R_DATASET_REGION2: Dataset Region Reference +
4H5R_ATTR: Attribute Reference +
+ +

Flags

This field describes the reference: + + + + + + + + + + + + + + +
BitDescription
0If set, the reference is to an external file. +
1-7Reserved

+ +
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Layout: Reference Block +
bytebytebytebyte
Token SizeThis space inserted + only to align table nicely


Token + (variable size)


Length of External File NameThis space inserted + only to align table nicely


External File Name + (variable size)


Size of Dataspace Selection
Rank of Dataspace Selection


Dataspace Selection Information + (variable size)


Length of Attribute Name This space inserted + only to align table nicely


Attribute Name + (variable size)


+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Fields: Reference Block +
Field NameDescription

Token size

This is the size of the token for the object. +

Token

+

+ This is the token for the object. +

+

Length fo External File Name

This is the length for the external file name. +

This field exists if bit 0 of flags is set.

+

+

External File Name

This is the name of the external file being referenced.

+

+

This field exists if bit 0 of flags is set.

+

Dataspace Selection Information

See Dataspace Selection.

+

+

This field exists if the Reference Type is H5R_DATASET_REGION2.

+

Length of Attribute Name

This is the length of the attribute name. +

This field exists if the Reference Type is H5R_ATTRIBUTE.

+

Attribute Name

This is the name of the attribute being referenced. +

This field exists if the Reference Type is H5R_ATTRIBUTE.

+
+
+ +
+
+
+ + + +

VIII.C. Reference Encoding (Backward Compatibility)

+

+
+ The two references described below are maintained to preserve compatibility with previous versions of the library. +

+ For the following reference type, + the reference encoding is stored as the dataset's raw data in the file: +

    +
  • Object Reference (H5R_OBJECT1)
  • +
+

+ For the following reference type, + the Global Heap ID is stored as the dataset's raw data in the file. + The global heap ID is used to locate the reference encoding + stored in the global heap: +

    +
  • Dataset Region Reference (H5R_DATASET_REGION1)
  • +
+ +
+
+
+ + + + + + + + + + + + + + +
+ Layout: Reference for H5R_OBJECT1 +
bytebytebytebyte

Object AddressO

+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+
+ + + + + + + + + + + + +
+ Fields: Reference for H5R_OBJECT1 +
Field NameDescription

Object Address

+

Address of the object being referenced +

+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ Layout: Reference for H5R_DATASET_REGION1 +
bytebytebytebyte

Object AddressO



Dataspace Selection Information + (variable size)


+ + + + + +
  + (Items marked with an ‘O’ in the above table are + of the size specified in the Size + of Offsets field in the superblock.) +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + +
+ Fields: Reference for H5R_DATASET_REGION1 +
Field NameDescription

Object Address

This is the address of the object being referenced. +

Dataspace Selection Information

This is the dataspace selection for the object being referenced. + See Dataspace Selection.

+

+
+
+ +
+
+
+ + + + diff --git a/doxygen/examples/H5A_examples.c b/doxygen/examples/H5A_examples.c new file mode 100644 index 0000000..f332efa --- /dev/null +++ b/doxygen/examples/H5A_examples.c @@ -0,0 +1,145 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_acpl, fail_attr, fail_file; + hid_t file, acpl, fspace, attr; + + unsigned mode = H5F_ACC_TRUNC; + char file_name[] = "f1.h5"; + // attribute names can be arbitrary Unicode strings + char attr_name[] = "Χαρακτηριστικό"; + + if ((file = H5Fcreate(file_name, mode, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_acpl; + } + // use UTF-8 encoding for the attribute name + if (H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0) { + ret_val = EXIT_FAILURE; + goto fail_fspace; + } + // create a scalar (singleton) attribute + if ((fspace = H5Screate(H5S_SCALAR)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_fspace; + } + // create an attribute on the root group + if ((attr = H5Acreate2(file, attr_name, H5T_STD_I32LE, fspace, acpl, H5P_DEFAULT)) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_attr; + } + + H5Aclose(attr); +fail_attr: + H5Sclose(fspace); +fail_fspace: + H5Pclose(acpl); +fail_acpl: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_attr, fail_file; + hid_t file, attr; + + unsigned mode = H5F_ACC_RDONLY; + char file_name[] = "f1.h5"; + char attr_name[] = "Χαρακτηριστικό"; + int value; + + if ((file = H5Fopen(file_name, mode, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((attr = H5Aopen(file, attr_name, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_attr; + } + // read the attribute value + if (H5Aread(attr, H5T_NATIVE_INT, &value) < 0) + ret_val = EXIT_FAILURE; + + // do something w/ the attribute value + + H5Aclose(attr); +fail_attr: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_attr, fail_file; + hid_t file, attr; + + unsigned mode = H5F_ACC_RDWR; + char file_name[] = "f1.h5"; + char attr_name[] = "Χαρακτηριστικό"; + int value = 1234; + + if ((file = H5Fopen(file_name, mode, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((attr = H5Aopen(file, attr_name, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_attr; + } + // update the attribute value + if (H5Awrite(attr, H5T_NATIVE_INT, &value) < 0) + ret_val = EXIT_FAILURE; + + H5Aclose(attr); +fail_attr: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_attr, fail_file; + hid_t file; + + unsigned mode = H5F_ACC_RDWR; + char file_name[] = "f1.h5"; + char attr_name[] = "Χαρακτηριστικό"; + + if ((file = H5Fopen(file_name, mode, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + // delete the attribute + if (H5Adelete(file, attr_name) < 0) { + ret_val = EXIT_FAILURE; + goto fail_attr; + } + +fail_attr: + H5Fclose(file); +fail_file:; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5D_examples.c b/doxygen/examples/H5D_examples.c new file mode 100644 index 0000000..aad057d --- /dev/null +++ b/doxygen/examples/H5D_examples.c @@ -0,0 +1,173 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_lcpl, fail_dset, fail_file; + hid_t file, lcpl, fspace, dset; + + unsigned mode = H5F_ACC_TRUNC; + char file_name[] = "d1.h5"; + // link names can be arbitrary Unicode strings + char dset_name[] = "σύνολο/δεδομένων"; + + if ((file = H5Fcreate(file_name, mode, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_lcpl; + } + // use UTF-8 encoding for link names + if (H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) { + ret_val = EXIT_FAILURE; + goto fail_fspace; + } + // create intermediate groups as needed + if (H5Pset_create_intermediate_group(lcpl, 1) < 0) { + ret_val = EXIT_FAILURE; + goto fail_fspace; + } + // create a 1D dataspace + if ((fspace = H5Screate_simple(1, (hsize_t[]){10}, NULL)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_fspace; + } + // create a 32-bit integer dataset + if ((dset = H5Dcreate2(file, dset_name, H5T_STD_I32LE, fspace, lcpl, H5P_DEFAULT, H5P_DEFAULT)) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dset; + } + + H5Dclose(dset); +fail_dset: + H5Sclose(fspace); +fail_fspace: + H5Pclose(lcpl); +fail_lcpl: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_dset, fail_file; + hid_t file, dset; + + unsigned mode = H5F_ACC_RDONLY; + char file_name[] = "d1.h5"; + // assume a priori knowledge of dataset name and size + char dset_name[] = "σύνολο/δεδομένων"; + int elts[10]; + + if ((file = H5Fopen(file_name, mode, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((dset = H5Dopen2(file, dset_name, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dset; + } + // read all dataset elements + if (H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, elts) < 0) + ret_val = EXIT_FAILURE; + + // do something w/ the dataset elements + + H5Dclose(dset); +fail_dset: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_update, fail_fspace, fail_dset, fail_file; + hid_t file, dset, fspace; + + unsigned mode = H5F_ACC_RDWR; + char file_name[] = "d1.h5"; + char dset_name[] = "σύνολο/δεδομένων"; + int new_elts[6][2] = {{-1, 1}, {-2, 2}, {-3, 3}, {-4, 4}, {-5, 5}, {-6, 6}}; + + if ((file = H5Fopen(file_name, mode, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((dset = H5Dopen2(file, dset_name, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dset; + } + // get the dataset's dataspace + if ((fspace = H5Dget_space(dset)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_fspace; + } + // select the first 5 elements in odd positions + if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, (hsize_t[]){1}, (hsize_t[]){2}, (hsize_t[]){5}, + NULL) < 0) { + ret_val = EXIT_FAILURE; + goto fail_update; + } + + // (implicitly) select and write the first 5 elements of the second column of NEW_ELTS + if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, fspace, H5P_DEFAULT, new_elts) < 0) + ret_val = EXIT_FAILURE; + +fail_update: + H5Sclose(fspace); +fail_fspace: + H5Dclose(dset); +fail_dset: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_delete, fail_file; + hid_t file; + + unsigned mode = H5F_ACC_RDWR; + char file_name[] = "d1.h5"; + char group_name[] = "σύνολο"; + char dset_name[] = "σύνολο/δεδομένων"; + + if ((file = H5Fopen(file_name, mode, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + // delete (unlink) the dataset + if (H5Ldelete(file, dset_name, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_delete; + } + // the previous call deletes (unlinks) only the dataset + if (H5Ldelete(file, group_name, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_delete; + } + +fail_delete: + H5Fclose(file); +fail_file:; + } + + //! + + return ret_val; +} diff --git a/doxygen/examples/H5F_examples.c b/doxygen/examples/H5F_examples.c new file mode 100644 index 0000000..a7ce6fb --- /dev/null +++ b/doxygen/examples/H5F_examples.c @@ -0,0 +1,187 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_fapl, fail_fcpl, fail_file; + hid_t fcpl, fapl, file; + + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_fcpl; + } + else { + // adjust the file creation properties + } + + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_fapl; + } + else { + // adjust the file access properties + } + + unsigned mode = H5F_ACC_EXCL; + char name[] = "f1.h5"; + + if ((file = H5Fcreate(name, mode, fcpl, fapl)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // do something useful with FILE + + H5Fclose(file); +fail_file: + H5Pclose(fapl); +fail_fapl: + H5Pclose(fcpl); +fail_fcpl:; + } + //! + + //! + { + __label__ fail_fapl, fail_file; + hid_t fapl, file; + + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_fapl; + } + else { + // adjust the file access properties + } + + unsigned mode = H5F_ACC_RDWR; + char name[] = "f1.h5"; + + if ((file = H5Fopen(name, mode, fapl)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // do something useful with FILE + + H5Fclose(file); +fail_file: + H5Pclose(fapl); +fail_fapl:; + } + //! + + //! + { + unsigned mode = H5F_ACC_TRUNC; + char name[] = "f11.h5"; + + hid_t file = H5Fcreate(name, mode, H5P_DEFAULT, H5P_DEFAULT); + if (file != H5I_INVALID_HID) + H5Fclose(file); + else + ret_val = EXIT_FAILURE; + } + //! + + //! + { + unsigned mode = H5F_ACC_RDONLY; + char name[] = "f11.h5"; + + hid_t file = H5Fopen(name, mode, H5P_DEFAULT); + if (file != H5I_INVALID_HID) + H5Fclose(file); + else + ret_val = EXIT_FAILURE; + } + //! + + //! + { + unsigned mode = H5F_ACC_RDWR; + char name[] = "f11.h5"; + + hid_t file = H5Fopen(name, mode, H5P_DEFAULT); + if (file != H5I_INVALID_HID) { + int step; + for (step = 0; step < 1000; ++step) { + + // do important work & flush every 20 steps + + if (step % 20 == 0) { + if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) { + perror("H5Fflush failed."); + ret_val = EXIT_FAILURE; + break; + } + } + } + + if (H5Fclose(file) < 0) + perror("H5Fclose failed."); + } + else + ret_val = EXIT_FAILURE; + } + //! + + //! + { + unsigned mode = H5F_ACC_RDWR; + char name[] = "f11.h5"; + + hid_t file = H5Fopen(name, mode, H5P_DEFAULT); + if (file != H5I_INVALID_HID) { + if (H5Fset_libver_bounds(file, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) >= 0) { + + // object creation will not exceed HDF5 version 1.8.x + } + else + perror("H5Fset_libver_bounds failed."); + + if (H5Fclose(file) < 0) + perror("H5Fclose failed."); + } + else + ret_val = EXIT_FAILURE; + } + //! + + //! + { + hid_t file = H5Fopen("f11.h5", H5F_ACC_RDWR, H5P_DEFAULT); + if (file != H5I_INVALID_HID) { + hid_t group, child; + if ((group = H5Gcreate1(file, "mount_point", H5P_DEFAULT)) != H5I_INVALID_HID) { + if ((child = H5Fopen("f1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) != H5I_INVALID_HID) { + if (H5Fmount(group, ".", child, H5P_DEFAULT) >= 0) { + + // do something useful w/ the mounted file + } + else { + ret_val = EXIT_FAILURE; + perror("H5Fmount failed."); + } + H5Fclose(child); + } + H5Gclose(group); + } + H5Fclose(file); + } + else + ret_val = EXIT_FAILURE; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5Pget_metadata_read_attempts.1.c b/doxygen/examples/H5Pget_metadata_read_attempts.1.c new file mode 100644 index 0000000..da325c0 --- /dev/null +++ b/doxygen/examples/H5Pget_metadata_read_attempts.1.c @@ -0,0 +1,22 @@ +/* Get a copy of file access property list */ +fapl = H5Pcreate(H5P_FILE_ACCESS); + +/* Retrieve the # of read attempts from the file access property list */ +H5Pget_metadata_read_attempts(fapl, &attempts); + +/* + * The value returned in "attempts" will be 1 (default for non-SWMR access). + */ + +/* Set the # of read attempts to 20 */ +H5Pset_metadata_read_attempts(fapl, 20); + +/* Retrieve the # of read attempts from the file access property list */ +H5Pget_metadata_read_attempts(fapl, &attempts); + +/* + * The value returned in "attempts" will be 20 as set. + */ + +/* Close the property list */ +H5Pclose(fapl); diff --git a/doxygen/examples/H5Pget_metadata_read_attempts.2.c b/doxygen/examples/H5Pget_metadata_read_attempts.2.c new file mode 100644 index 0000000..2cd12db --- /dev/null +++ b/doxygen/examples/H5Pget_metadata_read_attempts.2.c @@ -0,0 +1,44 @@ +/* Open the file with SWMR access and default file access property list */ +fid = H5Fopen(FILE, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), H5P_DEFAULT); + +/* Get the file's file access roperty list */ +file_fapl = H5Fget_access_plist(fid); + +/* Retrieve the # of read attempts from the file's file access property list */ +H5Pget_metadata_read_attempts(file_fapl, &attempts); + +/* + * The value returned in "attempts" will be 100 (default for SWMR access). + */ + +/* Close the property list */ +H5Pclose(file_fapl); + +/* Close the file */ +H5Fclose(fid); + +/* Create a copy of file access property list */ +fapl = H5Pcreate(H5P_FILE_ACCESS); + +/* Set the # of read attempts */ +H5Pset_metadata_read_attempts(fapl, 20); + +/* Open the file with SWMR access and the non-default file access property list */ +fid = H5Fopen(FILE, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); + +/* Get the file's file access roperty list */ +file_fapl = H5Fget_access_plist(fid); + +/* Retrieve the # of read attempts from the file's file access property list */ +H5Pget_metadata_read_attempts(file_fapl, &attempts); + +/* + * The value returned in "attempts" will be 20. + */ + +/* Close the property lists */ +H5Pclose(file_fapl); +H5Pclose(fapl); + +/* Close the file */ +H5Fclose(fid); diff --git a/doxygen/examples/H5Pget_metadata_read_attempts.3.c b/doxygen/examples/H5Pget_metadata_read_attempts.3.c new file mode 100644 index 0000000..4b5ea3a --- /dev/null +++ b/doxygen/examples/H5Pget_metadata_read_attempts.3.c @@ -0,0 +1,44 @@ +/* Open the file with non-SWMR access and default file access property list */ +fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + +/* Get the file's file access roperty list */ +file_fapl = H5Fget_access_plist(fid); + +/* Retrieve the # of read attempts from the file's file access property list */ +H5Pget_metadata_read_attempts(file_fapl, &attempts); + +/* + * The value returned in "attempts" will be 1 (default for non-SWMR access). + */ + +/* Close the property list */ +H5Pclose(file_fapl); + +/* Close the file */ +H5Fclose(fid); + +/* Create a copy of file access property list */ +fapl = H5Pcreate(H5P_FILE_ACCESS); + +/* Set the # of read attempts */ +H5Pset_metadata_read_attempts(fapl, 20); + +/* Open the file with non-SWMR access and the non-default file access property list */ +fid = H5Fopen(FILE, H5F_ACC_RDONLY, fapl); + +/* Get the file's file access roperty list */ +file_fapl = H5Fget_access_plist(fid); + +/* Retrieve the # of read attempts from the file's file access property list */ +H5Pget_metadata_read_attempts(file_fapl, &attempts); + +/* + * The value returned in "attempts" will be 1 (default for non-SWMR access). + */ + +/* Close the property lists */ +H5Pclose(file_fapl); +H5Pclose(fapl); + +/* Close the file */ +H5Fclose(fid); diff --git a/doxygen/examples/H5Pget_object_flush_cb.c b/doxygen/examples/H5Pget_object_flush_cb.c new file mode 100644 index 0000000..d18f3df --- /dev/null +++ b/doxygen/examples/H5Pget_object_flush_cb.c @@ -0,0 +1,41 @@ +hid_t fapl_id; +unsigned counter; +H5F_object_flush_t *ret_cb; +unsigned * ret_counter; + +/* Create a copy of the file access property list */ +fapl_id = H5Pcreate(H5P_FILE_ACCESS); + +/* Set up the object flush property values */ +/* flush_cb: callback function to invoke when an object flushes (see below) */ +/* counter: user data to pass along to the callback function */ +H5Pset_object_flush_cb(fapl_id, flush_cb, &counter); + +/* Open the file */ +file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + +/* Get the file access property list for the file */ +fapl = H5Fget_access_plist(file_id); + +/* Retrieve the object flush property values for the file */ +H5Pget_object_flush_cb(fapl, &ret_cb, &ret_counter); +/* ret_cb will point to flush_cb() */ +/* ret_counter will point to counter */ + +/* +. +. +. +. +. +. +*/ + +/* The callback function for the object flush property */ +static herr_t +flush_cb(hid_t obj_id, void *_udata) +{ + unsigned *flush_ct = (unsigned *)_udata; + ++(*flush_ct); + return 0; +} diff --git a/doxygen/examples/H5Pset_metadata_read_attempts.c b/doxygen/examples/H5Pset_metadata_read_attempts.c new file mode 100644 index 0000000..7c2f65d --- /dev/null +++ b/doxygen/examples/H5Pset_metadata_read_attempts.c @@ -0,0 +1,59 @@ +//! [SWMR Access] +/* Create a copy of file access property list */ +fapl = H5Pcreate(H5P_FILE_ACCESS); + +/* Set the # of read attempts */ +H5Pset_metadata_read_attempts(fapl, 20); + +/* Open the file with SWMR access and the non-default file access property list */ +fid = H5Fopen(FILE, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); + +/* Get the file's file access roperty list */ +file_fapl = H5Fget_access_plist(fid); + +/* Retrieve the # of read attempts from the file's file access property list */ +H5Pget_metadata_read_attempts(file_fapl, &attempts); + +/* + * The value returned in "attempts" will be 20. + * The library will use 20 as the number of read attempts + * when reading checksummed metadata in the file + */ + +/* Close the property list */ +H5Pclose(fapl); +H5Pclose(file_fapl); + +/* Close the file */ +H5Fclose(fid); +//! [SWMR Access] + +//! [non-SWMR Access] +/* Create a copy of file access property list */ +fapl = H5Pcreate(H5P_FILE_ACCESS); + +/* Set the # of read attempts */ +H5Pset_metadata_read_attempts(fapl, 20); + +/* Open the file with SWMR access and the non-default file access property list */ +fid = H5Fopen(FILE, H5F_ACC_RDONLY, fapl); + +/* Get the file's file access roperty list */ +file_fapl = H5Fget_access_plist(fid); + +/* Retrieve the # of read attempts from the file's file access property list */ +H5Pget_metadata_read_attempts(file_fapl, &attempts); + +/* + * The value returned in "attempts" will be 1 (default for non-SWMR access). + * The library will use 1 as the number of read attempts + * when reading checksummed metadata in the file + */ + +/* Close the property lists */ +H5Pclose(fapl); +H5Pclose(file_fapl); + +/* Close the file */ +H5Fclose(fid); +//! [non-SWMR Access] diff --git a/doxygen/examples/H5Pset_object_flush_cb.c b/doxygen/examples/H5Pset_object_flush_cb.c new file mode 100644 index 0000000..1dfa90d --- /dev/null +++ b/doxygen/examples/H5Pset_object_flush_cb.c @@ -0,0 +1,41 @@ +hid_t file_id, fapl_id; +hid_t dataset_id, dapl_id; +unsigned counter; + +/* Create a copy of the file access property list */ +fapl_id = H5Pcreate(H5P_FILE_ACCESS); + +/* Set up the object flush property values */ +/* flush_cb: callback function to invoke when an object flushes (see below) */ +/* counter: user data to pass along to the callback function */ +H5Pset_object_flush_cb(fapl_id, flush_cb, &counter); + +/* Open the file */ +file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + +/* Create a group */ +gid = H5Gcreate2(fid, “group”, H5P_DEFAULT, H5P_DEFAULT_H5P_DEFAULT); + +/* Open a dataset */ +dataset_id = H5Dopen2(file_id, DATASET, H5P_DEFAULT); + +/* The flush will invoke flush_cb() with counter */ +H5Dflush(dataset_id); +/* counter will be equal to 1 */ + +/* ... */ + +/* The flush will invoke flush_cb() with counter */ +H5Gflush(gid); +/* counter will be equal to 2 */ + +/* ... */ + +/* The callback function for object flush property */ +static herr_t +flush_cb(hid_t obj_id, void *_udata) +{ + unsigned *flush_ct = (unsigned *)_udata; + ++(*flush_ct); + return 0; +} diff --git a/doxygen/examples/ImageSpec.html b/doxygen/examples/ImageSpec.html new file mode 100644 index 0000000..1b700ff --- /dev/null +++ b/doxygen/examples/ImageSpec.html @@ -0,0 +1,1203 @@ + + + + + + Image Specification + +The HDF5 specification defines the standard objects and storage for the +standard HDF5 objects. (For information about the HDF5 library, model and +specification, see the HDF documentation.)  This document is an additional +specification do define a standard profile for how to store image data +in HDF5. Image data in HDF5 is stored as HDF5 datasets with standard attributes +to define the properties of the image. +

This specification is primarily concerned with two dimensional raster +data similar to HDF4 Raster Images.  Specifications for storing other +types of imagery will be covered in other documents. +

This specification defines: +

    +
  • +Standard storage and attributes for an Image dataset (Section +1)
  • + +
  • +Standard storage and attributes for Palettes (Section +2)
  • + +
  • +Standard for associating Palettes with Images. (Section +3)
  • +
+ +

+1. HDF5 Image Specification

+ +

+1.1 Overview

+Image data is stored as an HDF5 dataset with values of HDF5 class Integer +or Float.  A common example would be a two dimensional dataset, with +elements of class Integer, e.g., a two dimensional array of unsigned 8 +bit integers.  However, this specification does not limit the dimensions +or number type that may be used for an Image. +

The dataset for an image is distinguished from other datasets by giving +it an attribute "CLASS=IMAGE".  In addition, the Image dataset may +have an optional attribute "PALETTE" that is an array of object references +for zero or more palettes. The Image dataset may have additional attributes +to describe the image data, as defined in Section 1.2. +

A Palette is an HDF5 dataset which contains color map information.  +A Pallet dataset has an attribute "CLASS=PALETTE" and other attributes +indicating the type and size of the palette, as defined in Section +2.1.  A Palette is an independent object, which can be shared +among several Image datasets. +

+1.2  Image Attributes

+The attributes for the Image are scalars unless otherwise noted.  +The length of String valued attributes should be at least the number of +characters. Optionally, String valued attributes may be stored in a String +longer than the minimum, in which case it must be zero terminated or null +padded.  "Required" attributes must always be used. "Optional" attributes +must be used when required. +
  +

+Attributes

+ +
+
+Attribute name="CLASS" (Required)
+ +
+This attribute is type H5T_C_S1, with size 5.
+ +
+For all Images, the value of this attribute is "IMAGE".
+ +
+
+ +
+This attribute identifies this data set as intended to be interpreted as +an image that conforms to the specifications on this page.
+
+ +
+Attribute name="PALETTE"
+ +
+
+A Image dataset within an HDF5 file may optionally specify an array of +palettes to be viewed with. The dataset will have an attribute field called +"PALETTE" which contains a one-dimensional array of object reference +pointers (HDF5 datatype H5T_STD_REF_OBJ) which refer to palettes in the +file. The palette datasets must conform to the Palette specification in +section +2 below. The first palette in this array will be the default palette +that the data may be viewed with.
+
+ +
+
+
+ +
+Attribute name="IMAGE_SUBCLASS"
+ +
+If present, the value of this attribute indicates the type of Palette that +should be used with the Image.  This attribute is a scalar of type +H5T_C_S1, with size according to the string plus one.  The values +are:
+ +
+
+"IMAGE_GRAYSCALE" (length 15)
+ +
+A grayscale image
+ +
+"IMAGE_BITMAP" (length 12)
+ +
+A bit map image
+ +
+"IMAGE_TRUECOLOR" (length 15)
+ +
+A truecolor image
+ +
+"IMAGE_INDEXED" (length 13)
+ +
+An indexed image
+ +
+
+
+ +
+Attribute name="INTERLACE_MODE"
+ +
+For images with more than one component for each pixel, this optional attribute +specifies the layout of the data. The values are type H5T_C_S1 of length +15. See section 1.3 for information about the +storage layout for data.
+ +
+"INTERLACE_PIXEL" (default): the component value for a pixel are contiguous.
+ +
+"INTERLACE_PLANE": each component is stored as a plane.
+ +
+
+ +
+Attribute name="DISPLAY_ORIGIN"
+ +
+This optional attribute indicates the intended orientation of the data +on a two-dimensional raster display.  The value indicates which corner +the pixel at (0, 0) should be viewed.  The values are type H5T_C_S1 +of length 2. If DISPLAY_ORIGIN is not set, the orientation is undefined.
+ +
+"UL": (0,0) is at the upper left.
+ +
+"LL": (0,0) is at the lower left.
+ +
+"UR": (0,0) is at the upper right.
+ +
+"LR": (0,0) is at the lower right.
+
+ +
+Attribute name="IMAGE_WHITE_IS_ZERO"
+ +
+
+This attribute is of type H5T_NATIVE_UCHAR.  0 = false, 1 = true .  +This is used for images with IMAGE_SUBCLASS="IMAGE_GRAYSCALE" or "IMAGE_BITMAP".
+
+ +
+
+Attribute name="IMAGE_MINMAXRANGE"
+ +
+If present, this attribute is an array of two numbers, of the same HDF5 +datatype as the data.  The first element is the minimum value of the +data, and the second is the maximum.  This is used for images with +IMAGE_SUBCLASS="IMAGE_GRAYSCALE", "IMAGE_BITMAP" or "IMAGE_INDEXED".
+
+ +
+Attribute name="IMAGE_BACKGROUNDINDEX"
+ +
+
+If set, this attribute indicates the index value that should be interpreted +as the "background color".  This attribute is HDF5 type H5T_NATIVE_UINT.
+
+ +
+Attribute name="IMAGE_TRANSPARENCY"
+ +
+
+If set, this attribute indicates the index value that should be interpreted +as the "transparent color".  This attribute is HDF5 type H5T_NATIVE_UINT.  +This attribute may not be used for IMAGE_SUBCLASS="IMAGE_TRUE_COLOR".
+
+ +
+Attribute name="IMAGE_ASPECTRATIO"
+ +
+
+If set, this attribute indicates the aspect ratio.
+
+ +
+Attribute name="IMAGE_COLORMODEL"
+ +
+
+If set, this attribute indicates the color model of Palette that should +be used with the Image.  This attribute is of type H5T_C_S1, with +size 3, 4, or 5.  The value is one of the color models described in +the Palette specification in section 2.2 below.  +This attribute may be used only for IMAGE_SUBCLASS="IMAGE_TRUECOLOR" or +"IMAGE_INDEXED".
+
+ +
+Attribute name="IMAGE_GAMMACORRECTION"
+ +
+
+If set, this attribute gives the Gamma correction.  The attribute +is type H5T_NATIVE_FLOAT.  This attribute may be used only for IMAGE_SUBCLASS="IMAGE_TRUECOLOR" +or "IMAGE_INDEXED".
+
+Attribute name="IMAGE_VERSION" (Required) +
+
+This attribute is of type H5T_C_S1, with size corresponding to the length +of the version string.  This attribute identifies the version number +of this specification to which it conforms.  The current version number +is "1.2".
+ +
  +

  +
  +
  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 1. Attributes of an Image Dataset
Attribute Name(R = Required +
O= Optional)
TypeString SizeValue
CLASSRString5"IMAGE"
PALETTEOArray Object References<references to Palette datasets>1
IMAGE_SUBCLASSO2String15,  +
12,  +
15, +
13
+
+"IMAGE_GRAYSCALE",
+ +
+"IMAGE_BITMAP",
+ +
+"IMAGE_TRUECOLOR",
+ +
+"IMAGE_INDEXED"
+
INTERLACE_MODEO3,6String15The layout of components if more than one component per pixel.
DISPLAY_ORIGINOString2If set, indicates the intended location of the pixel (0,0).
IMAGE_WHITE_IS_ZEROO3,4Unsigned Integer0 = false, 1 = true
IMAGE_MINMAXRANGEO3,5Array [2] <same datatype as data values>The (<minimum>, <maximum>) value of the data.
IMAGE_BACKGROUNDINDEXO3Unsigned IntegerThe index of the background color.
IMAGE_TRANSPARENCYO3,5Unsigned IntegerThe index of the transparent color.
IMAGE_ASPECTRATIOO3,4Unsigned IntegerThe aspect ratio.
IMAGE_COLORMODELO3,6String3, 4, or 5The color model, as defined below in the Palette specification for +attribute PAL_COLORMODEL.
IMAGE_GAMMACORRECTIONO3,6FloatThe gamma correction.
IMAGE_VERSIONRString3"1.2"
+ +
1.  The first element of the array is the default +Palette. +
2.  This attribute is required for images +that use one of the standard color map types listed. +
3. This attribute is required if set for the source +image, in the case that the image is translated from another file into +HDF5. +
4.  This applies to:  IMAGE_SUBCLASS="IMAGE_GRAYSCALE" +or "IMAGE_BITMAP". +
5.  This applies to:  IMAGE_SUBCLASS="IMAGE_GRAYSCALE", +"IMAGE_BITMAP", or "IMAGE_INDEXED". +
6.  This applies to: IMAGE_SUBCLASS="IMAGE_TRUECOLOR", +or "IMAGE_INDEXED".
+
+Table 2 summarizes the standard attributes for an Image datasets using +the common sub-classes. R means that the attribute listed on the leftmost +column is Required for the image subclass on the first row, O means that +the attribute is Optional for that subclass and N that the attribute cannot +be applied to that subclass. The two first rows show the only required +attributes +for all subclasses. +
  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 2a. Applicability of Attributes to IMAGE sub-classes
IMAGE_SUBCLASS1IMAGE_GRAYSCALEIMAGE_BITMAP
CLASSRR
IMAGE_VERSIONRR
INTERLACE_MODENN
IMAGE_WHITE_IS_ZERORR
IMAGE_MINMAXRANGEOO
IMAGE_BACKGROUNDINDEXOO
IMAGE_TRANSPARENCYOO
IMAGE_ASPECTRATIOOO
IMAGE_COLORMODELNN
IMAGE_GAMMACORRECTIONNN
PALETTEOO
DISPLAY_ORIGINOO
+ +
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 2b. Applicability of Attributes to IMAGE sub-classes
IMAGE_SUBCLASSIMAGE_TRUECOLORIMAGE_INDEXED
CLASSRR
IMAGE_VERSIONRR
INTERLACE_MODERN
IMAGE_WHITE_IS_ZERONN
IMAGE_MINMAXRANGENO
IMAGE_BACKGROUNDINDEXNO
IMAGE_TRANSPARENCYNO
IMAGE_ASPECTRATIOOO
IMAGE_COLORMODELOO
IMAGE_GAMMACORRECTIONOO
PALETTEOO
DISPLAY_ORIGINOO
+ +

+1.3 Storage Layout and Properties for Images

+In the case of an image with more than one component per pixel (e.g., Red, +Green, and Blue), the data may be arranged in one of two ways.  Following +HDF4 terminology, the data may be interlaced by pixel or by plane, which +should be indicated by the INTERLACE_MODE  attribute.  In both +cases, the dataset will have a dataspace with three dimensions, height, +width, and components.  The interlace modes specify different orders +for the dimensions. +
  + + + + + + + + + + + + + + + + + + + + +
Table 3. Storage of multiple component image data.
Interlace ModeDimensions in the Dataspace
INTERLACE_PIXEL[height][width][pixel components]
INTERLACE_PLANE[pixel components][height][width]
+ +

For example, consider a 5 (rows) by 10 (column) image, with Red, Green, +and Blue components.  Each component is an unsigned byte. In HDF5, +the datatype would be declared as an unsigned 8 bit integer.  For +pixel interlace, the dataspace would be a three dimensional array, with +dimensions: [10][5][3].  For plane interleave, the dataspace would +be three dimensions: [3][10][5]. +

In the case of images with only one component, the dataspace may be +either a two dimensional array, or a three dimensional array with the third +dimension of size 1.  For example, a 5 by 10 image with 8 bit color +indexes would be an HDF5 dataset with type unsigned 8 bit integer.  +The dataspace could be either a two dimensional array, with dimensions +[10][5], or three dimensions, with dimensions either [10][5][1] or [1][10][5]. +

Image datasets may be stored with any chunking or compression properties +supported by HDF5. +

A note concerning compatibility with HDF5 GR interface: An Image +dataset is stored as an HDF5 dataset.  It is important to note that +the order of the dimensions is the same as for any other HDF5 dataset.  +For a two dimensional image that is to be stored as a series of horizontal +scan lines, with the scan lines contiguous (i.e., the fastest changing +dimension is 'width'), the image will have a dataspace with dim[0] = +height and dim[1] = width.  This is completely consistent +with all other HDF5 datasets. +

Users familiar with HDF4 should be cautioned that this is not the +same as HDF4, and specifically is not consistent with what the HDF4 +GR interface does. +
  +

+2.  HDF5 Palette Specification

+ +

+2.1 Overview

+A palette is the means by which color is applied to an image and is also +referred to as a color lookup table. It is a table in which every row contains +the numerical representation of a particular color. In the example of an +8 bit standard RGB color model palette, this numerical representation of +a color is presented as a triplet specifying the intensity of red, green, +and blue components that make up each color. +
+

+ +

In this example, the color component numeric type is an 8 bit unsigned +integer. While this is most common and recommended for general use, other +component color numeric datatypes, such as a 16 bit unsigned integer , +may be used. This type is specified as the type attribute of the palette +dataset. (see H5Tget_type(), H5Tset_type()) +

The minimum and maximum values of the component color numeric are specified +as attribute of the palette dataset. See below (attribute PAL_MINMAXNUMERIC). +If these attributes do not exist, it is assumed that the range of values +will fill the space of the color numeric type. i.e. with an 8 bit unsigned +integer, the valid range would be 0 to 255 for each color component. +

The HDF5 palette specification additionally allows for color models +beyond RGB. YUV, HSV, CMY, CMYK, YCbCr color models are supported, and +may be specified as a color model attribute of the palette dataset. (see +"Palette Attributes" for details). +

In HDF 4 and earlier, palettes were limited to 256 colors. The HDF5 +palette specification allows for palettes of varying length. The length +is specified as the number of rows of the palette dataset. +
  +
  + + + + +
Important Note: The specification of the Indexed +Palette will change substantially in the next version.  The Palette +described here is denigrated and is not supported.
+ +
  + + + + +
Denigrated +

In a standard palette, the color entries are indexed directly. HDF5 +supports the notion of a range index table. Such a table defines an ascending +ordered list of ranges that map dataset values to the palette. If a range +index table exists for the palette, the PAL_TYPE attribute will be set +to "RANGEINDEX", and the PAL_RANGEINDEX attribute will contain an object +reference to a range index table array. If not, the PAL_TYPE attribute +either does not exist, or will be set to "STANDARD". +

The range index table array consists of a one dimensional array with +the same length as the palette dataset - 1. Ideally, the range index would +be of the same type as the dataset it refers to, however this is not a +requirement. +

Example 2: A range index array of type floating point +

+

+ +

The range index array attribute defines the "to" of the range. +Notice that the range index array attribute is one less entry in size than +the palette. The first entry of 0.1259, specifies that all values below +and up to 0.1259 inclusive, will map to the first palette entry. The second +entry signifies that all values greater than 0.1259 up to 0.3278 inclusive, +will map to the second palette entry, etc. All value greater than the last +range index array attribute (100000) map to the last entry in the palette.

+ +

+2.2. Palette Attributes

+A palette exists in an HDF file as an independent data set with accompanying +attributes.  The Palette attributes are scalars except where noted +otherwise.  String values should have size the length of the string +value plus one.  "Required" attributes must be used.  "Optional" +attributes must be used when required. +

These attributes are defined as follows: +

+
+Attribute name="CLASS" (Required)
+ +
+This attribute is of type H5T_C_S1, with size 7.
+ +
+For all palettes, the value of this attribute is "PALETTE". This attribute +identifies this palette data set as a palette that conforms to the specifications +on this page.
+ +
+Attribute name="PAL_COLORMODEL" (Required)
+ +
+This attribute is of type H5T_C_S1, with size 3, 4, or 5.
+ +
+Possible values for this are "RGB", "YUV", "CMY", "CMYK", "YCbCr", "HSV".
+ +
+This defines the color model that the entries in the palette data set represent.
+ +
+
+"RGB"
+ +
+Each color index contains a triplet where the the first value defines the +red component, second defines the green component, and the third the blue +component.
+ +
+"CMY"
+ +
+Each color index contains a triplet where the the first value defines the +cyan component, second defines the magenta component, and the third the +yellow component.
+ +
+"CMYK"
+ +
+Each color index contains a quadruplet where the the first value defines +the cyan component, second defines the magenta component, the third the +yellow component, and the forth the black component.
+ +
+"YCbCr"
+ +
+Class Y encoding model. Each color index contains a triplet where the the +first value defines the luminance, second defines the Cb Chromonance, and +the third the Cr Chromonance.
+ +
+"YUV"
+ +
+Composite encoding color model. Each color index contains a triplet where +the the first value defines the luminance component, second defines the +chromonance component, and the third the value component.
+ +
+"HSV"
+ +
+Each color index contains a triplet where the the first value defines the +hue component, second defines the saturation component, and the third the +value component. The hue component defines the hue spectrum with a low +value representing magenta/red progressing to a high value which would +represent blue/magenta, passing through yellow, green, cyan. A low value +for the saturation component means less color saturation than a high value. +A low value for value will be darker than a high value.
+ +
+
+
+ +
+Attribute name="PAL_TYPE" (Required)
+ +
+This attribute is of type H5T_C_S1, with size 9 or 10.
+ +
+The current supported values for this attribute are : "STANDARD8" or "RANGEINDEX"
+ +
+A PAL_TYPE of "STANDARD8" defines a palette dataset such that the first +entry defines index 0, the second entry defines index 1, etc. up until +the length of the palette - 1. This assumes an image dataset with direct +indexes into the palette.
+
+ +
  + + + + +
Denigrated +

If the PAL_TYPE is set to "RANGEINDEX", there will be an additional +attribute with a name of "PAL_RANGEINDEX",  (See example 2 +for more details)

+ + + + + +
+
+Attribute name="PAL_RANGEINDEX"   (Denigrated)
+ +
+
+The PAL_RANGEINDEX attribute contains an HDF object reference (HDF5 +datatype H5T_STD_REF_OBJ) pointer which specifies a range index array in +the file to be used for color lookups for the palette.  (Only for +PAL_TYPE="RANGEINDEX")
+
+
+ +
+Attribute name="PAL_MINMAXNUMERIC"
+ +
+
+If present, this attribute is an array of two numbers, of the same HDF5 +datatype as the palette elements or color numerics.
+ +
They specify the minimum and maximum values of the color numeric components. +For example, if the palette was an RGB of type Float, the color numeric +range for Red, Green, and Blue could be set to be between 0.0 and 1.0. +The intensity of the color guns would then be scaled accordingly to be +between this minimum and maximum attribute.
+Attribute name="PAL_VERSION"  (Required) +
This attribute is of type H5T_C_S1, with size corresponding to the +length of the version string.  This attribute identifies the version +number of this specification to which it conforms.  The current version +is "1.2".
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 4. Attributes of a Palette Dataset
Attribute Name(R = Required, +
O = Optional)
TypeString SizeValue
CLASSRString +
7
+
"PALETTE"
PAL_COLORMODELRString +
3, 4, or 5
+
Color Model:  "RGB", YUV", "CMY", "CMYK", "YCbCr", or "HSV"
PAL_TYPERString +
9
+ +


+ + + + +
or 10
+

"STANDARD8"  + + + + +
or "RANGEINDEX" (Denigrated)
+
+ + + + +
Denigrated +
RANGE_INDEX
+
+ + + + +
Object Reference 
+
+ + + + +
<Object Reference to Dataset of range index values>
+
PAL_MINMAXNUMERICOArray[2] of <same datatype as palette>The first value is the <Minimum value for color values>, the second +value is <Maximum value for color values>2
PAL_VERSIONRString4"1.2"
+ +
  + + + + +
1.  The RANGE_INDEX attribute is required if the +PAL_TYPE is "RANGEINDEX".  Otherwise, the RANGE_INDEX attribute should +be omitted. (Range index is denigrated.)
+2.  The minimum and maximum are optional.  If not +set, the range is assumed to the maximum range of the number type.  +If one of these attributes is set, then both should be set.  The value +of the minimum must be less than or equal to the value of the maximum.
+
+Table 5 summarized the uses of the standard attributes for a palette dataset. +R means that the attribute listed on the leftmost column is Required for +the palette type on the first row, O means that the attribute is Optional +for that type and N that the attribute cannot be applied to that type. +The four first rows show the attributes that are always required  +for the two palette types. +
  +
  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 5. Applicability of Attributes
PAL_TYPESTANDARD8RANGEINDEX
CLASSRR
PAL_VERSIONRR
PAL_COLORMODELRR
RANGE_INDEXNR
PAL_MINMAXNUMERICOO
+ +

+2.3. Storage Layout for Palettes

+The values of the Palette are stored as a dataset.  The datatype can +be any HDF 5 atomic numeric type.  The dataset will have dimensions +(nentries  by  ncomponents), where 'nentries' +is the number of colors (usually 256) and 'ncomponents' is the +number of values per color (3 for RGB, 4 for CMYK, etc.) +
  +

+3.  Consistency and Correlation of Image and Palette +Attributes

+The objects in this specification are an extension to the base HDF5 specification +and library.  They are accessible with the standard HDF5 library, +but the semantics of the objects are not enforced by the base library.  +For example, it is perfectly possible to add an attribute called IMAGE +to any dataset, or to include an object reference to any +HDF5 dataset in a PALETTE attribute.  This would be a valid +HDF5 file, but not conformant to this specification.  The rules defined +in this specification must be implemented with appropriate software, and +applications must use conforming software to assure correctness. +

The Image and Palette specifications include several redundant standard +attributes, such as the IMAGE_COLORMODEL and the PAL_COLORMODEL.  +These attributes are informative not normative, in that it is acceptable +to attach a Palette to an Image dataset even if their attributes do not +match.  Software is not required to enforce consistency, and files +may contain mismatched associations of Images and Palettes.  In all +cases, it is up to applications to determine what kinds of images and color +models can be supported. +

For example, an Image that was created from a file with an "RGB" may +have a "YUV" Palette in its PALETTE attribute array.  This +would be a legal HDF5 file and also conforms to this specification, although +it may or may not be correct for a given application.

+ + + diff --git a/doxygen/examples/PaletteExample1.gif b/doxygen/examples/PaletteExample1.gif new file mode 100644 index 0000000..8694d9d Binary files /dev/null and b/doxygen/examples/PaletteExample1.gif differ diff --git a/doxygen/examples/Palettes.fm.anc.gif b/doxygen/examples/Palettes.fm.anc.gif new file mode 100644 index 0000000..d344c03 Binary files /dev/null and b/doxygen/examples/Palettes.fm.anc.gif differ diff --git a/doxygen/examples/TableSpec.html b/doxygen/examples/TableSpec.html new file mode 100644 index 0000000..474176e --- /dev/null +++ b/doxygen/examples/TableSpec.html @@ -0,0 +1,193 @@ + + + HDF5 Table Specification + + +The HDF5 specification defines the standard objects and storage for the +standard HDF5 objects. (For information about the HDF5 library, model and +specification, see the HDF documentation.)  This document is an additional +specification do define a standard profile for how to store tables in HDF5. +Table data in HDF5 is stored as HDF5 datasets with standard attributes to define +the properties of the tables. + +

+1. Overview

+A generic table is a sequence of records, each record has a name and a type. +Table data is stored as an HDF5 one dimensional compound dataset.  A table +is defined as a collection of records whose values are stored in fixed-length +fields. All records have the same structure and all values in each field have +the same data type. +

The dataset for a table is distinguished from other datasets by giving +it an attribute "CLASS=TABLE".   +Optional attributes allow the storage of a title for the Table and for +each column, and a fill value for each column. +

+2.  Table Attributes

+The attributes for the Table are strings. They are written with the H5LTset_attribute_string +Lite API function.  "Required" attributes must always be used. "Optional" attributes +must be used when required. +
  +

+Attributes

+ +
+
+Attribute name="CLASS" (Required)
+ +
+This attribute is type H5T_C_S1, with size 5.
+ +
+For all Tables, the value of this attribute is "TABLE".
+ +
+This attribute identifies this data set as intended to be interpreted as Table that conforms to the specifications on this page.
+
+ +
+Attribute name="VERSION" (Required) + +
+This attribute is of type H5T_C_S1, with size corresponding to the length +of the version string.  This attribute identifies the version number +of this specification to which it conforms.  The current version number +is "0.2".
+ +
+ +
+
+Attribute name="TITLE" (Optional)
+ +
+The TITLE is an optional String that is to be used as the +informative title of the whole table. +The TITLE is set with the parameter table_title of the function + H5TBmake_table
+
+ +
+
+Attribute name="FIELD_(n)_NAME" (Required)
+ +
+The FIELD_(n)_NAME is an optional String that is to be used as the +informative title of column n of the table. +For each of the fields the word FIELD_ is concatenated with + the zero based field (n) index together with the name of the field.
+ +
+
+
+Attribute name="FIELD_(n)_FILL" (Optional)
+ +
+The FIELD_(n)_FILL is an optional String that is the fill value for +column n of the table. +For each of the fields the word FIELD_ is concatenated with + the zero based field (n) index together with the fill value, if present. +This value is written only when a fill value is defined for the table.
+ +
+ +
+ +
  +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 1. Attributes of an Image Dataset
Attribute Name(R = Required +
O= Optional)
TypeString SizeValue
CLASSRString5"TABLE"
VERSIONRString3"0.2"
TITLEOString  + +
FIELD_(n)_NAMERString  +  + +
FIELD_(n)_FILLO*String  +  +
+
+ +
+

+

+  +
+* The attribute FIELD_(n)_FILL is written to the table if a fill value is +specified on the creation of the Table. Otherwise, it is not.

The following +section of code shows the calls necessary to the creation of a table. + +

/* Create a new HDF5 file using default properties. */
+ file_id = H5Fcreate( "my_table.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );

+ +

/* Call the make table function */
+
H5TBmake_table( "Table Title", file_id, "Table1", NFIELDS, NRECORDS, dst_size, 
+ field_names, dst_offset, field_type, 
+ chunk_size, fill_data, compress, p_data ) 

+ +

/* Close the file. */
+ status = H5Fclose( file_id );

+ + diff --git a/doxygen/examples/ThreadSafeLibrary.html b/doxygen/examples/ThreadSafeLibrary.html new file mode 100644 index 0000000..8daf386 --- /dev/null +++ b/doxygen/examples/ThreadSafeLibrary.html @@ -0,0 +1,787 @@ + + + + Thread Safe Library + + +

1. Library header files and conditional compilation

+ +

+The following code is placed at the beginning of H5private.h: +

+ +
+
+  #ifdef H5_HAVE_THREADSAFE
+  #include <pthread.h>
+  #endif
+  
+
+ +

+H5_HAVE_THREADSAFE is defined when the HDF-5 library is +compiled with the --enable-threadsafe configuration option. In general, +code for the non-threadsafe version of HDF-5 library are placed within +the #else part of the conditional compilation. The exception +to this rule are the changes to the FUNC_ENTER (in +H5private.h), HRETURN and HRETURN_ERROR (in +H5Eprivate.h) macros (see section 3.2). +

+ + +

2. Global variables/structures

+ +

2.1 Global library initialization variable

+ +

+In the threadsafe implementation, the global library initialization +variable H5_libinit_g is changed to a global structure +consisting of the variable with its associated lock (locks are explained +in section 4.1): +

+ +
+
+    hbool_t  H5_libinit_g = FALSE;
+  
+
+ +

+becomes +

+ +
+
+    H5_api_t H5_g;
+  
+
+ +

+where H5_api_t is +

+ +
+
+    typedef struct H5_api_struct {
+      H5_mutex_t init_lock;           /* API entrance mutex */
+      hbool_t H5_libinit_g;
+    } H5_api_t;
+  
+
+ +

+All former references to H5_libinit_g in the library are now +made using the macro H5_INIT_GLOBAL. If the threadsafe +library is to be used, the macro is set to H5_g.H5_libinit_g +instead. +

+ +

2.2 Global serialization variable

+ +

+A new global boolean variable H5_allow_concurrent_g is used +to determine if multiple threads are allowed to an API call +simultaneously. This is set to FALSE. +

+ +

+All APIs that are allowed to do so have their own local variable that +shadows the global variable and is set to TRUE. In phase 1, +no such APIs exist. +

+ +

+It is defined in H5.c as follows: +

+ +
+
+    hbool_t H5_allow_concurrent_g = FALSE;
+  
+
+ +

2.3 Global thread initialization variable

+ +

+The global variable H5_first_init_g of type +pthread_once_t is used to allow only the first thread in the +application process to call an initialization function using +pthread_once. All subsequent calls to +pthread_once by any thread are disregarded. +

+ +

+The call sets up the mutex in the global structure H5_g (see +section 3.1) via an initialization function +H5_first_thread_init. The first thread initialization +function is described in section 4.2. +

+ +

+H5_first_init_g is defined in H5.c as follows: +

+ +
+
+    pthread_once_t H5_first_init_g = PTHREAD_ONCE_INIT;
+  
+
+ +

2.4 Global key for per-thread error stacks

+ +

+A global pthread-managed key H5_errstk_key_g is used to +allow pthreads to maintain a separate error stack (of type +H5E_t) for each thread. This is defined in H5.c +as: +

+ +
+
+    pthread_key_t H5_errstk_key_g;
+  
+
+ +

+Error stack management is described in section 4.3. +

+ +

2.5 Global structure and key for thread cancellation prevention

+ +

+We need to preserve the thread cancellation status of each thread +individually by using a key H5_cancel_key_g. The status is +preserved using a structure (of type H5_cancel_t) which +maintains the cancellability state of the thread before it entered the +library and a count (which works very much like the recursive lock +counter) which keeps track of the number of API calls the thread makes +within the library. +

+ +

+The structure is defined in H5private.h as: +

+ +
+
+    /* cancelability structure */
+    typedef struct H5_cancel_struct {
+      int previous_state;
+      unsigned int cancel_count;
+    } H5_cancel_t;
+  
+
+ +

+Thread cancellation is described in section 4.4. +

+ + +

3. Changes to Macro expansions

+ +

3.1 Changes to FUNC_ENTER

+ +

+The FUNC_ENTER macro is now extended to include macro calls +to initialize first threads, disable cancellability and wraps a lock +operation around the checking of the global initialization flag. It +should be noted that the cancellability should be disabled before +acquiring the lock on the library. Doing so otherwise would allow the +possibility that the thread be cancelled just after it has acquired the +lock on the library and in that scenario, if the cleanup routines are not +properly set, the library would be permanently locked out. +

+ +

+The additional macro code and new macro definitions can be found in +Appendix E.1 to E.5. The changes are made in H5private.h. +

+ +

3.2 Changes to HRETURN and HRETURN_ERROR

+ +

+The HRETURN and HRETURN_ERROR macros are the +counterparts to the FUNC_ENTER macro described in section +3.1. FUNC_LEAVE makes a macro call to HRETURN, +so it is also covered here. +

+ +

+The basic changes to these two macros involve adding macro calls to call +an unlock operation and re-enable cancellability if necessary. It should +be noted that the cancellability should be re-enabled only after the +thread has released the lock to the library. The consequence of doing +otherwise would be similar to that described in section 3.1. +

+ +

+The additional macro code and new macro definitions can be found in +Appendix E.9 to E.9. The changes are made in H5Eprivate.h. +

+ +

4. Implementation of threadsafe functionality

+ +

4.1 Recursive Locks

+ +

+A recursive mutex lock m allows a thread t1 to successfully lock m more +than once without blocking t1. Another thread t2 will block if t2 tries +to lock m while t1 holds the lock to m. If t1 makes k lock calls on m, +then it also needs to make k unlock calls on m before it releases the +lock. +

+ +

+Our implementation of recursive locks is built on top of a pthread mutex +lock (which is not recursive). It makes use of a pthread condition +variable to have unsuccessful threads wait on the mutex. Waiting threads +are awaken by a signal from the final unlock call made by the thread +holding the lock. +

+ +

+Recursive locks are defined to be the following type +(H5private.h): +

+ +
+
+    typedef struct H5_mutex_struct {
+      pthread_t owner_thread;         /* current lock owner */
+      pthread_mutex_t atomic_lock;    /* lock for atomicity of new mechanism */
+      pthread_cond_t cond_var;        /* condition variable */
+      unsigned int lock_count;
+    } H5_mutex_t;
+  
+
+ +

+Detailed implementation code can be found in Appendix A. The +implementation changes are made in H5TS.c. +

+ +

4.2 First thread initialization

+ +

+Because the mutex lock associated with a recursive lock cannot be +statically initialized, a mechanism is required to initialize the +recursive lock associated with H5_g so that it can be used +for the first time. +

+ +

+The pthreads library allows this through the pthread_once call which as +described in section 3.3 allows only the first thread accessing the +library in an application to initialize H5_g. +

+ +

+In addition to initializing H5_g, it also initializes the +key (see section 3.4) for use with per-thread error stacks (see section +4.3). +

+ +

+The first thread initialization mechanism is implemented as the function +call H5_first_thread_init() in H5TS.c. This is +described in appendix B. +

+ +

4.3 Per-thread error stack management

+ +

+Pthreads allows individual threads to access dynamic and persistent +per-thread data through the use of keys. Each key is associated with +a table that maps threads to data items. Keys can be initialized by +pthread_key_create() in pthreads (see sections 3.4 and 4.2). +Per-thread data items are accessed using a key through the +pthread_getspecific() and pthread_setspecific() +calls to read and write to the association table respectively. +

+ +

+Per-thread error stacks are accessed through the key +H5_errstk_key_g which is initialized by the first thread +initialization call (see section 4.2). +

+ +

+In the non-threadsafe version of the library, there is a global stack +variable H5E_stack_g[1] which is no longer defined in the +threadsafe version. At the same time, the macro call to gain access to +the error stack H5E_get_my_stack is changed from: +

+ +
+
+    #define H5E_get_my_stack() (H5E_stack_g+0)
+  
+
+ +

+to: +

+ +
+
+    #define H5E_get_my_stack() H5E_get_stack()
+  
+
+ +

+where H5E_get_stack() is a surrogate function that does the +following operations: +

+ +
    +
  1. if a thread is attempting to get an error stack for the first + time, the error stack is dynamically allocated for the thread and + associated with H5_errstk_key_g using + pthread_setspecific(). The way we detect if it is the + first time is through pthread_getspecific() which + returns NULL if no previous value is associated with + the thread using the key.
  2. + +
  3. if pthread_getspecific() returns a non-null value, + then that is the pointer to the error stack associated with the + thread and the stack can be used as usual.
  4. +
+ +

+A final change to the error reporting routines is as follows; the current +implementation reports errors to always be detected at thread 0. In the +threadsafe implementation, this is changed to report the number returned +by a call to pthread_self(). +

+ +

+The change in code (reflected in H5Eprint of file +H5E.c) is as follows: +

+ +
+
+    #ifdef H5_HAVE_THREADSAFE
+      fprintf (stream, "HDF5-DIAG: Error detected in thread %d."
+               ,pthread_self());
+    #else
+      fprintf (stream, "HDF5-DIAG: Error detected in thread 0.");
+    #endif
+  
+
+ +

+Code for H5E_get_stack() can be found in Appendix C. All the +above changes were made in H5E.c. +

+ +

4.4 Thread Cancellation safety

+ +

+To prevent thread cancellations from killing a thread while it is in the +library, we maintain per-thread information about the cancellability +status of the thread before it entered the library so that we can restore +that same status when the thread leaves the library. +

+ +

+By enter and leave the library, we mean the points when a +thread makes an API call from a user application and the time that API +call returns. Other API or callback function calls made from within that +API call are considered within the library. +

+ +

+Because other API calls may be made from within the first API call, we +need to maintain a counter to determine which was the first and +correspondingly the last return. +

+ +

+When a thread makes an API call, the macro H5_API_SET_CANCEL +calls the worker function H5_cancel_count_inc() which does +the following: +

+ +
    +
  1. if this is the first time the thread has entered the library, + a new cancellability structure needs to be assigned to it.
  2. +
  3. if the thread is already within the library when the API call is + made, then cancel_count is simply incremented. Otherwise, we set + the cancellability state to PTHREAD_CANCEL_DISABLE + while storing the previous state into the cancellability structure. + cancel_count is also incremented in this case.
  4. +
+ +

+When a thread leaves an API call, the macro +H5_API_UNSET_CANCEL calls the worker function +H5_cancel_count_dec() which does the following: +

+ +
    +
  1. if cancel_count is greater than 1, indicating that the + thread is not yet about to leave the library, then + cancel_count is simply decremented.
  2. +
  3. otherwise, we reset the cancellability state back to its original + state before it entered the library and decrement the count (back + to zero).
  4. +
+ +

+H5_cancel_count_inc and H5_cancel_count_dec are +described in Appendix D and may be found in H5TS.c. +

+ +

5. Test programs

+ +

+Except where stated, all tests involve 16 simultaneous threads that make +use of HDF-5 API calls without any explicit synchronization typically +required in a non-threadsafe environment. +

+ +

5.1 Data set create and write

+ +

+The test program sets up 16 threads to simultaneously create 16 +different datasets named from zero to fifteen for a single +file and then writing an integer value into that dataset equal to the +dataset's named value. +

+ +

+The main thread would join with all 16 threads and attempt to match the +resulting HDF-5 file with expected results - that each dataset contains +the correct value (0 for zero, 1 for one etc ...) and all +datasets were correctly created. +

+ +

+The test is implemented in the file ttsafe_dcreate.c. +

+ +

5.2 Test on error stack

+ +

+The error stack test is one in which 16 threads simultaneously try to +create datasets with the same name. The result, when properly serialized, +should be equivalent to 16 attempts to create the dataset with the same +name. +

+ +

+The error stack implementation runs correctly if it reports 15 instances +of the dataset name conflict error and finally generates a correct HDF-5 +containing that single dataset. Each thread should report its own stack +of errors with a thread number associated with it. +

+ +

+The test is implemented in the file ttsafe_error.c. +

+ +

5.3 Test on cancellation safety

+ +

+The main idea in thread cancellation safety is as follows; a child thread +is spawned to create and write to a dataset. Following that, it makes a +H5Diterate call on that dataset which activates a callback +function. +

+ +

+A deliberate barrier is invoked at the callback function which waits for +both the main and child thread to arrive at that point. After that +happens, the main thread proceeds to make a thread cancel call on the +child thread while the latter sleeps for 3 seconds before proceeding to +write a new value to the dataset. +

+ +

+After the iterate call, the child thread logically proceeds to wait +another 3 seconds before writing another newer value to the dataset. +

+ +

+The test is correct if the main thread manages to read the second value +at the end of the test. This means that cancellation did not take place +until the end of the iteration call despite of the 3 second wait within +the iteration callback and the extra dataset write operation. +Furthermore, the cancellation should occur before the child can proceed +to write the last value into the dataset. +

+ +

5.4 Test on attribute creation

+ +

+A main thread makes 16 threaded calls to H5Acreate with a +generated name for each attribute. Sixteen attributes should be created +for the single dataset in random (chronological) order and receive values +depending on its generated attribute name (e.g. attrib010 would +receive the value 10). +

+ +

+After joining with all child threads, the main thread proceeds to read +each attribute by generated name to see if the value tallies. Failure is +detected if the attribute name does not exist (meaning they were never +created) or if the wrong values were read back. +

+ +

A. Recursive Lock implementation code

+ +
+
+  void H5_mutex_init(H5_mutex_t *H5_mutex)
+  {
+    H5_mutex->owner_thread = NULL;
+    pthread_mutex_init(&H5_mutex->atomic_lock, NULL);
+    pthread_cond_init(&H5_mutex->cond_var, NULL);
+    H5_mutex->lock_count = 0;
+  }
+
+  void H5_mutex_lock(H5_mutex_t *H5_mutex)
+  {
+    pthread_mutex_lock(&H5_mutex->atomic_lock);
+
+    if (pthread_equal(pthread_self(), H5_mutex->owner_thread)) {
+    	/* already owned by self - increment count */
+    	H5_mutex->lock_count++;
+    } else {
+    	if (H5_mutex->owner_thread == NULL) {
+    		/* no one else has locked it - set owner and grab lock */
+    		H5_mutex->owner_thread = pthread_self();
+    		H5_mutex->lock_count = 1;
+    	} else {
+    		/* if already locked by someone else */
+    		while (1) {
+    			pthread_cond_wait(&H5_mutex->cond_var, &H5_mutex->atomic_lock);
+
+    			if (H5_mutex->owner_thread == NULL) {
+    				H5_mutex->owner_thread = pthread_self();
+    				H5_mutex->lock_count = 1;
+    				break;
+    			} /* else do nothing and loop back to wait on condition*/
+    		}
+    	}
+    }
+
+    pthread_mutex_unlock(&H5_mutex->atomic_lock);
+  }
+
+  void H5_mutex_unlock(H5_mutex_t *H5_mutex)
+  {
+    pthread_mutex_lock(&H5_mutex->atomic_lock);
+    H5_mutex->lock_count--;
+
+    if (H5_mutex->lock_count == 0) {
+    	H5_mutex->owner_thread = NULL;
+    	pthread_cond_signal(&H5_mutex->cond_var);
+    }
+    pthread_mutex_unlock(&H5_mutex->atomic_lock);
+  }
+  
+
+ +

B. First thread initialization

+ +
+
+  void H5_first_thread_init(void)
+  {
+    /* initialize global API mutex lock                      */
+    H5_g.H5_libinit_g = FALSE;
+    H5_g.init_lock.owner_thread = NULL;
+    pthread_mutex_init(&H5_g.init_lock.atomic_lock, NULL);
+    pthread_cond_init(&H5_g.init_lock.cond_var, NULL);
+    H5_g.init_lock.lock_count = 0;
+
+    /* initialize key for thread-specific error stacks       */
+    pthread_key_create(&H5_errstk_key_g, NULL);
+
+    /* initialize key for thread cancellability mechanism    */
+    pthread_key_create(&H5_cancel_key_g, NULL);
+  }
+  
+
+ + +

C. Per-thread error stack acquisition

+ +
+
+  H5E_t *H5E_get_stack(void)
+  {
+    H5E_t *estack;
+
+    if (estack = pthread_getspecific(H5_errstk_key_g)) {
+    	return estack;
+    } else {
+    	/* no associated value with current thread - create one */
+    	estack = (H5E_t *)malloc(sizeof(H5E_t));
+    	pthread_setspecific(H5_errstk_key_g, (void *)estack);
+    	return estack;
+    }
+  }
+  
+
+ +

D. Thread cancellation mechanisms

+ +
+
+  void H5_cancel_count_inc(void)
+  {
+    H5_cancel_t *cancel_counter;
+
+    if (cancel_counter = pthread_getspecific(H5_cancel_key_g)) {
+      /* do nothing here */
+    } else {
+      /*
+       * first time thread calls library - create new counter and
+       * associate with key
+       */
+      cancel_counter = (H5_cancel_t *)malloc(sizeof(H5_cancel_t));
+      cancel_counter->cancel_count = 0;
+      pthread_setspecific(H5_cancel_key_g, (void *)cancel_counter);
+    }
+
+    if (cancel_counter->cancel_count == 0) {
+      /* thread entering library */
+      pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
+                             &(cancel_counter->previous_state));
+    }
+
+    cancel_counter->cancel_count++;
+  }
+
+  void H5_cancel_count_dec(void)
+  {
+    H5_cancel_t *cancel_counter = pthread_getspecific(H5_cancel_key_g);
+
+    if (cancel_counter->cancel_count == 1)
+      pthread_setcancelstate(cancel_counter->previous_state, NULL);
+
+    cancel_counter->cancel_count--;
+  }
+  
+
+ +

E. Macro expansion codes

+ +

E.1 FUNC_ENTER

+ +
+
+  /* Initialize the library */                                \
+  H5_FIRST_THREAD_INIT                                        \
+  H5_API_UNSET_CANCEL                                         \
+  H5_API_LOCK_BEGIN                                           \
+    if (!(H5_INIT_GLOBAL)) {                                  \
+      H5_INIT_GLOBAL = TRUE;                                  \
+        if (H5_init_library() < 0) {                          \
+          HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err,         \
+                        "library initialization failed");     \
+        }                                                     \
+    }                                                         \
+    H5_API_LOCK_END                                           \
+             :
+             :
+             :
+  
+
+ +

E.2 H5_FIRST_THREAD_INIT

+ +
+
+  /* Macro for first thread initialization */
+  #define H5_FIRST_THREAD_INIT                                \
+    pthread_once(&H5_first_init_g, H5_first_thread_init);
+  
+
+ + +

E.3 H5_API_UNSET_CANCEL

+ +
+
+  #define H5_API_UNSET_CANCEL                                 \
+    if (H5_IS_API(FUNC)) {                                    \
+      H5_cancel_count_inc();                                  \
+    }
+  
+
+ + +

E.4 H5_API_LOCK_BEGIN

+ +
+
+  #define H5_API_LOCK_BEGIN                                   \
+     if (H5_IS_API(FUNC)) {                                   \
+       H5_mutex_lock(&H5_g.init_lock);
+  
+
+ + +

E.5 H5_API_LOCK_END

+ +
+
+  #define H5_API_LOCK_END }
+  
+
+ + +

E.6 HRETURN and HRETURN_ERROR

+ +
+
+            :
+            :
+    H5_API_UNLOCK_BEGIN                                       \
+    H5_API_UNLOCK_END                                         \
+    H5_API_SET_CANCEL                                         \
+    return ret_val;                                           \
+  }
+  
+
+ +

E.7 H5_API_UNLOCK_BEGIN

+ +
+
+  #define H5_API_UNLOCK_BEGIN                                 \
+    if (H5_IS_API(FUNC)) {                                    \
+      H5_mutex_unlock(&H5_g.init_lock);
+  
+
+ +

E.8 H5_API_UNLOCK_END

+ +
+
+  #define H5_API_UNLOCK_END }
+  
+
+ + +

E.9 H5_API_SET_CANCEL

+ +
+
+  #define H5_API_SET_CANCEL                                   \
+    if (H5_IS_API(FUNC)) {                                    \
+      H5_cancel_count_dec();                                  \
+    }
+  
+
+ +

By Chee Wai Lee

+

By Bill Wendling

+ + + diff --git a/doxygen/examples/VFL.html b/doxygen/examples/VFL.html new file mode 100644 index 0000000..9776f96 --- /dev/null +++ b/doxygen/examples/VFL.html @@ -0,0 +1,1601 @@ + + + + +HDF5 Virtual File Layer + + + + + + + + +Revision History +

Initial document, 18 November 1999.

+ +

Updated on 10/24/00, Quincey Koziol

+ +

Added the section “Programming Note for C++ Developers Using C +Functions,” 08/23/2012, Mark Evans + + + +

+


+

Table of Contents

+ +


+ + +

Introduction

+ +

+The HDF5 file format describes how HDF5 data structures and dataset raw +data are mapped to a linear format address space and the HDF5 +library implements that bidirectional mapping in terms of an +API. However, the HDF5 format specifications do not indicate how +the format address space is mapped onto storage and HDF (version 5 and +earlier) simply mapped the format address space directly onto a single +file by convention. + +

+

+Since early versions of HDF5 it became apparent that users want the ability to +map the format address space onto different types of storage (a single file, +multiple files, local memory, global memory, network distributed global +memory, a network protocol, etc.) with various types of maps. For +instance, some users want to be able to handle very large format address +spaces on operating systems that support only 2GB files by partitioning the +format address space into equal-sized parts each served by a separate +file. Other users want the same multi-file storage capability but want to +partition the address space according to purpose (raw data in one file, object +headers in another, global heap in a third, etc.) in order to improve I/O +speeds. + +

+

+In fact, the number of storage variations is probably larger than the +number of methods that the HDF5 team is capable of implementing and +supporting. Therefore, a Virtual File Layer API is being +implemented which will allow application teams or departments to design +and implement their own mapping between the HDF5 format address space +and storage, with each mapping being a separate file driver +(possibly written in terms of other file drivers). The HDF5 team will +provide a small set of useful file drivers which will also serve as +examples for those who which to write their own: + +

+
+ +
H5FD_SEC2 +
+This is the default driver which uses Posix file-system functions like +read and write to perform I/O to a single file. All I/O +requests are unbuffered although the driver does optimize file seeking +operations to some extent. + +
H5FD_STDIO +
+This driver uses functions from `stdio.h' to perform buffered I/O +to a single file. + +
H5FD_CORE +
+This driver performs I/O directly to memory and can be used to create small +temporary files that never exist on permanent storage. This type of storage is +generally very fast since the I/O consists only of memory-to-memory copy +operations. + +
H5FD_MPIIO +
+This is the driver of choice for accessing files in parallel using MPI and +MPI-IO. It is only predefined if the library is compiled with parallel I/O +support. + +
H5FD_FAMILY +
+Large format address spaces are partitioned into more manageable pieces and +sent to separate storage locations using an underlying driver of the user's +choice. The h5repart tool can be used to change the sizes of the +family members when stored as files or to convert a family of files to a +single file or vice versa. + +
H5FD_SPLIT +
+The format address space is split into meta data and raw data and each is +mapped onto separate storage using underlying drivers of the user's +choice. The meta data storage can be read by itself (for limited +functionality) or both files can be accessed together. +
+ + + +

Using a File Driver

+ +

+Most application writers will use a driver defined by the HDF5 library or +contributed by another programming team. This chapter describes how existing +drivers are used. + +

+ + + +

Driver Header Files

+ +

+Each file driver is defined in its own public header file which should +be included by any application which plans to use that driver. The +predefined drivers are in header files whose names begin with +`H5FD' followed by the driver name and `.h'. The `hdf5.h' +header file includes all the predefined driver header files. + +

+

+Once the appropriate header file is included a symbol of the form +`H5FD_' followed by the upper-case driver name will be the driver +identification number.(1) However, the +value may change if the library is closed (e.g., by calling +H5close) and the symbol is referenced again. + +

+ + +

Creating and Opening Files

+ +

+In order to create or open a file one must define the method by which the +storage is accessed(2) and does so by creating a file access property list(3) which is passed to the H5Fcreate or +H5Fopen function. A default file access property list is created by +calling H5Pcreate and then the file driver information is inserted by +calling a driver initialization function such as H5Pset_fapl_family: + +

+ +
+hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
+size_t member_size = 100*1024*1024; /*100MB*/
+H5Pset_fapl_family(fapl, member_size, H5P_DEFAULT);
+hid_t file = H5Fcreate("foo%05d.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+H5Pclose(fapl);
+
+ +

+Each file driver will have its own initialization function +whose name is H5Pset_fapl_ followed by the driver name and which +takes a file access property list as the first argument followed by +additional driver-dependent arguments. + +

+

+An alternative to using the driver initialization function is to set the +driver directly using the H5Pset_driver function.(4) Its second argument is the file driver identifier, which may +have a different numeric value from run to run depending on the order in which +the file drivers are registered with the library. The third argument +encapsulates the additional arguments of the driver initialization +function. This method only works if the file driver writer has made the +driver-specific property list structure a public datatype, which is +often not the case. + +

+ +
+hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
+static H5FD_family_fapl_t fa = {100*1024*1024, H5P_DEFAULT};
+H5Pset_driver(fapl, H5FD_FAMILY, &fa);
+hid_t file = H5Fcreate("foo.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+H5Pclose(fapl);
+
+ +

+It is also possible to query the file driver information from a file access +property list by calling H5Pget_driver to determine the driver and then +calling a driver-defined query function to obtain the driver information: + +

+ +
+hid_t driver = H5Pget_driver(fapl);
+if (H5FD_SEC2==driver) {
+    /*nothing further to get*/
+} else if (H5FD_FAMILY==driver) {
+    hid_t member_fapl;
+    haddr_t member_size;
+    H5Pget_fapl_family(fapl, &member_size, &member_fapl);
+} else if (....) {
+    ....
+}
+
+ + + +

Performing I/O

+ +

+The H5Dread and H5Dwrite functions transfer data between +application memory and the file. They both take an optional data transfer +property list which has some general driver-independent properties and +optional driver-defined properties. An application will typically perform I/O +in one of three styles via the H5Dread or H5Dwrite function: + +

+

+Like file access properties in the previous section, data transfer properties +can be set using a driver initialization function or a general purpose +function. For example, to set the MPI-IO driver to use independent access for +I/O operations one would say: + +

+ +
+hid_t dxpl = H5Pcreate(H5P_DATA_XFER);
+H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT);
+H5Dread(dataset, type, mspace, fspace, buffer, dxpl);
+H5Pclose(dxpl);
+
+ +

+The alternative is to initialize a driver defined C struct and pass it +to the H5Pset_driver function: + +

+ +
+hid_t dxpl = H5Pcreate(H5P_DATA_XFER);
+static H5FD_mpio_dxpl_t dx = {H5FD_MPIO_INDEPENDENT};
+H5Pset_driver(dxpl, H5FD_MPIO, &dx);
+H5Dread(dataset, type, mspace, fspace, buffer, dxpl);
+
+ +

+The transfer propery list can be queried in a manner similar to the file +access property list: the driver provides a function (or functions) to return +various information about the transfer property list: + +

+ +
+hid_t driver = H5Pget_driver(dxpl);
+if (H5FD_MPIO==driver) {
+    H5FD_mpio_xfer_t xfer_mode;
+    H5Pget_dxpl_mpio(dxpl, &xfer_mode);
+} else {
+    ....
+}
+
+ + + +

File Driver Interchangeability

+ +

+The HDF5 specifications describe two things: the mapping of data onto a linear +format address space and the C API which performs the mapping. +However, the mapping of the format address space onto storage intentionally +falls outside the scope of the HDF5 specs. This is a direct result of the fact +that it is not generally possible to store information about how to access +storage inside the storage itself. For instance, given only the file name +`/arborea/1225/work/f%03d' the HDF5 library is unable to tell whether the +name refers to a file on the local file system, a family of files on the local +file system, a file on host `arborea' port 1225, a family of files on a +remote system, etc. + +

+

+Two ways which library could figure out where the storage is located are: +storage access information can be provided by the user, or the library can try +all known file access methods. This implementation uses the former method. + +

+

+In general, if a file was created with one driver then it isn't possible to +open it with another driver. There are of course exceptions: a file created +with MPIO could probably be opened with the sec2 driver, any file created +by the sec2 driver could be opened as a family of files with one member, +etc. In fact, sometimes a file must not only be opened with the same +driver but also with the same driver properties. The predefined drivers are +written in such a way that specifying the correct driver is sufficient for +opening a file. + +

+ + +

Implementation of a Driver

+ +

+A driver is simply a collection of functions and data structures which are +registered with the HDF5 library at runtime. The functions fall into these +categories: + +

+ +
    +
  • Functions which operate on modes + +
  • Functions which operate on files + +
  • Functions which operate on the address space + +
  • Functions which operate on data + +
  • Functions for driver initialization + +
  • Optimization functions + +
+ + + +

Mode Functions

+ +

+Some drivers need information about file access and data transfers which are +very specific to the driver. The information is usually implemented as a pair +of pointers to C structs which are allocated and initialized as part of an +HDF5 property list and passed down to various driver functions. There are two +classes of settings: file access modes that describe how to access the file +through the driver, and data transfer modes which are settings that control +I/O operations. Each file opened by a particular driver may have a different +access mode; each dataset I/O request for a particular file may have a +different data transfer mode. + +

+

+Since each driver has its own particular requirements for various settings, +each driver is responsible for defining the mode structures that it +needs. Higher layers of the library treat the structures as opaque but must be +able to copy and free them. Thus, the driver provides either the size of the +structure or a pair of function pointers for each of the mode types. + +

+

+Example: The family driver needs to know how the format address +space is partitioned and the file access property list to use for the +family members. + +

+ +
+/* Driver-specific file access properties */
+typedef struct H5FD_family_fapl_t {
+    hsize_t     memb_size;      /*size of each member                   */
+    hid_t       memb_fapl_id;   /*file access property list of each memb*/
+} H5FD_family_fapl_t;
+
+/* Driver specific data transfer properties */
+typedef struct H5FD_family_dxpl_t {
+    hid_t       memb_dxpl_id;   /*data xfer property list of each memb  */
+} H5FD_family_dxpl_t;
+
+ +

+In order to copy or free one of these structures the member file access +or data transfer properties must also be copied or freed. This is done +by providing a copy and close function for each structure: + +

+

+Example: The file access property list copy and close functions +for the family driver: + +

+ +
+static void *
+H5FD_family_fapl_copy(const void *_old_fa)
+{
+    const H5FD_family_fapl_t *old_fa = (const H5FD_family_fapl_t*)_old_fa;
+    H5FD_family_fapl_t *new_fa = malloc(sizeof(H5FD_family_fapl_t));
+    assert(new_fa);
+
+    memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t));
+    new_fa->memb_fapl_id = H5Pcopy(old_fa->memb_fapl_id);
+    return new_fa;
+}
+
+static herr_t
+H5FD_family_fapl_free(void *_fa)
+{
+    H5FD_family_fapl_t  *fa = (H5FD_family_fapl_t*)_fa;
+    H5Pclose(fa->memb_fapl_id);
+    free(fa);
+    return 0;
+}
+
+ +

+Generally when a file is created or opened the file access properties +for the driver are copied into the file pointer which is returned and +they may be modified from their original value (for instance, the file +family driver modifies the member size property when opening an existing +family). In order to support the H5Fget_access_plist function the +driver must provide a fapl_get callback which creates a copy of +the driver-specific properties based on a particular file. + +

+

+Example: The file family driver copies the member size file +access property list into the return value: + +

+ +
+static void *
+H5FD_family_fapl_get(H5FD_t *_file)
+{
+    H5FD_family_t	*file = (H5FD_family_t*)_file;
+    H5FD_family_fapl_t	*fa = calloc(1, sizeof(H5FD_family_fapl_t*));
+
+    fa->memb_size = file->memb_size;
+    fa->memb_fapl_id = H5Pcopy(file->memb_fapl_id);
+    return fa;
+}
+
+ + + +

File Functions

+ +

+The higher layers of the library expect files to have a name and allow the +file to be accessed in various modes. The driver must be able to create a new +file, replace an existing file, or open an existing file. Opening or creating +a file should return a handle, a pointer to a specialization of the +H5FD_t struct, which allows read-only or read-write access and which +will be passed to the other driver functions as they are +called.(5) + +

+ +
+typedef struct {
+    /* Public fields */
+    H5FD_class_t *cls; /*class data defined below*/
+
+    /* Private fields -- driver-defined */
+
+} H5FD_t;
+
+ +

+Example: The family driver requires handles to the underlying +storage, the size of the members for this particular file (which might be +different than the member size specified in the file access property list if +an existing file family is being opened), the name used to open the file in +case additional members must be created, and the flags to use for creating +those additional members. The eoa member caches the size of the format +address space so the family members don't have to be queried in order to find +it. + +

+ +
+/* The description of a file belonging to this driver. */
+typedef struct H5FD_family_t {
+    H5FD_t      pub;            /*public stuff, must be first           */
+    hid_t       memb_fapl_id;   /*file access property list for members */
+    hsize_t     memb_size;      /*maximum size of each member file      */
+    int         nmembs;         /*number of family members              */
+    int         amembs;         /*number of member slots allocated      */
+    H5FD_t      **memb;         /*dynamic array of member pointers      */
+    haddr_t     eoa;            /*end of allocated addresses            */
+    char        *name;          /*name generator printf format          */
+    unsigned    flags;          /*flags for opening additional members  */
+} H5FD_family_t;
+
+ +

+Example: The sec2 driver needs to keep track of the underlying Unix +file descriptor and also the end of format address space and current Unix file +size. It also keeps track of the current file position and last operation +(read, write, or unknown) in order to optimize calls to lseek. The +device and inode fields are defined on Unix in order to uniquely +identify the file and will be discussed below. + +

+ +
+typedef struct H5FD_sec2_t {
+    H5FD_t      pub;                    /*public stuff, must be first   */
+    int         fd;                     /*the unix file                 */
+    haddr_t     eoa;                    /*end of allocated region       */
+    haddr_t     eof;                    /*end of file; current file size*/
+    haddr_t     pos;                    /*current file I/O position     */
+    int         op;                     /*last operation                */
+    dev_t       device;                 /*file device number            */
+    ino_t       inode;                  /*file i-node number            */
+} H5FD_sec2_t;
+
+ + + +

Opening Files

+ +

+All drivers must define a function for opening/creating a file. This +function should have a prototype which is: + +

+

+

+
Function: static H5FD_t * open (const char *name, unsigned flags, hid_t fapl, haddr_t maxaddr) +
+ +

+

+The file name name and file access property list fapl are +the same as were specified in the H5Fcreate or H5Fopen +call. The flags are the same as in those calls also except the +flag H5F_ACC_CREATE is also present if the call was to +H5Fcreate and they are documented in the `H5Fpublic.h' +file. The maxaddr argument is the maximum format address that the +driver should be prepared to handle (the minimum address is always +zero). +

+ +

+

+Example: The sec2 driver opens a Unix file with the requested name +and saves information which uniquely identifies the file (the Unix device +number and inode). + +

+ +
+static H5FD_t *
+H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id/*unused*/,
+               haddr_t maxaddr)
+{
+    unsigned    o_flags;
+    int         fd;
+    struct stat sb;
+    H5FD_sec2_t *file=NULL;
+
+    /* Check arguments */
+    if (!name || !*name) return NULL;
+    if (0==maxaddr || HADDR_UNDEF==maxaddr) return NULL;
+    if (ADDR_OVERFLOW(maxaddr)) return NULL;
+
+    /* Build the open flags */
+    o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
+    if (H5F_ACC_TRUNC & flags) o_flags |= O_TRUNC;
+    if (H5F_ACC_CREAT & flags) o_flags |= O_CREAT;
+    if (H5F_ACC_EXCL & flags) o_flags |= O_EXCL;
+
+    /* Open the file */
+    if ((fd=open(name, o_flags, 0666))<0) return NULL;
+    if (fstat(fd, &sb)<0) {
+        close(fd);
+        return NULL;
+    }
+
+    /* Create the new file struct */
+    file = calloc(1, sizeof(H5FD_sec2_t));
+    file->fd = fd;
+    file->eof = sb.st_size;
+    file->pos = HADDR_UNDEF;
+    file->op = OP_UNKNOWN;
+    file->device = sb.st_dev;
+    file->inode = sb.st_ino;
+
+    return (H5FD_t*)file;
+}
+
+ + + +

Closing Files

+ +

+Closing a file simply means that all cached data should be flushed to the next +lower layer, the file should be closed at the next lower layer, and all +file-related data structures should be freed. All information needed by the +close function is already present in the file handle. + +

+

+

+
Function: static herr_t close (H5FD_t *file) +
+ +

+

+The file argument is the handle which was returned by the open +function, and the close should free only memory associated with the +driver-specific part of the handle (the public parts will have already been released by HDF5's virtual file layer). +

+ +

+

+Example: The sec2 driver just closes the underlying Unix file, +making sure that the actual file size is the same as that known to the +library by writing a zero to the last file position it hasn't been +written by some previous operation (which happens in the same code which +flushes the file contents and is shown below). + +

+ +
+static herr_t
+H5FD_sec2_close(H5FD_t *_file)
+{
+    H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
+
+    if (H5FD_sec2_flush(_file)<0) return -1;
+    if (close(file->fd)<0) return -1;
+    free(file);
+    return 0;
+}
+
+ + + +

File Keys

+ +

+Occasionally an application will attempt to open a single file more than one +time in order to obtain multiple handles to the file. HDF5 allows the files to +share information(6) but in order to +accomplish this HDF5 must be able to tell when two names refer to the same +file. It does this by associating a driver-defined key with each file opened +by a driver and comparing the key for an open request with the keys for all +other files currently open by the same driver. + +

+

+

+
Function: const int cmp (const H5FD_t *f1, const H5FD_t *f2) +
+ +

+

+The driver may provide a function which compares two files f1 and +f2 belonging to the same driver and returns a negative, positive, or +zero value a la the strcmp function.(7) If this +function is not provided then HDF5 assumes that all calls to the open +callback return unique files regardless of the arguments and it is up to the +application to avoid doing this if that assumption is incorrect. +

+ +

+

+Each time a file is opened the library calls the cmp function to +compare that file with all other files currently open by the same driver and +if one of them matches (at most one can match) then the file which was just +opened is closed and the previously opened file is used instead. + +

+

+Opening a file twice with incompatible flags will result in failure. For +instance, opening a file with the truncate flag is a two step process which +first opens the file without truncation so keys can be compared, and if no +matching file is found already open then the file is closed and immediately +reopened with the truncation flag set (if a matching file is already open then +the truncating open will fail). + +

+

+Example: The sec2 driver uses the Unix device and i-node as the +key. They were initialized when the file was opened. + +

+ +
+static int
+H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
+{
+    const H5FD_sec2_t   *f1 = (const H5FD_sec2_t*)_f1;
+    const H5FD_sec2_t   *f2 = (const H5FD_sec2_t*)_f2;
+
+    if (f1->device < f2->device) return -1;
+    if (f1->device > f2->device) return 1;
+
+    if (f1->inode < f2->inode) return -1;
+    if (f1->inode > f2->inode) return 1;
+
+    return 0;
+}
+
+ + + +

Saving Modes Across Opens

+ +

+Some drivers may also need to store certain information in the file superblock +in order to be able to reliably open the file at a later date. This is done by +three functions: one to determine how much space will be necessary to store +the information in the superblock, one to encode the information, and one to +decode the information. These functions are optional, but if any one is +defined then the other two must also be defined. + +

+

+

+
Function: static hsize_t sb_size (H5FD_t *file) +
+
Function: static herr_t sb_encode (H5FD_t *file, char *name, unsigned char *buf) +
+
Function: static herr_t sb_decode (H5FD_t *file, const char *name, const unsigned char *buf) +
+ +

+

+The sb_size function returns the number of bytes necessary to encode +information needed later if the file is reopened. The sb_encode +function encodes information from the file into buffer buf +allocated by the caller. It also writes an 8-character (plus null +termination) into the name argument, which should be a unique +identification for the driver. The sb_decode function looks at +the name + +

+

+ decodes +data from the buffer buf and updates the file argument with the new information, +advancing *p in the process. +

+ +

+

+The part of this which is somewhat tricky is that the file must be readable +before the superblock information is decoded. File access modes fall outside +the scope of the HDF5 file format, but they are placed inside the boot block +for convenience.(8) + +

+

+Example: To be written later. + +

+ + +

Address Space Functions

+ +

+HDF5 does not assume that a file is a linear address space of bytes. Instead, +the library will call functions to allocate and free portions of the HDF5 +format address space, which in turn map onto functions in the file driver to +allocate and free portions of file address space. The library tells the file +driver how much format address space it wants to allocate and the driver +decides what format address to use and how that format address is mapped onto +the file address space. Usually the format address is chosen so that the file +address can be calculated in constant time for data I/O operations (which are +always specified by format addresses). + +

+ + + +

Userblock and Superblock

+ +

+The HDF5 format allows an optional userblock to appear before the actual HDF5 +data in such a way that if the userblock is sucked out of the file and +everything remaining is shifted downward in the file address space, then the +file is still a valid HDF5 file. The userblock size can be zero or any +multiple of two greater than or equal to 512 and the file superblock begins +immediately after the userblock. + +

+

+HDF5 allocates space for the userblock and superblock by calling an +allocation function defined below, which must return a chunk of memory at +format address zero on the first call. + +

+ + +

Allocation of Format Regions

+ +

+The library makes many types of allocation requests: + +

+
+ +
H5FD_MEM_SUPER +
+An allocation request for the userblock and/or superblock. +
H5FD_MEM_BTREE +
+An allocation request for a node of a B-tree. +
H5FD_MEM_DRAW +
+An allocation request for the raw data of a dataset. +
H5FD_MEM_META +
+An allocation request for the raw data of a dataset which +the user has indicated will be relatively small. +
H5FD_MEM_GROUP +
+An allocation request for a group leaf node (internal nodes of the group tree +are allocated as H5MF_BTREE). +
H5FD_MEM_GHEAP +
+An allocation request for a global heap collection. Global heaps are used to +store certain types of references such as dataset region references. The set +of all global heap collections can become quite large. +
H5FD_MEM_LHEAP +
+An allocation request for a local heap. Local heaps are used to store the +names which are members of a group. The combined size of all local heaps is a +function of the number of object names in the file. +
H5FD_MEM_OHDR +
+An allocation request for (part of) an object header. Object headers are +relatively small and include meta information about objects (like the data +space and type of a dataset) and attributes. +
+ +

+When a chunk of memory is freed the library adds it to a free list and +allocation requests are satisfied from the free list before requesting memory +from the file driver. Each type of allocation request enumerated above has its +own free list, but the file driver can specify that certain object types can +share a free list. It does so by providing an array which maps a request type +to a free list. If any value of the map is H5MF_DEFAULT (zero) then the +object's own free list is used. The special value H5MF_NOLIST indicates +that the library should not attempt to maintain a free list for that +particular object type, instead calling the file driver each time an object of +that type is freed. + +

+

+Mappings predefined in the `H5FDpublic.h' file are: +

+ +
H5FD_FLMAP_SINGLE +
+All memory usage types are mapped to a single free list. +
H5FD_FLMAP_DICHOTOMY +
+Memory usage is segregated into meta data and raw data for the purposes of +memory management. +
H5FD_FLMAP_DEFAULT +
+Each memory usage type has its own free list. +
+ +

+Example: To make a map that manages object headers on one free list +and everything else on another free list one might initialize the map with the +following code: (the use of H5FD_MEM_SUPER is arbitrary) + +

+ +
+H5FD_mem_t mt, map[H5FD_MEM_NTYPES];
+
+for (mt=0; mt<H5FD_MEM_NTYPES; mt++) {
+    map[mt] = (H5FD_MEM_OHDR==mt) ? mt : H5FD_MEM_SUPER;
+}
+
+ +

+If an allocation request cannot be satisfied from the free list then one of +two things happen. If the driver defines an allocation callback then it is +used to allocate space; otherwise new memory is allocated from the end of the +format address space by incrementing the end-of-address marker. + +

+

+

+
Function: static haddr_t alloc (H5FD_t *file, H5MF_type_t type, hsize_t size) +
+ +

+

+The file argument is the file from which space is to be allocated, +type is the type of memory being requested (from the list above) without +being mapped according to the freelist map and size is the number of +bytes being requested. The library is allowed to allocate large chunks of +storage and manage them in a layer above the file driver (although the current +library doesn't do that). The allocation function should return a format +address for the first byte allocated. The allocated region extends from that +address for size bytes. If the request cannot be honored then the +undefined address value is returned (HADDR_UNDEF). The first call to +this function for a file which has never had memory allocated must +return a format address of zero or HADDR_UNDEF since this is how the +library allocates space for the userblock and/or superblock. +

+ +

+ +

+Example: To be written later. + +

+ + +

Freeing Format Regions

+ +

+When the library is finished using a certain region of the format address +space it will return the space to the free list according to the type of +memory being freed and the free list map described above. If the free list has +been disabled for a particular memory usage type (according to the free list +map) and the driver defines a free callback then it will be +invoked. The free callback is also invoked for all entries on the free +list when the file is closed. + +

+

+

+
Function: static herr_t free (H5FD_t *file, H5MF_type_t type, haddr_t addr, hsize_t size) +
+ +

+

+The file argument is the file for which space is being freed; type +is the type of object being freed (from the list above) without being mapped +according to the freelist map; addr is the first format address to free; +and size is the size in bytes of the region being freed. The region +being freed may refer to just part of the region originally allocated and/or +may cross allocation boundaries provided all regions being freed have the same +usage type. However, the library will never attempt to free regions which have +already been freed or which have never been allocated. +

+ +

+

+A driver may choose to not define the free function, in which case +format addresses will be leaked. This isn't normally a huge problem since the +library contains a simple free list of its own and freeing parts of the format +address space is not a common occurrence. + +

+

+Example: To be written later. + +

+ + +

Querying Address Range

+ +

+Each file driver must have some mechanism for setting and querying the end of +address, or EOA, marker. The EOA marker is the first format address +after the last format address ever allocated. If the last part of the +allocated address range is freed then the driver may optionally decrease the +eoa marker. + +

+

+

+
Function: static haddr_t get_eoa (H5FD_t *file) +
+ +

+

+This function returns the current value of the EOA marker for the specified +file. +

+ +

+

+Example: The sec2 driver just returns the current eoa marker value +which is cached in the file structure: + +

+ +
+static haddr_t
+H5FD_sec2_get_eoa(H5FD_t *_file)
+{
+    H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
+    return file->eoa;
+}
+
+ +

+The eoa marker is initially zero when a file is opened and the library may set +it to some other value shortly after the file is opened (after the superblock +is read and the saved eoa marker is determined) or when allocating additional +memory in the absence of an alloc callback (described above). + +

+

+Example: The sec2 driver simply caches the eoa marker in the file +structure and does not extend the underlying Unix file. When the file is +flushed or closed then the Unix file size is extended to match the eoa marker. + +

+ +
+static herr_t
+H5FD_sec2_set_eoa(H5FD_t *_file, haddr_t addr)
+{
+    H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
+    file->eoa = addr;
+    return 0;
+}
+
+ + + +

Data Functions

+ +

+These functions operate on data, transferring a region of the format address +space between memory and files. + +

+ + + +

Contiguous I/O Functions

+ +

+A driver must specify two functions to transfer data from the library to the +file and vice versa. + +

+

+

+
Function: static herr_t read (H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, hsize_t size, void *buf) +
+
Function: static herr_t write (H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, hsize_t size, const void *buf) +
+ +

+

+The read function reads data from file file beginning at address +addr and continuing for size bytes into the buffer buf +supplied by the caller. The write function transfers data in the +opposite direction. Both functions take a data transfer property list +dxpl which indicates the fine points of how the data is to be +transferred and which comes directly from the H5Dread or +H5Dwrite function. Both functions receive type of +data being written, which may allow a driver to tune it's behavior for +different kinds of data. +

+ +

+

+Both functions should return a negative value if they fail to transfer the +requested data, or non-negative if they succeed. The library will never +attempt to read from unallocated regions of the format address space. + +

+

+Example: The sec2 driver just makes system calls. It tries not to +call lseek if the current operation is the same as the previous +operation and the file position is correct. It also fills the output buffer +with zeros when reading between the current EOF and EOA markers and restarts +system calls which were interrupted. + +

+ +
+static herr_t
+H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type/*unused*/, hid_t dxpl_id/*unused*/,
+        haddr_t addr, hsize_t size, void *buf/*out*/)
+{
+    H5FD_sec2_t         *file = (H5FD_sec2_t*)_file;
+    ssize_t             nbytes;
+
+    assert(file && file->pub.cls);
+    assert(buf);
+
+    /* Check for overflow conditions */
+    if (REGION_OVERFLOW(addr, size)) return -1;
+    if (addr+size>file->eoa) return -1;
+
+    /* Seek to the correct location */
+    if ((addr!=file->pos || OP_READ!=file->op) &&
+        file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) {
+        file->pos = HADDR_UNDEF;
+        file->op = OP_UNKNOWN;
+        return -1;
+    }
+
+    /*
+     * Read data, being careful of interrupted system calls, partial results,
+     * and the end of the file.
+     */
+    while (size>0) {
+        do nbytes = read(file->fd, buf, size);
+        while (-1==nbytes && EINTR==errno);
+        if (-1==nbytes) {
+            /* error */
+            file->pos = HADDR_UNDEF;
+            file->op = OP_UNKNOWN;
+            return -1;
+        }
+        if (0==nbytes) {
+            /* end of file but not end of format address space */
+            memset(buf, 0, size);
+            size = 0;
+        }
+        assert(nbytes>=0);
+        assert((hsize_t)nbytes<=size);
+        size -= (hsize_t)nbytes;
+        addr += (haddr_t)nbytes;
+        buf = (char*)buf + nbytes;
+    }
+
+    /* Update current position */
+    file->pos = addr;
+    file->op = OP_READ;
+    return 0;
+}
+
+ +

+Example: The sec2 write callback is similar except it updates +the file EOF marker when extending the file. + +

+ + +

Flushing Cached Data

+ +

+Some drivers may desire to cache data in memory in order to make larger I/O +requests to the underlying file and thus improving bandwidth. Such drivers +should register a cache flushing function so that the library can insure that +data has been flushed out of the drivers in response to the application +calling H5Fflush. + +

+

+

+
Function: static herr_t flush (H5FD_t *file) +
+ +

+

+Flush all data for file file to storage. +

+ +

+

+Example: The sec2 driver doesn't cache any data but it also doesn't +extend the Unix file as agressively as it should. Therefore, when finalizing a +file it should write a zero to the last byte of the allocated region so that +when reopening the file later the EOF marker will be at least as large as the +EOA marker saved in the superblock (otherwise HDF5 will refuse to open the +file, claiming that the data appears to be truncated). + +

+ +
+static herr_t
+H5FD_sec2_flush(H5FD_t *_file)
+{
+    H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
+
+    if (file->eoa>file->eof) {
+        if (-1==file_seek(file->fd, file->eoa-1, SEEK_SET)) return -1;
+        if (write(file->fd, "", 1)!=1) return -1;
+        file->eof = file->eoa;
+        file->pos = file->eoa;
+        file->op = OP_WRITE;
+    }
+
+    return 0;
+}
+
+ + + +

Optimization Functions

+ +

+The library is capable of performing several generic optimizations on I/O, but +these types of optimizations may not be appropriate for a given VFL driver. +

+ +

+Each driver may provide a query function to allow the library to query whether +to enable these optimizations. If a driver lacks a query function, the library +will disable all types of optimizations which can be queried. +

+ +

+

+
Function: static herr_t query (const H5FD_t *file, unsigned long *flags) +
+

+

+This function is called by the library to query which optimizations to enable +for I/O to this driver. These are the flags which are currently defined: + +

    +
    +
    H5FD_FEAT_AGGREGATE_METADATA (0x00000001) +
    Defining the H5FD_FEAT_AGGREGATE_METADATA for a VFL driver means that +the library will attempt to allocate a larger block for metadata and +then sub-allocate each metadata request from that larger block. +
    H5FD_FEAT_ACCUMULATE_METADATA (0x00000002) +
    Defining the H5FD_FEAT_ACCUMULATE_METADATA for a VFL driver means that +the library will attempt to cache metadata as it is written to the file +and build up a larger block of metadata to eventually pass to the VFL +'write' routine. +
    H5FD_FEAT_DATA_SIEVE (0x00000004) +
    Defining the H5FD_FEAT_DATA_SIEVE for a VFL driver means that +the library will attempt to cache raw data as it is read from/written to +a file in a "data sieve" buffer. See Rajeev Thakur's papers: +
      +
      +
      http://www.mcs.anl.gov/~thakur/papers/romio-coll.ps.gz +
      http://www.mcs.anl.gov/~thakur/papers/mpio-high-perf.ps.gz +
      +
    +
    +
+

+ +
+

+ +

Registration of a Driver

+ +

+Before a driver can be used the HDF5 library needs to be told of its +existence. This is done by registering the driver, which results in a driver +identification number. Instead of passing many arguments to the registration +function, the driver information is entered into a structure and the address +of the structure is passed to the registration function where it is +copied. This allows the HDF5 API to be extended while providing backward +compatibility at the source level. + +

+

+

+
Function: hid_t H5FDregister (H5FD_class_t *cls) +
+ +

+

+The driver described by struct cls is registered with the library and an +ID number for the driver is returned. +

+ +

+

+The H5FD_class_t type is a struct with the following fields: + +

+
+ +
const char *name +
+A pointer to a constant, null-terminated driver name to be used for debugging +purposes. +
size_t fapl_size +
+The size in bytes of the file access mode structure or zero if the driver +supplies a copy function or doesn't define the structure. +
void *(*fapl_copy)(const void *fapl) +
+An optional function which copies a driver-defined file access mode structure. +This field takes precedence over fm_size when both are defined. +
void (*fapl_free)(void *fapl) +
+An optional function to free the driver-defined file access mode structure. If +null, then the library calls the C free function to free the +structure. +
size_t dxpl_size +
+The size in bytes of the data transfer mode structure or zero if the driver +supplies a copy function or doesn't define the structure. +
void *(*dxpl_copy)(const void *dxpl) +
+An optional function which copies a driver-defined data transfer mode +structure. This field takes precedence over xm_size when both are +defined. +
void (*dxpl_free)(void *dxpl) +
+An optional function to free the driver-defined data transfer mode +structure. If null, then the library calls the C free function to +free the structure. +
H5FD_t *(*open)(const char *name, unsigned flags, hid_t fapl, haddr_t maxaddr) +
+The function which opens or creates a new file. +
herr_t (*close)(H5FD_t *file) +
+The function which ends access to a file. +
int (*cmp)(const H5FD_t *f1, const H5FD_t *f2) +
+An optional function to determine whether two open files have the same key. If +this function is not present then the library assumes that two files will +never be the same. +
int (*query)(const H5FD_t *f, unsigned long *flags) +
+An optional function to determine which library optimizations a driver can +support. +
haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hsize_t size) +
+An optional function to allocate space in the file. +
herr_t (*free)(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) +
+An optional function to free space in the file. +
haddr_t (*get_eoa)(H5FD_t *file) +
+A function to query how much of the format address space has been allocated. +
herr_t (*set_eoa)(H5FD_t *file, haddr_t) +
+A function to set the end of address space. +
haddr_t (*get_eof)(H5FD_t *file) +
+A function to return the current end-of-file marker value. +
herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, hsize_t size, void *buffer) +
+A function to read data from a file. +
herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, hsize_t size, const void *buffer) +
+A function to write data to a file. +
herr_t (*flush)(H5FD_t *file) +
+A function which flushes cached data to the file. +
H5FD_mem_t fl_map[H5FD_MEM_NTYPES] +
+An array which maps a file allocation request type to a free list. +
+ +

+Example: The sec2 driver would be registered as: + +

+ +
+static const H5FD_class_t H5FD_sec2_g = {
+    "sec2",                                     /*name                  */
+    MAXADDR,                                    /*maxaddr               */
+    NULL,                                       /*sb_size               */
+    NULL,                                       /*sb_encode             */
+    NULL,                                       /*sb_decode             */
+    0,                                          /*fapl_size             */
+    NULL,                                       /*fapl_get              */
+    NULL,                                       /*fapl_copy             */
+    NULL,                                       /*fapl_free             */
+    0,                                          /*dxpl_size             */
+    NULL,                                       /*dxpl_copy             */
+    NULL,                                       /*dxpl_free             */
+    H5FD_sec2_open,                             /*open                  */
+    H5FD_sec2_close,                            /*close                 */
+    H5FD_sec2_cmp,                              /*cmp                   */
+    H5FD_sec2_query,                            /*query                 */
+    NULL,                                       /*alloc                 */
+    NULL,                                       /*free                  */
+    H5FD_sec2_get_eoa,                          /*get_eoa               */
+    H5FD_sec2_set_eoa,                          /*set_eoa               */
+    H5FD_sec2_get_eof,                          /*get_eof               */
+    H5FD_sec2_read,                             /*read                  */
+    H5FD_sec2_write,                            /*write                 */
+    H5FD_sec2_flush,                            /*flush                 */
+    H5FD_FLMAP_SINGLE,                          /*fl_map                */
+};
+
+hid_t
+H5FD_sec2_init(void)
+{
+    if (!H5FD_SEC2_g) {
+        H5FD_SEC2_g = H5FDregister(&H5FD_sec2_g);
+    }
+    return H5FD_SEC2_g;
+}
+
+ +

+A driver can be removed from the library by unregistering it + +

+

+

+
Function: herr_t H5Dunregister (hid_t driver) +
+Where driver is the ID number returned when the driver was registered. +
+ +

+

+Unregistering a driver makes it unusable for creating new file access or data +transfer property lists but doesn't affect any property lists or files that +already use that driver. + +

+ + + + +

Programming Note +for C++ Developers Using C Functions

+ +

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.

+ +

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.

+ +

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.

+ + + + + + + +

Querying Driver Information

+ +

+

+
Function: void * H5Pget_driver_data (hid_t fapl) +
+
Function: void * H5Pget_driver_data (hid_t fxpl) +
+ +

+

+This function is intended to be used by driver functions, not applications. +It returns a pointer directly into the file access property list +fapl which is a copy of the driver's file access mode originally +provided to the H5Pset_driver function. If its argument is a data +transfer property list fxpl then it returns a pointer to the +driver-specific data transfer information instead. +

+ +

+ + + +

Miscellaneous

+ +

+The various private H5F_low_* functions will be replaced by public +H5FD* functions so they can be called from drivers. + +

+

+All private functions H5F_addr_* which operate on addresses will be +renamed as public functions by removing the first underscore so they can be +called by drivers. + +

+

+The haddr_t address data type will be passed by value throughout the +library. The original intent was that this type would eventually be a union of +file address types for the various drivers and may become quite large, but +that was back when drivers were part of HDF5. It will become an alias for an +unsigned integer type (32 or 64 bits depending on how the library was +configured). + +

+

+The various H5F*.c driver files will be renamed H5FD*.c and each +will have a corresponding header file. All driver functions except the +initializer and API will be declared static. + +

+

+This documentation didn't cover optimization functions which would be useful +to drivers like MPI-IO. Some drivers may be able to perform data pipeline +operations more efficiently than HDF5 and need to be given a chance to +override those parts of the pipeline. The pipeline would be designed to call +various H5FD optimization functions at various points which return one of +three values: the operation is not implemented by the driver, the operation is +implemented but failed in a non-recoverable manner, the operation is +implemented and succeeded. + +

+

+Various parts of HDF5 check the only the top-level file driver and do +something special if it is the MPI-IO driver. However, we might want to be +able to put the MPI-IO driver under other drivers such as the raw part of a +split driver or under a debug driver whose sole purpose is to accumulate +statistics as it passes all requests through to the MPI-IO driver. Therefore +we will probably need a function which takes a format address and or object +type and returns the driver which would have been used at the lowest level to +process the request. + +

+ +


+

Footnotes

+

(1)

+

The driver name is by convention and might +not apply to drivers which are not distributed with HDF5. +

(2)

+

The access method also indicates how to translate +the storage name to a storage server such as a file, network protocol, or +memory. +

(3)

+

The term +"file access property list" is a misnomer since storage isn't +required to be a file. +

(4)

+

This +function is overloaded to operate on data transfer property lists also, as +described below. +

(5)

+

Read-only access is only appropriate when opening an existing +file. +

(6)

+

For instance, writing data to one handle will cause +the data to be immediately visible on the other handle. +

(7)

+

The ordering is +arbitrary as long as it's consistent within a particular file driver. +

(8)

+

File access modes do not describe data, but rather +describe how the HDF5 format address space is mapped to the underlying +file(s). Thus, in general the mapping must be known before the file superblock +can be read. However, the user usually knows enough about the mapping for the +superblock to be readable and once the superblock is read the library can fill +in the missing parts of the mapping. +


+ + + + + diff --git a/doxygen/hdf5_footer.html b/doxygen/hdf5_footer.html new file mode 100644 index 0000000..520f3f5 --- /dev/null +++ b/doxygen/hdf5_footer.html @@ -0,0 +1,21 @@ + + +

+ + + + + + + diff --git a/doxygen/hdf5_header.html b/doxygen/hdf5_header.html new file mode 100644 index 0000000..4a575d6 --- /dev/null +++ b/doxygen/hdf5_header.html @@ -0,0 +1,61 @@ + + + + + + + +$projectname: $title +$title + + + +$treeview +$search +$mathjax + + + + + + + + +
Please, help us to better know about our user community by answering the following short survey: https://www.hdfgroup.org/
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+
$projectname +  $projectnumber +
+
$projectbrief
+
+
$projectbrief
+
$searchbox
+
+ + diff --git a/doxygen/hdf5_navtree_hacks.js b/doxygen/hdf5_navtree_hacks.js new file mode 100644 index 0000000..942970c --- /dev/null +++ b/doxygen/hdf5_navtree_hacks.js @@ -0,0 +1,246 @@ + +// generate a table of contents in the side-nav based on the h1/h2 tags of the current page. +function generate_autotoc() { + var headers = $("h1, h2"); + if(headers.length > 1) { + var toc = $("#side-nav").append(''); + toc = $("#nav-toc"); + var footer = $("#nav-path"); + var footerHeight = footer.height(); + toc = toc.append('
    '); + toc = toc.find('ul'); + var indices = new Array(); + indices[0] = 0; + indices[1] = 0; + + var h1counts = $("h1").length; + headers.each(function(i) { + var current = $(this); + var levelTag = current[0].tagName.charAt(1); + if(h1counts==0) + levelTag--; + var cur_id = current.attr("id"); + + indices[levelTag-1]+=1; + var prefix = indices[0]; + if (levelTag >1) { + prefix+="."+indices[1]; + } + + // Uncomment to add number prefixes + // current.html(prefix + " " + current.html()); + for(var l = levelTag; l < 2; ++l){ + indices[l] = 0; + } + + if(cur_id == undefined) { + current.attr('id', 'title' + i); + current.addClass('anchor'); + toc.append("
  • " + current.text() + "
  • "); + } else { + toc.append("
  • " + current.text() + "
  • "); + } + }); + resizeHeight(); + } +} + + +var global_navtree_object; + +// Overloaded to remove links to sections/subsections +function getNode(o, po) +{ + po.childrenVisited = true; + var l = po.childrenData.length-1; + for (var i in po.childrenData) { + var nodeData = po.childrenData[i]; + if((!nodeData[1]) || (nodeData[1].indexOf('#')==-1)) // <- we added this line + po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], i==l); + } +} + +// Overloaded to adjust the size of the navtree wrt the toc +function resizeHeight() +{ + var header = $("#top"); + var sidenav = $("#side-nav"); + var content = $("#doc-content"); + var navtree = $("#nav-tree"); + var footer = $("#nav-path"); + var toc = $("#nav-toc"); + + var headerHeight = header.outerHeight(); + var footerHeight = footer.outerHeight(); + var tocHeight = toc.height(); + var windowHeight = $(window).height() - headerHeight - footerHeight; + content.css({height:windowHeight + "px"}); + navtree.css({height:(windowHeight-tocHeight) + "px"}); + sidenav.css({height:windowHeight + "px"}); +} + +// Overloaded to save the root node into global_navtree_object +function initNavTree(toroot,relpath) +{ + var o = new Object(); + global_navtree_object = o; // <- we added this line + o.toroot = toroot; + o.node = new Object(); + o.node.li = document.getElementById("nav-tree-contents"); + o.node.childrenData = NAVTREE; + o.node.children = new Array(); + o.node.childrenUL = document.createElement("ul"); + o.node.getChildrenUL = function() { return o.node.childrenUL; }; + o.node.li.appendChild(o.node.childrenUL); + o.node.depth = 0; + o.node.relpath = relpath; + o.node.expanded = false; + o.node.isLast = true; + o.node.plus_img = document.createElement("img"); + o.node.plus_img.src = relpath+"ftv2pnode.png"; + o.node.plus_img.width = 16; + o.node.plus_img.height = 22; + + if (localStorageSupported()) { + var navSync = $('#nav-sync'); + if (cachedLink()) { + showSyncOff(navSync,relpath); + navSync.removeClass('sync'); + } else { + showSyncOn(navSync,relpath); + } + navSync.click(function(){ toggleSyncButton(relpath); }); + } + + navTo(o,toroot,window.location.hash,relpath); + + $(window).bind('hashchange', function(){ + if (window.location.hash && window.location.hash.length>1){ + var a; + if ($(location).attr('hash')){ + var clslink=stripPath($(location).attr('pathname'))+':'+ + $(location).attr('hash').substring(1); + a=$('.item a[class$="'+clslink+'"]'); + } + if (a==null || !$(a).parent().parent().hasClass('selected')){ + $('.item').removeClass('selected'); + $('.item').removeAttr('id'); + } + var link=stripPath2($(location).attr('pathname')); + navTo(o,link,$(location).attr('hash'),relpath); + } else if (!animationInProgress) { + $('#doc-content').scrollTop(0); + $('.item').removeClass('selected'); + $('.item').removeAttr('id'); + navTo(o,toroot,window.location.hash,relpath); + } + }) + + $(window).on("load", showRoot); +} + +// return false if the the node has no children at all, or has only section/subsection children +function checkChildrenData(node) { + if (!(typeof(node.childrenData)==='string')) { + for (var i in node.childrenData) { + var url = node.childrenData[i][1]; + if(url.indexOf("#")==-1) + return true; + } + return false; + } + return (node.childrenData); +} + +// Modified to: +// 1 - remove the root node +// 2 - remove the section/subsection children +function createIndent(o,domNode,node,level) +{ + var level=-2; // <- we replaced level=-1 by level=-2 + var n = node; + while (n.parentNode) { level++; n=n.parentNode; } + if (checkChildrenData(node)) { // <- we modified this line to use checkChildrenData(node) instead of node.childrenData + var imgNode = document.createElement("span"); + imgNode.className = 'arrow'; + imgNode.style.paddingLeft=(16*level).toString()+'px'; + imgNode.innerHTML=arrowRight; + node.plus_img = imgNode; + node.expandToggle = document.createElement("a"); + node.expandToggle.href = "javascript:void(0)"; + node.expandToggle.onclick = function() { + if (node.expanded) { + $(node.getChildrenUL()).slideUp("fast"); + node.plus_img.innerHTML=arrowRight; + node.expanded = false; + } else { + expandNode(o, node, false, false); + } + } + node.expandToggle.appendChild(imgNode); + domNode.appendChild(node.expandToggle); + } else { + var span = document.createElement("span"); + span.className = 'arrow'; + span.style.width = 16*(level+1)+'px'; + span.innerHTML = ' '; + domNode.appendChild(span); + } +} + +// Overloaded to automatically expand the selected node +function selectAndHighlight(hash,n) +{ + var a; + if (hash) { + var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1); + a=$('.item a[class$="'+link+'"]'); + } + if (a && a.length) { + a.parent().parent().addClass('selected'); + a.parent().parent().attr('id','selected'); + highlightAnchor(); + } else if (n) { + $(n.itemDiv).addClass('selected'); + $(n.itemDiv).attr('id','selected'); + } + if ($('#nav-tree-contents .item:first').hasClass('selected')) { + $('#nav-sync').css('top','30px'); + } else { + $('#nav-sync').css('top','5px'); + } + expandNode(global_navtree_object, n, true, true); // <- we added this line + showRoot(); +} + + +$(document).ready(function() { + + generate_autotoc(); + + (function (){ // wait until the first "selected" element has been created + try { + + // this line will triger an exception if there is no #selected element, i.e., before the tree structure is complete. + document.getElementById("selected").className = "item selected"; + + // ok, the default tree has been created, we can keep going... + + // expand the "Chapters" node + if(window.location.href.indexOf('unsupported')==-1) + expandNode(global_navtree_object, global_navtree_object.node.children[0].children[2], true, true); + else + expandNode(global_navtree_object, global_navtree_object.node.children[0].children[1], true, true); + + // Hide the root node "HDF5" + $(document.getElementsByClassName('index.html')[0]).parent().parent().css({display:"none"}); + + } catch (err) { + setTimeout(arguments.callee, 10); + } + })(); + + $(window).on("load", resizeHeight); +}); diff --git a/doxygen/hdf5doxy.css b/doxygen/hdf5doxy.css new file mode 100644 index 0000000..8c03860 --- /dev/null +++ b/doxygen/hdf5doxy.css @@ -0,0 +1,251 @@ + +/******** HDF5 specific CSS code ************/ + +/**** Styles removing elements ****/ + +/* remove the "modules|classes" link for module pages (they are already in the TOC) */ +div.summary { + display:none; +} + +/* remove */ +div.contents hr { + display:none; +} + +/**** ****/ + +p, dl.warning, dl.attention, dl.note +{ + max-width:60em; + text-align:justify; +} + +li { + max-width:55em; + text-align:justify; +} + +img { + border: 0; +} + +div.fragment { + display:table; /* this allows the element to be larger than its parent */ + padding: 0pt; +} +pre.fragment { + border: 1px solid #cccccc; + + margin: 2px 0px 2px 0px; + padding: 3px 5px 3px 5px; +} + +/* Common style for all HDF5's tables */ + +table.example, table.manual, table.manual-vl, table.manual-hl { + max-width:100%; + border-collapse: collapse; + border-style: solid; + border-width: 1px; + border-color: #cccccc; + font-size: 1em; + + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +table.example th, table.manual th, table.manual-vl th, table.manual-hl th { + padding: 0.5em 0.5em 0.5em 0.5em; + text-align: left; + padding-right: 1em; + color: #555555; + background-color: #F4F4E5; + + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.3,#FFFFFF), color-stop(0.30,#FFFFFF), color-stop(0.98,#F4F4E5), to(#ECECDE)); + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 30%, #F4F4E5 98%, #ECECDE); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF', endColorstr='#F4F4E5'); +} + +table.example td, table.manual td, table.manual-vl td, table.manual-hl td { + vertical-align:top; + border-width: 1px; + border-color: #cccccc; +} + +/* header of headers */ +table th.meta { + text-align:center; + font-size: 1.2em; + background-color:#FFFFFF; +} + +/* intermediate header */ +table th.inter { + text-align:left; + background-color:#FFFFFF; + background-image:none; + border-style:solid solid solid solid; + border-width: 1px; + border-color: #cccccc; +} + +/** class for example / output tables **/ + +table.example { +} + +table.example th { +} + +table.example td { + padding: 0.5em 0.5em 0.5em 0.5em; + vertical-align:top; +} + +/* standard class for the manual */ + +table.manual, table.manual-vl, table.manual-hl { + padding: 0.2em 0em 0.5em 0em; +} + +table.manual th, table.manual-vl th, table.manual-hl th { + margin: 0em 0em 0.3em 0em; +} + +table.manual td, table.manual-vl td, table.manual-hl td { + padding: 0.3em 0.5em 0.3em 0.5em; + vertical-align:top; + border-width: 1px; +} + +table.manual td.alt, table.manual tr.alt, table.manual-vl td.alt, table.manual-vl tr.alt { + background-color: #F4F4E5; +} + +table.manual-vl th, table.manual-vl td, table.manual-vl td.alt { + border-color: #cccccc; + border-width: 1px; + border-style: none solid none solid; +} + +table.manual-vl th.inter { + border-style: solid solid solid solid; +} + +table.manual-hl td { + border-color: #cccccc; + border-width: 1px; + border-style: solid none solid none; +} + +table td.code { + font-family: monospace; +} + +h2 { + margin-top:2em; + border-style: none none solid none; + border-width: 1px; + border-color: #cccccc; +} + +/**** Table of content in the side-nav ****/ + + +div.toc { + margin:0; + padding: 0.3em 0 0 0; + width:100%; + float:none; + position:absolute; + bottom:0; + border-radius:0px; + border-style: solid none none none; + max-height:50%; + overflow-y: scroll; +} + +div.toc h3 { + margin-left: 0.5em; + margin-bottom: 0.2em; +} + +div.toc ul { + margin: 0.2em 0 0.4em 0.5em; +} + +span.cpp11,span.cpp14,span.cpp17 { + color: #119911; + font-weight: bold; +} + +.newin3x { + color: #a37c1a; + font-weight: bold; +} + +div.warningbox { + max-width:60em; + border-style: solid solid solid solid; + border-color: red; + border-width: 3px; +} + +/**** old HDF5's styles ****/ + + +table.tutorial_code td { + border-color: transparent; /* required for Firefox */ + padding: 3pt 5pt 3pt 5pt; + vertical-align: top; +} + + +/* Whenever doxygen meets a '\n' or a '
    ', it will put + * the text containing the character into a

    . + * This little hack together with table.tutorial_code td.note + * aims at fixing this issue. */ +table.tutorial_code td.note p.starttd { + margin: 0px; + border: none; + padding: 0px; +} + +div.eimainmenu { + text-align: center; +} + +/* center version number on main page */ +h3.version { + text-align: center; +} + + +td.width20em p.endtd { + width: 20em; +} + +/* needed for huge screens */ +.ui-resizable-e { + background-repeat: repeat-y; +} + +/* Style external links -- nav-tree is different */ + +#nav-tree .label a { + padding:2px 16px 2px 2px; +} + +a { + outline: none; + text-decoration: none; + padding: 2px 1px 0; +} + +a[href*="http"] { + background: url('https://mdn.mozillademos.org/files/12982/external-link-52.png') no-repeat 100% 0; + background-size: 12px 12px; + padding-right: 16px; +} diff --git a/doxygen/hdf5doxy_layout.xml b/doxygen/hdf5doxy_layout.xml new file mode 100644 index 0000000..7f71c24 --- /dev/null +++ b/doxygen/hdf5doxy_layout.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doxygen/img/FF-IH_FileGroup.gif b/doxygen/img/FF-IH_FileGroup.gif new file mode 100644 index 0000000..b0d76f5 Binary files /dev/null and b/doxygen/img/FF-IH_FileGroup.gif differ diff --git a/doxygen/img/FF-IH_FileObject.gif b/doxygen/img/FF-IH_FileObject.gif new file mode 100644 index 0000000..8eba623 Binary files /dev/null and b/doxygen/img/FF-IH_FileObject.gif differ diff --git a/doxygen/img/FileFormatSpecChunkDiagram.jpg b/doxygen/img/FileFormatSpecChunkDiagram.jpg new file mode 100644 index 0000000..03fd90a Binary files /dev/null and b/doxygen/img/FileFormatSpecChunkDiagram.jpg differ diff --git a/doxygen/img/HDFG-logo.png b/doxygen/img/HDFG-logo.png index a2d52a9..38300ff 100644 Binary files a/doxygen/img/HDFG-logo.png and b/doxygen/img/HDFG-logo.png differ diff --git a/doxygen/img/PaletteExample1.gif b/doxygen/img/PaletteExample1.gif new file mode 100644 index 0000000..8694d9d Binary files /dev/null and b/doxygen/img/PaletteExample1.gif differ diff --git a/doxygen/img/Palettes.fm.anc.gif b/doxygen/img/Palettes.fm.anc.gif new file mode 100644 index 0000000..d344c03 Binary files /dev/null and b/doxygen/img/Palettes.fm.anc.gif differ diff --git a/doxygen/img/ftv2node.png b/doxygen/img/ftv2node.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/doxygen/img/ftv2node.png differ diff --git a/doxygen/img/ftv2pnode.png b/doxygen/img/ftv2pnode.png new file mode 100644 index 0000000..c6ee22f Binary files /dev/null and b/doxygen/img/ftv2pnode.png differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c92bb2..74fd71f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1378,6 +1378,7 @@ if (DOXYGEN_FOUND) 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) # This configure and custom target work together # Replace variables inside @@ with the current values diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index e6cebff..f8f4f28 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -442,124 +442,347 @@ extern "C" { #define H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY 0 #define H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED 1 +/** + * H5AC_cache_config_t is a public structure intended for use in public APIs. + * At least in its initial incarnation, it is basically a copy of \c struct + * \c H5C_auto_size_ctl_t, minus the \c report_fcn field, and plus the + * \c dirty_bytes_threshold field. + * + * The \c report_fcn field is omitted, as including it would require us to make + * \c H5C_t structure public. + * + * The \c dirty_bytes_threshold field does not appear in \c H5C_auto_size_ctl_t, + * as synchronization between caches on different processes is handled at the \c + * H5AC level, not at the level of \c H5C. Note however that there is + * considerable interaction between this value and the other fields in this + * structure. + * + * Similarly, the \c open_trace_file, \c close_trace_file, and \c + * trace_file_name fields do not appear in \c H5C_auto_size_ctl_t, as most trace + * file issues are handled at the \c H5AC level. The one exception is storage + * of the pointer to the trace file, which is handled by \c H5C. + * + * The structure is in H5ACpublic.h as we may wish to allow different + * configuration options for metadata and raw data caches. + */ + +//! typedef struct H5AC_cache_config_t { /* general configuration fields: */ + //! int version; + /**< Integer field indicating the the version of the H5AC_cache_config_t + * in use. This field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION + * (defined in H5ACpublic.h). */ hbool_t rpt_fcn_enabled; + /**< Boolean flag indicating whether the adaptive cache resize report + * function is enabled. This field should almost always be set to disabled + * (0). Since resize algorithm activity is reported via stdout, it MUST be + * set to disabled (0) on Windows machines.\n + * The report function is not supported code, and can be expected to change + * between versions of the library. Use it at your own risk. */ hbool_t open_trace_file; + /**< Boolean field indicating whether the + * \ref H5AC_cache_config_t.trace_file_name "trace_file_name" + * field should be used to open a trace file for the cache.\n + * The trace file is a debugging feature that allows the capture + * of top level metadata cache requests for purposes of debugging + * and/or optimization. This field should normally be set to 0, as + * trace file collection imposes considerable overhead.\n + * This field should only be set to 1 when the + * \ref H5AC_cache_config_t.trace_file_name "trace_file_name" + * contains the full path of the desired trace file, and either + * there is no open trace file on the cache, or the + * \ref H5AC_cache_config_t.close_trace_file "close_trace_file" + * field is also 1.\n + * The trace file feature is unsupported unless used at the + * direction of The HDF Group. It is intended to allow The HDF + * Group to collect a trace of cache activity in cases of occult + * failures and/or poor performance seen in the field, so as to aid + * in reproduction in the lab. If you use it absent the direction + * of The HDF Group, you are on your own. */ + hbool_t close_trace_file; - char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1]; + /**< Boolean field indicating whether the current trace file + *(if any) should be closed.\n + * See the above comments on the \ref H5AC_cache_config_t.open_trace_file + * "open_trace_file" field. This field should be set to 0 unless there is + * an open trace file on the cache that you wish to close.\n + * The trace file feature is unsupported unless used at the direction of + * The HDF Group. It is intended to allow The HDF Group to collect a trace + * of cache activity in cases of occult failures and/or poor performance + * seen in the field, so as to aid in reproduction in the lab. If you use + * it absent the direction of The HDF Group, you are on your own. */ + + char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1]; + /**< Full path of the trace file to be opened if the + * \ref H5AC_cache_config_t.open_trace_file "open_trace_file" field is set + * to 1.\n + * In the parallel case, an ascii representation of the MPI rank of the + * process will be appended to the file name to yield a unique trace file + * name for each process.\n + * The length of the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN + * characters.\n + * The trace file feature is unsupported unless used at the direction of + * The HDF Group. It is intended to allow The HDF Group to collect a trace + * of cache activity in cases of occult failures and/or poor performance + * seen in the field, so as to aid in reproduction in the lab. If you use + * it absent the direction of The HDF Group, you are on your own. */ hbool_t evictions_enabled; + /**< A boolean flag indicating whether evictions from the metadata cache + * are enabled. This flag is initially set to enabled (1).\n + * In rare circumstances, the raw data throughput quirements may be so high + * that the user wishes to postpone metadata writes so as to reserve I/O + * throughput for raw data. The \p evictions_enabled field exists to allow + * this. However, this is an extreme step, and you have no business doing + * it unless you have read the User Guide section on metadata caching, and + * have considered all other options carefully.\n + * The \p evictions_enabled field may not be set to disabled (0) + * unless all adaptive cache resizing code is disabled via the + * \ref H5AC_cache_config_t.incr_mode "incr_mode", + * \ref H5AC_cache_config_t.flash_incr_mode "flash_incr_mode", + * \ref H5AC_cache_config_t.decr_mode "decr_mode" fields.\n + * When this flag is set to disabled (\c 0), the metadata cache will not + * attempt to evict entries to make space for new entries, and thus will + * grow without bound.\n + * Evictions will be re-enabled when this field is set back to \c 1. + * This should be done as soon as possible. */ hbool_t set_initial_size; - size_t initial_size; + /**< Boolean flag indicating whether the cache should be created + * with a user specified initial size. */ + + size_t initial_size; + /**< If \ref H5AC_cache_config_t.set_initial_size "set_initial_size" + * is set to 1, \p initial_size must contain he desired initial size in + * bytes. This value must lie in the closed interval + * [ \p min_size, \p max_size ]. (see below) */ double min_clean_fraction; + /**< This field specifies the minimum fraction of the cache + * that must be kept either clean or empty.\n + * The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to + * start in the serial case. In the parallel case, a larger value is needed + * -- see the overview of the metadata cache in the + * “Metadata Caching in HDF5” section of the -- HDF5 User’s Guide + * for details. */ size_t max_size; + /**< Upper bound (in bytes) on the range of values that the + * adaptive cache resize code can select as the maximum cache size. */ + size_t min_size; + /**< Lower bound (in bytes) on the range of values that the + * adaptive cache resize code can select as the mininum cache * size. */ long int epoch_length; + /**< Number of cache accesses between runs of the adaptive cache resize + * code. 50,000 is a good starting number. */ + //! /* size increase control fields: */ + //! enum H5C_cache_incr_mode incr_mode; + /**< Enumerated value indicating the operational mode of the automatic + * cache size increase code. At present, only two values listed in + * #H5C_cache_incr_mode are legal. */ double lower_hr_threshold; + /**< Hit rate threshold used by the hit rate threshold cache size + * increment algorithm.\n + * When the hit rate over an epoch is below this threshold and the cache + * is full, the maximum size of the cache is multiplied by increment + * (below), and then clipped as necessary to stay within \p max_size, and + * possibly \p max_increment.\n + * This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good + * place to start. */ double increment; + /**< Factor by which the hit rate threshold cache size increment + * algorithm multiplies the current cache max size to obtain a tentative + * new cache size.\n + * The actual cache size increase will be clipped to satisfy the \p max_size + * specified in the general configuration, and possibly max_increment + * below.\n + * The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable + * value.\n + * If you set it to 1.0, you will effectively disable cache size increases. + */ hbool_t apply_max_increment; - size_t max_increment; + /**< Boolean flag indicating whether an upper limit should be applied to + * the size of cache size increases. */ + + size_t max_increment; + /**< Maximum number of bytes by which cache size can be increased in a + * single step -- if applicable. */ enum H5C_cache_flash_incr_mode flash_incr_mode; - double flash_multiple; - double flash_threshold; + /**< Enumerated value indicating the operational mode of the flash cache + * size increase code. At present, only two listed values in + * #H5C_cache_flash_incr_mode are legal.*/ + + double flash_multiple; + /**< The factor by which the size of the triggering entry / entry size + * increase is multiplied to obtain the initial cache size increment. This + * increment may be reduced to reflect existing free space in the cache and + * the \p max_size field above.\n + * The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good + * place to start.\n + * At present, this field must lie in the range [0.1, 10.0]. */ + + double flash_threshold; + /**< The factor by which the current maximum cache size is multiplied to + * obtain the minimum size entry / entry size increase which may trigger a + * flash cache size increase. \n + * At present, this value must lie in the range [0.1, 1.0]. */ + //! /* size decrease control fields: */ + //! enum H5C_cache_decr_mode decr_mode; + /**< Enumerated value indicating the operational mode of the tomatic + * cache size decrease code. At present, the values listed in + * #H5C_cache_decr_mode are legal.*/ double upper_hr_threshold; + /**< Hit rate threshold for the hit rate threshold and ageout with hit + * rate threshold cache size decrement algorithms.\n + * When \p decr_mode is #H5C_decr__threshold, and the hit rate over a given + * epoch exceeds the supplied threshold, the current maximum cache + * size is multiplied by decrement to obtain a tentative new (and smaller) + * maximum cache size.\n + * When \p decr_mode is #H5C_decr__age_out_with_threshold, there is + * no attempt to find and evict aged out entries unless the hit rate in + * the previous epoch exceeded the supplied threshold.\n + * This field must lie in the interval [0.0, 1.0].\n + * For #H5C_incr__threshold, .9995 or .99995 is a good place to start.\n + * For #H5C_decr__age_out_with_threshold, .999 might be more useful.*/ double decrement; + /**< In the hit rate threshold cache size decrease algorithm, this + * parameter contains the factor by which the current max cache size is + * multiplied to produce a tentative new cache size.\n + * The actual cache size decrease will be clipped to satisfy the + * \ref H5AC_cache_config_t.min_size "min_size" specified in the general + * configuration, and possibly \ref H5AC_cache_config_t.max_decrement + * "max_decrement".\n + * The parameter must be be in the interval [0.0, 1.0].\n + * If you set it to 1.0, you will effectively + * disable cache size decreases. 0.9 is a reasonable starting point. */ hbool_t apply_max_decrement; - size_t max_decrement; + /**< Boolean flag indicating ether an upper limit should be applied to + * the size of cache size decreases. */ + + size_t max_decrement; + /**< Maximum number of bytes by which the maximum cache size can be + * decreased in any single step -- if applicable.*/ int epochs_before_eviction; + /**< In the ageout based cache size reduction algorithms, this field + * contains the minimum number of epochs an entry must remain unaccessed in + * cache before the cache size reduction algorithm tries to evict it. 3 is a + * reasonable value. */ hbool_t apply_empty_reserve; - double empty_reserve; + /**< Boolean flag indicating whether the ageout based decrement + * algorithms will maintain a empty reserve when decreasing cache size. */ + + double empty_reserve; + /**< Empty reserve as a fraction maximum cache size if applicable.\n When + * so directed, the ageout based algorithms will not decrease the maximum + * cache size unless the empty reserve can be met.\n The parameter must lie + * in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to start. */ + //! /* parallel configuration fields: */ + //! size_t dirty_bytes_threshold; - int metadata_write_strategy; - + /**< Threshold number of bytes of dirty metadata generation for + * triggering synchronizations of the metadata caches serving the target + * file in the parallel case.\n Synchronization occurs whenever the number + * of bytes of dirty metadata created since the last synchronization exceeds + * this limit.\n This field only applies to the parallel case. While it is + * ignored elsewhere, it can still draw a value out of bounds error.\n It + * must be consistant across all caches on any given file.\n By default, + * this field is set to 256 KB. It shouldn't be more than half the current + * max cache size times the min clean fraction. */ + + int metadata_write_strategy; + /**< Desired metadata write strategy. The valid values for this field + * are:\n #H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: Specifies tha only + * process zero is allowed to write dirty metadata to disk.\n + * #H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: Specifies that process zero + * still makes the decisions as to what entries should be flushed, but the + * actual flushes are distributed across the processes in the computation to + * the extent possible.\n The src/H5ACpublic.h include file in the HDF5 + * library has detailed information on each strategy. */ + //! } H5AC_cache_config_t; - -/**************************************************************************** - * - * structure H5AC_cache_image_config_t - * - * H5AC_cache_image_ctl_t is a public structure intended for use in public - * APIs. At least in its initial incarnation, it is a copy of struct - * H5C_cache_image_ctl_t. - * - * The fields of the structure are discussed individually below: - * - * version: Integer field containing the version number of this version - * of the H5C_image_ctl_t structure. Any instance of - * H5C_image_ctl_t passed to the cache must have a known - * version number, or an error will be flagged. - * - * generate_image: Boolean flag indicating whether a cache image should - * be created on file close. - * - * save_resize_status: Boolean flag indicating whether the cache image - * should include the adaptive cache resize configuration and status. - * Note that this field is ignored at present. - * - * entry_ageout: Integer field indicating the maximum number of - * times a prefetched entry can appear in subsequent cache images. - * This field exists to allow the user to avoid the buildup of - * infrequently used entries in long sequences of cache images. - * - * The value of this field must lie in the range - * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to - * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100). - * - * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit - * is imposed on number of times a prefeteched entry can appear - * in subsequent cache images. - * - * A value of 0 prevents prefetched entries from being included - * in cache images. - * - * Positive integers restrict prefetched entries to the specified - * number of appearances. - * - * Note that the number of subsequent cache images that a prefetched - * entry has appeared in is tracked in an 8 bit field. Thus, while - * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its - * current value, any value in excess of 255 will be the functional - * equivalent of H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. - * - ****************************************************************************/ +//! #define H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION 1 #define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE -1 #define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX 100 +//! +/** + * H5AC_cache_image_config_t is a public structure intended for use in public + * APIs. At least in its initial incarnation, it is a copy of \c struct \c + * H5C_cache_image_ctl_t. + */ + typedef struct H5AC_cache_image_config_t { - int version; + int version; + /**< Integer field containing the version number of this version of the \c + * H5C_image_ctl_t structure. Any instance of \c H5C_image_ctl_t passed + * to the cache must have a known version number, or an error will be + * flagged. + */ hbool_t generate_image; + /**< Boolean flag indicating whether a cache image should be created on file + * close. + */ hbool_t save_resize_status; - int entry_ageout; + /**< Boolean flag indicating whether the cache image should include the + * adaptive cache resize configuration and status. Note that this field + * is ignored at present. + */ + int entry_ageout; + /**< Integer field indicating the maximum number of times a + * prefetched entry can appear in subsequent cache images. This field + * exists to allow the user to avoid the buildup of infrequently used + * entries in long sequences of cache images. + * + * The value of this field must lie in the range \ref + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to \ref + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100). + * + * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit is + * imposed on number of times a prefeteched entry can appear in subsequent + * cache images. + * + * A value of 0 prevents prefetched entries from being included in cache + * images. + * + * Positive integers restrict prefetched entries to the specified number + * of appearances. + * + * Note that the number of subsequent cache images that a prefetched entry + * has appeared in is tracked in an 8 bit field. Thus, while \ref + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its current + * value, any value in excess of 255 will be the functional equivalent of + * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. + */ } H5AC_cache_image_config_t; +//! + #ifdef __cplusplus } #endif diff --git a/src/H5Amodule.h b/src/H5Amodule.h index 45172bf..c89c93f 100644 --- a/src/H5Amodule.h +++ b/src/H5Amodule.h @@ -30,19 +30,39 @@ #define H5_MY_PKG_INIT YES /**\defgroup H5A H5A - * \brief Attribute Interface * - * \details The Attribute Interface, H5A, provides a mechanism for attaching - * additional information to a dataset, group, or named datatype. + * Use the functions in this module to manage HDF5 attributes. * - * 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. + * The Attribute Interface, H5A, provides a mechanism for attaching additional + * information to a dataset, group, or named datatype. * - * 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. + * 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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet H5A_examples.c create + * + * \snippet H5A_examples.c read + *
    UpdateDelete
    + * \snippet H5A_examples.c update + * + * \snippet H5A_examples.c delete + *
    * */ diff --git a/src/H5Apublic.h b/src/H5Apublic.h index 68d8a8a..2d58cdf 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -22,19 +22,40 @@ #include "H5Opublic.h" /* Object Headers */ #include "H5Tpublic.h" /* Datatypes */ -/* Information struct for attribute (for H5Aget_info/H5Aget_info_by_idx) */ -//! [H5A_info_t_snip] +//! +/** + * Information struct for H5Aget_info() / H5Aget_info_by_idx() + */ typedef struct { - hbool_t corder_valid; /* Indicate if creation order is valid */ - H5O_msg_crt_idx_t corder; /* Creation order */ - H5T_cset_t cset; /* Character set of attribute name */ - hsize_t data_size; /* Size of raw data */ + hbool_t corder_valid; /**< Indicate if creation order is valid */ + H5O_msg_crt_idx_t corder; /**< Creation order */ + H5T_cset_t cset; /**< Character set of attribute name */ + hsize_t data_size; /**< Size of raw data */ } H5A_info_t; -//! [H5A_info_t_snip] +//! -/* Typedef for H5Aiterate2() callbacks */ +//! +/** + * Typedef for H5Aiterate2() / H5Aiterate_by_name() callbacks + * \param[in] location_id The identifier for the group, dataset + * or named datatype being iterated over + * \param[in] attr_name The name of the current object attribute + * \param[in] ainfo The attribute’s info struct + * \param[in,out] op_data A pointer to the operator data passed in to + * H5Aiterate2() or H5Aiterate_by_name() + * \returns The return values from an operator are: + * \li Zero causes the iterator to continue, returning zero when + * all attributes have been processed. + * \li Positive causes the iterator to immediately return that + * positive value, indicating short-circuit success. The + * iterator can be restarted at the next attribute. + * \li Negative causes the iterator to immediately return that value, + * indicating failure. The iterator can be restarted at the next + * attribute. + */ typedef herr_t (*H5A_operator2_t)(hid_t location_id /*in*/, const char *attr_name /*in*/, const H5A_info_t *ainfo /*in*/, void *op_data /*in,out*/); +//! /********************/ /* Public Variables */ @@ -105,8 +126,8 @@ H5_DLL herr_t H5Aclose(hid_t attr_id); * The attribute identifier returned by this function must be released * with H5Aclose() resource leaks will develop. * - * \note The \p acpl and \p aapl parameters are currently not used; specify - * #H5P_DEFAULT. + * \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. * @@ -117,6 +138,11 @@ H5_DLL herr_t H5Aclose(hid_t attr_id); */ H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Acreate} + */ H5_DLL hid_t H5Acreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t es_id); @@ -659,30 +685,12 @@ 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. * - * The #H5A_operator2_t prototype for the \p op parameter is a - * user defined function where: - * The operation receives the location identifier for the group or - * dataset being iterated over, \p location_id; the name of the - * current object attribute, \p attr_name; the attribute’s info - * struct, \p ainfo; and a pointer to the operator data passed - * into H5Aiterate2(), \p op_data. - * - * Valid return values from an operator and the resulting - * H5Aiterate2() 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. + * \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. - * \todo Add snippet for H5A_operator2_t * * \since 1.8.0 * @@ -751,13 +759,10 @@ 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. * - * The #H5A_operator2_t prototype for the \p op parameter is a - * user defined function where: - * The operation receives the location identifier for the group or - * dataset being iterated over, \p location_id; the name of the - * current object attribute, \p attr_name; the attribute’s info - * struct, \p ainfo; and a pointer to the operator data passed - * into H5Aiterate_by_name(), \p op_data. + * \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: @@ -777,17 +782,21 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord * information regarding the properties of links required to access * the object, \p obj_name. * - * \todo Add snippet to show H5Aoperator2_t. * \since 1.8.0 * */ H5_DLL 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, H5A_operator2_t op, void *op_data, hid_t lapl_id); -H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app_line, - hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, - hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id, - hid_t es_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Acreate_by_name} + */ +H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app_line, + hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, + hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id, + hid_t es_id); /*--------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -819,6 +828,11 @@ H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func * \see H5Aclose(), H5Acreate() */ H5_DLL hid_t H5Aopen(hid_t obj_id, const char *attr_name, hid_t aapl_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aopen} + */ H5_DLL hid_t H5Aopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, const char *attr_name, hid_t aapl_id, hid_t es_id); /*--------------------------------------------------------------------------*/ @@ -868,6 +882,11 @@ H5_DLL hid_t H5Aopen_async(const char *app_file, const char *app_func, unsigned */ H5_DLL hid_t H5Aopen_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 aapl_id, hid_t lapl_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aopen_by_idx} + */ H5_DLL hid_t H5Aopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id, hid_t es_id); @@ -914,6 +933,11 @@ H5_DLL hid_t H5Aopen_by_idx_async(const char *app_file, const char *app_func, un */ H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aopen_by_name} + */ H5_DLL hid_t H5Aopen_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id, hid_t es_id); @@ -967,6 +991,11 @@ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf); * */ H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aread} + */ H5_DLL 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); /*--------------------------------------------------------------------------*/ @@ -1001,15 +1030,40 @@ H5_DLL herr_t H5Aread_async(const char *app_file, const char *app_func, unsigned * */ H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Awrite} + */ H5_DLL herr_t H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, hid_t type_id, const void *buf, hid_t es_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Arename} + */ H5_DLL herr_t H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *old_name, const char *new_name, hid_t es_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Arename_by_name} + */ H5_DLL herr_t H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name, hid_t lapl_id, hid_t es_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aexists} + */ H5_DLL herr_t H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, const char *attr_name, hbool_t *exists, hid_t es_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aexists_by_name} + */ H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, const char *attr_name, hbool_t *exists, hid_t lapl_id, hid_t es_id); @@ -1038,6 +1092,11 @@ H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func */ 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); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aclose} + */ H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, hid_t es_id); @@ -1085,9 +1144,28 @@ H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigne /* Typedefs */ -/* Typedef for H5Aiterate1() callbacks */ +//! +/** + * \brief Typedef for H5Aiterate1() callbacks + * + * \param[in] location_id The identifier for the group, dataset + * or named datatype being iterated over + * \param[in] attr_name The name of the current object attribute + * \param[in,out] operator_data A pointer to the operator data passed in to + * H5Aiterate1() + * \returns The return values from an operator are: + * \li Zero causes the iterator to continue, returning zero when + * all attributes have been processed. + * \li Positive causes the iterator to immediately return that + * positive value, indicating short-circuit success. The + * iterator can be restarted at the next attribute. + * \li Negative causes the iterator to immediately return that value, + * indicating failure. The iterator can be restarted at the next + * attribute. + */ typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_name /*in*/, void *operator_data /*in,out*/); +//! /* Function prototypes */ /* --------------------------------------------------------------------------*/ @@ -1163,8 +1241,6 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id); * * \brief Calls a user’s function for each attribute on an object * - * \todo make prototype parameter match function (idx vs attr_num) - * * \loc_id * \param[in,out] idx Starting (in) and ending (out) attribute index * \param[in] op User's function to pass each attribute to @@ -1186,29 +1262,12 @@ 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. * - * The prototype for #H5A_operator1_t is a user defined function - * where: - * The operation receives the identifier for the group, dataset - * or named datatype being iterated over, \p loc_id, the name of - * the current object attribute, \p attr_name, and the pointer to - * the operator data passed in to H5Aiterate1(), \p op_data. - * - * The return values from an operator are: - * - * \li Zero causes the iterator to continue, returning zero when - * all attributes have been processed. - * \li Positive causes the iterator to immediately return that - * positive value, indicating short-circuit success. The - * iterator can be restarted at the next attribute. - * \li Negative causes the iterator to immediately return that value, - * indicating failure. The iterator can be restarted at the next - * attribute. - * - * \todo Add snippet to show H5A_operator1_t. + * \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 * */ diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h index 0e6fb84..79ece10 100644 --- a/src/H5Cpublic.h +++ b/src/H5Cpublic.h @@ -31,15 +31,34 @@ extern "C" { #endif -enum H5C_cache_incr_mode { H5C_incr__off, H5C_incr__threshold }; +enum H5C_cache_incr_mode { + H5C_incr__off, + /** + *

    CreateRead
    + * \snippet H5D_examples.c create + * + * \snippet H5D_examples.c read + *
    UpdateDelete
    + * \snippet H5D_examples.c update + * + * \snippet H5D_examples.c delete + *
    * - * A Dataset is used by other HDF5 APIs, either by name or by a handle, - * which is obtained by either creating or opening the dataset. */ #endif /* H5Dmodule_H */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index ce4ce84..608025a 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -39,30 +39,41 @@ /* Public Typedefs */ /*******************/ -/* Values for the H5D_LAYOUT property */ +//! +/** + * 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_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_t; +//! -/* Types of chunk index data structures */ +//! +/** + * Types of chunk index data structures + */ typedef enum H5D_chunk_index_t { - H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index (default) */ + H5D_CHUNK_IDX_BTREE = 0, /**< v1 B-tree index (default) */ H5D_CHUNK_IDX_SINGLE = - 1, /* Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */ - H5D_CHUNK_IDX_NONE = 2, /* Implicit: No Index (H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims) */ - H5D_CHUNK_IDX_FARRAY = 3, /* Fixed array (for 0 unlimited dims) */ - H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */ - H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */ - H5D_CHUNK_IDX_NTYPES /* This one must be last! */ + 1, /**< Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */ + H5D_CHUNK_IDX_NONE = 2, /**< Implicit: No Index (#H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims) */ + H5D_CHUNK_IDX_FARRAY = 3, /**< Fixed array (for 0 unlimited dims) */ + H5D_CHUNK_IDX_EARRAY = 4, /**< Extensible array (for 1 unlimited dim) */ + H5D_CHUNK_IDX_BT2 = 5, /**< v2 B-tree index (for >1 unlimited dims) */ + H5D_CHUNK_IDX_NTYPES /**< This one must be last! */ } H5D_chunk_index_t; +//! -/* Values for the space allocation time property */ +//! +/** + * Values for the space allocation time property + */ typedef enum H5D_alloc_time_t { H5D_ALLOC_TIME_ERROR = -1, H5D_ALLOC_TIME_DEFAULT = 0, @@ -70,57 +81,84 @@ typedef enum H5D_alloc_time_t { H5D_ALLOC_TIME_LATE = 2, H5D_ALLOC_TIME_INCR = 3 } H5D_alloc_time_t; +//! -/* Values for the status of space allocation */ +//! +/** + * 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_t; +//! -/* Values for time of writing fill value property */ +//! +/** + * 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_t; +//! -/* Values for fill value status */ +//! +/** + * 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_t; +//! -/* Values for VDS bounds option */ +//! +/** + * 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_view_t; +//! -/* Callback for H5Pset_append_flush() in a dataset access property list */ +//! +/** + * Callback for H5Pset_append_flush() in a dataset access property list + */ typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_data); +//! -/** Define the operator function pointer for H5Diterate() */ -//! [H5D_operator_t_snip] +//! +/** + * Define the operator function pointer for H5Diterate() + */ typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); -//! [H5D_operator_t_snip] +//! -/** Define the operator function pointer for H5Dscatter() */ -//! [H5D_scatter_func_t_snip] +//! +/** + * Define the operator function pointer for H5Dscatter() + */ typedef herr_t (*H5D_scatter_func_t)(const void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/, void *op_data); -//! [H5D_scatter_func_t_snip] +//! -/** Define the operator function pointer for H5Dgather() */ -//! [H5D_gather_func_t_snip] +//! +/** + * Define the operator function pointer for H5Dgather() + */ 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] +//! /********************/ /* Public Variables */ @@ -203,26 +241,8 @@ H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t spa /** * -------------------------------------------------------------------------- - * \ingroup H5D - * - * \brief Asynchronous version of H5Dcreate2() - * - * \app_file - * \app_func - * \app_line - * \fgdta_loc_id - * \param[in] name Name of the dataset to create - * \type_id - * \space_id - * \lcpl_id - * \dcpl_id - * \dapl_id - * \es_id - * - * \return \hid_t{dataset} - * - * \see H5Dcreate2() - * + * \ingroup ASYNC + * \async_variant_of{H5Dcreate} */ H5_DLL hid_t H5Dcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, @@ -325,22 +345,8 @@ H5_DLL hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id); /** * -------------------------------------------------------------------------- - * \ingroup H5D - * - * \brief Asynchronous version of H5Dopen2() - * - * \app_file - * \app_func - * \app_line - * \fgdta_loc_id - * \param[in] name Name of the dataset to open - * \dapl_id - * \es_id - * - * \return \hid_t{dataset} - * - * \see H5Dopen2() - * + * \ingroup ASYNC + * \async_variant_of{H5Dopen} */ H5_DLL hid_t H5Dopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t dapl_id, hid_t es_id); @@ -370,24 +376,17 @@ H5_DLL hid_t H5Dget_space(hid_t dset_id); /** * -------------------------------------------------------------------------- - * \ingroup H5D - * - * \brief Asynchronous version of H5Dget_space() - * - * \app_file - * \app_func - * \app_line - * \dset_id - * \es_id - * - * \return \hid_t{dataspace} - * - * \see H5Dget_space() - * + * \ingroup ASYNC + * \async_variant_of{H5Dget_space} */ H5_DLL hid_t H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, hid_t es_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * \todo Document this function! + */ H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation); /** @@ -614,7 +613,7 @@ H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks * using the coordinates specified by \p offset. * * If the queried chunk does not exist in the file, \p size will - * be set to 0, \p addr to #HADDR_UNDEF, and the buffer \p + * be set to 0, \p addr to \c HADDR_UNDEF, and the buffer \p * filter_mask will not be modified. * * \p offset is a pointer to a one-dimensional array with a size @@ -649,7 +648,7 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u * specified by the index index. The chunk belongs to a set of * chunks in the selection specified by fspace_id. If the queried * chunk does not exist in the file, the size will be set to 0 and - * address to #HADDR_UNDEF. The value pointed to by filter_mask will + * 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. * * \p chk_idx is the chunk index in the selection. Index value @@ -684,7 +683,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 #HADDR_UNDEF, + * \return Returns the offset in bytes; otherwise, returns \c HADDR_UNDEF, * a negative value. * * \details H5Dget_offset() returns the address in the file of @@ -795,25 +794,8 @@ H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_ /** * -------------------------------------------------------------------------- - * \ingroup H5D - * - * \brief Asynchronous version of H5Dread() - * - * \app_file - * \app_func - * \app_line - * \dset_id Identifier of the dataset to read from - * \param[in] mem_type_id Identifier of the memory datatype - * \param[in] mem_space_id Identifier of the memory dataspace - * \param[in] file_space_id Identifier of the dataset's dataspace in the file - * \param[in] dxpl_id Identifier of a transfer property list - * \param[out] buf Buffer to receive data read from file - * \es_id - * - * \return \herr_t - * - * \see H5Dread() - * + * \ingroup ASYNC + * \async_variant_of{H5Dread} */ H5_DLL herr_t H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, @@ -932,25 +914,8 @@ H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid /** * -------------------------------------------------------------------------- - * \ingroup H5D - * - * \brief Asynchronous version of H5Dwrite() - * - * \app_file - * \app_func - * \app_line - * \param[in] dset_id Identifier of the dataset to read from - * \param[in] mem_type_id Identifier of the memory datatype - * \param[in] mem_space_id Identifier of the memory dataspace - * \param[in] file_space_id Identifier of the dataset's dataspace in the file - * \dxpl_id - * \param[out] buf Buffer with data to be written to the file - * \es_id - * - * \return \herr_t - * - * \see H5Dwrite() - * + * \ingroup ASYNC + * \async_variant_of{H5Dwrite} */ H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, @@ -1292,22 +1257,8 @@ H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]); /** * -------------------------------------------------------------------------- - * \ingroup H5D - * - * \brief Asynchronous version of H5Dset_extent() - * - * \app_file - * \app_func - * \app_line - * \dset_id - * \param[in] size[] Array containing the new magnitude of each dimension - * of the dataset - * \es_id - * - * \return \herr_t - * - * \see H5Dset_extent() - * + * \ingroup ASYNC + * \async_variant_of{H5Dset_extent} */ H5_DLL herr_t H5Dset_extent_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, const hsize_t size[], hid_t es_id); @@ -1536,20 +1487,8 @@ H5_DLL herr_t H5Dclose(hid_t dset_id); /** * -------------------------------------------------------------------------- - * \ingroup H5D - * - * \brief Asynchronous version of H5Dclose() - * - * \app_file - * \app_func - * \app_line - * \dset_id - * \es_id - * - * \return \herr_t - * - * \see H5Dclose() - * + * \ingroup ASYNC + * \async_variant_of{H5Dclose} */ 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); @@ -1608,9 +1547,181 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); /* Typedefs */ /* Function prototypes */ -H5_DLL hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id); -H5_DLL hid_t H5Dopen1(hid_t loc_id, const char *name); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Creates a dataset at the specified location + * + * \fgdta_loc_id + * \param[in] name Name of the dataset to create + * \type_id + * \space_id + * \dcpl_id + * + * \return \hid_t{dataset} + * + * \deprecated This function is deprecated in favor of the function 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 + * file, group, dataset, named datatype or attribute. If an attribute, + * dataset, or named datatype is specified for \p loc_id then the + * dataset will be created at the location where the attribute, + * dataset, or named datatype is attached. + * + * \p name can be a relative path based at \p loc_id or an absolute + * path from the root of the file. Use of this function requires that + * any intermediate groups specified in the path already exist. + * + * The dataset’s datatype and dataspace are specified by \p type_id and + * \p space_id, respectively. These are the datatype and dataspace of + * the dataset as it will exist in the file, which may differ from the + * datatype and dataspace in application memory. + * + * Names within a group are unique: H5Dcreate1() will return an error + * if a link with the name specified in name already exists at the + * location specified in \p loc_id. + * + * As is the case for any object in a group, the length of a dataset + * name is not limited. + * + * \p dcpl_id is an #H5P_DATASET_CREATE property list created with \p + * H5reate1() and initialized with various property list functions + * described in Property List Interface. + * + * H5Dcreate() and H5Dcreate_anon() return an error if the dataset’s + * datatype includes a variable-length (VL) datatype and the fill value + * is undefined, i.e., set to \c NULL in the dataset creation property + * list. Such a VL datatype may be directly included, indirectly + * included as part of a compound or array datatype, or indirectly + * included as part of a nested compound or array datatype. + * + * H5Dcreate() and H5Dcreate_anon() return a dataset identifier for + * success or a negative value for failure. The dataset identifier + * should eventually be closed by calling H5Dclose() to release + * resources it uses. + * + * See H5Dcreate_anon() for discussion of the differences between + * H5Dcreate() and H5Dcreate_anon(). + * + * The HDF5 library provides flexible means of specifying a fill value, + * of specifying when space will be allocated for a dataset, and of + * specifying when fill values will be written to a dataset. + * + * \version 1.8.0 Function H5Dcreate() renamed to H5Dcreate1() and deprecated in this release. + * \since 1.0.0 + * + * \see H5Dopen2(), H5Dclose(), H5Tset_size() + * + */ +H5_DLL hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Opens an existing dataset + * + * \fgdta_loc_id + * \param[in] name Name of the dataset to access + * + * \return \hid_t{dataset} + * + * \deprecated This function is deprecated in favor of the function 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, + * named datatype or attribute. If an attribute, dataset, or named + * datatype is specified for loc_id then the dataset will be opened at + * the location where the attribute, dataset, or named datatype is + * attached. name is a dataset name and is used to identify the dataset + * in the file. + * + * A dataset opened with this function should be closed with H5Dclose() + * when the dataset is no longer needed so that resource leaks will not + * develop. + * + * \version 1.8.0 Function H5Dopen() renamed to H5Dopen1() and deprecated in this release. + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Dopen1(hid_t loc_id, const char *name); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Extends a dataset + * + * \dset_id + * \param[in] size Array containing the new size of each dimension + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function 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 + * that of the dataspace of the dataset being changed. + * + * This function can be applied to the following datasets: + * \li Any dataset with unlimited dimensions + * \li A dataset with fixed dimensions if the current dimension sizes + * are less than the maximum sizes set with \c maxdims + * (see H5Screate_simple()) + * + * Space on disk is immediately allocated for the new dataset extent if + * the dataset’s space allocation time is set to + * #H5D_ALLOC_TIME_EARLY. Fill values will be written to the dataset if + * the dataset’s fill time is set to #H5D_FILL_TIME_IFSET or + * #H5D_FILL_TIME_ALLOC. (See H5Pset_fill_time() and + * H5Pset_alloc_time().) + * + * This function ensures that the dataset dimensions are of at least + * 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 + * syntax changed to \Code{const hsize_t size[]} in this release. + * + */ H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t size[]); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Reclaims variable-length (VL) datatype memory buffers + * + * \type_id + * \space_id + * \dxpl_id + * \param[in] buf Pointer to the buffer to be reclaimed + * + * \return \herr_t + * + * \deprecated This function has been deprecated in HDF5-1.12 in favor of the + * function H5Treclaim(). + * + * \details H5Dvlen_reclaim() reclaims memory buffers created to store VL + * datatypes. + * + * The \p type_id must be the datatype stored in the buffer. The \p + * space_id describes the selection for the memory buffer to free the + * VL datatypes within. The \p dxpl_id is the dataset transfer property + * list which was used for the I/O transfer to create the buffer. And + * \p buf is the pointer to the buffer to be reclaimed. + * + * The VL structures (\ref hvl_t) in the user's buffer are modified to + * zero out the VL information after the memory has been reclaimed. + * + * If nested VL datatypes were used to create the buffer, this routine + * frees them from the bottom up, releasing all the memory without + * creating memory leaks. + * + * \version 1.12.0 Routine was deprecated + * + */ H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5ESmodule.h b/src/H5ESmodule.h index ea9fd7a..cbc812e 100644 --- a/src/H5ESmodule.h +++ b/src/H5ESmodule.h @@ -29,4 +29,37 @@ #define H5_MY_PKG_ERR H5E_EVENTSET #define H5_MY_PKG_INIT YES +/** + * \defgroup H5ES H5ES + * \brief Event Set Interface + * + * \details \Bold{This interface can be only used with the HDF5 VOL connectors that + * enable the asynchronous feature in HDF5.} The native HDF5 library has + * only synchronous operations. + * + * HDF5 VOL connectors with support for asynchronous operations: + * - ASYNC + * - DAOS + * + * \par Example: + * \code + * fid = H5Fopen(..); + * gid = H5Gopen(fid, ..); //Starts when H5Fopen completes + * did = H5Dopen(gid, ..); //Starts when H5Gopen completes + * + * es_id = H5EScreate(); // Create event set for tracking async operations + * status = H5Dwrite_async(did, .., es_id); //Asynchronous, starts when H5Dopen completes, + * // may run concurrently with other H5Dwrite_async + * // in event set. + * status = H5Dwrite_async(did, .., es_id); //Asynchronous, starts when H5Dopen completes, + * // may run concurrently with other H5Dwrite_async + * // in event set.... + * + * ... + * H5ESwait(es_id); // Wait for operations in event set to complete, buffers + * // used for H5Dwrite_async must only be changed after wait + * // returns. + * \endcode + */ + #endif /* H5ESmodule_H */ diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h index 752218b..a7c2e58 100644 --- a/src/H5ESpublic.h +++ b/src/H5ESpublic.h @@ -47,20 +47,24 @@ typedef enum H5ES_status_t { H5ES_STATUS_FAIL /* An operation has completed, but failed */ } H5ES_status_t; -/* Information about failed operations in event set */ +//! +/** + * 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 */ - 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 */ + char * api_name; /**< Name of HDF5 API routine called */ + char * api_args; /**< "Argument string" for arguments to HDF5 API routine called */ + 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 */ /* Error info */ - hid_t err_stack_id; /* ID for error stack from failed operation */ + hid_t err_stack_id; /**< ID for error stack from failed operation */ } H5ES_err_info_t; +//! /* H5ES_op_info_t: @@ -119,14 +123,157 @@ How to Trace Async Operations? extern "C" { #endif -H5_DLL hid_t H5EScreate(void); +/** + * \ingroup H5ES + * + * \brief Creates an event set + * + * \returns \hid_ti{event set} + * + * \details H5EScreate() creates a new event set and returns a corresponding + * event set identifier. + * + * \since 1.13.0 + * + */ +H5_DLL hid_t H5EScreate(void); + +/** + * \ingroup H5ES + * + * \brief Waits for operations in event set to complete + * + * \es_id + * \param[in] timeout Total time in nanoseconds to wait for all operations in + * the event set to complete + * \param[out] num_in_progress The number of operations still in progress + * \param[out] err_occurred Flag if an operation in the event set failed + * \returns \herr_t + * + * \details H5ESwait() waits for operations in an event set \p es_id to wait + * with \p timeout. + * + * Timeout value is in nanoseconds, and is for the H5ESwait() call and + * not for each individual operation in the event set. For example, if + * "10" is passed as a timeout value and the event set waited 4 + * nanoseconds for the first operation to complete, the remaining + * operations would be allowed to wait for at most 6 nanoseconds more, + * i.e., the timeout value used across all operations in the event set + * until it reaches 0, then any remaining operations are only checked + * for completion, not waited on. + * + * This call will stop waiting on operations and will return + * immediately if an operation fails. If a failure occurs, the value + * returned for the number of operations in progress may be inaccurate. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress, hbool_t *err_occurred); + +/** + * \ingroup H5ES + * + * \brief Retrieves number of events in an event set + * + * \es_id + * \param[out] count The number of events in the event set + * \returns \herr_t + * + * \details H5ESget_count() retrieves number of events in an event set specified + * by \p es_id. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5ESget_count(hid_t es_id, size_t *count); + +/** + * \ingroup H5ES + * + * \todo Fill in the blanks! + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5ESget_op_counter(hid_t es_id, uint64_t *counter); + +/** + * \ingroup H5ES + * + * \brief Checks for failed operations + * + * \es_id + * \param[out] err_occurred Status indicating if error is present in the event + * set + * \returns \herr_t + * + * \details H5ESget_err_status() checks if event set specified by es_id has + * failed operations. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5ESget_err_status(hid_t es_id, hbool_t *err_occurred); + +/** + * \ingroup H5ES + * + * \brief Retrieves the number of failed operations + * + * \es_id + * \param[out] num_errs Number of errors + * \returns \herr_t + * + * \details H5ESget_err_count() retrieves the number of failed operations in an + * event set specified by \p es_id. + * + * The function does not wait for active operations to complete, so + * count may not include all failures. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5ESget_err_count(hid_t es_id, size_t *num_errs); + +/** + * \ingroup H5ES + * + * \brief Retrieves information about failed operations + * + * \es_id + * \param[in] num_err_info The number of elements in \p err_info array + * \param[out] err_info Array of structures + * \param[out] err_cleared Number of cleared errors + * \returns \herr_t + * + * \details H5ESget_err_info() retrieves information about failed operations in + * an event set specified by \p es_id. The strings retrieved for each + * error info must be released by calling H5free_memory(). + * + * Below is the description of the \ref H5ES_err_info_t structure: + * \snippet this H5ES_err_info_t_snip + * \click4more + * + * \since 1.13.0 + * + */ 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); + +/** + * \ingroup H5ES + * + * \brief Terminates access to an event set + * + * \es_id + * \returns \herr_t + * + * \details H5ESclose() terminates access to an event set specified by \p es_id. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5ESclose(hid_t es_id); #ifdef __cplusplus diff --git a/src/H5Emodule.h b/src/H5Emodule.h index 1670c03..43d5d36 100644 --- a/src/H5Emodule.h +++ b/src/H5Emodule.h @@ -29,4 +29,33 @@ #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. + */ + #endif /* H5Emodule_H */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index a2554d5..20a2107 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -26,18 +26,29 @@ /* Value for the default error stack */ #define H5E_DEFAULT (hid_t)0 -/* Different kinds of error information */ +/** + * Different kinds of error information + */ typedef enum H5E_type_t { H5E_MAJOR, H5E_MINOR } H5E_type_t; -/* Information about an error; element of error stack */ +/** + * Information about an error; element of error stack + */ typedef struct H5E_error2_t { - hid_t cls_id; /*class ID */ - hid_t maj_num; /*major error ID */ - hid_t min_num; /*minor error number */ - unsigned line; /*line in file where error occurs */ - const char *func_name; /*function in which error occurred */ - const char *file_name; /*file in which error occurred */ - const char *desc; /*optional supplied description */ + hid_t cls_id; + /**< Class ID */ + hid_t maj_num; + /**< Major error ID */ + hid_t min_num; + /**< Minor error number */ + unsigned line; + /**< Line in file where error occurs */ + const char *func_name; + /**< Function in which error occurred */ + const char *file_name; + /**< File in which error occurred */ + const char *desc; + /**< Optional supplied description */ } H5E_error2_t; /* When this header is included from a private header, don't make calls to H5open() */ @@ -138,10 +149,12 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; goto label; \ } -/* Error stack traversal direction */ +/** + * Error stack traversal direction + */ typedef enum H5E_direction_t { - H5E_WALK_UPWARD = 0, /*begin deep, end at API function */ - H5E_WALK_DOWNWARD = 1 /*begin at API function, end deep */ + H5E_WALK_UPWARD = 0, /**< begin w/ most specific error, end at API function */ + H5E_WALK_DOWNWARD = 1 /**< begin at API function, end w/ most specific error */ } H5E_direction_t; #ifdef __cplusplus @@ -149,30 +162,498 @@ extern "C" { #endif /* Error stack traversal callback function pointers */ +//! +/** + * \brief Callback function for H5Ewalk2() + * + * \param[in] n Indexed error position in the stack + * \param[in] err_desc Pointer to a data structure describing the error + * \param[in] client_data Pointer to client data in the format expected by the + * user-defined function + * \return \herr_t + */ typedef herr_t (*H5E_walk2_t)(unsigned n, const H5E_error2_t *err_desc, void *client_data); +//! + +//! +/** + * \brief Callback function for H5Eset_auto2() + * + * \estack_id{estack} + * \param[in] client_data Pointer to client data in the format expected by the + * user-defined function + * \return \herr_t + */ typedef herr_t (*H5E_auto2_t)(hid_t estack, void *client_data); +//! /* Public API functions */ -H5_DLL hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version); -H5_DLL herr_t H5Eunregister_class(hid_t class_id); -H5_DLL herr_t H5Eclose_msg(hid_t err_id); -H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg); -H5_DLL hid_t H5Ecreate_stack(void); -H5_DLL hid_t H5Eget_current_stack(void); -H5_DLL herr_t H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack); -H5_DLL herr_t H5Eclose_stack(hid_t stack_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Registers a client library or application program to the HDF5 error API + * + * \param[in] cls_name Name of the error class + * \param[in] lib_name Name of the client library or application to which the error class belongs + * \param[in] version Version of the client library or application to which the + error class belongs. Can be \c NULL. + * \return Returns a class identifier on success; otherwise returns H5I_INVALID_ID. + * + * \details H5Eregister_class() registers a client library or application + * program to the HDF5 error API so that the client library or + * application program can report errors together with the HDF5 + * library. It receives an identifier for this error class for further + * error operations. The library name and version number will be + * printed out in the error message as a preamble. + * + * \since 1.8.0 + */ +H5_DLL hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Removes an error class + * + * \param[in] class_id Error class identifier. + * \return \herr_t + * + * \details H5Eunregister_class() removes the error class specified by \p + * class_id. All the major and minor errors in this class will also be + * closed. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eunregister_class(hid_t class_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Closes an error message + * + * \param[in] err_id An error message identifier + * \return \herr_t + * + * \details H5Eclose_msg() closes an error message identifier, which can be + * either a major or minor message. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eclose_msg(hid_t err_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Adds a major error message to an error class + * + * \param[in] cls An error class identifier + * \param[in] msg_type The type of the error message + * \param[in] msg Major error message + * \return \herr_t + * + * \details H5Ecreate_msg() adds an error message to an error class defined by + * client library or application program. The error message can be + * either major or minor as indicated by the parameter \p msg_type. + * + * Use H5Eclose_msg() to close the message identifier returned by this + * function. + * + * \since 1.8.0 + */ +H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Creates a new, empty error stack + * + * \return \hid_ti{error stack} + * + * \details H5Ecreate_stack() creates a new empty error stack and returns the + * new stack’s identifier. Use H5Eclose_stack() to close the error stack + * identifier returned by this function. + * + * \since 1.8.0 + */ +H5_DLL hid_t H5Ecreate_stack(void); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns a copy of the current error stack + * + * \return \hid_ti{error stack} + * + * \details H5Eget_current_stack() copies the current error stack and returns an + * error stack identifier for the new copy. + * + * \since 1.8.0 + */ +H5_DLL hid_t H5Eget_current_stack(void); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Appends one error stack to another, optionally closing the source + * stack. + * + * \estack_id{dst_stack_id} + * \estack_id{src_stack_id} + * \param[in] close_source_stack Flag to indicate whether to close the source stack + * \return \herr_t + * + * \details H5Eappend_stack() appends the messages from error stack + * \p src_stack_id to the error stack \p dst_stack_id. + * If \p close_source_stack is \c TRUE, the source error stack + * will be closed. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Closes an error stack handle + * + * \estack_id{stack_id} + * + * \return \herr_t + * + * \details H5Eclose_stack() closes the error stack handle \p stack_id + * and releases its resources. #H5E_DEFAULT cannot be closed. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eclose_stack(hid_t stack_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Retrieves error class name + * + * \param[in] class_id Error class identifier + * \param[out] name Buffer for the error class name + * \param[in] size The maximum number of characters the class name to be returned + * by this function in\p name. + * \return Returns non-negative value as on success; otherwise returns negative value. + * + * \details H5Eget_class_name() retrieves the name of the error class specified + * by the class identifier. If non-NULL pointer is passed in for \p + * name and \p size is greater than zero, the class name of \p size + * long is returned. The length of the error class name is also + * returned. If NULL is passed in as \p name, only the length of class + * name is returned. If zero is returned, it means no name. The user is + * responsible for allocating sufficient buffer space for the name. + * + * \since 1.8.0 + */ H5_DLL ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size); -H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); -H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, - hid_t maj_id, hid_t min_id, const char *msg, ...); -H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); -H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream); -H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data); -H5_DLL herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data); -H5_DLL herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data); -H5_DLL herr_t H5Eclear2(hid_t err_stack); -H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Replaces the current error stack + * + * \estack_id{err_stack_id} + * + * \return \herr_t + * + * \details H5Eset_current_stack() replaces the content of the current error + * stack with a copy of the content of the error stack specified by + * \p err_stack_id, and it closes the error stack specified by + * \p err_stack_id. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Pushes a new error record onto an error stack + * + * \estack_id{err_stack}. If the identifier is #H5E_DEFAULT, the error record + * will be pushed to the current stack. + * \param[in] file Name of the file in which the error was detected + * \param[in] func Name of the function in which the error was detected + * \param[in] line Line number in the file where the error was detected + * \param[in] cls_id Error class identifier + * \param[in] maj_id Major error identifier + * \param[in] min_id Minor error identifier + * \param[in] msg Error description string + * \return \herr_t + * + * \details H5Epush2() pushes a new error record onto the error stack specified + * by \p err_stack.\n + * The error record contains the error class identifier \p cls_id, the + * major and minor message identifiers \p maj_id and \p min_id, the + * function name \p func where the error was detected, the file name \p + * file and line number \p line in the file where the error was + * detected, and an error description \p msg.\n + * The major and minor errors must be in the same error class.\n + * The function name, filename, and error description strings must be + * statically allocated.\n + * \p msg can be a format control string with additional + * arguments. This design of appending additional arguments is similar + * to the system and C functions printf() and fprintf(). + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, + hid_t maj_id, hid_t min_id, const char *msg, ...); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Deletes specified number of error messages from the error stack + * + * \estack_id{err_stack} + * \param[in] count The number of error messages to be deleted from the top + * of error stack + * \return \herr_t + * + * \details H5Epop() deletes the number of error records specified in \p count + * from the top of the error stack specified by \p err_stack (including + * major, minor messages and description). The number of error messages + * to be deleted is specified by \p count. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Prints the specified error stack in a default manner + * + * \estack_id{err_stack} + * \param[in] stream File pointer, or \c NULL for \c stderr + * \return \herr_t + * + * \details H5Eprint2() prints the error stack specified by \p err_stack on the + * specified stream, \p stream. Even if the error stack is empty, a + * one-line message of the following form will be printed: + * \code{.unparsed} + * HDF5-DIAG: Error detected in HDF5 library version: 1.5.62 thread 0. + * \endcode + * + * A similar line will appear before the error messages of each error + * class stating the library name, library version number, and thread + * identifier. + * + * If \p err_stack is #H5E_DEFAULT, the current error stack will be + * printed. + * + * H5Eprint2() is a convenience function for H5Ewalk2() with a function + * that prints error messages. Users are encouraged to write their own + * more specific error handlers. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Walks the specified error stack, calling the specified function + * + * \estack_id{err_stack} + * \param[in] direction Direction in which the error stack is to be walked + * \param[in] func Function to be called for each error encountered + * \param[in] client_data Data to be passed to \p func + * \return \herr_t + * + * \details H5Ewalk2() walks the error stack specified by err_stack for the + * current thread and calls the function specified in \p func for each + * error along the way. + * + * If the value of \p err_stack is #H5E_DEFAULT, then H5Ewalk2() walks + * the current error stack. + * + * \p direction specifies whether the stack is walked from the inside + * out or the outside in. A value of #H5E_WALK_UPWARD means to begin + * with the most specific error and end at the API; a value of + * #H5E_WALK_DOWNWARD means to start at the API and end at the + * innermost function where the error was first detected. + * + * \p func, a function conforming to the #H5E_walk2_t prototype, will + * be called for each error in the error stack. Its arguments will + * include an index number \c n (beginning at zero regardless of stack + * traversal direction), an error stack entry \c err_desc, and the \c + * client_data pointer passed to H5Eprint(). The #H5E_walk2_t prototype + * is as follows: + * \snippet this H5E_walk2_t_snip + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns the settings for the automatic error stack traversal + * function and its data + * + * \estack_id + * \param[out] func The function currently set to be called upon an error condition + * \param[out] client_data Data currently set to be passed to the error function + * \return \herr_t + * + * \details H5Eget_auto2() returns the settings for the automatic error stack + * traversal function, \p func, and its data, \p client_data, that are + * associated with the error stack specified by \p estack_id. + * + * Either or both of the \p func and \p client_data arguments may be + * \c NULL, in which case the value is not returned. + * + * The library initializes its default error stack traversal functions + * to H5Eprint1() and H5Eprint2(). A call to H5Eget_auto2() returns + * H5Eprint2() or the user-defined function passed in through + * H5Eset_auto2(). A call to H5Eget_auto1() returns H5Eprint1() or the + * user-defined function passed in through H5Eset_auto1(). However, if + * the application passes in a user-defined function through + * H5Eset_auto1(), it should call H5Eget_auto1() to query the traversal + * function. If the application passes in a user-defined function + * through H5Eset_auto2(), it should call H5Eget_auto2() to query the + * traversal function. + * + * Mixing the new style and the old style functions will cause a + * failure. For example, if the application sets a user-defined + * old-style traversal function through H5Eset_auto1(), a call to + * H5Eget_auto2() will fail and will indicate that the application has + * mixed H5Eset_auto1() and H5Eget_auto2(). On the other hand, mixing + * H5Eset_auto2() and H5Eget_auto1() will also cause a failure. But if + * the traversal functions are the library’s default H5Eprint1() or + * H5Eprint2(), mixing H5Eset_auto1() and H5Eget_auto2() or mixing + * H5Eset_auto2() and H5Eget_auto1() does not fail. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Turns automatic error printing on or off + * + * \estack_id + * \param[in] func Function to be called upon an error condition + * \param[in] client_data Data passed to the error function + * \return \herr_t + * + * \details H5Eset_auto2() turns on or off automatic printing of errors for the + * error stack specified with \p estack_id. An \p estack_id value of + * #H5E_DEFAULT indicates the current stack. + * + * When automatic printing is turned on, by the use of a non-null \p func + * pointer, any API function which returns an error indication will + * first call \p func, passing it \p client_data as an argument. + * + * \p func, a function compliant with the #H5E_auto2_t prototype, is + * defined in the H5Epublic.h source code file as: + * \snippet this H5E_auto2_t_snip + * + * When the library is first initialized, the auto printing function is + * set to H5Eprint2() (cast appropriately) and \p client_data is the + * standard error stream pointer, \c stderr. + * + * Automatic stack traversal is always in the #H5E_WALK_DOWNWARD + * direction. + * + * Automatic error printing is turned off with a H5Eset_auto2() call + * with a \c NULL \p func pointer. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Clears the specified error stack or the error stack for the current thread + * + * \estack_id{err_stack} + * \return \herr_t + * + * \details H5Eclear2() clears the error stack specified by \p err_stack, or, if + * \p err_stack is set to #H5E_DEFAULT, the error stack for the current + * thread. + * + * \p err_stack is an error stack identifier, such as that returned by + * H5Eget_current_stack(). + * + * The current error stack is also cleared whenever an API function is + * called, with certain exceptions (for instance, H5Eprint1() or + * H5Eprint2()). + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eclear2(hid_t err_stack); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Determines the type of error stack + * + * \estack_id{err_stack} + * \param[out] is_stack A flag indicating which error stack \c typedef the + * specified error stack conforms to + * + * \return \herr_t + * + * \details H5Eauto_is_v2() determines whether the error auto reporting function + * for an error stack conforms to the #H5E_auto2_t \c typedef or the + * #H5E_auto1_t \c typedef. + * + * The \p is_stack parameter is set to 1 if the error stack conforms to + * #H5E_auto2_t and 0 if it conforms to #H5E_auto1_t. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Retrieves an error message + * + * \param[in] msg_id Error message identifier + * \param[out] type The type of the error message Valid values are #H5E_MAJOR + * and #H5E_MINOR. + * \param[out] msg Error message buffer + * \param[in] size The length of error message to be returned by this function + * \return Returns the size of the error message in bytes on success; otherwise + * returns a negative value. + * + * \details H5Eget_msg() retrieves the error message including its length and + * type. The error message is specified by \p msg_id. The user is + * responsible for passing in sufficient buffer space for the + * message. If \p msg is not NULL and \p size is greater than zero, the + * error message of \p size long is returned. The length of the message + * is also returned. If NULL is passed in as \p msg, only the length + * and type of the message is returned. If the return value is zero, it + * means there is no message. + * + * \since 1.8.0 + */ H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, size_t size); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Retrieves the number of error messages in an error stack + * + * \estack_id{error_stack_id} + * \return Returns a non-negative value on success; otherwise returns a negative value. + * + * \details H5Eget_num() retrieves the number of error records in the error + * stack specified by \p error_stack_id (including major, minor + * messages and description). + * + * \since 1.8.0 + */ H5_DLL ssize_t H5Eget_num(hid_t error_stack_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. @@ -189,30 +670,259 @@ H5_DLL ssize_t H5Eget_num(hid_t error_stack_id); typedef hid_t H5E_major_t; typedef hid_t H5E_minor_t; -/* Information about an error element of error stack. */ +/** + * Information about an error element of error stack. + */ typedef struct H5E_error1_t { - H5E_major_t maj_num; /*major error number */ - H5E_minor_t min_num; /*minor error number */ - const char *func_name; /*function in which error occurred */ - const char *file_name; /*file in which error occurred */ - unsigned line; /*line in file where error occurs */ - const char *desc; /*optional supplied description */ + H5E_major_t maj_num; /**< major error number */ + H5E_minor_t min_num; /**< minor error number */ + const char *func_name; /**< function in which error occurred */ + const char *file_name; /**< file in which error occurred */ + unsigned line; /**< line in file where error occurs */ + const char *desc; /**< optional supplied description */ } H5E_error1_t; /* Error stack traversal callback function pointers */ +//! +/** + * \brief Callback function for H5Ewalk1() + * + * \param[in] n Indexed error position in the stack + * \param[in] err_desc Pointer to a data structure describing the error + * \param[in] client_data Pointer to client data in the format expected by the + * user-defined function + * \return \herr_t + */ typedef herr_t (*H5E_walk1_t)(int n, H5E_error1_t *err_desc, void *client_data); +//! + +//! +/** + * \brief Callback function for H5Eset_auto1() + * + * \param[in] client_data Pointer to client data in the format expected by the + * user-defined function + * \return \herr_t + */ typedef herr_t (*H5E_auto1_t)(void *client_data); +//! /* Function prototypes */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Clears the error stack for the current thread + * + * \return \herr_t + * + * \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); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns the current settings for the automatic error stack traversal + * function and its data + * + * \param[out] func Current setting for the function to be called upon an error + * condition + * \param[out] client_data Current setting for the data passed to the error + * function + * \return \herr_t + * + * \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 + * value is not returned. + * + * The library initializes its default error stack traversal functions + * to H5Eprint1() and H5Eprint2(). A call to H5Eget_auto2() returns + * H5Eprint2() or the user-defined function passed in through + * H5Eset_auto2(). A call to H5Eget_auto1() returns H5Eprint1() or the + * user-defined function passed in through H5Eset_auto1(). However, if + * the application passes in a user-defined function through + * H5Eset_auto1(), it should call H5Eget_auto1() to query the traversal + * function. If the application passes in a user-defined function + * through H5Eset_auto2(), it should call H5Eget_auto2() to query the + * traversal function. + * + * Mixing the new style and the old style functions will cause a + * failure. For example, if the application sets a user-defined + * old-style traversal function through H5Eset_auto1(), a call to + * H5Eget_auto2() will fail and will indicate that the application has + * mixed H5Eset_auto1() and H5Eget_auto2(). On the other hand, mixing + * H5Eset_auto2() and H5Eget_auto1() will also cause a failure. But if + * the traversal functions are the library’s default H5Eprint1() or + * 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); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Pushes a new error record onto the error stack + * + * \param[in] file Name of the file in which the error was detected + * \param[in] func Name of the function in which the error was detected + * \param[in] line Line number in the file where the error was detected + * \param[in] maj Major error identifier + * \param[in] min Minor error identifier + * \param[in] str Error description string + * \return \herr_t + * + * \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 + * and \p min_num, the function \p func where the error was detected, the + * name of the file \p file where the error was detected, the line \p line + * within that file, and an error description string \p str.\n + * The function name, filename, and error description strings must be statically + * 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); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Prints the current error stack in a default manner + * + * \param[in] stream File pointer, or \c NULL for \c stderr + * \return \herr_t + * + * \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: + * \code{.unparsed} + * HDF5-DIAG: Error detected in thread 0. + * \endcode + * H5Eprint1() is a convenience function for H5Ewalk1() with a function + * 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); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Turns automatic error printing on or off + * + * \param[in] func Function to be called upon an error condition + * \param[in] client_data Data passed to the error function + * \return \herr_t + * + * \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 + * client_data as an argument. + * + * \p func, a function conforming to the #H5E_auto1_t prototype, is + * defined in the H5Epublic.h source code file as: + * \snippet this H5E_auto1_t_snip + * + * When the library is first initialized, the auto printing function is + * set to H5Eprint1() (cast appropriately) and \p client_data is the + * standard error stream pointer, \c stderr. + * + * 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); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Walks the current error stack, calling the specified function + * + * \param[in] direction Direction in which the error stack is to be walked + * \param[in] func Function to be called for each error encountered + * \param[in] client_data Data to be passed to \p func + * \return \herr_t + * + * \details H5Ewalk1() walks the error stack for the current thread and calls + * the function specified in \p func for each error along the way. + * + * \p direction specifies whether the stack is walked from the inside + * out or the outside in. A value of #H5E_WALK_UPWARD means to begin + * with the most specific error and end at the API; a value of + * #H5E_WALK_DOWNWARD means to start at the API and end at the + * innermost function where the error was first detected. + * + * \p func, a function conforming to the #H5E_walk1_t prototype, will + * be called for each error in the error stack. Its arguments will + * include an index number \c n (beginning at zero regardless of stack + * traversal direction), an error stack entry \c err_desc, and the \c + * client_data pointer passed to H5Eprint(). The #H5E_walk1_t prototype + * 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); -H5_DLL char * H5Eget_major(H5E_major_t maj); -H5_DLL char * H5Eget_minor(H5E_minor_t min); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns a character string describing an error specified by a major + * error number + * + * \param[in] maj Major error number + * \return \herr_t + * + * \details Given a major error number, H5Eget_major() returns a constant + * character string that describes the error. + * + * \attention This function returns a dynamically allocated string (\c char + * 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); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns a character string describing an error specified by a minor + * error number + * + * \param[in] min Minor error number + * \return \herr_t + * + * \details Given a minor error number, H5Eget_minor() returns a constant + * character string that describes the error. + * + * \attention In the Release 1.8.x series, H5Eget_minor() returns a string of + * dynamic allocated \c char array. An application calling this + * function from an HDF5 library of Release 1.8.0 or later must free + * 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 */ #ifdef __cplusplus diff --git a/src/H5FDcore.h b/src/H5FDcore.h index f8a516a..d456c3e 100644 --- a/src/H5FDcore.h +++ b/src/H5FDcore.h @@ -25,8 +25,70 @@ #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_core_init(void); +H5_DLL hid_t H5FD_core_init(void); + +/** + * \ingroup FAPL + * + * \brief Modifies the file access property list to use the #H5FD_CORE driver + * + * \fapl_id + * \param[in] increment Size, in bytes, of memory increments + * \param[in] backing_store Boolean flag indicating whether to write the file + * contents to disk when the file is closed + * \returns \herr_t + * + * \details H5Pset_fapl_core() modifies the file access property list to use the + * #H5FD_CORE driver. + * + * The #H5FD_CORE driver enables an application to work with a file in + * memory, speeding reads and writes as no disk access is made. File + * contents are stored only in memory until the file is closed. The \p + * backing_store parameter determines whether file contents are ever + * written to disk. + * + * \p increment specifies the increment by which allocated memory is to + * be increased each time more memory is required. + * + * While using H5Fcreate() to create a core file, if the \p + * backing_store is set to 1 (TRUE), the file contents are flushed to a + * file with the same name as this core file when the file is closed or + * access to the file is terminated in memory. + * + * The application is allowed to open an existing file with #H5FD_CORE + * driver. While using H5Fopen() to open an existing file, if the \p + * backing_store is set to 1 (TRUE) and the \c flags for H5Fopen() is set to + * #H5F_ACC_RDWR, any change to the file contents are saved to the file + * when the file is closed. If \p backing_store is set to 0 (FALSE) and the \c + * flags for H5Fopen() is set to #H5F_ACC_RDWR, any change to the file + * contents will be lost when the file is closed. If the flags for + * H5Fopen() is set to #H5F_ACC_RDONLY, no change to the file is + * allowed either in memory or on file. + * + * \note Currently this driver cannot create or open family or multi files. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store); + +/** + * \ingroup FAPL + * + * \brief Queries core file driver properties + * + * \fapl_id + * \param[out] increment Size, in bytes, of memory increments + * \param[out] backing_store Boolean flag indicating whether to write the file + * contents to disk when the file is closed + * \returns \herr_t + * + * \details H5Pget_fapl_core() queries the #H5FD_CORE driver properties as set + * by H5Pset_fapl_core(). + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/); #ifdef __cplusplus } diff --git a/src/H5FDdirect.h b/src/H5FDdirect.h index eec10de..f06de7f 100644 --- a/src/H5FDdirect.h +++ b/src/H5FDdirect.h @@ -37,8 +37,69 @@ extern "C" { #define FBSIZE_DEF 4096 #define CBSIZE_DEF 16 * 1024 * 1024 -H5_DLL hid_t H5FD_direct_init(void); +H5_DLL hid_t H5FD_direct_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets up use of the direct I/O driver + * + * \fapl_id + * \param[in] alignment Required memory alignment boundary + * \param[in] block_size File system block size + * \param[in] cbuf_size Copy buffer size + * \returns \herr_t + * + * \details H5Pset_fapl_direct() sets the file access property list, \p fapl_id, + * to use the direct I/O driver, #H5FD_DIRECT. With this driver, data + * is written to or read from the file synchronously without being + * cached by the system. + * + * File systems usually require the data address in memory, the file + * address, and the size of the data to be aligned. The HDF5 library’s + * direct I/O driver is able to handle unaligned data, though that will + * consume some additional memory resources and may slow + * performance. To get better performance, use the system function \p + * posix_memalign to align the data buffer in memory and the HDF5 + * function H5Pset_alignment() to align the data in the file. Be aware, + * however, that aligned data I/O may cause the HDF5 file to be bigger + * than the actual data size would otherwise require because the + * alignment may leave some holes in the file. + * + * \p alignment specifies the required alignment boundary in memory. + * + * \p block_size specifies the file system block size. A value of 0 + * (zero) means to use HDF5 library’s default value of 4KB. + * + * \p cbuf_size specifies the copy buffer size. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pset_fapl_direct(hid_t fapl_id, size_t alignment, size_t block_size, size_t cbuf_size); + +/** + * \ingroup FAPL + * + * \brief Retrieves direct I/O driver settings + * + * \fapl_id + * \param[out] boundary Required memory alignment boundary + * \param[out] block_size File system block size + * \param[out] cbuf_size Copy buffer size + * \returns \herr_t + * + * \details H5Pget_fapl_direct() retrieves the required memory alignment (\p + * alignment), file system block size (\p block_size), and copy buffer + * size (\p cbuf_size) settings for the direct I/O driver, #H5FD_DIRECT, + * from the file access property list \p fapl_id. + * + * See H5Pset_fapl_direct() for discussion of these values, + * requirements, and important considerations. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary /*out*/, size_t *block_size /*out*/, size_t *cbuf_size /*out*/); diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h index f00836f..20ef532 100644 --- a/src/H5FDfamily.h +++ b/src/H5FDfamily.h @@ -26,8 +26,58 @@ extern "C" { #endif -H5_DLL hid_t H5FD_family_init(void); +H5_DLL hid_t H5FD_family_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets the file access property list to use the family driver + * + * \fapl_id + * \param[in] memb_size Size in bytes of each file member + * \param[in] memb_fapl_id Identifier of file access property list for + * each family member + * \returns \herr_t + * + * \details H5Pset_fapl_family() sets the file access property list identifier, + * \p fapl_id, to use the family driver. + * + * \p memb_size is the size in bytes of each file member. This size + * will be saved in file when the property list \p fapl_id is used to + * create a new file. If \p fapl_id is used to open an existing file, + * \p memb_size has to be equal to the original size saved in file. A + * failure with an error message indicating the correct member size + * will be returned if \p memb_size does not match the size saved. If + * any user does not know the original size, #H5F_FAMILY_DEFAULT can be + * passed in. The library will retrieve the saved size. + * + * \p memb_fapl_id is the identifier of the file access property list + * to be used for each family member. + * + * \version 1.8.0 Behavior of the \p memb_size parameter was changed. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id); + +/** + * \ingroup FAPL + * + * \brief Returns file access property list information + * + * \fapl_id + * \param[out] memb_size Size in bytes of each file member + * \param[out] memb_fapl_id Identifier of file access property list for + * each family member + * \returns \herr_t + * + * \details H5Pget_fapl_family() returns file access property list for use with + * the family driver. This information is returned through the output + * parameters. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size /*out*/, hid_t *memb_fapl_id /*out*/); #ifdef __cplusplus diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index abe7682..8d65ac7 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -112,8 +112,20 @@ typedef struct H5FD_hdfs_fapl_t { int32_t stream_buffer_size; } H5FD_hdfs_fapl_t; -H5_DLL hid_t H5FD_hdfs_init(void); +H5_DLL hid_t H5FD_hdfs_init(void); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); #ifdef __cplusplus diff --git a/src/H5FDlog.h b/src/H5FDlog.h index aa1f3cb..969c091 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -65,7 +65,410 @@ extern "C" { #endif -H5_DLL hid_t H5FD_log_init(void); +H5_DLL hid_t H5FD_log_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets up the logging virtual file driver (#H5FD_LOG) for use + * + * \fapl_id + * \param[in] logfile Name of the log file + * \param[in] flags Flags specifying the types of logging activity + * \param[in] buf_size The size of the logging buffers, in bytes (see description) + * \returns \herr_t + * + * \details H5Pset_fapl_log() modifies the file access property list to use the + * logging driver, #H5FD_LOG. The logging virtual file driver (VFD) is + * a clone of the standard SEC2 (#H5FD_SEC2) driver with additional + * facilities for logging VFD metrics and activity to a file. + * + * \p logfile is the name of the file in which the logging entries are + * to be recorded. + * + * The actions to be logged are specified in the parameter \p flags + * using the pre-defined constants described in the following + * table. Multiple flags can be set through the use of a logical \c OR + * contained in parentheses. For example, logging read and write + * locations would be specified as + * \Code{(H5FD_LOG_LOC_READ|H5FD_LOG_LOC_WRITE)}. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Table1: Logging Flags
    + * #H5FD_LOG_LOC_READ + * + * Track the location and length of every read, write, or seek operation. + *
    #H5FD_LOG_LOC_WRITE
    #H5FD_LOG_LOC_SEEK
    + * #H5FD_LOG_LOC_IO + * + * Track all I/O locations and lengths. The logical equivalent of the following: + * \Code{(#H5FD_LOG_LOC_READ | #H5FD_LOG_LOC_WRITE | #H5FD_LOG_LOC_SEEK)} + *
    + * #H5FD_LOG_FILE_READ + * + * Track the number of times each byte is read or written. + *
    #H5FD_LOG_FILE_WRITE
    + * #H5FD_LOG_FILE_IO + * + * Track the number of times each byte is read and written. The logical + * equivalent of the following: + * \Code{(#H5FD_LOG_FILE_READ | #H5FD_LOG_FILE_WRITE)} + *
    + * #H5FD_LOG_FLAVOR + * + * Track the type, or flavor, of information stored at each byte. + *
    + * #H5FD_LOG_NUM_READ + * + * Track the total number of read, write, seek, or truncate operations that occur. + *
    #H5FD_LOG_NUM_WRITE
    #H5FD_LOG_NUM_SEEK
    #H5FD_LOG_NUM_TRUNCATE
    + * #H5FD_LOG_NUM_IO + * + * Track the total number of all types of I/O operations. The logical equivalent + * of the following: + * \Code{(#H5FD_LOG_NUM_READ | #H5FD_LOG_NUM_WRITE | #H5FD_LOG_NUM_SEEK | #H5FD_LOG_NUM_TRUNCATE)} + *
    + * #H5FD_LOG_TIME_OPEN + * + * Track the time spent in open, stat, read, write, seek, or close operations. + *
    #H5FD_LOG_TIME_STAT
    #H5FD_LOG_TIME_READ
    #H5FD_LOG_TIME_WRITE
    #H5FD_LOG_TIME_SEEK
    #H5FD_LOG_TIME_CLOSE
    + * #H5FD_LOG_TIME_IO + * + * Track the time spent in each of the above operations. The logical equivalent + * of the following: + * \Code{(#H5FD_LOG_TIME_OPEN | #H5FD_LOG_TIME_STAT | #H5FD_LOG_TIME_READ | #H5FD_LOG_TIME_WRITE | + * #H5FD_LOG_TIME_SEEK | #H5FD_LOG_TIME_CLOSE)} + *
    + * #H5FD_LOG_ALLOC + * + * Track the allocation of space in the file. + *
    + * #H5FD_LOG_ALL + * + * Track everything. The logical equivalent of the following: + * \Code{(#H5FD_LOG_ALLOC | #H5FD_LOG_TIME_IO | #H5FD_LOG_NUM_IO | #H5FD_LOG_FLAVOR | #H5FD_LOG_FILE_IO | + * #H5FD_LOG_LOC_IO)} + *
    + * The logging driver can track the number of times each byte in the file is + * read from or written to (using #H5FD_LOG_FILE_READ and #H5FD_LOG_FILE_WRITE) + * and what kind of data is at that location (e.g., metadata, raw data; using + * #H5FD_LOG_FLAVOR). This information is tracked in internal buffers of size + * buf_size, which must be at least the maximum size in bytes of the file to be + * logged while the log driver is in use.\n + * One buffer of size buf_size will be created for each of #H5FD_LOG_FILE_READ, + * #H5FD_LOG_FILE_WRITE and #H5FD_LOG_FLAVOR when those flags are set; these + * buffers will not grow as the file increases in size. + * + * \par Output: + * This section describes the logging driver (LOG VFD) output.\n + * The table, immediately below, describes output of the various logging driver + * flags and function calls. A list of valid flavor values, describing the type + * of data stored, follows the table. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Table2: Logging Output
    FlagVFD CallOutput and Comments
    #H5FD_LOG_LOC_READRead + * \Code{%10a-%10a (%10Zu bytes) (%s) Read}\n\n + * Start position\n + * End position\n + * Number of bytes\n + * Flavor of read\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + *
    #H5FD_LOG_LOC_READRead Error + * \Code{Error! Reading: %10a-%10a (%10Zu bytes)}\n\n + * Same parameters as non-error entry. + *
    #H5FD_LOG_LOC_WRITEWrite + * \Code{%10a-%10a (%10Zu bytes) (%s) Written}\n\n + * Start position\n + * End position\n + * Number of bytes\n + * Flavor of write\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + *
    #H5FD_LOG_LOC_WRITEWrite Error + * \Code{Error! Writing: %10a-%10a (%10Zu bytes)}\n\n + * Same parameters as non-error entry. + *
    #H5FD_LOG_LOC_SEEKRead, Write + * \Code{Seek: From %10a-%10a}\n\n + * Start position\n + * End position\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + *
    #H5FD_LOG_FILE_READClose + * Begins with:\n + * Dumping read I/O information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) read from %3d times}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Number of times read\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + *
    #H5FD_LOG_FILE_WRITEClose + * Begins with:\n + * Dumping read I/O information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) written to %3d times}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Number of times written\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + *
    #H5FD_LOG_FLAVORClose + * Begins with:\n + * Dumping I/O flavor information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) flavor is %s}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Flavor\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + *
    #H5FD_LOG_NUM_READClose + * Total number of read operations: \Code{%11u} + *
    #H5FD_LOG_NUM_WRITEClose + * Total number of write operations: \Code{%11u} + *
    #H5FD_LOG_NUM_SEEKClose + * Total number of seek operations: \Code{%11u} + *
    #H5FD_LOG_NUM_TRUNCATEClose + * Total number of truncate operations: \Code{%11u} + *
    #H5FD_LOG_TIME_OPENOpen + * Open took: \Code{(\%f s)} + *
    #H5FD_LOG_TIME_READClose, Read + * Total time in read operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_READ + *
    #H5FD_LOG_TIME_WRITEClose, Write + * Total time in write operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_WRITE + *
    #H5FD_LOG_TIME_SEEKClose, Read, Write + * Total time in write operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_SEEK or #H5FD_LOG_LOC_WRITE + *
    #H5FD_LOG_TIME_CLOSEClose + * Close took: \Code{(\%f s)} + *
    #H5FD_LOG_TIME_STATOpen + * Stat took: \Code{(\%f s)} + *
    #H5FD_LOG_ALLOCAlloc + * \Code{%10-%10 (%10Hu bytes) (\%s) Allocated}\n\n + * Start of address space\n + * End of address space\n + * Total size allocation\n + * Flavor of allocation + *
    + * + * \par Flavors: + * The \Emph{flavor} describes the type of stored information. The following + * table lists the flavors that appear in log output and briefly describes each. + * These terms are provided here to aid in the construction of log message + * parsers; a full description is beyond the scope of this document. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Table3: Flavors of logged data
    FlavorDescription
    #H5FD_MEM_NOLISTError value
    #H5FD_MEM_DEFAULTValue not yet set.\n + * May also be a datatype set in a larger allocation that will be + * suballocated by the library.
    #H5FD_MEM_SUPERSuperblock data
    #H5FD_MEM_BTREEB-tree data
    #H5FD_MEM_DRAWRaw data (for example, contents of a dataset)
    #H5FD_MEM_GHEAPGlobal heap data
    #H5FD_MEM_LHEAPLocal heap data
    #H5FD_MEM_OHDRObject header data
    + * + * \version 1.8.7 The flags parameter has been changed from \Code{unsigned int} + * to \Code{unsigned long long}. + * The implementation of the #H5FD_LOG_TIME_OPEN, #H5FD_LOG_TIME_READ, + * #H5FD_LOG_TIME_WRITE, and #H5FD_LOG_TIME_SEEK flags has been finished. + * New flags were added: #H5FD_LOG_NUM_TRUNCATE and #H5FD_LOG_TIME_STAT. + * \version 1.6.0 The \c verbosity parameter has been removed. + * Two new parameters have been added: \p flags of type \Code{unsigned} and + * \p buf_size of type \Code{size_t}. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, size_t buf_size); #ifdef __cplusplus diff --git a/src/H5FDmirror.h b/src/H5FDmirror.h index 8aef934..49e24c1 100644 --- a/src/H5FDmirror.h +++ b/src/H5FDmirror.h @@ -61,8 +61,20 @@ typedef struct H5FD_mirror_fapl_t { char remote_ip[H5FD_MIRROR_MAX_IP_LEN + 1]; } H5FD_mirror_fapl_t; -H5_DLL hid_t H5FD_mirror_init(void); +H5_DLL hid_t H5FD_mirror_init(void); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa); #ifdef __cplusplus diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index 3af5e41..cf49301 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -34,10 +34,12 @@ */ #define H5D_MULTI_CHUNK_IO_COL_THRESHOLD 60 -/* Type of I/O for data transfer properties */ +/** + * Type of I/O for data transfer properties + */ typedef enum H5FD_mpio_xfer_t { - H5FD_MPIO_INDEPENDENT = 0, /*zero is the default*/ - H5FD_MPIO_COLLECTIVE + H5FD_MPIO_INDEPENDENT = 0, /**< Use independent I/O access */ + H5FD_MPIO_COLLECTIVE /**< Use collective I/O access */ } H5FD_mpio_xfer_t; /* Type of chunked dataset I/O */ diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index 79b52c7..8caf11c 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -44,14 +44,237 @@ H5_DLLVAR hbool_t H5FD_mpi_opt_types_g; #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_mpio_init(void); +H5_DLL hid_t H5FD_mpio_init(void); + +/** + * \ingroup FAPL + * + * \brief Stores MPI IO communicator information to the file access property list + * + * \fapl_id + * \param[in] comm MPI-2 communicator + * \param[in] info MPI-2 info object + * \returns \herr_t + * + * \details H5Pset_fapl_mpio() stores the user-supplied MPI IO parameters \p + * comm, for communicator, and \p info, for information, in the file + * access property list \p fapl_id. That property list can then be used + * to create and/or open a file. + * + * H5Pset_fapl_mpio() is available only in the parallel HDF5 library + * and is not a collective function. + * + * \p comm is the MPI communicator to be used for file open, as defined + * in \c MPI_File_open of MPI-2. This function makes a duplicate of the + * communicator, so modifications to \p comm after this function call + * returns have no effect on the file access property list. + * + * \p info is the MPI Info object to be used for file open, as defined + * in MPI_File_open() of MPI-2. This function makes a duplicate copy of + * the Info object, so modifications to the Info object after this + * function call returns will have no effect on the file access + * property list. + * + * If the file access property list already contains previously-set + * communicator and Info values, those values will be replaced and the + * old communicator and Info object will be freed. + * + * \note Raw dataset chunk caching is not currently supported when using this + * file driver in read/write mode. All calls to H5Dread() and H5Dwrite() + * will access the disk directly, and H5Pset_cache() and + * H5Pset_chunk_cache() will have no effect on performance.\n + * Raw dataset chunk caching is supported when this driver is used in + * read-only mode. + * + * \version 1.4.5 Handling of the MPI Communicator and Info object changed at + * this release. A duplicate of each of these is now stored in the property + * list instead of pointers to each. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info); + +/** + * \ingroup FAPL + * + * \brief Returns MPI IO communicator information + * + * \fapl_id + * \param[out] comm MPI-2 communicator + * \param[out] info MPI-2 info object + * \returns \herr_t + * + * \details If the file access property list is set to the #H5FD_MPIO driver, + * H5Pget_fapl_mpio() returns duplicates of the stored MPI communicator + * and Info object through the \p comm and \p info pointers, if those + * values are non-null. + * + * Since the MPI communicator and Info object are duplicates of the + * stored information, future modifications to the access property list + * will not affect them. It is the responsibility of the application to + * free these objects. + * + * \version 1.4.5 Handling of the MPI Communicator and Info object changed at + * this release. A duplicate of each of these is now stored in the + * property list instead of pointers to each. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/); + +/** + * \ingroup DXPL + * + * \brief Sets data transfer mode + * + * \dxpl_id + * \param[in] xfer_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id + * to use transfer mode \p xfer_mode. The property list can then be + * used to control the I/O transfer mode during data I/O operations. + * + * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and + * #H5FD_MPIO_COLLECTIVE. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode); + +/** + * \ingroup DXPL + * + * \brief Returns the data transfer mode + * + * \dxpl_id + * \param[out] xfer_mode Transfer mode + * \returns \herr_t + * + * \details H5Pget_dxpl_mpio() queries the data transfer mode currently set in + * the data transfer property list \p dxpl_id. + * + * Upon return, \p xfer_mode contains the data transfer mode, if it is + * non-null. + * + * H5Pget_dxpl_mpio() is not a collective function. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/); + +/** + * \ingroup DXPL + * + * \brief Sets data transfer mode + * + * \dxpl_id + * \param[in] opt_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id + * to use transfer mode xfer_mode. The property list can then be used + * to control the I/O transfer mode during data I/O operations. + * + * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and + * #H5FD_MPIO_COLLECTIVE. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode); + +/** + * \ingroup DXPL + * + * \brief Sets a flag specifying linked-chunk I/O or multi-chunk I/O + * + * \dxpl_id + * \param[in] opt_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt() specifies whether I/O is to be + * performed as linked-chunk I/O or as multi-chunk I/O. This function + * overrides the HDF5 library's internal algorithm for determining + * which mechanism to use. + * + * When an application uses collective I/O with chunked storage, the + * HDF5 library normally uses an internal algorithm to determine + * whether that I/O activity should be conducted as one linked-chunk + * I/O or as multi-chunk I/O. H5Pset_dxpl_mpio_chunk_opt() is provided + * so that an application can override the library's algorithm in + * circumstances where the library might lack the information needed to + * make an optimal decision. + * + * H5Pset_dxpl_mpio_chunk_opt() works by setting one of the following + * flags in the parameter \p opt_mode: + * - #H5FD_MPIO_CHUNK_ONE_IO - Do one-link chunked I/O + * - #H5FD_MPIO_CHUNK_MULTI_IO - Do multi-chunked I/O + * + * This function works by setting a corresponding property in the + * dataset transfer property list \p dxpl_id. + * + * The library performs I/O in the specified manner unless it + * determines that the low-level MPI IO package does not support the + * requested behavior; in such cases, the HDF5 library will internally + * use independent I/O. + * + * Use of this function is optional. + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode); + +/** + * \ingroup DXPL + * + * \brief Sets a numeric threshold for linked-chunk I/O + * + * \dxpl_id + * \param[in] num_chunk_per_proc + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt_num() sets a numeric threshold for the + * use of linked-chunk I/O. + * + * The library will calculate the average number of chunks selected by + * each process when doing collective access with chunked storage. If + * the number is greater than the threshold set in \p + * num_chunk_per_proc, the library will use linked-chunk I/O; + * otherwise, a separate I/O process will be invoked for each chunk + * (multi-chunk I/O). + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc); + +/** + * \ingroup DXPL + * + * \brief Sets a ratio threshold for collective I/O + * + * \dxpl_id + * \param[in] percent_num_proc_per_chunk + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt_ratio() sets a threshold for the use of + * collective I/O based on the ratio of processes with collective + * access to a dataset with chunked storage. The decision whether to + * use collective I/O is made on a per-chunk basis. + * + * The library will calculate the percentage of the total number of + * processes, the ratio, that hold selections in each chunk. If that + * percentage is greater than the threshold set in \p + * percent_proc_per_chunk, the library will do collective I/O for this + * chunk; otherwise, independent I/O will be done for the chunk. + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_chunk); #ifdef __cplusplus } diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 9e04d8d..62cc9c8 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -25,11 +25,228 @@ #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_multi_init(void); +H5_DLL hid_t H5FD_multi_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets up use of the multi-file driver + * + * \fapl_id + * \param[in] memb_map Maps memory usage types to other memory usage types + * \param[in] memb_fapl Property list for each memory usage type + * \param[in] memb_name Name generator for names of member files + * \param[in] memb_addr The offsets within the virtual address space, from 0 + * (zero) to #HADDR_MAX, at which each type of data storage begins + * \param[in] relax Allows read-only access to incomplete file sets when \c TRUE + * \returns \herr_t + * + * \details H5Pset_fapl_multi() sets the file access property list \p fapl_id to + * use the multi-file driver. + * + * The multi-file driver enables different types of HDF5 data and + * metadata to be written to separate files. These files are viewed by + * the HDF5 library and the application as a single virtual HDF5 file + * with a single HDF5 file address space. The types of data that can be + * broken out into separate files include raw data, the superblock, + * B-tree data, global heap data, local heap data, and object + * headers. At the programmer's discretion, two or more types of data + * can be written to the same file while other types of data are + * written to separate files. + * + * The array \p memb_map maps memory usage types to other memory usage + * types and is the mechanism that allows the caller to specify how + * many files are created. The array contains #H5FD_MEM_NTYPES entries, + * which are either the value #H5FD_MEM_DEFAULT or a memory usage + * type. The number of unique values determines the number of files + * that are opened. + * + * The array \p memb_fapl contains a property list for each memory + * usage type that will be associated with a file. + * + * The array \p memb_name should be a name generator (a + * \Code{printf}-style format with a \Code{%s} which will be replaced + * with the name passed to H5FDopen(), usually from H5Fcreate() or + * H5Fopen()). + * + * The array \p memb_addr specifies the offsets within the virtual + * address space, from 0 (zero) to #HADDR_MAX, at which each type of + * data storage begins. + * + * If \p relax is set to 1 (TRUE), then opening an existing file for + * read-only access will not fail if some file members are + * missing. This allows a file to be accessed in a limited sense if + * just the meta data is available. + * + * Default values for each of the optional arguments are as follows: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    \p memb_mapThe default member map contains the value #H5FD_MEM_DEFAULT for each element.
    + * \p memb_fapl + * + * The default value is #H5P_DEFAULT for each element. + *
    + * \p memb_name + * + * The default string is \Code{%s-X.h5} where \c X is one of the following letters: + * - \c s for #H5FD_MEM_SUPER + * - \c b for #H5FD_MEM_BTREE + * - \c r for #H5FD_MEM_DRAW + * - \c g for #H5FD_MEM_GHEAP + * - \c l for #H5FD_MEM_LHEAP + * - \c o for #H5FD_MEM_OHDR + *
    + * \p memb_addr + * + * The default setting is that the address space is equally divided + * among all of the elements: + * - #H5FD_MEM_SUPER \Code{-> 0 * (HADDR_MAX/6)} + * - #H5FD_MEM_BTREE \Code{-> 1 * (HADDR_MAX/6)} + * - #H5FD_MEM_DRAW \Code{-> 2 * (HADDR_MAX/6)} + * - #H5FD_MEM_GHEAP \Code{-> 3 * (HADDR_MAX/6)} + * - #H5FD_MEM_LHEAP \Code{-> 4 * (HADDR_MAX/6)} + * - #H5FD_MEM_OHDR \Code{-> 5 * (HADDR_MAX/6)} + *
    + * + * \par Example: + * The following code sample sets up a multi-file access property list that + * partitions data into meta and raw files, each being one-half of the address:\n + * \code + * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + * hid_t memb_fapl[H5FD_MEM_NTYPES]; + * const char *memb[H5FD_MEM_NTYPES]; + * haddr_t memb_addr[H5FD_MEM_NTYPES]; + * + * // The mapping... + * for (mt=0; mt typedef enum { H5FD_FILE_IMAGE_OP_NO_OP, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, + /**< Passed to the \p image_malloc and \p image_memcpy callbacks when a + * file image buffer is to be copied while being set in a file access + * property list (FAPL)*/ H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, + /**< Passed to the \p image_malloc and \p image_memcpy callbacks + * when a file image buffer is to be copied when a FAPL is copied*/ H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, + /** -/* Define structure to hold file image callbacks */ +/** + * Define structure to hold file image callbacks + */ +//! typedef struct { + /** + * \param[in] size Size in bytes of the file image buffer to allocate + * \param[in] file_image_op A value from H5FD_file_image_op_t indicating + * the operation being performed on the file image + * when this callback is invoked + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! void *(*image_malloc)(size_t size, H5FD_file_image_op_t file_image_op, void *udata); + //! + /** + * \param[in] dest Address of the destination buffer + * \param[in] src Address of the source buffer + * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating + * the operation being performed on the file image + * when this callback is invoked + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! void *(*image_memcpy)(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op, void *udata); + //! + /** + * \param[in] ptr Pointer to the buffer being reallocated + * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating + * the operation being performed on the file image + * when this callback is invoked + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! void *(*image_realloc)(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *udata); + //! + /** + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! herr_t (*image_free)(void *ptr, H5FD_file_image_op_t file_image_op, void *udata); + //! + /** + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! void *(*udata_copy)(void *udata); + //! + /** + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! herr_t (*udata_free)(void *udata); + //! + /** + * \brief The final field in the #H5FD_file_image_callbacks_t struct, + * provides a pointer to user-defined data. This pointer will be + * passed to the image_malloc, image_memcpy, image_realloc, and + * image_free callbacks. Define udata as NULL if no user-defined + * data is provided. + */ void *udata; } H5FD_file_image_callbacks_t; +//! #ifdef __cplusplus extern "C" { diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 3ef6b8a..8e42ca2 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -89,8 +89,20 @@ typedef struct H5FD_ros3_fapl_t { extern "C" { #endif -H5_DLL hid_t H5FD_ros3_init(void); +H5_DLL hid_t H5FD_ros3_init(void); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa); #ifdef __cplusplus diff --git a/src/H5FDsplitter.h b/src/H5FDsplitter.h index a201116..ee6e7c5 100644 --- a/src/H5FDsplitter.h +++ b/src/H5FDsplitter.h @@ -87,8 +87,20 @@ typedef struct H5FD_splitter_vfd_config_t { #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_splitter_init(void); +H5_DLL hid_t H5FD_splitter_init(void); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_ptr); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_ptr); #ifdef __cplusplus diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h index b3e06bb..9db92ed 100644 --- a/src/H5FDstdio.h +++ b/src/H5FDstdio.h @@ -28,7 +28,21 @@ extern "C" { #endif -H5_DLL hid_t H5FD_stdio_init(void); +H5_DLL hid_t H5FD_stdio_init(void); +/** + * \ingroup FAPL + * + * \brief Sets the standard I/O driver + * + * \fapl_id + * \returns \herr_t + * + * \details H5Pset_fapl_stdio() modifies the file access property list to use + * the standard I/O driver, H5FDstdio(). + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_stdio(hid_t fapl_id); #ifdef __cplusplus diff --git a/src/H5FDwindows.h b/src/H5FDwindows.h index c1c4654..79e73b6 100644 --- a/src/H5FDwindows.h +++ b/src/H5FDwindows.h @@ -27,6 +27,36 @@ extern "C" { #endif /* __cplusplus */ +/** + * \ingroup FAPL + * + * \brief Sets the Windows I/O driver + * + * \fapl_id + * \returns \herr_t + * + * \details H5Pset_fapl_windows() sets the default HDF5 Windows I/O driver on + * Windows systems. + * + * Since the HDF5 library uses this driver, #H5FD_WINDOWS, by default + * on Windows systems, it is not normally necessary for a user + * application to call H5Pset_fapl_windows(). While it is not + * recommended, there may be times when a user chooses to set a + * different HDF5 driver, such as the standard I/O driver (#H5FD_STDIO) + * or the sec2 driver (#H5FD_SEC2), in a Windows + * application. H5Pset_fapl_windows() is provided so that the + * application can return to the Windows I/O driver when the time + * comes. + * + * Only the Windows driver is tested on Windows systems; other drivers + * are used at the application’s and the user’s risk. + * + * Furthermore, the Windows driver is tested and available only on + * Windows systems; it is not available on non-Windows systems. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pset_fapl_windows(hid_t fapl_id); #ifdef __cplusplus diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h index 33c302a..7f0299a 100644 --- a/src/H5Fmodule.h +++ b/src/H5Fmodule.h @@ -31,8 +31,34 @@ /** * \defgroup H5F H5F - * \brief File Interface - * \todo Describe concisely what the functions in this module are about. + * + * Use the functions in this module to manage HDF5 files. + * + * In the code snippets below, we show the skeletal life cycle of an HDF5 file, + * when creating a new file (left) or when opening an existing file (right). + * File creation is essentially controlled through \ref FCPL, and file access to + * new and existing files is controlled through \ref FAPL. The file \c name and + * 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.} + * + * + * + * + * + * + *
    CreateOpen
    + * \snippet H5F_examples.c life_cycle + * + * \snippet H5F_examples.c life_cycle_w_open + *
    + * + * In addition to general file management functions, there are three categories + * of functions that deal with advanced file management tasks and use cases: + * 1. The control of the HDF5 \ref MDC + * 2. The use of (MPI-) \ref PH5F HDF5 + * 3. The \ref SWMR pattern * * \defgroup MDC Metadata Cache * \ingroup H5F diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 24fe350..164b412 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -47,27 +47,23 @@ * We're assuming that these constants are used rather early in the hdf5 * session. */ -#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< absence of rdwr => rd-only */ -#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< open for read and write */ -#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< overwrite existing files */ -#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< fail if file already exists*/ +#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< Absence of RDWR: read-only */ +#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< Open for read and write */ +#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< Overwrite existing files */ +#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< Fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ -#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< create non-existing files */ +#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< Create non-existing files */ #define H5F_ACC_SWMR_WRITE \ - (H5CHECK 0x0020u) /**< indicate that this file is open for writing in a \ - single-writer/multi-reader (SWMR) scenario. \ - Note that the process(es) opening the file for reading must \ - open the file with RDONLY access, and use the special "SWMR_READ" \ - access flag. */ + (H5CHECK 0x0020u) /**< Indicate that this file is open for writing in a \ + * single-writer/multi-reader (SWMR) scenario. \ + * Note that the process(es) opening the file for reading \ + * must open the file with #H5F_ACC_RDONLY and use the \ + * #H5F_ACC_SWMR_READ access flag. */ #define H5F_ACC_SWMR_READ \ - (H5CHECK 0x0040u) /**< indicate that this file is \ - * open for reading in a \ - * single-writer/multi-reader (SWMR) \ - * scenario. Note that the \ - * process(es) opening the file \ - * for SWMR reading must also \ - * open the file with the RDONLY \ - * flag. */ + (H5CHECK 0x0040u) /**< Indicate that this file is open for reading in a \ + * single-writer/multi-reader (SWMR) scenario. Note that \ + * the process(es) opening the file for SWMR reading must \ + * also open the file with the #H5F_ACC_RDONLY flag. */ /** * Default property list identifier @@ -91,7 +87,7 @@ #define H5F_FAMILY_DEFAULT (hsize_t)0 #ifdef H5_HAVE_PARALLEL -/* +/** * Use this constant string as the MPI_Info key to set H5Fmpio debug flags. * To turn on H5Fmpio debug flags, set the MPI_Info value with this key to * have the value of a string consisting of the characters that turn on the @@ -101,11 +97,12 @@ #endif /* H5_HAVE_PARALLEL */ /** - * The difference between a single file and a set of mounted files + * The scope of an operation such as H5Fflush(), e.g., + * a single file vs. a set of mounted files */ typedef enum H5F_scope_t { - H5F_SCOPE_LOCAL = 0, /**< specified file handle only */ - H5F_SCOPE_GLOBAL = 1 /**< entire virtual file */ + H5F_SCOPE_LOCAL = 0, /**< The specified file handle only */ + H5F_SCOPE_GLOBAL = 1 /**< The entire virtual file */ } H5F_scope_t; /** @@ -117,16 +114,16 @@ typedef enum H5F_scope_t { * How does file close behave? */ typedef enum H5F_close_degree_t { - H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlining VFL */ + H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlying VFD */ H5F_CLOSE_WEAK = 1, /**< File closes only after all opened objects are closed */ - H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is close; otherwise, file close fails */ + H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is closed; otherwise, file close fails */ H5F_CLOSE_STRONG = 3 /**< If there are opened objects, close them first, then close file */ } H5F_close_degree_t; /** * Current "global" information about file */ -//! [H5F_info2_t_snip] +//! typedef struct H5F_info2_t { struct { unsigned version; /**< Superblock version # */ @@ -144,7 +141,7 @@ typedef struct H5F_info2_t { H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */ } sohm; } H5F_info2_t; -//! [H5F_info2_t_snip] +//! /** * Types of allocation requests. The values larger than #H5FD_MEM_DEFAULT @@ -176,12 +173,12 @@ typedef enum H5F_mem_t { /** * Free space section information */ -//! [H5F_sect_info_t_snip] +//! typedef struct H5F_sect_info_t { haddr_t addr; /**< Address of free space section */ hsize_t size; /**< Size of free space section */ } H5F_sect_info_t; -//! [H5F_sect_info_t_snip] +//! /** * Library's format versions @@ -193,7 +190,7 @@ typedef enum H5F_libver_t { H5F_LIBVER_V110 = 2, /**< Use the latest v110 format for storing objects */ H5F_LIBVER_V112 = 3, /**< Use the latest v112 format for storing objects */ H5F_LIBVER_V114 = 4, /**< Use the latest v114 format for storing objects */ - H5F_LIBVER_NBOUNDS + H5F_LIBVER_NBOUNDS /**< Sentinel */ } H5F_libver_t; #define H5F_LIBVER_LATEST H5F_LIBVER_V114 @@ -201,7 +198,7 @@ typedef enum H5F_libver_t { /** * File space handling strategy */ -//! [H5F_fspace_strategy_t_snip] +//! typedef enum H5F_fspace_strategy_t { H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /**< Mechanisms: free-space managers, aggregators, and virtual file drivers This is the library default when not set */ @@ -211,7 +208,7 @@ typedef enum H5F_fspace_strategy_t { H5F_FSPACE_STRATEGY_NONE = 3, /**< Mechanisms: virtual file drivers */ H5F_FSPACE_STRATEGY_NTYPES /**< Sentinel */ } H5F_fspace_strategy_t; -//! [H5F_fspace_strategy_t_snip] +//! /** * File space handling strategy for release 1.10.0 @@ -228,7 +225,7 @@ typedef enum H5F_file_space_type_t { H5F_FILE_SPACE_NTYPES /**< Sentinel */ } H5F_file_space_type_t; -//! [H5F_retry_info_t_snip] +//! #define H5F_NUM_METADATA_READ_RETRY_TYPES 21 /** @@ -239,7 +236,7 @@ typedef struct H5F_retry_info_t { unsigned nbins; uint32_t *retries[H5F_NUM_METADATA_READ_RETRY_TYPES]; } H5F_retry_info_t; -//! [H5F_retry_info_t_snip] +//! /** * Callback for H5Pset_object_flush_cb() in a file access property list @@ -277,11 +274,6 @@ extern "C" { */ H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); /** - * \example H5Fcreate.c - * After creating an HDF5 file with H5Fcreate(), we close it with - * H5Fclose(). - */ -/** * \ingroup H5F * * \brief Creates an HDF5 file @@ -321,7 +313,8 @@ H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); * this file identifier should be closed by calling H5Fclose() when * it is no longer needed. * - * \include H5Fcreate.c + * \par Example + * \snippet H5F_examples.c minimal * * \note #H5F_ACC_TRUNC and #H5F_ACC_EXCL are mutually exclusive; use * exactly one. @@ -359,6 +352,11 @@ H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); * */ H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Fcreate} + */ H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id); /** @@ -408,6 +406,9 @@ H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigne * identifier should be closed by calling H5Fclose() when it is no * longer needed. * + * \par Example + * \snippet H5F_examples.c open + * * \note #H5F_ACC_RDWR and #H5F_ACC_RDONLY are mutually exclusive; use * exactly one. * @@ -451,6 +452,11 @@ H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigne * */ H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Fopen} + */ H5_DLL hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t access_plist, hid_t es_id); /** @@ -479,6 +485,11 @@ H5_DLL hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned * */ H5_DLL hid_t H5Freopen(hid_t file_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Freopen} + */ H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, hid_t es_id); /** @@ -503,6 +514,9 @@ H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigne * global or local. Valid values are as follows: * \scopes * + * \par Example + * \snippet H5F_examples.c flush + * * \attention HDF5 does not possess full control over buffering. H5Fflush() * flushes the internal HDF5 buffers then asks the operating system * (the OS) to flush the system buffers for the open files. After @@ -511,13 +525,13 @@ H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigne * */ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); -H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id, - H5F_scope_t scope, hid_t es_id); /** - * \example H5Fclose.c - * After creating an HDF5 file with H5Fcreate(), we close it with - * H5Fclose(). + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Fflush} */ +H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id, + H5F_scope_t scope, hid_t es_id); /** * \ingroup H5F * @@ -534,8 +548,8 @@ H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigne * identifier, or shared datatype identifier), the file will be fully * closed and access will end. * - * Use H5Fclose() as shown in the following example: - * \include H5Fclose.c + * \par Example + * \snippet H5F_examples.c minimal * * \note \Bold{Delayed close:} Note the following deviation from the * above-described behavior. If H5Fclose() is called for a file but one @@ -562,6 +576,11 @@ H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigne * */ H5_DLL herr_t H5Fclose(hid_t file_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Fclose} + */ H5_DLL herr_t H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, hid_t es_id); /** @@ -655,7 +674,7 @@ H5_DLL hid_t H5Fget_access_plist(hid_t file_id); * \note The function will not return an error if intent is NULL; it will * simply do nothing. * - * \version 1.10.0 C function enhanced to work with SWMR functionality. + * \version 1.10.0 Function enhanced to work with SWMR functionality. * * \since 1.8.0 * @@ -707,7 +726,7 @@ H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno); * \c (#H5F_OBJ_DATASET|#H5F_OBJ_GROUP) would call for datasets and * groups. * - * \version 1.6.8, 1.8.2 C function return type changed to \c ssize_t. + * \version 1.6.8, 1.8.2 Function return type changed to \c ssize_t. * \version 1.6.5 #H5F_OBJ_LOCAL has been added as a qualifier on the types * of objects to be counted. #H5F_OBJ_LOCAL restricts the * search to objects opened through current file identifier. @@ -745,9 +764,9 @@ H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types); * To retrieve a count of open objects, use the H5Fget_obj_count() * function. This count can be used to set the \p max_objs parameter. * - * \version 1.8.2 C function return type changed to \c ssize_t and \p + * \version 1.8.2 Function return type changed to \c ssize_t and \p * max_objs parameter datatype changed to \c size_t. - * \version 1.6.8 C function return type changed to \c ssize_t and \p + * \version 1.6.8 Function return type changed to \c ssize_t and \p * max_objs parameter datatype changed to \c size_t. * \since 1.6.0 * @@ -798,6 +817,9 @@ H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); * attribute, then the file will be mounted at the location where the * attribute, dataset, or named datatype is attached. * + * \par Example + * \snippet H5F_examples.c mount + * * \note To date, no file mount properties have been defined in HDF5. The * proper value to pass for \p plist is #H5P_DEFAULT, indicating the * default file mount property list. @@ -868,8 +890,6 @@ H5_DLL hssize_t H5Fget_freespace(hid_t file_id); * if any, the HDF5 portion of the file, and any data that may have * been appended beyond the data written through the HDF5 library. * - * \version 1.6.3 Fortran subroutine introduced in this release. - * * \since 1.6.3 * */ @@ -948,9 +968,7 @@ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); * * \note \Bold{Recommended Reading:} This function is part of the file image * operations feature set. It is highly recommended to study the guide - * "HDF5 File Image Operations" before using this feature set.\n See the - * "See Also" section below for links to other elements of HDF5 file - * image operations. \todo Fix the references. + * \ref_file_image_ops before using this feature set. * * \attention H5Pget_file_image() will fail, returning a negative value, if the * file is too large for the supplied buffer. @@ -958,8 +976,6 @@ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); * \see H5LTopen_file_image(), H5Pset_file_image(), H5Pget_file_image(), * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks() * - * \version 1.8.13 Fortran subroutine added in this release. - * * \since 1.8.0 * */ @@ -976,197 +992,18 @@ H5_DLL ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len); * \ref H5AC-cache-config-t "here". * \return \herr_t * + * \note The \c in direction applies only to the H5AC_cache_config_t::version + * field. All other fields are out parameters. + * * \details H5Fget_mdc_config() loads the current metadata cache configuration * into the instance of H5AC_cache_config_t pointed to by the \p config_ptr - * parameter. - * - * Note that the \c version field of \p config_ptr must be initialized - * --this allows the library to support old versions of the H5AC_cache_config_t - * structure. - * - * \par General configuration section - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    int version IN: Integer field indicating the the version of the H5AC_cache_config_t in use. This field should - * be set to #H5AC__CURR_CACHE_CONFIG_VERSION (defined in H5ACpublic.h).
    hbool_t rpt_fcn_enabled

    OUT: Boolean flag indicating whether the adaptive cache resize report function is enabled. This - * field should almost always be set to disabled (0). Since resize algorithm activity is - * reported via stdout, it MUST be set to disabled (0) on Windows machines.

    The - * report function is not supported code, and can be expected to change between versions of the - * library. Use it at your own risk.

    hbool_t open_trace_file OUT: Boolean field indicating whether the trace_file_name field should be used to - * open a trace file for the cache. This field will always be set to 0 in this - * context.
    hbool_t close_trace_file OUT: Boolean field indicating whether the current trace file (if any) should be closed. This field - * will always be set to 0 in this context.
    char*trace_file_name OUT: Full path name of the trace file to be opened if the open_trace_file field is - * set to 1. This field will always be set to the empty string in this context.
    hbool_t evictions_enabled OUT: Boolean flag indicating whether metadata cache entry evictions are - * enabled.
    hbool_t set_initial_size OUT: Boolean flag indicating whether the cache should be created with a user specified initial - * maximum size.

    If the configuration is loaded from the cache, this flag will always be set - * to 0.

    size_t initial_size OUT: Initial maximum size of the cache in bytes, if applicable.

    If the configuration is loaded - * from the cache, this field will contain the cache maximum size as of the time of the - * call.

    double min_clean_fraction OUT: Float value specifying the minimum fraction of the cache that must be kept either clean or - * empty when possible.
    size_t max_size OUT: Upper bound (in bytes) on the range of values that the adaptive cache resize code can select - * as the maximum cache size.
    size_t min_size OUT: Lower bound (in bytes) on the range of values that the adaptive cache resize code can select - * as the maximum cache size.
    long int epoch_length OUT: Number of cache accesses between runs of the adaptive cache resize - * code.
    - * - * \par Increment configuration section - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    enum H5C_cache_incr_mode incr_mode OUT: Enumerated value indicating the operational mode of the automatic cache size increase code. - * At present, only the following values are legal:

    \c H5C_incr__off: Automatic cache size increase - * is disabled.

    \c H5C_incr__threshold: Automatic cache size increase is enabled using the hit - * rate threshold algorithm.

    double lower_hr_threshold OUT: Hit rate threshold used in the hit rate threshold cache size increase algorithm.
    double increment OUT: The factor by which the current maximum cache size is multiplied to obtain an initial new - * maximum cache size if a size increase is triggered in the hit rate threshold cache size increase - * algorithm.
    hbool_t apply_max_increment OUT: Boolean flag indicating whether an upper limit will be applied to the size of cache size - * increases.
    size_t max_increment OUT: The maximum number of bytes by which the maximum cache size can be increased in a single step - * -- if applicable.
    enum H5C_cache_flash_incr_mode flash_incr_mode OUT: Enumerated value indicating the operational mode of the flash cache size increase code. At - * present, only the following values are legal:

    \c H5C_flash_incr__off: Flash cache size increase is - * disabled.

    \c H5C_flash_incr__add_space: Flash cache size increase is enabled using the add - * space algorithm.

    double flash_threshold OUT: The factor by which the current maximum cache size is multiplied to obtain the minimum size - * entry / entry size increase which may trigger a flash cache size - * increase.
    double flash_multiple OUT: The factor by which the size of the triggering entry / entry size increase is multiplied to - * obtain the initial cache size increment. This increment may be reduced to reflect existing free - * space in the cache and the max_size field above.
    - * - * \par Decrement configuration section - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Decrement configuration - * section:
    enum H5C_cache_decr_mode decr_mode OUT: Enumerated value indicating the operational mode of the automatic cache size decrease code. - * At present, the following values are legal:

    H5C_decr__off: Automatic cache size decrease is - * disabled, and the remaining decrement fields are ignored.

    H5C_decr__threshold: Automatic - * cache size decrease is enabled using the hit rate threshold algorithm.

    H5C_decr__age_out: - * Automatic cache size decrease is enabled using the ageout algorithm.

    - *

    H5C_decr__age_out_with_threshold: Automatic cache size decrease is enabled using the ageout - * with hit rate threshold algorithm

    double upper_hr_threshold OUT: Upper hit rate threshold. This value is only used if the decr_mode is either - * H5C_decr__threshold or H5C_decr__age_out_with_threshold.
    double decrement OUT: Factor by which the current max cache size is multiplied to obtain an initial value for the - * new cache size when cache size reduction is triggered in the hit rate threshold cache size reduction - * algorithm.
    hbool_t apply_max_decrement OUT: Boolean flag indicating whether an upper limit should be applied to the size of cache size - * decreases.
    size_t max_decrement OUT: The maximum number of bytes by which cache size can be decreased if any single step, if - * applicable.
    int epochs_before_eviction OUT: The minimum number of epochs that an entry must reside unaccessed in cache before being - * evicted under either of the ageout cache size reduction algorithms.
    hbool_t apply_empty_reserve OUT: Boolean flag indicating whether an empty reserve should be maintained under either of the - * ageout cache size reduction algorithms.
    double empty_reserve OUT: Empty reserve for use with the ageout cache size reduction algorithms, if applicable.
    - * - * \par Parallel configuration section - * - * - * - * - *
    int dirty_bytes_threshold OUT: Threshold number of bytes of dirty metadata generation for triggering synchronizations of the - * metadata caches serving the target file in the parallel case.

    Synchronization occurs whenever the - * number of bytes of dirty metadata created since the last synchronization exceeds this - * limit.

    + * parameter.\n + * The fields of the H5AC_cache_config_t structure are shown below: + * \snippet H5ACpublic.h H5AC_cache_config_t_snip + * \click4more * * \since 1.8.0 * - * \todo Fix the reference! - * */ H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr); /** @@ -1183,240 +1020,11 @@ H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr); * * \details H5Fset_mdc_config() attempts to configure the file's metadata cache * according configuration supplied in \p config_ptr. - * - * \par General configuration fields - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    int versionIN: Integer field indicating the the version of the H5AC_cache_config_t in use. This - * field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION (defined - * in H5ACpublic.h).
    hbool_t rpt_fcn_enabledIN: Boolean flag indicating whether the adaptive cache resize report function is enabled. This - * field should almost always be set to disabled (0). Since resize algorithm activity is - * reported via stdout, it MUST be set to disabled (0) on Windows machines.

    The report - * function is not supported code, and can be expected to change between versions of the library. Use - * it at your own risk.

    hbool_t open_trace_FileIN: Boolean field indicating whether the trace_file_name field should be used to open - * a trace file for the cache.

    The trace file is a debuging feature that allows the capture of top - * level metadata cache requests for purposes of debugging and/or optimization. This field should - *

    This field should only normally be set to 0, as trace file collection imposes - * considerable overhead.

    be set to 1 when the trace_file_name contains - * the full path of the desired trace file, and either there is no open trace file on the cache, or the - * close_trace_file field is also 1.

    The trace file feature is - * unsupported unless used at the direction of The HDF Group. It is intended to allow The HDF Group to - * collect a trace of cache activity in cases of occult failures and/or poor performance seen in the - * field, so as to aid in reproduction in the lab. If you use it absent the direction of The HDF Group, - * you are on your own.

    hbool_t close_trace_fileIN: Boolean field indicating whether the current trace file (if any) should be closed.

    See the - * above comments on the open_trace_file field. This field should be set to - * 0 unless there is an open trace file on the cache that you wish to close.

    The - * trace file feature is unsupported unless used at the direction of The HDF Group. It is intended to - * allow The HDF Group to collect a trace of cache activity in cases of occult failures and/or poor - * performance seen in the field, so as to aid in reproduction in the lab. If you use it absent the - * direction of The HDF Group, you are on your own.

    char trace_file_name[]IN: Full path of the trace file to be opened if the open_trace_file field is set - * to 1.

    In the parallel case, an ascii representation of the mpi rank of the process - * will be appended to the file name to yield a unique trace file name for each process.

    The - * length of the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN characters.

    The trace file - * feature is unsupported unless used at the direction of The HDF Group. It is intended to allow The - * HDF Group to collect a trace of cache activity in cases of occult failures and/or poor performance - * seen in the field, so as to aid in reproduction in the lab. If you use it absent the direction of - * The HDF Group, you are on your own.

    hbool_t evictions_enabledIN: A boolean flag indicating whether evictions from the metadata cache are enabled. This flag is - * initially set to enabled (1).

    In rare circumstances, the raw data throughput - * requirements may be so high that the user wishes to postpone metadata writes so as to reserve I/O - * throughput for raw data. The evictions_enabled field exists to allow this. However, - * this is an extreme step, and you have no business doing it unless you have read the User Guide - * section on metadata caching, and have considered all other options carefully.

    The - * evictions_enabled field may not be set to disabled (0) unless all adaptive - * cache resizing code is disabled via the incr_mode, flash_incr_mode, and - * decr_mode fields.

    When this flag is set to disabled (0), the - * metadata cache will not attempt to evict entries to make space for new entries, and thus will grow - * without bound.

    Evictions will be re-enabled when this field is set back to 1. - * This should be done as soon as possible.

    hbool_t set_initial_sizeIN: Boolean flag indicating whether the cache should be forced to the user specified initial - * size.
    size_t initial_sizeIN: If set_initial_size is set to 1, then initial_size must - * contain the desired initial size in bytes. This value must lie in the closed interval - * [min_size, max_size]. (see below)
    double min_clean_fractionIN: This field specifies the minimum fraction of the cache that must be kept either clean or - * empty.

    The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to start in the serial - * case. In the parallel case, a larger value is needed -- see Metadata Caching in HDF5 in the collection - * "Advanced Topics in HDF5."

    size_t max_sizeIN: Upper bound (in bytes) on the range of values that the adaptive cache resize code can select - * as the maximum cache size.
    size_t min_sizeIN: Lower bound (in bytes) on the range of values that the adaptive cache resize code can select - * as the maximum cache size.
    long int epoch_lengthIN: Number of cache accesses between runs of the adaptive cache resize code. 50,000 is a good - * starting number.
    - * - * \par Increment configuration fields - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    enum H5C_cache_incr_mode incr_modeIN: Enumerated value indicating the operational mode of the automatic cache size increase code. At - * present, only two values are legal:

    \c H5C_incr__off: Automatic cache size increase is disabled, - * and the remaining increment fields are ignored.

    \c H5C_incr__threshold: Automatic cache size - * increase is enabled using the hit rate threshold algorithm.

    double lower_hr_thresholdIN: Hit rate threshold used by the hit rate threshold cache size increment algorithm.

    When the - * hit rate over an epoch is below this threshold and the cache is full, the maximum size of the - * cache is multiplied by increment (below), and then clipped as necessary to stay within max_size, and - * possibly max_increment.

    This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good - * starting point.

    double incrementIN: Factor by which the hit rate threshold cache size increment algorithm multiplies the current - * maximum cache size to obtain a tentative new cache size.

    The actual cache size increase will be - * clipped to satisfy the max_size specified in the general configuration, and possibly max_increment - * below.

    The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable - * value.

    If you set it to 1.0, you will effectively disable cache size increases.

    hbool_t apply_max_incrementIN: Boolean flag indicating whether an upper limit should be applied to the size of cache size - * increases.
    size_t max_incrementIN: Maximum number of bytes by which cache size can be increased in a single step -- if - * applicable.
    enum H5C_cache_flash_incr_mode flash_incr_modeIN: Enumerated value indicating the operational mode of the flash cache size increase code. At - * present, only the following values are legal:

    \c H5C_flash_incr__off: Flash cache size increase is - * disabled.

    \c H5C_flash_incr__add_space: Flash cache size increase is enabled using the add - * space algorithm.

    double flash_thresholdIN: The factor by which the current maximum cache size is multiplied to obtain the minimum size - * entry / entry size increase which may trigger a flash cache size increase.

    At present, this value - * must lie in the range [0.1, 1.0].

    double flash_multipleIN: The factor by which the size of the triggering entry / entry size increase is multiplied to - * obtain the initial cache size increment. This increment may be reduced to reflect existing free - * space in the cache and the max_size field above.

    At present, this field must lie in - * the range [0.1, 10.0].

    - * - * \par Decrement configuration fields - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    enum H5C_cache_decr_mode decr_modeIN: Enumerated value indicating the operational mode of the automatic cache size decrease code. At - * present, the following values are legal:

    \c H5C_decr__off: Automatic cache size decrease is - * disabled.

    \c H5C_decr__threshold: Automatic cache size decrease is enabled using the hit - * rate threshold algorithm.

    \c H5C_decr__age_out: Automatic cache size decrease is enabled using - * the ageout algorithm.

    \c H5C_decr__age_out_with_threshold: Automatic cache size decrease is - * enabled using the ageout with hit rate threshold algorithm

    double upper_hr_thresholdIN: Hit rate threshold for the hit rate threshold and ageout with hit rate threshold cache size - * decrement algorithms.

    When \c decr_mode is \c H5C_decr__threshold, and the hit rate over a given - * epoch exceeds the supplied threshold, the current maximum cache size is multiplied by decrement to - * obtain a tentative new (and smaller) maximum cache size.

    When \c decr_mode is \c - * H5C_decr__age_out_with_threshold, there is no attempt to find and evict aged out entries unless the - * hit rate in the previous epoch exceeded the supplied threshold.

    This field must lie in the - * interval [0.0, 1.0].

    For \c H5C_incr__threshold, .9995 or .99995 is a good place to - * start.

    For \c H5C_decr__age_out_with_threshold, .999 might be more useful.

    double decrementIN: In the hit rate threshold cache size decrease algorithm, this parameter contains the factor by - * which the current max cache size is multiplied to produce a tentative new cache size.

    The actual - * cache size decrease will be clipped to satisfy the min_size specified in the general configuration, - * and possibly max_decrement below.

    The parameter must be be in the interval - * [0.0, 1.0].

    If you set it to 1.0, you will effectively disable cache size decreases. 0.9 is a - * reasonable starting point.

    hbool_t apply_max_decrementIN: Boolean flag indicating whether an upper limit should be applied to the size of cache size - * decreases.
    size_t max_decrementIN: Maximum number of bytes by which the maximum cache size can be decreased in any single step -- - * if applicable.
    int epochs_before_evictionIN: In the ageout based cache size reduction algorithms, this field contains the minimum number of - * epochs an entry must remain unaccessed in cache before the cache size reduction algorithm tries to - * evict it. 3 is a reasonable value.
    hbool_t apply_empty_reserveIN: Boolean flag indicating whether the ageout based decrement algorithms will maintain a empty - * reserve when decreasing cache size.
    double empty_reserveIN: Empty reserve as a fraction of maximum cache size if applicable.

    When so directed, the - * ageout based algorithms will not decrease the maximum cache size unless the empty reserve can be - * met.

    The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to - * start.

    - * - * \par Parallel configuration fields - * - * - * - * - * - *
    int dirty_bytes_thresholdIN: Threshold number of bytes of dirty metadata generation for triggering synchronizations of the - * metadata caches serving the target file in the parallel case.

    Synchronization occurs whenever the - * number of bytes of dirty metadata created since the last synchronization exceeds this - * limit.

    This field only applies to the parallel case. While it is ignored elsewhere, it can - * still draw a value out of bounds error.

    It must be consistant across all caches on any given - * file.

    By default, this field is set to 256 KB. It shouldn't be more than half the current - * maximum cache size times the minimum clean fraction.

    + * \snippet H5ACpublic.h H5AC_cache_config_t_snip + * \click4more * * \since 1.8.0 * - * \todo Fix the MDC document reference! */ H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr); /** @@ -1495,13 +1103,12 @@ H5_DLL herr_t H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_c * is enabled. However, the call should be useful if you choose to control metadata cache size from your * program. * - * See "Metadata Caching in HDF5" for details about the metadata cache and the adaptive cache resizing + * See \ref_mdc_in_hdf5 for details about the metadata cache and the adaptive cache resizing * algorithms. If you have not read, understood, and thought about the material covered in that * documentation, * you should not be using this API call. * \endparblock * - * \todo Fix the MDC document reference! */ H5_DLL herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id); /** @@ -1797,6 +1404,9 @@ H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id); * For the parameters \p low and \p high, see the description for * H5Pset_libver_bounds(). * + * \par Example + * \snippet H5F_examples.c libver_bounds + * * \since 1.10.2 * */ @@ -1835,7 +1445,7 @@ H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t * list, and H5Fget_mdc_logging_status() will return the current state of * the logging flags. * - * The log format is described in the \Emph{Metadata Cache Logging} document. + * The log format is described in the \ref_mdc_logging document. * * \note Logging can only be started or stopped if metadata cache logging was enabled * via H5Pset_mdc_log_options().\n @@ -1849,8 +1459,6 @@ H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t * * \since 1.10.0 * - * \todo Fix the document reference! - * */ H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id); /** @@ -1887,7 +1495,7 @@ H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id); * list, and H5Fget_mdc_logging_status() will return the current state of * the logging flags. * - * The log format is described in the \Emph{Metadata Cache Logging} document. + * The log format is described in the \ref_mdc_logging document. * * \note Logging can only be started or stopped if metadata cache logging was enabled * via H5Pset_mdc_log_options().\n @@ -1933,7 +1541,7 @@ H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id); * list, and H5Fget_mdc_logging_status() will return the current state of * the logging flags. * - * The log format is described in the \Emph{Metadata Cache Logging} document. + * The log format is described in the \ref_mdc_logging document. * * \note Unlike H5Fstart_mdc_logging() and H5Fstop_mdc_logging(), this function can * be called on any open file identifier. @@ -1944,7 +1552,7 @@ H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hboo /** * \ingroup SWMR * - * \todo Finish this! + * \todo UFO? */ H5_DLL herr_t H5Fformat_convert(hid_t fid); /** @@ -1998,7 +1606,7 @@ H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], u * \brief Obtains information about a cache image if it exists * * \file_id - * \param[out] image_addr Offset of the cache image if it exists, or #HADDR_UNDEF if it does not + * \param[out] image_addr Offset of the cache image if it exists, or \c HADDR_UNDEF if it does not * \param[out] image_size Length of the cache image if it exists, or 0 if it does not * \returns \herr_t * @@ -2139,11 +1747,10 @@ H5_DLL herr_t H5Fwait(hid_t file_id); * the desired behavior. * \endparblock * - * \see Enabling a Strict Consistency Semantics Model in Parallel HDF5 + * \see \ref_cons_semantics * * \since 1.8.9 * - * \todo Fix the reference! */ H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); /** @@ -2163,11 +1770,10 @@ H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); * Upon successful return, \p flag will be set to \c 1 if file access is set * to atomic mode and \c 0 if file access is set to nonatomic mode. * - * \see Enabling a Strict Consistency Semantics Model in Parallel HDF5 + * \see \ref_cons_semantics * * \since 1.8.9 * - * \todo Fix the reference! */ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #endif /* H5_HAVE_PARALLEL */ @@ -2199,14 +1805,14 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ -#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/ +#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /**< Print debug info \deprecated In which version? */ /* Typedefs */ /** * Current "global" information about file */ -//! [H5F_info1_t_snip] +//! typedef struct H5F_info1_t { hsize_t super_ext_size; /**< Superblock extension size */ struct { @@ -2214,7 +1820,7 @@ typedef struct H5F_info1_t { H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */ } sohm; } H5F_info1_t; -//! [H5F_info1_t_snip] +//! /* Function prototypes */ /** @@ -2252,7 +1858,7 @@ typedef struct H5F_info1_t { * header indexes. Each index might be either a B-tree or * a list. * - * \version 1.10.0 C function H5Fget_info() renamed to H5Fget_info1() and + * \version 1.10.0 Function H5Fget_info() renamed to H5Fget_info1() and * deprecated in this release. * * \since 1.8.0 diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h index 219342d..fe26bd2 100644 --- a/src/H5Gmodule.h +++ b/src/H5Gmodule.h @@ -31,9 +31,94 @@ /** * \defgroup H5G H5G - * \brief Group Interface - * \details The HDF5 Group Interface, H5G, provides a mechanism for managing - * HDF5 groups and their members, which are other HDF5 objects. + * + * \details \Bold{Groups in HDF5:} A group associates names with objects and + * provides a mechanism for mapping a name to an object. Since all + * objects appear in at least one group (with the possible exception of + * the root object) and since objects can have names in more than one + * group, the set of all objects in an HDF5 file is a directed + * graph. The internal nodes (nodes with out-degree greater than zero) + * must be groups while the leaf nodes (nodes with out-degree zero) are + * either empty groups or objects of some other type. Exactly one + * object in every non-empty file is the root object. The root object + * always has a positive in-degree because it is pointed to by the file + * super block. + * + * \Bold{Locating objects in the HDF5 file hierarchy:} An object name + * consists of one or more components separated from one another by + * slashes. An absolute name begins with a slash and the object is + * located by looking for the first component in the root object, then + * looking for the second component in the first object, etc., until + * the entire name is traversed. A relative name does not begin with a + * slash and the traversal begins at the location specified by the + * create or access function. + * + * \Bold{Group implementations in HDF5:} The original HDF5 group + * implementation provided a single indexed structure for link + * storage. A new group implementation, in HDF5 Release 1.8.0, enables + * more efficient compact storage for very small groups, improved link + * indexing for large groups, and other advanced features. + * + * \li The \Emph{original indexed} format remains the default. Links + * are stored in a B-tree in the group’s local heap. + * \li Groups created in the new \Emph{compact-or-indexed} format, the + * implementation introduced with Release 1.8.0, can be tuned for + * performance, switching between the compact and indexed formats + * at thresholds set in the user application. + * - The \Emph{compact} format will conserve file space and processing + * overhead when working with small groups and is particularly + * valuable when a group contains no links. Links are stored + * as a list of messages in the group’s header. + * - The \Emph{indexed} format will yield improved + * performance when working with large groups, e.g., groups + * containing thousands to millions of members. Links are stored in + * a fractal heap and indexed with an improved B-tree. + * \li The new implementation also enables the use of link names consisting of + * non-ASCII character sets (see H5Pset_char_encoding()) and is + * required for all link types other than hard or soft links, e.g., + * external and user-defined links (see the \ref H5L APIs). + * + * The original group structure and the newer structures are not + * directly interoperable. By default, a group will be created in the + * original indexed format. An existing group can be changed to a + * compact-or-indexed format if the need arises; there is no capability + * to change back. As stated above, once in the compact-or-indexed + * format, a group can switch between compact and indexed as needed. + * + * Groups will be initially created in the compact-or-indexed format + * only when one or more of the following conditions is met: + * \li The low version bound value of the library version bounds property + * has been set to Release 1.8.0 or later in the file access property + * list (see H5Pset_libver_bounds()). Currently, that would require an + * H5Pset_libver_bounds() call with the low parameter set to + * #H5F_LIBVER_LATEST.\n When this property is set for an HDF5 file, + * all objects in the file will be created using the latest available + * format; no effort will be made to create a file that can be read by + * older libraries. + * \li The creation order tracking property, #H5P_CRT_ORDER_TRACKED, has been + * set in the group creation property list (see H5Pset_link_creation_order()). + * + * An existing group, currently in the original indexed format, will be + * converted to the compact-or-indexed format upon the occurrence of + * any of the following events: + * \li An external or user-defined link is inserted into the group. + * \li A link named with a string composed of non-ASCII characters is + * inserted into the group. + * + * The compact-or-indexed format offers performance improvements that + * will be most notable at the extremes, i.e., in groups with zero + * members and in groups with tens of thousands of members. But + * measurable differences may sometimes appear at a threshold as low as + * eight group members. Since these performance thresholds and criteria + * differ from application to application, tunable settings are + * provided to govern the switch between the compact and indexed + * formats (see H5Pset_link_phase_change()). Optimal thresholds will + * depend on the application and the operating environment. + * + * Future versions of HDF5 will retain the ability to create, read, + * write, and manipulate all groups stored in either the original + * indexed format or the compact-or-indexed format. + * */ #endif /* H5Gmodule_H */ diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 68786dc..416ff2c 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -41,24 +41,31 @@ /* Public Typedefs */ /*******************/ -/* Types of link storage for groups */ +//! +/** + * Types of link storage for groups + */ typedef enum H5G_storage_type_t { - H5G_STORAGE_TYPE_UNKNOWN = -1, /* Unknown link storage type */ - H5G_STORAGE_TYPE_SYMBOL_TABLE, /* Links in group are stored with a "symbol table" */ - /* (this is sometimes called "old-style" groups) */ - H5G_STORAGE_TYPE_COMPACT, /* Links are stored in object header */ - H5G_STORAGE_TYPE_DENSE /* Links are stored in fractal heap & indexed with v2 B-tree */ + H5G_STORAGE_TYPE_UNKNOWN = -1, /**< Unknown link storage type */ + H5G_STORAGE_TYPE_SYMBOL_TABLE, /**< Links in group are stored with a "symbol table" */ + /**< (this is sometimes called "old-style" groups) */ + H5G_STORAGE_TYPE_COMPACT, /**< Links are stored in object header */ + H5G_STORAGE_TYPE_DENSE /**< Links are stored in fractal heap & indexed with v2 B-tree */ } H5G_storage_type_t; +//! -/* Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) */ -//! [H5G_info_t_snip] +//! +/** + * Information struct for group for + * H5Gget_info(), H5Gget_info_by_name(), and H5Gget_info_by_idx() + */ typedef struct H5G_info_t { - H5G_storage_type_t storage_type; /* Type of storage for links in group */ - hsize_t nlinks; /* Number of links in group */ - int64_t max_corder; /* Current max. creation order value for group */ - hbool_t mounted; /* Whether group has a file mounted on it */ + H5G_storage_type_t storage_type; /**< Type of storage for links in group */ + hsize_t nlinks; /**< Number of links in group */ + int64_t max_corder; /**< Current max. creation order value for group */ + hbool_t mounted; /**< Whether group has a file mounted on it */ } H5G_info_t; -//! [H5G_info_t_snip] +//! /********************/ /* Public Variables */ @@ -120,24 +127,8 @@ H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcp /** * -------------------------------------------------------------------------- - * \ingroup H5G - * - * \brief Asynchronous version of H5Gcreate2() - * - * \app_file - * \app_func - * \app_line - * \fgdta_loc_id - * \param[in] name Name of the group to create - * \lcpl_id - * \gcpl_id - * \gapl_id - * \es_id - * - * \return \hid_t{group} - * - * \see H5Gcreate2() - * + * \ingroup ASYNC + * \async_variant_of{H5Gcreate} */ H5_DLL hid_t H5Gcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t es_id); @@ -223,22 +214,8 @@ H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id); /** * -------------------------------------------------------------------------- - * \ingroup H5G - * - * \brief Asynchronous version of H5Gopen2() - * - * \app_file - * \app_func - * \app_line - * \fgdta_loc_id - * \param[in] name Name of the group to open - * \gapl_id - * \es_id - * - * \return \hid_t{group} - * - * \see H5Gopen2() - * + * \ingroup ASYNC + * \async_variant_of{H5Gopen} */ H5_DLL hid_t H5Gopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t gapl_id, hid_t es_id); @@ -296,21 +273,8 @@ H5_DLL herr_t H5Gget_info(hid_t loc_id, H5G_info_t *ginfo); /** * -------------------------------------------------------------------------- - * \ingroup H5G - * - * \brief Asynchronous version of H5Gget_info() - * - * \app_file - * \app_func - * \app_line - * \fgdta_loc_id - * \param[out] ginfo Struct in which group information is returned - * \es_id - * - * \return \hid_t{group} - * - * \see H5Gget_info() - * + * \ingroup ASYNC + * \async_variant_of{H5Gget_info} */ H5_DLL herr_t H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, H5G_info_t *ginfo /*out*/, hid_t es_id); @@ -351,23 +315,8 @@ H5_DLL herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *gi /** * -------------------------------------------------------------------------- - * \ingroup H5G - * - * \brief Asynchronous version of H5Gget_info_by_name() - * - * \app_file - * \app_func - * \app_line - * \fgdta_loc_id - * \param[in] name Name of the group to query - * \param[out] ginfo Struct in which group information is returned - * \lapl_id - * \es_id - * - * \return \herr_t - * - * \see H5Gget_info_by_name() - * + * \ingroup ASYNC + * \async_variant_of{H5Gget_info_by_name} */ H5_DLL herr_t H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, H5G_info_t *ginfo /*out*/, @@ -423,29 +372,8 @@ H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_ /** * -------------------------------------------------------------------------- - * \ingroup H5G - * - * \brief Asynchronous version of H5Gcreate2() - * - * \app_file - * \app_func - * \app_line - * \fgdta_loc_id - * \param[in] group_name Name of the group to query - * \param[in] idx_type Transient index identifying object - * \param[in] order Transient index identifying object - * \param[in] n Position in the index of the group to query - * \param[out] ginfo Struct in which group information is returned - * \lapl_id - * \es_id - * - * \return Returns - * \li The size of the object name if successful, or - * \li 0 if no name is associated with the group identifier, or - * \li negative value, if failure occurred - * - * \see H5Gcreate2() - * + * \ingroup ASYNC + * \async_variant_of{H5Gget_info_by_idx} */ H5_DLL herr_t H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *group_name, H5_index_t idx_type, @@ -523,29 +451,18 @@ H5_DLL herr_t H5Grefresh(hid_t group_id); * Failure to release a group with this call will result in * resource leaks. * - * \since 1.0.0 + * \par Example + * \snippet H5F_examples.c mount * - * \version 1.4.0 Fortran function introduced in this release + * \since 1.0.0 * */ H5_DLL herr_t H5Gclose(hid_t group_id); /** * -------------------------------------------------------------------------- - * \ingroup H5G - * - * \brief Asynchronous version of H5Gcreate2() - * - * \app_file - * \app_func - * \app_line - * \group_id - * \es_id - * - * \return \herr_t - * - * \see H5Gcreate2() - * + * \ingroup ASYNC + * \async_variant_of{H5Gclose} */ 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); @@ -595,60 +512,649 @@ H5_DLL herr_t H5Gclose_async(const char *app_file, const char *app_func, unsigne /* Typedefs */ -/* +//! +/** * An object has a certain type. The first few numbers are reserved for use * internally by HDF5. Users may add their own types with higher values. The - * values are never stored in the file -- they only exist while an - * application is running. An object may satisfy the `isa' function for more - * than one type. + * values are never stored in the file -- they only exist while an application + * is running. An object may satisfy the `isa' function for more than one type. + * + * \deprecated */ typedef enum H5G_obj_t { - H5G_UNKNOWN = -1, /* Unknown object type */ - H5G_GROUP, /* Object is a group */ - H5G_DATASET, /* Object is a dataset */ - H5G_TYPE, /* Object is a named data type */ - H5G_LINK, /* Object is a symbolic link */ - H5G_UDLINK, /* Object is a user-defined link */ - H5G_RESERVED_5, /* Reserved for future use */ - H5G_RESERVED_6, /* Reserved for future use */ - H5G_RESERVED_7 /* Reserved for future use */ + H5G_UNKNOWN = -1, /**< Unknown object type */ + H5G_GROUP, /**< Object is a group */ + H5G_DATASET, /**< Object is a dataset */ + H5G_TYPE, /**< Object is a named data type */ + H5G_LINK, /**< Object is a symbolic link */ + H5G_UDLINK, /**< Object is a user-defined link */ + H5G_RESERVED_5, /**< Reserved for future use */ + H5G_RESERVED_6, /**< Reserved for future use */ + H5G_RESERVED_7 /**< Reserved for future use */ } H5G_obj_t; +//! -/** Define the operator function pointer for for H5Giterate() */ -//! [H5G_iterate_t_snip] +//! +/** + * Callback for H5Giterate() + * + * \deprecated + */ typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data); -//! [H5G_iterate_t_snip] +//! -/** Information about an object */ -//! [H5G_stat_t_snip] +//! +/** + * Information about an object + * + * \deprecated + */ typedef struct H5G_stat_t { - unsigned long fileno[2]; /*file number */ - unsigned long objno[2]; /*object number */ - unsigned nlink; /*number of hard links to object*/ - H5G_obj_t type; /*basic object type */ - time_t mtime; /*modification time */ - size_t linklen; /*symbolic link value length */ - H5O_stat_t ohdr; /* Object header information */ + unsigned long fileno[2]; /**< file number */ + unsigned long objno[2]; /**< object number */ + unsigned nlink; /**< number of hard links to object*/ + H5G_obj_t type; /**< basic object type */ + time_t mtime; /**< modification time */ + size_t linklen; /**< symbolic link value length */ + H5O_stat_t ohdr; /**< Object header information */ } H5G_stat_t; -//! [H5G_stat_t_snip] +//! /* Function prototypes */ -H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint); -H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name); -H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name); -H5_DLL 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); -H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name); -H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name); -H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name); -H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/); -H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment); -H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf); -H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data); -H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs); -H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf /*out*/); -H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Creates a new group and links it into the file + * + * \fgdta_loc_id + * \param[in] name Name of the group to create + * \param[in] size_hint Optional parameter indicating the number of bytes + * to reserve for the names that will appear in the group + * + * \return \hid_t{group} + * + * \deprecated This function is deprecated in favor of H5Gcreate2(). + * + * \details H5Gcreate1() creates a new group with the specified name at the + * specified location, \p loc_id. \p loc_id may be a file, group, + * dataset, named datatype or attribute. If an attribute, dataset, or + * named datatype is specified for \p loc_id then the group will be + * created at the location where the attribute, dataset, or named + * datatype is attached. The name, name, must not already be taken by + * some other object and all parent groups must already exist. + * + * \p name can be a relative path based at \p loc_id or an absolute + * path from the root of the file. Use of this function requires that + * any intermediate groups specified in the path already exist. + * + * The length of a group name, or of the name of any object within a + * group, is not limited. + * + * \p size_hint is a hint for the number of bytes to reserve to store + * the names which will be eventually added to the new group. Passing a + * value of zero for \p size_hint is usually adequate since the library + * is able to dynamically resize the name heap, but a correct hint may + * result in better performance. If a non-positive value is supplied + * for \p size_hint, then a default size is chosen. + * + * The return value is a group identifier for the open group. This + * group identifier should be closed by calling H5Gclose() when it is + * no longer needed. + * + * See H5Gcreate_anon() for a discussion of the differences between + * H5Gcreate1() and H5Gcreate_anon(). + * + * \par Example + * \snippet H5F_examples.c mount + * + * \version 1.8.0 Function H5Gcreate() renamed to H5Gcreate1() and deprecated + * in this release. + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Opens an existing group for modification and returns a group + * identifier for that group + * + * \fgdta_loc_id + * \param[in] name Name of the group to open + * + * \return \hid_t{group} + * + * \deprecated This function is deprecated in favor of H5Gopen2(). + * + * \details H5Gopen1() opens an existing group, \p name, at the location + * specified by \p loc_id. + * + * H5Gopen1() returns a group identifier for the group that was + * opened. This group identifier should be released by calling + * H5Gclose() when it is no longer needed. + * + * \version 1.8.0 The function H5Gopen() was renamed to H5Gopen1() + * and deprecated in this release. + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Creates a link of the specified type from \p new_name to \p + * cur_name + * + * \fg_loc_id{cur_loc_id} + * \param[in] type Link type + * \param[in] cur_name Name of the existing object + * \param[in] new_name New name for the object + * + * \return \herr_t + * + * \deprecated This function is deprecated. + * + * \details H5Glink() creates a new name for an object that has some current + * name, possibly one of many names it currently has. + * + * If \p link_type is #H5G_LINK_HARD, then \p cur_name must specify + * the name of an existing object and both names are interpreted + * relative to \p cur_loc_id, which is either a file identifier or a + * group identifier. + * + * If \p link_type is #H5G_LINK_SOFT, then \p cur_name can be anything + * and is interpreted at lookup time relative to the group which + * contains the final component of \p new_name. For instance, if \p + * cur_name is \Code{./foo}, \p new_name is \Code{./x/y/bar}, and a + * request is made for \Code{./x/y/bar}, then the actual object looked + * up is \Code{./x/y/./foo}. + + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Creates a link of the specified type from \p cur_name to \p + * new_name + * + * \fg_loc_id{cur_loc_id} + * \param[in] cur_name Name of the existing object + * \param[in] type Link type + * \fg_loc_id{new_loc_id} + * \param[in] new_name New name for the object + * + * \return \herr_t + * + * \deprecated This function is deprecated. + * + * \details H5Glink2() creates a new name for an object that has some current + * name, possibly one of many names it currently has. + * + * If \p link_type is #H5G_LINK_HARD, then \p cur_name must specify the + * name of an existing object and both names are interpreted relative + * to \p cur_loc_id and \p new_loc_id, respectively, which are either + * file identifiers or group identifiers. + * + * If \p link_type is #H5G_LINK_SOFT, then \p cur_name can be anything + * and is interpreted at lookup time relative to the group which + * contains the final component of \p new_name. For instance, if \p + * current_name is \Code{./foo}, \p new_name is \Code{./x/y/bar}, and a + * request is made for \Code{./x/y/bar}, then the actual object looked + * up is \Code{./x/y/./foo}. + + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL 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); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Renames an object within an HDF5 file + * + * \fg_loc_id{src_loc_id} + * \param[in] src_name Object's original name + * \param[in] dst_name Object's new name + * + * \return \herr_t + * + * \deprecated This function is deprecated. + * + * \details H5Gmove() renames an object within an HDF5 file. The original name, + * \p src_name, is unlinked from the group graph and the new name, \p + * dst_name, is inserted as an atomic operation. Both names are + * interpreted relative to \p loc_id, which is either a file or a group + * identifier. + * + * \attention Exercise care in moving groups as it is possible to render data in + * a file inaccessible with H5Gmove(). See The Group Interface in the + * HDF5 User's Guide. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Renames an object within an HDF5 file + * + * \fg_loc_id{src_loc_id} + * \param[in] src_name Object's original name + * \fg_loc_id{dst_loc_id} + * \param[in] dst_name Object's new name + * + * \return \herr_t + * + * \deprecated This function is deprecated. + * + * \details H5Gmove2() renames an object within an HDF5 file. The original name, + * \p src_name, is unlinked from the group graph and the new name, \p + * dst_name, is inserted as an atomic operation. + * + * \p src_name and \p dst_name are interpreted relative to \p + * src_loc_id and \p dst_loc_id, respectively, which are either file or + * group identifiers. + * + * \attention Exercise care in moving groups as it is possible to render data in + * a file inaccessible with H5Gmove2(). See The Group Interface in the + * HDF5 User's Guide. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Removes the link to an object from a group + * + * \fg_loc_id{loc_id} + * \param[in] name Name of the object to unlink + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function H5Ldelete(). + * + * \details H5Gunlink() removes the object specified by \p name from the group + * graph and decrements the link count for the object to which \p name + * points. This action eliminates any association between name and the + * object to which name pointed. + * + * Object headers keep track of how many hard links refer to an object; + * when the link count reaches zero, the object can be removed from the + * file. Objects which are open are not removed until all identifiers + * to the object are closed. + * + * If the link count reaches zero, all file space associated with the + * object will be released, i.e., identified in memory as freespace. If + * any object identifier is open for the object, the space will not be + * released until after the object identifier is closed. + * + * Note that space identified as freespace is available for re-use only + * as long as the file remains open; once a file has been closed, the + * HDF5 library loses track of freespace. See “Freespace Management” in + * the HDF5 User's Guide for further details. + * + * \attention Exercise care in moving groups as it is possible to render data in + * a file inaccessible with H5Gunlink(). See The Group Interface in the + * HDF5 User's Guide. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns the name of the object that the symbolic link points to + * + * \fg_loc_id{loc_id} + * \param[in] name Symbolic link to the object whose name is to be returned + * \param[in] size Maximum number of characters of value to be returned + * \param[out] buf A buffer to hold the name of the object being sought + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function H5Lget_val(). + * + * \details H5Gget_linkval() returns up to size characters of the name of the + * object that the symbolic link name points to. + * + * The parameter \p loc_id is a file or group identifier. + * + * The parameter \p name must be a symbolic link pointing to the + * desired object and must be defined relative to \p loc_id. + * + * If size is smaller than the size of the returned object name, then + * the name stored in the buffer value will not be \c NULL terminated. + * + * This function fails if \p name is not a symbolic link. The presence + * of a symbolic link can be tested by passing zero for \p size and \p + * NULL for value. + * + * This function should be used only after H5Lget_info1() (or the + * deprecated function H5Gget_objinfo()) has been called to verify that + * name is a symbolic link. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Sets comment for specified object + * + * \fgdt_loc_id + * \param[in] name Name of the object whose comment is to be set or reset + * name must be \Code{'.'} (dot) if \p loc_id fully specifies + * the object for which the comment is to be set. + * \param[in] comment The new comment + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function + * H5Oset_comment(). + * + * \details H5Gset_comment() sets the comment for the object specified by \p + * loc_id and name to comment. Any previously existing comment is + * overwritten. + * + * \p loc_id can specify any object in the file. name can be one of the + * following: + * \li The name of the object relative to \p loc_id + * \li An absolute name of the object, starting from \c /, the file’s + * root group + * \li A dot (\c .), if \p loc_id fully specifies the object + * + * If \p comment is the empty string or a null pointer, the comment + * message is removed from the object. + * + * Comments should be relatively short, null-terminated, ASCII strings. + * + * Comments can be attached to any object that has an object header, + * e.g., datasets, groups, and named datatypes, but not symbolic links. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Retrieves comment for specified object + * + * \fgdt_loc_id + * \param[in] name Name of the object whose comment is to be set or reset + * name must be \Code{'.'} (dot) if \p loc_id fully specifies + * the object for which the comment is to be set. + * \param[in] bufsize Maximum number of comment characters to be returned in \p buf. + * \param[in] buf The comment + * + * \return Returns the number of characters in the comment, counting the \c NULL + * terminator, if successful; the value returned may be larger than + * \p bufsize. Otherwise returns a negative value. + * + * \deprecated This function is deprecated in favor of the function + * H5Oget_comment(). + * + * \details H5Gget_comment() retrieves the comment for the the object specified + * by \p loc_id and \p name. The comment is returned in the buffer \p + * buf. + * + * \p loc_id can specify any object in the file. name can be one of the + * following: + * \li The name of the object relative to \p loc_id + * \li An absolute name of the object, starting from \c /, the file’s + * root group + * \li A dot (\c .), if \p loc_id fully specifies the object + * + * At most bufsize characters, including a null-terminator, are + * returned in \p buf. The returned value is not null-terminated if the + * comment is longer than the supplied buffer. If the size of the + * comment is unknown, a preliminary \p H5Gget_comment() call will + * return the size of the comment, including space for the + * null-terminator. + * + * If an object does not have a comment, the empty string is returned + * in comment. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Iterates over the entries of a group invoking a callback for each + * entry encountered + * + * \fg_loc_id + * \param[in] name Group over which the iteration is performed + * \param[in,out] idx Location at which to begin the iteration + * \param[in] op Operation to be performed on an object at each step of the + * iteration + * \param[in,out] op_data Data associated with the operation + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function + * H5Literate1(). + * + * \details H5Giterate() iterates over the members of name in the file or group + * specified with \p loc_id. For each object in the group, the \p + * op_data and some additional information, specified below, are passed + * to the operator function. The iteration begins with the \p idx + * object in the group and the next element to be processed by the + * operator is returned in \p idx. If \p idx is NULL, then the iterator + * starts at the first group member; since no stopping point is + * returned in this case, the iterator cannot be restarted if one of + * the calls to its operator returns non-zero. H5Giterate() does not + * recursively follow links into subgroups of the specified group. + * + * The prototype for \ref H5G_iterate_t is: + * \snippet this H5G_iterate_t_snip + * + * The operation receives the group identifier for the group being + * iterated over, \p group, the name of the current object within + * the group, \p name, and the pointer to the operator data + * passed in to H5Giterate(), \p op_data. + * + * The return values from an operator are: + * \li Zero causes the iterator to continue, returning zero when all + * group members have been processed. + * \li Positive causes the iterator to immediately return that positive + * value, indicating short-circuit success. The iterator can be + * restarted at the next group member. + * \li Negative causes the iterator to immediately return that value, + * indicating failure. The iterator can be restarted at the next + * group member. + * + * H5Giterate() assumes that the membership of the group identified by + * \p name remains unchanged through the iteration. If the membership + * changes during the iteration, the function's behavior is undefined. + * + * H5Giterate() is not recursive. In particular, if a member of \p name + * is found to be a group, call it \c subgroup_a, H5Giterate() does not + * examine the members of \c subgroup_a. When recursive iteration is + * required, the application must handle the recursion, explicitly + * calling H5Giterate() on discovered subgroups. + + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns number of objects in the group specified by its identifier + * + * \fg_loc_id + * \param[out] num_objs Number of objects in the group + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function H5Gget_info(). + * + * \details H5Gget_num_objs() returns number of objects in a group. Group is + * specified by its identifier \p loc_id. If a file identifier is + * passed in, then the number of objects in the root group is returned. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns information about an object. + * + * \fgdt_loc_id + * \param[in] name Name of the object for which status is being sought + * \param[in] follow_link Link flag + * \param[out] statbuf Buffer in which to return information about the object + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the functions H5Oget_info() + * and H5Lget_info1(). + * + * \details H5Gget_objinfo() returns information about the specified object + * through the \p statbuf argument. + * + * A file or group identifier, \p loc_id, and an object name, \p name, + * relative to \p loc_id, are commonly used to specify the + * object. However, if the object identifier is already known to the + * application, an alternative approach is to use that identifier, \c + * obj_id, in place of \p loc_id, and a dot (\c .) in place of \p + * name. Thus, the alternative versions of the first portion of an + * H5Gget_objinfo() call would be as follows: + * \code + * H5Gget_objinfo (loc_id name ...) + * H5Gget_objinfo (obj_id . ...) + * \endcode + * + * If the object is a symbolic link and follow_link is zero (0), then + * the information returned describes the link itself; otherwise the + * link is followed and the information returned describes the object + * to which the link points. If \p follow_link is non-zero but the + * final symbolic link is dangling (does not point to anything), then + * an error is returned. The \p statbuf fields are undefined for an + * error. The existence of an object can be tested by calling this + * function with a \c NULL \p statbuf. + * + * H5Gget_objinfo() fills in the following data structure (defined in + * H5Gpublic.h): + * \snippet this H5G_stat_t_snip + * + * where \ref H5O_stat_t (defined in H5Opublic.h) is: + * \snippet H5Opublic.h H5O_stat_t_snip + * + * \attention Some systems will be able to record the time accurately but unable + * to retrieve the correct time; such systems (e.g., Irix64) will + * report an \c mtime value of 0 (zero). + * + * \version 1.8.0 Function deprecated in this release. + * \version 1.6.1 Two new fields were added to the \ref H5G_stat_t struct in + * this release. + * + */ +H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, + H5G_stat_t *statbuf /*out*/); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns a name of an object specified by an index + * + * \fg_loc_id + * \param[in] idx Transient index identifying object + * \param[in,out] name Pointer to user-provided buffer the object name + * \param[in] size Name length + * + * \return Returns the size of the object name if successful, or 0 if no name is + * associated with the group identifier. Otherwise returns a negative + * value. + * + * \deprecated This function is deprecated in favor of the function H5Lget_name_by_idx(). + * + * \details H5Gget_objname_by_idx() returns a name of the object specified by + * the index \p idx in the group \p loc_id. + * + * The group is specified by a group identifier \p loc_id. If + * preferred, a file identifier may be passed in \p loc_id; that file's + * root group will be assumed. + * + * \p idx is the transient index used to iterate through the objects in + * the group. The value of \p idx is any nonnegative number less than + * the total number of objects in the group, which is returned by the + * function H5Gget_num_objs(). Note that this is a transient index; an + * object may have a different index each time a group is opened. + * + * The object name is returned in the user-specified buffer \p name. + * + * If the size of the provided buffer \p name is less or equal the + * actual object name length, the object name is truncated to + * \Code{max_size - 1} characters. + * + * Note that if the size of the object's name is unkown, a preliminary + * call to H5Gget_objname_by_idx() with \p name set to \c NULL will + * return the length of the object's name. A second call to + * H5Gget_objname_by_idx() can then be used to retrieve the actual + * name. + * + * \version 1.8.0 Function deprecated in this release. + * \since 1.6.0 + * + */ +H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns the type of an object specified by an index + * + * \fg_loc_id + * \param[in] idx Transient index identifying object + * + * \return Returns the type of the object if successful. Otherwise returns a + * negative value. + * + * \deprecated This function is deprecated in favor of the function H5Oget_info(). + * + * \details H5Gget_objtype_by_idx() returns the type of the object specified by + * the index \p idx in the group \p loc_id. + * + * The group is specified by a group identifier \p loc_id. If + * preferred, a file identifier may be passed in \p loc_id; that file's + * root group will be assumed. + * + * \p idx is the transient index used to iterate through the objects in + * the group. This parameter is described in more detail in the + * discussion of H5Gget_objname_by_idx(). + * + * \version 1.8.0 Function deprecated in this release. + * \version 1.6.0 The function return type changed from \c int to the enumerated + * type \ref H5G_obj_t. + * \since 1.6.0 + * + */ H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index be347e4..8e5e167 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -32,6 +32,7 @@ * test/tmisc.c to verify that the H5I{inc|dec|get}_ref() routines * work correctly with it. \endinternal */ +//! typedef enum H5I_type_t { H5I_UNINIT = (-2), /**< uninitialized type */ H5I_BADID = (-1), /**< invalid Type */ @@ -53,6 +54,7 @@ typedef enum H5I_type_t { H5I_EVENTSET, /**< type ID for event sets */ H5I_NTYPES /**< number of library types, MUST BE LAST! */ } H5I_type_t; +//! /** * Type of IDs to return to users @@ -86,30 +88,30 @@ typedef herr_t (*H5I_free_t)(void *, void **); /** * The type of a function to compare objects & keys */ -//! [H5I_search_func_t_snip] +//! typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); -//! [H5I_search_func_t_snip] +//! /** * The type of H5Iiterate() callback functions */ -//! [H5I_iterate_func_t_snip] +//! typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); -//! [H5I_iterate_func_t_snip] +//! /** * The type of the realize_cb callback for H5Iregister_future */ -//! [H5I_future_realize_func_t_snip] +//! typedef herr_t (*H5I_future_realize_func_t)(void *future_object, hid_t *actual_object_id); -//! [H5I_future_realize_func_t_snip] +//! /** * The type of the discard_cb callback for H5Iregister_future */ -//! [H5I_future_discard_func_t_snip] +//! typedef herr_t (*H5I_future_discard_func_t)(void *future_object); -//! [H5I_future_discard_func_t_snip] +//! #ifdef __cplusplus extern "C" { @@ -173,7 +175,7 @@ H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object); * * \details The \p realize_cb parameter is a function pointer that will be * invoked by the HDF5 library to convert a future object into an - * actual object. The \realize_cb function may be invoked by + * actual object. The \p realize_cb function may be invoked by * H5Iobject_verify() to return the actual object for a user-defined * ID class (i.e. an ID class registered with H5Iregister_type()) or * internally by the HDF5 library in order to use or get information @@ -281,7 +283,7 @@ H5_DLL void *H5Iremove_verify(hid_t id, H5I_type_t type); * \p id. * * Valid types returned by the function are: - * \types + * \id_types * * If no valid type can be determined or the identifier submitted is * invalid, the function returns #H5I_BADID. diff --git a/src/H5Lmodule.h b/src/H5Lmodule.h index 54b94a4..16f1f34 100644 --- a/src/H5Lmodule.h +++ b/src/H5Lmodule.h @@ -35,6 +35,8 @@ * * \defgroup TRAV Link Traversal * \ingroup H5L + * \defgroup H5LA Advanced Link Functions + * \ingroup H5L */ #endif /* H5Lmodule_H */ diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index d5ec346..4b5e9e4 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -92,7 +92,7 @@ typedef enum { /** * \brief Information struct for links */ -//! [H5L_info2_t_snip] +//! typedef struct { H5L_type_t type; /**< Type of link */ hbool_t corder_valid; /**< Indicate if creation order is valid */ @@ -103,7 +103,7 @@ typedef struct { size_t val_size; /**< Size of a soft link or user-defined link value */ } u; } H5L_info2_t; -//! [H5L_info2_t_snip] +//! /* The H5L_class_t struct can be used to override the behavior of a * "user-defined" link class. Users should populate the struct with callback @@ -150,7 +150,7 @@ typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, * "user-defined" link class. Users should populate the struct with callback * functions defined elsewhere. */ -//! [H5L_class_t_snip] +//! typedef struct { int version; /**< Version number of this struct */ H5L_type_t id; /**< Link type ID */ @@ -162,16 +162,16 @@ typedef struct { H5L_delete_func_t del_func; /**< Callback for link deletion */ H5L_query_func_t query_func; /**< Callback for queries */ } H5L_class_t; -//! [H5L_class_t_snip] +//! /** * \brief Prototype for H5Literate2(), H5Literate_by_name2() operator * * The H5O_token_t version is used in the VOL layer and future public API calls. */ -//! [H5L_iterate2_t_snip] +//! typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); -//! [H5L_iterate2_t_snip] +//! /** * \brief Callback for external link traversal @@ -201,8 +201,6 @@ typedef herr_t (*H5L_elink_traverse_t)(const char *parent_file_name, const char * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lmove() moves a link within an HDF5 file. The original link, * \p src_name, is removed from \p src_loc and the new link, * \p dst_name, is inserted at dst_loc. This change is @@ -321,8 +319,6 @@ H5_DLL herr_t H5Lcopy(hid_t src_loc, const char *src_name, hid_t dst_loc, const * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lcreate_hard() creates a new hard link to a pre-existing object * in an HDF5 file. * @@ -357,6 +353,11 @@ H5_DLL herr_t H5Lcopy(hid_t src_loc, const char *src_name, hid_t dst_loc, const */ H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name, hid_t dst_loc, const char *dst_name, hid_t lcpl_id, hid_t lapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Lcreate_hard} + */ H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_line, hid_t cur_loc_id, 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); @@ -373,8 +374,6 @@ H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, u * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lcreate_soft() creates a new soft link to an object in an HDF5 * file. * @@ -426,6 +425,11 @@ H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, u */ H5_DLL herr_t H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Lcreate_soft} + */ H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_line, const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id, hid_t es_id); @@ -440,8 +444,6 @@ H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, u * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Ldelete() removes the link specified by \p name from the location * \p loc_id. * @@ -468,6 +470,11 @@ H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, u * */ H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Ldelete} + */ H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t lapl_id, hid_t es_id); /** @@ -484,8 +491,6 @@ H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsign * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Ldelete_by_idx() removes the \Emph{n}-th link in a group * according to the specified order, \p order, in the specified index, * \p index. @@ -500,6 +505,11 @@ H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsign */ H5_DLL herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Ldelete_by_idx} + */ H5_DLL herr_t H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); @@ -516,8 +526,6 @@ H5_DLL herr_t H5Ldelete_by_idx_async(const char *app_file, const char *app_func, * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lget_val() returns tha value of link \p name. For smbolic links, * this is the path to which the link points, including the null * terminator. For external and user-defined links, it is the link @@ -575,8 +583,6 @@ H5_DLL herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lget_val_by_idx() retrieves the value of the \Emph{n}-th link in * a group, according to the specified order, \p order, within an * index, \p index. @@ -630,8 +636,6 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lexists() allows an application to determine whether the link \p * name exists in the location specified by \p loc_id. The link may be * of any type; only the presence of a link with that name is checked. @@ -707,6 +711,11 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t * */ H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Lexists} + */ H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hbool_t *exists, hid_t lapl_id, hid_t es_id); /** @@ -721,8 +730,6 @@ H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsign * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lget_info2() returns information about the specified link through * the \p linfo argument. * @@ -830,8 +837,6 @@ H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo, h * * \see H5Lget_info2() * - * \todo Document H5Lget_info_by_idx() - * */ H5_DLL 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, hid_t lapl_id); @@ -957,6 +962,11 @@ H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index */ H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Literate} + */ H5_DLL herr_t H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op, void *op_data, hid_t es_id); @@ -1642,8 +1652,10 @@ H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hi /* Typedefs */ -/* Information struct for link (for H5Lget_info1/H5Lget_info_by_idx1) */ -//! [H5L_info1_t_snip] +//! +/** + * Information struct for link (for H5Lget_info1() and H5Lget_info_by_idx1()) + */ typedef struct { H5L_type_t type; /**< Type of link */ hbool_t corder_valid; /**< Indicate if creation order is valid */ @@ -1654,7 +1666,7 @@ typedef struct { size_t val_size; /**< Size of a soft link or UD link value */ } u; } H5L_info1_t; -//! [H5L_info1_t_snip] +//! /** Callback during link traversal */ typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata, @@ -1674,9 +1686,9 @@ typedef struct { } H5L_class_0_t; /** Prototype for H5Literate1() / H5Literate_by_name1() operator */ -//! [H5L_iterate1_t_snip] +//! typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, void *op_data); -//! [H5L_iterate1_t_snip] +//! /* Function prototypes */ /** @@ -1694,8 +1706,6 @@ typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of * the function H5Lget_info2() or the macro H5Lget_info(). * - * \todo We need to get the location ID story straight! - * * \details H5Lget_info1() returns information about the specified link through * the \p linfo argument. * diff --git a/src/H5MMpublic.h b/src/H5MMpublic.h index ebfb377..70ac644 100644 --- a/src/H5MMpublic.h +++ b/src/H5MMpublic.h @@ -29,8 +29,13 @@ #include "H5public.h" /* These typedefs are currently used for VL datatype allocation/freeing */ +//! typedef void *(*H5MM_allocate_t)(size_t size, void *alloc_info); +//! + +//! typedef void (*H5MM_free_t)(void *mem, void *free_info); +//! #ifdef __cplusplus extern "C" { diff --git a/src/H5Mmodule.h b/src/H5Mmodule.h index 8b4f11f..3dae3e2 100644 --- a/src/H5Mmodule.h +++ b/src/H5Mmodule.h @@ -26,4 +26,49 @@ #define H5_MY_PKG_ERR H5E_MAP #define H5_MY_PKG_INIT YES +/** + * \defgroup H5M H5M + * \brief Map Interface + * + * \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 + * feature. + * + * While the HDF5 data model is a flexible way to store data, some + * applications require a more general way to index information. HDF5 + * effectively uses key-value stores internally for a variety of + * purposes, but it does not expose a generic key-value store to the + * API. The Map APIs provide this capability to the HDF5 applications + * in the form of HDF5 map objects. These Map objects contain + * application-defined key-value stores, to which key-value pairs can + * be added, and from which values can be retrieved by key. + * + * HDF5 VOL connectors with support for map objects: + * - DAOS + * + * \par Example: + * \code + * hid_t file_id, fapl_id, map_id, vls_type_id; + * const char *names[2] = ["Alice", "Bob"]; + * uint64_t IDs[2] = [25385486, 34873275]; + * uint64_t val_out; + * + * + * + * vls_type_id = H5Tcopy(H5T_C_S1); + * H5Tset_size(vls_type_id, H5T_VARIABLE); + * file_id = H5Fcreate("file.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + * map_id = H5Mcreate(file_id, "map", vls_type_id, H5T_NATIVE_UINT64, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * H5Mput(map_id, vls_type_id, &names[0], H5T_NATIVE_UINT64, &IDs[0], H5P_DEFAULT); + * H5Mput(map_id, vls_type_id, &names[1], H5T_NATIVE_UINT64, &IDs[1], H5P_DEFAULT); + * H5Mget(map_id, vls_type_id, &names[0], H5T_NATIVE_UINT64, &val_out, H5P_DEFAULT); + * if(val_out != IDs[0]) + * ERROR; + * H5Mclose(map_id); + * H5Tclose(vls_type_id); + * H5Fclose(file_id); + * \endcode + * + */ + #endif /* H5Dmodule_H */ diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h index 4d8bef4..e0be828 100644 --- a/src/H5Mpublic.h +++ b/src/H5Mpublic.h @@ -61,8 +61,12 @@ typedef enum H5VL_map_specific_t { H5VL_MAP_DELETE /* H5Mdelete */ } H5VL_map_specific_t; -/* Callback for H5Miterate() */ +//! +/** + * Callback for H5Miterate() + */ typedef herr_t (*H5M_iterate_t)(hid_t map_id, const void *key, void *op_data); +//! /********************/ /* Public Variables */ @@ -81,38 +85,397 @@ extern "C" { */ #ifdef H5_HAVE_MAP_API +/** + * \ingroup H5M + * + * \brief Creates a map object + * + * \fgdta_loc_id + * \param[in] name Map object name + * \type_id{key_type_id} + * \type_id{val_type_id} + * \lcpl_id + * \mcpl_id + * \mapl_id + * \returns \hid_t{map object} + * + * \details H5Mcreate() creates a new map object for storing key-value + * pairs. The in-file datatype for keys is defined by \p key_type_id + * and the in-file datatype for values is defined by \p val_type_id. \p + * loc_id specifies the location to create the the map object and \p + * name specifies the name of the link to the map object relative to + * \p loc_id. + * + * \since 1.13.0 + * + */ H5_DLL hid_t H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Mcreate} + */ H5_DLL hid_t H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id, hid_t es_id); + +/** + * \ingroup H5M + * + * \brief + * + * \details + * + * \since 1.13.0 + * + */ H5_DLL 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); + +/** + * \ingroup H5M + * + * \brief Opens a map object + * + * \fgdta_loc_id{loc_id} + * \param[in] name Map object name relative to \p loc_id + * \mapl_id + * \returns \hid_t{map object} + * + * \details H5Mopen() finds a map object specified by \p name under the location + * specified by \p loc_id. The map object should be close with + * H5Mclose() when the application is not longer interested in + * accessing it. + * + * \since 1.13.0 + * + */ H5_DLL hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Mopen} + */ H5_DLL hid_t H5Mopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t mapl_id, hid_t es_id); + +/** + * \ingroup H5M + * + * \brief Terminates access to a map object + * + * \map_id + * \returns \herr_t + * + * \details H5Mclose() closes access to a map object specified by \p map_id and + * releases resources used by it. + * + * It is illegal to subsequently use that same map identifier in calls + * to other map functions. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5Mclose(hid_t map_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Mclose} + */ H5_DLL herr_t H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id, hid_t es_id); -H5_DLL hid_t H5Mget_key_type(hid_t map_id); -H5_DLL hid_t H5Mget_val_type(hid_t map_id); -H5_DLL hid_t H5Mget_create_plist(hid_t map_id); -H5_DLL hid_t H5Mget_access_plist(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Gets key datatype for a map object + * + * \map_id + * \returns \hid_t{datatype} + * + * \details H5Mget_key_type() retrieves key datatype as stored in the file for a + * map object specified by \p map_id and returns identifier for the + * datatype. + * + * \since 1.13.0 + * + */ +H5_DLL hid_t H5Mget_key_type(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Gets value datatype for a map object + * + * \map_id + * \returns \hid_t{datatype} + * + * \details H5Mget_val_type() retrieves value datatype as stored in the file for + * a map object specified by \p map_id and returns identifier for the + * datatype . + * + * \since 1.13.0 + * + */ +H5_DLL hid_t H5Mget_val_type(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Gets creation property list for a map object + * + * \map_id + * \returns \hid_t{map creation property list} + * + * \details H5Mget_create_plist() returns an identifier for a copy of the + * creation property list for a map object specified by \p map_id. + * + * \since 1.13.0 + * + */ +H5_DLL hid_t H5Mget_create_plist(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Gets access property list for a map object + * + * \map_id + * \returns \hid_t{map access property list} + * + * \details H5Mget_access_plist() returns an identifier for a copy of the access + * property list for a map object specified by \p map_id. + * + * \since 1.13.0 + * + */ +H5_DLL hid_t H5Mget_access_plist(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Retrieves the number of key-value pairs in a map object + * + * \map_id + * \param[out] count The number of key-value pairs stored in the map object + * \dxpl_id + * \returns \herr_t + * + * \details H5Mget_count() retrieves the number of key-value pairs stored in a + * map specified by map_id. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id); + +/** + * \ingroup H5M + * + * \brief Adds a key-value pair to a map object + * + * \map_id + * \type_id{key_mem_type_id} + * \param[in] key Pointer to key buffer + * \type_id{val_mem_type_id} + * \param[in] value Pointer to value buffer + * \dxpl_id + * \returns \herr_t + * + * \details H5Mput() adds a key-value pair to a map object specified by \p + * map_id, or updates the value for the specified key if one was set + * previously. + * + * \p key_mem_type_id and \p val_mem_type_id specify the datatypes for + * the provided key and value buffers, and if different from those used + * to create the map object, the key and value will be internally + * converted to the datatypes for the map object. + * + * Any further options can be specified through the property list + * \p dxpl_id. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, const void *value, hid_t dxpl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Mput} + */ H5_DLL herr_t H5Mput_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, const void *value, hid_t dxpl_id, hid_t es_id); + +/** + * \ingroup H5M + * + * \brief Retrieves a key-value pair from a map object + * + * \map_id + * \type_id{key_mem_type_id} + * \param[in] key Pointer to key buffer + * \type_id{val_mem_type_id} + * \param[out] value Pointer to value buffer + * \dxpl_id + * \returns \herr_t + * + * \details H5Mget() retrieves from a map object specified by \p map_id, the + * value associated with the provided key \p key. \p key_mem_type_id + * and \p val_mem_type_id specify the datatypes for the provided key + * and value buffers. If if the datatype specified by \p + * key_mem_type_id is different from that used to create the map object + * the key will be internally converted to the datatype for the map + * object for the query, and if the datatype specified by \p + * val_mem_type_id is different from that used to create the map object + * the returned value will be converted to have a datatype as specified + * by \p val_mem_type_id before the function returns. + * + * Any further options can be specified through the property list + * \p dxpl_id. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value, hid_t dxpl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Mget} + */ H5_DLL herr_t H5Mget_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value, hid_t dxpl_id, hid_t es_id); + +/** + * \ingroup H5M + * + * \brief Checks if provided key exists in a map object + * + * \map_id + * \type_id{key_mem_type_id} + * \param[in] key Pointer to key buffer + * \param[out] exists Pointer to a buffer to return the existence status + * \dxpl_id + * \returns \herr_t + * + * \details H5Mexists() checks if the provided key is stored in the map object + * specified by \p map_id. If \p key_mem_type_id is different from that + * used to create the map object the key will be internally converted + * to the datatype for the map object for the query. + * + * Any further options can be specified through the property list + * \p dxpl_id. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, hid_t dxpl_id); + +/** + * \ingroup H5M + * + * \brief Iterates over all key-value pairs in a map object + * + * \map_id + * \param[in,out] idx iteration index + * \type_id{key_mem_type_id} + * \param[in] op User-defined iterator function + * \op_data + * \dxpl_id + * \returns \herr_t + * + * \details H5Miterate() iterates over all key-value pairs stored in the map + * object specified by \p map_id, making the callback specified by \p + * op for each. The \p idx parameter is an in/out parameter that may be + * used to restart a previously interrupted iteration. At the start of + * iteration \p idx should be set to 0, and to restart iteration at the + * same location on a subsequent call to H5Miterate(), \p idx should be + * the same value as returned by the previous call. Iterate callback is + * defined as: + * \snippet this H5M_iterate_t_snip + * The \p key parameter is the buffer for the key for this iteration, + * converted to the datatype specified by \p key_mem_type_id. The \p + * op_data parameter is a simple pass through of the value passed to + * H5Miterate(), which can be used to store application-defined data for + * iteration. A negative return value from this function will cause + * H5Miterate() to issue an error, while a positive return value will + * cause H5Miterate() to stop iterating and return this value without + * issuing an error. A return value of zero allows iteration to continue. + * + * Any further options can be specified through the property list \p dxpl_id. + * + * \since 1.13.0 + * + */ H5_DLL 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); + +/** + * \ingroup H5M + * + * \brief Iterates over all key-value pairs in a map object + * + * \loc_id + * \param[in] map_name Map object name relative to the location specified by \p loc_id + * \param[in,out] idx Iteration index + * \type_id{key_mem_type_id} + * \param[in] op User-defined iterator function + * \op_data + * \dxpl_id + * \lapl_id + * \returns \herr_t + * + * \details H5Miterate_by_name() iterates over all key-value pairs stored in the + * map object specified by \p map_id, making the callback specified by + * \p op for each. The \p idx parameter is an in/out parameter that may + * be used to restart a previously interrupted iteration. At the start + * of iteration \p idx should be set to 0, and to restart iteration at + * the same location on a subsequent call to H5Miterate(), \p idx + * should be the same value as returned by the previous call. Iterate + * callback is defined as: + * \snippet this H5M_iterate_t_snip + * The\p key parameter is the buffer for the key for this iteration, + * converted to the datatype specified by \p key_mem_type_id. The \p + * op_data parameter is a simple pass through of the value passed to + * H5Miterate(), which can be used to store application-defined data + * for iteration. A negative return value from this function will cause + * H5Miterate() to issue an error, while a positive return value will cause + * H5Miterate() to stop iterating and return this value without issuing an + * error. A return value of zero allows iteration to continue. + * + * Any further options can be specified through the property list \p dxpl_id. + * + * \since 1.13.0 + * + */ H5_DLL 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); + +/** + * \ingroup H5M + * + * \brief Deletes a key-value pair from a map object + * + * \map_id + * \type_id{key_mem_type_id} + * \param[in] key Pointer to key buffer + * \dxpl_id + * \returns \herr_t + * + * \details H5Mdelete() deletes a key-value pair from the map object specified + * by \p map_id. \p key_mem_type_id specifies the datatype for the + * provided key buffer key, and if different from that used to create + * the map object, the key will be internally converted to the datatype + * for the map object. + * + * Any further options can be specified through the property list \p dxpl_id. + * + * \since 1.13.0 + * + */ H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id); /* API Wrappers for async routines */ diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 04ef35b..7bc7784 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -86,17 +86,15 @@ #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) -/* Flags for H5Oget_native_info. - * Theses flags determine which fields will be filled in in the H5O_native_info_t - * struct. +//! +/** + * Flags for H5Oget_native_info(). Theses flags determine which fields will be + * filled in in the \ref H5O_native_info_t struct. */ -//! [H5O_native_info_fields_snip] - #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] +//! /* Convenience macro to check if the token is the 'undefined' token value */ #define H5O_IS_TOKEN_UNDEF(token) (!HDmemcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t))) @@ -105,46 +103,48 @@ /* Public Typedefs */ /*******************/ -//! [H5O_type_t_snip] - -/* Types of objects in file */ +//! +/** + * Types of objects in file + */ typedef enum H5O_type_t { - H5O_TYPE_UNKNOWN = -1, /* Unknown object type */ - H5O_TYPE_GROUP, /* Object is a group */ - H5O_TYPE_DATASET, /* Object is a dataset */ - H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */ - H5O_TYPE_MAP, /* Object is a map */ - H5O_TYPE_NTYPES /* Number of different object types (must be last!) */ + H5O_TYPE_UNKNOWN = -1, /**< Unknown object type */ + H5O_TYPE_GROUP, /**< Object is a group */ + H5O_TYPE_DATASET, /**< Object is a dataset */ + H5O_TYPE_NAMED_DATATYPE, /**< Object is a named data type */ + H5O_TYPE_MAP, /**< Object is a map */ + H5O_TYPE_NTYPES /**< Number of different object types (must be last!) */ } H5O_type_t; +//! -//! [H5O_type_t_snip] - -/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */ -//! [H5O_hdr_info_t_snip] - +//! +/** + * Information struct for object header metadata (for + * H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx()) + */ typedef struct H5O_hdr_info_t { - unsigned version; /* Version number of header format in file */ - unsigned nmesgs; /* Number of object header messages */ - unsigned nchunks; /* Number of object header chunks */ - unsigned flags; /* Object header status flags */ + unsigned version; /**< Version number of header format in file */ + unsigned nmesgs; /**< Number of object header messages */ + unsigned nchunks; /**< Number of object header chunks */ + unsigned flags; /**< Object header status flags */ struct { - hsize_t total; /* Total space for storing object header in file */ - hsize_t meta; /* Space within header for object header metadata information */ - hsize_t mesg; /* Space within header for actual message information */ - hsize_t free; /* Free space within object header */ + hsize_t total; /**< Total space for storing object header in file */ + hsize_t meta; /**< Space within header for object header metadata information */ + hsize_t mesg; /**< Space within header for actual message information */ + hsize_t free; /**< Free space within object header */ } space; struct { - uint64_t present; /* Flags to indicate presence of message type in header */ - uint64_t shared; /* Flags to indicate message type is shared in header */ + uint64_t present; /**< Flags to indicate presence of message type in header */ + uint64_t shared; /**< Flags to indicate message type is shared in header */ } mesg; } H5O_hdr_info_t; +//! -//! [H5O_hdr_info_t_snip] - -//! [H5O_info2_t_snip] - -/* Data model information struct for objects */ -/* (For H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx version 3) */ +//! +/** + * Data model information struct for objects + * (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 */ @@ -156,44 +156,52 @@ typedef struct H5O_info2_t { time_t btime; /* Birth time */ hsize_t num_attrs; /* # of attributes attached to object */ } H5O_info2_t; +//! -//! [H5O_info2_t_snip] - -//! [H5O_native_info_t_snip] - -/* Native file format information struct for objects */ -/* (For H5Oget_native_info / H5Oget_native_info_by_name / H5Oget_native_info_by_idx) */ +//! +/** + * Native file format information struct for objects. + * (For H5Oget_native_info(), H5Oget_native_info_by_name(), H5Oget_native_info_by_idx()) + */ typedef struct H5O_native_info_t { - H5O_hdr_info_t hdr; /* Object header information */ + 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 */ + 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; } H5O_native_info_t; +//! -//! [H5O_native_info_t_snip] - -/* Typedef for message creation indexes */ +/** + * Typedef for message creation indexes + */ typedef uint32_t H5O_msg_crt_idx_t; -/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (version 3) */ -//! [H5O_iterate2_t_snip] - +//! +/** + * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (version 3) + */ typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data); +//! -//! [H5O_iterate2_t_snip] - +//! typedef enum H5O_mcdt_search_ret_t { - H5O_MCDT_SEARCH_ERROR = -1, /* Abort H5Ocopy */ - H5O_MCDT_SEARCH_CONT, /* Continue the global search of all committed datatypes in the destination file */ - H5O_MCDT_SEARCH_STOP /* Stop the search, but continue copying. The committed datatype will be copied but - not merged. */ + H5O_MCDT_SEARCH_ERROR = -1, /**< Abort H5Ocopy */ + H5O_MCDT_SEARCH_CONT, /**< Continue the global search of all committed datatypes in the destination file + */ + H5O_MCDT_SEARCH_STOP /**< Stop the search, but continue copying. The committed datatype will be copied + but not merged. */ } H5O_mcdt_search_ret_t; +//! -/* Callback to invoke when completing the search for a matching committed datatype from the committed dtype - * list */ +//! +/** + * Callback to invoke when completing the search for a matching committed + * datatype from the committed dtype list + */ typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data); +//! /********************/ /* Public Variables */ @@ -249,6 +257,11 @@ extern "C" { * */ H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Oopen} + */ H5_DLL hid_t H5Oopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t lapl_id, hid_t es_id); @@ -332,6 +345,11 @@ H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token); */ H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Oopen_by_idx} + */ H5_DLL hid_t H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); @@ -553,6 +571,11 @@ H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields); */ H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Oget_info_by_name} + */ H5_DLL herr_t H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, H5O_info2_t *oinfo /*out*/, unsigned fields, hid_t lapl_id, hid_t es_id); @@ -968,7 +991,6 @@ H5_DLL herr_t H5Odecr_refcount(hid_t object_id); * - H5Pset_copy_object() * - H5Pset_create_intermediate_group() * - H5Pset_mcdt_search_cb() - * . * - Copying Committed Datatypes with #H5Ocopy - A comprehensive * discussion of copying committed datatypes (PDF) in * Advanced Topics in HDF5 @@ -980,6 +1002,11 @@ H5_DLL herr_t H5Odecr_refcount(hid_t object_id); */ H5_DLL herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Ocopy} + */ H5_DLL herr_t H5Ocopy_async(const char *app_file, const char *app_func, unsigned app_line, hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t es_id); @@ -1522,6 +1549,11 @@ H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t i * */ H5_DLL herr_t H5Oclose(hid_t object_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Oclose} + */ H5_DLL herr_t H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id, hid_t es_id); @@ -1572,6 +1604,11 @@ H5_DLL herr_t H5Oclose_async(const char *app_file, const char *app_func, unsigne * */ H5_DLL herr_t H5Oflush(hid_t obj_id); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Oflush} + */ H5_DLL herr_t H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, hid_t es_id); /** @@ -1599,6 +1636,11 @@ H5_DLL herr_t H5Oflush_async(const char *app_file, const char *app_func, unsigne * */ H5_DLL herr_t H5Orefresh(hid_t oid); +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Orefresh} + */ H5_DLL herr_t H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, hid_t oid, hid_t es_id); @@ -1873,46 +1915,49 @@ H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g; /* Typedefs */ -/* A struct that's part of the H5G_stat_t structure (deprecated) */ -//! [H5O_stat_t_snip] +//! +/** + * A struct that's part of the \ref H5G_stat_t structure + * \deprecated + */ typedef struct H5O_stat_t { - hsize_t size; /* Total size of object header in file */ - hsize_t free; /* Free space within object header */ - unsigned nmesgs; /* Number of object header messages */ - unsigned nchunks; /* Number of object header chunks */ + hsize_t size; /**< Total size of object header in file */ + hsize_t free; /**< Free space within object header */ + unsigned nmesgs; /**< Number of object header messages */ + unsigned nchunks; /**< Number of object header chunks */ } H5O_stat_t; -//! [H5O_stat_t_snip] - -//! [H5O_info1_t_snip] +//! -/* Information struct for object */ -/* (For H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx versions 1 & 2) */ +//! +/** + * Information struct for object (For H5Oget_info(), H5Oget_info_by_name(), + * H5Oget_info_by_idx() versions 1 & 2.) + */ typedef struct H5O_info1_t { - unsigned long fileno; /* File number that object is located in */ - haddr_t addr; /* Object address in file */ - 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 */ - H5O_hdr_info_t hdr; /* Object header information */ + unsigned long fileno; /**< File number that object is located in */ + haddr_t addr; /**< Object address in file */ + 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 */ + 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 */ + 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; } H5O_info1_t; +//! -//! [H5O_info1_t_snip] - -/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (versions 1 & 2) */ -//! [H5O_iterate1_t_snip] - +//! +/** + * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (versions 1 & 2) + */ typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, void *op_data); - -//! [H5O_iterate1_t_snip] +//! /* Function prototypes */ diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index c3555bc..55ff594 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -28,8 +28,7 @@ */ #define H5PL_NO_PLUGIN "::" -//! [H5PL_type_t_snip] - +//! /** * Plugin type (bit-position) used by the plugin library */ @@ -39,8 +38,7 @@ typedef enum H5PL_type_t { H5PL_TYPE_VOL = 1, /**< VOL driver */ H5PL_TYPE_NONE = 2 /**< Sentinel: This must be last! */ } H5PL_type_t; - -//! [H5PL_type_t_snip] +//! /* Common dynamic plugin type flags used by the set/get_loading_state functions */ #define H5PL_FILTER_PLUGIN 0x0001 diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h index 130cb90..18f30c6 100644 --- a/src/H5Pmodule.h +++ b/src/H5Pmodule.h @@ -44,7 +44,6 @@ * and compressed. * * \todo Describe concisely what the functions in this module are about. - * \todo Clicking on "more" after "Property List Interface" at the top does not work * * \defgroup GPLO General Property List Operations * \ingroup H5P @@ -70,6 +69,10 @@ * \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/H5Ppublic.h b/src/H5Ppublic.h index 801c561..6235ac8 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -111,23 +111,50 @@ extern "C" { /*******************/ /* Define property list class callback function pointer types */ -//! [H5P_cls_create_func_t_snip] +//! 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] +//! + +//! 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] +//! + +//! typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data); -//! [H5P_cls_close_func_t_snip] +//! /* Define property list callback function pointer types */ -//! [H5P_prp_cb1_t_snip] +//! +/** + * \brief Callback function for H5Pregister2(),H5Pregister1(),H5Pinsert2(),H5Pinsert1() + * + * \param[in] name The name of the property + * \param[in] size The size of the property in bytes + * \param[in,out] value The value for the property + * \return \herr_t + * + * \details The H5P_prp_cb1_t() describes the parameters used by the + * property create,copy and close callback functions. + */ typedef herr_t (*H5P_prp_cb1_t)(const char *name, size_t size, void *value); -//! [H5P_prp_cb1_t_snip] -//! [H5P_prp_cb2_t_snip] +//! + +//! +/** + * \brief Callback function for H5Pregister2(),H5Pregister1(),H5Pinsert2(),H5Pinsert1() + * + * \plist_id{prop_id} + * \param[in] name The name of the property + * \param[in] size The size of the property in bytes + * \param[in] value The value for the property + * \return \herr_t + * + * \details The H5P_prp_cb2_t() describes the parameters used by the + * property set ,copy and delete callback functions. + */ typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, void *value); -//! [H5P_prp_cb2_t_snip] +//! + 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; @@ -135,60 +162,93 @@ typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *s typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); 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] + +//! typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); -//! [H5P_prp_compare_func_t_snip] +//! + typedef H5P_prp_cb1_t H5P_prp_close_func_t; /* Define property list iteration function type */ -//! [H5P_iterate_t_snip] +//! typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); -//! [H5P_iterate_t_snip] +//! -/* Actual IO mode property */ +//! +/** + * Actual IO mode property + * + * \details The default value, #H5D_MPIO_NO_CHUNK_OPTIMIZATION, is used for all + * I/O operations that do not use chunk optimizations, including + * non-collective I/O and contiguous collective I/O. + */ typedef enum H5D_mpio_actual_chunk_opt_mode_t { - /* The default value, H5D_MPIO_NO_CHUNK_OPTIMIZATION, is used for all I/O - * operations that do not use chunk optimizations, including non-collective - * I/O and contiguous collective I/O. - */ H5D_MPIO_NO_CHUNK_OPTIMIZATION = 0, + /**< No chunk optimization was performed. Either no collective I/O was + attempted or the dataset wasn't chunked. */ H5D_MPIO_LINK_CHUNK, + /**< Collective I/O is performed on all chunks simultaneously. */ H5D_MPIO_MULTI_CHUNK + /**< Each chunk was individually assigned collective or independent I/O based + on what fraction of processes access the chunk. If the fraction is greater + than the multi chunk ratio threshold, collective I/O is performed on that + chunk. The multi chunk ratio threshold can be set using + H5Pset_dxpl_mpio_chunk_opt_ratio(). The default value is 60%. */ } H5D_mpio_actual_chunk_opt_mode_t; +//! +//! +/** + * The following values are conveniently defined as a bit field so that + * we can switch from the default to independent or collective and then to + * mixed without having to check the original value. + */ typedef enum H5D_mpio_actual_io_mode_t { - /* The following four values are conveniently defined as a bit field so that - * we can switch from the default to independent or collective and then to - * mixed without having to check the original value. - * - * NO_COLLECTIVE means that either collective I/O wasn't requested or that - * no I/O took place. - * - * CHUNK_INDEPENDENT means that collective I/O was requested, but the - * chunk optimization scheme chose independent I/O for each chunk. - */ - H5D_MPIO_NO_COLLECTIVE = 0x0, + H5D_MPIO_NO_COLLECTIVE = 0x0, + /**< No collective I/O was performed. Collective I/O was not requested or + collective I/O isn't possible on this dataset */ H5D_MPIO_CHUNK_INDEPENDENT = 0x1, - H5D_MPIO_CHUNK_COLLECTIVE = 0x2, - H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2, - - /* The contiguous case is separate from the bit field. */ + /**< HDF5 performed one the chunk collective optimization schemes and each + chunk was accessed independently */ + H5D_MPIO_CHUNK_COLLECTIVE = 0x2, + /**< HDF5 performed one the chunk collective optimization schemes and each + chunk was accessed collectively */ + H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2, + /**< HDF5 performed one the chunk collective optimization schemes and some + chunks were accessed independently, some collectively. */ + /** \internal The contiguous case is separate from the bit field. */ H5D_MPIO_CONTIGUOUS_COLLECTIVE = 0x4 + /**< Collective I/O was performed on a contiguous dataset */ } H5D_mpio_actual_io_mode_t; +//! -/* Broken collective IO property */ +//! +/** + * Broken collective IO property + */ typedef enum H5D_mpio_no_collective_cause_t { - H5D_MPIO_COLLECTIVE = 0x00, - H5D_MPIO_SET_INDEPENDENT = 0x01, - H5D_MPIO_DATATYPE_CONVERSION = 0x02, - H5D_MPIO_DATA_TRANSFORMS = 0x04, - H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08, - H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10, - H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20, - H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40, + H5D_MPIO_COLLECTIVE = 0x00, + /**< Collective I/O was performed successfully */ + H5D_MPIO_SET_INDEPENDENT = 0x01, + /**< Collective I/O was not performed because independent I/O was requested */ + H5D_MPIO_DATATYPE_CONVERSION = 0x02, + /**< Collective I/O was not performed because datatype conversions were required */ + H5D_MPIO_DATA_TRANSFORMS = 0x04, + /**< Collective I/O was not performed because data transforms needed to be applied */ + H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08, + /**< \todo FIXME! */ + H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10, + /**< Collective I/O was not performed because one of the dataspaces was neither simple nor scalar */ + H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20, + /**< Collective I/O was not performed because the dataset was neither contiguous nor chunked */ + H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40, + /**< \todo FIXME! */ H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE = 0x80, - H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100 + /**< \todo FIXME! */ + H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100 + /**< Sentinel */ } H5D_mpio_no_collective_cause_t; +//! /********************/ /* Public Variables */ @@ -493,8 +553,6 @@ H5_DLL hid_t H5Pcreate(hid_t cls_id); * list of this class is being created. The #H5P_cls_create_func_t * callback function is defined as follows: * - * \todo fix snippets to work, when you click on them. - * * \snippet this H5P_cls_create_func_t_snip * * The parameters to this callback function are defined as follows: @@ -1233,8 +1291,6 @@ H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size); * property list objects; the initial value is assumed to * have any necessary setup already performed on it. * - * \todo "cpp_note" goes here - * * \since 1.8.0 * */ @@ -1326,9 +1382,6 @@ H5_DLL htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id); * If the membership changes during the iteration, the function's * behavior is undefined. * - * - * \todo "cpp_note" goes here - * * \since 1.4.0 * */ @@ -1582,16 +1635,12 @@ H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_da * property is being closed. The #H5P_prp_close_func_t callback * function is defined as follows: * - * \snippet this H5P_prp_cb2_t_snip + * \snippet this H5P_prp_cb1_t_snip * * The parameters to the callback function are defined as follows: * * * - * - * - * - * * * * @@ -1611,8 +1660,6 @@ H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_da * list close routine returns an error value but the property list is * still closed. * - * \todo "cpp_note" goes here - * * \since 1.8.0 * */ @@ -1701,7 +1748,7 @@ H5_DLL herr_t H5Punregister(hid_t pclass_id, const char *name); /* Object creation property list (OCPL) routines */ /** - * \ingroup OCPL + * \ingroup DCPL * * \brief Verifies that all required filters are available * @@ -1805,7 +1852,7 @@ H5_DLL herr_t H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact, un * \todo Signature for H5Pget_filter2 is different in H5Pocpl.c than in * H5Ppublic.h * - * \plist_id{plist_id} + * \ocpl_id{plist_id} * \param[in] idx Sequence number within the filter pipeline of the filter * for which information is sought * \param[out] flags Bit vector specifying certain general properties of the @@ -1869,7 +1916,7 @@ H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *f * * \brief Returns information about the specified filter * - * \plist_id + * \ocpl_id{plist_id} * \param[in] filter_id Filter identifier * \param[out] flags Bit vector specifying certain general * properties of the filter @@ -1927,10 +1974,7 @@ H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t filter_id, unsig * * \brief Returns the number of filters in the pipeline * - * \todo Signature for H5Pget_nfilters() is different in H5Pocpl.c than in - * H5Ppublic.h. - * - * \plist_id + * \ocpl_id{plist_id} * * \return Returns the number of filters in the pipeline if successful; * otherwise returns a negative value. @@ -1938,8 +1982,8 @@ H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t filter_id, unsig * \details H5Pget_nfilters() returns the number of filters defined in the * filter pipeline associated with the property list \p plist_id. * - * In each pipeline, the filters are numbered from 0 through N-1, - * where N is the value returned by this function. During output to + * In each pipeline, the filters are numbered from 0 through \Code{N-1}, + * where \c N is the value returned by this function. During output to * the file, the filters are applied in increasing order; during * input from the file, they are applied in decreasing order. * @@ -1987,7 +2031,7 @@ H5_DLL herr_t H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times); * * \brief Modifies a filter in the filter pipeline * - * \plist_id + * \ocpl_id{plist_id} * \param[in] filter Filter to be modified * \param[in] flags Bit vector specifying certain general properties * of the filter @@ -2016,7 +2060,7 @@ H5_DLL herr_t H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int * * \brief Delete one or more filters in the filter pipeline * - * \plist_id + * \ocpl_id{plist_id} * \param[in] filter Filter to be deleted * * \return \herr_t @@ -2170,7 +2214,7 @@ H5_DLL herr_t H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, uns * * \brief Sets deflate (GNU gzip) compression method and compression level * - * \plist_id + * \ocpl_id{plist_id} * \param[in] level Compression level * * \return \herr_t @@ -2226,7 +2270,7 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * * \brief Adds a filter to the filter pipeline * - * \param[in] plist_id Dataset or group creation property list identifier + * \ocpl_id{plist_id} * \param[in] filter Filter identifier for the filter to be added to the * pipeline * \param[in] flags Bit vector specifying certain general properties of @@ -2478,7 +2522,7 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * (The SZIP filter is an exception to this rule; see H5Pset_szip() * for details.) * - * \todo Removed several references to links to documentation + * \see \ref_filter_pipe, \ref_group_impls * * \version 1.8.5 Function applied to group creation property lists. * \since 1.6.0 @@ -2491,7 +2535,7 @@ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int fl * * \brief Sets up use of the Fletcher32 checksum filter * - * \param[in] plist_id Dataset or group creation property list identifier + * \ocpl_id{plist_id} * * \return \herr_t * @@ -2672,7 +2716,7 @@ H5_DLL herr_t H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsig /** * \ingroup FCPL * - * \brief Retrieves number of shared object header message indexes in file + * \brief Retrieves the number of shared object header message indexes in file * creation property list * * \fcpl_id{plist_id} @@ -3237,8 +3281,8 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz * * + * with no system buffering. This driver is POSIX-compliant and + * is the default file driver for all systems. * * * @@ -3276,8 +3320,9 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz * * + * memory until the file is closed. At closing, the memory + * version of the file can be written back to disk or abandoned. + * * * * @@ -3286,7 +3331,8 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz * + * systems that do not support files larger than 2 gigabytes. + * * * * @@ -3352,7 +3398,7 @@ H5_DLL hid_t H5Pget_driver(hid_t plist_id); * struct. Driver-specific versions of that struct are defined * for each low-level driver in the relevant source code file * H5FD*.c. For example, the struct used for the MULTI driver is - * #H5FD_multi_fapl_t defined in H5FDmulti.c. + * \c H5FD_multi_fapl_t defined in H5FDmulti.c. * * If no driver-specific properties have been registered, * H5Pget_driver_info() returns NULL. @@ -3369,8 +3415,50 @@ H5_DLL hid_t H5Pget_driver(hid_t plist_id); * */ H5_DLL const void *H5Pget_driver_info(hid_t plist_id); -H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size); -H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close); +/** + * \ingroup FAPL + * + * \brief Retrieves the size of the external link open file cache + * + * \fapl_id{plist_id} + * \param[out] efc_size External link open file cache size in number of files + * + * \return \herr_t + * + * \details H5Pget_elink_file_cache_size() retrieves the number of files that + * can be held open in an external link open file cache. + * + * \since 1.8.7 + * + */ +H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size); +/** + * \ingroup FAPL + * + * \brief Retrieves the file access property list setting that determines + * whether an HDF5 object will be evicted from the library's metadata + * cache when it is closed + * + * \fapl_id + * \param[out] evict_on_close Pointer to a variable that will indicate if + * the object will be evicted on close + * + * \return \herr_t + * + * \details The library's metadata cache is fairly conservative about holding on + * to HDF5 object metadata (object headers, chunk index structures, + * etc.), which can cause the cache size to grow, resulting in memory + * pressure on an application or system. When enabled, the "evict on + * close" property will cause all metadata for an object to be + * immediately evicted from the cache as long as it is not referenced + * by any other open object. + * + * See H5Pset_evict_on_close() for additional notes on behavior. + * + * \since 1.10.1 + * + */ +H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close); /** * \ingroup FAPL * @@ -3386,9 +3474,7 @@ H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close) * application can retrieve a file handle for low-level access to * a particular member of a family of files. The file handle is * retrieved with a separate call to H5Fget_vfd_handle() (or, - * in special circumstances, to H5FDget_vfd_handle()). - * - * \todo References the VFL documentation. + * in special circumstances, to H5FDget_vfd_handle(), see \ref VFL). * * \since 1.6.0 * @@ -3415,8 +3501,113 @@ H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); * */ H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree); +/** + * \ingroup FAPL + * + * \brief Retrieves a copy of the file image designated as the initial content + * and structure of a file + * + * \fapl_id + * \param[in,out] buf_ptr_ptr On input, \c NULL or a pointer to a + * pointer to a buffer that contains the + * file image.\n On successful return, if \p buf_ptr_ptr is not + * \c NULL, \Code{*buf_ptr_ptr} will contain a pointer to a copy + * of the initial image provided in the last call to + * H5Pset_file_image() for the supplied \p fapl_id. If no initial + * image has been set, \Code{*buf_ptr_ptr} will be \c NULL. + * \param[in,out] buf_len_ptr On input, \c NULL or a pointer to a buffer + * specifying the required size of the buffer to hold the file + * image.\n On successful return, if \p buf_len_ptr was not + * passed in as \c NULL, \p buf_len_ptr will return the required + * size in bytes of the buffer to hold the initial file image in + * the supplied file access property list, \p fapl_id. If no + * initial image is set, the value of \Code{*buf_len_ptr} will be + * set to 0 (zero) + * \return \herr_t + * + * \details H5Pget_file_image() allows an application to retrieve a copy of the + * file image designated for a VFD to use as the initial contents of a file. + * + * If file image callbacks are defined, H5Pget_file_image() will use + * them when allocating and loading the buffer to return to the + * application (see H5Pset_file_image_callbacks()). If file image + * callbacks are not defined, the function will use \c malloc and \c + * memcpy. When \c malloc and \c memcpy are used, it is the caller’s + * responsibility to discard the returned buffer with a call to \c + * free. + * + * It is the responsibility of the calling application to free the + * buffer whose address is returned in \p buf_ptr_ptr. This can be + * accomplished with \c free if file image callbacks have not been set + * (see H5Pset_file_image_callbacks()) or with the appropriate method + * if file image callbacks have been set. + * + * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(), + * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(), + * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t, + * + * HDF5 File Image Operations. + * + * + * \since 1.8.9 + * + */ H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); +/** + * \ingroup FAPL + * + * \brief Retrieves callback routines for working with file images + * + * \fapl_id + * \param[in,out] callbacks_ptr Pointer to the instance of the + * #H5FD_file_image_callbacks_t struct in which the callback + * routines are to be returned\n + * Struct fields must be initialized to NULL before the call + * is made.\n + * Struct field contents upon return will match those passed in + * in the last H5Pset_file_image_callbacks() call for the file + * access property list \p fapl_id. + * \return \herr_t + * + * \details H5Pget_file_image_callbacks() retrieves the callback routines set for + * working with file images opened with the file access property list + * \p fapl_id. + * + * The callbacks must have been previously set with + * H5Pset_file_image_callbacks() in the file access property list. + * + * Upon the successful return of H5Pset_file_image_callbacks(), the + * fields in the instance of the #H5FD_file_image_callbacks_t struct + * pointed to by \p callbacks_ptr will contain the same values as were + * passed in the most recent H5Pset_file_image_callbacks() call for the + * file access property list \p fapl_id. + * + * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(), + * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(), + * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t, + * + * HDF5 File Image Operations. + * + * \since 1.8.9 + * + */ H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); +/** + * \ingroup FAPL + * + * \brief Retrieves the file locking property values + * + * \fapl_id + * \param[out] use_file_locking File locking flag + * \param[out] ignore_when_disabled Ignore when disabled flag + * \return \herr_t + * + * \details H5Pget_file_locking() retrieves the file locking property values for + * the file access property list specified by \p fapl_id. + * + * \since 1.10.7 + * + */ H5_DLL herr_t H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking, hbool_t *ignore_when_disabled); /** * \ingroup FAPL @@ -3471,11 +3662,212 @@ H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref /*out*/); * */ H5_DLL herr_t H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low, H5F_libver_t *high); +/** + * \ingroup FAPL + * + * \brief Get the current initial metadata cache configuration from the + * provided file access property list + * + * \fapl_id{plist_id} + * \param[in,out] config_ptr Pointer to the instance of #H5AC_cache_config_t + * in which the current metadata cache configuration is to be + * reported + * \return \herr_t + * + * \note The \c in direction applies only to the \ref H5AC_cache_config_t.version + * field. All other fields are \c out parameters. + * + * \details The fields of the #H5AC_cache_config_t structure are shown + * below: + * \snippet H5ACpublic.h H5AC_cache_config_t_snip + * \click4more + * + * H5Pget_mdc_config() gets the initial metadata cache configuration + * contained in a file access property list and loads it into the + * instance of #H5AC_cache_config_t pointed to by the \p config_ptr + * parameter. This configuration is used when the file is opened. + * + * Note that the version field of \Code{*config_ptr} must be + * initialized; this allows the library to support earlier versions of + * the #H5AC_cache_config_t structure. + * + * See the overview of the metadata cache in the special topics section + * of the user guide for details on the configuration data returned. If + * you haven't read and understood that documentation, the results of + * this call will not make much sense. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); /* out */ +/** + * \ingroup FAPL + * + * \brief Retrieves the metadata cache image configuration values for a file + * access property list + * + * \fapl_id{plist_id} + * \param[out] config_ptr Pointer to metadata cache image configuration values + * \return \herr_t + * + * \details H5Pget_mdc_image_config() retrieves the metadata cache image values + * into \p config_ptr for the file access property list specified in \p + * plist_id. + * + * #H5AC_cache_image_config_t is defined as follows: + * \snippet H5ACpublic.h H5AC_cache_image_config_t_snip + * \click4more + * + * \since 1.10.1 + */ H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); +/** + * \ingroup FAPL + * + * \brief Gets metadata cache logging options + * + * \fapl_id{plist_id} + * \param[out] is_enabled Flag whether logging is enabled + * \param[out] location Location of log in UTF-8/ASCII (file path/name) (On + * Windows, this must be ASCII) + * \param[out] location_size Size in bytes of the location string + * \param[out] start_on_access Whether the logging begins as soon as the file is + * opened or created + * \return \herr_t + * + * \details The metadata cache is a central part of the HDF5 library through + * which all file metadata reads and writes take place. File metadata + * is normally invisible to the user and is used by the library for + * purposes such as locating and indexing data. File metadata should + * not be confused with user metadata, which consists of attributes + * created by users and attached to HDF5 objects such as datasets via + * \ref H5A API calls. + * + * Due to the complexity of the cache, a trace/logging feature has been + * created that can be used by HDF5 developers for debugging and + * performance analysis. The functions that control this functionality + * will normally be of use to a very limited number of developers + * outside of The HDF Group. The functions have been documented to help + * users create logs that can be sent with bug reports. + * + * Control of the log functionality is straightforward. Logging is + * enabled via the H5Pset_mdc_log_options() function, which will modify + * the file access property list used to open or create a file. This + * function has a flag that determines whether logging begins at file + * open or starts in a paused state. Log messages can then be + * controlled via the H5Fstart_mdc_logging() / H5Fstop_mdc_logging() + * functions. H5Pget_mdc_log_options() can be used to examine a file + * access property list, and H5Fget_mdc_logging_status() will return + * the current state of the logging flags. + * + * The log format is described in the + * Metadata Cache Logging document. + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, size_t *location_size, hbool_t *start_on_access); -H5_DLL herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size /*out*/); +/** + * \ingroup FAPL + * + * \brief Returns the current metadata block size setting + * + * \fapl_id{fapl_id} + * \param[out] size Minimum size, in bytes, of metadata block allocations + * + * \return \herr_t + * + * \details Returns the current minimum size, in bytes, of new + * metadata block allocations. This setting is retrieved from the + * file access property list \p fapl_id. + * + * This value is set by H5Pset_meta_block_size() and is + * retrieved from the file access property list \p fapl_id. + * + * \since 1.4.0 + */ +H5_DLL herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size); +/** + * \ingroup FAPL + * + * \brief Retrieves the number of read attempts from a file access + * property list + * + * \fapl_id{plist_id} + * \param[out] attempts The number of read attempts + * + * \return \herr_t + * + * \details H5Pget_metadata_read_attempts() retrieves the number of read + * attempts that is set in the file access property list \p plist_id. + * + * For a default file access property list, the value retrieved + * will depend on whether the user sets the number of attempts via + * H5Pset_metadata_read_attempts(): + * + *
      + * + *
    • If the number of attempts is set to N, the value + * returned will be N. + *
    • If the number of attempts is not set, the value returned + * will be the default for non-SWMR access (1). SWMR is short + * for single-writer/multiple-reader. + *
    + * + * For the file access property list of a specified HDF5 file, + * the value retrieved will depend on how the file is opened + * and whether the user sets the number of read attempts via + * H5Pset_metadata_read_attempts(): + * + *
      + *
    • For a file opened with SWMR access: + * + *
        + *
      • If the number of attempts is set to N, the value + * returned will be N. + *
      • If the number of attempts is not set, the value + * returned will be the default for SWMR access (100). + *
      + *
    • For a file opened without SWMR access, the value + * retrieved will always be the default for non-SWMR access + * (1). The value set via H5Pset_metadata_read_attempts() does + * not have any effect on non-SWMR access. + *
    + * + * \par Failure Modes + * \parblock + * + * When the input property list is not a file access property list. + * + * When the library is unable to retrieve the number of read attempts from + * the file access property list. + * + * \endparblock + * + * \par Examples + * \parblock + * + * The first example illustrates the two cases for retrieving the number + * of read attempts from a default file access property list. + * + * \include H5Pget_metadata_read_attempts.1.c + * + * The second example illustrates the two cases for retrieving the + * number of read attempts from the file access property list of a file + * opened with SWMR acccess. + * + * \include H5Pget_metadata_read_attempts.2.c + * + * The third example illustrates the two cases for retrieving the number + * of read attempts from the file access property list of a file opened + * with non-SWMR acccess. + * + * \include H5Pget_metadata_read_attempts.3.c + * + * \endparblock + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts); /** * \ingroup FAPL @@ -3510,10 +3902,102 @@ H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts); * */ H5_DLL herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type); +/** + * \ingroup FAPL + * + * \brief Retrieves the object flush property values from the file access property list + * + * \fapl_id{plist_id} + * \param[in] func The user-defined callback function + * \param[in] udata The user-defined input data for the callback function + * + * \return \herr_t + * + * \details H5Pget_object_flush_cb() gets the user-defined callback + * function that is set in the file access property list + * \p fapl_id and stored in the parameter \p func. The callback is + * invoked whenever an object flush occurs in the file. This + * routine also obtains the user-defined input data that is + * passed along to the callback function in the parameter + * \p udata. + * + * \par Example + * \parblock + * The example below illustrates the usage of this routine to obtain the + * object flush property values. + * + * \include H5Pget_object_flush_cb.c + * \endparblock + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata); -H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_per, - unsigned *min_raw_per); +/** + * \ingroup FAPL + * + * \brief Retrieves the maximum size for the page buffer and the minimum + percentage for metadata and raw data pages + * + * \fapl_id{plist_id} + * \param[out] buf_size Maximum size, in bytes, of the page buffer + * \param[out] min_meta_perc Minimum metadata percentage to keep in the + * page buffer before allowing pages containing metadata to + * be evicted + * + * \param[out] min_raw_perc Minimum raw data percentage to keep in the + * page buffer before allowing pages containing raw data to + * be evicted + * + * \return \herr_t + * + * \details H5Pget_page_buffer_size() retrieves \p buf_size, the maximum + * size in bytes of the page buffer, \p min_meta_perc, the + * minimum metadata percentage, and \p min_raw_perc, the + * minimum raw data percentage. + * + * \since 1.10.1 + */ +H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_perc, + unsigned *min_raw_perc); +/** + * \ingroup FAPL + * + * \brief Returns maximum data sieve buffer size + * + * \fapl_id{fapl_id} + * \param[in] size Maximum size, in bytes, of data sieve buffer + * + * \return \herr_t + * + * \details H5Pget_sieve_buf_size() retrieves, size, the current maximum + * size of the data sieve buffer. + * + * This value is set by H5Pset_sieve_buf_size() and is retrieved + * from the file access property list fapl_id. + * + * \version 1.6.0 The \p size parameter has changed from type \c hsize_t + * to \c size_t + * \since 1.4.0 + */ H5_DLL herr_t H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size /*out*/); +/** + * \ingroup FAPL + * + * \brief Retrieves the current small data block size setting + * + * \fapl_id{fapl_id} + * \param[out] size Maximum size, in bytes, of the small data block + * + * \result \herr_t + * + * \details H5Pget_small_data_block_size() retrieves the current setting + * for the size of the small data block. + * + * If the returned value is zero (0), the small data block + * mechanism has been disabled for the file. + * + * \since 1.4.4 + */ H5_DLL herr_t H5Pget_small_data_block_size(hid_t fapl_id, hsize_t *size /*out*/); /** * \ingroup FAPL @@ -3684,6 +4168,64 @@ H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignme */ H5_DLL herr_t H5Pset_cache(hid_t plist_id, int mdc_nelmts, size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0); +/** + * \ingroup FAPL + * + * \brief Sets write tracking information for core driver, #H5FD_CORE + * + * \fapl_id{fapl_id} + * \param[in] is_enabled Boolean value specifying whether feature is + enabled + * \param[in] page_size Positive integer specifying size, in bytes, of + * write aggregation pages Value of 1 (one) enables + * tracking with no paging. + * + * \return \herr_t + * + * \details When a file is created or opened for writing using the core + * virtual file driver (VFD) with the backing store option + * turned on, the core driver can be configured to track + * changes to the file and write out only the modified bytes. + * + * This write tracking feature is enabled and disabled with \p + * is_enabled. The default setting is that write tracking is + * disabled, or off. + * + * To avoid a large number of small writes, changes can + * be aggregated into pages of a user-specified size, \p + * page_size. + * + * Setting \p page_size to 1 enables tracking with no page + * aggregation. + * + * The backing store option is set via the function + * H5Pset_fapl_core. + * + * \attention + * \parblock + * This function is only for use with the core VFD and must + * be used after the call to H5Pset_fapl_core(). It is an error + * to use this function with any other VFD. + * + * It is an error to use this function when the backing store + * flag has not been set using H5Pset_fapl_core(). + * + * This function only applies to the backing store write + * operation which typically occurs when the file is flushed + * or closed. This function has no relationship to the + * increment parameter passed to H5Pset_fapl_core(). + * + * For optimum performance, the \p page_size parameter should be + * a power of two. + * + * It is an error to set the page size to 0. + * \endparblock + * + * \version 1.8.14 C function modified in this release to return error + * if \p page_size is set to 0 (zero). + * \since 1.8.13 + * + */ H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); /** * \ingroup FAPL @@ -3712,13 +4254,146 @@ H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size * */ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info); -H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size); -H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close); -H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); /** * \ingroup FAPL * - * \brief Sets the file close degree + * \brief Sets the number of files that can be held open in an external + * link open file cache + * + * \par Motivation + * \parblock + * The external link open file cache holds files open after + * they have been accessed via an external link. This cache reduces + * the number of times such files are opened when external links are + * accessed repeatedly and can siginificantly improves performance in + * certain heavy-use situations and when low-level file opens or closes + * are expensive. + * + * H5Pset_elink_file_cache_size() sets the number of files + * that will be held open in an external link open file + * cache. H5Pget_elink_file_cache_size() retrieves the size of an existing + * cache; and H5Fclear_elink_file_cache() clears an existing cache without + * closing it. + * \endparblock + * + * \fapl_id{plist_id} + * \param[in] efc_size External link open file cache size in number of files + * Default setting is 0 (zero). + * + * \return \herr_t + * + * \details H5Pset_elink_file_cache_size() specifies the number of files + * that will be held open in an external link open file cache. + * + * The default external link open file cache size is 0 (zero), + * meaning that files accessed via an external link are not + * held open. Setting the cache size to a positive integer + * turns on the cache; setting the size back to zero turns it + * off. + * + * With this property set, files are placed in the external + * link open file cache cache when they are opened via an + * external link. Files are then held open until either + * they are evicted from the cache or the parent file is + * closed. This property setting can improve performance when + * external links are repeatedly accessed. + * + * When the cache is full, files will be evicted using a least + * recently used (LRU) scheme; the file which has gone the + * longest time without being accessed through the parent file + * will be evicted and closed if nothing else is holding that + * file open. + * + * Files opened through external links inherit the parent + * file’s file access property list by default, and therefore + * inherit the parent file’s external link open file cache + * setting. + * + * When child files contain external links of their own, the + * caches can form a graph of cached external files. Closing + * the last external reference to such a graph will recursively + * close all files in the graph, even if cycles are present. + * \par Example + * \parblock + * The following code sets up an external link open file cache that will + * hold open up to 8 files reached through external links: + * + * \code + * status = H5Pset_elink_file_cache_size(fapl_id, 8); + * \endcode + * \endparblock + * + * \since 1.8.7 + */ +H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size); +/** + * \ingroup FAPL + * + * \brief Controls the library's behavior of evicting metadata associated with + * a closed object + * + * \fapl_id + * \param[in] evict_on_close Whether the HDF5 object should be evicted on close + * + * \return \herr_t + * + * \details The library's metadata cache is fairly conservative about holding + * on to HDF5 object metadata(object headers, chunk index structures, + * etc.), which can cause the cache size to grow, resulting in memory + * pressure on an application or system. When enabled, the "evict on + * close" property will cause all metadata for an object to be evicted + * from the cache as long as metadata is not referenced by any other + * open object. + * + * This function only applies to file access property lists. + * + * The default library behavior is to not evict on object or file + * close. + * + * When applied to a file access property list, any subsequently opened + * object will inherit the "evict on close" property and will have + * its metadata evicted when the object is closed. + * + * \since 1.10.1 + * + */ +H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close); +/** + * \ingroup FAPL + * + * \brief Sets offset property for low-level access to a file in a family of + * files + * + * \fapl_id + * \param[in] offset Offset in bytes within the HDF5 file + * + * \return \herr_t + * + * \details H5Pset_family_offset() sets the offset property in the file access + * property list \p fapl_id so that the user application can + * retrieve a file handle for low-level access to a particular member + * of a family of files. The file handle is retrieved with a separate + * call to H5Fget_vfd_handle() (or, in special circumstances, to + * H5FDget_vfd_handle(); see \ref VFL). + * + * The value of \p offset is an offset in bytes from the beginning of + * the HDF5 file, identifying a user-determined location within the + * HDF5 file. + * The file handle the user application is seeking is for the specific + * member-file in the associated family of files to which this offset + * is mapped. + * + * Use of this function is only appropriate for an HDF5 file written as + * a family of files with the \c FAMILY file driver. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); +/** + * \ingroup FAPL + * + * \brief Sets the file close degree * * \fapl_id * \param[in] degree Pointer to a location containing the file close @@ -3776,9 +4451,279 @@ H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); * */ H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); +/** + * \ingroup FAPL + * + * \brief Sets an initial file image in a memory buffer + * + * \fapl_id + * \param[in] buf_ptr Pointer to the initial file image, or + * NULL if no initial file image is desired + * \param[in] buf_len Size of the supplied buffer, or + * 0 (zero) if no initial image is desired + * + * \return \herr_t + * + * \details H5Pset_file_image() allows an application to provide a file image + * to be used as the initial contents of a file. + * Calling H5Pset_file_image()makes a copy of the buffer specified in + * \p buf_ptr of size \p buf_len. + * + * \par Motivation: + * H5Pset_file_image() and other elements of HDF5 are + * used to load an image of an HDF5 file into system memory and open + * that image as a regular HDF5 file. An application can then use the + * file without the overhead of disk I/O. + * + * \par Recommended Reading: + * This function is part of the file image + * operations feature set. It is highly recommended to study the guide + * [HDF5 File Image Operations] + * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations + * ) before using this feature set. See the “See Also” section below + * for links to other elements of HDF5 file image operations. + * + * \see + * \li H5LTopen_file_image() + * \li H5Fget_file_image() + * \li H5Pget_file_image() + * \li H5Pset_file_image_callbacks() + * \li H5Pget_file_image_callbacks() + * + * \li [HDF5 File Image Operations] + * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations) + * in [Advanced Topics in HDF5] + * (https://portal.hdfgroup.org/display/HDF5/Advanced+Topics+in+HDF5) + * + * \li Within H5Pset_file_image_callbacks(): + * \li Callback #H5FD_file_image_callbacks_t + * \li Callback #H5FD_file_image_op_t + * + * \version 1.8.13 Fortran subroutine added in this release. + * \since 1.8.9 + * + */ H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); +/** + * \ingroup FAPL + * + * \brief Sets the callbacks for working with file images + * + * \note **Motivation:** H5Pset_file_image_callbacks() and other elements + * of HDF5 are used to load an image of an HDF5 file into system + * memory and open that image as a regular HDF5 file. An application + * can then use the file without the overhead of disk I/O.\n + * **Recommended Reading:** This function is part of the file + * image operations feature set. It is highly recommended to study + * the guide [HDF5 File Image Operations] + * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations + * ) before using this feature set. See the “See Also” section below + * for links to other elements of HDF5 file image operations. + * + * \fapl_id + * \param[in,out] callbacks_ptr Pointer to the instance of the + * #H5FD_file_image_callbacks_t structure + * + * \return \herr_t \n + * **Failure Modes**: Due to interactions between this function and + * H5Pset_file_image() and H5Pget_file_image(), + * H5Pset_file_image_callbacks() will fail if a file image has + * already been set in the target file access property list, \p fapl_id. + * + * \details H5Pset_file_image_callbacks() sets callback functions for working + * with file images in memory. + * + * H5Pset_file_image_callbacks() allows an application to control the + * management of file image buffers through user defined callbacks. + * These callbacks can be used in the management of file image buffers + * in property lists and with certain file drivers. + * + * H5Pset_file_image_callbacks() must be used before any file image has + * been set in the file access property list. Once a file image has + * been set, the function will fail. + * + * The callback routines set up by H5Pset_file_image_callbacks() are + * invoked when a new file image buffer is allocated, when an existing + * file image buffer is copied or resized, or when a file image buffer + * is released from use. + * + * Some file drivers allow the use of user-defined callback functions + * for allocating, freeing, and copying the driver’s internal buffer, + * potentially allowing optimizations such as avoiding large \c malloc + * and \c memcpy operations, or to perform detailed logging. + * + * From the perspective of the HDF5 library, the operations of the + * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc", + * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy", + * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc", and + * \ref H5FD_file_image_callbacks_t.image_free "image_free" callbacks + * must be identical to those of the + * corresponding C standard library calls (\c malloc, \c memcpy, + * \c realloc, and \c free). While the operations must be identical, + * the file image callbacks have more parameters. The return values + * of \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" and + * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" are identical to + * the return values of \c malloc and \c realloc. The return values of + * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" and + * \ref H5FD_file_image_callbacks_t.image_free "image_free" differ from the return + * values of \c memcpy and \c free in that the return values of + * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy" and + * \ref H5FD_file_image_callbacks_t.image_free "image_free" can also indicate failure. + * + * The callbacks and their parameters, along with a struct and + * an \c ENUM required for their use, are described below. + * + * Callback struct and \c ENUM: + * + * The callback functions set up by H5Pset_file_image_callbacks() use + * a struct and an \c ENUM that are defined as follows + * + * The struct #H5FD_file_image_callbacks_t serves as a container + * for the callback functions and a pointer to user-supplied data. + * The struct is defined as follows: + * \snippet H5FDpublic.h H5FD_file_image_callbacks_t_snip + * + * Elements of the #H5FD_file_image_op_t are used by the + * callbacks to invoke certain operations on file images. The ENUM is + * defined as follows: + * \snippet H5FDpublic.h H5FD_file_image_op_t_snip + * + * The elements of the #H5FD_file_image_op_t are used in the following + * callbacks: + * + * - The \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" callback + * contains a pointer to a function that must appear to HDF5 to have + * functionality identical to that of the standard C library \c malloc() call. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h image_malloc_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy" + * callback contains a pointer to a function + * that must appear to HDF5 to have functionality identical to that + * of the standard C library \c memcopy() call, except that it returns + * a \p NULL on failure. (The \c memcpy C Library routine is defined + * to return the \p dest parameter in all cases.) + * + * - Setting \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy" + * to \c NULL indicates that HDF5 should invoke + * the standard C library \c memcpy() routine when copying buffers. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h image_memcpy_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" callback + * contains a pointer to a function that must appear to HDF5 to have + * functionality identical to that of the standard C library \c realloc() call. + * + * - Setting \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" + * to \p NULL indicates that HDF5 should + * invoke the standard C library \c realloc() routine when resizing + * file image buffers. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h image_realloc_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.image_free "image_free" callback contains + * a pointer to a function that must appear to HDF5 to have functionality + * identical to that of the standard C library \c free() call, except + * that it will return \c 0 (\c SUCCEED) on success and \c -1 (\c FAIL) on failure. + * + * - Setting \ref H5FD_file_image_callbacks_t.image_free "image_free" + * to \c NULL indicates that HDF5 should invoke + * the standard C library \c free() routine when releasing file image + * buffers. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h image_free_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.udata_copy "udata_copy" + * callback contains a pointer to a function + * that, from the perspective of HDF5, allocates a buffer of suitable + * size, copies the contents of the supplied \p udata into the new + * buffer, and returns the address of the new buffer. The function + * returns NULL on failure. This function is necessary if a non-NULL + * \p udata parameter is supplied, so that property lists containing + * the image callbacks can be copied. If the \p udata parameter below + * is \c NULL, then this parameter should be \c NULL as well. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h udata_copy_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.udata_free "udata_free" + * callback contains a pointer to a function + * that, from the perspective of HDF5, frees a user data block. This + * function is necessary if a non-NULL udata parameter is supplied so + * that property lists containing image callbacks can be discarded + * without a memory leak. If the udata parameter below is \c NULL, + * this parameter should be \c NULL as well. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h udata_free_snip + * + * - \p **udata**, the final field in the #H5FD_file_image_callbacks_t + * struct, provides a pointer to user-defined data. This pointer will + * be passed to the + * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc", + * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy", + * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc", and + * \ref H5FD_file_image_callbacks_t.image_free "image_free" callbacks. + * Define udata as \c NULL if no user-defined data is provided. + * + * \since 1.8.9 + * + */ H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); +/** + * \ingroup FAPL + * + * \brief Sets the file locking property values + * + * \fapl_id + * \param[in] use_file_locking Toggle to specify file locking (or not) + * \param[in] ignore_when_disabled Toggle to ignore when disabled (or not) + * + * \return \herr_t + * + * \details H5Pset_file_locking() overrides the default file locking flag + * setting that was set when the library was configured. + * + * This setting can be overridden by the \c HDF5_USE_FILE_LOCKING + * environment variable. + * + * File locking is used when creating/opening a file to prevent + * problematic file accesses. + * + * \since 1.10.7 + * + */ H5_DLL herr_t H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when_disabled); +/** + * \ingroup FAPL + * + * \brief Sets garbage collecting references flag + * + * \fapl_id + * \param[in] gc_ref Flag setting reference garbage collection to on (1) or off (0) + * + * \return \herr_t + * + * \details H5Pset_gc_references() sets the flag for garbage collecting + * references for the file. + * + * Dataset region references and other reference types use space in an + * HDF5 file's global heap. If garbage collection is on and the user + * passes in an uninitialized value in a reference structure, the heap + * might get corrupted. When garbage collection is off, however, and + * the user re-uses a reference, the previous heap block will be + * orphaned and not returned to the free heap space. + * + * When garbage collection is on, the user must initialize the + * reference structures to 0 or risk heap corruption. + * + * The default value for garbage collecting references is off. + * + */ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); /** * \ingroup FAPL @@ -3861,10 +4806,11 @@ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); * * * @@ -3872,14 +4818,15 @@ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); * * * @@ -3888,39 +4835,356 @@ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); * \p high=#H5F_LIBVER_V110 * * * *
    \ref hid_t \c prop_idIN: The identifier of the property list being closed
    \Code{const char * name}IN: The name of the property in the list
    #H5FD_SEC2This driver uses POSIX file-system functions like read and * write to perform I/O to a single, permanent file on local disk - * with no system buffering. This driver is POSIX-compliant and is - * the default file driver for all systems.H5Pset_fapl_sec2()
    #H5FD_COREWith this driver, an application can work with a file in * memory for faster reads and writes. File contents are kept in - * memory until the file is closed. At closing, the memory version - * of the file can be written back to disk or abandoned.H5Pset_fapl_core()
    With this driver, the HDF5 file’s address space is partitioned * into pieces and sent to separate storage files using an * underlying driver of the user’s choice. This driver is for - * systems that do not support files larger than 2 gigabytes.H5Pset_fapl_family()
    \p low=#H5F_LIBVER_V18
    * \p high=#H5F_LIBVER_V18
    - * \li The library will create objects with the latest format versions - * available to library release 1.8.x. + * \li The library will create objects with the latest format + * versions available to library release 1.8.x. * \li API calls that create objects or features that are available - * to versions of the library greater than 1.8.x release will fail. + * to versions of the library greater than 1.8.x release will + * fail. * \li Earlier versions of the library may not be able to access * objects created with this setting.
    \p low=#H5F_LIBVER_V18
    * \p high=#H5F_LIBVER_V110
    - * \li The library will create objects with the latest format versions - * available to library release 1.8.x. + * \li The library will create objects with the latest format + * versions available to library release 1.8.x. * \li The library will allow objects to be created with the latest * format versions available to library release 1.10.x. - * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper limit - * on the format versions to use. For example, if a newer format - * version is required to support a feature e.g. virtual dataset, - * this setting will allow the object to be created. + * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper + * limit on the format versions to use. For example, if a + * newer format version is required to support a feature e.g. + * virtual dataset, this setting will allow the object to be + * created. * \li Earlier versions of the library may not be able to access * objects created with this setting.
    - * \li The library will create objects with the latest format versions - * available to library release 1.10.x. + * \li The library will create objects with the latest format + * versions available to library release 1.10.x. * \li The library will allow objects to be created with the latest * format versions available to library release 1.10.x. - * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper limit - * on the format versions to use. For example, if a newer format - * version is required to support a feature e.g. virtual dataset, - * this setting will allow the object to be created. + * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper + * limit on the format versions to use. For example, if a + * newer format version is required to support a feature e.g. + * virtual dataset, this setting will allow the object to be + * created. * \li This setting allows users to take advantage of the latest - * features and performance enhancements in the library. However, - * objects written with this setting may be accessible to a smaller - * range of library versions than would be the case if low is set - * to #H5F_LIBVER_EARLIEST. - * \li Earlier versions of the library may not be able to access objects created with this + * features and performance enhancements in the library. + * However, objects written with this setting may be + * accessible to a smaller range of library versions than + * would be the case if low is set to #H5F_LIBVER_EARLIEST. + * \li Earlier versions of the library may not be able to access + * objects created with this * setting. *
    * - * \version 1.10.2 #H5F_LIBVER_V18 added to the enumerated defines in #H5F_libver_t. + * \version 1.10.2 #H5F_LIBVER_V18 added to the enumerated defines in + * #H5F_libver_t. * * \since 1.8.0 * */ H5_DLL herr_t H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high); +/** + * \ingroup FAPL + * + * \brief Set the initial metadata cache configuration in the indicated File + * Access Property List to the supplied value + * + * \fapl_id{plist_id} + * \param[in] config_ptr Pointer to the instance of \p H5AC_cache_config_t + * containing the desired configuration + * \return \herr_t + * + * \details The fields of the #H5AC_cache_config_t structure are shown + * below: + * \snippet H5ACpublic.h H5AC_cache_config_t_snip + * \click4more + * + * \details H5Pset_mdc_config() attempts to set the initial metadata cache + * configuration to the supplied value. It will fail if an invalid + * configuration is detected. This configuration is used when the file + * is opened. + * + * See the overview of the metadata cache in the special topics section + * of the user manual for details on what is being configured. If you + * have not read and understood that documentation, you really should + * not be using this API call. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); +/** + * \ingroup FAPL + * + * \brief Sets metadata cache logging options + * + * \fapl_id{plist_id} + * \param[in] is_enabled Whether logging is enabled + * \param[in] location Location of log in UTF-8/ASCII (file path/name) + * (On Windows, this must be ASCII) + * \param[in] start_on_access Whether the logging will begin as soon as the + * file is opened or created + * + * \return \herr_t + * + * \details The metadata cache is a central part of the HDF5 library through + * which all file metadata reads and writes take place. File metadata + * is normally invisible to the user and is used by the library for + * purposes such as locating and indexing data. File metadata should + * not be confused with user metadata, which consists of attributes + * created by users and attached to HDF5 objects such as datasets via + * H5A API calls. + * + * Due to the complexity of the cache, a trace/logging feature has + * been created that can be used by HDF5 developers for debugging and + * performance analysis. The functions that control this functionality + * will normally be of use to a very limited number of developers + * outside of The HDF Group. The functions have been documented to + * help users create logs that can be sent with bug reports. + * + * Control of the log functionality is straightforward. Logging is + * enabled via the H5Pset_mdc_log_options() function, + * which will modify the file access property list used to open or + * create a file. This function has a flag that determines whether + * logging begins at file open or starts in a paused state. Log + * messages can then be controlled via the H5Fstart_mdc_logging() + * and H5Fstop_mdc_logging() function. + * + * H5Pget_mdc_log_options() can be used to examine a file access + * property list, and H5Fget_mdc_logging_status() will return the + * current state of the logging flags. + * + * The log format is described in [Metadata Cache Logging] + * (https://portal.hdfgroup.org/display/HDF5/Fine-tuning+the+Metadata+Cache). + * + * \since 1.10.0 + * + */ H5_DLL herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, hbool_t start_on_access); +/** + * \ingroup FAPL + * + * \brief Sets the minimum metadata block size + * + * \fapl_id{fapl_id} + * \param[in] size Minimum size, in bytes, of metadata block allocations + * + * \return \herr_t + * + * \details H5Pset_meta_block_size() sets the minimum size, in bytes, of + * metadata block allocations when #H5FD_FEAT_AGGREGATE_METADATA is set by a VFL + * driver. + + * Each raw metadata block is initially allocated to be of the given size. + * Specific metadata objects (e.g., object headers, local heaps, B-trees) are then + * sub-allocated from this block. + * + * The default setting is 2048 bytes, meaning that the library will + * attempt to aggregate metadata in at least 2K blocks in the file. + * Setting the value to zero (\Code{0}) with this function will turn + * off metadata aggregation, even if the VFL driver attempts to use the + * metadata aggregation strategy. + * + * Metadata aggregation reduces the number of small data objects in the file that + * would otherwise be required for metadata. The aggregated block of metadata is + * usually written in a single write action and always in a contiguous block, + * potentially significantly improving library and application performance. + * + * \since 1.4.0 + */ H5_DLL herr_t H5Pset_meta_block_size(hid_t fapl_id, hsize_t size); +/** + * \ingroup FAPL + * + * \brief Sets the number of read attempts in a file access property list + * + * \fapl_id{plist_id} + * \param[in] attempts The number of read attempts. Must be a value greater than \Code{0} + * + * \return \herr_t + * + * \return Failure Modes: + * - When the user sets the number of read attempts to \Code{0}. + * - When the input property list is not a file access property list. + * - When the library is unable to set the number of read attempts in the file access property list. + * + * \details H5Pset_metadata_read_attempts() sets the number of reads that the + * library will try when reading checksummed metadata in an HDF5 file opened + * with SWMR access. When reading such metadata, the library will compare the + * checksum computed for the metadata just read with the checksum stored within + * the piece of checksum. When performing SWMR operations on a file, the + * checksum check might fail when the library reads data on a system that is not + * atomic. To remedy such situations, the library will repeatedly read the piece + * of metadata until the check passes or finally fails the read when the allowed + * number of attempts is reached. + * + * The number of read attempts used by the library will depend on how the file is + * opened and whether the user sets the number of read attempts via this routine: + + * - For a file opened with SWMR access: + * - If the user sets the number of attempts to \Code{N}, the library will use \Code{N}. + * - If the user does not set the number of attempts, the library will use the + * default for SWMR access (\Code{100}). + * - For a file opened with non-SWMR access, the library will always use the default + * for non-SWMR access (\Code{1}). The value set via this routine does not have any effect + * during non-SWMR access. + * + * \b Example: The first example illustrates the case in setting the number of read attempts for a file + * opened with SWMR access. + * + * \snippet H5Pset_metadata_read_attempts.c SWMR Access + * + * \b Example: The second example illustrates the case in setting the number of + * read attempts for a file opened with non-SWMR access. The value + * set in the file access property list does not have any effect. + * + * \snippet H5Pset_metadata_read_attempts.c non-SWMR Access + * + * \note \b Motivation: On a system that is not atomic, the library might + * possibly read inconsistent metadata with checksum when performing + * single-writer/multiple-reader (SWMR) operations for an HDF5 file. Upon + * encountering such situations, the library will try reading the metadata + * again to obtain consistent data. This routine provides the means to set + * the number of read attempts other than the library default. + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts); +/** + * \ingroup FAPL + * + * \brief Specifies type of data to be accessed via the \Code{MULTI} driver, + * enabling more direct access + * + * \fapl_id{fapl_id} + * \param[in] type Type of data to be accessed + * + * \return \herr_t + * + * \details H5Pset_multi_type() sets the \Emph{type of data} property in the file + * access property list \p fapl_id. This setting enables a user + * application to specify the type of data the application wishes to + * access so that the application can retrieve a file handle for + * low-level access to the particular member of a set of \Code{MULTI} + * files in which that type of data is stored. The file handle is + * retrieved with a separate call to H5Fget_vfd_handle() (or, in special + * circumstances, to H5FDget_vfd_handle(); see \ref VFL. + * + * The type of data specified in \p type may be one of the following: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    #H5FD_MEM_SUPER Super block data
    #H5FD_MEM_BTREE B-tree data
    #H5FD_MEM_DRAW Dataset raw data
    #H5FD_MEM_GHEAP Global heap data
    #H5FD_MEM_LHEAP Local Heap data
    #H5FD_MEM_OHDR Object header data
    + * + * This function is for use only when accessing an HDF5 file written as a set of + * files with the \Code{MULTI} file driver. + * + * \since 1.6.0 + */ H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); +/** + * \ingroup FAPL + * + * \brief Sets a callback function to invoke when an object flush occurs in the file + * + * \fapl_id{plist_id} + * \op{func} + * \op_data_in{udata} + * + * \return \herr_t + * + * \details H5Pset_object_flush_cb() sets the callback function to invoke in the + * file access property list \p plist_id whenever an object flush occurs in + * the file. Library objects are group, dataset, and committed + * datatype. + * + * The callback function \p func must conform to the prototype defined below: + * \code + * typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *user_data) + * \endcode + * + * The parameters of the callback function, per the above prototypes, are defined as follows: + * - \Code{object_id} is the identifier of the object which has just been flushed. + * - \Code{user_data} is the user-defined input data for the callback function. + * + * \b Example: The example below illustrates the usage of this routine to set + * the callback function to invoke when an object flush occurs. + * + * \include H5Pset_object_flush_cb.c + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata); +/** + * \ingroup FAPL + * + * \brief Sets the maximum size of the data sieve buffer + * + * \fapl_id{fapl_id} + * \param[in] size Maximum size, in bytes, of data sieve buffer + * + * \return \herr_t + * + * \details H5Pset_sieve_buf_size() sets \p size, the maximum size in bytes of the + * data sieve buffer, which is used by file drivers that are capable of + * using data sieving. + * + * The data sieve buffer is used when performing I/O on datasets in the + * file. Using a buffer which is large enough to hold several pieces of + * the dataset being read in for hyperslab selections boosts + * performance by quite a bit. + * + * The default value is set to 64KB, indicating that file I/O for raw + * data reads and writes will occur in at least 64KB blocks. Setting + * the value to zero (\Code{0}) with this API function will turn off + * the data sieving, even if the VFL driver attempts to use that + * strategy. + * + * Internally, the library checks the storage sizes of the datasets in + * the file. It picks the smaller one between the size from the file + * access property and the size of the dataset to allocate the sieve + * buffer for the dataset in order to save memory usage. + * + * \version 1.6.0 The \p size parameter has changed from type \Code{hsize_t} to \Code{size_t}. + * + * \since 1.4.0 + */ H5_DLL herr_t H5Pset_sieve_buf_size(hid_t fapl_id, size_t size); +/** + * \ingroup FAPL + * + * \brief Sets the size of a contiguous block reserved for small data + * + * \fapl_id{fapl_id} + * \param[in] size Maximum size, in bytes, of the small data block. + The default size is \Code{2048}. + * + * \return \herr_t + * + * \details H5Pset_small_data_block_size() reserves blocks of \p size bytes for the + * contiguous storage of the raw data portion of \Emph{small} datasets. The + * HDF5 library then writes the raw data from small datasets to this + * reserved space, thus reducing unnecessary discontinuities within + * blocks of meta data and improving I/O performance. + * + * A small data block is actually allocated the first time a qualifying + * small dataset is written to the file. Space for the raw data portion + * of this small dataset is suballocated within the small data block. + * The raw data from each subsequent small dataset is also written to + * the small data block until it is filled; additional small data + * blocks are allocated as required. + * + * The HDF5 library employs an algorithm that determines whether I/O + * performance is likely to benefit from the use of this mechanism with + * each dataset as storage space is allocated in the file. A larger + * \p size will result in this mechanism being employed with larger + * datasets. + * + * The small data block size is set as an allocation property in the + * file access property list identified by \p fapl_id. + * + * Setting \p size to zero (\Code{0}) disables the small data block mechanism. + * + * \since 1.4.4 + */ H5_DLL herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size); /** * \ingroup FAPL @@ -3943,14 +5207,242 @@ 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); #ifdef H5_HAVE_PARALLEL +/** + * \ingroup GACPL + * + * \brief Sets metadata I/O mode for read operations to collective or independent (default) + * + * \gacpl_id + * \param[in] is_collective Boolean value indicating whether metadata reads are collective + * (\Code{1}) or independent (\Code{0}). + * Default mode: Independent (\Code{0}) + * + * \return \herr_t + * + * \details H5Pset_all_coll_metadata_ops() sets the metadata I/O mode for read + * operations in the access property list \p plist_id. + * + * When engaging in parallel I/O, all metadata write operations must be + * collective. If \p is_collective is \Code{1}, this property specifies + * that the HDF5 library will perform all metadata read operations + * collectively; if \p is_collective is \Code{0}, such operations may + * be performed independently. + * + * Users must be aware that several HDF5 operations can potentially + * issue metadata reads. These include opening a dataset, datatype, or + * group; reading an attribute; or issuing a \Emph{get info} call such + * as getting information for a group with H5Fget_info(). Collective + * I/O requirements must be kept in mind when issuing such calls in the + * context of parallel I/O. + * + * If this property is collective on a file access property list that + * is used in creating or opening a file, then the HDF5 library will + * assume that all metadata read operations issued on that file + * identifier will be issued collectively from all ranks irrespective + * of the individual setting of a particular operation. If this + * assumption is not adhered to, corruption will be introduced in the + * metadata cache and HDF5’s behavior will be undefined. + * + * Alternatively, a user may wish to avoid setting this property + * globally on the file access property list, and individually set it + * on particular object access property lists (dataset, group, link, + * datatype, attribute access property lists) for certain operations. + * This will indicate that only the operations issued with such an + * access property list will be called collectively and other + * operations may potentially be called independently. There are, + * however, several HDF5 operations that can issue metadata reads but + * have no property list in their function signatures to allow passing + * the collective requirement property. For those operations, the only + * option is to set the global collective requirement property on the + * file access property list; otherwise the metadata reads that can be + * triggered from those operations will be done independently by each + * process. + * + * Functions that do not accommodate an access property list but that + * might issue metadata reads are listed in \ref maybe_metadata_reads. + * + * \attention As noted above, corruption will be introduced into the metadata + * cache and HDF5 library behavior will be undefined when both of the following + * conditions exist: + * - A file is created or opened with a file access property list in which the + * collective metadata I/O property is set to \Code{1}. + * - Any function is called that triggers an independent metadata read while the + * file remains open with that file access property list. + * + * \attention An approach that avoids this corruption risk is described above. + * + * \sa_metadata_ops + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective); +/** + * \ingroup GACPL + * + * \brief Retrieves metadata read mode setting + * + * \gacpl_id + * \param[out] is_collective Pointer to a buffer containing the Boolean value indicating whether metadata + * reads are collective (\Code{>0}) or independent (\Code{0}). + * Default mode: Independent (\Code{0}) + * + * \return \herr_t + * + * \details H5Pget_all_coll_metadata_ops() retrieves the collective metadata read setting from the access + * property list \p plist_id into \p is_collective. + * + * \sa_metadata_ops + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); +/** + * \ingroup FAPL + * + * \brief Sets metadata write mode to collective or independent (default) + * + * \fapl_id{plist_id} + * \param[out] is_collective Boolean value indicating whether metadata + * writes are collective (\Code{>0}) or independent (\Code{0}). + * \Emph{Default mode:} Independent (\Code{0}) + * \return \herr_t + * + * \details H5Pset_coll_metadata_write() tells the HDF5 library whether to + * perform metadata writes collectively (1) or independently (0). + * + * If collective access is selected, then on a flush of the metadata + * cache, all processes will divide the metadata cache entries to be + * flushed evenly among themselves and issue a single MPI-IO collective + * write operation. This is the preferred method when the size of the + * metadata created by the application is large. + * + * If independent access is selected, the library uses the default + * method for doing metadata I/O either from process zero or + * independently from each process. + * + * \sa_metadata_ops + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); +/** + * \ingroup FAPL + * + * \brief Retrieves metadata write mode setting + * + * \fapl_id{plist_id} + * \param[out] is_collective Pointer to a boolean value indicating whether + * metadata writes are collective (\Code{>0}) or independent (\Code{0}). + * \Emph{Default mode:} Independent (\Code{0}) + * \return \herr_t + * + * \details H5Pget_coll_metadata_write() retrieves the collective metadata write + * setting from the file access property into \p is_collective. + * + * \sa_metadata_ops + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); + +/** + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_mpi_params(hid_t fapl_id, MPI_Comm *comm, MPI_Info *info); + +/** + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_mpi_params(hid_t fapl_id, MPI_Comm comm, MPI_Info info); #endif /* H5_HAVE_PARALLEL */ +/** + * \ingroup FAPL + * + * \brief Sets the metadata cache image option for a file access property list + * + * \fapl_id{plist_id} + * \param[out] config_ptr Pointer to metadata cache image configuration values + * \return \herr_t + * + * \details H5Pset_mdc_image_config() sets the metadata cache image option with + * configuration values specified by \p config_ptr for the file access + * property list specified in \p plist_id. + * + * #H5AC_cache_image_config_t is defined as follows: + * \snippet H5ACpublic.h H5AC_cache_image_config_t_snip + * \click4more + * + * \par Limitations: While it is an obvious error to request a cache image when + * opening the file read only, it is not in general possible to test for + * this error in the H5Pset_mdc_image_config() call. Rather than fail the + * subsequent file open, the library silently ignores the file image + * request in this case.\n It is also an error to request a cache image on + * a file that does not support superblock extension messages (i.e. a + * superblock version less than 2). As above, it is not always possible to + * detect this error in the H5Pset_mdc_image_config() call, and thus the + * request for a cache image will fail silently in this case as well.\n + * Creation of cache images is currently disabled in parallel -- as above, + * any request for a cache image in this context will fail silently.\n + * Files with cache images may be read in parallel applications, but note + * that the load of the cache image is a collective operation triggered by + * the first operation that accesses metadata after file open (or, if + * persistent free space managers are enabled, on the first allocation or + * deallocation of file space, or read of file space manager status, + * whichever comes first). Thus the parallel process may deadlock if any + * process does not participate in this access.\n + * In long sequences of file closes and opens, infrequently accessed + * metadata can accumulate in the cache image to the point where the cost + * of storing and restoring this metadata exceeds the benefit of retaining + * frequently used metadata in the cache image. When implemented, the + * #H5AC_cache_image_config_t::entry_ageout should address this problem. In + * the interim, not requesting a cache image every n file close/open cycles + * may be an acceptable work around. The choice of \c n will be driven by + * application behavior, but \Code{n = 10} seems a good starting point. + * + * \since 1.10.1 + */ H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); +/** + * \ingroup FAPL + * + * \brief Sets the maximum size for the page buffer and the minimum percentage + * for metadata and raw data pages + * + * \fapl_id{plist_id} + * \param[in] buf_size Maximum size, in bytes, of the page buffer + * \param[in] min_meta_per Minimum metadata percentage to keep in the page buffer + * before allowing pages containing metadata to be evicted (Default is 0) + * \param[in] min_raw_per Minimum raw data percentage to keep in the page buffer + * before allowing pages containing raw data to be evicted (Default is 0) + * \return \herr_t + * + * \details H5Pset_page_buffer_size() sets buf_size, the maximum size in bytes + * of the page buffer. The default value is zero, meaning that page + * buffering is disabled. When a non-zero page buffer size is set, the + * library will enable page buffering if that size is larger or equal + * than a single page size if a paged file space strategy is enabled + * using the functions H5Pset_file_space_strategy() and + * H5Pset_file_space_page_size(). + * + * The page buffer layer captures all I/O requests before they are + * issued to the VFD and "caches" them in fixed sized pages. Once the + * total number of pages exceeds the page buffer size, the library + * evicts pages from the page buffer by writing them to the VFD. At + * file close, the page buffer is flushed writing all the pages to the + * file. + * + * If a non-zero page buffer size is set, and the file space strategy + * is not set to paged or the page size for the file space strategy is + * larger than the page buffer size, the subsequent call to H5Fcreate() + * or H5Fopen() using the \p plist_id will fail. + * + * The function also allows setting the minimum percentage of pages for + * metadata and raw data to prevent a certain type of data to evict hot + * data of the other type. + * + * \since 1.10.1 + * + */ H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per); @@ -4288,7 +5780,7 @@ H5_DLL H5D_layout_t H5Pget_layout(hid_t plist_id); * virtual dataset that has the creation property list specified * by \p dcpl_id. * - * \virtual + * \see_virtual * * \since 1.10.0 * @@ -4331,7 +5823,7 @@ H5_DLL herr_t H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/); * assigned to \p size for a second H5Pget_virtual_dsetname() * call, which will retrieve the actual dataset name. * - * \virtual + * \see_virtual * * \since 1.10.0 * @@ -4375,7 +5867,7 @@ H5_DLL ssize_t H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name / * \p size for a second H5Pget_virtual_filename() call, which * will retrieve the actual filename. * - * \virtual + * \see_virtual * * \since 1.10.0 * @@ -4400,7 +5892,7 @@ H5_DLL ssize_t H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name / * index, \p index, and returns a dataspace identifier for the * selection within the source dataset used in the mapping. * - * \virtual + * \see_virtual * * \since 1.10.0 * @@ -4425,7 +5917,7 @@ H5_DLL hid_t H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index); * index, \p index, and returns a dataspace identifier for the * selection within the virtual dataset used in the mapping. * - * \virtual + * \see_virtual * * \since 1.10.0 * @@ -5159,6 +6651,133 @@ H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, * */ H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block); + +/** + * \ingroup DCPL + * + * \brief Sets the mapping between virtual and source datasets + * + * \dcpl_id + * \param[in] vspace_id The dataspace identifier with the selection within the + * virtual dataset applied, possibly an unlimited selection + * \param[in] src_file_name The name of the HDF5 file where the source dataset is + * located or a \Code{"."} (period) for a source dataset in the same + * file. The file might not exist yet. The name can be specified using + * a C-style \c printf statement as described below. + * \param[in] src_dset_name The path to the HDF5 dataset in the file specified by + * \p src_file_name. The dataset might not exist yet. The dataset name + * can be specified using a C-style \c printf statement as described below. + * \param[in] src_space_id The source dataset’s dataspace identifier with a + * selection applied, possibly an unlimited selection + * \return \herr_t + * + * \details H5Pset_virtual() maps elements of the virtual dataset (VDS) + * described by the virtual dataspace identifier \p vspace_id to the + * elements of the source dataset described by the source dataset + * dataspace identifier \p src_space_id. The source dataset is + * identified by the name of the file where it is located, + * \p src_file_name, and the name of the dataset, \p src_dset_name. + * + * \par C-style \c printf Formatting Statements: + * C-style \c printf formatting allows a pattern to be specified in the name + * of a source file or dataset. Strings for the file and dataset names are + * treated as literals except for the following substitutions: + * + * + * + * + * + * + * + * + * + *
    \Code{"%%"}Replaced with a single \Code{"%"} (percent) character.
    "%b"Where "" is the virtual dataset dimension axis (0-based) + * and \Code{"b"} indicates that the block count of the selection in that + * dimension should be used. The full expression (for example, \Code{"%0b"}) + * is replaced with a single numeric value when the mapping is evaluated at + * VDS access time. Example code for many source and virtual dataset mappings + * is available in the "Examples of Source to Virtual Dataset Mapping" + * chapter in the + * + * RFC: HDF5 Virtual Dataset. + *
    + * If the printf form is used for the source file or dataset names, the + * selection in the source dataset’s dataspace must be fixed-size. + * + * \par Source File Resolutions: + * When a source dataset residing in a different file is accessed, the + * library will search for the source file \p src_file_name as described + * below: + * \li If \p src_file_name is a \Code{"."} (period) then it refers to the + * file containing the virtual dataset. + * \li If \p src_file_name is a relative pathname, the following steps are + * performed: + * - The library will get the prefix(es) set in the environment + * variable \c HDF5_VDS_PREFIX and will try to prepend each prefix + * to \p src_file_name to form a new \p src_file_name. If the new + * \p src_file_name does not exist or if \c HDF5_VDS_PREFIX is not + * set, the library will get the prefix set via H5Pset_virtual_prefix() + * and prepend it to \p src_file_name to form a new \p src_file_name. + * If the new \p src_file_name does not exist or no prefix is being + * set by H5Pset_virtual_prefix() then the path of the file containing + * the virtual dataset is obtained. This path can be the absolute path + * or the current working directory plus the relative path of that + * file when it is created/opened. The library will prepend this path + * to \p src_file_name to form a new \p src_file_name. + * - If the new \p src_file_name does not exist, then the library will + * look for \p src_file_name and will return failure/success accordingly. + * \li If \p src_file_name is an absolute pathname, the library will first + * try to find \p src_file_name. If \p src_file_name does not exist, + * \p src_file_name is stripped of directory paths to form a new + * \p src_file_name. The search for the new \p src_file_name then follows + * the same steps as described above for a relative pathname. See + * examples below illustrating how \p src_file_name is stripped to form + * a new \p src_file_name. + * \par + * Note that \p src_file_name is considered to be an absolute pathname when + * the following condition is true: + * \li For Unix, the first character of \p src_file_name is a slash + * (\Code{/}).\n For example, consider a \p src_file_name of + * \Code{/tmp/A.h5}. If that source file does not exist, the new + * \p src_file_name after stripping will be \Code{A.h5}. + * \li For Windows, there are 6 cases: + * 1. \p src_file_name is an absolute drive with absolute pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{A.h5}. + * 2. \p src_file_name is an absolute pathname without specifying + * drive name.\n For example, consider a \p src_file_name of + * \Code{/tmp/A.h5}. If that source file does not exist, the new + * \p src_file_name after stripping will be \Code{A.h5}. + * 3. \p src_file_name is an absolute drive with relative pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{tmp/A.h5}. + * 4. \p src_file_name is in UNC (Uniform Naming Convention) format + * with server name, share name, and pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{A.h5}. + * 5. \p src_file_name is in Long UNC (Uniform Naming Convention) + * format with server name, share name, and pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{A.h5}. + * 6. \p src_file_name is in Long UNC (Uniform Naming Convention) + * format with an absolute drive and an absolute pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{A.h5} + * + * \see + * Virtual Dataset Overview + * + * \see_virtual + * + * \version 1.10.2 A change was made to the method of searching for VDS source files. + * \since 1.10.0 + * + */ H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const char *src_dset_name, hid_t src_space_id); @@ -5191,8 +6810,6 @@ H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_fil * \p udata is the user-defined input data for the callback * function. * - * \todo Example Usage was removed and needs to be re-added - * * \since 1.10.0 * */ @@ -5298,7 +6915,7 @@ H5_DLL ssize_t H5Pget_efile_prefix(hid_t dapl_id, char *prefix /*out*/, size_t s * NULL will return the size of the prefix without the NULL * terminator. * - * \virtual + * \see_virtual * * \since 1.10.2 * @@ -5348,7 +6965,7 @@ H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t dapl_id, hsize_t *gap_size); * list, \p dapl_id, and retrieves the flag, \p view, set by the * H5Pset_virtual_view() call. * - * \virtual + * \see_virtual * * \since 1.10.0 * @@ -5389,7 +7006,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); * \p boundary. It is a 1-dimensional array with \p ndims * elements, which should be the same as the rank of the * dataset’s dataspace. While appending to a dataset along a - * particular dimension index via H5DOappend(), the library + * particular dimension index via H5Dappend(), the library * determines a boundary is reached when the resulting dimension * size is divisible by \p boundary[index]. A zero value for * \p boundary[index] indicates no boundary is set for that @@ -5415,8 +7032,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); * * The callback function \p func must conform to the following * prototype: - * \Code{typedef herr_t (#H5D_append_cb_t)(hid_t dataset_id, - * hsize_t *cur_dims, void *user_data)} + * \snippet H5Dpublic.h H5D_append_cb_t_snip * * The parameters of the callback function, per the above * prototype, are defined as follows: @@ -5426,10 +7042,6 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); * a boundary is hit. * \li \p user_data is the user-defined input data. * - * \todo Example Usage was removed and should be added back. - * \todo Adding snippet for H5D_append_cb_t_snip did not work. - * \todo H5DOappend() not found - * * \since 1.10.0 * */ @@ -5643,7 +7255,7 @@ H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char *prefix); * buffer should not be freed until the property list has been * closed. * - * \virtual + * \see_virtual * * \since 1.10.2 * @@ -5672,122 +7284,345 @@ H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char *prefix); * datasets will determine the extent of the unlimited virtual * dataset with the printf-style mappings. * - * Consider the following examples where the regularly spaced - * blocks of a virtual dataset are mapped to datasets with the - * names d-1, d-2, d-3, ..., d-N, ... : + * Consider the following examples where the regularly spaced + * blocks of a virtual dataset are mapped to datasets with the + * names d-1, d-2, d-3, ..., d-N, ... : + * + * \li If the dataset d-2 is missing and \p gap_size is set to 0, + * then the virtual dataset will contain only data found + * in d-1. + * \li If d-2 and d-3 are missing and \p gap_size is set to 2, + * then the virtual dataset will contain the data from + * d-1, d-3, ..., d-N, ... . The blocks that are mapped to + * d-2 and d-3 will be filled according to the virtual + * dataset’s fill value setting. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t dapl_id, hsize_t gap_size); +/** + * \ingroup DAPL + * + * \brief Sets the view of the virtual dataset (VDS) to include or exclude + * missing mapped elements + * + * \dapl_id + * \param[in] view Flag specifying the extent of the data to be included + * in the view. Valid values are: + * \li #H5D_VDS_FIRST_MISSING: View includes all data + * before the first missing mapped data + * \li #H5D_VDS_LAST_AVAILABLE View includes all + * available mapped data + * + * \return \herr_t + * + * \details H5Pset_virtual_view() takes the access property list for the + * virtual dataset, \p dapl_id, and the flag, \p view, and sets + * the VDS view according to the flag value. + * + * If \p view is set to #H5D_VDS_FIRST_MISSING, the view includes + * all data before the first missing mapped data. This setting + * provides a view containing only the continuous data starting + * with the dataset’s first data element. Any break in + * continuity terminates the view. + * + * If \p view is set to #H5D_VDS_LAST_AVAILABLE, the view + * includes all available mapped data. + * + * Missing mapped data is filled with the fill value set in the + * VDS creation property list. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pset_virtual_view(hid_t dapl_id, H5D_vds_view_t view); + +/* Dataset xfer property list (DXPL) routines */ +/** + * + * \ingroup DXPL + * + * \brief Gets B-tree split ratios for a dataset transfer property list + * + * \dxpl_id{plist_id} + * \param[out] left The B-tree split ratio for left-most nodes + * \param[out] middle The B-tree split ratio for right-most nodes and lone nodes + * \param[out] right The B-tree split ratio for all other nodes + * \return \herr_t + * + * \details H5Pget_btree_ratios() returns the B-tree split ratios for a dataset + * transfer property list. + * + * The B-tree split ratios are returned through the non-NULL arguments + * \p left, \p middle, and \p right, as set by the H5Pset_btree_ratios() + * function. + * + */ +H5_DLL herr_t H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/, + double *right /*out*/); +/** + * + * \ingroup DXPL + * + * \brief Reads buffer settings + * + * \param[in] plist_id Identifier for the dataset transfer property list + * \param[out] tconv Address of the pointer to application-allocated type + * conversion buffer + * \param[out] bkg Address of the pointer to application-allocated + * background buffer + * + * \return Returns buffer size, in bytes, if successful; otherwise 0 on failure. + * + * \details H5Pget_buffer() reads values previously set with H5Pset_buffer(). + * + * \version 1.6.0 The return type changed from \p hsize_t to \p size_t. + * \version 1.4.0 The return type changed to \p hsize_t. + * + */ +H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/); +/** + * + * \ingroup DXPL + * + * \brief Retrieves a data transform expression + * + * \param[in] plist_id Identifier of the property list or class + * \param[out] expression Pointer to memory where the transform expression will + * be copied + * \param[in] size Number of bytes of the transform expression to copy + * to + * + * \return Success: the size of the transform expression. Failure: a negative + * value. + * + * \details H5Pget_data_transform() retrieves the data transform expression + * previously set in the dataset transfer property list \p plist_id + * by H5Pset_data_transform(). + * + * H5Pget_data_transform() can be used to both retrieve the transform + * expression and query its size. + * + * If \p expression is non-NULL, up to \p size bytes of the data + * transform expression are written to the buffer. If \p expression + * is NULL, \p size is ignored, and the function does not write + * anything to the buffer. The function always returns the size of + * the data transform expression. + * + * If 0 is returned for the size of the expression, no data transform + * expression exists for the property list. + * + * 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 + * + */ +H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size); +/** + * + * \ingroup DXPL + * + * \brief Determines whether error-detection is enabled for dataset reads + * + * \param[in] plist_id Dataset transfer property list identifier + * + * \return Returns \p H5Z_ENABLE_EDC or \p H5Z_DISABLE_EDC if successful; + * otherwise returns a negative value. + * + * \details H5Pget_edc_check() queries the dataset transfer property + * list \p plist to determine whether error detection is enabled for + * data read operations. + * + * \since 1.6.0 + * + */ +H5_DLL H5Z_EDC_t H5Pget_edc_check(hid_t plist_id); +/** + * + * \ingroup DXPL + * + * \brief Retrieves number of I/O vectors to be read/written in hyperslab I/O + * + * \param[in] fapl_id Dataset transfer property list identifier + * \param[out] size Number of I/O vectors to accumulate in memory for I/O operations + * + * \return \herr_t + * + * \details H5Pget_hyper_vector_size() retrieves the number of I/O vectors to be accumulated in + * memory before being issued to the lower levels of the HDF5 library for reading or + * writing the actual data. + * + * The number of I/O vectors set in the dataset transfer property list \p fapl_id is + * returned in \p size. Unless the default value is in use, \p size was + * previously set with a call to H5Pset_hyper_vector_size(). + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size /*out*/); +/** + * + * \ingroup DXPL + * + * \brief Checks status of the dataset transfer property list (\b DEPRECATED) + * + * \deprecated{H5Pget_preserve() is deprecated as it is no longer useful; + * compound datatype field preservation is now core functionality + * in the HDF5 library.} + * + * \param[in] plist_id Identifier for the dataset transfer property list + * + * \return Returns 1 or 0 if successful; otherwise returns a negative value. + * + * \details H5Pget_preserve() checks the status of the dataset transfer + * property list. + * + * \version 1.6.0 The flag parameter was changed from INTEGER to LOGICAL to + * better match the C API. (Fortran 90) + * + */ +H5_DLL int H5Pget_preserve(hid_t plist_id); +/** + * + * \ingroup DXPL + * + * \brief Gets user-defined datatype conversion callback function * - * \li If the dataset d-2 is missing and \p gap_size is set to 0, - * then the virtual dataset will contain only data found - * in d-1. - * \li If d-2 and d-3 are missing and \p gap_size is set to 2, - * then the virtual dataset will contain the data from - * d-1, d-3, ..., d-N, ... . The blocks that are mapped to - * d-2 and d-3 will be filled according to the virtual - * dataset’s fill value setting. + * \param[in] dxpl_id Dataset transfer property list identifier + * \param[out] op User-defined type conversion callback function + * \param[out] operate_data User-defined input data for the callback function * - * \virtual + * \return \herr_t * - * \since 1.10.0 + * \details H5Pget_type_conv_cb() gets the user-defined datatype conversion + * callback function \p op in the dataset transfer property list + * \p dxpl_id. + * + * The parameter \p operate_data is a pointer to user-defined input + * data for the callback function. + * + * The callback function \p op defines the actions an application is + * to take when there is an exception during datatype conversion. + * + * Please refer to the function H5Pset_type_conv_cb() for more details. * */ -H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t dapl_id, hsize_t gap_size); +H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void **operate_data); /** - * \ingroup DAPL * - * \brief Sets the view of the virtual dataset (VDS) to include or exclude - * missing mapped elements + * \ingroup DXPL * - * \dapl_id - * \param[in] view Flag specifying the extent of the data to be included - * in the view. Valid values are: - * \li #H5D_VDS_FIRST_MISSING: View includes all data - * before the first missing mapped data - * \li #H5D_VDS_LAST_AVAILABLE View includes all - * available mapped data + * \brief Gets the memory manager for variable-length datatype allocation in H5Dread() and H5Dvlen_reclaim() + * + * \param[in] plist_id Identifier for the dataset transfer property list + * \param[out] alloc_func User's allocate routine, or NULL for system malloc + * \param[out] alloc_info Extra parameter for user’s allocation routine. + * Contents are ignored if preceding + * parameter is NULL \param[out] free_func User's free routine, or NULL for + * system free \param[out] free_info + * Extra parameter for user’s free routine. Contents are ignored if preceding + * parameter is NULL * * \return \herr_t * - * \details H5Pset_virtual_view() takes the access property list for the - * virtual dataset, \p dapl_id, and the flag, \p view, and sets - * the VDS view according to the flag value. + * \details H5Pget_vlen_mem_manager() is the companion function to + * H5Pset_vlen_mem_manager(), returning the parameters set by + * that function. * - * If \p view is set to #H5D_VDS_FIRST_MISSING, the view includes - * all data before the first missing mapped data. This setting - * provides a view containing only the continuous data starting - * with the dataset’s first data element. Any break in - * continuity terminates the view. + */ +H5_DLL herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func, void **alloc_info, + H5MM_free_t *free_func, void **free_info); +/** * - * If \p view is set to #H5D_VDS_LAST_AVAILABLE, the view - * includes all available mapped data. + * \ingroup DXPL * - * Missing mapped data is filled with the fill value set in the - * VDS creation property list. + * \brief Sets B-tree split ratios for a dataset transfer property list * - * \virtual + * \param[in] plist_id The dataset transfer property list identifier + * \param[in] left The B-tree split ratio for left-most nodes + * \param[in] middle The B-tree split ratio for all other nodes + * \param[in] right The B-tree split ratio for right-most nodes and lone + * nodes * - * \since 1.10.0 + * \return \herr_t + * + * \details H5Pset_btree_ratios() sets the B-tree split ratios for a dataset + * transfer property list. The split ratios determine what percent of + * children go in the first node when a node splits. + * + * The ratio \p left is used when the splitting node is the left-most + * node at its level in the tree; + * the ratio \p right is used when the splitting node is the right-most + * node at its level; and + * the ratio \p middle is used for all other cases. + * + * A node that is the only node at its level in the tree uses the + * ratio \p right when it splits. + * + * All ratios are real numbers between 0 and 1, inclusive. * */ -H5_DLL herr_t H5Pset_virtual_view(hid_t dapl_id, H5D_vds_view_t view); +H5_DLL herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right); -/* Dataset xfer property list (DXPL) routines */ -H5_DLL herr_t H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/, - double *right /*out*/); -H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/); /** * * \ingroup DXPL * - * \brief Retrieves a data transform expression - * - * \param[in] plist_id Identifier of the property list or class - * \param[out] expression Pointer to memory where the transform expression - * will be copied - * \param[in] size Number of bytes of the transform expression to copy to - * - * \return Returns the size of the transform expression if successful; - * otherwise returns a negative value. + * \brief Sets type conversion and background buffers * - * \details H5Pget_data_transform() retrieves the data transform - * expression previously set in the dataset transfer property - * list \p plist_id by H5Pset_data_transform(). + * \dxpl_id{plist_id} + * \param[in] size Size, in bytes, of the type conversion and background buffers + * \param[in] tconv Pointer to application-allocated type conversion buffer + * \param[in] bkg Pointer to application-allocated background buffer + * \return \herr_t * - * H5Pget_data_transform() can be used to both retrieve the - * transform expression and to query its size. + * \details Given a dataset transfer property list, H5Pset_buffer() sets the + * maximum size for the type conversion buffer and background buffer + * and optionally supplies pointers to application-allocated + * buffers. If the buffer size is smaller than the entire amount of + * data being transferred between the application and the file, and a + * type conversion buffer or background buffer is required, then strip + * mining will be used. * - * If \p expression is non-NULL, up to \p size bytes of the data - * transform expression are written to the buffer. If - * \p expression is NULL, \p size is ignored and the function - * does not write anything to the buffer. The function always - * returns the size of the data transform expression. + * Note that there are minimum size requirements for the buffer. Strip + * mining can only break the data up along the first dimension, so the + * buffer must be large enough to accommodate a complete slice that + * encompasses all of the remaining dimensions. For example, when strip + * mining a \Code{100x200x300} hyperslab of a simple data space, the + * buffer must be large enough to hold \Code{1x200x300} data + * elements. When strip mining a \Code{100x200x300x150} hyperslab of a + * simple data space, the buffer must be large enough to hold + * \Code{1x200x300x150} data elements. * - * If 0 is returned for the size of the expression, no data - * transform expression exists for the property list. + * If \p tconv and/or \p bkg are null pointers, then buffers will be + * allocated and freed during the data transfer. * - * If an error occurs, the buffer pointed to by \p expression is - * unchanged and the function returns a negative value. + * The default value for the maximum buffer is 1 MiB. * - * \since 1.8.0 + * \version 1.6.0 The \p size parameter has changed from type hsize_t to \c size_t. + * \version 1.4.0 The \p size parameter has changed to type hsize_t. * */ -H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size); -H5_DLL H5Z_EDC_t H5Pget_edc_check(hid_t plist_id); -H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size /*out*/); -H5_DLL int H5Pget_preserve(hid_t plist_id); -H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void **operate_data); -H5_DLL herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func, void **alloc_info, - H5MM_free_t *free_func, void **free_info); -H5_DLL herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right); -H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); +H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); + /** * \ingroup DXPL * * \brief Sets a data transform expression * - * \param[in] plist_id Identifier of the property list or class + * \dxpl_id{plist_id} * \param[in] expression Pointer to the null-terminated data transform * expression - * * \return \herr_t * * \details H5Pset_data_transform() sets the data transform to be used for @@ -5795,11 +7630,11 @@ H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *b * transfer property list \p plist_id. * * The \p expression parameter is a string containing an algebraic - * expression, such as (5/9.0)*(x-32) or x*(x-5). When a dataset - * is read or written with this property list, the transform - * expression is applied with the x being replaced by the values - * in the dataset. When reading data, the values in the file are - * not changed and the transformed data is returned to the user. + * expression, such as \Code{(5/9.0)*(x-32)} or \Code{x*(x-5)}. When a + * dataset is read or written with this property list, the transform + * expression is applied with the \c x being replaced by the values in + * the dataset. When reading data, the values in the file are not + * changed and the transformed data is returned to the user. * * Data transforms can only be applied to integer or * floating-point datasets. Order of operations is obeyed and @@ -5813,17 +7648,354 @@ H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *b * */ H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char *expression); + +/** + * \ingroup DXPL + * + * \brief Sets the dataset transfer property list to enable or disable error + * detection when reading data + * + * \dxpl_id{plist_id} + * \param[in] check Specifies whether error checking is enabled or disabled + * for dataset read operations + * \return \herr_t + * + * \details H5Pset_edc_check() sets the dataset transfer property list \p plist + * to enable or disable error detection when reading data. + * + * Whether error detection is enabled or disabled is specified in the + * \p check parameter. Valid values are #H5Z_ENABLE_EDC (default) and + * #H5Z_DISABLE_EDC. + * + * \note The initial error detection implementation, Fletcher32 checksum, + * supports error detection for chunked datasets only. + * + * \attention The Fletcher32 EDC checksum filter, set with H5Pset_fletcher32(), + * was added in HDF5 Release 1.6.0. In the original implementation, + * however, the checksum value was calculated incorrectly on + * little-endian systems. The error was fixed in HDF5 Release 1.6.3.\n + * As a result of this fix, an HDF5 library of Release 1.6.0 through + * Release 1.6.2 cannot read a dataset created or written with + * Release 1.6.3 or later if the dataset was created with the + * checksum filter and the filter is enabled in the reading + * library. (Libraries of Release 1.6.3 and later understand the + * earlier error and compensate appropriately.)\n + * \Bold{Work-around:} An HDF5 library of Release 1.6.2 or earlier + * will be able to read a dataset created or written with the + * checksum filter by an HDF5 library of Release 1.6.3 or later if + * the checksum filter is disabled for the read operation. This can + * be accomplished via an H5Pset_edc_check() call with the value + * #H5Z_DISABLE_EDC in the second parameter. This has the obvious + * drawback that the application will be unable to verify the + * checksum, but the data does remain accessible. + * + * \version 1.6.3 Error in checksum calculation on little-endian systems + * corrected in this release. + * \since 1.6.0 + * + */ H5_DLL herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check); + +/** + * \ingroup DXPL + * + * \brief Sets user-defined filter callback function + * + * \dxpl_id{plist_id} + * \param[in] func User-defined filter callback function + * \param[in] op_data User-defined input data for the callback function + * \return \herr_t + * + * \details H5Pset_filter_callback() sets the user-defined filter callback + * function \p func in the dataset transfer property list \p plist_id. + * + * The parameter \p op_data is a pointer to user-defined input data for + * the callback function and will be passed through to the callback + * function. + * + * The callback function \p func defines the actions an application is + * to take when a filter fails. The function prototype is as follows: + * \snippet H5Zpublic.h H5Z_filter_func_t_snip + * where \c filter indicates which filter has failed, \c buf and \c buf_size + * are used to pass in the failed data, and op_data is the required + * input data for this callback function. + * + * Valid callback function return values are #H5Z_CB_FAIL and #H5Z_CB_CONT. + * + * \since 1.6.0 + * + */ H5_DLL herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data); -H5_DLL herr_t H5Pset_hyper_vector_size(hid_t fapl_id, size_t size); + +/** + * \ingroup DXPL + * + * \brief Sets number of I/O vectors to be read/written in hyperslab I/O + * + * \dxpl_id{plist_id} + * \param[in] size Number of I/O vectors to accumulate in memory for I/O + * operations\n + * Must be greater than 1 (one)\n + * Default value: 1024 + * \return \herr_t + * + * \details H5Pset_hyper_vector_size() sets the number of I/O vectors to be + * accumulated in memory before being issued to the lower levels of + * the HDF5 library for reading or writing the actual data. + * + * The I/O vectors are hyperslab offset and length pairs and are + * generated during hyperslab I/O. + * + * The number of I/O vectors is passed in \p size to be set in the + * dataset transfer property list \p plist_id. \p size must be + * greater than 1 (one). + * + * H5Pset_hyper_vector_size() is an I/O optimization function; + * increasing vector_size should provide better performance, but the + * library will use more memory during hyperslab I/O. The default value + * of \p size is 1024. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pset_hyper_vector_size(hid_t plist_id, size_t size); + +/** + * \ingroup DXPL + * + * \brief Sets the dataset transfer property list \p status + * + * \dxpl_id{plist_id} + * \param[in] status Status toggle of the dataset transfer property list + * \return \herr_t + * + * \deprecated This function is deprecated as it no longer has any effect; + * compound datatype field preservation is now core functionality in + * the HDF5 library. + * + * \details H5Pset_preserve() sets the dataset transfer property list status to + * \c 1 or \c 0. + * + * When reading or writing compound datatypes and the destination is + * partially initialized and the read/write is intended to initialize + * the other members, one must set this property to \c 1. Otherwise the + * I/O pipeline treats the destination datapoints as completely + * uninitialized. + * + * \todo Add missing version information: introduction, deprecation, etc. + * Why is the declaration not in the deprecated section? + * + */ H5_DLL herr_t H5Pset_preserve(hid_t plist_id, hbool_t status); + +/** + * \ingroup DXPL + * + * \brief Sets user-defined datatype conversion callback function + * + * \dxpl_id + * \param[in] op User-defined type conversion callback function + * \param[in] operate_data User-defined input data for the callback function + * \return \herr_t + * + * \details H5Pset_type_conv_cb() sets the user-defined datatype conversion + * callback function \p op in the dataset transfer property list \p + * dxpl_id + * + * The parameter operate_data is a pointer to user-defined input data + * for the callback function and will be passed through to the callback + * function. + * + * The callback function \p op defines the actions an application is to + * take when there is an exception during datatype conversion. The + * function prototype is as follows: + * \snippet H5Tpublic.h H5T_conv_except_func_t_snip + * + * \todo Add version information. + * + */ H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void *operate_data); + +/** + * \ingroup DXPL + * + * \brief Sets the memory manager for variable-length datatype allocation in + * H5Dread() and H5Dvlen_reclaim() + * + * \dxpl_id{plist_id} + * \param[in] alloc_func User's allocate routine, or \c NULL for system \c malloc + * \param[in] alloc_info Extra parameter for user's allocation routine. + * Contents are ignored if preceding parameter is \c NULL. + * \param[in] free_func User's free routine, or \c NULL for system \c free + * \param[in] free_info Extra parameter for user's free routine. Contents are + * ignored if preceding parameter is \c NULL + * \return \herr_t + * + * \details H5Pset_vlen_mem_manager() sets the memory manager for + * variable-length datatype allocation in H5Dread() and free in + * H5Dvlen_reclaim(). + * + * The \p alloc_func and \p free_func parameters identify the memory + * management routines to be used. If the user has defined custom + * memory management routines, \p alloc_func and/or free_func should be + * set to make those routine calls (i.e., the name of the routine is + * used as the value of the parameter); if the user prefers to use the + * system's \c malloc and/or \c free, the \p alloc_func and \p + * free_func parameters, respectively, should be set to \c NULL + * + * The prototypes for these user-defined functions are as follows: + * \snippet H5MMpublic.h H5MM_allocate_t_snip + * + * \snippet H5MMpublic.h H5MM_free_t_snip + * + * The \p alloc_info and \p free_info parameters can be used to pass + * along any required information to the user's memory management + * routines. + * + * In summary, if the user has defined custom memory management + * routines, the name(s) of the routines are passed in the \p + * alloc_func and \p free_func parameters and the custom routines' + * parameters are passed in the \p alloc_info and \p free_info + * parameters. If the user wishes to use the system \c malloc and \c + * free functions, the \p alloc_func and/or \p free_func parameters are + * set to \c NULL and the \p alloc_info and \p free_info parameters are + * ignored. + * + * \todo Add version information. + */ H5_DLL herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info); + #ifdef H5_HAVE_PARALLEL +/** + * \ingroup DXPL + * + * \brief Retrieves the type of chunk optimization that HDF5 actually performed + * on the last parallel I/O call (not necessarily the type requested) + * + * \dxpl_id{plist_id} + * \param[out] actual_chunk_opt_mode The type of chunk optimization performed by HDF5 + * \return \herr_t + * + * \par Motivation: + * A user can request collective I/O via a data transfer property list + * (DXPL) that has been suitably modified with H5Pset_dxpl_mpio(). + * However, HDF5 will sometimes ignore this request and perform independent + * I/O instead. This property allows the user to see what kind of I/O HDF5 + * actually performed. Used in conjunction with H5Pget_mpio_actual_io_mode(), + * this property allows the user to determine exactly what HDF5 did when + * attempting collective I/O. + * + * \details H5Pget_mpio_actual_chunk_opt_mode() retrieves the type of chunk + * optimization performed when collective I/O was requested. This + * property is set before I/O takes place, and will be set even if I/O + * fails. + * + * Valid values returned in \p actual_chunk_opt_mode: + * \snippet this H5D_mpio_actual_chunk_opt_mode_t_snip + * \click4more + * + * \since 1.8.8 + * + */ H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode); +/** + * \ingroup DXPL + * + * \brief Retrieves the type of I/O that HDF5 actually performed on the last + * parallel I/O call (not necessarily the type requested) + * + * \dxpl_id{plist_id} + * \param[out] actual_io_mode The type of I/O performed by this process + * \return \herr_t + * + * \par Motivation: + * A user can request collective I/O via a data transfer property list + * (DXPL) that has been suitably modified with H5Pset_dxpl_mpio(). + * However, HDF5 will sometimes ignore this request and perform independent + * I/O instead. This property allows the user to see what kind of I/O HDF5 + * actually performed. Used in conjunction with H5Pget_mpio_actual_chunk_opt_mode(), + * this property allows the user to determine exactly HDF5 did when + * attempting collective I/O. + * + * \details H5Pget_mpio_actual_io_mode() retrieves the type of I/O performed on + * the selection of the current process. This property is set after all + * I/O is completed; if I/O fails, it will not be set. + * + * Valid values returned in \p actual_io_mode: + * \snippet this H5D_mpio_actual_io_mode_t_snip + * \click4more + * + * \attention All processes do not need to have the same value. For example, if + * I/O is being performed using the multi chunk optimization scheme, + * one process's selection may include only chunks accessed + * collectively, while another may include chunks accessed + * independently. In this case, the first process will report + * #H5D_MPIO_CHUNK_COLLECTIVE while the second will report + * #H5D_MPIO_CHUNK_INDEPENDENT. + * + * \see H5Pget_mpio_no_collective_cause(), H5Pget_mpio_actual_chunk_opt_mode() + * + * \since 1.8.8 + * + */ H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode); +/** + * \ingroup DXPL + * + * \brief Retrieves local and global causes that broke collective I/O on the last + * parallel I/O call + * + * \dxpl_id{plist_id} + * \param[out] local_no_collective_cause An enumerated set value indicating the + * causes that prevented collective I/O in the local process + * \param[out] global_no_collective_cause An enumerated set value indicating + * the causes across all processes that prevented collective I/O + * \return \herr_t + * + * \par Motivation: + * A user can request collective I/O via a data transfer property list (DXPL) + * that has been suitably modified with H5P_SET_DXPL_MPIO. However, there are + * conditions that can cause HDF5 to forgo collective I/O and perform + * independent I/O. Such causes can be different across the processes of a + * parallel application. This function allows the user to determine what + * caused the HDF5 library to skip collective I/O locally, that is in the + * local process, and globally, across all processes. + * + * \details H5Pget_mpio_no_collective_cause() serves two purposes. It can be + * used to determine whether collective I/O was used for the last + * preceding parallel I/O call. If collective I/O was not used, the + * function retrieves the local and global causes that broke collective + * I/O on that parallel I/O call. The properties retrieved by this + * function are set before I/O takes place and are retained even when + * I/O fails. + * + * Valid values returned in \p local_no_collective_cause and \p + * global_no_collective_cause are as follows or, if there are multiple + * causes, a bitwise OR of the relevant causes; the numbers in the + * center column are the bitmask values: + * \snippet this H5D_mpio_no_collective_cause_t_snip + * \click4more + * + * \attention Each process determines whether it can perform collective I/O and + * broadcasts the result. Those results are combined to make a + * collective decision; collective I/O will be performed only if all + * processes can perform collective I/O.\n + * If collective I/O was not used, the causes that prevented it are + * reported by individual process by means of an enumerated set. The + * causes may differ among processes, so H5Pget_mpio_no_collective_cause() + * returns two property values. The first value is the one produced + * by the local process to report local causes. This local information + * is encoded in an enumeration, the \ref H5D_mpio_no_collective_cause_t + * described above, with all individual causes combined into a single + * enumeration value by means of a bitwise OR operation. The second + * value reports global causes; this global value is the result of a + * bitwise-OR operation across the values returned by all the processes. + * + * \since 1.8.10 + * + */ 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 */ @@ -5880,6 +8052,36 @@ H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_int H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd); /* Group creation property list (GCPL) routines */ + +/** + * \ingroup GCPL + * + * \brief Returns the estimated link count and average link name length in a group + * + * \gcpl_id{plist_id} + * \param[out] est_num_entries The estimated number of links in the group + * referenced by \p plist_id + * \param[out] est_name_len The estimated average length of line names in the group + * referenced by \p plist_id + * \return \herr_t + * + * \details H5Pget_est_link_info() retrieves two settings from the group creation + * property list \p plist_id: the estimated number of links that are + * expected to be inserted into a group created with the property list + * and the estimated average length of those link names. + * + * The estimated number of links is returned in \p est_num_entries. The + * limit for \p est_num_entries is 64 K. + * + * The estimated average length of the anticipated link names is returned + * in \p est_name_len. The limit for \p est_name_len is 64 K. + * + * See \ref_group_impls for a discussion of the available types of HDF5 + * group structures. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */, unsigned *est_name_len /* out */); /** @@ -5949,7 +8151,64 @@ H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_fla */ H5_DLL herr_t H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned *min_dense /*out*/); +/** + * \ingroup GCPL + * + * \brief Retrieves the anticipated size of the local heap for original-style + * groups + * + * \gcpl_id{plist_id} + * \param[out] size_hint Anticipated size of local heap + * \return \herr_t + * + * \details H5Pget_local_heap_size_hint() queries the group creation property + * list, \p plist_id, for the anticipated size of the local heap, \p + * size_hint, for original-style groups, i.e., for groups of the style + * used prior to HDF5 Release 1.8.0. See H5Pset_local_heap_size_hint() + * for further discussion. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/); +/** + * \ingroup GCPL + * + * \brief Sets estimated number of links and length of link names in a group + * + * \gcpl_id{plist_id} + * \param[in] est_num_entries Estimated number of links to be inserted into group + * \param[in] est_name_len Estimated average length of link names + * \return \herr_t + * + * \details H5Pset_est_link_info() inserts two settings into the group creation + * property list plist_id: the estimated number of links that are + * expected to be inserted into a group created with the property list + * and the estimated average length of those link names. + * + * The estimated number of links is passed in \p est_num_entries. The + * limit for \p est_num_entries is 64 K. + * + * The estimated average length of the anticipated link names is passed + * in \p est_name_len. The limit for \p est_name_len is 64 K. + * + * The values for these two settings are multiplied to compute the + * initial local heap size (for old-style groups, if the local heap + * size hint is not set) or the initial object header size for + * (new-style compact groups; see \ref_group_impls). Accurately setting + * these parameters will help reduce wasted file space. + * + * If a group is expected to have many links and to be stored in dense + * format, set \p est_num_entries to 0 (zero) for maximum + * efficiency. This will prevent the group from being created in the + * compact format. + * + * See \ref_group_impls for a discussion of the available types of HDF5 + * group structures. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len); /** * \ingroup GCPL @@ -6039,15 +8298,119 @@ H5_DLL herr_t H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flag * the number of links falls below this threshold are * automatically converted to compact format. * - * \since 1.8.0 + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense); +/** + * \ingroup GCPL + * + * \brief Specifies the anticipated maximum size of a local heap + * + * \gcpl_id{plist_id} + * \param[in] size_hint Anticipated maximum size in bytes of local heap + * \return \herr_t + * + * \details H5Pset_local_heap_size_hint() is used with original-style HDF5 + * groups (see “Motivation” below) to specify the anticipated maximum + * local heap size, size_hint, for groups created with the group + * creation property list \p plist_id. The HDF5 library then uses \p + * size_hint to allocate contiguous local heap space in the file for + * each group created with \p plist_id. + * + * For groups with many members or very few members, an appropriate + * initial value of \p size_hint would be the anticipated number of + * group members times the average length of group member names, plus a + * small margin: + * \code + * size_hint = max_number_of_group_members * + * (average_length_of_group_member_link_names + 2) + * \endcode + * If it is known that there will be groups with zero members, the use + * of a group creation property list with \p size_hint set to to 1 (one) + * will guarantee the smallest possible local heap for each of those groups. + * + * Setting \p size_hint to zero (0) causes the library to make a + * reasonable estimate for the default local heap size. + * + * \par Motivation: + * In situations where backward-compatibility is required, specifically, when + * libraries prior to HDF5 Release 1.8.0 may be used to read the file, groups + * must be created and maintained in the original style. This is HDF5’s default + * behavior. If backward compatibility with pre-1.8.0 libraries is not a concern, + * greater efficiencies can be obtained with the new-format compact and indexed + * groups. See Group + * implementations in HDF5 in the \ref H5G API introduction (at the bottom).\n + * H5Pset_local_heap_size_hint() is useful for tuning file size when files + * contain original-style groups with either zero members or very large + * numbers of members.\n + * The original style of HDF5 groups, the only style available prior to HDF5 + * Release 1.8.0, was well-suited for moderate-sized groups but was not optimized + * for either very small or very large groups. This original style remains the + * default, but two new group implementations were introduced in HDF5 Release 1.8.0: + * compact groups to accommodate zero to small numbers of members and indexed groups + * for thousands or tens of thousands of members ... or millions, if that's what + * your application requires.\n + * The local heap size hint, \p size_hint, is a performance tuning parameter for + * original-style groups. As indicated above, an HDF5 group may have zero, a handful, + * or tens of thousands of members. Since the original style of HDF5 groups stores the + * metadata for all of these group members in a uniform format in a local heap, the size + * of that metadata (and hence, the size of the local heap) can vary wildly from group + * to group. To intelligently allocate space and to avoid unnecessary fragmentation of + * the local heap, it can be valuable to provide the library with a hint as to the local + * heap’s likely eventual size. This can be particularly valuable when it is known that + * a group will eventually have a great many members. It can also be useful in conserving + * space in a file when it is known that certain groups will never have any members. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint); + +/* Map access property list (MAPL) routines */ +#ifdef H5_HAVE_MAP_API +/** + * \ingroup MAPL + * + * \brief Set map iteration hints + * + * \mapl_id + * \param[in] key_prefetch_size Number of keys to prefetch at a time during + * iteration + * \param[in] key_alloc_size The initial size of the buffer allocated to hold + * prefetched keys + * \return \herr_t + * + * \details H5Pset_map_iterate_hints() adjusts the behavior of H5Miterate() when + * prefetching keys for iteration. The \p key_prefetch_size parameter + * specifies the number of keys to prefetch at a time during + * iteration. The \p key_alloc_size parameter specifies the initial + * size of the buffer allocated to hold these prefetched keys. If this + * buffer is too small it will be reallocated to a larger size, though + * this may result in an additional I/O. + * + * \since 1.12.? * */ -H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense); -H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint); - -/* Map access property list (MAPL) routines */ -#ifdef H5_HAVE_MAP_API H5_DLL herr_t H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size); +/** + * \ingroup MAPL + * + * \brief Set map iteration hints + * + * \mapl_id + * \param[out] key_prefetch_size Pointer to number of keys to prefetch at a time + * during iteration + * \param[out] key_alloc_size Pointer to the initial size of the buffer allocated + * to hold prefetched keys + * \return \herr_t + * + * \details H5Pget_map_iterate() returns the map iterate hints, \p key_prefetch_size + * and \p key_alloc_size, as set by H5Pset_map_iterate_hints(). + * + * \since 1.12.? + * + */ H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/, size_t *key_alloc_size /*out*/); #endif /* H5_HAVE_MAP_API */ @@ -6409,9 +8772,6 @@ H5_DLL herr_t H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags); * * * - * \todo Add Programming Note for C++ Developers Using C Functions - * - * * \since 1.8.3 * */ @@ -6594,10 +8954,7 @@ H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks); * \li H5Pget_mcdt_search_cb() * \li H5Pset_copy_object() * \li H5Pset_mcdt_search_cb() - * - * \todo missing link to "Copying Committed Datatypes with H5Ocopy - A - * comprehensive discussion of copying committed datatypes (PDF) - * in Advanced Topics in HDF5 + * \li \ref_h5ocopy * * \since 1.8.9 * @@ -6711,8 +9068,7 @@ H5_DLL herr_t H5Pget_copy_object(hid_t plist_id, unsigned *copy_options /*out*/) * \li H5Pget_mcdt_search_cb() * \li H5Pset_copy_object() * \li H5Pset_mcdt_search_cb() - * - * \todo Link to Copying Committed Datatypes with H5Ocopy was removed. + * \li \ref_h5ocopy * * \since 1.8.9 * @@ -6803,8 +9159,8 @@ H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, * \li H5Pget_mcdt_search_cb() * \li H5Pset_copy_object() * \li H5Pset_mcdt_search_cb() + * \li \ref_h5ocopy * - * \todo Link to Copying Committed Datatypes with H5Ocopy was removed. * \version 1.8.9 #H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG added in this release. * * \since 1.8.0 @@ -6890,9 +9246,7 @@ H5_DLL herr_t H5Pset_copy_object(hid_t plist_id, unsigned copy_options); * \li H5Pget_mcdt_search_cb() * \li H5Pset_copy_object() * \li H5Pset_mcdt_search_cb() - * - * \todo Link removed to "Copying Committed Datatypes with H5Ocopy" in Advanced Topics in HDF5 - * \todo Programming Note for C++ Developers Using C Functions: + * \li \ref_h5ocopy * * \since 1.8.9 * @@ -6911,38 +9265,316 @@ H5_DLL herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, v #define H5P_NO_CLASS H5P_ROOT /* Typedefs */ +/** + * \ingroup GPLOA + * + * \brief Registers a permanent property with a property list class + * + * \plistcls_id{cls_id} + * \param[in] name Name of property to register + * \param[in] size Size of property in bytes + * \param[in] def_value Default value for property in newly created + * property lists + * \param[in] prp_create Callback routine called when a property list is + * being created and the property value will be + * initialized + * \param[in] prp_set Callback routine called before a new value is + * copied into the property's value + * \param[in] prp_get Callback routine called when a property value is + * retrieved from the property + * \param[in] prp_del Callback routine called when a property is deleted + * from a property list + * \param[in] prp_copy Callback routine called when a property is copied + * from a property list + * \param[in] prp_close Callback routine called when a property list is + * being closed and the property value will be + * disposed of + * + * \return \herr_t + * + * \deprecated As of HDF5-1.8 this function was deprecated in favor of + * H5Pregister2() or the macro H5Pregister(). + * + * \details H5Pregister1() registers a new property with a property list + * class. The property will exist in all property list objects + * of that class after this routine is finished. The name of + * the property must not already exist. The default property + * value must be provided and all new property lists created + * with this property will have the property value set to the + * default provided. Any of the callback routines may be set + * to NULL if they are not needed. + * + * Zero-sized properties are allowed and do not store any data in + * the property list. These may be used as flags to indicate the + * presence or absence of a particular piece of information. The + * default pointer for a zero-sized property may be set to NULL. + * The property \p prp_create and \p prp_close callbacks are called for + * zero-sized properties, but the \p prp_set and \p prp_get callbacks + * are never called. + * + * The \p prp_create routine is called when a new property list with + * this property is being created. The #H5P_prp_create_func_t + * callback function is defined as #H5P_prp_cb1_t. + * + * The \p prp_create routine may modify the value to be set and those + * changes will be stored as the initial value of the property. + * If the \p prp_create routine returns a negative value, the new + * property value is not copied into the property and the + * \p prp_create routine returns an error value. + * + * The \p prp_set routine is called before a new value is copied into + * the property. The #H5P_prp_set_func_t callback function is defined + * as #H5P_prp_cb2_t. + * + * The \p prp_set routine may modify the value pointer to be set and + * those changes will be used when setting the property's value. + * If the \p prp_set routine returns a negative value, the new property + * value is not copied into the property and the \p prp_set routine + * returns an error value. The \p prp_set routine will not be called + * for the initial value; only the \p prp_create routine will be + * called. + * + * \b Note: The \p prp_set callback function may be useful to range + * check the value being set for the property or may perform some + * transformation or translation of the value set. The \p prp_get + * callback would then reverse the transformation or translation. + * A single \p prp_get or \p prp_set callback could handle multiple + * properties by performing different actions based on the property + * name or other properties in the property list. + * + * The \p prp_get routine is called when a value is retrieved from a + * property value. The #H5P_prp_get_func_t callback function is + * defined as #H5P_prp_cb2_t. + * + * The \p prp_get routine may modify the value to be returned from the + * query and those changes will be returned to the calling routine. + * If the \p prp_set routine returns a negative value, the query + * routine returns an error value. + * + * The \p prp_del routine is called when a property is being + * deleted from a property list. The #H5P_prp_delete_func_t + * callback function is defined as #H5P_prp_cb2_t. + * + * The \p prp_del routine may modify the value passed in, but the + * value is not used by the library when the \p prp_del routine + * returns. If the \p prp_del routine returns a negative value, + * the property list deletion routine returns an error value but + * the property is still deleted. + * + * The \p prp_copy routine is called when a new property list with + * this property is being created through a \p prp_copy operation. + * The #H5P_prp_copy_func_t callback function is defined as + * #H5P_prp_cb1_t. + * + * The \p prp_copy routine may modify the value to be set and those + * changes will be stored as the new value of the property. If + * the \p prp_copy routine returns a negative value, the new + * property value is not copied into the property and the \p prp_copy + * routine returns an error value. + * + * The \p prp_close routine is called when a property list with this + * property is being closed. The #H5P_prp_close_func_t callback + * function is defined as #H5P_prp_cb1_t. + * + * The \p prp_close routine may modify the value passed in, but the + * value is not used by the library when the \p prp_close routine + * returns. If the \p prp_close routine returns a negative value, the + * property list close routine returns an error value but the property + * list is still closed. + * + * The #H5P_prp_cb1_t is as follows: + * \snippet this H5P_prp_cb1_t_snip + * + * The #H5P_prp_cb2_t is as follows: + * \snippet this H5P_prp_cb2_t_snip + * + * + * \cpp_c_api_note + * + */ /* Function prototypes */ H5_DLL herr_t H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); +/** + * \ingroup GPLOA + * + * \brief Registers a temporary property with a property list + * + * \plist_id + * \param[in] name Name of property to create + * \param[in] size Size of property in bytes + * \param[in] value Initial value for the property + * \param[in] prp_set Callback routine called before a new value is copied + * into the property's value + * \param[in] prp_get Callback routine called when a property value is + * retrieved from the property + * \param[in] prp_delete Callback routine called when a property is deleted + * from a property list + * \param[in] prp_copy Callback routine called when a property is copied + * from an existing property list + * \param[in] prp_close Callback routine called when a property list is + * being closed and the property value will be disposed + * of + * + * \return \herr_t + * + * \deprecated As of HDF5-1.8 this function was deprecated in favor of + * H5Pinsert2() or the macro H5Pinsert(). + * + * \details H5Pinsert1() creates a new property in a property + * list. The property will exist only in this property list and + * copies made from it. + * + * The initial property value must be provided in \p value and + * the property value will be set accordingly. + * + * The name of the property must not already exist in this list, + * or this routine will fail. + * + * The \p prp_set and \p prp_get callback routines may be set to NULL + * if they are not needed. + * + * Zero-sized properties are allowed and do not store any data + * in the property list. The default value of a zero-size + * property may be set to NULL. They may be used to indicate the + * presence or absence of a particular piece of information. + * + * The \p prp_set routine is called before a new value is copied + * into the property. The #H5P_prp_set_func_t callback function + * is defined as #H5P_prp_cb2_t. + * The \p prp_set routine may modify the value pointer to be set and + * those changes will be used when setting the property's value. + * If the \p prp_set routine returns a negative value, the new property + * value is not copied into the property and the \p set routine + * returns an error value. The \p prp_set routine will be called for + * the initial value. + * + * \b Note: The \p prp_set callback function may be useful to range + * check the value being set for the property or may perform some + * transformation or translation of the value set. The \p prp_get + * callback would then reverse the transformation or translation. + * A single \p prp_get or \p prp_set callback could handle multiple + * properties by performing different actions based on the + * property name or other properties in the property list. + * + * The \p prp_get routine is called when a value is retrieved from + * a property value. The #H5P_prp_get_func_t callback function + * is defined as #H5P_prp_cb2_t. + * + * The \p prp_get routine may modify the value to be returned from + * the query and those changes will be preserved. If the \p prp_get + * routine returns a negative value, the query routine returns + * an error value. + * + * The \p prp_delete routine is called when a property is being + * deleted from a property list. The #H5P_prp_delete_func_t + * callback function is defined as #H5P_prp_cb2_t. + * + * The \p prp_copy routine is called when a new property list with + * this property is being created through a \p prp_copy operation. + * The #H5P_prp_copy_func_t callback function is defined as + * #H5P_prp_cb1_t. + * + * The \p prp_copy routine may modify the value to be set and those + * changes will be stored as the new value of the property. If the + * \p prp_copy routine returns a negative value, the new property value + * is not copied into the property and the prp_copy routine returns an + * error value. + * + * The \p prp_close routine is called when a property list with this + * property is being closed. + * The #H5P_prp_close_func_t callback function is defined as + * #H5P_prp_cb1_t. + * + * The \p prp_close routine may modify the value passed in, the + * value is not used by the library when the close routine + * returns. If the \p prp_close routine returns a negative value, + * the property list \p prp_close routine returns an error value + * but the property list is still closed. + * + * \b Note: There is no \p prp_create callback routine for temporary + * property list objects; the initial value is assumed to + * have any necessary setup already performed on it. + * + * The #H5P_prp_cb1_t is as follows: + * \snippet this H5P_prp_cb1_t_snip + * + * 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, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); +/** + * \ingroup GPLO + * + * \brief Encodes the property values in a property list into a binary + * buffer + * + * \plist_id + * \param[out] buf Buffer into which the property list will be encoded. + * If the provided buffer is NULL, the size of the + * buffer required is returned through \p nalloc; the + * function does nothing more. + * \param[out] nalloc The size of the required buffer + * + * \return \herr_t + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * H5Pencode2() or the macro H5Pencode(). + * + * \details H5Pencode1() encodes the property list \p plist_id into the + * binary buffer \p buf. + * + * If the required buffer size is unknown, \p buf can be passed + * in as NULL and the function will set the required buffer size + * in \p nalloc. The buffer can then be created and the property + * list encoded with a subsequent H5Pencode1() call. + * + * If the buffer passed in is not big enough to hold the encoded + * properties, the H5Pencode1() call can be expected to fail with + * a segmentation fault. + * + * Properties that do not have encode callbacks will be skipped. + * There is currently no mechanism to register an encode callback for + * a user-defined property, so user-defined properties cannot currently + * be encoded. + * + * Some properties cannot be encoded, particularly properties that are + * reliant on local context. + * + * \since 1.10.0 + * + */ H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc); /** - * \ingroup OCPL + * \ingroup DCPL * * \brief Returns information about a filter in a pipeline (DEPRECATED) * - * \todo H5Pget_filter1() prototype does not match source in H5Pocpl.c. - * Also, it is not in a deprecated file. Is that okay? + * * * \plist_id{plist_id} - * \param[in] filter Sequence number within the filter pipeline of the filter - * for which information is sought - * \param[out] flags Bit vector specifying certain general properties of - * the filter + * \param[in] filter Sequence number within the filter pipeline of + * the filter for which information is sought + * \param[out] flags Bit vector specifying certain general properties + * of the filter * \param[in,out] cd_nelmts Number of elements in \p cd_values - * \param[out] cd_values Auxiliary data for the filter - * \param[in] namelen Anticipated number of characters in \p name - * \param[out] name Name of the filter + * \param[out] cd_values Auxiliary data for the filter + * \param[in] namelen Anticipated number of characters in \p name + * \param[out] name Name of the filter * * \return Returns the filter identifier if successful; Otherwise returns * a negative value. See: #H5Z_filter_t * + * \deprecated When was this function deprecated? + * * \details H5Pget_filter1() returns information about a filter, specified * by its filter number, in a filter pipeline, specified by the * property list with which it is associated. @@ -6977,13 +9609,127 @@ H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc); H5_DLL H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned filter, unsigned int *flags /*out*/, size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[]); -H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/, - size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, - char name[] /*out*/); -H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot /*out*/, unsigned *freelist /*out*/, - unsigned *stab /*out*/, unsigned *shhdr /*out*/); -H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold); -H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold); +/** + * \ingroup DCPL + * + * \brief Returns information about the specified filter + * + * \plist_id{plist_id} + * \param[in] id Filter identifier + * \param[out] flags Bit vector specifying certain general properties + * of the filter + * \param[in,out] cd_nelmts Number of elements in \p cd_values + * \param[out] cd_values Auxiliary data for the filter + * \param[in] namelen Anticipated number of characters in \p name + * \param[out] name Name of the filter + * + * + * \return Returns a non-negative value if successful; Otherwise returns + * a negative value. + * + * \deprecated As of HDF5-1.8 this function was deprecated in favor of + * H5Pget_filter_by_id2() or the macro H5Pget_filter_by_id(). + * + * \details H5Pget_filter_by_id1() returns information about a filter, specified + * in \p id, a filter identifier. + * + * \p plist_id must be a dataset or group creation property list and + * \p id must be in the associated filter pipeline. + * + * The \p id and \p flags parameters are used in the same + * manner as described in the discussion of H5Pset_filter(). + * + * Aside from the fact that they are used for output, the parameters + * \p cd_nelmts and \p cd_values[] are used in the same manner as + * described in the discussion of H5Pset_filter(). + * On input, the \p cd_nelmts parameter indicates the number of entries + * in the \p cd_values[] array allocated by the calling program; + * on exit it contains the number of values defined by the filter. + * + * On input, the \p namelen parameter indicates the number of + * characters allocated for the filter name by the calling program + * in the array \p name[]. On exit \p name[] contains the name of the + * filter with one character of the name in each element of the array. + * + * If the filter specified in \p id is not set for the property + * list, an error will be returned and this function will fail. + * + * + * \version 1.8.5 Function extended to work with group creation property + * lists. + * \version 1.8.0 Function H5Pget_filter_by_id() renamed to + * H5Pget_filter_by_id1() and deprecated in this release. + * \version 1.6.0 Function introduced in this release. + */ +H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/, + size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, + char name[] /*out*/); +/** + * \ingroup FCPL + * + * \brief Retrieves the version information of various objects + * for a file creation property list(deprecated) + * + * \plist_id + * \param[out] boot Pointer to location to return super block version number + * \param[out] freelist Pointer to location to return global freelist version number + * \param[out] stab Pointer to location to return symbol table version number + * \param[out] shhdr Pointer to location to return shared object header version + * number + * + * \return \herr_t + * + * \deprecated Deprecated in favor of the function H5Fget_info() + * + * \details H5Pget_version() retrieves the version information of various objects + * for a file creation property list. Any pointer parameters which are + * passed as NULL are not queried. + * + * \version 1.6.4 \p boot, \p freelist, \p stab, \p shhdr parameter types + * changed to unsigned. + * + */ +H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot /*out*/, unsigned *freelist /*out*/, + unsigned *stab /*out*/, unsigned *shhdr /*out*/); +/** + * \ingroup FCPL + * + * \brief Sets the file space handling strategy and the free-space section + * size threshold. + * + * \fcpl_id{plist_id} + * \param[in] strategy The file space handling strategy to be used. See: + * #H5F_fspace_strategy_t + * \param[in] threshold The smallest free-space section size that the free + * space manager will track + * + * \return \herr_t + * + * \deprecated When was this function deprecated? + * + * \details Maps to the function H5Pset_file_space_strategy(). + * + */ +H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold); +/** + * \ingroup FCPL + * + * \brief Retrieves the file space handling strategy, and threshold value for + * a file creation property list + * + * \fcpl_id{plist_id} + * \param[out] strategy Pointer to the file space handling strategy + * \param[out] threshold Pointer to the free-space section size threshold value + * + * \return \herr_t + * + * \deprecated When was this function deprecated? + * + * \details Maps to the function H5Pget_file_space_strategy() + * + * + */ +H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold); #endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 5d356e9..b33960e 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -40,40 +40,54 @@ /* Public Typedefs */ /*******************/ -/* +//! +/** * Reference types allowed. - * DO NOT CHANGE THE ORDER or VALUES as reference type values are encoded into - * the datatype message header. + * + * \internal DO NOT CHANGE THE ORDER or VALUES as reference type values are + * encoded into the datatype message header. */ typedef enum { - H5R_BADTYPE = (-1), /* Invalid reference type */ - H5R_OBJECT1 = 0, /* Backward compatibility (object) */ - H5R_DATASET_REGION1 = 1, /* Backward compatibility (region) */ - H5R_OBJECT2 = 2, /* Object reference */ - H5R_DATASET_REGION2 = 3, /* Region reference */ - H5R_ATTR = 4, /* Attribute Reference */ - H5R_MAXTYPE = 5 /* Highest type (invalid) */ + H5R_BADTYPE = (-1), /**< Invalid reference type */ + H5R_OBJECT1 = 0, /**< Backward compatibility (object) */ + H5R_DATASET_REGION1 = 1, /**< Backward compatibility (region) */ + H5R_OBJECT2 = 2, /**< Object reference */ + H5R_DATASET_REGION2 = 3, /**< Region reference */ + H5R_ATTR = 4, /**< Attribute Reference */ + H5R_MAXTYPE = 5 /**< Highest type (invalid) */ } H5R_type_t; +//! /* Deprecated types are kept for backward compatibility with previous versions */ +//! /** - * Deprecated object reference type that is used with deprecated reference APIs. - * Note! This type can only be used with the "native" HDF5 VOL connector. + * \deprecated Deprecated object reference type that is used with deprecated + * reference APIs. + * + * \note This type can only be used with the "native" HDF5 VOL connector. */ typedef haddr_t hobj_ref_t; +//! +//! /** - * Dataset region reference type that is used with deprecated reference APIs. - * (Buffer to store heap ID and index) - * This needs to be large enough to store largest haddr_t in a worst case + * Buffer to store heap ID and index + * + * This needs to be large enough to store largest #haddr_t in a worst case * machine (8 bytes currently) plus an int. - * Note! This type can only be used with the "native" HDF5 VOL connector. + * + * \deprecated Dataset region reference type that is used with deprecated + * reference APIs. + * + * \note This type can only be used with the "native" HDF5 VOL connector. */ typedef struct { uint8_t __data[H5R_DSET_REG_REF_BUF_SIZE]; } hdset_reg_ref_t; +//! +//! /** * Opaque reference type. The same reference type is used for object, * dataset region and attribute references. This is the type that @@ -81,10 +95,11 @@ typedef struct { */ typedef struct { union { - uint8_t __data[H5R_REF_BUF_SIZE]; /* opaque data */ - int64_t align; /* ensures alignment */ + uint8_t __data[H5R_REF_BUF_SIZE]; /**< opaque data */ + int64_t align; /**< ensures alignment */ } u; } H5R_ref_t; +//! /********************/ /* Public Variables */ @@ -121,8 +136,8 @@ extern "C" { * must be of the same type as the object being referenced, that is * a group, dataset or committed datatype property list. * - * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char - * H5R_ref_t[#H5R_REF_BUF_SIZE]; + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip * * H5Rdestroy() should be used to release the resource from the * reference. @@ -157,14 +172,12 @@ H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5 * must be of the same type as the object being referenced, that is * a dataset property list in this case. * - * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char - * H5R_ref_t[#H5R_REF_BUF_SIZE]; + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip * * H5Rdestroy() should be used to release the resource from the * reference. * - * \see function_name() - * */ H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr); @@ -196,8 +209,8 @@ H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, h * as that object, that is a group, dataset or committed datatype * property list. * - * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char - * H5R_ref_t[#H5R_REF_BUF_SIZE]; + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip * * H5Rdestroy() should be used to release the resource from the * reference. @@ -216,12 +229,12 @@ H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_na * * \return \herr_t * - * \details Given a reference, ref_ptr, to an object, region or attribute - * attached to an object, H5R_DESTROY releases allocated resources + * \details Given a reference, \p ref_ptr, to an object, region or attribute + * attached to an object, H5Rdestroy() releases allocated resources * from a previous create call. * - * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char - * H5R_ref_t[#H5R_REF_BUF_SIZE]; + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip * */ H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr); @@ -236,23 +249,20 @@ H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr); * * \param[in] ref_ptr Pointer to reference * - * \return Returns a valid reference type if successful; otherwise returns #H5R_UNKNOWN. + * \return Returns a valid reference type if successful; otherwise returns #H5R_BADTYPE . * * \details Given a reference, \p ref_ptr, H5Rget_type() returns the * type of the reference. * * Valid returned reference types are: + * \snippet this H5R_type_t_snip * - * #H5R_OBJECT2 Object reference version 2 - * #H5R_DATASET_REGION2 Region reference version 2 - * #H5R_ATTRIBUTE Attribute reference - * - * Note that #H5R_OBJECT1 and #H5R_DATASET REGION1 can never be - * associated to an H5R_ref_t reference and can therefore never be + * Note that #H5R_OBJECT1 and #H5R_DATASET_REGION1 can never be + * associated to an \ref H5R_ref_t reference and can therefore never be * returned through that function. * - * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char - * H5R_ref_t[#H5R_REF_BUF_SIZE]; + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip * */ H5_DLL H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr); @@ -273,8 +283,8 @@ H5_DLL H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr); * \details H5Requal() determines whether two references point to the * same object, region or attribute. * - * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char - * H5R_ref_t[#H5R_REF_BUF_SIZE]; + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip * */ H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr); @@ -320,8 +330,8 @@ H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr); * must be of the same type as the object being referenced, that is * a group or dataset property list. * - * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char - * H5R_ref_t[#H5R_REF_BUF_SIZE]; + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip * * The object opened with this function should be closed when it * is no longer needed so that resource leaks will not develop. Use @@ -333,22 +343,8 @@ H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); /** * -------------------------------------------------------------------------- - * \ingroup H5R - * - * \brief Asynchronous version of H5Ropen_object() - * - * \app_file - * \app_func - * \app_line - * \param[out] ref_ptr Pointer to reference to open - * \rapl_id - * \oapl_id - * \es_id - * - * \return \hid_t{object} - * - * \see H5Ropen_object() - * + * \ingroup ASYNC + * \async_variant_of{H5Ropen} */ H5_DLL hid_t H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_line, H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id); @@ -388,22 +384,8 @@ H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); /** * -------------------------------------------------------------------------- - * \ingroup H5R - * - * \brief Asynchronous version of H5Ropen_region() - * - * \app_file - * \app_func - * \app_line - * \param[in] ref_ptr Pointer to reference to open - * \rapl_id - * \oapl_id - * \es_id - * - * \return \hid_t{dataspace} - * - * \see H5Ropen_region() - * + * \ingroup ASYNC + * \async_variant_of{H5Ropen_region} */ H5_DLL hid_t H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_line, H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id); @@ -440,22 +422,8 @@ H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id); /** * -------------------------------------------------------------------------- - * \ingroup H5R - * - * \brief Asynchronous version of H5Ropen_attr() - * - * \app_file - * \app_func - * \app_line - * \param[in] ref_ptr Pointer to reference to open - * \rapl_id - * \aapl_id - * \es_id - * - * \return \hid_t{attribute} - * - * \see H5Ropen_attr() - * + * \ingroup ASYNC + * \async_variant_of{H5Ropen_attr} */ H5_DLL hid_t H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line, H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id, hid_t es_id); @@ -485,10 +453,7 @@ H5_DLL hid_t H5Ropen_attr_async(const char *app_file, const char *app_func, unsi * Upon success, the function returns in \p obj_type the type of * the object that the reference points to. Valid values for this * referenced object type are as followed (defined in H5Opublic.h): - * - * H5O_TYPE_GROUP Object is a group - * H5O_TYPE_DATASET Object is a dataset - * H5O_TYPE_NAMED_DATATYPE Object is a named datatype + * \snippet H5Opublic.h H5O_type_t_snip * */ H5_DLL herr_t H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type); @@ -540,12 +505,12 @@ H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *name, size_t siz * \details H5Rget_obj_name() retrieves the object name for the object, * region or attribute reference pointed to by \p ref_ptr. * - * The parameter \p rapl id is a reference access property list + * The parameter \p rapl_id is a reference access property list * identifier for the reference. The access property list can * be used to access external files that the reference points to * (through a file access property list). * - * Up to size characters of the name are returned in name; additional + * Up to size characters of the name are returned in \p name; additional * characters, if any, are not returned to the user application. If * the length of the name, which determines the required value of * \p size, is unknown, a preliminary call to H5Rget_obj_name() call @@ -553,8 +518,8 @@ H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *name, size_t siz * object name. That value can then be passed in for \p size in the * second call to H5Rget_obj_name(), which will retrieve the actual * name. If there is no name associated with the object identifier - * or if the name is #NULL, H5Rget_obj_name() returns the size of - * the name buffer (the size does not include the #NULL terminator). + * or if the name is NULL, H5Rget_obj_name() returns the size of + * the name buffer (the size does not include the \c \0 terminator). * * If \p ref_ptr is an object reference, \p name will be returned with * a name for the referenced object. If \p ref_ptr is a dataset region @@ -624,15 +589,334 @@ H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t siz /* Function prototypes */ #ifndef H5_NO_DEPRECATED_SYMBOLS +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the type of object that an object reference points to + * + * \param[in] id The dataset containing the reference object or the group + * containing that dataset + * \param[in] ref_type Type of reference to query + * \param[in] ref Reference to query + * + * \return Returns a valid object type if successful; otherwise returns a + * negative value (#H5G_UNKNOWN). + * + * \deprecated This function has been renamed from H5Rget_obj_type() and is + * deprecated in favor of the macro H5Rget_obj_type() or the + * function H5Rget_obj_type2(). + * + * \details Given an object reference, \p ref, H5Rget_obj_type1() returns the + * type of the referenced object. + * + * A \Emph{reference type} is the type of reference, either an object + * reference or a dataset region reference. An \Emph{object reference} + * points to an HDF5 object while a \Emph{dataset region reference} + * points to a defined region within a dataset. + * + * The \Emph{referenced object} is the object the reference points + * to. The \Emph{referenced object type}, or the type of the referenced + * object, is the type of the object that the reference points to. + * + * The location identifier, \p id, is the identifier for either the + * dataset containing the object reference or the group containing that + * dataset. + * + * Valid reference types, to pass in as \p ref_type, include the + * following: + * \snippet this H5R_type_t_snip + * + * If the application does not already know the object reference type, + * that can be determined with three preliminary calls: + * + * \li Call H5Dget_type() on the dataset containing the reference to + * get a datatype identifier for the dataset’s datatype. + * \li Using that datatype identifier, H5Tget_class() returns a datatype + * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can + * then be used to determine whether the reference’s datatype is + * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG: + * - If the datatype is #H5T_STD_REF_OBJ, the reference object type + * is #H5R_OBJECT. + * - If the datatype is #H5T_STD_REF_DSETREG, the reference object + * type is #H5R_DATASET_REGION. + * + * When the function completes successfully, it returns one of the + * following valid object type values (defined in H5Gpublic.h): + * \snippet H5Gpublic.h H5G_obj_t_snip + * + * \version 1.8.0 Function H5Rget_obj_type() renamed to H5Rget_obj_type1() and + * deprecated in this release. + * \since 1.6.0 + * + */ H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref); -H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Opens the HDF5 object referenced + * + * \obj_id + * \param[in] ref_type The reference type of \p ref + * \param[in] ref Reference to open + * + * \return Returns identifier of referenced object if successful; otherwise + * returns a negative value. + * + * \deprecated This function has been renamed from H5Rdereference() and is + * deprecated in favor of the macro H5Rdereference() or the function + * H5Rdereference2(). + * + * \details Given a reference, \p ref, to an object or a region in an object, + * H5Rdereference1() opens that object and returns an identifier. + * + * The parameter \p obj_id must be a valid identifier for an object in + * the HDF5 file containing the referenced object, including the file + * identifier. + * + * The parameter \p ref_type specifies the reference type of the + * reference \p ref. \p ref_type may contain either of the following + * values: + * - #H5R_OBJECT + * - #H5R_DATASET_REGION + * + * The object opened with this function should be closed when it is no + * longer needed so that resource leaks will not develop. Use the + * appropriate close function such as H5Oclose() or H5Dclose() for + * datasets. + * + * \version 1.10.0 Function H5Rdereference() renamed to H5Rdereference1() and + * deprecated in this release. + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id); -H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type); -H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref); -H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref); +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Creates a reference + * + * \param[out] ref Reference created by the function call + * \param[in] loc_id Location identifier used to locate the object being pointed to + * \param[in] name Name of object at location \p loc_id + * \param[in] ref_type Type of reference + * \param[in] space_id Dataspace identifier with selection. Used only for + * dataset region references; pass as -1 if reference is + * an object reference, i.e., of type #H5R_OBJECT + * + * \return \herr_t + * + * \details H5Rcreate() creates the reference, \p ref, of the type specified in + * \p ref_type, pointing to the object \p name located at \p loc_id. + * + * The HDF5 library maps the void type specified above for \p ref to + * the type specified in \p ref_type, which will be one of the following: + * \snippet this H5R_type_t_snip + * + * The parameters \p loc_id and \p name are used to locate the object. + * + * The parameter \p space_id identifies the dataset region that a + * dataset region reference points to. This parameter is used only with + * dataset region references and should be set to -1 if the reference + * is an object reference, #H5R_OBJECT. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the type of object that an object reference points to + * + * \param[in] id The dataset containing the reference object or the group + * containing that dataset + * \param[in] ref_type Type of reference to query + * \param[in] ref Reference to query + * \param[out] obj_type Type of referenced object + * + * \return \herr_t + * + * \details Given an object reference, \p ref, H5Rget_obj_type2() returns the + * type of the referenced object in \p obj_type. + * + * A \Emph{reference type} is the type of reference, either an object + * reference or a dataset region reference. An \Emph{object reference} + * points to an HDF5 object while a \Emph{dataset region reference} + * points to a defined region within a dataset. + * + * The \Emph{referenced object} is the object the reference points + * to. The \Emph{referenced object type}, or the type of the referenced + * object, is the type of the object that the reference points to. + * + * The location identifier, \p id, is the identifier for either the + * dataset containing the object reference or the group containing that + * dataset. + * + * Valid reference types, to pass in as \p ref_type, include the + * following: + * \snippet this H5R_type_t_snip + * + * If the application does not already know the object reference type, + * that can be determined with three preliminary calls: + * + * \li Call H5Dget_type() on the dataset containing the reference to + * get a datatype identifier for the dataset’s datatype. + * \li Using that datatype identifier, H5Tget_class() returns a datatype + * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can + * then be used to determine whether the reference’s datatype is + * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG: + * - If the datatype is #H5T_STD_REF_OBJ, the reference object type + * is #H5R_OBJECT. + * - If the datatype is #H5T_STD_REF_DSETREG, the reference object + * type is #H5R_DATASET_REGION. + * + * When the function completes successfully, it returns one of the + * following valid object type values (defined in H5Opublic.h): + * \snippet H5Opublic.h H5O_type_t_snip + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Opens the HDF5 object referenced + * + * \obj_id + * \oapl_id + * \param[in] ref_type The reference type of \p ref + * \param[in] ref Reference to open + * + * \return Returns identifier of referenced object if successful; otherwise + * returns a negative value. + * + * \details Given a reference, \p ref, to an object or a region in an object, + * H5Rdereference2() opens that object and returns an identifier. + * + * The parameter \p obj_id must be a valid identifier for the HDF5 file + * containing the referenced object or for any object in that HDF5 + * file. + * + * The parameter \p oapl_id is an object access property list + * identifier for the referenced object. The access property list must + * be of the same type as the object being referenced, that is a group, + * dataset, or datatype property list. + * + * The parameter \p ref_type specifies the reference type of the + * reference \p ref. \p ref_type may contain either of the following + * values: + * - #H5R_OBJECT + * - #H5R_DATASET_REGION + * + * The object opened with this function should be closed when it is no + * longer needed so that resource leaks will not develop. Use the + * appropriate close function such as H5Oclose() or H5Dclose() for + * datasets. + * + * \since 1.10.0 + * + */ +H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Sets up a dataspace and selection as specified by a region reference + * + * \param[in] dataset File identifier or identifier for any object in the file + * containing the referenced region + * \param[in] ref_type Reference type of \p ref, which must be #H5R_DATASET_REGION + * \param[in] ref Region reference to open + * + * \return Returns a valid dataspace identifier if successful; otherwise returns + * a negative value. + * + * \details H5Rget_region() creates a copy of the dataspace of the dataset + * pointed to by a region reference, \p ref, and defines a selection + * matching the selection pointed to by ref within the dataspace copy. + * + * \p dataset is used to identify the file containing the referenced + * region; it can be a file identifier or an identifier for any object + * in the file. + * + * The parameter \p ref_type specifies the reference type of \p ref and + * must contain the value #H5R_DATASET_REGION. + * + * Use H5Sclose() to release the dataspace identifier returned by this + * function when the identifier is no longer needed. + * + */ +H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves a name for a referenced object + * + * \param[in] loc_id Identifier for the file containing the reference or for + * any object in that file + * \param[in] ref_type Type of reference + * \param[in] ref An object or dataset region reference + * \param[out] name A buffer to place the name of the referenced object or + * dataset region. If \c NULL, then this call will return the + * size in bytes of the name. + * \param[in] size The size of the \p name buffer. When the size is passed in, + * the \c NULL terminator needs to be included. + * + * \return Returns the length of the name if successful, returning 0 (zero) if + * no name is associated with the identifier. Otherwise returns a + * negative value. + * + * \details H5Rget_name() retrieves a name for the object identified by \p ref.\n + * \p loc_id is used to identify the file containing the reference. It + * can be the file identifier for the file containing the reference or + * an identifier for any object in that file. + * + * \ref H5R_type_t is the reference type of \p ref. Valid values + * include the following: + * \snippet this H5R_type_t_snip + * + * \p ref is the reference for which the target object’s name is + * sought. + * + * If \p ref is an object reference, \p name will be returned with a + * name for the referenced object. If \p ref is a dataset region + * reference, \p name will contain a name for the object containing the + * referenced region. + * + * Up to \p size characters of the name are returned in \p name; + * additional characters, if any, are not returned to the user + * application. + * + * If the length of the name, which determines the required value of \p + * size, is unknown, a preliminary H5Rget_name() call can be made. The + * return value of this call will be the size of the object name. That + * value can then be assigned to \p size for a second H5Rget_name() + * call, which will retrieve the actual name. + * + * If there is no name associated with the object identifier or if the + * \p name is \c NULL, H5Rget_name() returns the size of the \p name + * buffer (the size does not include the \p NULL terminator). + * + * Note that an object in an HDF5 file may have multiple paths if there + * are multiple links pointing to it. This function may return any one + * of these paths. + * + * \since 1.8.0 + */ H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, char *name, size_t size); #ifdef __cplusplus diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 5037e0a..fd85dcc 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -364,10 +364,8 @@ H5_DLL hid_t H5Sdecode(const void *buf); * * \note Motivation: This function was introduced in HDF5-1.12 as part of the * H5Sencode() format change to enable 64-bit selection encodings and - * a dataspace selection that is tied to a file. See the New Features - * in HDF5 Release 1.12 as well as the H5Sencode() / H5Sdecode() Format Change RFC. - * - * \todo Fix the references. + * a dataspace selection that is tied to a file. See the \ref_news_112 + * as well as the \ref_sencode_fmt_change. * * \since 1.12.0 * @@ -1069,7 +1067,7 @@ H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); * buffer as: * \n 0 0 0 0 13 5 11 17 7 21 29 21 * - * \version 1.6.4 C coord parameter type changed to \p const #hsize_t. + * \version 1.6.4 C coord parameter type changed to \p const hsize_t. * \version 1.6.4 Fortran \p coord parameter type changed to \p INTEGER(HSIZE_T). * \since 1.0.0 * diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h index 4f9edde..c489edc 100644 --- a/src/H5Tmodule.h +++ b/src/H5Tmodule.h @@ -44,12 +44,8 @@ * \ingroup H5T * \defgroup ENUM Enumeration Datatypes * \ingroup H5T - * \defgroup GTO General Datatype Operations - * \ingroup H5T * \defgroup OPAQUE Opaque Datatypes * \ingroup H5T - * \defgroup STRING String Datatypes - * \ingroup H5T * \defgroup VLEN Variable-length Sequence Datatypes * \ingroup H5T * diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 1457053..5301ea2 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -28,7 +28,7 @@ * internal If this goes over 16 types (0-15), the file format will need to * change. */ -//! [H5T_class_t_snip] +//! typedef enum H5T_class_t { H5T_NO_CLASS = -1, /**< error */ H5T_INTEGER = 0, /**< integer types */ @@ -45,12 +45,12 @@ typedef enum H5T_class_t { H5T_NCLASSES /**< sentinel: this must be last */ } H5T_class_t; -//! [H5T_class_t_snip] +//! /** * Byte orders */ -//! [H5T_order_t_snip] +//! typedef enum H5T_order_t { H5T_ORDER_ERROR = -1, /**< error */ H5T_ORDER_LE = 0, /**< little endian */ @@ -60,12 +60,12 @@ typedef enum H5T_order_t { H5T_ORDER_NONE = 4 /**< no particular order (strings, bits,..) */ /*H5T_ORDER_NONE must be last */ } H5T_order_t; -//! [H5T_order_t_snip] +//! /** * Types of integer sign schemes */ -//! [H5T_sign_t_snip] +//! typedef enum H5T_sign_t { H5T_SGN_ERROR = -1, /**< error */ H5T_SGN_NONE = 0, /**< this is an unsigned type */ @@ -73,12 +73,12 @@ typedef enum H5T_sign_t { H5T_NSGN = 2 /** sentinel: this must be last! */ } H5T_sign_t; -//! [H5T_sign_t_snip] +//! /** * Floating-point normalization schemes */ -//! [H5T_norm_t_snip] +//! typedef enum H5T_norm_t { H5T_NORM_ERROR = -1, /**< error */ H5T_NORM_IMPLIED = 0, /**< msb of mantissa isn't stored, always 1 */ @@ -86,7 +86,7 @@ typedef enum H5T_norm_t { H5T_NORM_NONE = 2 /**< not normalized */ /*H5T_NORM_NONE must be last */ } H5T_norm_t; -//! [H5T_norm_t_snip] +//! /** * Character set to use for text strings. @@ -141,7 +141,7 @@ typedef enum H5T_str_t { /** * Type of padding to use in other atomic types */ -//! [H5T_pad_t_snip] +//! typedef enum H5T_pad_t { H5T_PAD_ERROR = -1, /**< error */ H5T_PAD_ZERO = 0, /**< always set to zero */ @@ -150,7 +150,7 @@ typedef enum H5T_pad_t { H5T_NPAD = 3 /**< sentinal: THIS MUST BE LAST */ } H5T_pad_t; -//! [H5T_pad_t_snip] +//! /** * Commands sent to conversion functions @@ -173,14 +173,14 @@ typedef enum H5T_bkg_t { /** * Type conversion client data */ -//! [H5T_cdata_t_snip] +//! typedef struct H5T_cdata_t { H5T_cmd_t command; /**< what should the conversion function do? */ H5T_bkg_t need_bkg; /**< is the background buffer needed? */ hbool_t recalc; /**< recalculate private data */ void * priv; /**< private data */ } H5T_cdata_t; -//! [H5T_cdata_t_snip] +//! /** * Conversion function persistence @@ -194,25 +194,32 @@ typedef enum H5T_pers_t { /** * The order to retrieve atomic native datatype */ -//! [H5T_direction_t_snip] +//! typedef enum H5T_direction_t { H5T_DIR_DEFAULT = 0, /**< default direction is inscendent */ H5T_DIR_ASCEND = 1, /**< in inscendent order */ H5T_DIR_DESCEND = 2 /**< in descendent order */ } H5T_direction_t; -//! [H5T_direction_t_snip] +//! /** * The exception type passed into the conversion callback function */ typedef enum H5T_conv_except_t { - H5T_CONV_EXCEPT_RANGE_HI = 0, /**< source value is greater than destination's range */ - H5T_CONV_EXCEPT_RANGE_LOW = 1, /**< source value is less than destination's range */ - H5T_CONV_EXCEPT_PRECISION = 2, /**< source value loses precision in destination */ - H5T_CONV_EXCEPT_TRUNCATE = 3, /**< source value is truncated in destination */ - H5T_CONV_EXCEPT_PINF = 4, /**< source value is positive infinity(floating number) */ - H5T_CONV_EXCEPT_NINF = 5, /**< source value is negative infinity(floating number) */ - H5T_CONV_EXCEPT_NAN = 6 /**< source value is NaN(floating number) */ + H5T_CONV_EXCEPT_RANGE_HI = 0, + /**< Source value is greater than destination's range */ + H5T_CONV_EXCEPT_RANGE_LOW = 1, + /**< Source value is less than destination's range */ + H5T_CONV_EXCEPT_PRECISION = 2, + /**< Source value loses precision in destination */ + H5T_CONV_EXCEPT_TRUNCATE = 3, + /**< Source value is truncated in destination */ + H5T_CONV_EXCEPT_PINF = 4, + /**< Source value is positive infinity */ + H5T_CONV_EXCEPT_NINF = 5, + /**< Source value is negative infinity */ + H5T_CONV_EXCEPT_NAN = 6 + /**< Source value is \c NaN (not a number, including \c QNaN and \c SNaN) */ } H5T_conv_except_t; /** @@ -254,17 +261,31 @@ extern "C" { /** * All datatype conversion functions are... */ -//! [H5T_conv_t_snip] +//! typedef herr_t (*H5T_conv_t)(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); -//! [H5T_conv_t_snip] +//! +//! /** - * Exception handler. If an exception like overflow happenes during conversion, - * this function is called if it's registered through H5Pset_type_conv_cb(). + * \brief Exception handler. + * + * \param[in] except_type The kind of exception that occurred + * \param[in] src_id Source datatype identifier + * \param[in] dst_id Destination datatype identifier + * \param[in] src_buf Source data buffer + * \param[in,out] dst_buf Destination data buffer + * \param[in,out] user_data Callback context + * \returns Valid callback function return values are #H5T_CONV_ABORT, + * #H5T_CONV_UNHANDLED and #H5T_CONV_HANDLED. + * + * \details If an exception like overflow happenes during conversion, this + * function is called if it's registered through H5Pset_type_conv_cb(). + * */ typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(H5T_conv_except_t except_type, hid_t src_id, hid_t dst_id, void *src_buf, void *dst_buf, void *user_data); +//! /* When this header is included from a private header, don't make calls to H5open() */ #undef H5OPEN @@ -1061,7 +1082,7 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST64_g; * predefined datatype. * * When creating a variable-length string datatype, \p size must - * be #H5T_VARIABLE. + * be #H5T_VARIABLE; see \ref_vlen_strings. * * When creating a fixed-length string datatype, \p size will * be the length of the string in bytes. The length of the @@ -1075,13 +1096,9 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST64_g; * The datatype identifier returned from this function should be * released with H5Tclose or resource leaks will result. * - * \since 1.2.0 - * * \see H5Tclose() * - * \todo Original has a reference to “Creating variable-length string - * datatypes”. - * \todo Create an example for H5Tcreate. + * \since 1.2.0 * */ H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size); @@ -1106,8 +1123,6 @@ H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size); * The returned datatype identifier should be released with H5Tclose() * to prevent resource leak. * - * \todo Create an example for H5Tcopy(). - * */ H5_DLL hid_t H5Tcopy(hid_t type_id); /** @@ -1130,8 +1145,6 @@ H5_DLL herr_t H5Tclose(hid_t type_id); * * \brief Asynchronous version of H5Tclose(). * - * \todo Create an example for H5Tclose_async(). - * */ H5_DLL herr_t H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t type_id, hid_t es_id); @@ -1222,8 +1235,6 @@ H5_DLL herr_t H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lc * * \brief Asynchronous version of H5Tcommit2(). * - * \todo Create an example for H5Tcommit_async(). - * */ H5_DLL herr_t H5Tcommit_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, @@ -1257,8 +1268,6 @@ H5_DLL hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id); * * \brief Asynchronous version of H5Topen2(). * - * \todo Create an example for H5Topen_async(). - * */ H5_DLL hid_t H5Topen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t tapl_id, hid_t es_id); @@ -1503,8 +1512,6 @@ H5_DLL herr_t H5Trefresh(hid_t type_id); * * \since 1.2.0 * - * \todo Create example for H5Tinsert - * */ H5_DLL herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id); /** @@ -1663,10 +1670,7 @@ H5_DLL herr_t H5Tenum_valueof(hid_t type, const char *name, void *value /*out*/) * character base type creates a variable-length sequence of strings * (a variable-length, 1-dimensional array), with each element of * the array being of the string or character base type.\n - * To create a variable-length string datatype, see "Creating - * variable-length string datatypes." - * - * \todo Fix the reference. + * To create a variable-length string datatype, see \ref_vlen_strings. * */ H5_DLL hid_t H5Tvlen_create(hid_t base_id); @@ -1870,13 +1874,9 @@ H5_DLL htri_t H5Tdetect_class(hid_t type_id, H5T_class_t cls); * actual data and a size value. This function does not return the * size of actual variable-length sequence data. * - * \since 1.2.0 - * * \see H5Tset_size() * - * \todo Original has a reference to “Creating variable-length string datatypes”. - * \todo Create an example for H5Tget_size(). - * + * \since 1.2.0 */ H5_DLL size_t H5Tget_size(hid_t type_id); /** @@ -2090,7 +2090,7 @@ H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id); */ H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id); /** - * \ingroup COMPOUND + * \ingroup COMPOUND ENUM * * \brief Retrieves the number of elements in a compound or enumeration datatype * @@ -2107,7 +2107,7 @@ H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id); */ H5_DLL int H5Tget_nmembers(hid_t type_id); /** - * \ingroup COMPOUND + * \ingroup COMPOUND ENUM * * \brief Retrieves the name of a compound or enumeration datatype member * @@ -2134,7 +2134,7 @@ H5_DLL int H5Tget_nmembers(hid_t type_id); */ H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno); /** - * \ingroup COMPOUND + * \ingroup COMPOUND ENUM * * \brief Retrieves the index of a compound or enumeration datatype member * @@ -2406,6 +2406,7 @@ H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction); * * \li Variable-length string datatypes: If \p dtype_id is a * variable-length string, size must normally be set to #H5T_VARIABLE. + * See \ref_vlen_strings. * * \li Compound datatypes: This function may be used to increase or * decrease the size of a compound datatype, but the function will @@ -2416,12 +2417,9 @@ H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction); * variable-length array datatypes (#H5T_VLEN), or reference datatypes * (#H5T_REFERENCE). * - * \since 1.2.0 - * * \see H5Tget_size() * - *\todo Create an example for H5Tset_size(). - *\todo Original has a reference to “Creating variable-length string datatypes”. + * \since 1.2.0 * */ H5_DLL herr_t H5Tset_size(hid_t type_id, size_t size); @@ -2873,7 +2871,7 @@ H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id); * enough to hold the larger of the input and output data. * * \version 1.6.3 \p nelmts parameter type changed to size_t. - * \version 1.4.0 \p nelmts parameter type changed to \ref hsize_t. + * \version 1.4.0 \p nelmts parameter type changed to hsize_t. * */ H5_DLL herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *background, diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index ac40e70..2a8ef6e 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -458,7 +458,7 @@ typedef struct H5VL_token_class_t { * \ingroup H5VLDEV * Class information for each VOL connector */ -//! [H5VL_class_t_snip] +//! typedef struct H5VL_class_t { /* Overall connector fields & callbacks */ unsigned version; /**< VOL connector class struct version # */ @@ -492,7 +492,7 @@ typedef struct H5VL_class_t { herr_t (*optional)(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments); /**< Optional callback */ } H5VL_class_t; -//! [H5VL_class_t_snip] +//! /********************/ /* Public Variables */ @@ -529,15 +529,14 @@ extern "C" { * uncommon, as most VOL-specific properties are added to the file * access property list via the connector's API calls which set the * VOL connector for the file open/create. For more information, see - * the VOL documentation. + * the \ref_vol_doc. * * H5VL_class_t is defined in H5VLconnector.h in the source code. It * contains class information for each VOL connector: * \snippet this H5VL_class_t_snip * - * \todo Fix the reference to VOL documentation. - * * \since 1.12.0 + * */ H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); /** diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h index 78c5986..009c0e5 100644 --- a/src/H5VLmodule.h +++ b/src/H5VLmodule.h @@ -32,6 +32,10 @@ * \brief Virtual Object Layer Interface * \todo Describe concisely what the functions in this module are about. * + * \defgroup ASYNC Asynchronous Functions + * \brief Asynchronous Functions + * \todo Describe concisely what the functions in this module are about. + * * \defgroup H5VLDEF Definitions * \ingroup H5VL * \defgroup H5VLDEV VOL Developer diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index ce50653..c5f85dc 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -93,9 +93,9 @@ * connectors. Subsequent values should be obtained from the HDF5 * development team at mailto:help@hdfgroup.org. */ -//! [H5VL_class_value_t_snip] +//! typedef int H5VL_class_value_t; -//! [H5VL_class_value_t_snip] +//! /** * \ingroup H5VLDEF @@ -153,11 +153,10 @@ extern "C" { * uncommon, as most VOL-specific properties are added to the file * access property list via the connector's API calls which set the * VOL connector for the file open/create. For more information, see - * the VOL documentation. - * - * \todo Fix the reference to VOL documentation. + * \ref_vol_doc. * * \since 1.12.0 + * */ H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id); /** @@ -192,11 +191,10 @@ H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vi * uncommon, as most VOL-specific properties are added to the file * access property list via the connector's API calls which set the * VOL connector for the file open/create. For more information, see - * the VOL documentation. - * - * \todo Fix the reference to VOL documentation. + * the \ref_vol_doc. * * \since 1.12.0 + * */ H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id); /** diff --git a/src/H5Zmodule.h b/src/H5Zmodule.h index 25007b3..76a2380 100644 --- a/src/H5Zmodule.h +++ b/src/H5Zmodule.h @@ -77,11 +77,9 @@ * Custom filters that have been registered with the library will have * additional unique identifiers. * - * See \Emph{HDF5 Dynamically Loaded Filters} for more information on - * how an HDF5 application can apply a filter that is not registered - * with the HDF5 library. - * - * \todo Fix the reference. + * 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/H5Zpublic.h b/src/H5Zpublic.h index 4c9b006..90277cf 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -230,16 +230,18 @@ typedef enum H5Z_EDC_t { * Return values for filter callback function */ typedef enum H5Z_cb_return_t { - H5Z_CB_ERROR = -1, - H5Z_CB_FAIL = 0, /**< I/O should fail if filter fails. */ - H5Z_CB_CONT = 1, /**< I/O continues if filter fails. */ - H5Z_CB_NO = 2 + H5Z_CB_ERROR = -1, /**< error value */ + H5Z_CB_FAIL = 0, /**< I/O should fail if filter fails. */ + H5Z_CB_CONT = 1, /**< I/O continues if filter fails. */ + H5Z_CB_NO = 2 /**< sentinel */ } H5Z_cb_return_t; +//! /** * Filter callback function definition */ typedef H5Z_cb_return_t (*H5Z_filter_func_t)(H5Z_filter_t filter, void *buf, size_t buf_size, void *op_data); +//! /** * Structure for filter callback property @@ -254,58 +256,93 @@ extern "C" { #endif /** - * \details Before a dataset gets created, the \c can_apply callbacks for any - * filters used in the dataset creation property list are called with - * the dataset's dataset creation property list, the dataset's - * datatype and a dataspace describing a chunk (for chunked dataset - * storage). + * \brief This callback determines if a filter can be applied to the dataset + * with the characteristics provided * - * The \c can_apply callback must determine if the combination of the - * dataset creation property list setting, the datatype and the - * dataspace represent a valid combination to apply this filter to. - * For example, some cases of invalid combinations may involve the - * filter not operating correctly on certain datatypes (or certain - * datatype sizes), or certain sizes of the chunk dataspace. + * \dcpl_id + * \type_id + * \space_id * - * The \c can_apply callback can be the NULL pointer, in which case, - * the library will assume that it can apply to any combination of - * dataset creation property list values, datatypes and dataspaces. + * \return \htri_t * - * The \c can_apply callback returns positive a valid combination, - * zero for an invalid combination and negative for an error. - */ -//! [H5Z_can_apply_func_t_snip] + * \details Before a dataset gets created, the \ref H5Z_can_apply_func_t + * callbacks for any filters used in the dataset creation property list + * are called with the dataset's dataset creation property list, the + * dataset's datatype and a dataspace describing a chunk (for chunked + * dataset storage). + * + * The \ref H5Z_can_apply_func_t callback must determine if the + * combination of the dataset creation property list setting, the + * datatype and the dataspace represent a valid combination to apply + * this filter to. For example, some cases of invalid combinations may + * involve the filter not operating correctly on certain datatypes (or + * certain datatype sizes), or certain sizes of the chunk dataspace. + * + * The \ref H5Z_can_apply_func_t callback can be the NULL pointer, in + * which case, the library will assume that it can apply to any + * combination of dataset creation property list values, datatypes and + * dataspaces. + * + * The \ref H5Z_can_apply_func_t callback returns positive a valid + * combination, zero for an invalid combination and negative for an + * error. + */ +//! typedef htri_t (*H5Z_can_apply_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id); -//! [H5Z_can_apply_func_t_snip] -/** - * \details After the "can_apply" callbacks are checked for new datasets, the - * \c set_local callbacks for any filters used in the dataset creation - * property list are called. These callbacks receive the dataset's - * private copy of the dataset creation property list passed in to - * H5Dcreate() (i.e. not the actual property list passed in to - * H5Dcreate()) and the datatype ID passed in to H5Dcreate() (which is - * not copied and should not be modified) and a dataspace describing - * the chunk (for chunked dataset storage) (which should also not be - * modified). - * - * The \c set_local callback must set any parameters that are specific - * to this dataset, based on the combination of the dataset creation - * property list values, the datatype and the dataspace. For example, - * some filters perform different actions based on different datatypes - * (or datatype sizes) or different number of dimensions or dataspace - * sizes. +//! +/** + * \brief The filter operation callback function, defining a filter's operation + * on data * - * The \c set_local callback can be the NULL pointer, in which case, - * the library will assume that there are no dataset-specific settings - * for this filter. + * \dcpl_id + * \type_id + * \space_id * - * The \c set_local callback must return non-negative on success and - * negative for an error. - */ -//! [H5Z_set_local_func_t_snip] + * \return \herr_t + * + * \details After the \ref H5Z_can_apply_func_t callbacks are checked for new + * datasets, the \ref H5Z_set_local_func_t callbacks for any filters + * used in the dataset creation property list are called. These + * callbacks receive the dataset's private copy of the dataset creation + * property list passed in to H5Dcreate() (i.e. not the actual property + * list passed in to H5Dcreate()) and the datatype ID passed in to + * H5Dcreate() (which is not copied and should not be modified) and a + * dataspace describing the chunk (for chunked dataset storage) (which + * should also not be modified). + * + * The \ref H5Z_set_local_func_t callback must set any parameters that + * are specific to this dataset, based on the combination of the + * dataset creation property list values, the datatype and the + * dataspace. For example, some filters perform different actions based + * on different datatypes (or datatype sizes) or different number of + * dimensions or dataspace sizes. + * + * The \ref H5Z_set_local_func_t callback can be the NULL pointer, in + * which case, the library will assume that there are no + * dataset-specific settings for this filter. + * + * The \ref H5Z_set_local_func_t callback must return non-negative on + * success and negative for an error. + */ +//! typedef herr_t (*H5Z_set_local_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id); -//! [H5Z_set_local_func_t_snip] +//! + /** + * \brief The filter operation callback function, defining a filter's operation + * on data + * + * \param[in] flags Bit vector specifying certain general properties of the filter + * \param[in] cd_nelmts Number of elements in \p cd_values + * \param[in] cd_values Auxiliary data for the filter + * \param[in] nbytes The number of valid bytes in \p buf to be filtered + * \param[in,out] buf_size The size of \p buf + * \param[in,out] buf The filter buffer + * + * \return Returns the number of valid bytes of data contained in \p buf. In the + * case of failure, the return value is 0 (zero) and all pointer + * arguments are left unchanged. + * * \details A filter gets definition flags and invocation flags (defined * above), the client data array and size defined when the filter was * added to the pipeline, the size in bytes of the data on which to @@ -321,15 +358,15 @@ typedef herr_t (*H5Z_set_local_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space * output buffer. If an error occurs then the function should return * zero and leave all pointer arguments unchanged. */ -//! [H5Z_func_t_snip] +//! typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t *buf_size, void **buf); -//! [H5Z_func_t_snip] +//! /** * The filter table maps filter identification numbers to structs that * contain a pointers to the filter function and timing statistics. */ -//! [H5Z_class2_t_snip] +//! typedef struct H5Z_class2_t { int version; /**< Version number of the H5Z_class_t struct */ H5Z_filter_t id; /**< Filter ID number */ @@ -340,7 +377,7 @@ typedef struct H5Z_class2_t { H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */ H5Z_func_t filter; /**< The actual filter function */ } H5Z_class2_t; -//! [H5Z_class2_t_snip] +//! /** * \ingroup H5Z @@ -635,7 +672,7 @@ H5_DLL herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_confi * The filter table maps filter identification numbers to structs that * contain a pointers to the filter function and timing statistics. */ -//! [H5Z_class1_t_snip] +//! typedef struct H5Z_class1_t { H5Z_filter_t id; /**< Filter ID number */ const char * name; /**< Comment for debugging */ @@ -643,7 +680,7 @@ typedef struct H5Z_class1_t { H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */ H5Z_func_t filter; /**< The actual filter function */ } H5Z_class1_t; -//! [H5Z_class1_t_snip] +//! #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5public.h b/src/H5public.h index b319550..751abbe 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -95,50 +95,130 @@ extern "C" { #define H5_NO_EXPAND(x) (x) /* Version numbers */ -#define H5_VERS_MAJOR 1 /* For major interface/format changes */ -#define H5_VERS_MINOR 13 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 0 /* For tweaks, bug-fixes, or development */ -#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ -/* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.13.0" /* Full version string */ +/** + * For major interface/format changes + */ +#define H5_VERS_MAJOR 1 +/** + * For minor interface/format changes + */ +#define H5_VERS_MINOR 13 +/** + * For tweaks, bug-fixes, or development + */ +#define H5_VERS_RELEASE 0 +/** + * For pre-releases like \c snap0. Empty string for official releases. + */ +#define H5_VERS_SUBRELEASE "" +/** + * Full version string + */ +#define H5_VERS_INFO "HDF5 library version: 1.13.0" #define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE) /* macros for comparing the version */ +/** + * \brief Determines whether the version of the library being used is greater + * than or equal to the specified version + * + * \param[in] Maj Major version number - A non-negative integer value + * \param[in] Min Minor version number - A non-negative integer value + * \param[in] Rel Release version number - A non-negative integer value + * \returns A value of 1 is returned if the library version is greater than + * or equal to the version number specified.\n + * A value of 0 is returned if the library version is less than the + * version number specified.\n + * A library version is greater than the specified version number if + * its major version is larger than the specified major version + * number. If the major version numbers are the same, it is greater + * than the specified version number if its minor version is larger + * than the specified minor version number. If the minor version + * numbers are the same, then a library version would be greater than + * the specified version number if its release number is larger than + * the specified release number. + * + * \details The #H5_VERSION_GE and #H5_VERSION_LE macros are used at compile + * time to conditionally include or exclude code based on the version + * of the HDF5 library against which an application will be linked. + * + * The #H5_VERSION_GE macro compares the version of the HDF5 library + * being used against the version number specified in the parameters. + * + * For more information about release versioning, see \ref_h5lib_relver. + * + * \since 1.8.7 + * + */ #define H5_VERSION_GE(Maj, Min, Rel) \ (((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE >= Rel)) || \ ((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR > Min)) || (H5_VERS_MAJOR > Maj)) +/** + * \brief Determines whether the version of the library being used is less + * than or equal to the specified version + * + * \param[in] Maj Major version number - A non-negative integer value + * \param[in] Min Minor version number - A non-negative integer value + * \param[in] Rel Release version number - A non-negative integer value + * \returns A value of 1 is returned if the library version is less than + * or equal to the version number specified.\n + * A value of 0 is returned if the library version is greater than the + * version number specified.\n + * A library version is less than the specified version number if + * its major version is smaller than the specified major version + * number. If the major version numbers are the same, it is smaller + * than the specified version number if its minor version is smaller + * than the specified minor version number. If the minor version + * numbers are the same, then a library version would be smaller than + * the specified version number if its release number is smaller than + * the specified release number. + * + * \details The #H5_VERSION_GE and #H5_VERSION_LE macros are used at compile + * time to conditionally include or exclude code based on the version + * of the HDF5 library against which an application will be linked. + * + * The #H5_VERSION_LE macro compares the version of the HDF5 library + * being used against the version number specified in the parameters. + * + * For more information about release versioning, see \ref_h5lib_relver. + * + * \since 1.8.7 + * + */ #define H5_VERSION_LE(Maj, Min, Rel) \ (((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE <= Rel)) || \ ((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR < Min)) || (H5_VERS_MAJOR < Maj)) -/* +/** * 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: - * - * if((dset = H5Dopen2(file, name)) < 0) - * fprintf(stderr, "unable to open the requested dataset\n"); + * \code + * if((dset = H5Dopen2(file, name)) < 0) + * fprintf(stderr, "unable to open the requested dataset\n"); + * \endcode */ 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 + * 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: - * - * if ((retval = H5Tcommitted(type)) > 0) { - * printf("data type is committed\n"); - * } else if (!retval) { - * printf("data type is not committed\n"); - * } else { - * printf("error determining whether data type is committed\n"); - * } + * for truth from a #htri_t function is: + * \code + * if ((retval = H5Tcommitted(type)) > 0) { + * printf("data type is committed\n"); + * } else if (!retval) { + * printf("data type is not committed\n"); + * } else { + * printf("error determining whether data type is committed\n"); + * } + * \endcode */ #ifdef H5_HAVE_STDBOOL_H #include @@ -307,8 +387,7 @@ typedef unsigned long uint32_t; #error "nothing appropriate for uint32_t" #endif -//! [H5_iter_order_t_snip] - +//! /** * Common iteration orders */ @@ -319,8 +398,7 @@ typedef enum { H5_ITER_NATIVE, /**< No particular order, whatever is fastest */ H5_ITER_N /**< Number of iteration orders */ } H5_iter_order_t; - -//! [H5_iter_order_t_snip] +//! /* Iteration callback values */ /* (Actually, any positive value will cause the iterator to stop and pass back @@ -330,8 +408,7 @@ typedef enum { #define H5_ITER_CONT (0) #define H5_ITER_STOP (1) -//! [H5_index_t_snip] - +//! /** * The types of indices on links in groups/attributes on objects. * Primarily used for " by index" routines and for iterating over @@ -343,18 +420,17 @@ typedef enum H5_index_t { H5_INDEX_CRT_ORDER, /**< Index on creation order */ H5_INDEX_N /**< Number of indices defined */ } H5_index_t; - -//! [H5_index_t_snip] +//! /** * Storage info struct used by H5O_info_t and H5F_info_t */ -//! [H5_ih_info_t_snip] +//! typedef struct H5_ih_info_t { hsize_t index_size; /**< btree and/or list */ hsize_t heap_size; } H5_ih_info_t; -//! [H5_ih_info_t_snip] +//! /** * The maximum size allowed for tokens @@ -364,17 +440,17 @@ typedef struct H5_ih_info_t { */ #define H5O_MAX_TOKEN_SIZE (16) -//! [H5O_token_t_snip] - +//! /** + * Type for object tokens + * * \internal (Hoisted here, since it's used by both the - * H5Lpublic.h and H5Opublic.h headers) */ -/* Type for object tokens */ + * H5Lpublic.h and H5Opublic.h headers) + */ typedef struct H5O_token_t { uint8_t __data[H5O_MAX_TOKEN_SIZE]; } H5O_token_t; - -//! [H5O_token_t_snip] +//! /** * Allocation statistics info struct -- cgit v0.12 From 460b6f4a8a98d95226cda99380b10217f95a9e2a Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 26 Apr 2021 16:44:31 -0500 Subject: fortran generated files depends (#598) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- fortran/src/CMakeLists.txt | 13 +++++++++++-- src/CMakeLists.txt | 7 +++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 258efe8..120dc1a 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -88,7 +88,7 @@ if (NOT ONLY_SHARED_LIBS) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h + DEPENDS H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) @@ -101,7 +101,7 @@ if (BUILD_SHARED_LIBS) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared - DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h + DEPENDS H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 PROPERTIES GENERATED TRUE) @@ -134,10 +134,19 @@ set (f90CStub_C_HDRS # generated files ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ) +add_custom_target (H5gen_i ALL + DEPENDS H5match_types ${f90CStub_C_HDRS} +) +set_source_files_properties (${f90CStub_C_HDRS} PROPERTIES GENERATED TRUE) + set (f90CStub_C_SHHDRS # generated files ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ) +add_custom_target (H5gen_iSH ALL + DEPENDS H5match_types ${f90CStub_C_SHHDRS} +) +set_source_files_properties (${f90CStub_C_SHHDRS} PROPERTIES GENERATED TRUE) if (NOT ONLY_SHARED_LIBS) add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 74fd71f..a2d4c37 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1044,6 +1044,7 @@ if (LOCAL_BATCH_TEST) endif () endif () +set (lib_prog_deps) if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") @@ -1055,6 +1056,7 @@ if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") target_compile_options(H5detect PRIVATE "$<$:-O0>" ) + set (lib_prog_deps ${lib_prog_deps} H5detect) if (HDF5_BATCH_H5DETECT) configure_file ( @@ -1146,6 +1148,7 @@ target_link_libraries (H5make_libsettings target_compile_options(H5make_libsettings PRIVATE "$<$:-O0>" ) +set (lib_prog_deps ${lib_prog_deps} H5make_libsettings) #----------------------------------------------------------------------------- # Add Target to clang-format @@ -1189,7 +1192,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) if (NOT ONLY_SHARED_LIBS) set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c) add_custom_target (gen_${HDF5_LIB_TARGET} ALL - DEPENDS H5make_libsettings ${gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2 + DEPENDS ${lib_prog_deps} ${gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2 COMMENT "Generation target files" ) @@ -1228,7 +1231,7 @@ endif () if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c) add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL - DEPENDS H5make_libsettings ${shared_gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2 + DEPENDS ${lib_prog_deps} ${shared_gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2 COMMENT "Shared generation target files" ) -- cgit v0.12 From 00dc456cec2a6820bbb05d8a9a2f1967bf30f7e8 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 27 Apr 2021 08:58:34 -0500 Subject: Parallel builds need the mpi compiler for pkgconfig scripts. (#599) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/src/CMakeLists.txt | 6 +++++- fortran/src/CMakeLists.txt | 6 +++++- hl/c++/src/CMakeLists.txt | 6 +++++- hl/fortran/src/CMakeLists.txt | 6 +++++- hl/src/CMakeLists.txt | 6 +++++- src/CMakeLists.txt | 20 +++++++++++++++++++- 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 8608c67..4b1a2d6 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -209,7 +209,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 120dc1a..ae815f2 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -556,7 +556,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5fc diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 1eac9fe..e488656 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -120,7 +120,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 38529b4..4f0b451 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -353,7 +353,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5hlfc diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 785bdcf..427424e 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -152,7 +152,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a2d4c37..0d2d960 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1352,7 +1352,11 @@ install ( ) if (NOT WIN32) - set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5cc @@ -1364,6 +1368,20 @@ if (NOT WIN32) PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT libraries ) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + #legacy requires a different name + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT libraries + ) + endif () endif () #----------------------------------------------------------------------------- -- cgit v0.12 From 138bc52facad0e6be4cfd13a860bb628c1dfd626 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 29 Apr 2021 04:57:02 -0700 Subject: Fix for a segfault when H5Pset_fapl_log is passed an invalid fapl ID (#607) * Committing clang-format changes * Fixes an issue where H5Pset_fapl_log sefaults when passed an invalid fapl ID This was due to a pointer-containing struct being memset after the first internal API call. If the first call failed, the error condition would check if the pointer was not NULL and then attempt to free it if not. This would lead to the freeing of a wild pointer if an invalid fapl ID were passed in. This was fixed by reordering the memset and adding a test to ensure the problem stays fixed. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- release_docs/RELEASE.txt | 13 +++++++++++++ src/H5FDlog.c | 7 +++++-- test/vfd.c | 13 ++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 359f222..f014d72 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -414,6 +414,19 @@ New Features Library: -------- + - H5Pset_fapl_log() no longer crashes when passed an invalid fapl ID + + When passed an invalid fapl ID, H5Pset_fapl_log() would usually + segfault when attempting to free an uninitialized pointer in the error + handling code. This behavior is more common in release builds or + when the memory sanitization checks were not selected as a build + option. + + The pointer is now correctly initialized and the API call now + produces a normal HDF5 error when fed an invalid fapl ID. + + (DER - 2021/04/28, HDFFV-11240) + - HSYS_GOTO_ERROR now emits the results of GetLastError() on Windows HSYS_GOTO_ERROR is an internal macro that is used to produce error diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 57902b6..707c97b 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -328,12 +328,15 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sULz", fapl_id, logfile, flags, buf_size); + /* Do this first, so that we don't try to free a wild pointer if + * H5P_object_verify() fails. + */ + HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t)); + /* Check arguments */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t)); - /* Duplicate the log file string * A little wasteful, since this string will just be copied later, but * passing it in as a pointer sets off a chain of impossible-to-resolve diff --git a/test/vfd.c b/test/vfd.c index 6b851a2..8484bfd 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1867,12 +1867,23 @@ test_log(void) hsize_t file_size = 0; unsigned int flags = H5FD_LOG_ALL; size_t buf_size = 4 * KB; + herr_t ret = SUCCEED; TESTING("LOG file driver"); - /* Set property list and file name for log driver. */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; + + /* Make sure calling with an invalid fapl doesn't crash */ + H5E_BEGIN_TRY + { + ret = H5Pset_fapl_log(H5I_INVALID_HID, LOG_FILENAME, 0, 0); + } + H5E_END_TRY; + if (SUCCEED == ret) + TEST_ERROR; + + /* Set property list and file name for log driver. */ if (H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0) TEST_ERROR; h5_fixname(FILENAME[6], fapl, filename, sizeof filename); -- cgit v0.12 From 16f9b070ce084313de37cc73968f70f2cba0b75a Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 29 Apr 2021 07:33:43 -0700 Subject: Fixes a segfault when H5Pset_mdc_log_options is called multiple times on a fapl (#601) * Committing clang-format changes * Fixes a segfault when H5Pset_mdc_log_options() is called multiple times An internal string is incorrectly freed when the API call is invoked multiple times on a property list, which will usually cause a segfault to occur. On the first call the log location is NULL so the problem doesn't occur. Fixes HDFFV-11239 * Fixes typos Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- release_docs/RELEASE.txt | 12 ++++++++++++ src/H5Pfapl.c | 11 +++-------- test/cache_logging.c | 6 ++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index f014d72..8b07393 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -427,6 +427,18 @@ New Features (DER - 2021/04/28, HDFFV-11240) + - Fixes a segfault when H5Pset_mdc_log_options() is called multiple times + + The call incorrectly attempts to free an internal copy of the previous + log location string, which causes a segfault. This only happens + when the call is invoked multiple times on the same property list. + On the first call to a given fapl, the log location is set to NULL so + the segfault does not occur. + + The string is now handled properly and the segfault no longer occurs. + + (DER - 2021/04/27, HDFFV-11239) + - HSYS_GOTO_ERROR now emits the results of GetLastError() on Windows HSYS_GOTO_ERROR is an internal macro that is used to produce error diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index c085b71..fb7b195 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -4221,7 +4221,7 @@ herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, hbool_t start_on_access) { H5P_genplist_t *plist; /* Property list pointer */ - char * tmp_location; /* Working location pointer */ + char * new_location; /* Working location pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -4237,19 +4237,14 @@ H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list") - /* Get the current location string and free it */ - if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current log location") - H5MM_xfree(tmp_location); - /* Make a copy of the passed-in location */ - if (NULL == (tmp_location = H5MM_xstrdup(location))) + if (NULL == (new_location = H5MM_xstrdup(location))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy passed-in log location") /* Set values */ if (H5P_set(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &is_enabled) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set is_enabled flag") - if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0) + if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &new_location) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set log location") if (H5P_set(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &start_on_access) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set start_on_access flag") diff --git a/test/cache_logging.c b/test/cache_logging.c index 93d4505..12f3d96 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -59,6 +59,12 @@ test_logging_api(void) if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0) TEST_ERROR; + /* Ensure that setting the property twice doesn't cause problems + * (addresses a previous bug). + */ + if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0) + TEST_ERROR; + /* Check to make sure that the property list getter returns the correct * location string buffer size; */ -- cgit v0.12 From 7ab97037a0f64a583a6c7d4064d92a963cdfd843 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 30 Apr 2021 13:40:27 -0500 Subject: Fortran target depends (#608) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- fortran/src/CMakeLists.txt | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index ae815f2..7a39abf 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -88,7 +88,7 @@ if (NOT ONLY_SHARED_LIBS) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h + DEPENDS H5_buildiface H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) @@ -101,7 +101,7 @@ if (BUILD_SHARED_LIBS) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared - DEPENDS H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h + DEPENDS H5_buildiface H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 PROPERTIES GENERATED TRUE) @@ -131,25 +131,29 @@ set (f90CStub_C_SOURCES set_source_files_properties (${f90CStub_C_SOURCES} PROPERTIES LANGUAGE C) set (f90CStub_C_HDRS + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h +) + +set (f90CStub_CGEN_HDRS # generated files ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ) add_custom_target (H5gen_i ALL - DEPENDS H5match_types ${f90CStub_C_HDRS} + DEPENDS H5match_types ${f90CStub_CGEN_HDRS} ) -set_source_files_properties (${f90CStub_C_HDRS} PROPERTIES GENERATED TRUE) -set (f90CStub_C_SHHDRS +set (f90CStub_CGEN_SHHDRS # generated files ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ) add_custom_target (H5gen_iSH ALL - DEPENDS H5match_types ${f90CStub_C_SHHDRS} + DEPENDS H5match_types ${f90CStub_CGEN_SHHDRS} ) -set_source_files_properties (${f90CStub_C_SHHDRS} PROPERTIES GENERATED TRUE) if (NOT ONLY_SHARED_LIBS) - add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) + add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_HDRS}) target_include_directories (${HDF5_F90_C_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" @@ -163,11 +167,12 @@ if (NOT ONLY_SHARED_LIBS) FOLDER libraries/fortran LINKER_LANGUAGE C ) + add_dependencies (${HDF5_F90_C_LIB_TARGET} H5gen_i) set (install_targets ${HDF5_F90_C_LIB_TARGET}) endif () if (BUILD_SHARED_LIBS) - add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) + add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_SHHDRS}) target_include_directories (${HDF5_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" @@ -182,6 +187,7 @@ if (BUILD_SHARED_LIBS) FOLDER libraries/fortran LINKER_LANGUAGE C ) + add_dependencies (${HDF5_F90_C_LIBSH_TARGET} H5gen_iSH) set (install_targets ${install_targets} ${HDF5_F90_C_LIBSH_TARGET}) endif () @@ -220,7 +226,7 @@ add_custom_command (TARGET H5_buildiface POST_BUILD BYPRODUCTS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} - DEPENDS ${f90_F_GEN_SOURCES} + DEPENDS H5_buildiface ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 file" ) if (NOT ONLY_SHARED_LIBS) @@ -229,7 +235,7 @@ if (NOT ONLY_SHARED_LIBS) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 + DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMENT "Generating the H5_gen.F90 file" ) add_custom_target (H5gen ALL -- cgit v0.12 From 73bb382e9e77ca9847c09dff37b9e2338f26bbb8 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 30 Apr 2021 12:47:51 -0700 Subject: Fixes crashes when size_hint > UINT32_MAX is passed to H5Gcreate1 (#611) * Committing clang-format changes * Fixes incorrect size_hint handling in H5Gcreate1 * Updates the size hint type for group creation * Updates the RELEASE.txt note * Revert "Updates the RELEASE.txt note" This reverts commit 3df386acca806d652bbe2209f7c4503b30f068ff. * Reverts previous behavior to use a uint32_t struct field * Updates RELEASE.txt Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- release_docs/RELEASE.txt | 18 ++++++++++++++++++ src/H5Gdeprec.c | 10 ++++++---- src/H5Gpublic.h | 12 +++++------- test/tmisc.c | 25 +++++++++++++++++++++++-- 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8b07393..be8440f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -414,6 +414,24 @@ New Features Library: -------- + - H5Gcreate1() now rejects size_hint parameters larger than UINT32_MAX + + The size_hint value is ultimately stored in a uint32_t struct field, + so specifying a value larger than this on a 64-bit machine can cause + undefined behavior including crashing the system. + + The documentation for this API call was also incorrect, stating that + passing a negative value would cause the library to use a default + value. Instead, passing a "negative" value actually passes a very large + value, which is probably not what the user intends and can cause + crashes on 64-bit systems. + + The Doxygen documentation has been updated and passing values larger + than UINT32_MAX for size_hint will now produce a normal HDF5 error. + + (DER - 2021/04/29, HDFFV-11241) + + - H5Pset_fapl_log() no longer crashes when passed an invalid fapl ID When passed an invalid fapl ID, H5Pset_fapl_log() would usually diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 453796e..45065e8 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -141,10 +141,10 @@ H5G_map_obj_type(H5O_type_t obj_type) * specified NAME. The group is opened for write access * and it's object ID is returned. * - * The optional SIZE_HINT specifies how much file space to - * reserve to store the names that will appear in this - * group. If a non-positive value is supplied for the SIZE_HINT - * then a default size is chosen. + * The SIZE_HINT parameter specifies how much file space to reserve + * to store the names that will appear in this group. This number + * must be less than or equal to UINT32_MAX. If zero is supplied + * for the SIZE_HINT then a default size is chosen. * * Note: Deprecated in favor of H5Gcreate2 * @@ -174,6 +174,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Check arguments */ if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given") + if (size_hint > UINT32_MAX) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX") /* Check if we need to create a non-standard GCPL */ if (size_hint > 0) { diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 416ff2c..b009d41 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -569,8 +569,8 @@ typedef struct H5G_stat_t { * * \fgdta_loc_id * \param[in] name Name of the group to create - * \param[in] size_hint Optional parameter indicating the number of bytes - * to reserve for the names that will appear in the group + * \param[in] size_hint The number of bytes to reserve for the names + * that will appear in the group * * \return \hid_t{group} * @@ -592,11 +592,9 @@ typedef struct H5G_stat_t { * group, is not limited. * * \p size_hint is a hint for the number of bytes to reserve to store - * the names which will be eventually added to the new group. Passing a - * value of zero for \p size_hint is usually adequate since the library - * is able to dynamically resize the name heap, but a correct hint may - * result in better performance. If a non-positive value is supplied - * for \p size_hint, then a default size is chosen. + * the names which will be eventually added to the new group. This + * value must be between 0 and UINT32_MAX (inclusive). If this + * parameter is zero, a default value will be used. * * The return value is a group identifier for the open group. This * group identifier should be closed by calling H5Gclose() when it is diff --git a/test/tmisc.c b/test/tmisc.c index 03f9952..51e203a 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -4088,9 +4088,31 @@ test_misc23(void) H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gcreate1"); - tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0); + /* Make sure that size_hint values that can't fit into a 32-bit + * unsigned integer are rejected. Only necessary on systems where + * size_t is a 64-bit type. + */ + if (SIZE_MAX > UINT32_MAX) { + H5E_BEGIN_TRY + { + tmp_id = H5Gcreate1(file_id, "/size_hint_too_large", SIZE_MAX); + } + H5E_END_TRY; + VERIFY(tmp_id, FAIL, "H5Gcreate1"); + } + + /* Make sure the largest size_hint value works */ + H5E_BEGIN_TRY + { + tmp_id = H5Gcreate1(file_id, "/largest_size_hint", UINT32_MAX); + } + H5E_END_TRY; CHECK(tmp_id, FAIL, "H5Gcreate1"); + status = H5Gclose(tmp_id); + CHECK(status, FAIL, "H5Gclose"); + tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0); + CHECK(tmp_id, FAIL, "H5Gcreate1"); status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); @@ -4103,7 +4125,6 @@ test_misc23(void) tmp_id = H5Dcreate1(file_id, "/A/dset", type_id, space_id, create_id); CHECK(tmp_id, FAIL, "H5Dcreate1"); - status = H5Dclose(tmp_id); CHECK(status, FAIL, "H5Dclose"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -- cgit v0.12 From 44db310d8d45d7d639b5b7745636d1a58555d89a Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 3 May 2021 10:08:37 -0400 Subject: =?UTF-8?q?Removed=20mentions=20of=20Wdeclaration-after-statement?= =?UTF-8?q?=20now=20that=20C99=20is=20requ=E2=80=A6=20(#447)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removed mentions of Wdeclaration-after-statement now that C99 is required * Remove -Werror=declaration-after-statement from error-general file. Co-authored-by: Larry Knox --- config/gnu-warnings/error-general | 1 - config/gnu-warnings/noerror-general | 1 - release_docs/INSTALL_Warnings.txt | 2 -- 3 files changed, 4 deletions(-) diff --git a/config/gnu-warnings/error-general b/config/gnu-warnings/error-general index 4358b20..8405c40 100644 --- a/config/gnu-warnings/error-general +++ b/config/gnu-warnings/error-general @@ -3,7 +3,6 @@ # circumstances, so ask the compiler to treat them as errors: # -Werror=bad-function-cast --Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=missing-prototypes diff --git a/config/gnu-warnings/noerror-general b/config/gnu-warnings/noerror-general index e19014f..31194d3 100644 --- a/config/gnu-warnings/noerror-general +++ b/config/gnu-warnings/noerror-general @@ -3,7 +3,6 @@ # circumstances, so ask the compiler to treat them as errors: # -Wbad-function-cast --Wdeclaration-after-statement -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes diff --git a/release_docs/INSTALL_Warnings.txt b/release_docs/INSTALL_Warnings.txt index 97b3f76..97981be 100644 --- a/release_docs/INSTALL_Warnings.txt +++ b/release_docs/INSTALL_Warnings.txt @@ -60,7 +60,6 @@ Autotools UNIX warnings added to H5_CFLAGS -Wcast-align -Wcast-qual -Wconversion - -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal -Wformat=2 @@ -291,7 +290,6 @@ IF GNU GCC -Wcast-align -Wcast-qual -Wconversion - -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal -Wformat=2 -- cgit v0.12 From 3899e090dfd2e88b4a1929e304df835fd7a3d316 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 3 May 2021 11:22:53 -0400 Subject: Ubsan fixes (#498) * Fixed use of null pointer identified by UBSan UBSan warned: runtime error: member access within null pointer of type 'named_dt_t' (aka 'struct named_dt_t') with these two tests: H5REPACK-committed_dt_DFF H5REPACK-committed_dt Reformulated per @gnuoyd suggestion. * Fixed undefined float -> unsigned char conversion in HL_test_image * Removed dead skip_overflow_tests_g global The global `skip_overflow_tests_g` was being set but never read. * Don't treat 2d array as 1d array, fixing UBSan complaint in `CPP_testhdf5` * Committing clang-format changes * Remove extra ']' in line 730. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Larry Knox --- c++/test/ttypes.cpp | 8 ++-- hl/test/test_image.c | 11 ++--- test/dt_arith.c | 93 ------------------------------------------- tools/src/h5repack/h5repack.c | 18 ++++----- 4 files changed, 19 insertions(+), 111 deletions(-) diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index b633740..7d0337d 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -656,7 +656,6 @@ static void test_named() { static hsize_t ds_size[2] = {10, 20}; - hsize_t i; unsigned attr_data[10][20]; DataType * ds_type = NULL; @@ -726,8 +725,11 @@ test_named() // It should be possible to define an attribute for the named type Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space); - for (i = 0; i < ds_size[0] * ds_size[1]; i++) - attr_data[0][i] = (int)i; /*tricky*/ + for (hsize_t i = 0; i < ds_size[0]; i++) { + for (hsize_t j = 0; j < ds_size[1]; j++) { + attr_data[i][j] = (unsigned)(i * ds_size[1] + j); + } + } attr1.write(PredType::NATIVE_UINT, attr_data); attr1.close(); diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 0c7d511..dc1be96 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -650,10 +650,10 @@ test_generate(void) HL_TESTING2("make indexed image from land data"); for (i = 0; i < n_elements; i++) { - if (data[i] < 0) + if (data[i] < 0.0f) image_data[i] = 0; else - image_data[i] = (unsigned char)((255 * (data[i])) / xmax); + image_data[i] = (unsigned char)((255 * data[i]) / xmax); } /* make the image */ @@ -671,10 +671,11 @@ test_generate(void) HL_TESTING2("make indexed image from sea data"); for (i = 0; i < n_elements; i++) { - if (data[i] > 0) + if (data[i] > 0.0f) image_data[i] = 0; - else - image_data[i] = (unsigned char)((255 * (data[i] - xmin)) / xmin); + else { + image_data[i] = (unsigned char)((255.0f * (data[i] - xmin)) / (xmax - xmin)); + } } /* make the image */ diff --git a/test/dt_arith.c b/test/dt_arith.c index f2bf6cf..ddc8814 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -74,9 +74,6 @@ typedef enum dtype_t { OTHER } dtype_t; -/* Skip overflow tests if non-zero */ -static int skip_overflow_tests_g = 0; - /* * Although we check whether a floating point overflow generates a SIGFPE and * turn off overflow tests in that case, it might still be possible for an @@ -394,7 +391,6 @@ static int without_hardware_g = 0; HDfree(value); \ } -void some_dummy_func(float x); static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits); static int my_isnan(dtype_t type, void *val); static int my_isinf(int endian, const unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, @@ -515,92 +511,6 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 } /*------------------------------------------------------------------------- - * Function: some_dummy_func - * - * Purpose: A dummy function to help check for overflow. - * - * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT - * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW - * CHECKING. - * - * Return: void - * - * Programmer: Robb Matzke - * Tuesday, July 21, 1998 - * - *------------------------------------------------------------------------- - */ -void -some_dummy_func(float x) -{ - char s[128]; - - HDsnprintf(s, sizeof(s), "%g", (double)x); -} - -/*------------------------------------------------------------------------- - * Function: generates_sigfpe - * - * Purpose: Determines if SIGFPE is generated from overflows. We must be - * able to fork() and waitpid() in order for this test to work - * properly. Sets skip_overflow_tests_g to non-zero if they - * would generate SIGBUS, zero otherwise. - * - * Programmer: Robb Matzke - * Tuesday, July 21, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -generates_sigfpe(void) -{ -#ifdef H5_HAVE_UNISTD_H - pid_t pid; - int status; - size_t i, j; - double d; - unsigned char *dp = (unsigned char *)&d; - float f; - - HDfflush(stdout); - HDfflush(stderr); - if ((pid = HDfork()) < 0) { - HDperror("fork"); - HDexit(EXIT_FAILURE); - } - else if (0 == pid) { - for (i = 0; i < 2000; i++) { - for (j = 0; j < sizeof(double); j++) - dp[j] = (unsigned char)HDrand(); - f = (float)d; - some_dummy_func((float)f); - } - HDexit(EXIT_SUCCESS); - } - - while (pid != HDwaitpid(pid, &status, 0)) - /*void*/; - if (WIFEXITED(status) && 0 == WEXITSTATUS(status)) { - HDputs("Floating-point overflow cases will be tested."); - skip_overflow_tests_g = FALSE; - } - else if (WIFSIGNALED(status) && SIGFPE == WTERMSIG(status)) { - HDputs("Floating-point overflow cases cannot be safely tested."); - skip_overflow_tests_g = TRUE; - /* delete the core dump file that SIGFPE may have created */ - HDunlink("core"); - } -#else /* H5_HAVE_UNISTD_H */ - HDputs("Cannot determine if floating-point overflows generate a SIGFPE"); - HDputs("due to a lack of fork(2) - assuming yes."); - HDputs("Overflow cases will not be tested."); - skip_overflow_tests_g = TRUE; -#endif /* H5_HAVE_UNISTD_H */ -} - -/*------------------------------------------------------------------------- * Function: test_hard_query * * Purpose: Tests H5Tcompiler_conv() for querying whether a conversion is @@ -5406,9 +5316,6 @@ main(void) * for user-defined integer types */ nerrors += (unsigned long)test_derived_integer(); - /* Does floating point overflow generate a SIGFPE? */ - generates_sigfpe(); - /* Test degenerate cases */ nerrors += (unsigned long)run_fp_tests("noop"); diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 7bcca8f..7cad36b 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -225,9 +225,9 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { - named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ - named_dt_t *dt_ret = NULL; /* Datatype to return */ - H5O_info2_t oinfo; /* Object info of input dtype */ + named_dt_t *dt = NULL; /* Stack pointer */ + named_dt_t *dt_ret = NULL; /* Datatype to return */ + H5O_info2_t oinfo; /* Object info of input dtype */ int token_cmp; hid_t ret_value = H5I_INVALID_HID; @@ -235,15 +235,13 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Oget_info failed"); if (*named_dt_head_p) { - if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0) - H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens"); - - /* Stack already exists, search for the datatype */ - while (dt && token_cmp) { - dt = dt->next; - + /* Search the stack for the datatype. */ + for (dt = *named_dt_head_p; dt != NULL; dt = dt->next) { if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0) H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens"); + + if (token_cmp == 0) + break; // found it! } dt_ret = dt; -- cgit v0.12 From c7d45c205e78f141df76578ed72243d4445ac675 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 4 May 2021 13:26:38 -0700 Subject: Adds const to a few global variables (#623) * Committing clang-format changes * Adds consts to a few global variables Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5Clog_json.c | 52 ++++++++++++++++++++++++++-------------------------- src/H5Clog_trace.c | 52 ++++++++++++++++++++++++++-------------------------- src/H5MF.c | 14 +++++++------- src/H5MFpkg.h | 6 +++--- src/H5MFsection.c | 6 +++--- 5 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index 731d741..18323ca 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -118,32 +118,32 @@ static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_ /* Note that there's no cache set up call since that's the * place where this struct is wired into the cache. */ -static H5C_log_class_t H5C_json_log_class_g = {"json", - H5C__json_tear_down_logging, - NULL, /* start logging */ - NULL, /* stop logging */ - H5C__json_write_start_log_msg, - H5C__json_write_stop_log_msg, - H5C__json_write_create_cache_log_msg, - H5C__json_write_destroy_cache_log_msg, - H5C__json_write_evict_cache_log_msg, - H5C__json_write_expunge_entry_log_msg, - H5C__json_write_flush_cache_log_msg, - H5C__json_write_insert_entry_log_msg, - H5C__json_write_mark_entry_dirty_log_msg, - H5C__json_write_mark_entry_clean_log_msg, - H5C__json_write_mark_unserialized_entry_log_msg, - H5C__json_write_mark_serialized_entry_log_msg, - H5C__json_write_move_entry_log_msg, - H5C__json_write_pin_entry_log_msg, - H5C__json_write_create_fd_log_msg, - H5C__json_write_protect_entry_log_msg, - H5C__json_write_resize_entry_log_msg, - H5C__json_write_unpin_entry_log_msg, - H5C__json_write_destroy_fd_log_msg, - H5C__json_write_unprotect_entry_log_msg, - H5C__json_write_set_cache_config_log_msg, - H5C__json_write_remove_entry_log_msg}; +static const H5C_log_class_t H5C_json_log_class_g = {"json", + H5C__json_tear_down_logging, + NULL, /* start logging */ + NULL, /* stop logging */ + H5C__json_write_start_log_msg, + H5C__json_write_stop_log_msg, + H5C__json_write_create_cache_log_msg, + H5C__json_write_destroy_cache_log_msg, + H5C__json_write_evict_cache_log_msg, + H5C__json_write_expunge_entry_log_msg, + H5C__json_write_flush_cache_log_msg, + H5C__json_write_insert_entry_log_msg, + H5C__json_write_mark_entry_dirty_log_msg, + H5C__json_write_mark_entry_clean_log_msg, + H5C__json_write_mark_unserialized_entry_log_msg, + H5C__json_write_mark_serialized_entry_log_msg, + H5C__json_write_move_entry_log_msg, + H5C__json_write_pin_entry_log_msg, + H5C__json_write_create_fd_log_msg, + H5C__json_write_protect_entry_log_msg, + H5C__json_write_resize_entry_log_msg, + H5C__json_write_unpin_entry_log_msg, + H5C__json_write_destroy_fd_log_msg, + H5C__json_write_unprotect_entry_log_msg, + H5C__json_write_set_cache_config_log_msg, + H5C__json_write_remove_entry_log_msg}; /*------------------------------------------------------------------------- * Function: H5C__json_write_log_message diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index c30f79e..d33d1b0 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -113,32 +113,32 @@ static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache /* Note that there's no cache set up call since that's the * place where this struct is wired into the cache. */ -static H5C_log_class_t H5C_trace_log_class_g = {"trace", - H5C__trace_tear_down_logging, - NULL, /* start logging */ - NULL, /* stop logging */ - NULL, /* write start message */ - NULL, /* write stop message */ - NULL, /* write create cache message */ - NULL, /* write destroy cache message */ - NULL, /* write evict cache message */ - H5C__trace_write_expunge_entry_log_msg, - H5C__trace_write_flush_cache_log_msg, - H5C__trace_write_insert_entry_log_msg, - H5C__trace_write_mark_entry_dirty_log_msg, - H5C__trace_write_mark_entry_clean_log_msg, - H5C__trace_write_mark_unserialized_entry_log_msg, - H5C__trace_write_mark_serialized_entry_log_msg, - H5C__trace_write_move_entry_log_msg, - H5C__trace_write_pin_entry_log_msg, - H5C__trace_write_create_fd_log_msg, - H5C__trace_write_protect_entry_log_msg, - H5C__trace_write_resize_entry_log_msg, - H5C__trace_write_unpin_entry_log_msg, - H5C__trace_write_destroy_fd_log_msg, - H5C__trace_write_unprotect_entry_log_msg, - H5C__trace_write_set_cache_config_log_msg, - H5C__trace_write_remove_entry_log_msg}; +static const H5C_log_class_t H5C_trace_log_class_g = {"trace", + H5C__trace_tear_down_logging, + NULL, /* start logging */ + NULL, /* stop logging */ + NULL, /* write start message */ + NULL, /* write stop message */ + NULL, /* write create cache message */ + NULL, /* write destroy cache message */ + NULL, /* write evict cache message */ + H5C__trace_write_expunge_entry_log_msg, + H5C__trace_write_flush_cache_log_msg, + H5C__trace_write_insert_entry_log_msg, + H5C__trace_write_mark_entry_dirty_log_msg, + H5C__trace_write_mark_entry_clean_log_msg, + H5C__trace_write_mark_unserialized_entry_log_msg, + H5C__trace_write_mark_serialized_entry_log_msg, + H5C__trace_write_move_entry_log_msg, + H5C__trace_write_pin_entry_log_msg, + H5C__trace_write_create_fd_log_msg, + H5C__trace_write_protect_entry_log_msg, + H5C__trace_write_resize_entry_log_msg, + H5C__trace_write_unpin_entry_log_msg, + H5C__trace_write_destroy_fd_log_msg, + H5C__trace_write_unprotect_entry_log_msg, + H5C__trace_write_set_cache_config_log_msg, + H5C__trace_write_remove_entry_log_msg}; /*------------------------------------------------------------------------- * Function: H5C__trace_write_log_message diff --git a/src/H5MF.c b/src/H5MF.c index 16da9e6..17301f7 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -1442,13 +1442,13 @@ done: htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) { - H5MF_free_section_t * node = NULL; /* Free space section pointer */ - H5MF_sect_ud_t udata; /* User data for callback */ - H5FS_section_class_t *sect_cls; /* Section class */ - H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ - H5F_mem_page_t fs_type; /* Free space type */ - htri_t ret_value = FALSE; /* Return value */ + H5MF_free_section_t * node = NULL; /* Free space section pointer */ + H5MF_sect_ud_t udata; /* User data for callback */ + const H5FS_section_class_t *sect_cls; /* Section class */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ + H5F_mem_page_t fs_type; /* Free space type */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index 4e7717d..f34c73e 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -168,9 +168,9 @@ typedef struct H5MF_fs_t { /*****************************/ /* H5MF single section inherits serializable properties from H5FS_section_class_t */ -H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1]; -H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1]; -H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1]; +H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1]; +H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1]; +H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1]; /******************************/ /* Package Private Prototypes */ diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 8d4704e..bf5b888 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -81,7 +81,7 @@ static herr_t H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *udata); /*********************/ /* Class info for "simple" free space sections */ -H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{ +const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{ /* Class variables */ H5MF_FSPACE_SECT_SIMPLE, /* Section type */ 0, /* Extra serialized size */ @@ -107,7 +107,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{ }}; /* Class info for "small" free space sections */ -H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{ +const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{ /* Class variables */ H5MF_FSPACE_SECT_SMALL, /* Section type */ 0, /* Extra serialized size */ @@ -133,7 +133,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{ }}; /* Class info for "large" free space sections */ -H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ +const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ /* Class variables */ H5MF_FSPACE_SECT_LARGE, /* Section type */ 0, /* Extra serialized size */ -- cgit v0.12 From dbe7204085d46188414fd9d9e0dde48afcf30f28 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 4 May 2021 13:51:26 -0700 Subject: Hash table replacement for skip lists in ID code (#600) * Committing clang-format changes * Brings over hash table code from Bitbucket * Can be switched between skip list and hash table implementation with H5_USE_ID_HASH_TABLE #define * Not yet updated to use iterate-safe delete * Fixes a warning and changes where the problematic test is commented out. * Adds mark-and-sweep flags and members * Final fixes for hash table ID code * Removes skip list ID code * Committing clang-format changes * Formatted source * Adds a comment about the mark-and-sweep scheme. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 1 + src/CMakeLists.txt | 2 + src/H5Idbg.c | 17 +- src/H5Iint.c | 156 ++++--- src/H5Ipkg.h | 29 +- src/H5T.c | 3 +- src/uthash.h | 1184 ++++++++++++++++++++++++++++++++++++++++++++++++++++ test/tid.c | 4 +- 8 files changed, 1327 insertions(+), 69 deletions(-) create mode 100644 src/uthash.h diff --git a/MANIFEST b/MANIFEST index f7a4983..9ecef83 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1114,6 +1114,7 @@ ./src/hdf5.h ./src/libhdf5.settings.in ./src/H5win32defs.h +./src/uthash.h ./test/AtomicWriterReader.txt ./test/H5srcdir.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d2d960..9bacd6b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -971,6 +971,8 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5Zprivate.h ${HDF5_SRC_DIR}/H5win32defs.h + + ${HDF5_SRC_DIR}/uthash.h ) set (H5_GENERATED_HEADERS diff --git a/src/H5Idbg.c b/src/H5Idbg.c index 8894230..7b5eb5a 100644 --- a/src/H5Idbg.c +++ b/src/H5Idbg.c @@ -30,7 +30,6 @@ #include "H5Gprivate.h" /* Groups */ #include "H5Ipkg.h" /* IDs */ #include "H5RSprivate.h" /* Reference-counted strings */ -#include "H5SLprivate.h" /* Skip Lists */ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLprivate.h" /* Virtual Object Layer */ @@ -86,6 +85,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) HDfprintf(stderr, " id = %" PRIdHID "\n", info->id); HDfprintf(stderr, " count = %u\n", info->count); HDfprintf(stderr, " obj = 0x%8p\n", info->object); + HDfprintf(stderr, " marked = %d\n", info->marked); /* Get the group location, so we get get the name */ switch (type) { @@ -173,6 +173,9 @@ H5I_dump_ids_for_type(H5I_type_t type) if (type_info) { + H5I_id_info_t *item = NULL; + H5I_id_info_t *tmp = NULL; + /* Header */ HDfprintf(stderr, " init_count = %u\n", type_info->init_count); HDfprintf(stderr, " reserved = %u\n", type_info->cls->reserved); @@ -182,7 +185,17 @@ H5I_dump_ids_for_type(H5I_type_t type) /* List */ if (type_info->id_count > 0) { HDfprintf(stderr, " List:\n"); - H5SL_iterate(type_info->ids, H5I__id_dump_cb, &type); + /* Normally we care about the callback's return value + * (H5I_ITER_CONT, etc.), but this is an iteration over all + * the IDs so we don't care. + * + * XXX: Update this to emit an error message on errors? + */ + HDfprintf(stderr, " (HASH TABLE)\n"); + HASH_ITER(hh, type_info->hash_table, item, tmp) + { + H5I__id_dump_cb((void *)item, NULL, (void *)&type); + } } } else diff --git a/src/H5Iint.c b/src/H5Iint.c index 41c6316..164fafc 100644 --- a/src/H5Iint.c +++ b/src/H5Iint.c @@ -29,7 +29,6 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5SLprivate.h" /* Skip Lists */ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLprivate.h" /* Virtual Object Layer */ @@ -75,7 +74,7 @@ typedef struct { /********************/ static void * H5I__unwrap(void *object, H5I_type_t type); -static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); +static herr_t H5I__mark_node(void *_id, void *key, void *udata); static void * H5I__remove_common(H5I_type_info_t *type_info, hid_t id); static int H5I__dec_ref(hid_t id, void **request); static int H5I__dec_app_ref(hid_t id, void **request); @@ -96,6 +95,9 @@ int H5I_next_type_g = (int)H5I_NTYPES; /* Declare a free list to manage the H5I_id_info_t struct */ H5FL_DEFINE_STATIC(H5I_id_info_t); +/* Whether deletes are actually marks (for mark-and-sweep) */ +hbool_t H5I_marking_g = FALSE; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -131,7 +133,7 @@ H5I_term_package(void) /* Count the number of types still in use */ for (i = 0; i < H5I_next_type_g; i++) - if ((type_info = H5I_type_info_array_g[i]) && type_info->ids) + if ((type_info = H5I_type_info_array_g[i]) && type_info->hash_table) in_use++; /* If no types are still being used then clean up */ @@ -139,7 +141,7 @@ H5I_term_package(void) for (i = 0; i < H5I_next_type_g; i++) { type_info = H5I_type_info_array_g[i]; if (type_info) { - HDassert(NULL == type_info->ids); + HDassert(NULL == type_info->hash_table); type_info = H5MM_xfree(type_info); H5I_type_info_array_g[i] = NULL; in_use++; @@ -196,8 +198,7 @@ H5I_register_type(const H5I_class_t *cls) type_info->id_count = 0; type_info->nextid = cls->reserved; type_info->last_id_info = NULL; - if (NULL == (type_info->ids = H5SL_create(H5SL_TYPE_HID, NULL))) - HGOTO_ERROR(H5E_ID, H5E_CANTCREATE, FAIL, "skip list creation failed") + type_info->hash_table = NULL; } /* Increment the count of the times this type has been initialized */ @@ -205,13 +206,9 @@ H5I_register_type(const H5I_class_t *cls) done: /* Clean up on error */ - if (ret_value < 0) { - if (type_info) { - if (type_info->ids) - H5SL_close(type_info->ids); + if (ret_value < 0) + if (type_info) H5MM_free(type_info); - } - } FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_register_type() */ @@ -311,7 +308,9 @@ H5I__unwrap(void *object, H5I_type_t type) herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) { - H5I_clear_type_ud_t udata; /* udata struct for callback */ + H5I_clear_type_ud_t udata; /* udata struct for callback */ + H5I_id_info_t * item = NULL; + H5I_id_info_t * tmp = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -328,33 +327,57 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) udata.force = force; udata.app_ref = app_ref; - /* Attempt to free all ids in the type */ - if (H5SL_try_free_safe(udata.type_info->ids, H5I__clear_type_cb, &udata) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, FAIL, "can't free ids in type") + /* Clearing a type is done in two phases (mark-and-sweep). This is because + * the type's free callback can free other IDs, potentially corrupting + * the data structure during the traversal. + */ + + /* Set marking flag */ + H5I_marking_g = TRUE; + + /* Mark nodes for deletion */ + HASH_ITER(hh, udata.type_info->hash_table, item, tmp) + { + if (!item->marked) + if (H5I__mark_node((void *)item, NULL, (void *)&udata) < 0) + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed while clearing the ID type") + } + + /* Unset marking flag */ + H5I_marking_g = FALSE; + + /* Perform sweep */ + HASH_ITER(hh, udata.type_info->hash_table, item, tmp) + { + if (item->marked) { + HASH_DELETE(hh, udata.type_info->hash_table, item); + item = H5FL_FREE(H5I_id_info_t, item); + } + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_clear_type() */ /*------------------------------------------------------------------------- - * Function: H5I__clear_type_cb + * Function: H5I__mark_node * - * Purpose: Attempts to free the specified ID, calling the free - * function for the object. + * Purpose: Attempts to mark the node for freeing and calls the free + * function for the object, if any * - * Return: TRUE/FALSE/FAIL + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Friday, July 10, 2015 * *------------------------------------------------------------------------- */ -static htri_t -H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata) +static herr_t +H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata) { - H5I_id_info_t * info = (H5I_id_info_t *)_info; /* Current ID info being worked with */ - H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */ - htri_t ret_value = FALSE; /* Return value */ + H5I_id_info_t * info = (H5I_id_info_t *)_info; /* Current ID info being worked with */ + H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */ + hbool_t mark = FALSE; FUNC_ENTER_STATIC_NOERR @@ -383,12 +406,12 @@ H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata) #endif /* H5I_DEBUG */ /* Indicate node should be removed from list */ - ret_value = TRUE; + mark = TRUE; } } else { /* Indicate node should be removed from list */ - ret_value = TRUE; + mark = TRUE; } } else { @@ -406,28 +429,28 @@ H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata) #endif /* H5I_DEBUG */ /* Indicate node should be removed from list */ - ret_value = TRUE; + mark = TRUE; } } else { /* Indicate node should be removed from list */ - ret_value = TRUE; + mark = TRUE; } } H5_GCC_DIAG_ON("cast-qual") /* Remove ID if requested */ - if (ret_value) { - /* Free ID info */ - info = H5FL_FREE(H5I_id_info_t, info); + if (mark) { + /* Mark ID for deletion */ + info->marked = TRUE; /* Decrement the number of IDs in the type */ udata->type_info->id_count--; } } - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__clear_type_cb() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5I__mark_node() */ /*------------------------------------------------------------------------- * Function: H5I__destroy_type @@ -471,9 +494,8 @@ H5I__destroy_type(H5I_type_t type) if (type_info->cls->flags & H5I_CLASS_IS_APPLICATION) type_info->cls = H5MM_xfree_const(type_info->cls); - if (H5SL_close(type_info->ids) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") - type_info->ids = NULL; + HASH_CLEAR(hh, type_info->hash_table); + type_info->hash_table = NULL; type_info = H5MM_xfree(type_info); @@ -531,10 +553,10 @@ H5I__register(H5I_type_t type, const void *object, hbool_t app_ref, H5I_future_r info->is_future = (NULL != realize_cb); info->realize_cb = realize_cb; info->discard_cb = discard_cb; + info->marked = FALSE; /* Insert into the type */ - if (H5SL_insert(type_info->ids, info, &info->id) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert ID node into skip list") + HASH_ADD(hh, type_info->hash_table, id, sizeof(hid_t), info); type_info->id_count++; type_info->nextid++; @@ -643,10 +665,10 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, h info->is_future = FALSE; info->realize_cb = NULL; info->discard_cb = NULL; + info->marked = FALSE; /* Insert into the type */ - if (H5SL_insert(type_info->ids, info, &info->id) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") + HASH_ADD(hh, type_info->hash_table, id, sizeof(hid_t), info); type_info->id_count++; /* Set the most recent ID to this object */ @@ -900,9 +922,17 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id) /* Sanity check */ HDassert(type_info); - /* Get the ID node for the ID */ - if (NULL == (info = (H5I_id_info_t *)H5SL_remove(type_info->ids, &id))) - HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node from skip list") + /* Delete or mark the node */ + HASH_FIND(hh, type_info->hash_table, &id, sizeof(hid_t), info); + if (info) { + HDassert(!info->marked); + if (!H5I_marking_g) + HASH_DELETE(hh, type_info->hash_table, info); + else + info->marked = TRUE; + } + else + HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node from hash table") /* Check if this ID was the last one accessed */ if (type_info->last_id_info == info) @@ -912,7 +942,8 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id) ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ H5_GCC_DIAG_ON("cast-qual") - info = H5FL_FREE(H5I_id_info_t, info); + if (!H5I_marking_g) + info = H5FL_FREE(H5I_id_info_t, info); /* Decrement the number of IDs in the type */ (type_info->id_count)--; @@ -1555,8 +1586,9 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re /* Only iterate through ID list if it is initialized and there are IDs in type */ if (type_info && type_info->init_count > 0 && type_info->id_count > 0) { - H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ - herr_t iter_status; /* Iteration status */ + H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ + H5I_id_info_t * item = NULL; + H5I_id_info_t * tmp = NULL; /* Set up iterator user data */ iter_udata.user_func = func; @@ -1565,8 +1597,16 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re iter_udata.obj_type = type; /* Iterate over IDs */ - if ((iter_status = H5SL_iterate(type_info->ids, H5I__iterate_cb, &iter_udata)) < 0) - HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed") + HASH_ITER(hh, type_info->hash_table, item, tmp) + { + if (!item->marked) { + int ret = H5I__iterate_cb((void *)item, NULL, (void *)&iter_udata); + if (H5_ITER_ERROR == ret) + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed") + if (H5_ITER_STOP == ret) + break; + } + } } done: @@ -1607,8 +1647,7 @@ H5I__find_id(hid_t id) if (type_info->last_id_info && type_info->last_id_info->id == id) id_info = type_info->last_id_info; else { - /* Locate the ID node for the ID */ - id_info = (H5I_id_info_t *)H5SL_search(type_info->ids, &id); + HASH_FIND(hh, type_info->hash_table, &id, sizeof(hid_t), id_info); /* Remember this ID */ type_info->last_id_info = id_info; @@ -1724,8 +1763,9 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) /* Only iterate through ID list if it is initialized and there are IDs in type */ if (type_info->init_count > 0 && type_info->id_count > 0) { - H5I_get_id_ud_t udata; /* User data */ - herr_t iter_status; /* Iteration status */ + H5I_get_id_ud_t udata; /* User data */ + H5I_id_info_t * item = NULL; + H5I_id_info_t * tmp = NULL; /* Set up iterator user data */ udata.object = object; @@ -1733,8 +1773,14 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) udata.ret_id = H5I_INVALID_HID; /* Iterate over IDs for the ID type */ - if ((iter_status = H5SL_iterate(type_info->ids, H5I__find_id_cb, &udata)) < 0) - HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed") + HASH_ITER(hh, type_info->hash_table, item, tmp) + { + int ret = H5I__find_id_cb((void *)item, NULL, (void *)&udata); + if (H5_ITER_ERROR == ret) + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed") + if (H5_ITER_STOP == ret) + break; + } *id = udata.ret_id; } diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 0a7215b..e93ec74 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -29,8 +29,14 @@ /* Get package's private header */ #include "H5Iprivate.h" -/* Other private headers needed by this file */ -#include "H5SLprivate.h" /* Skip Lists */ +/* uthash is an external, header-only hash table implementation. + * + * We include the file directly in src/ and #define a few functions + * to use our internal memory calls. + */ +#define uthash_malloc(sz) H5MM_malloc(sz) +#define uthash_free(ptr, sz) H5MM_free(ptr) /* Ignoring sz is intentional */ +#include "uthash.h" /**************************/ /* Package Private Macros */ @@ -72,6 +78,10 @@ typedef struct H5I_id_info_t { hbool_t is_future; /* Whether this ID represents a future object */ H5I_future_realize_func_t realize_cb; /* 'realize' callback for future object */ H5I_future_discard_func_t discard_cb; /* 'discard' callback for future object */ + + /* Hash table ID fields */ + hbool_t marked; /* Marked for deletion */ + UT_hash_handle hh; /* Hash table handle (must be LAST) */ } H5I_id_info_t; /* Type information structure used */ @@ -81,7 +91,7 @@ typedef struct H5I_type_info_t { uint64_t id_count; /* Current number of IDs held */ uint64_t nextid; /* ID to use for the next object */ H5I_id_info_t * last_id_info; /* Info for most recent ID looked up */ - H5SL_t * ids; /* Pointer to skip list that stores IDs */ + H5I_id_info_t * hash_table; /* Hash table pointer for this ID type */ } H5I_type_info_t; /*****************************/ @@ -91,12 +101,13 @@ typedef struct H5I_type_info_t { /* Array of pointers to ID types */ H5_DLLVAR H5I_type_info_t *H5I_type_info_array_g[H5I_MAX_NUM_TYPES]; -/* Variable to keep track of the number of types allocated. Its value is the */ -/* next type ID to be handed out, so it is always one greater than the number */ -/* of types. */ -/* Starts at 1 instead of 0 because it makes trace output look nicer. If more */ -/* types (or IDs within a type) are needed, adjust TYPE_BITS in H5Ipkg.h */ -/* and/or increase size of hid_t */ +/* Variable to keep track of the number of types allocated. Its value is the + * next type ID to be handed out, so it is always one greater than the number + * of types. + * Starts at 1 instead of 0 because it makes trace output look nicer. If more + * types (or IDs within a type) are needed, adjust TYPE_BITS in H5Ipkg.h + * and/or increase size of hid_t + */ H5_DLLVAR int H5I_next_type_g; /******************************/ diff --git a/src/H5T.c b/src/H5T.c index 4b1d483..666c33d 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1512,7 +1512,8 @@ H5T__unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void *_udata) FUNC_ENTER_STATIC_NOERR - HDassert(dt && dt->shared); + HDassert(dt); + HDassert(dt->shared); if (H5T_STATE_IMMUTABLE == dt->shared->state) { dt->shared->state = H5T_STATE_RDONLY; diff --git a/src/uthash.h b/src/uthash.h new file mode 100644 index 0000000..8bdca55 --- /dev/null +++ b/src/uthash.h @@ -0,0 +1,1184 @@ +/* +Copyright (c) 2003-2018, Troy D. Hanson http://troydhanson.github.com/uthash/ +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef UTHASH_H +#define UTHASH_H + +#define UTHASH_VERSION 2.1.0 + +#include /* memcmp, memset, strlen */ +#include /* ptrdiff_t */ +#include /* exit */ + +/* These macros use decltype or the earlier __typeof GNU extension. + As decltype is only available in newer compilers (VS2010 or gcc 4.3+ + when compiling c++ source) this code uses whatever method is needed + or, for VS2008 where neither is available, uses casting workarounds. */ +#if !defined(DECLTYPE) && !defined(NO_DECLTYPE) +#if defined(_MSC_VER) /* MS compiler */ +#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ +#define DECLTYPE(x) (decltype(x)) +#else /* VS2008 or older (or VS2010 in C mode) */ +#define NO_DECLTYPE +#endif +#elif defined(__BORLANDC__) || defined(__ICCARM__) || defined(__LCC__) || defined(__WATCOMC__) +#define NO_DECLTYPE +#else /* GNU, Sun and other compilers */ +#define DECLTYPE(x) (__typeof(x)) +#endif +#endif + +#ifdef NO_DECLTYPE +#define DECLTYPE(x) +#define DECLTYPE_ASSIGN(dst, src) \ + do { \ + char **_da_dst = (char **)(&(dst)); \ + *_da_dst = (char *)(src); \ + } while (0) +#else +#define DECLTYPE_ASSIGN(dst, src) \ + do { \ + (dst) = DECLTYPE(dst)(src); \ + } while (0) +#endif + +/* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */ +#if defined(_WIN32) +#if defined(_MSC_VER) && _MSC_VER >= 1600 +#include +#elif defined(__WATCOMC__) || defined(__MINGW32__) || defined(__CYGWIN__) +#include +#else +typedef unsigned int uint32_t; +typedef unsigned char uint8_t; +#endif +#elif defined(__GNUC__) && !defined(__VXWORKS__) +#include +#else +typedef unsigned int uint32_t; +typedef unsigned char uint8_t; +#endif + +#ifndef uthash_malloc +#define uthash_malloc(sz) malloc(sz) /* malloc fcn */ +#endif +#ifndef uthash_free +#define uthash_free(ptr, sz) free(ptr) /* free fcn */ +#endif +#ifndef uthash_bzero +#define uthash_bzero(a, n) memset(a, '\0', n) +#endif +#ifndef uthash_strlen +#define uthash_strlen(s) strlen(s) +#endif + +#ifdef uthash_memcmp +/* This warning will not catch programs that define uthash_memcmp AFTER including uthash.h. */ +#warning "uthash_memcmp is deprecated; please use HASH_KEYCMP instead" +#else +#define uthash_memcmp(a, b, n) memcmp(a, b, n) +#endif + +#ifndef HASH_KEYCMP +#define HASH_KEYCMP(a, b, n) uthash_memcmp(a, b, n) +#endif + +#ifndef uthash_noexpand_fyi +#define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ +#endif +#ifndef uthash_expand_fyi +#define uthash_expand_fyi(tbl) /* can be defined to log expands */ +#endif + +#ifndef HASH_NONFATAL_OOM +#define HASH_NONFATAL_OOM 0 +#endif + +#if HASH_NONFATAL_OOM +/* malloc failures can be recovered from */ + +#ifndef uthash_nonfatal_oom +#define uthash_nonfatal_oom(obj) \ + do { \ + } while (0) /* non-fatal OOM error */ +#endif + +#define HASH_RECORD_OOM(oomed) \ + do { \ + (oomed) = 1; \ + } while (0) +#define IF_HASH_NONFATAL_OOM(x) x + +#else +/* malloc failures result in lost memory, hash tables are unusable */ + +#ifndef uthash_fatal +#define uthash_fatal(msg) exit(-1) /* fatal OOM error */ +#endif + +#define HASH_RECORD_OOM(oomed) uthash_fatal("out of memory") +#define IF_HASH_NONFATAL_OOM(x) + +#endif + +/* initial number of buckets */ +#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ +#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */ +#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ + +/* calculate the element whose hash handle address is hhp */ +#define ELMT_FROM_HH(tbl, hhp) ((void *)(((char *)(hhp)) - ((tbl)->hho))) +/* calculate the hash handle from element address elp */ +#define HH_FROM_ELMT(tbl, elp) ((UT_hash_handle *)(void *)(((char *)(elp)) + ((tbl)->hho))) + +#define HASH_ROLLBACK_BKT(hh, head, itemptrhh) \ + do { \ + struct UT_hash_handle *_hd_hh_item = (itemptrhh); \ + unsigned _hd_bkt; \ + HASH_TO_BKT(_hd_hh_item->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ + (head)->hh.tbl->buckets[_hd_bkt].count++; \ + _hd_hh_item->hh_next = NULL; \ + _hd_hh_item->hh_prev = NULL; \ + } while (0) + +#define HASH_VALUE(keyptr, keylen, hashv) \ + do { \ + HASH_FCN(keyptr, keylen, hashv); \ + } while (0) + +#define HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, hashval, out) \ + do { \ + (out) = NULL; \ + if (head) { \ + unsigned _hf_bkt; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \ + if (HASH_BLOOM_TEST((head)->hh.tbl, hashval) != 0) { \ + HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[_hf_bkt], keyptr, keylen, \ + hashval, out); \ + } \ + } \ + } while (0) + +#define HASH_FIND(hh, head, keyptr, keylen, out) \ + do { \ + (out) = NULL; \ + if (head) { \ + unsigned _hf_hashv; \ + HASH_VALUE(keyptr, keylen, _hf_hashv); \ + HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, _hf_hashv, out); \ + } \ + } while (0) + +#ifdef HASH_BLOOM +#define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM) +#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN / 8UL) + (((HASH_BLOOM_BITLEN % 8UL) != 0UL) ? 1UL : 0UL) +#define HASH_BLOOM_MAKE(tbl, oomed) \ + do { \ + (tbl)->bloom_nbits = HASH_BLOOM; \ + (tbl)->bloom_bv = (uint8_t *)uthash_malloc(HASH_BLOOM_BYTELEN); \ + if (!(tbl)->bloom_bv) { \ + HASH_RECORD_OOM(oomed); \ + } \ + else { \ + uthash_bzero((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ + (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ + } \ + } while (0) + +#define HASH_BLOOM_FREE(tbl) \ + do { \ + uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ + } while (0) + +#define HASH_BLOOM_BITSET(bv, idx) (bv[(idx) / 8U] |= (1U << ((idx) % 8U))) +#define HASH_BLOOM_BITTEST(bv, idx) (bv[(idx) / 8U] & (1U << ((idx) % 8U))) + +#define HASH_BLOOM_ADD(tbl, hashv) \ + HASH_BLOOM_BITSET((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) + +#define HASH_BLOOM_TEST(tbl, hashv) \ + HASH_BLOOM_BITTEST((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) + +#else +#define HASH_BLOOM_MAKE(tbl, oomed) +#define HASH_BLOOM_FREE(tbl) +#define HASH_BLOOM_ADD(tbl, hashv) +#define HASH_BLOOM_TEST(tbl, hashv) (1) +#define HASH_BLOOM_BYTELEN 0U +#endif + +#define HASH_MAKE_TABLE(hh, head, oomed) \ + do { \ + (head)->hh.tbl = (UT_hash_table *)uthash_malloc(sizeof(UT_hash_table)); \ + if (!(head)->hh.tbl) { \ + HASH_RECORD_OOM(oomed); \ + } \ + else { \ + uthash_bzero((head)->hh.tbl, sizeof(UT_hash_table)); \ + (head)->hh.tbl->tail = &((head)->hh); \ + (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ + (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ + (head)->hh.tbl->hho = (char *)(&(head)->hh) - (char *)(head); \ + (head)->hh.tbl->buckets = \ + (UT_hash_bucket *)uthash_malloc(HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ + (head)->hh.tbl->signature = HASH_SIGNATURE; \ + if (!(head)->hh.tbl->buckets) { \ + HASH_RECORD_OOM(oomed); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + } \ + else { \ + uthash_bzero((head)->hh.tbl->buckets, \ + HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ + HASH_BLOOM_MAKE((head)->hh.tbl, oomed); \ + IF_HASH_NONFATAL_OOM(if (oomed) { \ + uthash_free((head)->hh.tbl->buckets, \ + HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + }) \ + } \ + } \ + } while (0) + +#define HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, hashval, add, replaced, cmpfcn) \ + do { \ + (replaced) = NULL; \ + HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ + if (replaced) { \ + HASH_DELETE(hh, head, replaced); \ + } \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn); \ + } while (0) + +#define HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, hashval, add, replaced) \ + do { \ + (replaced) = NULL; \ + HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ + if (replaced) { \ + HASH_DELETE(hh, head, replaced); \ + } \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add); \ + } while (0) + +#define HASH_REPLACE(hh, head, fieldname, keylen_in, add, replaced) \ + do { \ + unsigned _hr_hashv; \ + HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ + HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced); \ + } while (0) + +#define HASH_REPLACE_INORDER(hh, head, fieldname, keylen_in, add, replaced, cmpfcn) \ + do { \ + unsigned _hr_hashv; \ + HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ + HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, cmpfcn); \ + } while (0) + +#define HASH_APPEND_LIST(hh, head, add) \ + do { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ + (head)->hh.tbl->tail->next = (add); \ + (head)->hh.tbl->tail = &((add)->hh); \ + } while (0) + +#define HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn) \ + do { \ + do { \ + if (cmpfcn(DECLTYPE(head)(_hs_iter), add) > 0) { \ + break; \ + } \ + } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ + } while (0) + +#ifdef NO_DECLTYPE +#undef HASH_AKBI_INNER_LOOP +#define HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn) \ + do { \ + char *_hs_saved_head = (char *)(head); \ + do { \ + DECLTYPE_ASSIGN(head, _hs_iter); \ + if (cmpfcn(head, add) > 0) { \ + DECLTYPE_ASSIGN(head, _hs_saved_head); \ + break; \ + } \ + DECLTYPE_ASSIGN(head, _hs_saved_head); \ + } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ + } while (0) +#endif + +#if HASH_NONFATAL_OOM + +#define HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, oomed) \ + do { \ + if (!(oomed)) { \ + unsigned _ha_bkt; \ + (head)->hh.tbl->num_items++; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ + HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \ + if (oomed) { \ + HASH_ROLLBACK_BKT(hh, head, &(add)->hh); \ + HASH_DELETE_HH(hh, head, &(add)->hh); \ + (add)->hh.tbl = NULL; \ + uthash_nonfatal_oom(add); \ + } \ + else { \ + HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ + HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ + } \ + } \ + else { \ + (add)->hh.tbl = NULL; \ + uthash_nonfatal_oom(add); \ + } \ + } while (0) + +#else + +#define HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, oomed) \ + do { \ + unsigned _ha_bkt; \ + (head)->hh.tbl->num_items++; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ + HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \ + HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ + HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ + } while (0) + +#endif + +#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, hashval, add, cmpfcn) \ + do { \ + IF_HASH_NONFATAL_OOM(int _ha_oomed = 0;) \ + (add)->hh.hashv = (hashval); \ + (add)->hh.key = (char *)(keyptr); \ + (add)->hh.keylen = (unsigned)(keylen_in); \ + if (!(head)) { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = NULL; \ + HASH_MAKE_TABLE(hh, add, _ha_oomed); \ + IF_HASH_NONFATAL_OOM(if (!_ha_oomed) { ) \ + (head) = (add); \ + IF_HASH_NONFATAL_OOM( \ + }) \ + } \ + else { \ + void *_hs_iter = (head); \ + (add)->hh.tbl = (head)->hh.tbl; \ + HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn); \ + if (_hs_iter) { \ + (add)->hh.next = _hs_iter; \ + if (((add)->hh.prev = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev)) { \ + HH_FROM_ELMT((head)->hh.tbl, (add)->hh.prev)->next = (add); \ + } \ + else { \ + (head) = (add); \ + } \ + HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev = (add); \ + } \ + else { \ + HASH_APPEND_LIST(hh, head, add); \ + } \ + } \ + HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \ + HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE_INORDER"); \ + } while (0) + +#define HASH_ADD_KEYPTR_INORDER(hh, head, keyptr, keylen_in, add, cmpfcn) \ + do { \ + unsigned _hs_hashv; \ + HASH_VALUE(keyptr, keylen_in, _hs_hashv); \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, _hs_hashv, add, cmpfcn); \ + } while (0) + +#define HASH_ADD_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, hashval, add, cmpfcn) \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn) + +#define HASH_ADD_INORDER(hh, head, fieldname, keylen_in, add, cmpfcn) \ + HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn) + +#define HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, hashval, add) \ + do { \ + IF_HASH_NONFATAL_OOM(int _ha_oomed = 0;) \ + (add)->hh.hashv = (hashval); \ + (add)->hh.key = (char *)(keyptr); \ + (add)->hh.keylen = (unsigned)(keylen_in); \ + if (!(head)) { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = NULL; \ + HASH_MAKE_TABLE(hh, add, _ha_oomed); \ + IF_HASH_NONFATAL_OOM(if (!_ha_oomed) { ) \ + (head) = (add); \ + IF_HASH_NONFATAL_OOM( \ + }) \ + } \ + else { \ + (add)->hh.tbl = (head)->hh.tbl; \ + HASH_APPEND_LIST(hh, head, add); \ + } \ + HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \ + HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE"); \ + } while (0) + +#define HASH_ADD_KEYPTR(hh, head, keyptr, keylen_in, add) \ + do { \ + unsigned _ha_hashv; \ + HASH_VALUE(keyptr, keylen_in, _ha_hashv); \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, _ha_hashv, add); \ + } while (0) + +#define HASH_ADD_BYHASHVALUE(hh, head, fieldname, keylen_in, hashval, add) \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add) + +#define HASH_ADD(hh, head, fieldname, keylen_in, add) \ + HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add) + +#define HASH_TO_BKT(hashv, num_bkts, bkt) \ + do { \ + bkt = ((hashv) & ((num_bkts)-1U)); \ + } while (0) + +/* delete "delptr" from the hash table. + * "the usual" patch-up process for the app-order doubly-linked-list. + * The use of _hd_hh_del below deserves special explanation. + * These used to be expressed using (delptr) but that led to a bug + * if someone used the same symbol for the head and deletee, like + * HASH_DELETE(hh,users,users); + * We want that to work, but by changing the head (users) below + * we were forfeiting our ability to further refer to the deletee (users) + * in the patch-up process. Solution: use scratch space to + * copy the deletee pointer, then the latter references are via that + * scratch pointer rather than through the repointed (users) symbol. + */ +#define HASH_DELETE(hh, head, delptr) HASH_DELETE_HH(hh, head, &(delptr)->hh) + +#define HASH_DELETE_HH(hh, head, delptrhh) \ + do { \ + struct UT_hash_handle *_hd_hh_del = (delptrhh); \ + if ((_hd_hh_del->prev == NULL) && (_hd_hh_del->next == NULL)) { \ + HASH_BLOOM_FREE((head)->hh.tbl); \ + uthash_free((head)->hh.tbl->buckets, \ + (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + (head) = NULL; \ + } \ + else { \ + unsigned _hd_bkt; \ + if (_hd_hh_del == (head)->hh.tbl->tail) { \ + (head)->hh.tbl->tail = HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev); \ + } \ + if (_hd_hh_del->prev != NULL) { \ + HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev)->next = _hd_hh_del->next; \ + } \ + else { \ + DECLTYPE_ASSIGN(head, _hd_hh_del->next); \ + } \ + if (_hd_hh_del->next != NULL) { \ + HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->next)->prev = _hd_hh_del->prev; \ + } \ + HASH_TO_BKT(_hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ + HASH_DEL_IN_BKT((head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ + (head)->hh.tbl->num_items--; \ + } \ + HASH_FSCK(hh, head, "HASH_DELETE_HH"); \ + } while (0) + +/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ +#define HASH_FIND_STR(head, findstr, out) \ + do { \ + unsigned _uthash_hfstr_keylen = (unsigned)uthash_strlen(findstr); \ + HASH_FIND(hh, head, findstr, _uthash_hfstr_keylen, out); \ + } while (0) +#define HASH_ADD_STR(head, strfield, add) \ + do { \ + unsigned _uthash_hastr_keylen = (unsigned)uthash_strlen((add)->strfield); \ + HASH_ADD(hh, head, strfield[0], _uthash_hastr_keylen, add); \ + } while (0) +#define HASH_REPLACE_STR(head, strfield, add, replaced) \ + do { \ + unsigned _uthash_hrstr_keylen = (unsigned)uthash_strlen((add)->strfield); \ + HASH_REPLACE(hh, head, strfield[0], _uthash_hrstr_keylen, add, replaced); \ + } while (0) +#define HASH_FIND_INT(head, findint, out) HASH_FIND(hh, head, findint, sizeof(int), out) +#define HASH_ADD_INT(head, intfield, add) HASH_ADD(hh, head, intfield, sizeof(int), add) +#define HASH_REPLACE_INT(head, intfield, add, replaced) \ + HASH_REPLACE(hh, head, intfield, sizeof(int), add, replaced) +#define HASH_FIND_PTR(head, findptr, out) HASH_FIND(hh, head, findptr, sizeof(void *), out) +#define HASH_ADD_PTR(head, ptrfield, add) HASH_ADD(hh, head, ptrfield, sizeof(void *), add) +#define HASH_REPLACE_PTR(head, ptrfield, add, replaced) \ + HASH_REPLACE(hh, head, ptrfield, sizeof(void *), add, replaced) +#define HASH_DEL(head, delptr) HASH_DELETE(hh, head, delptr) + +/* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined. + * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. + */ +#ifdef HASH_DEBUG +#include /* fprintf, stderr */ +#define HASH_OOPS(...) \ + do { \ + fprintf(stderr, __VA_ARGS__); \ + exit(-1); \ + } while (0) +#define HASH_FSCK(hh, head, where) \ + do { \ + struct UT_hash_handle *_thh; \ + if (head) { \ + unsigned _bkt_i; \ + unsigned _count = 0; \ + char * _prev; \ + for (_bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; ++_bkt_i) { \ + unsigned _bkt_count = 0; \ + _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ + _prev = NULL; \ + while (_thh) { \ + if (_prev != (char *)(_thh->hh_prev)) { \ + HASH_OOPS("%s: invalid hh_prev %p, actual %p\n", (where), (void *)_thh->hh_prev, \ + (void *)_prev); \ + } \ + _bkt_count++; \ + _prev = (char *)(_thh); \ + _thh = _thh->hh_next; \ + } \ + _count += _bkt_count; \ + if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ + HASH_OOPS("%s: invalid bucket count %u, actual %u\n", (where), \ + (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ + } \ + } \ + if (_count != (head)->hh.tbl->num_items) { \ + HASH_OOPS("%s: invalid hh item count %u, actual %u\n", (where), (head)->hh.tbl->num_items, \ + _count); \ + } \ + _count = 0; \ + _prev = NULL; \ + _thh = &(head)->hh; \ + while (_thh) { \ + _count++; \ + if (_prev != (char *)_thh->prev) { \ + HASH_OOPS("%s: invalid prev %p, actual %p\n", (where), (void *)_thh->prev, \ + (void *)_prev); \ + } \ + _prev = (char *)ELMT_FROM_HH((head)->hh.tbl, _thh); \ + _thh = (_thh->next ? HH_FROM_ELMT((head)->hh.tbl, _thh->next) : NULL); \ + } \ + if (_count != (head)->hh.tbl->num_items) { \ + HASH_OOPS("%s: invalid app item count %u, actual %u\n", (where), (head)->hh.tbl->num_items, \ + _count); \ + } \ + } \ + } while (0) +#else +#define HASH_FSCK(hh, head, where) +#endif + +/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to + * the descriptor to which this macro is defined for tuning the hash function. + * The app can #include to get the prototype for write(2). */ +#ifdef HASH_EMIT_KEYS +#define HASH_EMIT_KEY(hh, head, keyptr, fieldlen) \ + do { \ + unsigned _klen = fieldlen; \ + write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ + write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \ + } while (0) +#else +#define HASH_EMIT_KEY(hh, head, keyptr, fieldlen) +#endif + +/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ +#ifdef HASH_FUNCTION +#define HASH_FCN HASH_FUNCTION +#else +#define HASH_FCN HASH_JEN +#endif + +/* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */ +#define HASH_BER(key, keylen, hashv) \ + do { \ + unsigned _hb_keylen = (unsigned)keylen; \ + const unsigned char *_hb_key = (const unsigned char *)(key); \ + (hashv) = 0; \ + while (_hb_keylen-- != 0U) { \ + (hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \ + } \ + } while (0) + +/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at + * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ +#define HASH_SAX(key, keylen, hashv) \ + do { \ + unsigned _sx_i; \ + const unsigned char *_hs_key = (const unsigned char *)(key); \ + hashv = 0; \ + for (_sx_i = 0; _sx_i < keylen; _sx_i++) { \ + hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ + } \ + } while (0) +/* FNV-1a variation */ +#define HASH_FNV(key, keylen, hashv) \ + do { \ + unsigned _fn_i; \ + const unsigned char *_hf_key = (const unsigned char *)(key); \ + (hashv) = 2166136261U; \ + for (_fn_i = 0; _fn_i < keylen; _fn_i++) { \ + hashv = hashv ^ _hf_key[_fn_i]; \ + hashv = hashv * 16777619U; \ + } \ + } while (0) + +#define HASH_OAT(key, keylen, hashv) \ + do { \ + unsigned _ho_i; \ + const unsigned char *_ho_key = (const unsigned char *)(key); \ + hashv = 0; \ + for (_ho_i = 0; _ho_i < keylen; _ho_i++) { \ + hashv += _ho_key[_ho_i]; \ + hashv += (hashv << 10); \ + hashv ^= (hashv >> 6); \ + } \ + hashv += (hashv << 3); \ + hashv ^= (hashv >> 11); \ + hashv += (hashv << 15); \ + } while (0) + +#define HASH_JEN_MIX(a, b, c) \ + do { \ + a -= b; \ + a -= c; \ + a ^= (c >> 13); \ + b -= c; \ + b -= a; \ + b ^= (a << 8); \ + c -= a; \ + c -= b; \ + c ^= (b >> 13); \ + a -= b; \ + a -= c; \ + a ^= (c >> 12); \ + b -= c; \ + b -= a; \ + b ^= (a << 16); \ + c -= a; \ + c -= b; \ + c ^= (b >> 5); \ + a -= b; \ + a -= c; \ + a ^= (c >> 3); \ + b -= c; \ + b -= a; \ + b ^= (a << 10); \ + c -= a; \ + c -= b; \ + c ^= (b >> 15); \ + } while (0) + +#define HASH_JEN(key, keylen, hashv) \ + do { \ + unsigned _hj_i, _hj_j, _hj_k; \ + unsigned const char *_hj_key = (unsigned const char *)(key); \ + hashv = 0xfeedbeefu; \ + _hj_i = _hj_j = 0x9e3779b9u; \ + _hj_k = (unsigned)(keylen); \ + while (_hj_k >= 12U) { \ + _hj_i += (_hj_key[0] + ((unsigned)_hj_key[1] << 8) + ((unsigned)_hj_key[2] << 16) + \ + ((unsigned)_hj_key[3] << 24)); \ + _hj_j += (_hj_key[4] + ((unsigned)_hj_key[5] << 8) + ((unsigned)_hj_key[6] << 16) + \ + ((unsigned)_hj_key[7] << 24)); \ + hashv += (_hj_key[8] + ((unsigned)_hj_key[9] << 8) + ((unsigned)_hj_key[10] << 16) + \ + ((unsigned)_hj_key[11] << 24)); \ + \ + HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ + \ + _hj_key += 12; \ + _hj_k -= 12U; \ + } \ + hashv += (unsigned)(keylen); \ + switch (_hj_k) { \ + case 11: \ + hashv += ((unsigned)_hj_key[10] << 24); /* FALLTHROUGH */ \ + case 10: \ + hashv += ((unsigned)_hj_key[9] << 16); /* FALLTHROUGH */ \ + case 9: \ + hashv += ((unsigned)_hj_key[8] << 8); /* FALLTHROUGH */ \ + case 8: \ + _hj_j += ((unsigned)_hj_key[7] << 24); /* FALLTHROUGH */ \ + case 7: \ + _hj_j += ((unsigned)_hj_key[6] << 16); /* FALLTHROUGH */ \ + case 6: \ + _hj_j += ((unsigned)_hj_key[5] << 8); /* FALLTHROUGH */ \ + case 5: \ + _hj_j += _hj_key[4]; /* FALLTHROUGH */ \ + case 4: \ + _hj_i += ((unsigned)_hj_key[3] << 24); /* FALLTHROUGH */ \ + case 3: \ + _hj_i += ((unsigned)_hj_key[2] << 16); /* FALLTHROUGH */ \ + case 2: \ + _hj_i += ((unsigned)_hj_key[1] << 8); /* FALLTHROUGH */ \ + case 1: \ + _hj_i += _hj_key[0]; \ + } \ + HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ + } while (0) + +/* The Paul Hsieh hash function */ +#undef get16bits +#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) || defined(_MSC_VER) || \ + defined(__BORLANDC__) || defined(__TURBOC__) +#define get16bits(d) (*((const uint16_t *)(d))) +#endif + +#if !defined(get16bits) +#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) + (uint32_t)(((const uint8_t *)(d))[0])) +#endif +#define HASH_SFH(key, keylen, hashv) \ + do { \ + unsigned const char *_sfh_key = (unsigned const char *)(key); \ + uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \ + \ + unsigned _sfh_rem = _sfh_len & 3U; \ + _sfh_len >>= 2; \ + hashv = 0xcafebabeu; \ + \ + /* Main loop */ \ + for (; _sfh_len > 0U; _sfh_len--) { \ + hashv += get16bits(_sfh_key); \ + _sfh_tmp = ((uint32_t)(get16bits(_sfh_key + 2)) << 11) ^ hashv; \ + hashv = (hashv << 16) ^ _sfh_tmp; \ + _sfh_key += 2U * sizeof(uint16_t); \ + hashv += hashv >> 11; \ + } \ + \ + /* Handle end cases */ \ + switch (_sfh_rem) { \ + case 3: \ + hashv += get16bits(_sfh_key); \ + hashv ^= hashv << 16; \ + hashv ^= (uint32_t)(_sfh_key[sizeof(uint16_t)]) << 18; \ + hashv += hashv >> 11; \ + break; \ + case 2: \ + hashv += get16bits(_sfh_key); \ + hashv ^= hashv << 11; \ + hashv += hashv >> 17; \ + break; \ + case 1: \ + hashv += *_sfh_key; \ + hashv ^= hashv << 10; \ + hashv += hashv >> 1; \ + } \ + \ + /* Force "avalanching" of final 127 bits */ \ + hashv ^= hashv << 3; \ + hashv += hashv >> 5; \ + hashv ^= hashv << 4; \ + hashv += hashv >> 17; \ + hashv ^= hashv << 25; \ + hashv += hashv >> 6; \ + } while (0) + +/* iterate over items in a known bucket to find desired item */ +#define HASH_FIND_IN_BKT(tbl, hh, head, keyptr, keylen_in, hashval, out) \ + do { \ + if ((head).hh_head != NULL) { \ + DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (head).hh_head)); \ + } \ + else { \ + (out) = NULL; \ + } \ + while ((out) != NULL) { \ + if ((out)->hh.hashv == (hashval) && (out)->hh.keylen == (keylen_in)) { \ + if (HASH_KEYCMP((out)->hh.key, keyptr, keylen_in) == 0) { \ + break; \ + } \ + } \ + if ((out)->hh.hh_next != NULL) { \ + DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (out)->hh.hh_next)); \ + } \ + else { \ + (out) = NULL; \ + } \ + } \ + } while (0) + +/* add an item to a bucket */ +#define HASH_ADD_TO_BKT(head, hh, addhh, oomed) \ + do { \ + UT_hash_bucket *_ha_head = &(head); \ + _ha_head->count++; \ + (addhh)->hh_next = _ha_head->hh_head; \ + (addhh)->hh_prev = NULL; \ + if (_ha_head->hh_head != NULL) { \ + _ha_head->hh_head->hh_prev = (addhh); \ + } \ + _ha_head->hh_head = (addhh); \ + if ((_ha_head->count >= ((_ha_head->expand_mult + 1U) * HASH_BKT_CAPACITY_THRESH)) && \ + !(addhh)->tbl->noexpand) { \ + HASH_EXPAND_BUCKETS(addhh, (addhh)->tbl, oomed); \ + IF_HASH_NONFATAL_OOM(if (oomed) { HASH_DEL_IN_BKT(head, addhh); }) \ + } \ + } while (0) + +/* remove an item from a given bucket */ +#define HASH_DEL_IN_BKT(head, delhh) \ + do { \ + UT_hash_bucket *_hd_head = &(head); \ + _hd_head->count--; \ + if (_hd_head->hh_head == (delhh)) { \ + _hd_head->hh_head = (delhh)->hh_next; \ + } \ + if ((delhh)->hh_prev) { \ + (delhh)->hh_prev->hh_next = (delhh)->hh_next; \ + } \ + if ((delhh)->hh_next) { \ + (delhh)->hh_next->hh_prev = (delhh)->hh_prev; \ + } \ + } while (0) + +/* Bucket expansion has the effect of doubling the number of buckets + * and redistributing the items into the new buckets. Ideally the + * items will distribute more or less evenly into the new buckets + * (the extent to which this is true is a measure of the quality of + * the hash function as it applies to the key domain). + * + * With the items distributed into more buckets, the chain length + * (item count) in each bucket is reduced. Thus by expanding buckets + * the hash keeps a bound on the chain length. This bounded chain + * length is the essence of how a hash provides constant time lookup. + * + * The calculation of tbl->ideal_chain_maxlen below deserves some + * explanation. First, keep in mind that we're calculating the ideal + * maximum chain length based on the *new* (doubled) bucket count. + * In fractions this is just n/b (n=number of items,b=new num buckets). + * Since the ideal chain length is an integer, we want to calculate + * ceil(n/b). We don't depend on floating point arithmetic in this + * hash, so to calculate ceil(n/b) with integers we could write + * + * ceil(n/b) = (n/b) + ((n%b)?1:0) + * + * and in fact a previous version of this hash did just that. + * But now we have improved things a bit by recognizing that b is + * always a power of two. We keep its base 2 log handy (call it lb), + * so now we can write this with a bit shift and logical AND: + * + * ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0) + * + */ +#define HASH_EXPAND_BUCKETS(hh, tbl, oomed) \ + do { \ + unsigned _he_bkt; \ + unsigned _he_bkt_i; \ + struct UT_hash_handle *_he_thh, *_he_hh_nxt; \ + UT_hash_bucket * _he_new_buckets, *_he_newbkt; \ + _he_new_buckets = \ + (UT_hash_bucket *)uthash_malloc(2UL * (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ + if (!_he_new_buckets) { \ + HASH_RECORD_OOM(oomed); \ + } \ + else { \ + uthash_bzero(_he_new_buckets, 2UL * (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ + (tbl)->ideal_chain_maxlen = \ + ((tbl)->num_items >> ((tbl)->log2_num_buckets + 1U)) + \ + ((((tbl)->num_items & (((tbl)->num_buckets * 2U) - 1U)) != 0U) ? 1U : 0U); \ + (tbl)->nonideal_items = 0; \ + for (_he_bkt_i = 0; _he_bkt_i < (tbl)->num_buckets; _he_bkt_i++) { \ + _he_thh = (tbl)->buckets[_he_bkt_i].hh_head; \ + while (_he_thh != NULL) { \ + _he_hh_nxt = _he_thh->hh_next; \ + HASH_TO_BKT(_he_thh->hashv, (tbl)->num_buckets * 2U, _he_bkt); \ + _he_newbkt = &(_he_new_buckets[_he_bkt]); \ + if (++(_he_newbkt->count) > (tbl)->ideal_chain_maxlen) { \ + (tbl)->nonideal_items++; \ + if (_he_newbkt->count > _he_newbkt->expand_mult * (tbl)->ideal_chain_maxlen) { \ + _he_newbkt->expand_mult++; \ + } \ + } \ + _he_thh->hh_prev = NULL; \ + _he_thh->hh_next = _he_newbkt->hh_head; \ + if (_he_newbkt->hh_head != NULL) { \ + _he_newbkt->hh_head->hh_prev = _he_thh; \ + } \ + _he_newbkt->hh_head = _he_thh; \ + _he_thh = _he_hh_nxt; \ + } \ + } \ + uthash_free((tbl)->buckets, (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ + (tbl)->num_buckets *= 2U; \ + (tbl)->log2_num_buckets++; \ + (tbl)->buckets = _he_new_buckets; \ + (tbl)->ineff_expands = \ + ((tbl)->nonideal_items > ((tbl)->num_items >> 1)) ? ((tbl)->ineff_expands + 1U) : 0U; \ + if ((tbl)->ineff_expands > 1U) { \ + (tbl)->noexpand = 1; \ + uthash_noexpand_fyi(tbl); \ + } \ + uthash_expand_fyi(tbl); \ + } \ + } while (0) + +/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */ +/* Note that HASH_SORT assumes the hash handle name to be hh. + * HASH_SRT was added to allow the hash handle name to be passed in. */ +#define HASH_SORT(head, cmpfcn) HASH_SRT(hh, head, cmpfcn) +#define HASH_SRT(hh, head, cmpfcn) \ + do { \ + unsigned _hs_i; \ + unsigned _hs_looping, _hs_nmerges, _hs_insize, _hs_psize, _hs_qsize; \ + struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \ + if (head != NULL) { \ + _hs_insize = 1; \ + _hs_looping = 1; \ + _hs_list = &((head)->hh); \ + while (_hs_looping != 0U) { \ + _hs_p = _hs_list; \ + _hs_list = NULL; \ + _hs_tail = NULL; \ + _hs_nmerges = 0; \ + while (_hs_p != NULL) { \ + _hs_nmerges++; \ + _hs_q = _hs_p; \ + _hs_psize = 0; \ + for (_hs_i = 0; _hs_i < _hs_insize; ++_hs_i) { \ + _hs_psize++; \ + _hs_q = ((_hs_q->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ + if (_hs_q == NULL) { \ + break; \ + } \ + } \ + _hs_qsize = _hs_insize; \ + while ((_hs_psize != 0U) || ((_hs_qsize != 0U) && (_hs_q != NULL))) { \ + if (_hs_psize == 0U) { \ + _hs_e = _hs_q; \ + _hs_q = \ + ((_hs_q->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ + _hs_qsize--; \ + } \ + else if ((_hs_qsize == 0U) || (_hs_q == NULL)) { \ + _hs_e = _hs_p; \ + if (_hs_p != NULL) { \ + _hs_p = ((_hs_p->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_p->next) \ + : NULL); \ + } \ + _hs_psize--; \ + } \ + else if ((cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_p)), \ + DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_q)))) <= 0) { \ + _hs_e = _hs_p; \ + if (_hs_p != NULL) { \ + _hs_p = ((_hs_p->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_p->next) \ + : NULL); \ + } \ + _hs_psize--; \ + } \ + else { \ + _hs_e = _hs_q; \ + _hs_q = \ + ((_hs_q->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ + _hs_qsize--; \ + } \ + if (_hs_tail != NULL) { \ + _hs_tail->next = ((_hs_e != NULL) ? ELMT_FROM_HH((head)->hh.tbl, _hs_e) : NULL); \ + } \ + else { \ + _hs_list = _hs_e; \ + } \ + if (_hs_e != NULL) { \ + _hs_e->prev = \ + ((_hs_tail != NULL) ? ELMT_FROM_HH((head)->hh.tbl, _hs_tail) : NULL); \ + } \ + _hs_tail = _hs_e; \ + } \ + _hs_p = _hs_q; \ + } \ + if (_hs_tail != NULL) { \ + _hs_tail->next = NULL; \ + } \ + if (_hs_nmerges <= 1U) { \ + _hs_looping = 0; \ + (head)->hh.tbl->tail = _hs_tail; \ + DECLTYPE_ASSIGN(head, ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \ + } \ + _hs_insize *= 2U; \ + } \ + HASH_FSCK(hh, head, "HASH_SRT"); \ + } \ + } while (0) + +/* This function selects items from one hash into another hash. + * The end result is that the selected items have dual presence + * in both hashes. There is no copy of the items made; rather + * they are added into the new hash through a secondary hash + * hash handle that must be present in the structure. */ +#define HASH_SELECT(hh_dst, dst, hh_src, src, cond) \ + do { \ + unsigned _src_bkt, _dst_bkt; \ + void * _last_elt = NULL, *_elt; \ + UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh = NULL; \ + ptrdiff_t _dst_hho = ((char *)(&(dst)->hh_dst) - (char *)(dst)); \ + if ((src) != NULL) { \ + for (_src_bkt = 0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \ + for (_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; _src_hh != NULL; \ + _src_hh = _src_hh->hh_next) { \ + _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \ + if (cond(_elt)) { \ + IF_HASH_NONFATAL_OOM(int _hs_oomed = 0;) \ + _dst_hh = (UT_hash_handle *)(void *)(((char *)_elt) + _dst_hho); \ + _dst_hh->key = _src_hh->key; \ + _dst_hh->keylen = _src_hh->keylen; \ + _dst_hh->hashv = _src_hh->hashv; \ + _dst_hh->prev = _last_elt; \ + _dst_hh->next = NULL; \ + if (_last_elt_hh != NULL) { \ + _last_elt_hh->next = _elt; \ + } \ + if ((dst) == NULL) { \ + DECLTYPE_ASSIGN(dst, _elt); \ + HASH_MAKE_TABLE(hh_dst, dst, _hs_oomed); \ + IF_HASH_NONFATAL_OOM(if (_hs_oomed) { \ + uthash_nonfatal_oom(_elt); \ + (dst) = NULL; \ + continue; \ + }) \ + } \ + else { \ + _dst_hh->tbl = (dst)->hh_dst.tbl; \ + } \ + HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \ + HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt], hh_dst, _dst_hh, _hs_oomed); \ + (dst)->hh_dst.tbl->num_items++; \ + IF_HASH_NONFATAL_OOM(if (_hs_oomed) { \ + HASH_ROLLBACK_BKT(hh_dst, dst, _dst_hh); \ + HASH_DELETE_HH(hh_dst, dst, _dst_hh); \ + _dst_hh->tbl = NULL; \ + uthash_nonfatal_oom(_elt); \ + continue; \ + }) \ + HASH_BLOOM_ADD(_dst_hh->tbl, _dst_hh->hashv); \ + _last_elt = _elt; \ + _last_elt_hh = _dst_hh; \ + } \ + } \ + } \ + } \ + HASH_FSCK(hh_dst, dst, "HASH_SELECT"); \ + } while (0) + +#define HASH_CLEAR(hh, head) \ + do { \ + if ((head) != NULL) { \ + HASH_BLOOM_FREE((head)->hh.tbl); \ + uthash_free((head)->hh.tbl->buckets, \ + (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + (head) = NULL; \ + } \ + } while (0) + +#define HASH_OVERHEAD(hh, head) \ + (((head) != NULL) ? ((size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \ + ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \ + sizeof(UT_hash_table) + (HASH_BLOOM_BYTELEN))) \ + : 0U) + +#ifdef NO_DECLTYPE +#define HASH_ITER(hh, head, el, tmp) \ + for (((el) = (head)), ((*(char **)(&(tmp))) = (char *)((head != NULL) ? (head)->hh.next : NULL)); \ + (el) != NULL; \ + ((el) = (tmp)), ((*(char **)(&(tmp))) = (char *)((tmp != NULL) ? (tmp)->hh.next : NULL))) +#else +#define HASH_ITER(hh, head, el, tmp) \ + for (((el) = (head)), ((tmp) = DECLTYPE(el)((head != NULL) ? (head)->hh.next : NULL)); (el) != NULL; \ + ((el) = (tmp)), ((tmp) = DECLTYPE(el)((tmp != NULL) ? (tmp)->hh.next : NULL))) +#endif + +/* obtain a count of items in the hash */ +#define HASH_COUNT(head) HASH_CNT(hh, head) +#define HASH_CNT(hh, head) ((head != NULL) ? ((head)->hh.tbl->num_items) : 0U) + +typedef struct UT_hash_bucket { + struct UT_hash_handle *hh_head; + unsigned count; + + /* expand_mult is normally set to 0. In this situation, the max chain length + * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If + * the bucket's chain exceeds this length, bucket expansion is triggered). + * However, setting expand_mult to a non-zero value delays bucket expansion + * (that would be triggered by additions to this particular bucket) + * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH. + * (The multiplier is simply expand_mult+1). The whole idea of this + * multiplier is to reduce bucket expansions, since they are expensive, in + * situations where we know that a particular bucket tends to be overused. + * It is better to let its chain length grow to a longer yet-still-bounded + * value, than to do an O(n) bucket expansion too often. + */ + unsigned expand_mult; + +} UT_hash_bucket; + +/* random signature used only to find hash tables in external analysis */ +#define HASH_SIGNATURE 0xa0111fe1u +#define HASH_BLOOM_SIGNATURE 0xb12220f2u + +typedef struct UT_hash_table { + UT_hash_bucket * buckets; + unsigned num_buckets, log2_num_buckets; + unsigned num_items; + struct UT_hash_handle *tail; /* tail hh in app order, for fast append */ + ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */ + + /* in an ideal situation (all buckets used equally), no bucket would have + * more than ceil(#items/#buckets) items. that's the ideal chain length. */ + unsigned ideal_chain_maxlen; + + /* nonideal_items is the number of items in the hash whose chain position + * exceeds the ideal chain maxlen. these items pay the penalty for an uneven + * hash distribution; reaching them in a chain traversal takes >ideal steps */ + unsigned nonideal_items; + + /* ineffective expands occur when a bucket doubling was performed, but + * afterward, more than half the items in the hash had nonideal chain + * positions. If this happens on two consecutive expansions we inhibit any + * further expansion, as it's not helping; this happens when the hash + * function isn't a good fit for the key domain. When expansion is inhibited + * the hash will still work, albeit no longer in constant time. */ + unsigned ineff_expands, noexpand; + + uint32_t signature; /* used only to find hash tables in external analysis */ +#ifdef HASH_BLOOM + uint32_t bloom_sig; /* used only to test bloom exists in external analysis */ + uint8_t *bloom_bv; + uint8_t bloom_nbits; +#endif + +} UT_hash_table; + +typedef struct UT_hash_handle { + struct UT_hash_table * tbl; + void * prev; /* prev element in app order */ + void * next; /* next element in app order */ + struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ + struct UT_hash_handle *hh_next; /* next hh in bucket order */ + void * key; /* ptr to enclosing struct's key */ + unsigned keylen; /* enclosing struct's key len */ + unsigned hashv; /* result of hash-fcn(key) */ +} UT_hash_handle; + +#endif /* UTHASH_H */ diff --git a/test/tid.c b/test/tid.c index 1f30a4f..0a45116 100644 --- a/test/tid.c +++ b/test/tid.c @@ -715,7 +715,7 @@ test_remove_clear_type(void) for (i = 0; i < RCT_NITER; i++) { /* The number of members in the type, according to the HDF5 library */ - hsize_t nmembers = 1234567; + hsize_t nmembers = 1234567; /* (init to fake number) */ /* The number of objects found while scanning through the object list */ int found; @@ -801,7 +801,7 @@ test_remove_clear_type(void) if (ret == FAIL) goto error; VERIFY(nmembers, found, "The number of members remaining in the type did not match our count"); - if (nmembers != found) + if (nmembers != (hsize_t)found) goto error; /***************************************** -- cgit v0.12 From dc639bddb8a8a59d28de6d800f26e53e19b93db3 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 4 May 2021 16:56:33 -0400 Subject: Made private my_yyinput function static (#618) This prevents it being exported as a public symbol. --- hl/src/H5LTanalyze.c | 4 ++-- hl/src/H5LTanalyze.l | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 65da9d0..875a37a 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -916,7 +916,7 @@ char *yytext; #include "H5LTparse.h" static char *trim_quotes(const char *); -int my_yyinput(char *, int); +static int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) #define token(x) (int)x @@ -2554,7 +2554,7 @@ trim_quotes(const char *quoted) return trimmed; } -int my_yyinput(char *buf, int max_size) +static int my_yyinput(char *buf, int max_size) { int ret; diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index fd1cbe5..5006612 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -27,7 +27,7 @@ #include "H5LTparse.h" static char *trim_quotes(const char *); -int my_yyinput(char *, int); +static int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) #define token(x) (int)x @@ -144,7 +144,7 @@ trim_quotes(const char *quoted) return trimmed; } -int my_yyinput(char *buf, int max_size) +static int my_yyinput(char *buf, int max_size) { int ret; -- cgit v0.12 From 2f79e3f2df47a576e72ca019bb0addb1c0fea04e Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 4 May 2021 17:43:19 -0500 Subject: doygen adjustments (#614) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- Makefile.am | 16 ++++----- configure.ac | 5 +-- doxygen/Doxyfile.in | 2 +- release_docs/INSTALL | 13 +++++++ src/CMakeLists.txt | 14 ++++++-- src/H5Apublic.h | 98 ++++++++++++++++++++++++++-------------------------- src/H5Epublic.h | 6 ++-- src/H5Mpublic.h | 30 ++++++++-------- src/H5Ppublic.h | 16 ++++----- src/H5public.h | 4 +-- src/Makefile.am | 8 ----- 11 files changed, 112 insertions(+), 100 deletions(-) diff --git a/Makefile.am b/Makefile.am index cc38972..8518114 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,6 +35,9 @@ include $(top_srcdir)/config/commence.am +# include Doxygen rules (requires autoconf-archive >2016-03-20) +@DX_RULES@ + # Define subdirectories to build. ## Automake understands that `make distclean' should recurse into ## conditional subdirectories even if `make all' does not. @@ -187,15 +190,10 @@ check-all-install: trace: @(cd src && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; -# Run doxygen across source files. -# Currently, only invoke doxygen in the src directory. -doxygen: - @echo Invoking doxygen - for d in src; do \ - if test $$d != .; then \ - (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - fi; \ - done +# doxygen support +if BUILD_DOXYGEN_CONDITIONAL +doxygen: doxygen-doc +endif # Run tests with different Virtual File Drivers. # Currently, only invoke check-vfd in the test directory. diff --git a/configure.ac b/configure.ac index b6694ad..2df2b90 100644 --- a/configure.ac +++ b/configure.ac @@ -1126,6 +1126,7 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then AC_SUBST([DOXYGEN_EXTERNAL_SEARCH]) AC_SUBST([DOXYGEN_SEARCHENGINE_URL]) +# SRCDIR Environment variables used inside doxygen macro for the source location: DOXYGEN_PACKAGE=${PACKAGE_NAME} DOXYGEN_VERSION_STRING=${PACKAGE_VERSION} DOXYGEN_INCLUDE_ALIASES='$(SRCDIR)/doxygen/aliases' @@ -1135,7 +1136,7 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then DOXYGEN_OPTIMIZE_OUTPUT_FOR_C=YES DOXYGEN_MACRO_EXPANSION=YES DOXYGEN_OUTPUT_DIRECTORY=hdf5lib_docs - DOXYGEN_EXAMPLES_DIRECTORY='$(SRCDIR)/doxygen/examples' + DOXYGEN_EXAMPLES_DIRECTORY='$(SRCDIR)/doxygen/examples $(SRCDIR)/src $(SRCDIR)/examples $(SRCDIR)/test' DOXYGEN_LAYOUT_FILE='$(SRCDIR)/doxygen/hdf5doxy_layout.xml' DOXYGEN_HTML_HEADER='$(SRCDIR)/doxygen/hdf5_header.html' DOXYGEN_HTML_FOOTER='$(SRCDIR)/doxygen/hdf5_footer.html' @@ -1145,7 +1146,7 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then DOXYGEN_EXTERNAL_SEARCH=NO DOXYGEN_SEARCHENGINE_URL= - DX_INIT_DOXYGEN([HDF5], [../doxygen/Doxyfile], [hdf5lib_docs]) + DX_INIT_DOXYGEN([HDF5], [./doxygen/Doxyfile], [hdf5lib_docs]) else AC_MSG_RESULT([no]) diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in index b1cb955..29f3028 100644 --- a/doxygen/Doxyfile.in +++ b/doxygen/Doxyfile.in @@ -917,7 +917,7 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = ../src ../examples ../test @DOXYGEN_EXAMPLES_DIRECTORY@ +EXAMPLE_PATH = @DOXYGEN_EXAMPLES_DIRECTORY@ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and diff --git a/release_docs/INSTALL b/release_docs/INSTALL index 9546615..c9f7d4c 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL @@ -450,6 +450,19 @@ CONTENTS $ make -j -l6 +4.4. Building doxygen + One can optionally build the doxygen files for the HDF5 C library. + By default, this option is disabled. To build the html files, specify + '--enable-doxygen'. + + $ ./configure --enable-doxygen + + Configuration will halt if the required applications are not available. + To build: + + $ make doxygen + + 4.5. Testing HDF5 comes with various test suites, all of which can be run by specifying: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9bacd6b..b648e26 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1390,8 +1390,8 @@ endif () # Option to build documentation #----------------------------------------------------------------------------- if (DOXYGEN_FOUND) - set (DOXYGEN_PACKAGE ${HDF5_PACKAGE}) - set (DOXYGEN_VERSION_STRING ${HDF5_VERSION_STRING}) + 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) @@ -1401,7 +1401,15 @@ if (DOXYGEN_FOUND) 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) + 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 diff --git a/src/H5Apublic.h b/src/H5Apublic.h index 2d58cdf..b3da77f 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -89,6 +89,13 @@ extern "C" { * \see H5Acreate(), H5Aopen() */ H5_DLL herr_t H5Aclose(hid_t attr_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aclose} + */ +H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, + hid_t es_id); /* --------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -195,6 +202,15 @@ H5_DLL hid_t H5Acreate_async(const char *app_file, const char *app_func, unsigne */ H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Acreate_by_name} + */ +H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app_line, + hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, + hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id, + hid_t es_id); /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -316,6 +332,13 @@ H5_DLL herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char * * */ H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aexists} + */ +H5_DLL herr_t H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, + const char *attr_name, hbool_t *exists, hid_t es_id); /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -349,6 +372,14 @@ H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name); * */ H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *attr_name, hid_t lapl_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aexists_by_name} + */ +H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app_line, + hid_t loc_id, const char *obj_name, const char *attr_name, + hbool_t *exists, hid_t lapl_id, hid_t es_id); /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -790,15 +821,6 @@ H5_DLL herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t hid_t lapl_id); /*--------------------------------------------------------------------------*/ /** - * \ingroup ASYNC - * \async_variant_of{H5Acreate_by_name} - */ -H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app_line, - hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, - hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id, - hid_t es_id); -/*--------------------------------------------------------------------------*/ -/** * \ingroup H5A * * \brief Opens an attribute for an object specified by object identifier and @@ -969,6 +991,13 @@ H5_DLL hid_t H5Aopen_by_name_async(const char *app_file, const char *app_func, u * */ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Aread} + */ +H5_DLL 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); /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -994,10 +1023,18 @@ H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name /*--------------------------------------------------------------------------*/ /** * \ingroup ASYNC - * \async_variant_of{H5Aread} + * \async_variant_of{H5Arename} */ -H5_DLL 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); +H5_DLL herr_t H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, + const char *old_name, const char *new_name, hid_t es_id); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup ASYNC + * \async_variant_of{H5Arename_by_name} + */ +H5_DLL herr_t H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app_line, + hid_t loc_id, const char *obj_name, const char *old_attr_name, + const char *new_attr_name, hid_t lapl_id, hid_t es_id); /*--------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -1037,36 +1074,6 @@ H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); */ H5_DLL herr_t H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, hid_t type_id, const void *buf, hid_t es_id); -/*--------------------------------------------------------------------------*/ -/** - * \ingroup ASYNC - * \async_variant_of{H5Arename} - */ -H5_DLL herr_t H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, - const char *old_name, const char *new_name, hid_t es_id); -/*--------------------------------------------------------------------------*/ -/** - * \ingroup ASYNC - * \async_variant_of{H5Arename_by_name} - */ -H5_DLL herr_t H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app_line, - hid_t loc_id, const char *obj_name, const char *old_attr_name, - const char *new_attr_name, hid_t lapl_id, hid_t es_id); -/*--------------------------------------------------------------------------*/ -/** - * \ingroup ASYNC - * \async_variant_of{H5Aexists} - */ -H5_DLL herr_t H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, - const char *attr_name, hbool_t *exists, hid_t es_id); -/*--------------------------------------------------------------------------*/ -/** - * \ingroup ASYNC - * \async_variant_of{H5Aexists_by_name} - */ -H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app_line, - hid_t loc_id, const char *obj_name, const char *attr_name, - hbool_t *exists, hid_t lapl_id, hid_t es_id); /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -1092,13 +1099,6 @@ H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func */ 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); -/*--------------------------------------------------------------------------*/ -/** - * \ingroup ASYNC - * \async_variant_of{H5Aclose} - */ -H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, - hid_t es_id); /* API Wrappers for async routines */ /* (Must be defined _after_ the function prototype) */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 20a2107..ace7700 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -38,9 +38,9 @@ typedef struct H5E_error2_t { hid_t cls_id; /**< Class ID */ hid_t maj_num; - /**< Major error ID */ + /**< Major error ID */ hid_t min_num; - /**< Minor error number */ + /**< Minor error number */ unsigned line; /**< Line in file where error occurs */ const char *func_name; @@ -308,7 +308,7 @@ H5_DLL hid_t H5Eget_current_stack(void); * If \p close_source_stack is \c TRUE, the source error stack * will be closed. * - * \since 1.8.0 + * \since 1.13.0 */ H5_DLL herr_t H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack); /** diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h index e0be828..3f6bf01 100644 --- a/src/H5Mpublic.h +++ b/src/H5Mpublic.h @@ -106,7 +106,7 @@ extern "C" { * name specifies the name of the link to the map object relative to * \p loc_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL hid_t H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, @@ -127,7 +127,7 @@ H5_DLL hid_t H5Mcreate_async(const char *app_file, const char *app_func, unsigne * * \details * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL 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); @@ -147,7 +147,7 @@ H5_DLL hid_t H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, * H5Mclose() when the application is not longer interested in * accessing it. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id); @@ -173,7 +173,7 @@ H5_DLL hid_t H5Mopen_async(const char *app_file, const char *app_func, unsigned * It is illegal to subsequently use that same map identifier in calls * to other map functions. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL herr_t H5Mclose(hid_t map_id); @@ -197,7 +197,7 @@ H5_DLL herr_t H5Mclose_async(const char *app_file, const char *app_func, unsigne * map object specified by \p map_id and returns identifier for the * datatype. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL hid_t H5Mget_key_type(hid_t map_id); @@ -214,7 +214,7 @@ H5_DLL hid_t H5Mget_key_type(hid_t map_id); * a map object specified by \p map_id and returns identifier for the * datatype . * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL hid_t H5Mget_val_type(hid_t map_id); @@ -230,7 +230,7 @@ H5_DLL hid_t H5Mget_val_type(hid_t map_id); * \details H5Mget_create_plist() returns an identifier for a copy of the * creation property list for a map object specified by \p map_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL hid_t H5Mget_create_plist(hid_t map_id); @@ -246,7 +246,7 @@ H5_DLL hid_t H5Mget_create_plist(hid_t map_id); * \details H5Mget_access_plist() returns an identifier for a copy of the access * property list for a map object specified by \p map_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL hid_t H5Mget_access_plist(hid_t map_id); @@ -264,7 +264,7 @@ H5_DLL hid_t H5Mget_access_plist(hid_t map_id); * \details H5Mget_count() retrieves the number of key-value pairs stored in a * map specified by map_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL herr_t H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id); @@ -294,7 +294,7 @@ H5_DLL herr_t H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id); * Any further options can be specified through the property list * \p dxpl_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL herr_t H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, @@ -335,7 +335,7 @@ H5_DLL herr_t H5Mput_async(const char *app_file, const char *app_func, unsigned * Any further options can be specified through the property list * \p dxpl_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL herr_t H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value, @@ -369,7 +369,7 @@ H5_DLL herr_t H5Mget_async(const char *app_file, const char *app_func, unsigned * Any further options can be specified through the property list * \p dxpl_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, hid_t dxpl_id); @@ -407,7 +407,7 @@ H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hb * * Any further options can be specified through the property list \p dxpl_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, @@ -448,7 +448,7 @@ H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_ * * Any further options can be specified through the property list \p dxpl_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL herr_t H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_mem_type_id, @@ -473,7 +473,7 @@ H5_DLL herr_t H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *id * * Any further options can be specified through the property list \p dxpl_id. * - * \since 1.13.0 + * \since 1.12.0 * */ H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 6235ac8..5adb05e 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -5055,22 +5055,22 @@ H5_DLL herr_t H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts); * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * *
    #H5FD_MEM_SUPER Super block data#H5FD_MEM_SUPER Super block data
    #H5FD_MEM_BTREE B-tree data#H5FD_MEM_BTREE B-tree data
    #H5FD_MEM_DRAW Dataset raw data#H5FD_MEM_DRAW Dataset raw data
    #H5FD_MEM_GHEAP Global heap data#H5FD_MEM_GHEAP Global heap data
    #H5FD_MEM_LHEAP Local Heap data#H5FD_MEM_LHEAP Local Heap data
    #H5FD_MEM_OHDR Object header data#H5FD_MEM_OHDR Object header data
    * @@ -8389,7 +8389,7 @@ H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint); * buffer is too small it will be reallocated to a larger size, though * this may result in an additional I/O. * - * \since 1.12.? + * \since 1.12.0 * */ H5_DLL herr_t H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size); @@ -8408,7 +8408,7 @@ H5_DLL herr_t H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, * \details H5Pget_map_iterate() returns the map iterate hints, \p key_prefetch_size * and \p key_alloc_size, as set by H5Pset_map_iterate_hints(). * - * \since 1.12.? + * \since 1.12.0 * */ H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/, diff --git a/src/H5public.h b/src/H5public.h index 751abbe..ada15a7 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -511,7 +511,7 @@ H5_DLL herr_t H5open(void); * If the HDF5 library is initialized and closed more than once, the * \p func callback must be registered within each open/close cycle. * - * \since 1.12.1 + * \since 1.13.0 */ H5_DLL herr_t H5atclose(H5_atclose_func_t func, void *ctx); /** @@ -735,7 +735,7 @@ H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) * after it has been closed. The value of \p is_terminating is * undefined if this routine fails. * - * \since 1.12.1 + * \since 1.13.0 */ H5_DLL herr_t H5is_library_terminating(hbool_t *is_terminating); /** diff --git a/src/Makefile.am b/src/Makefile.am index 0b4fa5c..6d5a56e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,9 +19,6 @@ include $(top_srcdir)/config/commence.am include $(top_srcdir)/config/lt_vers.am -# include Doxygen rules (requires autoconf-archive >2016-03-20) -@DX_RULES@ - # How to build H5detect for number format detection. # Use -g to force no optimization since many compilers (e.g., Intel) takes # a long time to compile it with any optimization on. H5detect is used @@ -203,11 +200,6 @@ $(top_srcdir)/src/H5version.h: $(top_srcdir)/src/H5vers.txt $(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt perl $(top_srcdir)/bin/make_overflow $? -# doxygen support -if BUILD_DOXYGEN_CONDITIONAL -doxygen: doxygen-doc -endif - # Add TRACE macros to library source files. This is done via the trace script # in the hdf5/bin directory. If the file contains HDF5 API macros, a "clean" # version of the source file is saved with a tilde (~) after its name and -- cgit v0.12 From 333a79c1b285054e65a709dc2da5fc876d513b37 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 5 May 2021 17:08:10 -0500 Subject: Cleanup tools debug build warnings (#627) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- tools/lib/h5diff.c | 8 +++--- tools/lib/h5diff_dset.c | 2 +- tools/lib/h5diff_util.c | 4 +-- tools/lib/h5tools.c | 38 ++++++++++++------------- tools/lib/h5tools_dump.c | 60 ++++++++++++++++++++-------------------- tools/lib/h5tools_str.c | 14 +++++----- tools/src/h5diff/h5diff_common.c | 8 +++--- tools/src/h5ls/h5ls.c | 16 +++++------ 8 files changed, 75 insertions(+), 75 deletions(-) diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 57cfaf2..0ad319e 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -461,7 +461,7 @@ build_match_list(const char *objname1, trav_info_t *info1, const char *objname2, done: *table_out = table; - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- @@ -493,7 +493,7 @@ trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata) const char * ext_path; herr_t ret_value = SUCCEED; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); /* init linkinfo struct */ HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); @@ -577,7 +577,7 @@ trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata) done: if (lnk_info.trg_path) HDfree(lnk_info.trg_path); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -627,7 +627,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char trav_table_t *match_list = NULL; diff_err_t ret_value = H5DIFF_NO_ERR; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); /* init filenames */ HDmemset(filenames, 0, MAX_FILENAME * 2); /* init link info struct */ diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index b0726ec..e6872f0 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -961,7 +961,7 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1, int i; int ret_value = 1; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); /*------------------------------------------------------------------------- * check for the same class *------------------------------------------------------------------------- diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 3e24802..e487a12 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -339,7 +339,7 @@ match_up_memsize(hid_t f_tid1_id, hid_t f_tid2_id, hid_t *m_tid1, hid_t *m_tid2, { herr_t ret_value = SUCCEED; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((*m_size1) != (*m_size2)) { if ((*m_size1) < (*m_size2)) { H5Tclose(*m_tid1); @@ -362,6 +362,6 @@ match_up_memsize(hid_t f_tid1_id, hid_t f_tid2_id, hid_t *m_tid1, hid_t *m_tid2, H5TOOLS_GOTO_ERROR(FAIL, "native type sizes do not compare"); done: - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 97026f0..eee9c53 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1129,7 +1129,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context if (!ctx->need_prefix) return; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); HDmemset(&prefix, 0, sizeof(h5tools_str_t)); HDmemset(&str, 0, sizeof(h5tools_str_t)); @@ -1198,7 +1198,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context h5tools_str_close(&prefix); h5tools_str_close(&str); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- @@ -1444,7 +1444,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex ctx->prev_multiline = multiline; - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return dimension_break; } @@ -1485,7 +1485,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools int secnum; /* section sequence number */ int multiline; /* datum was multiline */ - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); H5TOOLS_DEBUG("elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); s = h5tools_str_fmt(buffer, (size_t)0, "%s"); @@ -1598,7 +1598,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools ctx->prev_multiline = multiline; - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return dimension_break; } @@ -1617,7 +1617,7 @@ init_acc_pos(unsigned ndims, const hsize_t *dims, hsize_t *acc, hsize_t *pos, hs int i; unsigned j; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); for (i = 0; (unsigned)i < ndims; i++) p_min_idx[i] = 0; @@ -1632,7 +1632,7 @@ init_acc_pos(unsigned ndims, const hsize_t *dims, hsize_t *acc, hsize_t *pos, hs pos[j] = 0; } - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- @@ -1650,7 +1650,7 @@ calc_acc_pos(unsigned ndims, hsize_t elmtno, const hsize_t *acc, hsize_t *pos) int i; hsize_t curr_pos = elmtno; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if (ndims > 0) { for (i = 0; i < (int)ndims; i++) { @@ -1665,7 +1665,7 @@ calc_acc_pos(unsigned ndims, hsize_t elmtno, const hsize_t *acc, hsize_t *pos) } } - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return curr_pos; } @@ -1689,7 +1689,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t hbool_t past_catch = FALSE; int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((size = H5Tget_size(tid)) == 0) H5TOOLS_THROW((-1), "H5Tget_size failed"); @@ -1899,7 +1899,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } /* end switch */ CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -1932,7 +1932,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t contai hid_t sid1 = H5I_INVALID_HID; int ret_value = -1; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); /* Get the dataspace of the dataset */ if ((sid1 = H5Dget_space(region_id)) < 0) H5TOOLS_THROW((-1), "H5Dget_space failed"); @@ -1998,7 +1998,7 @@ done:; if (H5Sclose(sid1) < 0) H5TOOLS_ERROR((-1), "H5Sclose failed"); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -2026,7 +2026,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *strea hbool_t past_catch = FALSE; hbool_t ret_value = TRUE; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) H5TOOLS_THROW(FALSE, "H5Sget_select_hyper_nblocks failed"); nblocks = (hsize_t)snblocks; @@ -2062,7 +2062,7 @@ done: H5_LEAVE(TRUE) CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -2093,7 +2093,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE * void * region_buf = NULL; int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((type_size = H5Tget_size(type_id)) == 0) H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed"); @@ -2123,7 +2123,7 @@ done: if (H5Sclose(mem_space) < 0) H5TOOLS_ERROR((-1), "H5Sclose failed"); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -2149,7 +2149,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *strea hbool_t past_catch = FALSE; hbool_t ret_value = TRUE; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) H5TOOLS_THROW(FALSE, "H5Sget_select_elem_npoints failed"); npoints = (hsize_t)snpoints; @@ -2176,7 +2176,7 @@ done: H5_LEAVE(ret_value) CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 4fb8202..cb4f9d2 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -465,7 +465,7 @@ done: CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -522,7 +522,7 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for HDmemset(&ctx, 0, sizeof(ctx)); - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((type_size = H5Tget_size(type_id)) == 0) H5TOOLS_THROW(FAIL, "H5Tget_size failed"); @@ -642,7 +642,7 @@ done: if (H5Sclose(sid1) < 0) H5TOOLS_ERROR(FAIL, "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -696,7 +696,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *strea HDassert(ctx); HDassert(buffer); - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); outputformat = *info; outputformat.idx_fmt = ""; outputformat.idx_n_fmt = ""; @@ -865,7 +865,7 @@ done: CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -915,7 +915,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stre HDassert(ptdata); HDassert(ndims > 0); - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); HDmemset(&ctx, 0, sizeof(ctx)); /* Allocate space for the dimension array */ @@ -1001,7 +1001,7 @@ done: if (H5Sclose(mem_space) < 0) H5TOOLS_ERROR((-1), "H5Sclose failed"); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -1053,7 +1053,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *strea HDassert(ctx); HDassert(buffer); - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); outputformat = *info; outputformat.idx_fmt = ""; outputformat.idx_n_fmt = ""; @@ -1217,7 +1217,7 @@ done: H5_LEAVE(dimension_break) CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -1284,7 +1284,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c unsigned int vl_data = 0; /* contains VL datatypes */ herr_t ret_value = SUCCEED; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((size_t)ctx->ndims > NELMTS(sm_size)) H5TOOLS_THROW(FAIL, "ndims and sm_size comparision failed"); @@ -1398,7 +1398,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c if (sm_buf) HDfree(sm_buf); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -1583,7 +1583,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co hbool_t past_catch = FALSE; herr_t ret_value = SUCCEED; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((f_space = H5Dget_space(dset)) < 0) H5TOOLS_THROW(FAIL, "H5Dget_space failed"); @@ -1607,7 +1607,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co if (f_space >= 0 && H5Sclose(f_space) < 0) H5TOOLS_THROW(FAIL, "H5Sclose failed"); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -1660,7 +1660,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont unsigned int vl_data = 0; /* contains VL datatypes */ int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if (H5I_INVALID_HID == (f_space = H5Dget_space(dset))) H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); @@ -1795,7 +1795,7 @@ done: if (f_space >= 0 && H5Sclose(f_space) < 0) H5TOOLS_ERROR((-1), "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -1826,7 +1826,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte /* VL data special information */ unsigned int vl_data = 0; /* contains VL datatypes */ - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if (H5I_INVALID_HID == (f_space = H5Aget_space(attr_id))) H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); @@ -1885,7 +1885,7 @@ done: if (f_space >= 0 && H5Sclose(f_space) < 0) H5TOOLS_ERROR((-1), "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -1917,7 +1917,7 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tool_format_t info_dflt; int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); /* Use default values */ if (!stream) stream = rawoutstream; @@ -1969,7 +1969,7 @@ done: if (f_space > 0) H5Sclose(f_space); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -1993,7 +1993,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c h5tool_format_t info_dflt; int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); /* Use default values */ if (!stream) stream = rawoutstream; @@ -2039,7 +2039,7 @@ done: if (f_space > 0) H5Sclose(f_space); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -2082,7 +2082,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ const char *order_s = NULL; /* byte order string */ int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((type_class = H5Tget_class(type)) < 0) H5TOOLS_THROW((-1), "H5Tget_class failed"); if (object_search && H5Tcommitted(type) > 0) { @@ -2641,7 +2641,7 @@ found_string_type: } CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -2667,7 +2667,7 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) int i; int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) H5TOOLS_THROW((-1), "H5Sget_simple_extent_dims failed"); @@ -2721,7 +2721,7 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) } /* end switch */ CATCH - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -2756,7 +2756,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i hbool_t past_catch = FALSE; int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -2868,7 +2868,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i if (0 == nmembs) h5tools_str_append(buffer, "\n"); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -4069,7 +4069,7 @@ h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_contex h5tools_str_t buffer; /* string into which to render */ h5tools_context_t datactx; /* print context */ - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); datactx = *ctx; /* print context */ /* Assume entire data space to be printed */ @@ -4276,7 +4276,7 @@ h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_contex h5tools_str_close(&buffer); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- @@ -4493,5 +4493,5 @@ done: } h5tools_str_close(&buffer); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index e4c0bdc..5fcaee6 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -287,7 +287,7 @@ h5tools_str_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t *info, h { size_t i = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); h5tools_str_reset(str); @@ -306,7 +306,7 @@ h5tools_str_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t *info, h h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)elmtno); H5TOOLS_DEBUG("str=%s", str->s); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); /* Add prefix and suffix to the index */ return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); @@ -327,7 +327,7 @@ h5tools_str_region_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t * { size_t i = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); h5tools_str_reset(str); @@ -347,7 +347,7 @@ h5tools_str_region_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t * h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)0); H5TOOLS_DEBUG("str=%s", str->s); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); /* Add prefix and suffix to the index */ return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); @@ -657,7 +657,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai H5T_class_t type_class; char * ret_value = NULL; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); /* Build default formats for long long types */ if (!fmt_llong[0]) { HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH); @@ -1339,7 +1339,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp) { ssize_t buf_size; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); h5tools_str_append(str, " \""); buf_size = H5Rget_file_name(ref_vp, NULL, 0); @@ -1381,7 +1381,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp) } h5tools_str_append(str, "\""); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 99cd653..603b1f3 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -138,7 +138,7 @@ parse_hsize_list(const char *h_list, subset_d *d) } d->data = p_list; d->len = size_count; - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- @@ -187,7 +187,7 @@ parse_subset_params(const char *dset) parse_hsize_list(brace, &s->block); } - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return s; } @@ -208,7 +208,7 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node; struct exclude_path_list *exclude_attr_head, *exclude_attr_prev, *exclude_attr_node; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); /* process the command-line */ HDmemset(opts, 0, sizeof(diff_opt_t)); @@ -482,7 +482,7 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char opts->sset[1] = parse_subset_params(*objname2); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 1a430b3..a0b9441 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1315,7 +1315,7 @@ dump_dataset_values(hid_t dset) h5tool_format_t * info = &ls_dataformat; H5R_ref_t * ref_buf = NULL; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); f_type = H5Dget_type(dset); space = H5Dget_space(dset); @@ -1456,7 +1456,7 @@ done: PRINTVALSTREAM(rawoutstream, "\n"); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- @@ -1484,7 +1484,7 @@ dump_attribute_values(hid_t attr) h5tool_format_t * info = &ls_dataformat; H5R_ref_t * ref_buf = NULL; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); f_type = H5Aget_type(attr); space = H5Aget_space(attr); @@ -1632,7 +1632,7 @@ done: PRINTVALSTREAM(rawoutstream, "\n"); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- @@ -1661,7 +1661,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain h5tools_context_t ctx; /* print context */ h5tool_format_t * info = &ls_dataformat; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -1740,7 +1740,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain H5TOOLS_DEBUG("Attribute open failed"); h5tools_str_close(&buffer); } - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return 0; } @@ -2088,7 +2088,7 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi h5tools_context_t ctx; /* print context */ h5tool_format_t * info = &ls_dataformat; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -2242,7 +2242,7 @@ done: } h5tools_str_close(&buffer); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return 0; } /* end list_obj() */ -- cgit v0.12 From 69553290541c48722c3a201864f79c9827125b89 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 7 May 2021 11:43:12 -0500 Subject: h5diff subset indexing (#628) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- tools/lib/h5diff_array.c | 188 ++++++++++++++++++------------------- tools/test/h5diff/CMakeTests.cmake | 2 +- 2 files changed, 90 insertions(+), 100 deletions(-) diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 77b6a5e..43ded12 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -225,7 +225,7 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_ mcomp_t members; H5T_class_t type_class; - H5TOOLS_START_DEBUG(" - rank:%d hs_nelmts:%ld errstat:%d", opts->rank, opts->hs_nelmts, opts->err_stat); + H5TOOLS_START_DEBUG(" - rank:%d hs_nelmts:%lld errstat:%d", opts->rank, opts->hs_nelmts, opts->err_stat); opts->print_header = 1; /* enable print header */ /* get the size. */ @@ -411,7 +411,7 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_ HDmemset(&members, 0, sizeof(mcomp_t)); get_member_types(opts->m_tid, &members); for (i = 0; i < opts->hs_nelmts; i++) { - H5TOOLS_DEBUG("opts->pos[%ld]:%ld - nelmts:%ld", i, opts->pos[i], opts->hs_nelmts); + H5TOOLS_DEBUG("opts->pos[%lld]:%lld - nelmts:%lld", i, opts->pos[i], opts->hs_nelmts); nfound += diff_datum(mem1 + i * size, mem2 + i * size, i, opts, container1_id, container2_id, &members); if (opts->count_bool && nfound >= opts->count) @@ -419,7 +419,7 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_ } /* i */ close_member_types(&members); } /* switch */ - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -475,7 +475,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co hsize_t nfound = 0; /* differences found */ diff_err_t ret_value = opts->err_stat; - H5TOOLS_START_DEBUG("ph:%d elemtno:%d - errstat:%d", opts->print_header, elemtno, opts->err_stat); + H5TOOLS_START_DEBUG("ph:%d elemtno:%lld - errstat:%d", opts->print_header, elemtno, opts->err_stat); type_size = H5Tget_size(opts->m_tid); type_class = H5Tget_class(opts->m_tid); @@ -593,8 +593,8 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co * of length of strings. * For now mimic the previous way. */ - H5TOOLS_DEBUG("string size:%d", size1); - H5TOOLS_DEBUG("string size:%d", size2); + H5TOOLS_DEBUG("string size:%ld", size1); + H5TOOLS_DEBUG("string size:%ld", size2); if (size1 != size2) { H5TOOLS_DEBUG("string sizes difference"); nfound++; @@ -725,7 +725,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co H5TOOLS_DEBUG("H5T_ARRAY ph=%d", opts->print_header); arr_opts = *opts; - H5TOOLS_DEBUG("Check opts: hs_nelmts:%ld to %ld rank:%d to %ld", opts->hs_nelmts, + H5TOOLS_DEBUG("Check opts: hs_nelmts:%lld to %lld rank:%d to %d", opts->hs_nelmts, arr_opts.hs_nelmts, opts->rank, arr_opts.rank); /* get the array's base datatype for each element */ arr_opts.m_tid = H5Tget_super(opts->m_tid); @@ -1074,7 +1074,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1 failed"); if (H5Rdestroy(ref1_buf) < 0) H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1 failed"); - H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, + H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF complete nfound:%lld - errstat:%d", nfound, ref_opts.err_stat); } /*------------------------------------------------------------------------- @@ -1286,7 +1286,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co done: opts->err_stat = opts->err_stat | ret_value; - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -1378,7 +1378,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di hsize_t nfound_p = 0; /* point differences found */ hsize_t ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); ndims1 = H5Sget_simple_extent_ndims(region1_id); ndims2 = H5Sget_simple_extent_ndims(region2_id); @@ -1397,8 +1397,8 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di npoints2 = H5Sget_select_elem_npoints(region2_id); } H5E_END_TRY; - H5TOOLS_DEBUG("blocks: 1=%ld-2=%ld", nblocks1, nblocks2); - H5TOOLS_DEBUG("points: 1=%ld-2=%ld", npoints1, npoints2); + H5TOOLS_DEBUG("blocks: 1=%lld-2=%lld", nblocks1, nblocks2); + H5TOOLS_DEBUG("points: 1=%lld-2=%lld", npoints1, npoints2); if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) { opts->not_cmp = 1; @@ -1561,7 +1561,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di ret_value = nfound_p + nfound_b; done: - H5TOOLS_ENDDEBUG(" with diffs:%d", ret_value); + H5TOOLS_ENDDEBUG(" with diffs:%lld", ret_value); return ret_value; } @@ -1598,7 +1598,7 @@ character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t } nfound++; } - H5TOOLS_ENDDEBUG(": %d", nfound); + H5TOOLS_ENDDEBUG(": %lld", nfound); return nfound; } @@ -1669,7 +1669,7 @@ character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, nfound++; } - H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero); + H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero); return nfound; } @@ -1850,7 +1850,7 @@ diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d } } - H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero); + H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero); return nfound; } @@ -2021,7 +2021,7 @@ diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, nfound++; } } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2196,7 +2196,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2285,7 +2285,7 @@ diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2373,7 +2373,7 @@ diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2461,7 +2461,7 @@ diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2553,7 +2553,7 @@ diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2641,7 +2641,7 @@ diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, dif nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2729,7 +2729,7 @@ diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, di nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2817,7 +2817,7 @@ diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, di nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -2907,7 +2907,7 @@ diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d nfound++; } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -3000,7 +3000,7 @@ diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d } } - H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat); return nfound; } @@ -3100,7 +3100,7 @@ diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, } } - H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero); + H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero); return nfound; } @@ -3119,7 +3119,7 @@ ull2float(unsigned long long ull_value, float *f_value) size_t dst_size; int ret_value = 0; - H5TOOLS_START_DEBUG(""); + H5TOOLS_START_DEBUG(" "); if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed"); @@ -3146,7 +3146,7 @@ done: if (buf) HDfree(buf); - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); return ret_value; } @@ -3348,97 +3348,87 @@ print_header(diff_opt_t *opts) static void print_pos(diff_opt_t *opts, hsize_t idx, size_t u) { - int i, j; - - H5TOOLS_START_DEBUG(" -- idx:%ld", idx); + H5TOOLS_START_DEBUG(" -- idx:%lld", idx); if (print_data(opts)) { + hsize_t curr_pos = idx; /* print header */ if (opts->print_header == 1) { opts->print_header = 0; - print_header(opts); } /* end print header */ H5TOOLS_DEBUG("rank=%d", opts->rank); if (opts->rank > 0) { - hsize_t curr_pos = idx; - parallel_print("[ "); - H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", idx, opts->hs_nelmts, + H5TOOLS_DEBUG("do calc_acc_pos[%lld] nelmts:%lld - errstat:%d", idx, opts->hs_nelmts, opts->err_stat); - if (opts->sset[0] != NULL) { /* Subsetting is used - calculate total position */ - hsize_t prev_dim_size = 0; /* previous dim size */ - hsize_t prev_str = 0; /* previouw stride idx*/ - hsize_t str_cnt = 0; /* stride multiplier*/ - hsize_t curr_idx = 0; /* calculated running position */ - hsize_t str_idx = 0; - hsize_t blk_idx = 0; - hsize_t cnt_idx = 0; - hsize_t dim_size = 0; /* current dim size */ - hsize_t elmnt_cnt = 1; - hsize_t next_idx = idx; - hsize_t data_idx = 0; - j = opts->rank - 1; - H5TOOLS_DEBUG("...begin:%ld=> opts->rank:%ld (idx:%ld)", j, opts->rank, idx); - do { - curr_idx = next_idx; /* New current data position */ - cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */ - blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */ - str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - c:%ld b:%ld s:%ld", j, - curr_pos, curr_idx, cnt_idx, blk_idx, str_idx); - dim_size = opts->dims[j]; /* Current dimension size */ - /* elmnt_cnt *= dim_size; /* Total number of elements in dimension */ - H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld - (prev_dim_size:%ld - dim_size:%ld) " - "- str_cnt:%ld", - j, elmnt_cnt, prev_dim_size, dim_size, str_cnt); - data_idx = elmnt_cnt * dim_size; - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (data_idx:%ld)", j, curr_pos, data_idx); - for (i = 0; i < cnt_idx; i++) { - H5TOOLS_DEBUG("... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld (curr_idx:%ld - " - "data_idx:%ld)", - i, cnt_idx, str_cnt, curr_idx, data_idx); - if (curr_idx >= data_idx) { - /* get to next block */ - data_idx += str_idx * dim_size; - /* get next block */ - str_cnt++; - H5TOOLS_DEBUG( - "... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld - data_idx:%ld", i, - cnt_idx, str_cnt, data_idx); - } - H5TOOLS_DEBUG("... ... end data loop:%d with dim_cnt:%ld - str_cnt:%ld - " - "(curr_idx:%ld - data_idx:%ld)", - i, dim_size, str_cnt, curr_idx, data_idx); + hsize_t curr_idx = 0; /* current pos in the selection space for each dimension */ + + curr_pos = 0; /* current position in full space */ + if (curr_idx < idx) { + int j; + hsize_t count; + hsize_t block; + hsize_t stride; + hsize_t tmp = 0; + hsize_t k0 = 0; /* whole location beyond current dimension */ + hsize_t k1 = 0; /* partial location within dimension */ + hsize_t dim_size = 0; /* previous dim size */ + hsize_t prev_dim_size = 0; /* previous dim size */ + hsize_t total_dim_size = 1; /* current dim size */ + hsize_t prev_total_dim_size = 1; /* current dim size */ + + prev_dim_size = 1; + total_dim_size = 1; + curr_idx = idx; + /* begin with fastest changing dimension */ + for (int i = 0; i < opts->rank; i++) { + j = opts->rank - i - 1; + prev_total_dim_size *= prev_dim_size; + dim_size = opts->dims[j]; + H5TOOLS_DEBUG("j=%d, dim_size=%lld, prev_dim_size=%lld, total_dim_size=%lld, " + "prev_total_dim_size=%lld", + j, dim_size, prev_dim_size, total_dim_size, prev_total_dim_size); + count = opts->sset[0]->count.data[j]; + block = opts->sset[0]->block.data[j]; + stride = opts->sset[0]->stride.data[j]; + H5TOOLS_DEBUG("stride=%lld, count=%lld, block=%lld", stride, count, block); + tmp = count * block; + k0 = curr_idx / tmp; + k1 = curr_idx % tmp; + curr_pos += k1 * stride * prev_total_dim_size; + H5TOOLS_DEBUG("curr_idx=%lld, k0=%lld, k1=%lld, curr_pos=%lld", curr_idx, k0, k1, + curr_pos); + if (k0 > 0) + curr_idx = k0 * total_dim_size; + H5TOOLS_DEBUG("curr_idx=%lld, tmp=%lld", curr_idx, tmp); + total_dim_size *= dim_size; + /* if last calculation exists within in current dimension */ + if (k0 == 0) + break; + H5TOOLS_DEBUG("j=%d, curr_pos=%lld", j, curr_pos); + prev_dim_size = dim_size; } - next_idx += dim_size * str_cnt; - H5TOOLS_DEBUG("... sset loop:%d with curr_idx:%ld (next_idx:%ld)", j, curr_idx, next_idx); - str_cnt = 0; - prev_str = str_idx; - prev_dim_size = dim_size; - H5TOOLS_DEBUG("... end sset loop:%d with prev_dim_size:%ld (curr_idx:%ld - data_idx:%ld) " - "- str_cnt:%ld", - j, prev_dim_size, curr_idx, data_idx, str_cnt); - elmnt_cnt *= dim_size; /* Total number of elements in dimension */ - j--; - } while (next_idx >= elmnt_cnt && j >= 0); - curr_pos = curr_idx; /* New current position */ - H5TOOLS_DEBUG("pos loop:%d,%d with elmnt_cnt:%ld - curr_pos:%ld", i, j, elmnt_cnt, curr_pos); - } /* if (opts->sset[0] != NULL) */ + /* check if there is a final calculation needed for slowest changing dimension */ + if (k0 > 0) + curr_pos += k0 * stride * prev_total_dim_size; + H5TOOLS_DEBUG("4:curr_idx=%lld, curr_pos=%lld", curr_idx, curr_pos); + } + } /* * Calculate the number of elements represented by a unit change in a * certain index position. */ calc_acc_pos((unsigned)opts->rank, curr_pos, opts->acc, opts->pos); - for (i = 0; i < opts->rank; i++) { - H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld opts->sm_pos=%ld", i, opts->pos[i], + for (int i = 0; i < opts->rank; i++) { + H5TOOLS_DEBUG("pos loop:%d with opts->pos=%lld opts->sm_pos=%lld", i, opts->pos[i], opts->sm_pos[i]); opts->pos[i] += (unsigned long)opts->sm_pos[i]; - H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld", i, opts->pos[i]); + H5TOOLS_DEBUG("pos loop:%d with opts->pos=%lld", i, opts->pos[i]); parallel_print(HSIZE_T_FORMAT, (unsigned long long)opts->pos[i]); parallel_print(" "); } @@ -3457,7 +3447,7 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u) parallel_print(SPACES); } - H5TOOLS_ENDDEBUG(""); + H5TOOLS_ENDDEBUG(" "); } /*------------------------------------------------------------------------- diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index aeae2e4..9c27076 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -1549,7 +1549,7 @@ ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array) # ############################################################################## # # dataset subsets # ############################################################################## -#TRILABS_227 ADD_H5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;]) +ADD_H5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;]) # ############################################################################## # # VDS tests -- cgit v0.12 From 1e572b18e3c271f9de045a6b61e3c855779e7c58 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 7 May 2021 09:44:07 -0700 Subject: Cleans up a const warning left over from previous constification (#633) * Committing clang-format changes * Adds consts to a few global variables * Cleans up a const warning left over from previous constification Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5Clog.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Clog.h b/src/H5Clog.h index bd5c413..790a073 100644 --- a/src/H5Clog.h +++ b/src/H5Clog.h @@ -79,10 +79,10 @@ typedef struct H5C_log_class_t { /* Logging information */ struct H5C_log_info_t { - hbool_t enabled; /* Was the logging set up? */ - hbool_t logging; /* Are we currently logging? */ - H5C_log_class_t *cls; /* Callbacks for writing log messages */ - void * udata; /* Log-specific data */ + hbool_t enabled; /* Was the logging set up? */ + hbool_t logging; /* Are we currently logging? */ + const H5C_log_class_t *cls; /* Callbacks for writing log messages */ + void * udata; /* Log-specific data */ }; /*****************************/ -- cgit v0.12 From 9023e98940d959aa974e655cc383fab0b0ed663c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 7 May 2021 09:45:05 -0700 Subject: Removes gratuitous (double)x.yF casts (#632) * Committing clang-format changes * Removes gratuitous (double)x.yF casts * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/test/dsets.cpp | 4 +- hl/src/H5LT.c | 2 +- src/H5C.c | 49 +++++------ src/H5Cdbg.c | 23 +++-- src/H5Cimage.c | 9 +- src/H5Cprivate.h | 16 ++-- src/H5HFdbg.c | 2 +- src/H5HLdbg.c | 2 +- src/H5Pdapl.c | 2 +- src/H5Pdxpl.c | 5 +- src/H5Pfapl.c | 2 +- src/H5T.c | 4 +- src/H5Zdeflate.c | 2 +- src/H5Zscaleoffset.c | 2 +- src/H5timer.c | 40 ++++----- src/H5trace.c | 6 +- test/cache.c | 8 +- test/cache_api.c | 174 ++++++++++++++++++------------------- test/cross_read.c | 6 +- test/dsets.c | 6 +- test/dt_arith.c | 2 +- test/dtypes.c | 6 +- test/enc_dec_plist.c | 20 ++--- test/gen_cross.c | 2 +- test/gen_plist.c | 18 ++-- test/links.c | 2 +- test/mtime.c | 2 +- test/objcopy.c | 2 +- test/tattr.c | 22 ++--- test/tgenprop.c | 2 +- test/th5s.c | 2 +- test/timer.c | 22 ++--- test/tmisc.c | 22 ++--- testpar/t_prop.c | 20 ++--- tools/src/h5diff/h5diff_common.c | 2 +- tools/src/h5ls/h5ls.c | 2 +- tools/src/h5stat/h5stat.c | 4 +- tools/test/h5import/h5importtest.c | 4 +- tools/test/perform/chunk.c | 16 ++-- tools/test/perform/chunk_cache.c | 30 ++++--- tools/test/perform/iopipe.c | 11 ++- tools/test/perform/sio_perf.c | 3 +- tools/test/perform/zip_perf.c | 11 ++- 43 files changed, 291 insertions(+), 300 deletions(-) diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 356112e..0363bba 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1157,7 +1157,7 @@ test_chunk_cache(const FileAccPropList &fapl) // Verify that chunk cache parameters are the same int mdc_nelmts = 0; size_t nslots_1 = 0, nslots_4 = 0, nbytes_1 = 0, nbytes_4 = 0; - double w0_1 = 0.0F, w0_4 = 0.0F; + double w0_1 = 0.0, w0_4 = 0.0; fapl_def.getCache(mdc_nelmts, nslots_1, nbytes_1, w0_1); dapl.getChunkCache(nslots_4, nbytes_4, w0_4); verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__); @@ -1175,7 +1175,7 @@ test_chunk_cache(const FileAccPropList &fapl) // Set new rdcc settings on fapl local size_t nslots_2 = nslots_1 * 2; size_t nbytes_2 = nbytes_1 * 2; - double w0_2 = w0_1 / (double)2.0F; + double w0_2 = w0_1 / 2.0; fapl_local.getCache(mdc_nelmts, nslots_2, nbytes_2, w0_2); // Create a new file using default fcpl and the passed-in fapl diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index fbd2be0..fb507e7 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -822,7 +822,7 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) char file_name[64]; /* Filename buffer */ size_t alloc_incr; /* Buffer allocation increment */ size_t min_incr = 65536; /* Minimum buffer increment */ - double buf_prcnt = 0.1f; /* Percentage of buffer size to set + double buf_prcnt = 0.1; /* Percentage of buffer size to set as increment */ static long file_name_counter; H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy, &image_realloc, &image_free, diff --git a/src/H5C.c b/src/H5C.c index 1b885e3..7853933 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -445,17 +445,17 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, (cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT; (cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off; - (cache_ptr->resize_ctl).flash_multiple = (double)1.0f; - (cache_ptr->resize_ctl).flash_threshold = (double)0.25f; + (cache_ptr->resize_ctl).flash_multiple = 1.0; + (cache_ptr->resize_ctl).flash_threshold = 0.25; (cache_ptr->resize_ctl).decr_mode = H5C_decr__off; - (cache_ptr->resize_ctl).upper_hr_threshold = (double)H5C__DEF_AR_UPPER_THRESHHOLD; - (cache_ptr->resize_ctl).decrement = (double)H5C__DEF_AR_DECREMENT; + (cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD; + (cache_ptr->resize_ctl).decrement = H5C__DEF_AR_DECREMENT; (cache_ptr->resize_ctl).apply_max_decrement = TRUE; (cache_ptr->resize_ctl).max_decrement = H5C__DEF_AR_MAX_DECREMENT; (cache_ptr->resize_ctl).epochs_before_eviction = H5C__DEF_AR_EPCHS_B4_EVICT; (cache_ptr->resize_ctl).apply_empty_reserve = TRUE; - (cache_ptr->resize_ctl).empty_reserve = (double)H5C__DEF_AR_EMPTY_RESERVE; + (cache_ptr->resize_ctl).empty_reserve = H5C__DEF_AR_EMPTY_RESERVE; cache_ptr->epoch_markers_active = 0; @@ -2705,7 +2705,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p break; case H5C_incr__threshold: - if ((config_ptr->lower_hr_threshold <= (double)0.0f) || (config_ptr->increment <= (double)1.0f) || + if ((config_ptr->lower_hr_threshold <= 0.0) || (config_ptr->increment <= 1.0) || ((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0))) cache_ptr->size_increase_possible = FALSE; break; @@ -2725,21 +2725,21 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p break; case H5C_decr__threshold: - if ((config_ptr->upper_hr_threshold >= (double)1.0f) || (config_ptr->decrement >= (double)1.0f) || + if ((config_ptr->upper_hr_threshold >= 1.0) || (config_ptr->decrement >= 1.0) || ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0))) cache_ptr->size_decrease_possible = FALSE; break; case H5C_decr__age_out: - if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) || + if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) || ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0))) cache_ptr->size_decrease_possible = FALSE; break; case H5C_decr__age_out_with_threshold: - if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) || + if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) || ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) || - (config_ptr->upper_hr_threshold >= (double)1.0f)) + (config_ptr->upper_hr_threshold >= 1.0)) cache_ptr->size_decrease_possible = FALSE; break; @@ -3720,8 +3720,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "initial_size must be in the interval [min_size, max_size]") - if ((config_ptr->min_clean_fraction < (double)0.0f) || - (config_ptr->min_clean_fraction > (double)1.0f)) + if ((config_ptr->min_clean_fraction < 0.0) || (config_ptr->min_clean_fraction > 1.0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_clean_fraction must be in the interval [0.0, 1.0]") if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH) @@ -3736,12 +3735,11 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode") if (config_ptr->incr_mode == H5C_incr__threshold) { - if ((config_ptr->lower_hr_threshold < (double)0.0f) || - (config_ptr->lower_hr_threshold > (double)1.0f)) + if ((config_ptr->lower_hr_threshold < 0.0) || (config_ptr->lower_hr_threshold > 1.0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]") - if (config_ptr->increment < (double)1.0f) + if (config_ptr->increment < 1.0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0") /* no need to check max_increment, as it is a size_t, @@ -3755,12 +3753,10 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) break; case H5C_flash_incr__add_space: - if ((config_ptr->flash_multiple < (double)0.1f) || - (config_ptr->flash_multiple > (double)10.0f)) + if ((config_ptr->flash_multiple < 0.1) || (config_ptr->flash_multiple > 10.0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flash_multiple must be in the range [0.1, 10.0]") - if ((config_ptr->flash_threshold < (double)0.1f) || - (config_ptr->flash_threshold > (double)1.0f)) + if ((config_ptr->flash_threshold < 0.1) || (config_ptr->flash_threshold > 1.0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flash_threshold must be in the range [0.1, 1.0]") break; @@ -3781,10 +3777,10 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) } if (config_ptr->decr_mode == H5C_decr__threshold) { - if (config_ptr->upper_hr_threshold > (double)1.0f) + if (config_ptr->upper_hr_threshold > 1.0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0") - if ((config_ptr->decrement > (double)1.0f) || (config_ptr->decrement < (double)0.0f)) + if ((config_ptr->decrement > 1.0) || (config_ptr->decrement < 0.0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]") /* no need to check max_decrement as it is a size_t @@ -3801,7 +3797,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") if ((config_ptr->apply_empty_reserve) && - ((config_ptr->empty_reserve > (double)1.0f) || (config_ptr->empty_reserve < (double)0.0f))) + ((config_ptr->empty_reserve > 1.0) || (config_ptr->empty_reserve < 0.0))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]") /* no need to check max_decrement as it is a size_t @@ -3810,8 +3806,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */ if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) { - if ((config_ptr->upper_hr_threshold > (double)1.0f) || - (config_ptr->upper_hr_threshold < (double)0.0f)) + if ((config_ptr->upper_hr_threshold > 1.0) || (config_ptr->upper_hr_threshold < 0.0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be in the interval [0.0, 1.0]") } /* H5C_decr__age_out_with_threshold */ @@ -4279,8 +4274,8 @@ H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted) HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length); - HDassert((double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction); - HDassert((cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f); + HDassert(0.0 <= (cache_ptr->resize_ctl).min_clean_fraction); + HDassert((cache_ptr->resize_ctl).min_clean_fraction <= 100.0); /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this * is a re-entrant call via a client callback called in the resize @@ -4303,7 +4298,7 @@ H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted) if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") - HDassert(((double)0.0f <= hit_rate) && (hit_rate <= (double)1.0f)); + HDassert((0.0 <= hit_rate) && (hit_rate <= 1.0)); switch ((cache_ptr->resize_ctl).incr_mode) { case H5C_incr__off: diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index e59012c..104f1af 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -429,11 +429,11 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, int32_t aggregate_max_pins = 0; double hit_rate; double prefetch_use_rate; - double average_successful_search_depth = 0.0f; - double average_failed_search_depth = 0.0f; - double average_entries_skipped_per_calls_to_msic = 0.0f; - double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f; - double average_entries_scanned_per_calls_to_msic = 0.0f; + double average_successful_search_depth = 0.0; + double average_failed_search_depth = 0.0; + double average_entries_skipped_per_calls_to_msic = 0.0; + double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0; + double average_entries_scanned_per_calls_to_msic = 0.0; #endif /* H5C_COLLECT_CACHE_STATS */ herr_t ret_value = SUCCEED; /* Return value */ @@ -492,9 +492,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, } /* end for */ if ((total_hits > 0) || (total_misses > 0)) - hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses)); + hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses)); else - hit_rate = 0.0f; + hit_rate = 0.0; if (cache_ptr->successful_ht_searches > 0) average_successful_search_depth = ((double)(cache_ptr->total_successful_ht_search_depth)) / @@ -630,10 +630,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID])); if (cache_ptr->prefetches > 0) - prefetch_use_rate = - (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches)); + prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches)); else - prefetch_use_rate = 0.0f; + prefetch_use_rate = 0.0; HDfprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate); @@ -658,10 +657,10 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, ((cache_ptr->class_table_ptr))[i]->name); if ((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0)) - hit_rate = (double)100.0f * ((double)(cache_ptr->hits[i])) / + hit_rate = 100.0 * ((double)(cache_ptr->hits[i])) / ((double)(cache_ptr->hits[i] + cache_ptr->misses[i])); else - hit_rate = 0.0f; + hit_rate = 0.0; HDfprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix, (long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate); diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 20d3b4d..f17ff48 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -933,15 +933,14 @@ H5C_image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header) } /* end for */ if ((total_hits > 0) || (total_misses > 0)) - hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses)); + hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses)); else - hit_rate = 0.0f; + hit_rate = 0.0; if (cache_ptr->prefetches > 0) - prefetch_use_rate = - (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches)); + prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches)); else - prefetch_use_rate = 0.0f; + prefetch_use_rate = 0.0; if (print_header) { HDfprintf(stdout, "\nhit prefetches prefetch image pf hit\n"); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index fb5c3ea..27a24c4 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -115,20 +115,20 @@ #define H5C__CURR_CACHE_IMAGE_CTL_VER 1 /* Default configuration settings */ -#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f -#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f +#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999 +#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9 #define H5C__DEF_AR_MAX_SIZE ((size_t)(16 * 1024 * 1024)) #define H5C__DEF_AR_INIT_SIZE ((size_t)(1 * 1024 * 1024)) #define H5C__DEF_AR_MIN_SIZE ((size_t)(1 * 1024 * 1024)) -#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5f -#define H5C__DEF_AR_INCREMENT 2.0f +#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5 +#define H5C__DEF_AR_INCREMENT 2.0 #define H5C__DEF_AR_MAX_INCREMENT ((size_t)(2 * 1024 * 1024)) -#define H5C__DEF_AR_FLASH_MULTIPLE 1.0f -#define H5C__DEV_AR_FLASH_THRESHOLD 0.25f -#define H5C__DEF_AR_DECREMENT 0.9f +#define H5C__DEF_AR_FLASH_MULTIPLE 1.0 +#define H5C__DEV_AR_FLASH_THRESHOLD 0.25 +#define H5C__DEF_AR_DECREMENT 0.9 #define H5C__DEF_AR_MAX_DECREMENT ((size_t)(1 * 1024 * 1024)) #define H5C__DEF_AR_EPCHS_B4_EVICT 3 -#define H5C__DEF_AR_EMPTY_RESERVE 0.05f +#define H5C__DEF_AR_EMPTY_RESERVE 0.05 #define H5C__MIN_AR_EPOCH_LENGTH 100 #define H5C__DEF_AR_EPOCH_LENGTH 50000 #define H5C__MAX_AR_EPOCH_LENGTH 1000000 diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index cc61aa1..a244035 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -543,7 +543,7 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, amount_free = 0; HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:", - ((double)100.0f * (double)((dblock->size - blk_prefix_size) - amount_free) / + (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) / (double)(dblock->size - blk_prefix_size))); /* diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index d0cfa96..76e4ec0 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -102,7 +102,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, if (h->dblk_size) HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", - ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); + (100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); /* Print the data in a VMS-style octal dump */ H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index c8a97c2..2ebdbe3 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -768,7 +768,7 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double /* Check arguments. Note that we allow negative values - they are * considered to "unset" the property. */ - if (rdcc_w0 > (double)1.0f) + if (rdcc_w0 > 1.0) HGOTO_ERROR( H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive, or H5D_CHUNK_CACHE_W0_DEFAULT"); diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 70fc982..de67dfd 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -1486,9 +1486,8 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right) H5TRACE4("e", "iddd", plist_id, left, middle, right); /* Check arguments */ - if (left < (double)0.0f || left > (double)1.0f || middle < (double)0.0f || middle > (double)1.0f || - right < (double)0.0f || right > (double)1.0f) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0") + if (left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 || right < 0.0 || right > 1.0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0 <= X <= 1.0") /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index fb7b195..49cc27e 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1686,7 +1686,7 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots, H5TRACE5("e", "iIszzd", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0); /* Check arguments */ - if (rdcc_w0 < (double)0.0f || rdcc_w0 > (double)1.0f) + if (rdcc_w0 < 0.0 || rdcc_w0 > 1.0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive") diff --git a/src/H5T.c b/src/H5T.c index 666c33d..532feac 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -562,8 +562,8 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0; /* (+/- Inf for all floating-point types) */ 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 = (double)0.0f; -double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f; +double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0; +double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0; /* Declare the free list for H5T_t's and H5T_shared_t's */ H5FL_DEFINE(H5T_t); diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index d8fed41..d29d8e5 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -48,7 +48,7 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{ H5Z__filter_deflate, /* The actual filter function */ }}; -#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * (double)1.001f) + 12) +#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12) /*------------------------------------------------------------------------- * Function: H5Z__filter_deflate diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 5310f7d..2e1a474 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -1116,7 +1116,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu unsigned filavail; /* flag indicating if fill value is defined or not */ H5Z_SO_scale_type_t scale_type = H5Z_SO_FLOAT_DSCALE; /* scale type */ int scale_factor = 0; /* scale factor */ - double D_val = 0.0f; /* decimal scale factor */ + double D_val = 0.0; /* decimal scale factor */ uint32_t minbits = 0; /* minimum number of bits to store values */ unsigned long long minval = 0; /* minimum value of input buffer */ enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */ diff --git a/src/H5timer.c b/src/H5timer.c index 54a3365..b2cc5f0 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -42,9 +42,9 @@ #define H5TIMER_TIME_STRING_LEN 1536 /* Conversion factors */ -#define H5_SEC_PER_DAY (double)(24.0F * 60.0F * 60.0F) -#define H5_SEC_PER_HOUR (double)(60.0F * 60.0F) -#define H5_SEC_PER_MIN (double)(60.0F) +#define H5_SEC_PER_DAY (24.0 * 60.0 * 60.0) +#define H5_SEC_PER_HOUR (60.0 * 60.0) +#define H5_SEC_PER_MIN (60.0) /******************/ /* Local Typedefs */ @@ -100,13 +100,13 @@ H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds) { double bw; - if (nseconds <= (double)0.0F) + if (nseconds <= 0.0) HDstrcpy(buf, " NaN"); else { bw = nbytes / nseconds; - if (H5_DBL_ABS_EQUAL(bw, (double)0.0F)) + if (H5_DBL_ABS_EQUAL(bw, 0.0)) HDstrcpy(buf, "0.000 B/s"); - else if (bw < (double)1.0F) + else if (bw < 1.0) HDsprintf(buf, "%10.4e", bw); else if (bw < (double)H5_KB) { HDsprintf(buf, "%05.4f", bw); @@ -224,7 +224,7 @@ H5_now_usec(void) double H5_get_time(void) { - double ret_value = (double)0.0f; + double ret_value = 0.0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -233,14 +233,14 @@ H5_get_time(void) struct timespec ts; HDclock_gettime(CLOCK_MONOTONIC, &ts); - ret_value = (double)ts.tv_sec + ((double)ts.tv_nsec / (double)1000000000.0f); + ret_value = (double)ts.tv_sec + ((double)ts.tv_nsec / 1000000000.0); } #elif defined(H5_HAVE_GETTIMEOFDAY) { struct timeval now_tv; HDgettimeofday(&now_tv, NULL); - ret_value = (double)now_tv.tv_sec + ((double)now_tv.tv_usec / (double)1000000.0f); + ret_value = (double)now_tv.tv_sec + ((double)now_tv.tv_usec / 1000000.0); } #else ret_value = (double)HDtime(NULL); @@ -289,8 +289,8 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) if (HDgetrusage(RUSAGE_SELF, &res) < 0) return -1; - times->system = (double)res.ru_stime.tv_sec + ((double)res.ru_stime.tv_usec / (double)1.0E6F); - times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / (double)1.0E6F); + times->system = (double)res.ru_stime.tv_sec + ((double)res.ru_stime.tv_usec / 1.0E6); + times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / 1.0E6); } #else /* No suitable way to get system/user times */ @@ -589,7 +589,7 @@ H5_timer_get_time_string(double seconds) double remainder_sec = 0.0; /* Extract larger time units from count of seconds */ - if (seconds > (double)60.0F) { + if (seconds > 60.0) { /* Set initial # of seconds */ remainder_sec = seconds; @@ -617,19 +617,19 @@ H5_timer_get_time_string(double seconds) * time unit. Perhaps this could be passed as an integer. * (name? round_up_size? ?) */ - if (seconds < (double)0.0F) + if (seconds < 0.0) HDsprintf(s, "N/A"); - else if (H5_DBL_ABS_EQUAL((double)0.0F, seconds)) + else if (H5_DBL_ABS_EQUAL(0.0, seconds)) HDsprintf(s, "0.0 s"); - else if (seconds < (double)1.0E-6F) + else if (seconds < 1.0E-6) /* t < 1 us, Print time in ns */ - HDsprintf(s, "%.f ns", seconds * (double)1.0E9F); - else if (seconds < (double)1.0E-3F) + HDsprintf(s, "%.f ns", seconds * 1.0E9); + else if (seconds < 1.0E-3) /* t < 1 ms, Print time in us */ - HDsprintf(s, "%.1f us", seconds * (double)1.0E6F); - else if (seconds < (double)1.0F) + HDsprintf(s, "%.1f us", seconds * 1.0E6); + else if (seconds < 1.0) /* t < 1 s, Print time in ms */ - HDsprintf(s, "%.1f ms", seconds * (double)1.0E3F); + HDsprintf(s, "%.1f ms", seconds * 1.0E3); else if (seconds < H5_SEC_PER_MIN) /* t < 1 m, Print time in s */ HDsprintf(s, "%.2f s", seconds); diff --git a/src/H5trace.c b/src/H5trace.c index d587853..ecb2705 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -3903,14 +3903,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if (returning) { if (current_depth > 1) { --current_depth; - return (double)0.0F; + return 0.0; } } else { if (current_depth > 0) { /* Do not update last_call_depth */ current_depth++; - return (double)0.0F; + return 0.0; } } } @@ -3997,5 +3997,5 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if (H5_debug_g.ttimes) return function_times.elapsed; else - return (double)0.0F; + return 0.0; } /* end H5_trace() */ diff --git a/test/cache.c b/test/cache.c index 3f2a404..0081830 100644 --- a/test/cache.c +++ b/test/cache.c @@ -26482,7 +26482,7 @@ check_auto_cache_resize_aux_fcns(unsigned paged) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; } - else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f)) { /* i.e. hit_rate != 0.0 */ + else if (!H5_DBL_ABS_EQUAL(hit_rate, 0.0)) { /* i.e. hit_rate != 0.0 */ pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate returned unexpected hit rate 1.\n"; @@ -26513,7 +26513,7 @@ check_auto_cache_resize_aux_fcns(unsigned paged) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; } - else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f)) { /* i.e. hit_rate != 0.0 */ + else if (!H5_DBL_ABS_EQUAL(hit_rate, 0.0)) { /* i.e. hit_rate != 0.0 */ pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate returned unexpected hit rate 2.\n"; @@ -26554,7 +26554,7 @@ check_auto_cache_resize_aux_fcns(unsigned paged) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; } - else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.5f)) { /* i.e. hit_rate != 0.5 */ + else if (!H5_DBL_ABS_EQUAL(hit_rate, 0.5)) { /* i.e. hit_rate != 0.5 */ pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate returned unexpected hit rate 3.\n"; @@ -26627,7 +26627,7 @@ check_auto_cache_resize_aux_fcns(unsigned paged) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; } - else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.5F)) { /* i.e. hit_rate != 0.5 */ + else if (!H5_DBL_ABS_EQUAL(hit_rate, 0.5)) { /* i.e. hit_rate != 0.5 */ pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate returned unexpected hit rate 4.\n"; diff --git a/test/cache_api.c b/test/cache_api.c index 75e1b9d..5d0f395 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -81,27 +81,27 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t evictions_enabled = */ TRUE, /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024 + 1), - /* double min_clean_fraction = */ 0.2f, + /* double min_clean_fraction = */ 0.2, /* size_t max_size = */ (16 * 1024 * 1024 + 1), /* size_t min_size = */ (1 * 1024 * 1024 + 1), /* long int epoch_length = */ 50001, /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.91f, - /* double increment = */ 2.1f, + /* double lower_hr_threshold = */ 0.91, + /* double increment = */ 2.1, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024 + 1), /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, - /* double upper_hr_threshold = */ 0.998f, - /* double decrement = */ 0.91f, + /* double upper_hr_threshold = */ 0.998, + /* double decrement = */ 0.91, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f, + /* double empty_reserve = */ 0.05, /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; @@ -526,22 +526,22 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t evictions_enabled = */ TRUE, /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024 + 1), - /* double min_clean_fraction = */ 0.2f, + /* double min_clean_fraction = */ 0.2, /* size_t max_size = */ (16 * 1024 * 1024 + 1), /* size_t min_size = */ (1 * 1024 * 1024 + 1), /* long int epoch_length = */ 50001, /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.91f, - /* double increment = */ 2.1f, + /* double lower_hr_threshold = */ 0.91, + /* double increment = */ 2.1, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024 + 1), /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, - /* double upper_hr_threshold = */ 0.998f, - /* double decrement = */ 0.91f, + /* double upper_hr_threshold = */ 0.998, + /* double decrement = */ 0.91, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), /* int epochs_before_eviction = */ 4, @@ -559,27 +559,27 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t evictions_enabled = */ TRUE, /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (512 * 1024), - /* double min_clean_fraction = */ 0.1f, + /* double min_clean_fraction = */ 0.1, /* size_t max_size = */ (8 * 1024 * 1024), /* size_t min_size = */ (512 * 1024), /* long int epoch_length = */ 25000, /* 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 = */ (2 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 1.5f, - /* double flash_threshold = */ 0.4f, + /* double flash_multiple = */ 1.5, + /* double flash_threshold = */ 0.4, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.9995f, - /* double decrement = */ 0.95f, + /* double upper_hr_threshold = */ 0.9995, + /* double decrement = */ 0.95, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (512 * 1024), /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f, + /* double empty_reserve = */ 0.05, /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; @@ -592,27 +592,27 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t evictions_enabled = */ TRUE, /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.2f, + /* double min_clean_fraction = */ 0.2, /* size_t max_size = */ (16 * 1024 * 1024), /* size_t min_size = */ (1 * 1024 * 1024), /* long int epoch_length = */ 50000, /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.90f, - /* double increment = */ 2.0f, + /* double lower_hr_threshold = */ 0.90, + /* 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__off, - /* double flash_multiple = */ 2.1f, - /* double flash_threshold = */ 0.6f, + /* double flash_multiple = */ 2.1, + /* double flash_threshold = */ 0.6, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* 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 = */ FALSE, /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ FALSE, - /* double empty_reserve = */ 0.05f, + /* double empty_reserve = */ 0.05, /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; @@ -625,28 +625,28 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t evictions_enabled = */ TRUE, /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.15f, + /* double min_clean_fraction = */ 0.15, /* size_t max_size = */ (20 * 1024 * 1024), /* size_t min_size = */ (1 * 1024 * 1024), /* long int epoch_length = */ 75000, /* 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 = */ (2 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 1.1f, - /* double flash_threshold = */ 0.3f, + /* double flash_multiple = */ 1.1, + /* double flash_threshold = */ 0.3, /* 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, /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; @@ -755,7 +755,7 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fget_mdc_hit_rate() failed 1.\n"; } - else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f)) { + else if (!H5_DBL_ABS_EQUAL(hit_rate, 0.0)) { pass = FALSE; failure_mssg = "H5Fget_mdc_hit_rate() returned unexpected hit rate.\n"; @@ -857,7 +857,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) hbool_t valid_chunk; hbool_t dump_hit_rate = FALSE; int64_t min_accesses = 1000; - double min_hit_rate = 0.90f; + double min_hit_rate = 0.90; hbool_t dump_cache_size = FALSE; hid_t file_id = -1; hid_t dataspace_id = -1; @@ -883,27 +883,27 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* hbool_t evictions_enabled = */ TRUE, /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ 500000, - /* double min_clean_fraction = */ 0.1f, + /* double min_clean_fraction = */ 0.1, /* size_t max_size = */ 16000000, /* size_t min_size = */ 250000, /* long int epoch_length = */ 50000, /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.95f, - /* double increment = */ 2.0f, + /* double lower_hr_threshold = */ 0.95, + /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* 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 = */ FALSE, /* size_t max_decrement = */ 1000000, /* int epochs_before_eviction = */ 2, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f, + /* double empty_reserve = */ 0.05, /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; @@ -916,27 +916,27 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* hbool_t evictions_enabled = */ TRUE, /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ 12000000, - /* double min_clean_fraction = */ 0.1f, + /* double min_clean_fraction = */ 0.1, /* size_t max_size = */ 16000000, /* size_t min_size = */ 250000, /* long int epoch_length = */ 50000, /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.95f, - /* double increment = */ 2.0f, + /* double lower_hr_threshold = */ 0.95, + /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* 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 = */ FALSE, /* size_t max_decrement = */ 1000000, /* int epochs_before_eviction = */ 2, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f, + /* double empty_reserve = */ 0.05, /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; @@ -949,27 +949,27 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* hbool_t evictions_enabled = */ TRUE, /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ 2000000, - /* double min_clean_fraction = */ 0.1f, + /* double min_clean_fraction = */ 0.1, /* size_t max_size = */ 16000000, /* size_t min_size = */ 250000, /* long int epoch_length = */ 50000, /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.95f, - /* double increment = */ 2.0f, + /* double lower_hr_threshold = */ 0.95, + /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* 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 = */ FALSE, /* size_t max_decrement = */ 1000000, /* int epochs_before_eviction = */ 2, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f, + /* double empty_reserve = */ 0.05, /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; @@ -1517,26 +1517,26 @@ init_invalid_configs(void) configs[i].evictions_enabled = TRUE; configs[i].set_initial_size = TRUE; configs[i].initial_size = (1 * 1024 * 1024); - configs[i].min_clean_fraction = 0.25F; + configs[i].min_clean_fraction = 0.25; configs[i].max_size = (16 * 1024 * 1024); configs[i].min_size = (1 * 1024 * 1024); configs[i].epoch_length = 50000; configs[i].incr_mode = H5C_incr__threshold; - configs[i].lower_hr_threshold = 0.9F; - configs[i].increment = 2.0F; + configs[i].lower_hr_threshold = 0.9; + configs[i].increment = 2.0; configs[i].apply_max_increment = TRUE; configs[i].max_increment = (4 * 1024 * 1024); configs[i].flash_incr_mode = H5C_flash_incr__off; - configs[i].flash_multiple = 2.0F; - configs[i].flash_threshold = 0.5F; + configs[i].flash_multiple = 2.0; + configs[i].flash_threshold = 0.5; configs[i].decr_mode = H5C_decr__age_out_with_threshold; - configs[i].upper_hr_threshold = 0.999F; - configs[i].decrement = 0.9F; + configs[i].upper_hr_threshold = 0.999; + configs[i].decrement = 0.9; configs[i].apply_max_decrement = TRUE; configs[i].max_decrement = (1 * 1024 * 1024); configs[i].epochs_before_eviction = 3; configs[i].apply_empty_reserve = TRUE; - configs[i].empty_reserve = 0.1F; + configs[i].empty_reserve = 0.1; configs[i].dirty_bytes_threshold = (256 * 1024); configs[i].metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY; } @@ -1567,10 +1567,10 @@ init_invalid_configs(void) configs[6].initial_size = (1 * 1024 * 1024 - 1); /* 7 -- min_clean_fraction too big */ - configs[7].min_clean_fraction = 1.000001f; + configs[7].min_clean_fraction = 1.000001; /* 8 -- min_clean_fraction too small */ - configs[8].min_clean_fraction = -0.00000001f; + configs[8].min_clean_fraction = -0.00000001; /* 9 -- epoch_length too small */ configs[9].epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1; @@ -1582,10 +1582,10 @@ init_invalid_configs(void) configs[11].incr_mode = (enum H5C_cache_incr_mode) - 1; /* 12 -- lower_hr_threshold too small */ - configs[12].lower_hr_threshold = -0.000001f; + configs[12].lower_hr_threshold = -0.000001; /* 13 -- lower_hr_threshold too big */ - configs[13].lower_hr_threshold = 1.00000001f; + configs[13].lower_hr_threshold = 1.00000001; /* 14 -- increment too small */ configs[14].increment = 0.999999999999; @@ -1595,29 +1595,29 @@ init_invalid_configs(void) /* 16 -- flash_multiple too small */ configs[16].flash_incr_mode = H5C_flash_incr__add_space; - configs[16].flash_multiple = 0.09f; + configs[16].flash_multiple = 0.09; /* 17 -- flash_multiple too big */ configs[17].flash_incr_mode = H5C_flash_incr__add_space; - configs[17].flash_multiple = 10.001f; + configs[17].flash_multiple = 10.001; /* 18 -- flash_threshold too small */ configs[18].flash_incr_mode = H5C_flash_incr__add_space; - configs[18].flash_threshold = 0.099f; + configs[18].flash_threshold = 0.099; /* 19 -- flash_threshold too big */ configs[19].flash_incr_mode = H5C_flash_incr__add_space; - configs[19].flash_threshold = 1.001f; + configs[19].flash_threshold = 1.001; /* 20 -- bad decr_mode */ configs[20].decr_mode = (enum H5C_cache_decr_mode) - 1; /* 21 -- upper_hr_threshold too big */ - configs[21].upper_hr_threshold = 1.00001f; + configs[21].upper_hr_threshold = 1.00001; /* 22 -- decrement too small */ configs[22].decr_mode = H5C_decr__threshold; - configs[22].decrement = -0.0000000001f; + configs[22].decrement = -0.0000000001; /* 23 -- decrement too big */ configs[23].decr_mode = H5C_decr__threshold; @@ -1630,20 +1630,20 @@ init_invalid_configs(void) configs[25].epochs_before_eviction = H5C__MAX_EPOCH_MARKERS + 1; /* 26 -- empty_reserve too small */ - configs[26].empty_reserve = -0.0000000001f; + configs[26].empty_reserve = -0.0000000001; /* 27 -- empty_reserve too big */ configs[27].empty_reserve = 1.00000000001; /* 28 -- upper_hr_threshold too small */ - configs[28].upper_hr_threshold = -0.000000001f; + configs[28].upper_hr_threshold = -0.000000001; /* 29 -- upper_hr_threshold too big */ configs[29].upper_hr_threshold = 1.00000001; /* 30 -- upper_hr_threshold <= lower_hr_threshold */ - configs[30].lower_hr_threshold = 0.9f; - configs[30].upper_hr_threshold = 0.9f; + configs[30].lower_hr_threshold = 0.9; + configs[30].upper_hr_threshold = 0.9; /* 31 -- dirty_bytes_threshold too small */ configs[31].dirty_bytes_threshold = (H5C__MIN_MAX_CACHE_SIZE / 2) - 1; diff --git a/test/cross_read.c b/test/cross_read.c index 386c0da..eef814f 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -159,9 +159,9 @@ check_data_f(const char *dsetname, hid_t fid) /* Input (last row is different) */ for (i = 0; i < NX; i++) for (j = 0; j < NY; j++) - data_in[i][j] = ((double)(i + j + 1)) / (double)3.0F; + data_in[i][j] = ((double)(i + j + 1)) / 3.0; for (i = 0; i < NY; i++) - data_in[NX][i] = -2.2F; + data_in[NX][i] = -2.2; /* Output */ HDmemset(data_out, 0, (NX + 1) * NY * sizeof(double)); @@ -174,7 +174,7 @@ check_data_f(const char *dsetname, hid_t fid) /* Check results */ for (i = 0; i < (NX + 1); i++) for (j = 0; j < NY; j++) - if (!H5_DBL_REL_EQUAL(data_out[i][j], data_in[i][j], (double)0.001F)) + if (!H5_DBL_REL_EQUAL(data_out[i][j], data_in[i][j], 0.001)) if (!nerrors++) { H5_FAILED(); HDprintf("element [%d][%d] is %g but should have been %g\n", (int)i, (int)j, diff --git a/test/dsets.c b/test/dsets.c index e38f253..88dcb35 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -6520,7 +6520,7 @@ test_set_local(hid_t fapl) for (i = 0; i < DSET_DIM1; i++) for (j = 0; j < DSET_DIM2; j++) { points[i][j] = (int)n++; - points_dbl[i][j] = (double)1.5F * n++; + points_dbl[i][j] = 1.5 * n++; } /* Open file */ @@ -6716,7 +6716,7 @@ test_set_local(hid_t fapl) for (j = 0; j < dims[1]; j++) { /* If the difference between two values is greater than 0.001%, they're * considered not equal. */ - if (!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) { + if (!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], 0.00001)) { H5_FAILED(); HDprintf(" Line %d: Read different values than written.\n", __LINE__); HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); @@ -8803,7 +8803,7 @@ test_chunk_cache(hid_t fapl) /* Set new rdcc settings on fapl */ nslots_2 = nslots_1 * 2; nbytes_2 = nbytes_1 * 2; - w0_2 = w0_1 / (double)2.0F; + w0_2 = w0_1 / 2.0; if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR diff --git a/test/dt_arith.c b/test/dt_arith.c index ddc8814..7b79102 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -3232,7 +3232,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) int expo_diff = check_expo[0] - check_expo[1]; int valid_bits = (int)((dst_ebias + dst_msize) + (size_t)MIN(check_expo[0], check_expo[1])) - 1; - double epsilon = 1.0F; + double epsilon = 1.0; /* Re-scale the mantissas based on any exponent difference */ if (expo_diff != 0) diff --git a/test/dtypes.c b/test/dtypes.c index 626c58c..52eb0ea 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2284,9 +2284,9 @@ test_compound_11(void) /* Initialize buffer */ for (u = 0; u < NTESTELEM; u++) { - ((big_t *)buf)[u].d1 = (double)u * (double)1.5f; - ((big_t *)buf)[u].d2 = (double)u * (double)2.5f; - ((big_t *)buf)[u].d3 = (double)u * (double)3.5f; + ((big_t *)buf)[u].d1 = (double)u * 1.5; + ((big_t *)buf)[u].d2 = (double)u * 2.5; + ((big_t *)buf)[u].d3 = (double)u * 3.5; ((big_t *)buf)[u].i1 = (int)(u * 3); ((big_t *)buf)[u].i2 = (int)(u * 5); ((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32); diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 83298c8..9b4879e 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -141,11 +141,11 @@ main(void) hid_t vspace = -1; /* Virtual dset dataspaces */ hsize_t dims[1] = {3}; /* Data space current size */ hsize_t chunk_size[2] = {16384, 4}; /* chunk size */ - double fill = 2.7f; /* Fill value */ + double fill = 2.7; /* Fill value */ hsize_t max_size[1]; /* data space maximum size */ size_t nslots = 521 * 2; size_t nbytes = 1048576 * 10; - double w0 = 0.5f; + double w0 = 0.5; unsigned max_compact; unsigned min_dense; const char * c_to_f = "x+32"; @@ -159,26 +159,26 @@ main(void) TRUE, FALSE, (2 * 2048 * 1024), - 0.3f, + 0.3, (64 * 1024 * 1024), (4 * 1024 * 1024), 60000, H5C_incr__threshold, - 0.8f, - 3.0f, + 0.8, + 3.0, TRUE, (8 * 1024 * 1024), H5C_flash_incr__add_space, - 2.0f, - 0.25f, + 2.0, + 0.25, H5C_decr__age_out_with_threshold, - 0.997f, - 0.8f, + 0.997, + 0.8, TRUE, (3 * 1024 * 1024), 3, FALSE, - 0.2f, + 0.2, (256 * 2048), H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; diff --git a/test/gen_cross.c b/test/gen_cross.c index 3eac79a..2746bb6 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -295,7 +295,7 @@ create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid) hid_t dataset = -1; /* dataset handles */ hid_t dcpl = -1; double data[NX][NY]; /* data to write */ - double fillvalue = -2.2f; + double fillvalue = -2.2; hsize_t chunk[RANK] = {CHUNK0, CHUNK1}; int i, j; diff --git a/test/gen_plist.c b/test/gen_plist.c index 7a67c56..10c6423 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -42,7 +42,7 @@ main(void) hsize_t max_size[1]; /* data space maximum size */ size_t nslots = 521 * 2; size_t nbytes = 1048576 * 10; - double w0 = 0.5f; + double w0 = 0.5; unsigned max_compact; unsigned min_dense; const char * c_to_f = "x+32"; @@ -56,26 +56,26 @@ main(void) 1 /*TRUE*/, 0 /*FALSE*/, (2 * 2048 * 1024), - 0.3f, + 0.3, (64 * 1024 * 1024), (4 * 1024 * 1024), 60000, H5C_incr__threshold, - 0.8f, - 3.0f, + 0.8, + 3.0, 1 /*TRUE*/, (8 * 1024 * 1024), H5C_flash_incr__add_space, - 2.0f, - 0.25f, + 2.0, + 0.25, H5C_decr__age_out_with_threshold, - 0.997f, - 0.8f, + 0.997, + 0.8, 1 /*TRUE*/, (3 * 1024 * 1024), 3, 0 /*FALSE*/, - 0.2f, + 0.2, (256 * 2048), H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY}; H5AC_cache_image_config_t my_cache_image_config = {H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, TRUE, FALSE, diff --git a/test/links.c b/test/links.c index 2ac2e28..b2d0d9a 100644 --- a/test/links.c +++ b/test/links.c @@ -140,7 +140,7 @@ const char *FILENAME[] = {"links0", #define H5L_DIM1 100 #define H5L_DIM2 100 -#define FILTER_FILESIZE_MAX_FRACTION (double)0.9F +#define FILTER_FILESIZE_MAX_FRACTION 0.9 /* Creation order macros */ #define CORDER_GROUP_NAME "corder_group" diff --git a/test/mtime.c b/test/mtime.c index 78f9065..43dc502 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -120,7 +120,7 @@ main(void) HDputs(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; } - else if (HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) { + else if (HDfabs(HDdifftime(now, oi1.ctime)) > 60.0) { H5_FAILED(); tm = HDlocaltime(&(oi1.ctime)); HDstrftime((char *)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); diff --git a/test/objcopy.c b/test/objcopy.c index 681b8a5..43a5756 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2936,7 +2936,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t HDmemset(buf, 0, sizeof(buf)); for (i = 0; i < DIM_SIZE_1; i++) { buf[i].a = i; - buf[i].d = (double)1.0F / (double)(i + 1); + buf[i].d = 1.0 / (double)(i + 1); } /* end for */ /* Initialize the filenames */ diff --git a/test/tattr.c b/test/tattr.c index 3f0c102..b602222 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -519,13 +519,13 @@ test_attr_basic_read(hid_t fapl) static void test_attr_flush(hid_t fapl) { - hid_t fil, /* File ID */ - att, /* Attribute ID */ - spc, /* Dataspace ID */ - set; /* Dataset ID */ - double wdata = 3.14159F; /* Data to write */ - double rdata; /* Data read in */ - herr_t ret; /* Generic return value */ + hid_t fil, /* File ID */ + att, /* Attribute ID */ + spc, /* Dataspace ID */ + set; /* Dataset ID */ + double wdata = 3.14159; /* Data to write */ + double rdata; /* Data read in */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Attribute Flushing\n")); @@ -545,8 +545,8 @@ test_attr_flush(hid_t fapl) ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if (!H5_DBL_ABS_EQUAL(rdata, (double)0.0f)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, (double)0.0F); + if (!H5_DBL_ABS_EQUAL(rdata, 0.0)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0); ret = H5Fflush(fil, H5F_SCOPE_GLOBAL); CHECK(ret, FAIL, "H5Fflush"); @@ -554,8 +554,8 @@ test_attr_flush(hid_t fapl) ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if (!H5_DBL_ABS_EQUAL(rdata, (double)0.0f)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, (double)0.0F); + if (!H5_DBL_ABS_EQUAL(rdata, 0.0)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0); ret = H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata); CHECK(ret, FAIL, "H5Awrite"); diff --git a/test/tgenprop.c b/test/tgenprop.c index 7e805e2..55e5a9b 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -55,7 +55,7 @@ char prop3_def[10] = "Ten chars"; /* Property 3 default value */ #define PROP3_DEF_VALUE (&prop3_def) #define PROP4_NAME "Property 4" -double prop4_def = 1.41F; /* Property 4 default value */ +double prop4_def = 1.41; /* Property 4 default value */ #define PROP4_SIZE sizeof(prop4_def) #define PROP4_DEF_VALUE (&prop4_def) diff --git a/test/th5s.c b/test/th5s.c index 30c3396..51216dc 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -2575,7 +2575,7 @@ test_h5s_chunk(void) for (i = 0; i < CHUNK_DATA_NX; i++) { for (j = 0; j < CHUNK_DATA_NY; j++) { /* Check if the two values are within 0.001% range. */ - if (!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F)) + if (!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], 0.00001)) TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]); diff --git a/test/timer.c b/test/timer.c index 24f3245..bb474ca 100644 --- a/test/timer.c +++ b/test/timer.c @@ -144,7 +144,7 @@ test_timer_system_user(void) /* The system and user times may not be present on some systems. They * will be -1.0 if they are not. */ - if (timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) { + if (timer.initial.system < 0.0 || timer.initial.user < 0.0) { SKIPPED(); HDprintf("NOTE: No suitable way to get system/user times on this platform.\n"); return 0; @@ -165,7 +165,7 @@ test_timer_system_user(void) TEST_ERROR; /* System and user times should be non-negative. */ - if (times.system < (double)0.0f || times.user < (double)0.0f) + if (times.system < 0.0 || times.user < 0.0) TEST_ERROR; PASSED(); @@ -224,7 +224,7 @@ test_timer_elapsed(void) TEST_ERROR; /* Elapsed time should be non-negative. */ - if (times.elapsed < (double)0.0f) + if (times.elapsed < 0.0) TEST_ERROR; PASSED(); @@ -260,11 +260,11 @@ test_timer_functionality(void) /* Times should be initialized to zero */ err = H5_timer_get_times(timer, ×); - if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) + if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, 0.0)) TEST_ERROR; err = H5_timer_get_total_times(timer, ×); - if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) + if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, 0.0)) TEST_ERROR; /******************** @@ -289,11 +289,11 @@ test_timer_functionality(void) /* Times should be positive and non-negative */ err = H5_timer_get_times(timer, ×); - if (err < 0 || times.elapsed < (double)0.0f) + if (err < 0 || times.elapsed < 0.0) TEST_ERROR; err = H5_timer_get_total_times(timer, ×); - if (err < 0 || times.elapsed < (double)0.0f) + if (err < 0 || times.elapsed < 0.0) TEST_ERROR; /********************** @@ -306,11 +306,11 @@ test_timer_functionality(void) TEST_ERROR; err = H5_timer_get_times(timer, ×); - if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) + if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, 0.0)) TEST_ERROR; err = H5_timer_get_total_times(timer, ×); - if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) + if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, 0.0)) TEST_ERROR; /* Timer state should flip */ @@ -326,12 +326,12 @@ test_timer_functionality(void) /* Times should be non-negative */ err = H5_timer_get_times(timer, ×); - if (err < 0 || times.elapsed < (double)0.0f) + if (err < 0 || times.elapsed < 0.0) TEST_ERROR; prev_etime = times.elapsed; err = H5_timer_get_total_times(timer, ×); - if (err < 0 || times.elapsed < (double)0.0f) + if (err < 0 || times.elapsed < 0.0) TEST_ERROR; prev_total_etime = times.elapsed; diff --git a/test/tmisc.c b/test/tmisc.c index 51e203a..302da0d 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2521,17 +2521,17 @@ test_misc13(void) static void test_misc14(void) { - hid_t file_id; /* File ID */ - hid_t fapl; /* File access property list ID */ - hid_t DataSpace; /* Dataspace ID */ - hid_t Dataset1; /* Dataset ID #1 */ - hid_t Dataset2; /* Dataset ID #2 */ - hid_t Dataset3; /* Dataset ID #3 */ - double data1 = 5.0F; /* Data to write for dataset #1 */ - double data2 = 10.0F; /* Data to write for dataset #2 */ - double data3 = 15.0F; /* Data to write for dataset #3 */ - double rdata; /* Data read in */ - herr_t ret; /* Generic return value */ + hid_t file_id; /* File ID */ + hid_t fapl; /* File access property list ID */ + hid_t DataSpace; /* Dataspace ID */ + hid_t Dataset1; /* Dataset ID #1 */ + hid_t Dataset2; /* Dataset ID #2 */ + hid_t Dataset3; /* Dataset ID #3 */ + double data1 = 5.0; /* Data to write for dataset #1 */ + double data2 = 10.0; /* Data to write for dataset #2 */ + double data3 = 15.0; /* Data to write for dataset #3 */ + double rdata; /* Data read in */ + herr_t ret; /* Generic return value */ /* Test creating two datasets and deleting the second */ diff --git a/testpar/t_prop.c b/testpar/t_prop.c index 92c8bc0..a3f1859 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -98,10 +98,10 @@ test_plist_ed(void) int mpi_size, mpi_rank, recv_proc; hsize_t chunk_size = 16384; /* chunk size */ - double fill = 2.7f; /* Fill value */ + double fill = 2.7; /* Fill value */ size_t nslots = 521 * 2; size_t nbytes = 1048576 * 10; - double w0 = 0.5f; + double w0 = 0.5; unsigned max_compact; unsigned min_dense; hsize_t max_size[1]; /*data space maximum size */ @@ -114,26 +114,26 @@ test_plist_ed(void) TRUE, FALSE, (2 * 2048 * 1024), - 0.3f, + 0.3, (64 * 1024 * 1024), (4 * 1024 * 1024), 60000, H5C_incr__threshold, - 0.8f, - 3.0f, + 0.8, + 3.0, TRUE, (8 * 1024 * 1024), H5C_flash_incr__add_space, - 2.0f, - 0.25f, + 2.0, + 0.25, H5C_decr__age_out_with_threshold, - 0.997f, - 0.8f, + 0.997, + 0.8, TRUE, (3 * 1024 * 1024), 3, FALSE, - 0.2f, + 0.2, (256 * 2048), H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 603b1f3..1b81824 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -375,7 +375,7 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char opts->percent = HDatof(opt_arg); /* -p 0 is the same as default */ - if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F)) + if (H5_DBL_ABS_EQUAL(opts->percent, 0.0)) opts->percent_bool = 0; break; diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index a0b9441..4392d85 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1983,7 +1983,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) HSIZE_T_FORMAT " logical byte%s, " HSIZE_T_FORMAT " allocated byte%s", total, 1 == total ? "" : "s", used, 1 == used ? "" : "s"); if (used > 0) { - utilization = ((double)total * (double)100.0f) / (double)used; + utilization = ((double)total * 100.0) / (double)used; h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization); } } diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 3e7a8c1..e091a8a 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1609,7 +1609,7 @@ print_storage_summary(const iter_t *iter) { hsize_t total_meta = 0; hsize_t unaccount = 0; - double percent = 0.0f; + double percent = 0.0; HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]); HDfprintf(stdout, "File space page size: %" PRIuHSIZE " bytes\n", iter->fsp_size); @@ -1624,7 +1624,7 @@ print_storage_summary(const iter_t *iter) HDfprintf(stdout, " File metadata: %" PRIuHSIZE " bytes\n", total_meta); HDfprintf(stdout, " Raw data: %" PRIuHSIZE " bytes\n", iter->dset_storage_size); - percent = ((double)iter->free_space / (double)iter->filesize) * (double)100.0f; + percent = ((double)iter->free_space / (double)iter->filesize) * 100.0; HDfprintf(stdout, " Amount/Percent of tracked free space: %" PRIuHSIZE " bytes/%3.1f%%\n", iter->free_space, percent); diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c index 340e31b..e49125b 100644 --- a/tools/test/h5import/h5importtest.c +++ b/tools/test/h5import/h5importtest.c @@ -64,8 +64,8 @@ main(void) double b64r3[5][3][4]; double row8[3], col8[4], pln8[5]; - double rowo8 = 11.0F, colo8 = 21.0F, plno8 = 51.0F; - double rowi8 = 1.0F, coli8 = 2.0F, plni8 = 5.0F; + double rowo8 = 11.0, colo8 = 21.0, plno8 = 51.0; + double rowi8 = 1.0, coli8 = 2.0, plni8 = 5.0; /* Initialize machine endian */ volatile uint32_t ibyte = 0x01234567; diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index ada2ed3..1b6793a 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -55,20 +55,20 @@ #define RM_CACHE_STRT 25 #define RM_CACHE_END 25 #define RM_CACHE_DELT 5 -#define RM_START (double)0.50F -#define RM_END (double)5.00F -#define RM_DELTA (double)0.50F -#define RM_W0 0.0F +#define RM_START 0.50 +#define RM_END 5.00 +#define RM_DELTA 0.50 +#define RM_W0 0.0 #define RM_NRDCC 521 /* Diagonal test */ #define DIAG_CACHE_STRT 25 #define DIAG_CACHE_END 25 #define DIAG_CACHE_DELT 5 -#define DIAG_START (double)0.50F -#define DIAG_END (double)5.00F -#define DIAG_DELTA (double)0.50F -/* #define DIAG_W0 0.65F */ +#define DIAG_START 0.50 +#define DIAG_END 5.00 +#define DIAG_DELTA 0.50 +/* #define DIAG_W0 0.65 */ /* #define DIAG_NRDCC 521 */ static size_t nio_g; diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index fcaa337..25fa34c 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -262,13 +262,14 @@ check_partial_chunks_perf(hid_t file) end_t = H5_get_time(); - if ((end_t - start_t) > (double)0.0f) - printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n", - (end_t - start_t), nbytes_global); + if ((end_t - start_t) > 0.0) + HDprintf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n", + (end_t - start_t), nbytes_global); else - printf("1. Partial chunks: no total read time because timer is not available; number of bytes being " - "read from file is %zu\n", - nbytes_global); + HDprintf( + "1. Partial chunks: no total read time because timer is not available; number of bytes being " + "read from file is %zu\n", + nbytes_global); H5Dclose(dataset); H5Sclose(filespace); @@ -340,13 +341,14 @@ check_hash_value_perf(hid_t file) end_t = H5_get_time(); - if ((end_t - start_t) > (double)0.0f) - printf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n", - (end_t - start_t), nbytes_global); + if ((end_t - start_t) > 0.0) + HDprintf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n", + (end_t - start_t), nbytes_global); else - printf("2. Hash value: no total read time because timer is not available; number of bytes being read " - "from file is %zu\n", - nbytes_global); + HDprintf( + "2. Hash value: no total read time because timer is not available; number of bytes being read " + "from file is %zu\n", + nbytes_global); H5Dclose(dataset); H5Sclose(filespace); @@ -375,7 +377,7 @@ error: int main(void) { - hid_t file; /* handles */ + hid_t file = H5I_INVALID_HID; /* file ID */ int nerrors = 0; /* Create a new file. If file exists its contents will be overwritten. */ @@ -404,6 +406,6 @@ main(void) return 0; error: - fprintf(stderr, "*** ERRORS DETECTED ***\n"); + HDfprintf(stderr, "*** ERRORS DETECTED ***\n"); return 1; } diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index 68eaa3a..d0db06a 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -64,11 +64,11 @@ print_stats(const char *prefix, #ifdef H5_HAVE_GETRUSAGE double u_time, s_time; - u_time = ((double)(r_stop->ru_utime.tv_sec) + (double)(r_stop->ru_utime.tv_usec) / (double)1000000.0F) - - ((double)(r_start->ru_utime.tv_sec) + (double)(r_start->ru_utime.tv_usec) / (double)1000000.0F); + u_time = ((double)(r_stop->ru_utime.tv_sec) + (double)(r_stop->ru_utime.tv_usec) / 1000000.0) - + ((double)(r_start->ru_utime.tv_sec) + (double)(r_start->ru_utime.tv_usec) / 1000000.0); - s_time = ((double)(r_stop->ru_stime.tv_sec) + (double)(r_stop->ru_stime.tv_usec) / (double)1000000.0F) - - ((double)(r_start->ru_stime.tv_sec) + (double)(r_start->ru_stime.tv_usec) / (double)1000000.0F); + s_time = ((double)(r_stop->ru_stime.tv_sec) + (double)(r_stop->ru_stime.tv_usec) / 1000000.0) - + ((double)(r_start->ru_stime.tv_sec) + (double)(r_start->ru_stime.tv_usec) / 1000000.0); #endif e_time = t_stop - t_start; H5_bandwidth(bw, (double)nbytes, e_time); @@ -149,8 +149,7 @@ main(void) * Win32 version 5.0 compiler. * 1998-11-06 ptl */ - HDprintf("I/O request size is %1.1fMB\n", - (double)(hssize_t)(size[0] * size[1]) / (double)1024.0F * (double)1024); + HDprintf("I/O request size is %1.1fMB\n", (double)(hssize_t)(size[0] * size[1]) / 1024.0 * 1024.0); /* Open the files */ file = H5Fcreate(HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index 5b3a9e8..fe4e7e7 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -65,8 +65,7 @@ #define SIO_HDF5 0x4 /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes, t) \ - (H5_DBL_ABS_EQUAL(t, (double)0.0F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t))) +#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL(t, 0.0) ? 0.0 : ((((double)bytes) / (double)ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 6a1e1aa..517866b 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -32,11 +32,10 @@ #define ONE_MB (ONE_KB * ONE_KB) #define ONE_GB (ONE_MB * ONE_KB) -#define MICROSECOND 1000000.0F +#define MICROSECOND 1000000.0 /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes, t) \ - ((fabs(t) < (double)0.0000000001F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t))) +#define MB_PER_SEC(bytes, t) ((fabs(t) < 0.0000000001) ? 0.0 : ((((double)bytes) / (double)ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 @@ -169,7 +168,7 @@ write_file(Bytef *source, uLongf sourceLen) /* destination buffer needs to be at least 0.1% larger than sourceLen * plus 12 bytes */ - destLen = (uLongf)((double)sourceLen + ((double)sourceLen * (double)0.1F)) + 12; + destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1)) + 12; dest = (Bytef *)HDmalloc(destLen); if (!dest) @@ -179,8 +178,8 @@ write_file(Bytef *source, uLongf sourceLen) compress_buffer(dest, &destLen, source, sourceLen); HDgettimeofday(&timer_stop, NULL); - compression_time += ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / (double)MICROSECOND) - - ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / (double)MICROSECOND); + compression_time += ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / MICROSECOND) - + ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / MICROSECOND); if (report_once_flag) { HDfprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen); -- cgit v0.12 From 7d140b97fbd78d8071780e38e3e4287f6711f7f6 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 11 May 2021 09:05:03 -0700 Subject: Purges UFAIL from the library (#637) * Committing clang-format changes * Purges UFAIL from the library * H5HL_insert change requested in PR Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5Dchunk.c | 6 +- src/H5Dearray.c | 16 +- src/H5Dlayout.c | 17 +-- src/H5Gent.c | 13 +- src/H5Gstab.c | 5 +- src/H5HL.c | 42 +++--- src/H5HLprivate.h | 2 +- src/H5Oefl.c | 8 +- src/H5SM.c | 59 ++++---- src/H5Smpio.c | 3 +- src/H5Tbit.c | 9 +- src/H5VM.c | 386 +++++++++++++++++++++++------------------------ src/H5VMprivate.h | 2 +- src/H5private.h | 1 - test/dsets.c | 6 +- test/lheap.c | 2 +- tools/src/misc/h5debug.c | 2 +- 17 files changed, 274 insertions(+), 305 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index b6f1e8b..25fb2f8 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -711,10 +711,8 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize } /* end for */ /* Get the "down" sizes for each dimension */ - if (H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value") - if (H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value") + H5VM_array_down(ndims, layout->chunks, layout->down_chunks); + H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 24e8df2..abce233 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -1160,9 +1160,7 @@ done: static herr_t H5D__earray_idx_resize(H5O_layout_chunk_t *layout) { - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(layout); @@ -1182,8 +1180,7 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout) H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim); /* Get the swizzled "down" sizes for each dimension */ - if (H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value") + H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks); /* Get the swizzled max number of chunks in each dimension */ H5MM_memcpy(swizzled_max_chunks, layout->max_chunks, @@ -1191,13 +1188,10 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout) H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim); /* Get the swizzled max "down" sizes for each dimension */ - if (H5VM_array_down((layout->ndims - 1), swizzled_max_chunks, - layout->u.earray.swizzled_max_down_chunks) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value") - } /* end if */ + H5VM_array_down((layout->ndims - 1), swizzled_max_chunks, layout->u.earray.swizzled_max_down_chunks); + } -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__earray_idx_resize() */ /*------------------------------------------------------------------------- diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 86c0bf6..6c4fc12 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -504,6 +504,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) H5HL_t * heap; /* Pointer to local heap for EFL file names */ size_t heap_size = H5HL_ALIGN(1); size_t u; + size_t name_offset; /* Determine size of heap needed to stored the file names */ for (u = 0; u < efl->nused; ++u) @@ -518,24 +519,22 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap") /* Insert "empty" name first */ - if (UFAIL == H5HL_insert(file, heap, (size_t)1, "")) { + if (H5HL_insert(file, heap, (size_t)1, "", &name_offset) < 0) { H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") - } /* end if */ + } for (u = 0; u < efl->nused; ++u) { - size_t offset; /* Offset of file name in heap */ - /* Insert file name into heap */ - if (UFAIL == - (offset = H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) { + if (H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) < + 0) { H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") - } /* end if */ + } /* Store EFL file name offset */ - efl->slot[u].name_offset = offset; - } /* end for */ + efl->slot[u].name_offset = name_offset; + } /* Release the heap */ if (H5HL_unprotect(heap) < 0) diff --git a/src/H5Gent.c b/src/H5Gent.c index b26e308..2f1a2b4 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -384,11 +384,8 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk /* Reset the new entry */ H5G__ent_reset(ent); - /* - * Add the new name to the heap. - */ - name_offset = H5HL_insert(f, heap, HDstrlen(name) + 1, name); - if (0 == name_offset || UFAIL == name_offset) + /* Add the new name to the heap */ + if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap") ent->name_off = name_offset; @@ -476,14 +473,12 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk size_t lnk_offset; /* Offset to sym-link value */ /* Insert link value into local heap */ - if (UFAIL == - (lnk_offset = H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name))) + if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap") ent->type = H5G_CACHED_SLINK; ent->cache.slink.lval_offset = lnk_offset; - } /* end case */ - break; + } break; case H5L_TYPE_ERROR: case H5L_TYPE_EXTERNAL: diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 34f9610..bf4b417 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -150,11 +150,10 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") /* Insert name into the heap */ - if (UFAIL == (name_offset = H5HL_insert(f, heap, (size_t)1, ""))) + if (H5HL_insert(f, heap, (size_t)1, "", &name_offset) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap") - /* - * B-tree's won't work if the first name isn't at the beginning + /* B-trees won't work if the first name isn't at the beginning * of the heap. */ HDassert(0 == name_offset); diff --git a/src/H5HL.c b/src/H5HL.c index 50d24c3..ca83445 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -508,27 +508,31 @@ END_FUNC(STATIC) /* end H5HL__dirty() */ * * Purpose: Inserts a new item into the heap. * - * Return: Success: Offset of new item within heap. - * Failure: UFAIL + * Return: Success: SUCCEED + * Offset set to location of new item within heap + * + * Failure: FAIL + * Offset set to SIZE_MAX * * Programmer: Robb Matzke * Jul 17 1997 * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL, - H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf)) +BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, + H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out)) H5HL_free_t *fl = NULL, *last_fl = NULL; - size_t offset = 0; size_t need_size; + size_t offset = 0; hbool_t found; - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(heap); HDassert(buf_size > 0); HDassert(buf); + HDassert(offset_out); /* Mark heap as dirty in cache */ /* (A bit early in the process, but it's difficult to determine in the @@ -539,20 +543,18 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL, if (FAIL == H5HL__dirty(heap)) H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); - /* - * In order to keep the free list descriptors aligned on word boundaries, + /* In order to keep the free list descriptors aligned on word boundaries, * whatever that might mean, we round the size up to the next multiple of * a word. */ need_size = H5HL_ALIGN(buf_size); - /* - * Look for a free slot large enough for this object and which would + /* Look for a free slot large enough for this object and which would * leave zero or at least H5G_SIZEOF_FREE bytes left over. */ for (fl = heap->freelist, found = FALSE; fl; fl = fl->next) { if (fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) { - /* a big enough free block was found */ + /* A big enough free block was found */ offset = fl->offset; fl->offset += need_size; fl->size -= need_size; @@ -562,20 +564,19 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL, break; } else if (fl->size == need_size) { - /* free block of exact size found */ + /* Free block of exact size found */ offset = fl->offset; fl = H5HL__remove_free(heap, fl); found = TRUE; break; } else if (!last_fl || last_fl->offset < fl->offset) { - /* track free space that's closest to end of heap */ + /* Track free space that's closest to end of heap */ last_fl = fl; } } /* end for */ - /* - * If no free chunk was large enough, then allocate more space and + /* If no free chunk was large enough, then allocate more space and * add it to the free list. If the heap ends with a free chunk, we * can extend that free chunk. Otherwise we'll have to make another * free chunk. If the heap must expand, we double its size. @@ -587,7 +588,8 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL, htri_t was_extended; /* Whether the local heap's data segment on disk was extended */ /* At least double the heap's size, making certain there's enough room - * for the new object */ + * for the new object + */ need_more = MAX(need_size, heap->dblk_size); /* If there is no last free block or it's not at the end of the heap, @@ -657,8 +659,7 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL, } } /* end if */ else { - /* - * Create a new free list element large enough that we can + /* Create a new free list element large enough that we can * take some space out of it right away. */ offset = old_dblk_size; @@ -700,11 +701,10 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL, /* Copy the data into the heap */ H5MM_memcpy(heap->dblk_image + offset, buf, buf_size); - /* Set return value */ - ret_value = offset; + *offset_out = offset; CATCH - /* No special processing on errors */ + /* No special processing on exit */ END_FUNC(PRIV) /* H5HL_insert() */ diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 739e761..5c98846 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -57,7 +57,7 @@ H5_DLL herr_t H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr /*out*/); H5_DLL herr_t H5HL_delete(H5F_t *f, haddr_t addr); H5_DLL herr_t H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size); H5_DLL herr_t H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size); -H5_DLL size_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf); +H5_DLL herr_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf, size_t *offset); H5_DLL void * H5HL_offset_into(const H5HL_t *heap, size_t offset); H5_DLL H5HL_t *H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags); H5_DLL herr_t H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size); diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 1ecaf36..d950249 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -466,7 +466,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d HGOTO_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to protect EFL file name heap") /* Insert "empty" name first */ - if (UFAIL == (name_offset = H5HL_insert(file_dst, heap, (size_t)1, ""))) + if (H5HL_insert(file_dst, heap, (size_t)1, "", &name_offset) < 0) HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap") HDassert(0 == name_offset); @@ -483,10 +483,10 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d /* copy the name from the source */ for (idx = 0; idx < efl_src->nused; idx++) { efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name); - if (UFAIL == (efl_dst->slot[idx].name_offset = H5HL_insert( - file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name))) + if (H5HL_insert(file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name, + &(efl_dst->slot[idx].name_offset)) < 0) HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap") - } /* end for */ + } /* Set return value */ ret_value = efl_dst; diff --git a/src/H5SM.c b/src/H5SM.c index ad7ae4f..5f055bb 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -1262,16 +1262,16 @@ static herr_t H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t defer, unsigned type_id, void *mesg, unsigned *cache_flags_ptr) { - H5SM_list_t * list = NULL; /* List index */ - H5SM_mesg_key_t key; /* Key used to search the index */ - H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - H5O_shared_t shared; /* Shared H5O message */ - hbool_t found = FALSE; /* Was the message in the index? */ - H5HF_t * fheap = NULL; /* Fractal heap handle */ - H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */ - size_t buf_size; /* Size of the encoded message */ - void * encoding_buf = NULL; /* Buffer for encoded message */ - size_t empty_pos = UFAIL; /* Empty entry in list */ + H5SM_list_t * list = NULL; /* List index */ + H5SM_mesg_key_t key; /* Key used to search the index */ + H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ + H5O_shared_t shared; /* Shared H5O message */ + hbool_t found = FALSE; /* Was the message in the index? */ + H5HF_t * fheap = NULL; /* Fractal heap handle */ + H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */ + size_t buf_size; /* Size of the encoded message */ + void * encoding_buf = NULL; /* Buffer for encoded message */ + size_t empty_pos = SIZE_MAX; /* Empty entry in list */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -1325,11 +1325,11 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") if (defer) { - if (list_pos != UFAIL) + if (list_pos != SIZE_MAX) found = TRUE; } /* end if */ else { - if (list_pos != UFAIL) { + if (list_pos != SIZE_MAX) { /* If the message was previously shared in an object header, share * it in the heap now. */ @@ -1481,13 +1481,13 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t /* Insert the new message into the SOHM index */ if (header->index_type == H5SM_LIST) { /* Index is a list. Find an empty spot if we haven't already */ - if (empty_pos == UFAIL) { + if (empty_pos == SIZE_MAX) { size_t pos; if (H5SM__find_in_list(list, NULL, &empty_pos, &pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") - if (pos == UFAIL || empty_pos == UFAIL) + if (pos == SIZE_MAX || empty_pos == SIZE_MAX) HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list") } /* Insert message into list */ @@ -1647,9 +1647,14 @@ done: * * If EMPTY_POS is NULL, don't store anything in it. * - * Return: Message's position in the list on success - * UFAIL if message couldn't be found - * empty_pos set to position of empty message or UFAIL. + * Return: Success: SUCCEED + * pos = position (if found) + * pos = SIZE_MAX (if not found) + * empty_pos = indeterminate (if found) + * empty_pos = 1st empty position (if not found) + * + * Failure: FAIL + * pos & empty_pos indeterminate * * Programmer: James Laird * Tuesday, May 2, 2006 @@ -1670,7 +1675,7 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t * /* Initialize empty_pos to an invalid value */ if (empty_pos) - *empty_pos = UFAIL; + *empty_pos = SIZE_MAX; /* Find the first (only) message equal to the key passed in. * Also record the first empty position we find. @@ -1693,11 +1698,11 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t * /* Found earlier position possible, don't check any more */ empty_pos = NULL; - } /* end if */ - } /* end for */ + } + } /* If we reached this point, we didn't find the message */ - *pos = UFAIL; + *pos = SIZE_MAX; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1839,7 +1844,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c /* Find the message in the list */ if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") - if (list_pos == UFAIL) + if (list_pos == SIZE_MAX) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") if (list->messages[list_pos].location == H5SM_IN_HEAP) @@ -2221,7 +2226,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize /* Find the message in the list */ if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") - if (list_pos == UFAIL) + if (list_pos == SIZE_MAX) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") /* Copy the message */ @@ -2519,7 +2524,7 @@ H5SM__list_free(H5SM_list_t *list) * * Purpose: Print debugging information for the master table. * - * If table_vers and num_indexes are not UFAIL, they are used + * If table_vers and num_indexes are not UINT_MAX, they are used * instead of the values in the superblock. * * Return: Non-negative on success/Negative on failure @@ -2546,14 +2551,14 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi HDassert(indent >= 0); HDassert(fwidth >= 0); - /* If table_vers and num_indexes are UFAIL, replace them with values from + /* If table_vers and num_indexes are UINT_MAX, replace them with values from * userblock */ - if (table_vers == UFAIL) + if (table_vers == UINT_MAX) table_vers = H5F_SOHM_VERS(f); else if (table_vers != H5F_SOHM_VERS(f)) HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); - if (num_indexes == UFAIL) + if (num_indexes == UINT_MAX) num_indexes = H5F_SOHM_NINDEXES(f); else if (num_indexes != H5F_SOHM_NINDEXES(f)) HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 9a38aaa..7b85209 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -1014,8 +1014,7 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne elmt_type_is_derived = TRUE; /* Compute 'down' sizes for each dimension */ - if (H5VM_array_down(space->extent.rank, space->extent.size, down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes") + H5VM_array_down(space->extent.rank, space->extent.size, down); /* Acquire an operation generation value for creating MPI datatypes */ op_gen = H5S__hyper_get_op_gen(); diff --git a/src/H5Tbit.c b/src/H5Tbit.c index e2ca4b9..9f0c061 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -228,10 +228,7 @@ done: * Purpose: Return a small bit sequence as a number. Bit vector starts * at OFFSET and is SIZE bits long. * - * Return: Success: The bit sequence interpretted as an unsigned - * integer. - * - * Failure: 0 + * Return: The bit sequence interpretted as an unsigned integer * *------------------------------------------------------------------------- */ @@ -264,8 +261,8 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) case H5T_ORDER_NONE: case H5T_ORDER_MIXED: default: - /* Unknown endianness. Bail out. */ - HGOTO_DONE(UFAIL) + /* This function can't return errors */ + HDassert(0 && "unknown byte order"); } /* Set return value */ diff --git a/src/H5VM.c b/src/H5VM.c index 49cad20..4d65d75 100644 --- a/src/H5VM.c +++ b/src/H5VM.c @@ -43,20 +43,20 @@ static void H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n #endif /* LATER */ /*------------------------------------------------------------------------- - * Function: H5VM__stride_optimize1 + * Function: H5VM__stride_optimize1 * - * Purpose: Given a stride vector which references elements of the - * specified size, optimize the dimensionality, the stride - * vector, and the element size to minimize the dimensionality - * and the number of memory accesses. + * Purpose: Given a stride vector which references elements of the + * specified size, optimize the dimensionality, the stride + * vector, and the element size to minimize the dimensionality + * and the number of memory accesses. * - * All arguments are passed by reference and their values may be - * modified by this function. + * All arguments are passed by reference and their values may be + * modified by this function. * - * Return: None + * Return: void * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 + * Programmer: Robb Matzke + * Saturday, October 11, 1997 * *------------------------------------------------------------------------- */ @@ -66,15 +66,12 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c { FUNC_ENTER_STATIC_NOERR - /* - * This has to be true because if we optimize the dimensionality down to + /* This has to be true because if we optimize the dimensionality down to * zero we still must make one reference. */ HDassert(1 == H5VM_vector_reduce_product(0, NULL)); - /* - * Combine adjacent memory accesses - */ + /* Combine adjacent memory accesses */ while (*np && stride1[*np - 1] > 0 && (hsize_t)(stride1[*np - 1]) == *elmt_size) { *elmt_size *= size[*np - 1]; if (--*np) @@ -85,20 +82,20 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c } /*------------------------------------------------------------------------- - * Function: H5VM__stride_optimize2 + * Function: H5VM__stride_optimize2 * - * Purpose: Given two stride vectors which reference elements of the - * specified size, optimize the dimensionality, the stride - * vectors, and the element size to minimize the dimensionality - * and the number of memory accesses. + * Purpose: Given two stride vectors which reference elements of the + * specified size, optimize the dimensionality, the stride + * vectors, and the element size to minimize the dimensionality + * and the number of memory accesses. * - * All arguments are passed by reference and their values may be - * modified by this function. + * All arguments are passed by reference and their values may be + * modified by this function. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 + * Programmer: Robb Matzke + * Saturday, October 11, 1997 * *------------------------------------------------------------------------- */ @@ -108,16 +105,13 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c { FUNC_ENTER_STATIC_NOERR - /* - * This has to be true because if we optimize the dimensionality down to + /* This has to be true because if we optimize the dimensionality down to * zero we still must make one reference. */ HDassert(1 == H5VM_vector_reduce_product(0, NULL)); HDassert(*elmt_size > 0); - /* - * Combine adjacent memory accesses - */ + /* Combine adjacent memory accesses */ /* Unroll loop for common cases */ switch (*np) { @@ -206,29 +200,26 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c } /*------------------------------------------------------------------------- - * Function: H5VM_hyper_stride - * - * Purpose: Given a description of a hyperslab, this function returns - * (through STRIDE[]) the byte strides appropriate for accessing - * all bytes of the hyperslab and the byte offset where the - * striding will begin. The SIZE can be passed to the various - * stride functions. + * Function: H5VM_hyper_stride * - * The dimensionality of the whole array, the hyperslab, and the - * returned stride array is N. The whole array dimensions are - * TOTAL_SIZE and the hyperslab is at offset OFFSET and has - * dimensions SIZE. + * Purpose: Given a description of a hyperslab, this function returns + * (through STRIDE[]) the byte strides appropriate for accessing + * all bytes of the hyperslab and the byte offset where the + * striding will begin. The SIZE can be passed to the various + * stride functions. * - * The stride and starting point returned will cause the - * hyperslab elements to be referenced in C order. + * The dimensionality of the whole array, the hyperslab, and the + * returned stride array is N. The whole array dimensions are + * TOTAL_SIZE and the hyperslab is at offset OFFSET and has + * dimensions SIZE. * - * Return: Success: Byte offset from beginning of array to start - * of striding. + * The stride and starting point returned will cause the + * hyperslab elements to be referenced in C order. * - * Failure: abort() -- should never fail + * Return: Byte offset from beginning of array to start of striding. * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 + * Programmer: Robb Matzke + * Saturday, October 11, 1997 * *------------------------------------------------------------------------- */ @@ -308,23 +299,22 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co } /*------------------------------------------------------------------------- - * Function: H5VM_hyper_eq + * Function: H5VM_hyper_eq * - * Purpose: Determines whether two hyperslabs are equal. This function - * assumes that both hyperslabs are relative to the same array, - * for if not, they could not possibly be equal. + * Purpose: Determines whether two hyperslabs are equal. This function + * assumes that both hyperslabs are relative to the same array, + * for if not, they could not possibly be equal. * - * Return: Success: TRUE if the hyperslabs are equal (that is, - * both refer to exactly the same elements of an - * array) + * Return: TRUE if the hyperslabs are equal (that is, + * both refer to exactly the same elements of an + * array) * - * FALSE otherwise. + * FALSE otherwise * - * Failure: TRUE the rank is zero or if both hyperslabs - * are of zero size. + * Never returns FAIL * - * Programmer: Robb Matzke - * Friday, October 17, 1997 + * Programmer: Robb Matzke + * Friday, October 17, 1997 * *------------------------------------------------------------------------- */ @@ -360,19 +350,19 @@ done: /*------------------------------------------------------------------------- * Function: H5VM_hyper_fill * - * Purpose: Similar to memset() except it operates on hyperslabs... + * Purpose: Similar to memset() except it operates on hyperslabs... * - * Fills a hyperslab of array BUF with some value VAL. BUF - * is treated like a C-order array with N dimensions where the - * size of each dimension is TOTAL_SIZE[]. The hyperslab which - * will be filled with VAL begins at byte offset OFFSET[] from - * the minimum corner of BUF and continues for SIZE[] bytes in - * each dimension. + * Fills a hyperslab of array BUF with some value VAL. BUF + * is treated like a C-order array with N dimensions where the + * size of each dimension is TOTAL_SIZE[]. The hyperslab which + * will be filled with VAL begins at byte offset OFFSET[] from + * the minimum corner of BUF and continues for SIZE[] bytes in + * each dimension. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, October 10, 1997 + * Programmer: Robb Matzke + * Friday, October 10, 1997 * *------------------------------------------------------------------------- */ @@ -418,31 +408,31 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con } /*------------------------------------------------------------------------- - * Function: H5VM_hyper_copy + * Function: H5VM_hyper_copy * - * Purpose: Copies a hyperslab from the source to the destination. + * Purpose: Copies a hyperslab from the source to the destination. * - * A hyperslab is a logically contiguous region of - * multi-dimensional size SIZE of an array whose dimensionality - * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE. - * The minimum corner of the hyperslab begins at a - * multi-dimensional offset from the minimum corner of the DST - * (destination) or SRC (source) array. The sizes and offsets - * are assumed to be in C order, that is, the first size/offset - * varies the slowest while the last varies the fastest in the - * mapping from N-dimensional space to linear space. This - * function assumes that the array elements are single bytes (if - * your array has multi-byte elements then add an additional - * dimension whose size is that of your element). + * A hyperslab is a logically contiguous region of + * multi-dimensional size SIZE of an array whose dimensionality + * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE. + * The minimum corner of the hyperslab begins at a + * multi-dimensional offset from the minimum corner of the DST + * (destination) or SRC (source) array. The sizes and offsets + * are assumed to be in C order, that is, the first size/offset + * varies the slowest while the last varies the fastest in the + * mapping from N-dimensional space to linear space. This + * function assumes that the array elements are single bytes (if + * your array has multi-byte elements then add an additional + * dimension whose size is that of your element). * - * The SRC and DST array may be the same array, but the results - * are undefined if the source hyperslab overlaps the - * destination hyperslab. + * The SRC and DST array may be the same array, but the results + * are undefined if the source hyperslab overlaps the + * destination hyperslab. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, October 10, 1997 + * Programmer: Robb Matzke + * Friday, October 10, 1997 * *------------------------------------------------------------------------- */ @@ -592,13 +582,13 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const /*------------------------------------------------------------------------- * Function: H5VM_stride_fill * - * Purpose: Fills all bytes of a hyperslab with the same value using - * memset(). + * Purpose: Fills all bytes of a hyperslab with the same value using + * memset(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 + * Programmer: Robb Matzke + * Saturday, October 11, 1997 * *------------------------------------------------------------------------- */ @@ -643,19 +633,19 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize /*------------------------------------------------------------------------- * Function: H5VM_stride_copy * - * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays - * DST and SRC while copying bytes from SRC to DST. This - * function minimizes the number of calls to memcpy() by - * combining various strides, but it will never touch memory - * outside the hyperslab defined by the strides. + * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays + * DST and SRC while copying bytes from SRC to DST. This + * function minimizes the number of calls to memcpy() by + * combining various strides, but it will never touch memory + * outside the hyperslab defined by the strides. * - * Note: If the src_stride is all zero and elmt_size is one, then it's - * probably more efficient to use H5VM_stride_fill() instead. + * Note: If the src_stride is all zero and elmt_size is one, then it's + * probably more efficient to use H5VM_stride_fill() instead. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 + * Programmer: Robb Matzke + * Saturday, October 11, 1997 * *------------------------------------------------------------------------- */ @@ -709,19 +699,19 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize /*------------------------------------------------------------------------- * Function: H5VM_stride_copy_s * - * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays - * DST and SRC while copying bytes from SRC to DST. This - * function minimizes the number of calls to memcpy() by - * combining various strides, but it will never touch memory - * outside the hyperslab defined by the strides. + * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays + * DST and SRC while copying bytes from SRC to DST. This + * function minimizes the number of calls to memcpy() by + * combining various strides, but it will never touch memory + * outside the hyperslab defined by the strides. * - * Note: If the src_stride is all zero and elmt_size is one, then it's - * probably more efficient to use H5VM_stride_fill() instead. + * Note: If the src_stride is all zero and elmt_size is one, then it's + * probably more efficient to use H5VM_stride_fill() instead. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 + * Programmer: Robb Matzke + * Saturday, October 11, 1997 * *------------------------------------------------------------------------- */ @@ -775,17 +765,17 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss #ifdef LATER /*------------------------------------------------------------------------- - * Function: H5VM__stride_copy2 + * Function: H5VM__stride_copy2 * - * Purpose: Similar to H5VM_stride_copy() except the source and - * destination each have their own dimensionality and size and - * we copy exactly NELMTS elements each of size ELMT_SIZE. The - * size counters wrap if NELMTS is more than a size counter. + * Purpose: Similar to H5VM_stride_copy() except the source and + * destination each have their own dimensionality and size and + * we copy exactly NELMTS elements each of size ELMT_SIZE. The + * size counters wrap if NELMTS is more than a size counter. * - * Return: None + * Return: void * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 + * Programmer: Robb Matzke + * Saturday, October 11, 1997 * *------------------------------------------------------------------------- */ @@ -843,16 +833,16 @@ H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsiz #endif /* LATER */ /*------------------------------------------------------------------------- - * Function: H5VM_array_fill + * Function: H5VM_array_fill * - * Purpose: Fills all bytes of an array with the same value using - * memset(). Increases amount copied by power of two until the - * halfway point is crossed, then copies the rest in one swoop. + * Purpose: Fills all bytes of an array with the same value using + * memset(). Increases amount copied by power of two until the + * halfway point is crossed, then copies the rest in one swoop. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, June 18, 1998 + * Programmer: Quincey Koziol + * Thursday, June 18, 1998 * *------------------------------------------------------------------------- */ @@ -895,25 +885,25 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) } /* H5VM_array_fill() */ /*------------------------------------------------------------------------- - * Function: H5VM_array_down + * Function: H5VM_array_down * - * Purpose: Given a set of dimension sizes, calculate the size of each + * Purpose: Given a set of dimension sizes, calculate the size of each * "down" slice. This is the size of the dimensions for all the * dimensions below the current one, which is used for indexing * offsets in this dimension. * - * Return: Non-negative on success/Negative on failure + * Return: void * - * Programmer: Quincey Koziol - * Monday, April 28, 2003 + * Programmer: Quincey Koziol + * Monday, April 28, 2003 * *------------------------------------------------------------------------- */ -herr_t +void H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) { - hsize_t acc; /*accumulator */ - int i; /*counter */ + hsize_t acc; /* Accumulator */ + int i; /* Counter */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -921,31 +911,31 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) HDassert(total_size); HDassert(down); - /* Build the sizes of each dimension in the array */ - /* (From fastest to slowest) */ + /* Build the sizes of each dimension in the array + * (From fastest to slowest) + */ for (i = (int)(n - 1), acc = 1; i >= 0; i--) { down[i] = acc; acc *= total_size[i]; - } /* end for */ + } - FUNC_LEAVE_NOAPI(SUCCEED) + FUNC_LEAVE_NOAPI_VOID } /* end H5VM_array_down() */ /*------------------------------------------------------------------------- * Function: H5VM_array_offset_pre * - * Purpose: Given a coordinate description of a location in an array, this - * function returns the byte offset of the coordinate. + * Purpose: Given a coordinate description of a location in an array, this + * function returns the byte offset of the coordinate. * - * The dimensionality of the whole array, and the offset is N. + * The dimensionality of the whole array, and the offset is N. * The whole array dimensions are TOTAL_SIZE and the coordinate * is at offset OFFSET. * - * Return: Success: Byte offset from beginning of array to element offset - * Failure: abort() -- should never fail + * Return: Byte offset from beginning of array to element offset * * Programmer: Quincey Koziol - * Tuesday, June 22, 1999 + * Tuesday, June 22, 1999 * *------------------------------------------------------------------------- */ @@ -971,18 +961,17 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) /*------------------------------------------------------------------------- * Function: H5VM_array_offset * - * Purpose: Given a coordinate description of a location in an array, this - * function returns the byte offset of the coordinate. + * Purpose: Given a coordinate description of a location in an array, + * this function returns the byte offset of the coordinate. * - * The dimensionality of the whole array, and the offset is N. + * The dimensionality of the whole array, and the offset is N. * The whole array dimensions are TOTAL_SIZE and the coordinate * is at offset OFFSET. * - * Return: Success: Byte offset from beginning of array to element offset - * Failure: abort() -- should never fail + * Return: Byte offset from beginning of array to element offset * * Programmer: Quincey Koziol - * Tuesday, June 22, 1999 + * Tuesday, June 22, 1999 * *------------------------------------------------------------------------- */ @@ -992,38 +981,36 @@ H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset) hsize_t acc_arr[H5VM_HYPER_NDIMS]; /* Accumulated size of down dimensions */ hsize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI((HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */ + FUNC_ENTER_NOAPI_NOERR HDassert(n <= H5VM_HYPER_NDIMS); HDassert(total_size); HDassert(offset); /* Build the sizes of each dimension in the array */ - if (H5VM_array_down(n, total_size, acc_arr) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes") + H5VM_array_down(n, total_size, acc_arr); /* Set return value */ ret_value = H5VM_array_offset_pre(n, acc_arr, offset); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VM_array_offset() */ /*------------------------------------------------------------------------- * Function: H5VM_array_calc_pre * - * Purpose: Given a linear offset in an array, the dimensions of that + * Purpose: Given a linear offset in an array, the dimensions of that * array and the pre-computed 'down' (accumulator) sizes, this * function computes the coordinates of that offset in the array. * - * The dimensionality of the whole array, and the coordinates is N. + * The dimensionality of the whole array, and the coordinates is N. * The array dimensions are TOTAL_SIZE and the coordinates * are returned in COORD. The linear offset is in OFFSET. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 16, 2009 + * Programmer: Quincey Koziol + * Thursday, July 16, 2009 * *------------------------------------------------------------------------- */ @@ -1050,18 +1037,18 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co /*------------------------------------------------------------------------- * Function: H5VM_array_calc * - * Purpose: Given a linear offset in an array and the dimensions of that + * Purpose: Given a linear offset in an array and the dimensions of that * array, this function computes the coordinates of that offset * in the array. * - * The dimensionality of the whole array, and the coordinates is N. + * The dimensionality of the whole array, and the coordinates is N. * The array dimensions are TOTAL_SIZE and the coordinates * are returned in COORD. The linear offset is in OFFSET. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, April 16, 2003 + * Programmer: Quincey Koziol + * Wednesday, April 16, 2003 * *------------------------------------------------------------------------- */ @@ -1079,8 +1066,7 @@ H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t * HDassert(coords); /* Build the sizes of each dimension in the array */ - if (H5VM_array_down(n, total_size, idx) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute down sizes") + H5VM_array_down(n, total_size, idx); /* Compute the coordinates from the offset */ if (H5VM_array_calc_pre(offset, n, idx, coords) < 0) @@ -1093,7 +1079,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VM_chunk_index * - * Purpose: Given a coordinate offset (COORD), the size of each chunk + * Purpose: Given a coordinate offset (COORD), the size of each chunk * (CHUNK), the number of chunks in each dimension (NCHUNKS) * and the number of dimensions of all of these (NDIMS), calculate * a "chunk index" for the chunk that the coordinate offset is @@ -1123,10 +1109,10 @@ done: * The chunk index is placed in the CHUNK_IDX location for return * from this function * - * Return: Chunk index on success (can't fail) + * Return: Chunk index on success (can't fail) * - * Programmer: Quincey Koziol - * Monday, April 21, 2003 + * Programmer: Quincey Koziol + * Monday, April 21, 2003 * *------------------------------------------------------------------------- */ @@ -1151,14 +1137,14 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, co } /* end H5VM_chunk_index() */ /*------------------------------------------------------------------------- - * Function: H5VM_chunk_scaled + * Function: H5VM_chunk_scaled * - * Purpose: Compute the scaled coordinates for a chunk offset + * Purpose: Compute the scaled coordinates for a chunk offset * - * Return: + * Return: void * - * Programmer: Quincey Koziol - * Wednesday, November 19, 2014 + * Programmer: Quincey Koziol + * Wednesday, November 19, 2014 * *------------------------------------------------------------------------- */ @@ -1186,7 +1172,7 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h /*------------------------------------------------------------------------- * Function: H5VM_chunk_index_scaled * - * Purpose: Given a coordinate offset (COORD), the size of each chunk + * Purpose: Given a coordinate offset (COORD), the size of each chunk * (CHUNK), the number of chunks in each dimension (NCHUNKS) * and the number of dimensions of all of these (NDIMS), calculate * a "chunk index" for the chunk that the coordinate offset is @@ -1216,13 +1202,13 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h * The chunk index is placed in the CHUNK_IDX location for return * from this function * - * Note: This routine is identical to H5VM_chunk_index(), except for - * caching the scaled information. Make changes in both places. + * Note: This routine is identical to H5VM_chunk_index(), except for + * caching the scaled information. Make changes in both places. * - * Return: Chunk index on success (can't fail) + * Return: Chunk index on success (can't fail) * - * Programmer: Vailin Choi - * Monday, February 9, 2015 + * Programmer: Vailin Choi + * Monday, February 9, 2015 * *------------------------------------------------------------------------- */ @@ -1257,22 +1243,22 @@ H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *ch /*------------------------------------------------------------------------- * Function: H5VM_opvv * - * Purpose: Perform an operation on a source & destination sequences - * of offset/length pairs. Each set of sequnces has an array - * of lengths, an array of offsets, the maximum number of - * sequences and the current sequence to start at in the sequence. + * Purpose: Perform an operation on a source & destination sequences + * of offset/length pairs. Each set of sequnces has an array + * of lengths, an array of offsets, the maximum number of + * sequences and the current sequence to start at in the sequence. * * There may be different numbers of bytes in the source and * destination sequences, the operation stops when either the * source or destination sequence runs out of information. * - * Note: The algorithm in this routine is [basically] the same as for - * H5VM_memcpyvv(). Changes should be made to both! + * Note: The algorithm in this routine is [basically] the same as for + * H5VM_memcpyvv(). Changes should be made to both! * - * Return: Non-negative # of bytes operated on, on success/Negative on failure + * Return: Non-negative # of bytes operated on, on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, September 30, 2010 + * Programmer: Quincey Koziol + * Thursday, September 30, 2010 * *------------------------------------------------------------------------- */ @@ -1460,7 +1446,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VM_memcpyvv * - * Purpose: Given source and destination buffers in memory (SRC & DST) + * Purpose: Given source and destination buffers in memory (SRC & DST) * copy sequences of from the source buffer into the destination * buffer. Each set of sequences has an array of lengths, an * array of offsets, the maximum number of sequences and the @@ -1470,13 +1456,13 @@ done: * destination sequences, data copying stops when either the * source or destination buffer runs out of sequence information. * - * Note: The algorithm in this routine is [basically] the same as for - * H5VM_opvv(). Changes should be made to both! + * Note: The algorithm in this routine is [basically] the same as for + * H5VM_opvv(). Changes should be made to both! * - * Return: Non-negative # of bytes copied on success/Negative on failure + * Return: Non-negative # of bytes copied on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, May 2, 2003 + * Programmer: Quincey Koziol + * Friday, May 2, 2003 * *------------------------------------------------------------------------- */ diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index 2fea2fc..0d3bd0f 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -105,7 +105,7 @@ H5_DLL herr_t H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *_ const hssize_t *dst_stride, void *_dst, const hssize_t *src_stride, const void *_src); H5_DLL herr_t H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count); -H5_DLL herr_t H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down); +H5_DLL void H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down); H5_DLL hsize_t H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset); H5_DLL hsize_t H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset); H5_DLL herr_t H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *coords); diff --git a/src/H5private.h b/src/H5private.h index efc19d3..a0b4e8e 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -363,7 +363,6 @@ */ #define SUCCEED 0 #define FAIL (-1) -#define UFAIL (unsigned)(-1) /* The HDF5 library uses the symbol `ERR` frequently. So do * header files for libraries such as curses(3), terminfo(3), etc. diff --git a/test/dsets.c b/test/dsets.c index 88dcb35..96f8b81 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -9525,8 +9525,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) npoints = (hsize_t)snpoints; /* Compute the "down" dimension values */ - if (H5VM_array_down(ndims, dim, down) < 0) - FAIL_STACK_ERROR + H5VM_array_down(ndims, dim, down); /* Create chunked dataset */ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, @@ -9708,8 +9707,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) H5VM_swizzle_coords(hsize_t, swizzled_dim, unlim_dim); /* Compute the "down" dimension values */ - if (H5VM_array_down(ndims, swizzled_dim, down) < 0) - FAIL_STACK_ERROR + H5VM_array_down(ndims, swizzled_dim, down); /* Read elements */ for (u = 0; u < npoints; u++) { diff --git a/test/lheap.c b/test/lheap.c index 9bbacbe..2609510 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -103,7 +103,7 @@ main(void) if (j > 4) buf[j] = '\0'; - if (UFAIL == (obj[i] = H5HL_insert(f, heap, HDstrlen(buf) + 1, buf))) { + if (H5HL_insert(f, heap, HDstrlen(buf) + 1, buf, &obj[i]) < 0) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index 454981d..72f47cb 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -626,7 +626,7 @@ main(int argc, char *argv[]) * Debug shared message master table. */ - status = H5SM_table_debug(f, addr, stdout, 0, VCOL, (unsigned)UFAIL, (unsigned)UFAIL); + status = H5SM_table_debug(f, addr, stdout, 0, VCOL, UINT_MAX, UINT_MAX); } else if (!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* -- cgit v0.12 From 78f0728d1b675e675f4dfb0112fc128535e10071 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Tue, 11 May 2021 22:22:45 -0500 Subject: Fix H5Eget_auto2/H5Eauto_is_v2 to not clear error stack (#625) --- src/H5E.c | 47 +++++++++++++++++++++++++++++++++++++-------- test/testfiles/err_compat_1 | 14 +++++++++++++- 2 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/H5E.c b/src/H5E.c index 6d6dfd3..dabd367 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -245,6 +245,20 @@ H5E_term_package(void) nstk = H5I_nmembers(H5I_ERROR_STACK); if ((ncls + nmsg + nstk) > 0) { + /* Clear the default error stack. Note that + * the following H5I_clear_type calls do not + * force the clears and will not be able to + * clear any error message IDs that are still + * in use by the default error stack unless we + * clear that stack manually. + * + * Error message IDs will typically still be + * in use by the default error stack when the + * application does H5E_BEGIN/END_TRY cleanup + * at the very end. + */ + H5E_clear_stack(NULL); + /* Clear any outstanding error stacks */ if (nstk > 0) (void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE); @@ -1532,7 +1546,8 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou H5E_auto_op_t op; /* Error stack function */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) + /* Don't clear the error stack! :-) */ + FUNC_ENTER_API_NOCLEAR(FAIL) H5TRACE3("e", "ixx", estack_id, func, client_data); if (estack_id == H5E_DEFAULT) { @@ -1540,8 +1555,13 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ - else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + else { + /* Only clear the error stack if it's not the default stack */ + H5E_clear_stack(NULL); + + if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + } /* end else */ /* Get the automatic error reporting information */ if (H5E__get_auto(estack, &op, client_data) < 0) @@ -1598,8 +1618,13 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ - else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + else { + /* Only clear the error stack if it's not the default stack */ + H5E_clear_stack(NULL); + + if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + } /* end else */ #ifndef H5_NO_DEPRECATED_SYMBOLS /* Get the automatic error reporting information */ @@ -1646,7 +1671,8 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) H5E_t *estack; /* Error stack to operate on */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) + /* Don't clear the error stack! :-) */ + FUNC_ENTER_API_NOCLEAR(FAIL) H5TRACE2("e", "i*Iu", estack_id, is_stack); if (estack_id == H5E_DEFAULT) { @@ -1654,8 +1680,13 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ - else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + else { + /* Only clear the error stack if it's not the default stack */ + H5E_clear_stack(NULL); + + if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + } /* end else */ /* Check if the error stack reporting function is the "newer" stack type */ if (is_stack) diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index c797ebb..df43184 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -40,7 +40,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Unable to create file ********* Print error stack in customized way ********* - error #000: (file name) in H5Eget_auto(1 or 2)(): line (number) + error #000: (file name) in H5VL_vol_object(): line (number) + major: Invalid arguments to routine + minor: Inappropriate type + error #001: (file name) in H5VL_setup_acc_args(): line (number) + major: Invalid arguments to routine + minor: Inappropriate type + error #002: (file name) in H5D__create_api_common(): line (number) + major: Dataset + minor: Can't set value + error #003: (file name) in H5Dcreate2(): line (number) + major: Dataset + minor: Unable to create file + error #004: (file name) in H5Eget_auto(1 or 2)(): line (number) major: Error API minor: Can't get value -- cgit v0.12 From 9fb2c24c2eb2454430701247a984780654ca0544 Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Wed, 12 May 2021 15:35:53 -0400 Subject: Bmr dev hdffv 11223 (#640) * Fixed HDFFV-11223 (CVE-2018-14460) Description - Added checks against buffer size to prevent segfault, in case of data corruption, for sdim->size and sdim->max. - Renamed data files in an existing test to shorten their length as agreed with other developers previously. Platforms tested: Linux/64 (jelly) * Committing clang-format changes * Updated for test files * Updated for HDFFV-11223 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 3 ++- release_docs/RELEASE.txt | 13 +++++++++++- src/H5Osdspace.c | 23 ++++++++++++++++----- tools/test/h5repack/CMakeTests.cmake | 10 +++++++-- tools/test/h5repack/h5repack.sh.in | 9 ++++++-- .../h5repack/testfiles/h5repack_CVE-2018-14460.h5 | Bin 0 -> 2560 bytes .../h5repack/testfiles/h5repack_CVE-2018-17432.h5 | Bin 0 -> 7648 bytes .../h5repack_HDFFV-10590_CVE-2018-17432.h5 | Bin 7648 -> 0 bytes 8 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5 delete mode 100644 tools/test/h5repack/testfiles/h5repack_HDFFV-10590_CVE-2018-17432.h5 diff --git a/MANIFEST b/MANIFEST index 9ecef83..9832159 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2836,7 +2836,8 @@ ./tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl ./tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl ./tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl -./tools/test/h5repack/testfiles/h5repack_HDFFV-10590_CVE-2018-17432.h5 +./tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5 +./tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5 ./tools/test/h5repack/testfiles/GS.h5repack_paged_nopersist.h5.ddl ./tools/test/h5repack/testfiles/S.h5repack_fsm_aggr_persist.h5.ddl ./tools/test/h5repack/testfiles/SP.h5repack_fsm_aggr_nopersist.h5.ddl diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index be8440f..9e99e66 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -823,7 +823,18 @@ Bug Fixes since HDF5-1.12.0 release =================================== Library ------- - - Fixed CVE-2018-17435 + - Fixed CVE-2018-14460 + + The tool h5repack produced a segfault when the rank in dataspace + message was corrupted, causing invalid read while decoding the + dimension sizes. + + The problem was fixed by ensuring that decoding the dimension sizes + and max values will not go beyong the end of the buffer. + + (BMR - 2021/05/12, HDFFV-11223) + + - Fixed CVE-2018-11206 The tool h5dump produced a segfault when the size of a fill value message was corrupted and caused a buffer overflow. diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 2cdf6ec..dab989f 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -106,12 +106,13 @@ H5FL_ARR_EXTERN(hsize_t); --------------------------------------------------------------------------*/ static void * H5O__sdspace_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) { - H5S_extent_t *sdim = NULL; /* New extent dimensionality structure */ - unsigned flags, version; - unsigned i; /* Local counting variable */ - void * ret_value = NULL; /* Return value */ + H5S_extent_t * sdim = NULL; /* New extent dimensionality structure */ + unsigned flags, version; + unsigned i; /* Local counting variable */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -161,6 +162,13 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN /* Decode dimension sizes */ if (sdim->rank > 0) { + /* Ensure that rank doesn't cause reading passed buffer's end, + due to possible data corruption */ + uint8_t sizeof_size = H5F_SIZEOF_SIZE(f); + if (p + (sizeof_size * sdim->rank - 1) > p_end) { + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end") + } + if (NULL == (sdim->size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -170,6 +178,11 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN if (flags & H5S_VALID_MAX) { if (NULL == (sdim->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + /* Ensure that rank doesn't cause reading passed buffer's end */ + if (p + (sizeof_size * sdim->rank - 1) > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end") + for (i = 0; i < sdim->rank; i++) H5F_DECODE_LENGTH(f, p, sdim->max[i]); } /* end if */ diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 528ee1c..037287d 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -51,7 +51,8 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_named_dtypes.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nested_8bit_enum.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nested_8bit_enum_deflated.h5 - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_HDFFV-10590_CVE-2018-17432.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_CVE-2018-17432.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_CVE-2018-14460.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nbit.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_objs.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_refs.h5 @@ -1551,10 +1552,15 @@ ADD_H5_TEST (HDFFV-7840 "TEST" h5diff_attr1.h5) # test CVE-2018-17432 fix - set (arg h5repack_HDFFV-10590_CVE-2018-17432.h5 h5repack_HDFFV-10590_CVE-2018-17432_out.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6) + set (arg h5repack_CVE-2018-17432.h5 h5repack__CVE-2018-17432_out.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6) set (TESTTYPE "TEST") ADD_H5_FILTER_TEST (HDFFV-10590 "" ${TESTTYPE} 1 ${arg}) +# test CVE-2018-14460 fix + set (arg h5repack_CVE-2018-14460.h5 h5repack_CVE-2018-14460_out.h5) + set (TESTTYPE "TEST") + ADD_H5_FILTER_TEST (HDFFV-11223 "" ${TESTTYPE} 1 ${arg}) + # tests for metadata block size option ('-M') ADD_H5_TEST_META (meta_short h5repack_layout.h5 -M 8192) ADD_H5_TEST_META (meta_long h5repack_layout.h5 --metadata_block_size=8192) diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index f881b0a..3756a95 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -129,7 +129,8 @@ $SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5 ########h5diff/testfile######## $SRC_H5DIFF_TESTFILES/h5diff_attr1.h5 ########test#HDFFV-10590######## -$SRC_H5REPACK_TESTFILES/h5repack_HDFFV-10590_CVE-2018-17432.h5 +$SRC_H5REPACK_TESTFILES/h5repack_CVE-2018-17432.h5 +$SRC_H5REPACK_TESTFILES/h5repack_CVE-2018-14460.h5 ########tools/testfiles#for#external#links######## $SRC_TOOLS_TESTFILES/tsoftlinks.h5 $SRC_TOOLS_TESTFILES/textlinkfar.h5 @@ -1712,7 +1713,11 @@ TOOLTEST HDFFV-5932 h5repack_attr_refs.h5 TOOLTEST HDFFV-7840 h5diff_attr1.h5 # test HDFFV-10590 -arg="h5repack_HDFFV-10590_CVE-2018-17432.h5 h5repack_HDFFV-10590_CVE-2018-17432_out.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6" +arg="h5repack_CVE-2018-17432.h5 h5repack_CVE-2018-17432_out.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6" +TOOLTEST_FAIL $arg + +# test HDFFV-11223 +arg="h5repack_CVE-2018-14460.h5 h5repack_CVE-2018-14460_out.h5" TOOLTEST_FAIL $arg # tests for metadata block size option diff --git a/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5 b/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5 new file mode 100644 index 0000000..f4093b5 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5 b/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5 new file mode 100644 index 0000000..7a815ba Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_HDFFV-10590_CVE-2018-17432.h5 b/tools/test/h5repack/testfiles/h5repack_HDFFV-10590_CVE-2018-17432.h5 deleted file mode 100644 index 7a815ba..0000000 Binary files a/tools/test/h5repack/testfiles/h5repack_HDFFV-10590_CVE-2018-17432.h5 and /dev/null differ -- cgit v0.12 From 6c170c4b24e7f93bbe2515b941d52eb28905be4a Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 15 May 2021 11:58:54 -0700 Subject: Reduces overly-pedantic casting in the public headers (#644) * Committing clang-format changes * Fixes overly pedantic casting in public headers Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5Dpublic.h | 16 ++++++++-------- src/H5ESpublic.h | 2 +- src/H5Epublic.h | 2 +- src/H5Fpublic.h | 4 ++-- src/H5Lpublic.h | 4 ++-- src/H5Ppublic.h | 2 +- src/H5Spublic.h | 2 +- src/H5Tpublic.h | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 608025a..e48b727 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -28,9 +28,9 @@ /*****************/ /* Macros used to "unset" chunk cache configuration parameters */ -#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t)-1) -#define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t)-1) -#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f) +#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT SIZE_MAX +#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() */ #define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u) @@ -46,11 +46,11 @@ 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_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_t; //! diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h index a7c2e58..409282c 100644 --- a/src/H5ESpublic.h +++ b/src/H5ESpublic.h @@ -25,7 +25,7 @@ /*****************/ /* Default value for "no event set" / synchronous execution */ -#define H5ES_NONE (hid_t)0 +#define H5ES_NONE 0 /* (hid_t) */ /* Special "wait" timeout values */ #define H5ES_WAIT_FOREVER (UINT64_MAX) /* Wait until all operations complete */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index ace7700..0294023 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -24,7 +24,7 @@ #include "H5Ipublic.h" /* Value for the default error stack */ -#define H5E_DEFAULT (hid_t)0 +#define H5E_DEFAULT 0 /* (hid_t) */ /** * Different kinds of error information diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 164b412..51c06f4 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -84,7 +84,7 @@ (0x0020u) /**< Restrict search to objects opened through current file ID \ (as opposed to objects opened through any file ID accessing this file) */ -#define H5F_FAMILY_DEFAULT (hsize_t)0 +#define H5F_FAMILY_DEFAULT 0 /* (hsize_t) */ #ifdef H5_HAVE_PARALLEL /** @@ -108,7 +108,7 @@ typedef enum H5F_scope_t { /** * Unlimited file size for H5Pset_external() */ -#define H5F_UNLIMITED ((hsize_t)(-1L)) +#define H5F_UNLIMITED HSIZE_UNDEF /** * How does file close behave? diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 4b5e9e4..5274649 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -39,12 +39,12 @@ * * The maximum length of a link's name is encoded in a 32-bit unsigned integer. */ -#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */ +#define H5L_MAX_LINK_NAME_LEN UINT32_MAX /** * \brief Macro to indicate operation occurs on same location */ -#define H5L_SAME_LOC (hid_t)0 +#define H5L_SAME_LOC 0 /* (hid_t) */ /** * \brief Current version of the H5L_class_t struct diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 5adb05e..3d6968e 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -100,7 +100,7 @@ #define H5P_CRT_ORDER_INDEXED 0x0002 /* Default value for all property list classes */ -#define H5P_DEFAULT (hid_t)0 +#define H5P_DEFAULT 0 /* (hid_t) */ #ifdef __cplusplus extern "C" { diff --git a/src/H5Spublic.h b/src/H5Spublic.h index fd85dcc..c2c0aef 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -22,7 +22,7 @@ #include "H5Ipublic.h" /* Define atomic datatypes */ -#define H5S_ALL (hid_t)0 +#define H5S_ALL 0 /* (hid_t) */ #define H5S_UNLIMITED HSIZE_UNDEF /* Define user-level maximum number of dimensions */ diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 5301ea2..70a119d 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -245,7 +245,7 @@ typedef struct { * Indicate that a string is variable length (null-terminated in C, instead of * fixed length) */ -#define H5T_VARIABLE ((size_t)(-1)) +#define H5T_VARIABLE SIZE_MAX /* Opaque information */ /** -- cgit v0.12 From 96aa5923d3eb4991ef355404b153ec9e66864e7c Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 17 May 2021 16:25:55 -0500 Subject: CMake uses matches for clang (#645) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- config/cmake/HDFCompilerFlags.cmake | 6 +++--- tools/test/h5diff/testh5diff.sh.in | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index add40bb..bb6ad78 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -134,7 +134,7 @@ if (NOT MSVC AND NOT MINGW) # gcc automatically inlines based on the optimization level # this is just a failsafe list (APPEND H5_CFLAGS "-finline-functions") - elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") + elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") @@ -160,13 +160,13 @@ if (NOT MSVC AND NOT MINGW) list (APPEND H5_CFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") - elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") + elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () else () if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") - elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") + elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () endif () diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index 53e9bf4..bd27dd0 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -1205,7 +1205,7 @@ TOOLTEST h5diff_801.txt -v h5diff_dset1.h5 h5diff_dset3.h5 /g1/array /g1/array # ############################################################################## # # dataset subsets # ############################################################################## -#TRILABS_227 TOOLTEST h5diff_830.txt --enable-error-stack -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;] +#TOOLTEST h5diff_830.txt --enable-error-stack -v h5diff_dset1.h5 h5diff_dset2.h5 "/g1/array3D[0,0,0;2,2,1;2,2,2;]" "/g1/array3D[0,0,0;2,2,1;2,2,2;]" # ############################################################################## # VDS tests -- cgit v0.12 From a5d1897225305fb870761822834f53d3d27fd416 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 18 May 2021 14:23:17 -0500 Subject: Revert addition of & to 2 parameters in DSetCreatPropList::setVirtual to (#652) maintain binary compatibility with released HDF5 versions. --- c++/src/H5DcreatProp.cpp | 4 ++-- c++/src/H5DcreatProp.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 34be7ba..a9270fd 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -774,8 +774,8 @@ DSetCreatPropList::setVirtual(const DataSpace &vspace, const char *src_fname, co // Programmer Binh-Minh Ribler - Mar, 2017 //-------------------------------------------------------------------------- void -DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string &src_fname, - const H5std_string &src_dsname, const DataSpace &sspace) const +DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fname, + const H5std_string src_dsname, const DataSpace &sspace) const { setVirtual(vspace, src_fname.c_str(), src_dsname.c_str(), sspace); } diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index a576518..b822c25 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -123,7 +123,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { // Maps elements of a virtual dataset to elements of the source dataset. void setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname, const DataSpace &sspace) const; - void setVirtual(const DataSpace &vspace, const H5std_string &src_fname, const H5std_string &src_dsname, + void setVirtual(const DataSpace &vspace, const H5std_string src_fname, const H5std_string src_dsname, const DataSpace &sspace) const; ///\brief Returns this class name. -- cgit v0.12 From d179f9d79ca9ed3f94715b907e3d8426a26ee766 Mon Sep 17 00:00:00 2001 From: Lee Newberg <35611400+Leengit@users.noreply.github.com> Date: Wed, 19 May 2021 16:48:20 -0400 Subject: BUG: DataSet assignment operator is missing (#503) * BUG: DataSet assignment operator is missing * Some compilers complain if the copy constructor is given explicitly but the assignment operator is implicitly set to default. * Explicitly defining the assignment operator allows us to properly handle reference counters for shared resources. * BUG: DataSet assignment operator is missing. * Mimicking code of H5DataType::operator() as suggested by @bmribler. * Added test Description: Added test for DataSet::operator= that Leengit added Platform tested: Linux/64 (jelly) * Removed Author field. * Commit clang format changes. * Entry for Leengit's github PR #503 * Removed lines left by mistake Co-authored-by: Binh-Minh Ribler Co-authored-by: Larry Knox --- c++/src/H5DataSet.cpp | 62 ++++++++++++--------------------- c++/src/H5DataSet.h | 3 ++ c++/test/dsets.cpp | 89 +++++++++++++++++++++++++++++++----------------- release_docs/RELEASE.txt | 7 +++- 4 files changed, 88 insertions(+), 73 deletions(-) diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 3a14975..47031db 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -42,7 +42,6 @@ using std::endl; //-------------------------------------------------------------------------- // Function: DataSet default constructor ///\brief Default constructor: creates a stub DataSet. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) { @@ -52,7 +51,6 @@ DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) // Function: DataSet overloaded constructor ///\brief Creates an DataSet object using the id of an existing dataset. ///\param existing_id - IN: Id of an existing dataset -// Programmer Binh-Minh Ribler - 2000 // Description // incRefCount() is needed here to prevent the id from being closed // prematurely. That is, when application uses the id of an @@ -69,7 +67,6 @@ DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existin // Function: DataSet copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: DataSet instance to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(original.id) { @@ -77,6 +74,20 @@ DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(origina } //-------------------------------------------------------------------------- +// Function: DataSet assignment operator +///\brief Assignment operator: same HDF5 object as \a original +///\param original - IN: DataSet instance to copy +//-------------------------------------------------------------------------- +DataSet & +DataSet::operator=(const DataSet &original) +{ + if (this != &original) { + setId(original.id); + } + return (*this); +} + +//-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference ///\brief Given a reference, ref, to an hdf5 location, creates a /// DataSet object @@ -89,7 +100,6 @@ DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(origina ///\par Description /// \c loc can be DataSet, Group, H5File, or named DataType, that /// is a datatype that has been named by DataType::commit. -// Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- DataSet::DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID) @@ -106,7 +116,6 @@ DataSet::DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type, co ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\param plist - IN: Property list - default to PropList::DEFAULT ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- DataSet::DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type, const PropList &plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID) @@ -119,7 +128,6 @@ DataSet::DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type, co ///\brief Gets a copy of the dataspace of this dataset. ///\return DataSpace instance ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace DataSet::getSpace() const @@ -156,7 +164,6 @@ DataSet::p_get_type() const ///\brief Gets the dataset creation property list. ///\return DSetCreatPropList instance ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList DataSet::getCreatePlist() const @@ -200,7 +207,6 @@ DataSet::getAccessPlist() const ///\exception H5::DataSetIException // Note: H5Dget_storage_size returns 0 when there is no data. This // function should have no failure. (from SLU) -// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- hsize_t DataSet::getStorageSize() const @@ -214,7 +220,6 @@ DataSet::getStorageSize() const ///\brief Gets the size in memory of the dataset's data. ///\return Size of data (in memory) ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Apr 2009 //-------------------------------------------------------------------------- size_t DataSet::getInMemDataSize() const @@ -272,7 +277,6 @@ DataSet::getInMemDataSize() const ///\brief Returns the address of this dataset in the file. ///\return Address of dataset ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- haddr_t DataSet::getOffset() const @@ -291,7 +295,6 @@ DataSet::getOffset() const ///\brief Determines whether space has been allocated for a dataset. ///\param status - OUT: Space allocation status ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::getSpaceStatus(H5D_space_status_t &status) const @@ -309,7 +312,6 @@ DataSet::getSpaceStatus(H5D_space_status_t &status) const ///\param space - IN: Selection for the memory buffer ///\return Amount of storage ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hsize_t DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const @@ -334,7 +336,6 @@ DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const // misses const's. This wrapper will be removed in future release. // Return Amount of storage // Exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Modified to call its replacement. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -354,7 +355,6 @@ DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const ///\param xfer_plist - IN: Property list used to create the buffer ///\param buf - IN: Pointer to the buffer to be reclaimed ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::vlenReclaim(const DataType &type, const DataSpace &space, const DSetMemXferPropList &xfer_plist, @@ -380,7 +380,6 @@ DataSet::vlenReclaim(const DataType &type, const DataSpace &space, const DSetMem ///\param xfer_plist - IN: Property list used to create the buffer ///\param buf - IN: Pointer to the buffer to be reclaimed ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 //\parDescription // This function has better prototype for the users than the // other, which might be removed at some point. BMR - 2006/12/20 @@ -413,7 +412,6 @@ DataSet::vlenReclaim(void *buf, const DataType &type, const DataSpace &space, /// This function reads raw data from this dataset into the /// buffer \a buf, converting from file datatype and dataspace /// to memory datatype \a mem_type and dataspace \a mem_space. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::read(void *buf, const DataType &mem_type, const DataSpace &mem_space, const DataSpace &file_space, @@ -441,7 +439,6 @@ DataSet::read(void *buf, const DataType &mem_type, const DataSpace &mem_space, c ///\param file_space - IN: Dataset's dataspace in the file ///\param xfer_plist - IN: Transfer property list for this I/O operation ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Jul 2009 // Follow the change to Attribute::read and use the following @@ -490,7 +487,6 @@ DataSet::read(H5std_string &strg, const DataType &mem_type, const DataSpace &mem /// \a buf to a dataset, converting from memory datatype /// \a mem_type and dataspace \a mem_space to file datatype /// and dataspace. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::write(const void *buf, const DataType &mem_type, const DataSpace &mem_space, @@ -512,7 +508,6 @@ DataSet::write(const void *buf, const DataType &mem_type, const DataSpace &mem_s // Function: DataSet::write ///\brief This is an overloaded member function, provided for convenience. /// It takes a reference to a \c H5std_string for the buffer. -// Programmer Binh-Minh Ribler - 2000 // Modification // Jul 2009 // Modified to pass the buffer into H5Dwrite properly depending @@ -568,7 +563,6 @@ DataSet::write(const H5std_string &strg, const DataType &mem_type, const DataSpa ///\exception H5::DataSetIException ///\note This function may not work correctly yet - it's still /// under development. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DataSet::iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op, @@ -594,7 +588,6 @@ DataSet::iterateElems(void *buf, const DataType &type, const DataSpace &space, H ///\par Description /// For information, please refer to the H5Dset_extent API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::extend(const hsize_t *size) const @@ -613,7 +606,6 @@ DataSet::extend(const hsize_t *size) const ///\param buf_type - IN: Datatype of the elements in buffer ///\param space - IN: Dataspace describing memory buffer & containing selection to use ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2014 //-------------------------------------------------------------------------- void DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type, @@ -639,7 +631,6 @@ DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, cons // Param buf_type - IN: Datatype of the elements in buffer // Param space - IN: Dataspace describing memory buffer & containing selection to use // Exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Modified to call its replacement. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -658,7 +649,6 @@ DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, cons ///\param buf_type - IN: Datatype of the elements in buffer ///\param space - IN: Dataspace describing memory buffer & containing selection to use ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const @@ -680,7 +670,6 @@ DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) // Param buf_type - IN: Datatype of the elements in buffer // Param space - IN: Dataspace describing memory buffer & containing selection to use // Exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Modified to call its replacement. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -700,7 +689,6 @@ DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) // AbstractDs and Attribute are moved out of H5Object. In // addition, member IdComponent::id is moved into subclasses, and // IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t DataSet::getId() const @@ -710,11 +698,10 @@ DataSet::getId() const //-------------------------------------------------------------------------- // Function: DataSet::p_read_fixed_len (private) -// brief Reads a fixed length \a H5std_string from a dataset. -// param mem_type - IN: DataSet datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Jul, 2009 +// brief Reads a fixed length \a H5std_string from a dataset. +// param mem_type - IN: DataSet datatype (in memory) +// param strg - IN: Buffer for read string +// exceptio n H5::DataSetIException // Modification // Jul 2009 // Added in follow to the change in Attribute::read @@ -748,11 +735,10 @@ DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, con //-------------------------------------------------------------------------- // Function: DataSet::p_read_variable_len (private) -// brief Reads a variable length \a H5std_string from an dataset. -// param mem_type - IN: DataSet datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Jul, 2009 +// brief Reads a variable length \a H5std_string from an dataset. +// param mem_type - IN: DataSet datatype (in memory) +// param strg - IN: Buffer for read string +// exception H5::DataSetIException // Modification // Jul 2009 // Added in follow to the change in Attribute::read @@ -787,7 +773,6 @@ DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, // The underlaying reference counting in the C library ensures // that the current valid id of this object is properly closed. // Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::p_setId(const hid_t new_id) @@ -811,7 +796,6 @@ DataSet::p_setId(const hid_t new_id) // Applications shouldn't need to use it. // param dset - IN/OUT: DataSet object to be changed // param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void f_PropList_setId(PropList *plist, hid_t new_id) @@ -826,7 +810,6 @@ f_PropList_setId(PropList *plist, hid_t new_id) ///\brief Closes this dataset. /// ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void DataSet::close() @@ -844,7 +827,6 @@ DataSet::close() //-------------------------------------------------------------------------- // Function: DataSet destructor ///\brief Properly terminates access to this dataset. -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Jun 1, 2004 diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index 619bc30..d50b2c5 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -117,6 +117,9 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Copy constructor - same as the original DataSet. DataSet(const DataSet &original); + // Assignment operator + DataSet &operator=(const DataSet &original); + // Creates a copy of an existing DataSet using its id. DataSet(const hid_t existing_id); diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 0363bba..a16061b 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -42,6 +42,8 @@ const H5std_string DSET_SIMPLE_IO_NAME("simple_io"); const H5std_string DSET_TCONV_NAME("tconv"); const H5std_string DSET_COMPRESS_NAME("compressed"); const H5std_string DSET_BOGUS_NAME("bogus"); +const H5std_string DSET_OPERATOR("testing operator="); +const H5std_string DSET_OPERATOR_PATH("/testing operator="); /* Temporary filter IDs used for testing */ const int H5Z_FILTER_BOGUS = 305; @@ -58,9 +60,6 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 *------------------------------------------------------------------------- */ static herr_t @@ -182,9 +181,6 @@ test_create(H5File &file) * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 *------------------------------------------------------------------------- */ static herr_t @@ -260,9 +256,6 @@ test_simple_io(H5File &file) * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler - * Thursday, March 22, 2012 *------------------------------------------------------------------------- */ static herr_t @@ -322,9 +315,6 @@ test_datasize(FileAccPropList &fapl) * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 *------------------------------------------------------------------------- */ static herr_t @@ -432,9 +422,6 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[ * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 *------------------------------------------------------------------------- */ static herr_t @@ -703,10 +690,6 @@ test_compression(H5File &file) * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler - * Friday, April 22, 2016 - * *------------------------------------------------------------------------- */ const H5std_string DSET_NBIT_NAME("nbit_dataset"); @@ -818,9 +801,6 @@ test_nbit_compression(H5File &file) * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler (using C version) - * Saturday, February 17, 2001 *------------------------------------------------------------------------- */ static herr_t @@ -893,9 +873,6 @@ test_multiopen(H5File &file) * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler (using C version) - * February 17, 2001 *------------------------------------------------------------------------- */ static herr_t @@ -1246,10 +1223,6 @@ test_chunk_cache(const FileAccPropList &fapl) * * Return Success: 0 * Failure: number of errors - * - * Programmer Binh-Minh Ribler - * Friday, March 10, 2017 - * *------------------------------------------------------------------------- */ const int RANK = 2; @@ -1316,6 +1289,60 @@ test_virtual() } // test_virtual /*------------------------------------------------------------------------- + * Function: test_operator + * + * Purpose Tests DataSet::operator= + * + * Return Success: 0 + * + * Failure: -1 + *------------------------------------------------------------------------- + */ +static herr_t +test_operator(H5File &file) +{ + SUBTEST("DataSet::operator="); + + try { + // Create a data space + hsize_t dims[2]; + dims[0] = 256; + dims[1] = 512; + DataSpace space(2, dims, NULL); + + // Create a dataset using the default dataset creation properties. + // We're not sure what they are, so we won't check. + DataSet dataset = file.createDataSet(DSET_OPERATOR, PredType::NATIVE_DOUBLE, space); + + // Add a comment to the dataset + file.setComment(DSET_OPERATOR, "Dataset using operator="); + + // Close the dataset + dataset.close(); + + // Re-open the dataset + DataSet another_dataset(file.openDataSet(DSET_OPERATOR)); + + // Try operator= to make another dataset + DataSet copied_dataset = another_dataset; + + H5std_string copied_dataset_name = copied_dataset.getObjName(); + H5std_string another_dataset_name = another_dataset.getObjName(); + + PASSED(); + return 0; + } // try block + + // catch all other exceptions + catch (Exception &E) { + issue_fail_msg("test_operator", __LINE__, __FILE__); + + // clean up and return with failure + return -1; + } +} // test_operator + +/*------------------------------------------------------------------------- * Function: test_dset * * Purpose Tests the dataset interface (H5D) @@ -1324,9 +1351,6 @@ test_virtual() * * Failure: -1 * - * Programmer Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 - * * Modifications: * Nov 12, 01: * - moved h5_cleanup to outside of try block because @@ -1364,6 +1388,7 @@ test_dset() nerrors += test_multiopen(file) < 0 ? 1 : 0; nerrors += test_types(file) < 0 ? 1 : 0; nerrors += test_virtual() < 0 ? 1 : 0; + nerrors += test_operator(file) < 0 ? 1 : 0; nerrors += test_chunk_cache(fapl) < 0 ? 1 : 0; // Close group "emit diagnostics". diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9e99e66..802c6d1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1157,7 +1157,12 @@ Bug Fixes since HDF5-1.12.0 release C++ APIs -------- - - + - Added DataSet::operator= + + Some compilers complain if the copy constructor is given explicitly + but the assignment operator is implicitly set to default. + + (2021/05/19) Testing -- cgit v0.12 From 509a068f628826b8d1d09b7ab267400f4cec0852 Mon Sep 17 00:00:00 2001 From: Gaute Hope Date: Thu, 20 May 2021 00:21:52 +0200 Subject: Add H5Dchunk_iter method for iterating over chunks (#6) * Add H5Dchunk_iter method for iterating over chunks This method iterates over all chunks in dataset, calling a user-supplied callback with the chunk information and optional user supplied data. The iterator is stopped when ITER_STOP is returned by the user-supplied callback or the iterator is exhausted. Existing methods to get chunk_info performs an iteration each time, so to get many or all chunks causes SUM(i) for i = 0 -> N operations for N chunks, as opposed to N operations when using this iterator for this use case. * H5Dchunk_iter: test iterating all chunks, some chunks and failing iteration. * H5D: move H5Dchunk_iter private methods to specific * trace: add H5D_chunk_iter_op_t and trace H5D.c * chunks-iter: document chunk_iter * chunk-iter: chunk add FUNC_ENTER/FUNC_LEAVE macros * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- bin/trace | 1 + src/H5D.c | 65 +++++++++++++++++++++++++++ src/H5Dchunk.c | 98 ++++++++++++++++++++++++++++++++++++++++ src/H5Dpkg.h | 1 + src/H5Dpublic.h | 53 ++++++++++++++++++++++ src/H5VLconnector.h | 3 +- src/H5VLnative_dataset.c | 18 ++++++++ test/chunk_info.c | 113 +++++++++++++++++++++++++++++++++++++++-------- 8 files changed, 333 insertions(+), 19 deletions(-) diff --git a/bin/trace b/bin/trace index 0611fa5..a2052ce 100755 --- a/bin/trace +++ b/bin/trace @@ -53,6 +53,7 @@ $Source = ""; "H5D_scatter_func_t" => "DS", "H5FD_mpio_xfer_t" => "Dt", "H5D_vds_view_t" => "Dv", + "H5D_chunk_iter_op_t" => "x", "herr_t" => "e", "H5E_auto1_t" => "Ea", "H5E_auto2_t" => "EA", diff --git a/src/H5D.c b/src/H5D.c index 2f0daaf..aa09f5f 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -2142,3 +2142,68 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte done: FUNC_LEAVE_API(ret_value) } /* end H5Dget_chunk_info_by_coord() */ + +/*------------------------------------------------------------------------- + * Function: H5Dchunk_iter + * + * Purpose: Iterates over all chunks in dataset with given callback and user data. + * + * Parameters: + * hid_t dset_id; IN: Chunked dataset 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. + * + * 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. + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Gaute Hope + * August 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dchunk_iter(hid_t dset_id, H5D_chunk_iter_op_t cb, void *op_data) +{ + H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ix*x", dset_id, cb, 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") + + /* 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") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Dchunk_iter() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 25fb2f8..6be29fd 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -245,6 +245,11 @@ 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 */ + void * op_data; /* User data for user defined callback */ +} H5D_chunk_iter_cb_data_t; + /********************/ /* Local Prototypes */ /********************/ @@ -269,6 +274,7 @@ static herr_t H5D__chunk_dest(H5D_t *dset); static int H5D__get_num_chunks_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); static int H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); +static int H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata); /* "Nonexistent" layout operation callback */ static ssize_t H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, @@ -7451,3 +7457,95 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__get_chunk_info_by_coord() */ + +/*------------------------------------------------------------------------- + * Function: H5D__chunk_iter + * + * Purpose: Iterate over all the chunks in the dataset with given callbak. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Gaute Hope + * August 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t cb, void *op_data) +{ + const H5O_layout_t *layout = NULL; /* Dataset layout */ + const H5D_rdcc_t * rdcc = NULL; /* Raw data chunk cache */ + H5D_rdcc_ent_t * ent; /* Cache entry index */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) + + /* Check args */ + HDassert(dset); + HDassert(dset->shared); + + /* Get dataset layout and raw data chunk cache */ + layout = &(dset->shared->layout); + rdcc = &(dset->shared->cache.chunk); + HDassert(layout); + HDassert(rdcc); + HDassert(H5D_CHUNKED == layout->type); + + /* Search for cached chunks that haven't been written out */ + for (ent = rdcc->head; ent; ent = ent->next) + /* Flush the chunk out to disk, to make certain the size is correct later */ + if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.pline = &dset->shared->dcpl_cache.pline; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; + + /* 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; + + /* 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.") + } /* end if H5F_addr_defined */ + +done: + FUNC_LEAVE_NOAPI_TAG(ret_value) +} /* end H5D__chunk_iter() */ + +/*------------------------------------------------------------------------- + * Function: H5D__chunk_iter_cb + * + * Purpose: Call the user-defined function with the chunk data. The iterator continues if + * the user-defined function returns H5_ITER_CONT, and stops if H5_ITER_STOP is + * returned. + * + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * Failure: Negative (H5_ITER_ERROR) + * + * Programmer: Gaute Hope + * August 2020 + * + *------------------------------------------------------------------------- + */ +static int +H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata) +{ + int ret_value = 0; + + 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); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__chunk_iter_cb */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 64f2c7a..28561c9 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -565,6 +565,7 @@ H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_ unsigned *filter_mask, haddr_t *offset, hsize_t *size); H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size); +H5_DLL herr_t H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t cb, void *op_data); H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); H5_DLL herr_t H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size); H5_DLL herr_t H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index e48b727..0b5fac6 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -160,6 +160,14 @@ typedef herr_t (*H5D_scatter_func_t)(const void **src_buf /*out*/, size_t *src_b typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_used, void *op_data); //! +//! +/** + * Define the operator function pointer for H5Dchunk_iter() + */ +//! +typedef int (*H5D_chunk_iter_op_t)(const hsize_t *offset, uint32_t filter_mask, haddr_t addr, uint32_t nbytes, + void *op_data); + /********************/ /* Public Variables */ /********************/ @@ -630,6 +638,51 @@ 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 + * + * \dset_id + * \param[in] cb User callback function, called for every chunk. + * \param[in] op_data User-defined pointer to data required by op + * + * \return \herr_t + * + * \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. + * + */ +H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, H5D_chunk_iter_op_t cb, void *op_data); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * * \brief Retrieves information about a chunk specified by its index * * \dset_id diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 2a8ef6e..63613bc 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -82,7 +82,8 @@ 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_WAIT, /* H5Dwait */ + H5VL_DATASET_CHUNK_ITER /* H5Dchunk_iter */ } H5VL_dataset_specific_t; /* Typedef for VOL connector dataset optional VOL operations */ diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c index d78388e..21491e7 100644 --- a/src/H5VLnative_dataset.c +++ b/src/H5VLnative_dataset.c @@ -353,6 +353,24 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, 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 */ diff --git a/test/chunk_info.c b/test/chunk_info.c index ada2d80..c84f500 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -1482,6 +1482,50 @@ error: return FAIL; } /* test_chunk_info_version2_btrees() */ +typedef struct chunk_iter_info_t { + hsize_t offset[2]; + uint32_t filter_mask; + haddr_t addr; + uint32_t nbytes; +} chunk_iter_info_t; + +static int +iter_cb(const hsize_t *offset, uint32_t filter_mask, haddr_t addr, uint32_t nbytes, void *op_data) +{ + chunk_iter_info_t **chunk_info = (chunk_iter_info_t **)op_data; + + (*chunk_info)->offset[0] = offset[0]; + (*chunk_info)->offset[1] = offset[1]; + (*chunk_info)->filter_mask = filter_mask; + (*chunk_info)->addr = addr; + (*chunk_info)->nbytes = nbytes; + + /* printf("offset: [%lld, %lld], addr: %ld, size: %d, filter mask: %d\n", offset[0], offset[1], addr, + * nbytes, filter_mask); */ + + *chunk_info += 1; + + return H5_ITER_CONT; +} + +static int +iter_cb_stop(const hsize_t H5_ATTR_UNUSED *offset, uint32_t H5_ATTR_UNUSED filter_mask, + haddr_t H5_ATTR_UNUSED addr, uint32_t H5_ATTR_UNUSED nbytes, void *op_data) +{ + chunk_iter_info_t **chunk_info = (chunk_iter_info_t **)op_data; + *chunk_info += 1; + return H5_ITER_STOP; +} + +static int +iter_cb_fail(const hsize_t H5_ATTR_UNUSED *offset, uint32_t H5_ATTR_UNUSED filter_mask, + haddr_t H5_ATTR_UNUSED addr, uint32_t H5_ATTR_UNUSED nbytes, void *op_data) +{ + chunk_iter_info_t **chunk_info = (chunk_iter_info_t **)op_data; + *chunk_info += 1; + return H5_ITER_ERROR; +} + /*------------------------------------------------------------------------- * Function: test_basic_query * @@ -1502,24 +1546,26 @@ error: static herr_t test_basic_query(hid_t fapl) { - char filename[FILENAME_BUF_SIZE]; /* File name */ - hid_t basicfile = H5I_INVALID_HID; /* File ID */ - hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t cparms = H5I_INVALID_HID; /* Creation plist */ - hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ - hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ - int direct_buf[CHUNK_NX][CHUNK_NY]; /* Data in chunks */ - unsigned flt_msk = 0; /* Filter mask */ - unsigned read_flt_msk = 0; /* Filter mask after direct read */ - hsize_t offset[2]; /* Offset coordinates of a chunk */ - hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ - hsize_t size = 0; /* Size of an allocated/written chunk */ - hsize_t nchunks = 0; /* Number of chunks */ - haddr_t addr = 0; /* Address of an allocated/written chunk */ - hsize_t chk_index = 0; /* Index of a chunk */ - hsize_t ii, jj; /* Array indices */ - herr_t ret; /* Temporary returned value for verifying failure */ + char filename[FILENAME_BUF_SIZE]; /* File name */ + hid_t basicfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + int direct_buf[CHUNK_NX][CHUNK_NY]; /* Data in chunks */ + unsigned flt_msk = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + hsize_t ii, jj; /* Array indices */ + chunk_iter_info_t chunk_infos[2]; /* chunk infos filled up by iterator */ + chunk_iter_info_t *cptr; /* pointer to array of chunks */ + herr_t ret; /* Temporary returned value for verifying failure */ TESTING("basic operations"); @@ -1627,6 +1673,37 @@ test_basic_query(hid_t fapl) if (verify_empty_chunk_info(dset, offset) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); + /* iterate over all chunks */ + cptr = &(chunk_infos[0]); + if (H5Dchunk_iter(dset, &iter_cb, &cptr) < 0) + TEST_ERROR; + + VERIFY(cptr, &(chunk_infos[2]), "Iterator did not iterate all chunks"); + VERIFY(chunk_infos[0].offset[0], 0, "Offset mismatch"); + VERIFY(chunk_infos[0].offset[1], 0, "Offset mismatch"); + VERIFY(chunk_infos[0].filter_mask, 0, "Filter mismatch"); + VERIFY(chunk_infos[0].nbytes, 96, "Size mismatch"); + + VERIFY(chunk_infos[1].offset[0], 1, "Offset mismatch"); + VERIFY(chunk_infos[1].offset[1], 1, "Offset mismatch"); + + /* iterate and stop after one iteration */ + cptr = &(chunk_infos[0]); + if (H5Dchunk_iter(dset, &iter_cb_stop, &cptr) < 0) + TEST_ERROR; + VERIFY(cptr, &(chunk_infos[1]), "Verification of halted iterator failed\n"); + + /* iterate and fail after one iteration */ + cptr = &(chunk_infos[0]); + H5E_BEGIN_TRY + { + ret = H5Dchunk_iter(dset, &iter_cb_fail, &cptr); + } + H5E_END_TRY; + if (ret >= 0) + TEST_ERROR; + VERIFY(cptr, &(chunk_infos[1]), "Verification of halted iterator failed\n"); + /* Release resourse */ if (H5Dclose(dset) < 0) TEST_ERROR -- cgit v0.12 From 5142398d1b625e05c14a4b01a2205411d6c30a5d Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 19 May 2021 17:22:18 -0500 Subject: Add if blocks around fortran targets for build mode (#660) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- fortran/src/CMakeLists.txt | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 7a39abf..1a3aa15 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -136,21 +136,25 @@ set (f90CStub_C_HDRS ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h ) -set (f90CStub_CGEN_HDRS - # generated files - ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h -) -add_custom_target (H5gen_i ALL - DEPENDS H5match_types ${f90CStub_CGEN_HDRS} -) +if (NOT ONLY_SHARED_LIBS) + set (f90CStub_CGEN_HDRS + # generated files + ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ) + add_custom_target (H5gen_i ALL + DEPENDS H5match_types ${f90CStub_CGEN_HDRS} + ) +endif () -set (f90CStub_CGEN_SHHDRS - # generated files - ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h -) -add_custom_target (H5gen_iSH ALL - DEPENDS H5match_types ${f90CStub_CGEN_SHHDRS} -) +if (BUILD_SHARED_LIBS) + set (f90CStub_CGEN_SHHDRS + # generated files + ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h + ) + add_custom_target (H5gen_iSH ALL + DEPENDS H5match_types ${f90CStub_CGEN_SHHDRS} + ) +endif () if (NOT ONLY_SHARED_LIBS) add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_HDRS}) -- cgit v0.12 From 701be452e73b0feaca4afae7f707f5a75fff15bd Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 20 May 2021 22:44:36 -0500 Subject: Fix VS2019 test reference (#668) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- release_docs/RELEASE.txt | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 802c6d1..1b920af 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -428,7 +428,7 @@ New Features The Doxygen documentation has been updated and passing values larger than UINT32_MAX for size_hint will now produce a normal HDF5 error. - + (DER - 2021/04/29, HDFFV-11241) @@ -456,7 +456,7 @@ New Features The string is now handled properly and the segfault no longer occurs. (DER - 2021/04/27, HDFFV-11239) - + - HSYS_GOTO_ERROR now emits the results of GetLastError() on Windows HSYS_GOTO_ERROR is an internal macro that is used to produce error @@ -905,7 +905,7 @@ Bug Fixes since HDF5-1.12.0 release H5S_NO_CLASS is an internal class value that should not have been exposed via a public API call. - In debug builds of the library, this can cause assert() function to + In debug builds of the library, this can cause assert() function to trip. In non-debug builds, it will produce normal library errors. The new library behavior is for H5Sset_extent_none() to convert @@ -1301,15 +1301,22 @@ The following platforms are not supported but have been tested for this release. #1 SMP ppc64 GNU/Linux IBM XL C/C++ for Linux, V13.1 (ostrich) and IBM XL Fortran for Linux, V15.1 - Fedora33 5.10.10-200.fc33.x86_64 - #1 SMP x86_64 GNU/Linux GNU gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9) - GNU Fortran (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9) + Fedora33 5.11.18-200.fc33.x86_64 + #1 SMP x86_64 GNU/Linux GNU gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) + GNU Fortran (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) clang version 11.0.0 (Fedora 11.0.0-2.fc33) (cmake and autotools) - Ubuntu20.10 5.8.0-41-generic-x86_64 - #46-Ubuntu SMP x86_64 GNU/Linux GNU gcc (GCC) 10.2.0-13ubuntu1 + Ubuntu20.04 5.8.0-53-generic-x86_64 + #60~20.04-Ubuntu SMP x86_64 GNU/Linux GNU gcc (GCC) 9.3.0-17ubuntu1 + GNU Fortran (GCC) 9.3.0-17ubuntu1 + clang version 10.0.0-4ubuntu1 + (cmake and autotools) + + Ubuntu20.10 5.8.0-53-generic-x86_64 + #60-Ubuntu SMP x86_64 GNU/Linux GNU gcc (GCC) 10.2.0-13ubuntu1 GNU Fortran (GCC) 10.2.0-13ubuntu1 + Ubuntu clang version 11.0.0-2 (cmake and autotools) SUSE15sp2 5.3.18-22-default -- cgit v0.12 From 02de350b396bfc378bfb4b4382e176b21bf379d5 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 21 May 2021 17:08:36 -0500 Subject: Remove version from pkgcfg file names (#671) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/src/CMakeLists.txt | 4 ++-- config/cmake/libh5cc.in | 2 +- fortran/src/CMakeLists.txt | 4 ++-- hl/c++/src/CMakeLists.txt | 4 ++-- hl/fortran/src/CMakeLists.txt | 4 ++-- hl/src/CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 4b1a2d6..835d422 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -199,11 +199,11 @@ set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}" configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in - ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}.pc @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}.pc DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig COMPONENT cpplibraries ) diff --git a/config/cmake/libh5cc.in b/config/cmake/libh5cc.in index f7cab98..c98d9ca 100644 --- a/config/cmake/libh5cc.in +++ b/config/cmake/libh5cc.in @@ -29,4 +29,4 @@ printf 'dir is %s\n' "$dir" export PKG_CONFIG_PATH=$dir/lib/pkgconfig -@_PKG_CONFIG_COMPILER@ `pkg-config --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@-@_PKG_CONFIG_VERSION@` $@ +@_PKG_CONFIG_COMPILER@ `pkg-config --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@` $@ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 1a3aa15..d849086 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -556,11 +556,11 @@ set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}" configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in - ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}.pc @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}.pc DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig COMPONENT fortlibraries ) diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index e488656..c516df1 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -110,11 +110,11 @@ set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSIO configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in - ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}.pc @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}.pc DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig COMPONENT hlcpplibraries ) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 4f0b451..6c97886 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -343,11 +343,11 @@ set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSI configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in - ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_F90_LIB_CORENAME}.pc @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_F90_LIB_CORENAME}.pc DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig COMPONENT hlfortlibraries ) diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 427424e..7678de8 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -142,11 +142,11 @@ set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}" configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in - ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}.pc @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}.pc DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig COMPONENT hllibraries ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b648e26..97384f0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1344,11 +1344,11 @@ set (_PKG_CONFIG_REQUIRES_PRIVATE) configure_file ( ${HDF_CONFIG_DIR}/libhdf5.pc.in - ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}.pc @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}.pc DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig COMPONENT libraries ) -- cgit v0.12 From 2142359709a65de6669d76c33c7574202e6909c8 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 24 May 2021 06:26:19 -0700 Subject: Brings chunk_info valgrind fix from 1.12 (#677) * Committing clang-format changes * Fixes a minor valgrind issue in the chunk_info test (#675) * Fixes a minor valgrind issue in the chunk_info test The chunk_info test incorrectly set the number of bytes in a compressed buffer, which caused valgrind to complain about writing uninitialized bytes. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/chunk_info.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/chunk_info.c b/test/chunk_info.c index c84f500..7104941 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -449,7 +449,7 @@ error: * Return: Success: SUCCEED * Failure: FAIL * - * Note: Note that the dataspace argument in these new functions are + * Note: Note that the dataspace argument in these new functions is * currently not used. The functionality involved the dataspace * will be implemented in the next version. * @@ -486,10 +486,10 @@ test_get_chunk_info_highest_v18(hid_t fapl) hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ #ifdef H5_HAVE_FILTER_DEFLATE const Bytef *z_src = (const Bytef *)(direct_buf); - Bytef * z_dst; /*destination buffer */ + Bytef * z_dst; /* Destination buffer */ uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE); uLong z_src_nbytes = (uLong)CHK_SIZE; -#endif /* end H5_HAVE_FILTER_DEFLATE */ +#endif void * inbuf = NULL; /* Pointer to new buffer */ hsize_t chunk_size = CHK_SIZE; /* Size of a chunk, can be compressed or not */ hsize_t ii, jj; /* Array indices */ @@ -544,14 +544,15 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Allocate input (compressed) buffer */ inbuf = HDcalloc(1, z_dst_nbytes); - /* Set chunk size to the compressed chunk size and the chunk point - to the compressed data chunk */ - chunk_size = (hsize_t)z_dst_nbytes; - z_dst = (Bytef *)inbuf; + /* zlib-friendly alias for the input buffer */ + z_dst = (Bytef *)inbuf; /* Perform compression from the source to the destination buffer */ ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + /* Set the chunk size to the compressed chunk size */ + chunk_size = (hsize_t)z_dst_nbytes; + /* Check for various zlib errors */ if (Z_BUF_ERROR == ret) { HDfprintf(stderr, "overflow"); -- cgit v0.12 From bee09040d39d265d28b230735e28c3603a5da217 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 24 May 2021 06:53:24 -0700 Subject: Fixes for a couple of trivial warnings (#676) * Committing clang-format changes * Trivial warning fixes: * Removes an unused done target in H5Tbit.c * Add (void) to quiet "ignored return value" warnings in the generators (which generally ignore errors) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5Tbit.c | 1 - tools/test/h5jam/h5jamgentest.c | 6 +++--- tools/test/h5stat/h5stat_gentest.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 9f0c061..04e2a97 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -268,7 +268,6 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) /* Set return value */ ret_value = val; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__bit_get_d() */ diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index 45ff0b0..1da6b63 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -277,7 +277,7 @@ gent_ub(const char *filename, size_t ub_size, size_t ub_fill) for (u = 0; u < ub_fill; u++) *bp++ = pattern[u % 10]; - HDwrite(fd, buf, ub_size); + (void)HDwrite(fd, buf, ub_size); HDclose(fd); } @@ -301,7 +301,7 @@ create_textfile(const char *name, size_t size) for (i = 0; i < size; i++) *bp++ = pattern[i % 10]; - HDwrite(fd, buf, size); + (void)HDwrite(fd, buf, size); HDfree(buf); @@ -329,7 +329,7 @@ create_binfile(char *name, off_t size) for (i = 0; i < size; i++) *bp++ = (char)i & 0xff; - HDwrite(fd, buf, size); + (void)HDwrite(fd, buf, size); HDclose(fd); } diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c index b55cd06..a9813e7 100644 --- a/tools/test/h5stat/h5stat_gentest.c +++ b/tools/test/h5stat/h5stat_gentest.c @@ -497,7 +497,7 @@ gen_err_refcount(const char *fname) attribute message */ if ((fd = HDopen(fname, O_RDWR, 0633)) >= 0) { HDlseek(fd, 4520 + 24, SEEK_SET); - HDwrite(fd, &val, 2); + (void)HDwrite(fd, &val, 2); HDclose(fd); } -- cgit v0.12 From 62a5443bd798dd2b4c4deba2cbb0bd8646196e7d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 24 May 2021 06:55:08 -0700 Subject: Various CMake changes (#679) * Committing clang-format changes * Several CMake updates: * Removes unused HDF5_ENABLE_HSIZET * Switches TEST_SHELL_SCRIPTS to ON * Sets SH_PROGRAM to bash instead of sh * Set default build type back to RelWithDebInfo Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- config/cmake/ConfigureChecks.cmake | 8 -------- release_docs/INSTALL_CMake.txt | 2 +- release_docs/RELEASE.txt | 16 ++++++++++++++++ test/CMakeTests.cmake | 2 +- test/ShellTests.cmake | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 0d82668..19e7dce 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -86,14 +86,6 @@ else () set (HDF5_FILE_LOCKING_SETTING "no") endif () -#----------------------------------------------------------------------------- -# Are we going to use HSIZE_T -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON) -if (HDF5_ENABLE_HSIZET) - set (${HDF_PREFIX}_HAVE_LARGE_HSIZET 1) -endif () - # so far we have no check for this set (${HDF_PREFIX}_HAVE_TMPFILE 1) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 6f30f45..5d11957 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -753,7 +753,6 @@ HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" OFF HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON -HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON HDF5_ENABLE_TRACE "Enable API tracing capability" OFF @@ -795,6 +794,7 @@ HDF5_BUILD_DOC "Build documentation" HDF5_ENABLE_ANALYZER_TOOLS "enable the use of Clang tools" OFF HDF5_ENABLE_SANITIZERS "execute the Clang sanitizer" OFF HDF5_ENABLE_FORMATTERS "format source files" OFF +TEST_SHELL_SCRIPTS "Enable shell script tests" ON ---------------- External Library Options --------------------- HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO" diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 1b920af..578c4b4 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,22 @@ New Features Configuration: ------------- + - CMake will now run the shell script tests in test/ by default + + The test directory includes several shell script tests that previously + were not run by CMake. These are now run by default. TEST_SHELL_SCRIPTS + has been set to ON and SH_PROGRAM has been set to bash (some test + scripts use bash-isms). Platforms without bash (e.g., Windows) will + ignore the script tests. + + (DER - 2021/05/23) + + - Removed unused HDF5_ENABLE_HSIZET option from CMake + + This has been unused for some time and has no effect. + + (DER - 2021/05/23) + - CMake no longer builds the C++ library by default HDF5_BUILD_CPP_LIB now defaults to OFF, which is in line with the diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index d3e0788..9fb49f6 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -870,7 +870,7 @@ if (BUILD_SHARED_LIBS) ############################################################################## endif () -option (TEST_SHELL_SCRIPTS "Enable shell script tests" OFF) +option (TEST_SHELL_SCRIPTS "Enable shell script tests" ON) if (TEST_SHELL_SCRIPTS) include (ShellTests.cmake) endif() diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index b28bbd6..812121e 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -17,7 +17,7 @@ if (UNIX) - find_program (SH_PROGRAM sh) + find_program (SH_PROGRAM bash) if (SH_PROGRAM) ############################################################################## -- cgit v0.12 From 004b9c06a68232957914874776c755568fba915e Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 25 May 2021 13:20:51 -0700 Subject: Typo (#682) * Committing clang-format changes * Minor typo in H5O.c Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5O.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5O.c b/src/H5O.c index ab39ec0..4876bb0 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1843,7 +1843,7 @@ H5O__close_check_common(hid_t object_id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O__close_api_common() */ +} /* H5O__close_check_common() */ /*------------------------------------------------------------------------- * Function: H5Oclose -- cgit v0.12 From 2c5d08d84d40ca7b8063e85e7db51024686ea28f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 25 May 2021 13:38:54 -0700 Subject: err_compat test cleanup (#681) * Committing clang-format changes * Cleans up err_compat test and output * Formatted source Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/err_compat.c | 257 ++++++++++++++++++++++++-------------------- test/testfiles/err_compat_1 | 12 +-- 2 files changed, 146 insertions(+), 123 deletions(-) diff --git a/test/err_compat.c b/test/err_compat.c index 53c8667..6f3cfb3 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -39,7 +39,6 @@ int * ipoints2_data = NULL; int * icheck2_data = NULL; #define DSET_NAME "a_dataset" -#define FAKE_ID (hid_t) - 1 herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void *client_data); herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void *client_data); @@ -47,13 +46,13 @@ herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void *client_data); /*------------------------------------------------------------------------- * Function: user_print1 * - * Purpose: This function is a user-defined old-style printing function. + * Purpose: This function is a user-defined old-style printing function. * This is just a convenience function for H5Ewalk1() with a * function that prints error messages. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * *------------------------------------------------------------------------- @@ -66,22 +65,22 @@ user_print1(FILE *stream) if (H5Ewalk1(H5E_WALK_UPWARD, (H5E_walk1_t)custom_print_cb1, stream) < 0) TEST_ERROR; - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /*------------------------------------------------------------------------- * Function: user_print2 * - * Purpose: This function is a user-defined new-style printing function. + * Purpose: This function is a user-defined new-style printing function. * This is just a convenience function for H5Ewalk2() with a * function that prints error messages. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * *------------------------------------------------------------------------- @@ -94,27 +93,23 @@ user_print2(hid_t err_stack, FILE *stream) if (H5Ewalk2(err_stack, H5E_WALK_UPWARD, (H5E_walk2_t)custom_print_cb2, stream) < 0) TEST_ERROR; - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /*------------------------------------------------------------------------- * Function: custom_print_cb1 * - * Purpose: Callback function to print error stack in customized way - * for H5Ewalk1. + * Purpose: Callback function to print error stack in customized way + * for H5Ewalk1 * - * Return: Success: 0 + * Return: SUCCEED/FAIL * - * Failure: -1 - * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -140,7 +135,7 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void *client_data) H5free_memory(maj); H5free_memory(min); - return 0; + return SUCCEED; error: if (maj) @@ -148,24 +143,20 @@ error: if (min) H5free_memory(min); - return -1; + return FAIL; } /*------------------------------------------------------------------------- * Function: custom_print_cb2 * - * Purpose: Callback function to print error stack in customized way - * for H5Ewalk1. - * - * Return: Success: 0 + * Purpose: Callback function to print error stack in customized way + * for H5Ewalk1 * - * Failure: -1 + * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -191,7 +182,7 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void *client_data) H5free_memory(maj); H5free_memory(min); - return 0; + return SUCCEED; error: if (maj) @@ -199,43 +190,42 @@ error: if (min) H5free_memory(min); - return -1; + return FAIL; } /*------------------------------------------------------------------------- - * Function: test_error1 - * - * Purpose: Test the backward compatibility of H5Eset/get_auto. - * - * Return: Success: 0 + * Function: test_error_compat * - * Failure: -1 - * - * Programmer: Raymond Lu - * 17 September 2010 + * Purpose: Test the backward compatibility of H5Eset/get_auto * + * Return: SUCCEED/FAIL * - * Modifications: + * Programmer: Raymond Lu + * 17 September 2010 * *------------------------------------------------------------------------- */ static herr_t -test_error1(void) +test_error_compat(void) { - hid_t dataset, space; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; hsize_t dims[2]; H5E_auto1_t old_func1; H5E_auto2_t old_func2; - void * old_data; + void * old_data = NULL; herr_t ret; TESTING("error API H5Eset/get_auto"); - HDfprintf(stderr, "\n"); - /* Create the data space */ + /* Add a newline and flush so the output file looks nicer */ + HDprintf("\n"); + HDfflush(stdout); + + /* Create the dataspace */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL)) < 0) + if ((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Use H5Eget_auto2 to query the default printing function. The library @@ -253,8 +243,8 @@ test_error1(void) /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (dataset >= 0) + did = H5Dcreate2(H5I_INVALID_HID, DSET_NAME, H5T_STD_I32BE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (did >= 0) TEST_ERROR; /* This call should work. It simply returns H5Eprint1. */ @@ -271,8 +261,8 @@ test_error1(void) /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (dataset >= 0) + did = H5Dcreate2(H5I_INVALID_HID, DSET_NAME, H5T_STD_I32BE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (did >= 0) TEST_ERROR; /* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1. @@ -288,8 +278,8 @@ test_error1(void) /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (dataset >= 0) + did = H5Dcreate2(H5I_INVALID_HID, DSET_NAME, H5T_STD_I32BE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (did >= 0) TEST_ERROR; /* This function changes the new-style printing function back to the default H5Eprint2. */ @@ -320,64 +310,72 @@ test_error1(void) /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (dataset >= 0) + did = H5Dcreate2(H5I_INVALID_HID, DSET_NAME, H5T_STD_I32BE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (did >= 0) TEST_ERROR; - return 0; + if (H5Sclose(sid) < 0) + TEST_ERROR; + + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY + { + H5Dclose(did); + H5Sclose(sid); + } + H5E_END_TRY + + return FAIL; } /*------------------------------------------------------------------------- - * Function: test_error2 - * - * Purpose: Test error API functions, mainly on H5Epush1. + * Function: test_h5epush1 * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Raymond Lu - * July 10, 2003 + * Purpose: Test error API functions, mainly H5Epush1 * + * Return: SUCCEED/FAIL * - * Modifications: + * Programmer: Raymond Lu + * July 10, 2003 * *------------------------------------------------------------------------- */ static herr_t -test_error2(hid_t file) +test_h5epush1(hid_t file) { - hid_t dataset, space; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t estack_id = H5I_INVALID_HID; hsize_t dims[2]; - const char *FUNC_test_error = "test_error2"; + const char *FUNC_test_error = "test_h5epush1"; TESTING("error API based on data I/O"); - HDfprintf(stderr, "\n"); - /* Create the data space */ + /* Add a newline and flush so the output file looks nicer */ + HDprintf("\n"); + HDfflush(stdout); + + /* Create the dataspace */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL)) < 0) + if ((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Test H5E_BEGIN_TRY */ H5E_BEGIN_TRY { - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = + H5Dcreate2(H5I_INVALID_HID, DSET_NAME, H5T_STD_I32BE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; /* Create the dataset */ - if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < - 0) { - H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE, "H5Dcreate2 failed"); - goto error; - } + if ((did = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; - /* Disable the library's default printing function */ + /* Disable the library's default printing function */ #ifdef H5_USE_16_API_DEFAULT if (H5Eset_auto(NULL, NULL) < 0) #else @@ -386,36 +384,48 @@ test_error2(hid_t file) TEST_ERROR; /* Make H5Dwrite fail, verify default print is disabled */ - if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) { - H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_WRITEERROR, - "H5Dwrite shouldn't succeed"); - goto error; - } + if (H5Dwrite(H5I_INVALID_HID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) + H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_WRITEERROR, "expected H5Dwrite error"); + else + TEST_ERROR; + + /* Save the error stack so the close calls don't interfere with it */ + if ((estack_id = H5Eget_current_stack()) < 0) + TEST_ERROR; - /* In case program comes to this point, close dataset */ - if (H5Dclose(dataset) < 0) + /* Close open identifiers */ + if (H5Dclose(did) < 0) + TEST_ERROR; + if (H5Sclose(sid) < 0) + TEST_ERROR; + + /* Restore the stack containing errors */ + if (H5Eset_current_stack(estack_id) < 0) TEST_ERROR; - TEST_ERROR; + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY + { + H5Dclose(did); + H5Sclose(sid); + H5Eclose_stack(estack_id); + } + H5E_END_TRY + + return FAIL; } /*------------------------------------------------------------------------- * Function: dump_error * - * Purpose: Prints error stack in default and customized ways. + * Purpose: Prints error stack in default and customized ways * - * Return: Success: 0 + * Return: SUCCEED/FAIL * - * Failure: -1 - * - * Programmer: Raymond Lu - * July 17, 2003 - * - * - * Modifications: + * Programmer: Raymond Lu + * July 17, 2003 * *------------------------------------------------------------------------- */ @@ -432,35 +442,34 @@ dump_error(void) if (H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb1, stderr) < 0) TEST_ERROR; - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /*------------------------------------------------------------------------- * Function: main * - * Purpose: Test error API. - * - * Programmer: Raymond Lu - * July 10, 2003 + * Purpose: Test error API * - * Modifications: + * Programmer: Raymond Lu + * July 10, 2003 * *------------------------------------------------------------------------- */ int main(void) { - hid_t file, fapl; + hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; char filename[1024]; const char *FUNC_main = "main"; int i; HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to " "be some error messages\n"); - fapl = h5_fileaccess(); + fapl_id = h5_fileaccess(); /* Set up data arrays */ if (NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) @@ -477,14 +486,14 @@ main(void) for (i = 0; i < DIM0; i++) icheck2[i] = icheck2_data + (i * DIM1); - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename)); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* Test error stack */ /* Push an error onto error stack */ - H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE, "Error test failed"); + H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE, "fake error message 1"); /* Print out the errors on stack */ dump_error(); @@ -493,17 +502,24 @@ main(void) H5Eclear1(); /* Test error API */ - if (test_error1() < 0) + if (test_error_compat() < 0) TEST_ERROR; - if (test_error2(file) < 0) { - H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG, "Error test failed"); + /* Test H5Epush1 + * + * On success, there will be errors on the stack to print. + */ + if (test_h5epush1(fid) < 0) { + TEST_ERROR; + } + else { + H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG, "fake error message 2"); H5Eprint1(stderr); } - if (H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) TEST_ERROR; - h5_clean_files(FILENAME, fapl); + h5_clean_files(FILENAME, fapl_id); HDfree(ipoints2); HDfree(ipoints2_data); @@ -511,7 +527,7 @@ main(void) HDfree(icheck2_data); HDprintf("All error API tests passed.\n"); - return 0; + return EXIT_SUCCESS; error: HDfree(ipoints2); @@ -519,7 +535,14 @@ error: HDfree(icheck2); HDfree(icheck2_data); + H5E_BEGIN_TRY + { + H5Fclose(fid); + H5Pclose(fapl_id); + } + H5E_END_TRY + HDprintf("***** ERROR TEST FAILED! *****\n"); - return 1; + return EXIT_FAILURE; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index df43184..e0c4654 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -1,8 +1,10 @@ -Testing error API H5Eset/get_auto Testing error API based on data I/O All error API tests passed. +Testing error API H5Eset/get_auto +Testing error API based on data I/O +All error API tests passed. This program tests the Error API compatible with HDF5 version (number). There are supposed to be some error messages ********* Print error stack in HDF5 default way ********* HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in main(): Error test failed + #000: (file name) line (number) in main(): fake error message 1 major: Error API minor: Bad value @@ -10,7 +12,6 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): error #000: (file name) in main(): line (number) major: Error API minor: Bad value - HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): unable to synchronously create dataset major: Dataset @@ -82,12 +83,11 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #003: (file name) line (number) in H5VL_vol_object(): invalid identifier type to function major: Invalid arguments to routine minor: Inappropriate type - HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in main(): Error test failed + #000: (file name) line (number) in main(): fake error message 2 major: Error API minor: Unrecognized message - #001: (file name) line (number) in test_error2(): H5Dwrite shouldn't succeed + #001: (file name) line (number) in test_h5epush1(): expected H5Dwrite error major: Error API minor: Write failed #002: (file name) line (number) in H5Dwrite(): can't synchronously write data -- cgit v0.12 From ee9d6f514ac163e4739440ab4b0ec70d59a0f7ce Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Wed, 26 May 2021 12:05:24 -0500 Subject: Use internal version of H5Eprint2 to avoid possible stack overflow (#661) --- src/H5E.c | 35 ++++++++++++++++++++++++++++++----- test/err_compat.c | 16 +++++++--------- test/error_test.c | 2 +- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/H5E.c b/src/H5E.c index dabd367..b8e17a4 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -85,6 +85,7 @@ static H5E_t * H5E__get_current_stack(void); static herr_t H5E__set_current_stack(H5E_t *estack); static herr_t H5E__close_stack(H5E_t *err_stack, void **request); static ssize_t H5E__get_num(const H5E_t *err_stack); +static herr_t H5E__print2(hid_t err_stack, FILE *stream); static herr_t H5E__append_stack(H5E_t *dst_estack, const H5E_t *src_stack); /*********************/ @@ -326,10 +327,10 @@ H5E__set_default_auto(H5E_t *stk) #endif /* H5_USE_16_API_DEFAULT */ stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; - stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; + stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5E__print2; stk->auto_op.is_default = TRUE; #else /* H5_NO_DEPRECATED_SYMBOLS */ - stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; + stk->auto_op.func2 = (H5E_auto2_t)H5E__print2; #endif /* H5_NO_DEPRECATED_SYMBOLS */ stk->auto_data = NULL; @@ -1447,13 +1448,37 @@ done: herr_t H5Eprint2(hid_t err_stack, FILE *stream) { - H5E_t *estack; /* Error stack to operate on */ herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) /*NO TRACE*/ + /* Print error stack */ + if ((ret_value = H5E__print2(err_stack, stream)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Eprint2() */ + +/*------------------------------------------------------------------------- + * Function: H5E__print2 + * + * Purpose: Internal helper routine for H5Eprint2. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5E__print2(hid_t err_stack, FILE *stream) +{ + H5E_t *estack; /* Error stack to operate on */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + /* Need to check for errors */ if (err_stack == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in @@ -1473,8 +1498,8 @@ H5Eprint2(hid_t err_stack, FILE *stream) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: - FUNC_LEAVE_API(ret_value) -} /* end H5Eprint2() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__print2() */ /*------------------------------------------------------------------------- * Function: H5Ewalk2 diff --git a/test/err_compat.c b/test/err_compat.c index 6f3cfb3..6ad69d8 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -228,16 +228,14 @@ test_error_compat(void) if ((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; - /* Use H5Eget_auto2 to query the default printing function. The library - *should indicate H5Eprint2 as the default. */ + /* Use H5Eget_auto2 to query the default printing function. */ if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data) < 0) TEST_ERROR; if (old_data != NULL) TEST_ERROR; - if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2) + if (old_func2 == NULL) TEST_ERROR; - /* This function sets the default printing function to be H5Eprint2. */ if (H5Eset_auto2(H5E_DEFAULT, old_func2, old_data) < 0) TEST_ERROR; @@ -282,12 +280,12 @@ test_error_compat(void) if (did >= 0) TEST_ERROR; - /* This function changes the new-style printing function back to the default H5Eprint2. */ - if (H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL) < 0) + /* This function changes the new-style printing function to the original. */ + if (H5Eset_auto2(H5E_DEFAULT, old_func2, NULL) < 0) TEST_ERROR; - /* This call should work because the H5Eset_auto2 above restored the default printing - * function H5Eprint2. It simply returns user_print1. */ + /* This call should work because the H5Eset_auto2 above set the default printing + * function to H5Eprint2. It simply returns user_print1. */ if ((ret = H5Eget_auto1(&old_func1, &old_data)) < 0) TEST_ERROR; if (old_data != NULL) @@ -305,7 +303,7 @@ test_error_compat(void) TEST_ERROR; if (old_data != NULL) TEST_ERROR; - if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2) + if (old_func2 == NULL) TEST_ERROR; /* Try the printing function. Dataset creation should fail because the file diff --git a/test/error_test.c b/test/error_test.c index d1ce00b..cf1e82c 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -129,7 +129,7 @@ test_error(hid_t file) TEST_ERROR; if (old_data != NULL) TEST_ERROR; - if (old_func != (H5E_auto2_t)H5Eprint2) + if (old_func == NULL) TEST_ERROR; if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) -- cgit v0.12 From dedba0f9476418ca3c9e06c626e7e3088179c632 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 27 May 2021 07:33:46 -0700 Subject: Makes the event_set test a single-source target (#690) * Committing clang-format changes * Makes the event_set test a single-source target Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/CMakeLists.txt | 20 +------------------- test/Makefile.am | 1 - 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f0d0d8a..56427f5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -259,10 +259,6 @@ set (ttsafe_SOURCES ${HDF5_TEST_SOURCE_DIR}/ttsafe_attr_vlen.c ) -set (event_set_SOURCES - ${HDF5_TEST_SOURCE_DIR}/event_set.c -) - set (H5_TESTS testhdf5 # multiple source cache @@ -336,7 +332,7 @@ set (H5_TESTS vol timer cmpd_dtransform - event_set # multiple source + event_set ) macro (ADD_H5_EXE file) @@ -368,7 +364,6 @@ set (H5_TESTS_MULTIPLE ttsafe thread_id # special link mirror_vfd - event_set ) # Only build single source tests here foreach (h5_test ${H5_TESTS}) @@ -532,19 +527,6 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TEST_mirror_vfd_FORMAT mirror_vfd) endif () -#-- Adding test for event_set -add_executable (event_set ${event_set_SOURCES}) -target_compile_options(event_set PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (event_set PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (event_set STATIC) - target_link_libraries (event_set PRIVATE ${HDF5_TEST_LIB_TARGET}) -else () - TARGET_C_PROPERTIES (event_set SHARED) - target_link_libraries (event_set PRIVATE ${HDF5_TEST_LIBSH_TARGET}) -endif () -set_target_properties (event_set PROPERTIES FOLDER test) - #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- diff --git a/test/Makefile.am b/test/Makefile.am index 5d07428..4bf9620 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -150,7 +150,6 @@ ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c ttsafe_attr_vlen.c cache_image_SOURCES=cache_image.c genall5.c mirror_vfd_SOURCES=mirror_vfd.c genall5.c -event_set_SOURCES=event_set.c # Additional target for running timing test timings _timings: testmeta -- cgit v0.12 From 168be9a0f0745261d28d60acea9e9fa6cfa93861 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 27 May 2021 07:35:15 -0700 Subject: CMake fix for sporadic flush2 failures (#692) * Committing clang-format changes * Runs the flush1/flush2 tests in their own directory Avoids file deletions by other tests. * Revert "Runs the flush1/flush2 tests in their own directory" This reverts commit 746c04882434cb502e4231de8f7dd5acb4949f54. Also pulls the flush files from the clean list, which is a simpler fix. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/CMakeTests.cmake | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 9fb49f6..17931cf 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -318,14 +318,6 @@ set (test_CLEANFILES tvlstr.h5 tvlstr2.h5 twriteorder.dat - flush.h5 - flush-swmr.h5 - noflush.h5 - noflush-swmr.h5 - flush_extend.h5 - flush_extend-swmr.h5 - noflush_extend.h5 - noflush_extend-swmr.h5 enum1.h5 titerate.h5 ttsafe.h5 -- cgit v0.12 From dfe4575914e7998e266b3a56c3acee321662ab20 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 27 May 2021 19:24:30 -0700 Subject: Require a C++11 compiler to build the C++ wrappers (#693) * Committing clang-format changes * Requires a C++11 compiler to build the C++ wrappers Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- config/clang-cxxflags | 14 +------------- config/cmake/HDFCXXCompilerFlags.cmake | 2 +- config/gnu-cxxflags | 2 +- release_docs/RELEASE.txt | 8 ++++++++ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/config/clang-cxxflags b/config/clang-cxxflags index e7ab6d8..c585ce7 100644 --- a/config/clang-cxxflags +++ b/config/clang-cxxflags @@ -113,19 +113,7 @@ if test "X-clang" = "X-$cxx_vendor" -o "X-Apple LLVM" = "X-$cxx_vendor"; then ;; esac - case "$host_os-$host_cpu" in - # cygwin needs the "-std=c99" flag removed, so make - # a specific case for Cygwin without the flag and a default - # case to add the flag everywhere else - cygwin-*) - ;; - - *) - H5_CXXFLAGS="$H5_CXXFLAGS -std=c++11" - ;; - esac - - H5_CXXFLAGS="$H5_CXXFLAGS $arch" + H5_CXXFLAGS="$H5_CXXFLAGS $arch -std=c++11" ############## # Production # diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index 757692c..e2904ca 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -9,7 +9,7 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index cba8298..0a7c63e 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -119,7 +119,7 @@ if test "X-g++" = "X-$cxx_vendor"; then esac # C++-specific - H5_CXXFLAGS="$H5_CXXFLAGS $arch" + H5_CXXFLAGS="$H5_CXXFLAGS $arch -std=c++11" ############## # Production # diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 578c4b4..20d561c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,14 @@ New Features Configuration: ------------- + - A C++11-compliant compiler is now required to build the C++ wrappers + + CMAKE_CXX_STANDARD is now set to 11 when building with CMake and + -std=c++11 is added when building with clang/gcc via the Autotools. + + (DER - 2021/05/27) + + - CMake will now run the shell script tests in test/ by default The test directory includes several shell script tests that previously -- cgit v0.12 From 4454fca02a57663ea0dbcca01016788bd11703b9 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 28 May 2021 07:36:46 -0500 Subject: Fix H5FD_mpio_Debug="rw" can report MPI_count instead of bytes (#699) * fixed missed closing of a dataset * fixed missed closing of a dataset * fixed typo in error return * Committing clang-format changes * minor edits * code format * Committing clang-format changes * code format * minor edit * switched from using MPI_count, to actual bytes written for H5FD_mpio_debug rw debugging * Committing clang-format changes * changed size_i in printf to reflect the I/O. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5FDmpio.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 08bd52a..7567376 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1195,12 +1195,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if ((hsize_t)size_i != size) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i") -#ifdef H5FDmpio_DEBUG - if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off, - size_i); -#endif - /* Only look for MPI views for raw data transfers */ if (type == H5FD_MEM_DRAW) { H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ @@ -1349,6 +1343,12 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (bytes_read < 0 || bytes_read > io_size) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", FUNC, file->mpi_rank, (long)mpi_off, + bytes_read); +#endif + /* * This gives us zeroes beyond end of physical MPI file. */ @@ -1436,12 +1436,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") size_i = (int)size; -#ifdef H5FDmpio_DEBUG - if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off, - size_i); -#endif - /* Get the transfer mode from the API context */ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") @@ -1566,6 +1560,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (bytes_written != io_size || bytes_written < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", FUNC, file->mpi_rank, + (long)mpi_off, bytes_written); +#endif + /* Each process will keep track of its perceived EOF value locally, and * ultimately we will reduce this value to the maximum amongst all * processes, but until then keep the actual eof at HADDR_UNDEF just in -- cgit v0.12 From e60ac6ec2d82fc1bcffcfecd353ff074f9011275 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 28 May 2021 05:48:29 -0700 Subject: Removes pre-C99 build and header cruft (#700) * Committing clang-format changes * Removes pre-C99 build and header cruft * Assumes ANSI C headers exist * Assumes stdbool.h, stdint.h, and inttypes.h are present * Assumes the C++ compiler can handle stdint.h * Removes all work-arounds for missing functionality, especially stdbool.h * Formats source Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- config/cmake/H5pubconf.h.in | 15 --------------- config/cmake_ext_mod/ConfigureChecks.cmake | 20 +++---------------- config/cmake_ext_mod/HDFTests.c | 8 -------- config/cmake_ext_mod/HDFUseCXX.cmake | 11 ----------- configure.ac | 10 +--------- src/H5private.h | 12 ------------ src/H5public.h | 31 ++++++------------------------ test/cache.c | 13 ------------- test/cache_common.c | 12 ------------ tools/test/perform/chunk.c | 2 -- tools/test/perform/direct_write_perf.c | 5 +---- tools/test/perform/overhead.c | 2 -- tools/test/perform/perf.c | 2 -- tools/test/perform/pio_engine.c | 2 -- tools/test/perform/pio_standalone.h | 5 ----- tools/test/perform/sio_engine.c | 2 -- tools/test/perform/sio_standalone.h | 5 ----- 17 files changed, 11 insertions(+), 146 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index c57d85a..0176c7a 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -198,9 +198,6 @@ optimization operation */ #cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_INTTYPES_H @H5_HAVE_INTTYPES_H@ - /* Define to 1 if you have the `ioctl' function. */ #cmakedefine H5_HAVE_IOCTL @H5_HAVE_IOCTL@ @@ -343,18 +340,9 @@ /* Define if `struct stat' has the `st_blocks' field */ #cmakedefine H5_HAVE_STAT_ST_BLOCKS @H5_HAVE_STAT_ST_BLOCKS@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_STDBOOL_H @H5_HAVE_STDBOOL_H@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_STDDEF_H @H5_HAVE_STDDEF_H@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_STDINT_H @H5_HAVE_STDINT_H@ - -/* Define to 1 if you have the header file for Cplusplus. */ -#cmakedefine H5_HAVE_STDINT_H_CXX @H5_HAVE_STDINT_H_CXX@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_STDLIB_H @H5_HAVE_STDLIB_H@ @@ -698,9 +686,6 @@ /* The size of `__int64', as computed by sizeof. */ #define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ -/* Define to 1 if you have the ANSI C header files. */ -#cmakedefine H5_STDC_HEADERS @H5_STDC_HEADERS@ - /* Define if strict file format checks are enabled */ #cmakedefine H5_STRICT_FORMAT_CHECKS @H5_STRICT_FORMAT_CHECKS@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 38b5ab3..12510eb 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -120,7 +120,6 @@ CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H) CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) -CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) # Windows @@ -146,12 +145,9 @@ CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H) CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H) CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H) CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H) -CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H) CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H) CHECK_INCLUDE_FILE_CONCAT ("netdb.h" ${HDF_PREFIX}_HAVE_NETDB_H) CHECK_INCLUDE_FILE_CONCAT ("arpa/inet.h" ${HDF_PREFIX}_HAVE_ARPA_INET_H) -# _Bool type support -CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) ## Check for non-standard extenstion quadmath.h @@ -238,11 +234,6 @@ macro (HDF_FUNCTION_TEST OTHER_TEST) endmacro () #----------------------------------------------------------------------------- -# Check for these functions before the time headers are checked -#----------------------------------------------------------------------------- -HDF_FUNCTION_TEST (STDC_HEADERS) - -#----------------------------------------------------------------------------- # Check for large file support #----------------------------------------------------------------------------- @@ -416,13 +407,9 @@ HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T) # Extra C99 types #----------------------------------------------------------------------------- -# _Bool type support -if (HAVE_STDBOOL_H) - set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h) - HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL) -else () - HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) -endif () +# Size of bool +set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h) +HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) if (MINGW OR NOT WINDOWS) #----------------------------------------------------------------------------- @@ -554,7 +541,6 @@ if (MINGW OR NOT WINDOWS) foreach (other_test HAVE_ATTRIBUTE HAVE_C99_FUNC -# STDC_HEADERS HAVE_FUNCTION HAVE_C99_DESIGNATED_INITIALIZER SYSTEM_SCOPE_THREADS diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 2d7e1b4..0c3b7b7 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -88,14 +88,6 @@ int main(void) } #endif -#ifdef STDC_HEADERS -#include -#include -#include -#include -int main() { return 0; } -#endif /* STDC_HEADERS */ - #ifdef HAVE_ATTRIBUTE diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake index 580c409..423f74a 100644 --- a/config/cmake_ext_mod/HDFUseCXX.cmake +++ b/config/cmake_ext_mod/HDFUseCXX.cmake @@ -32,17 +32,6 @@ endif () include (CheckIncludeFileCXX) include (TestForSTDNamespace) -# IF the c compiler found stdint, check the C++ as well. On some systems this -# file will be found by C but not C++, only do this test IF the C++ compiler -# has been initialized (e.g. the project also includes some c++) -if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) - CHECK_INCLUDE_FILE_CXX ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H_CXX) - if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) - set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") - set (USE_INCLUDES ${USE_INCLUDES} "stdint.h") - endif () -endif () - # For other CXX specific tests, use this MACRO. macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) if (NOT DEFINED ${OTHER_TEST}) diff --git a/configure.ac b/configure.ac index 2df2b90..921e8c6 100644 --- a/configure.ac +++ b/configure.ac @@ -1251,8 +1251,6 @@ AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h]) AC_CHECK_HEADERS([sys/socket.h sys/types.h sys/file.h]) AC_CHECK_HEADERS([stddef.h setjmp.h features.h]) AC_CHECK_HEADERS([dirent.h]) -AC_CHECK_HEADERS([stdint.h], [C9x=yes]) -AC_CHECK_HEADERS([stdbool.h]) AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h]) ## Darwin @@ -1417,11 +1415,7 @@ AC_CHECK_SIZEOF([off_t]) if test "X$C9x" = "Xyes"; then cat >>confdefs.h <<\EOF -#ifdef HAVE_STDBOOL_H -#include /* for bool definition */ -#else -#define bool _Bool -#endif +#include EOF AC_CHECK_SIZEOF([bool]) fi @@ -1938,10 +1932,8 @@ if test "X$THREADSAFE" = "Xyes"; then AC_CACHE_VAL([hdf5_cv_system_scope_threads], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([ - #if STDC_HEADERS #include #include - #endif ],[ pthread_attr_t attribute; int ret; diff --git a/src/H5private.h b/src/H5private.h index a0b4e8e..7888772 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -41,10 +41,6 @@ #endif /* H5_HAVE_WIN32_API */ #endif /* H5_HAVE_THREADSAFE */ -/* - * Include ANSI-C header files. - */ -#ifdef H5_STDC_HEADERS #include #include #include @@ -56,7 +52,6 @@ #include #include #include -#endif /* * If _POSIX_VERSION is defined in unistd.h then this system is Posix.1 @@ -71,14 +66,7 @@ #include #endif -/* - * C9x integer types - */ -#ifndef __cplusplus -#ifdef H5_HAVE_STDINT_H #include -#endif -#endif /* * The `struct stat' data type for stat() and fstat(). This is a Posix file diff --git a/src/H5public.h b/src/H5public.h index ada15a7..33f8b37 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -34,28 +34,21 @@ #ifdef H5_HAVE_FEATURES_H #include /* For setting POSIX, BSD, etc. compatibility */ #endif + #ifdef H5_HAVE_SYS_TYPES_H #include #endif -#ifdef H5_STDC_HEADERS + #include /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */ #include /* For variadic functions in H5VLpublic.h */ -#endif -#ifndef __cplusplus -#ifdef H5_HAVE_STDINT_H -#include /* For C9x types */ -#endif -#else -#ifdef H5_HAVE_STDINT_H_CXX -#include /* For C9x types (when included from C++) */ -#endif -#endif -#ifdef H5_HAVE_INTTYPES_H + +#include /* For C9x types */ #include /* C99/POSIX.1 header for uint64_t, PRIu64 */ -#endif + #ifdef H5_HAVE_STDDEF_H #include #endif + #ifdef H5_HAVE_PARALLEL /* Don't link against MPI C++ bindings */ #define MPICH_SKIP_MPICXX 1 @@ -220,19 +213,7 @@ typedef int herr_t; * } * \endcode */ -#ifdef H5_HAVE_STDBOOL_H #include -#else /* H5_HAVE_STDBOOL_H */ -#ifndef __cplusplus -#if defined(H5_SIZEOF_BOOL) && (H5_SIZEOF_BOOL != 0) -#define bool _Bool -#else -#define bool unsigned int -#endif -#define true 1 -#define false 0 -#endif /* __cplusplus */ -#endif /* H5_HAVE_STDBOOL_H */ typedef bool hbool_t; typedef int htri_t; diff --git a/test/cache.c b/test/cache.c index 0081830..78e902c 100644 --- a/test/cache.c +++ b/test/cache.c @@ -8068,19 +8068,6 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu if ((check[i].entry_num != i) || (check[i].entry_type < 0) || (check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (check[i].entry_index < 0) || (check[i].entry_index > max_indices[check[i].entry_type]) || -#ifndef H5_HAVE_STDBOOL_H - /* Check for nonsense values if hbool_t is an integral - * type instead of a real Boolean. - */ - ((check[i].in_cache != TRUE) && (check[i].in_cache != FALSE)) || - ((check[i].at_main_addr != TRUE) && (check[i].at_main_addr != FALSE)) || - ((check[i].is_dirty != TRUE) && (check[i].is_dirty != FALSE)) || - ((check[i].is_protected != TRUE) && (check[i].is_protected != FALSE)) || - ((check[i].is_pinned != TRUE) && (check[i].is_pinned != FALSE)) || - ((check[i].expected_deserialized != TRUE) && (check[i].expected_deserialized != FALSE)) || - ((check[i].expected_serialized != TRUE) && (check[i].expected_serialized != FALSE)) || - ((check[i].expected_destroyed != TRUE) && (check[i].expected_destroyed != FALSE)) || -#endif /* H5_HAVE_STDBOOL_H */ (check[i].expected_size <= (size_t)0)) { pass = FALSE; diff --git a/test/cache_common.c b/test/cache_common.c index 7269c49..e86724f 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1487,12 +1487,6 @@ add_flush_op(int target_type, int target_idx, int op_code, int type, int idx, hb HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES)); HDassert((0 <= idx) && (idx <= max_indices[type])); HDassert(new_size <= VARIABLE_ENTRY_SIZE); -#ifndef H5_HAVE_STDBOOL_H - /* Check for TRUE or FALSE if we're using an integer type instead - * of a real Boolean type. - */ - HDassert((flag == TRUE) || (flag == FALSE)); -#endif /* H5_HAVE_STDBOOL_H */ if (pass) { @@ -1692,12 +1686,6 @@ execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_o HDassert((0 <= op_ptr->type) && (op_ptr->type < NUMBER_OF_ENTRY_TYPES)); HDassert((0 <= op_ptr->idx) && (op_ptr->idx <= max_indices[op_ptr->type])); HDassert(flags_ptr != NULL); -#ifndef H5_HAVE_STDBOOL_H - /* Check for TRUE or FALSE if we're using an integer type instead - * of a real Boolean type. - */ - HDassert((op_ptr->flag == FALSE) || (op_ptr->flag == TRUE)); -#endif /* H5_HAVE_STDBOOL_H */ if (pass) { diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 1b6793a..1b08e95 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -24,12 +24,10 @@ #undef NDEBUG #include "hdf5.h" -#ifdef H5_STDC_HEADERS #include #include #include #include -#endif /* Solaris Studio defines attribute, but for the attributes we need */ #if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C) diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c index b3ae54d..6537215 100644 --- a/tools/test/perform/direct_write_perf.c +++ b/tools/test/perform/direct_write_perf.c @@ -23,14 +23,11 @@ #if !defined(WIN32) && !defined(__MINGW32__) -#include - -#ifdef H5_STDC_HEADERS #include #include +#include #include #include -#endif #ifdef H5_HAVE_UNISTD_H #include diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c index dba8220..345c5c8 100644 --- a/tools/test/perform/overhead.c +++ b/tools/test/perform/overhead.c @@ -23,13 +23,11 @@ #include "hdf5.h" #include "H5private.h" -#ifdef H5_STDC_HEADERS #include #include #include #include #include -#endif #ifdef H5_HAVE_IO_H #include diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index bf4b2a9..a06fb77 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -26,13 +26,11 @@ #ifdef H5_HAVE_PARALLEL -#ifdef H5_STDC_HEADERS #include #include #include #include #include -#endif #ifdef H5_HAVE_UNISTD_H #include diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 65194b0..cac36d7 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -16,12 +16,10 @@ #include "hdf5.h" -#ifdef H5_STDC_HEADERS #include #include #include #include -#endif #ifdef H5_HAVE_UNISTD_H #include diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 35a5217..82fabdc 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -21,10 +21,6 @@ #include "H5public.h" /* Include Public Definitions */ -/* - * Include ANSI-C header files. - */ -#ifdef H5_STDC_HEADERS #include #include #include @@ -37,7 +33,6 @@ #include #include #include -#endif /* * Redefine all the POSIX functions. We should never see a POSIX diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index e5a0ec8..f67a7a6 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -16,12 +16,10 @@ #include "hdf5.h" -#ifdef H5_STDC_HEADERS #include #include #include #include -#endif #ifdef H5_HAVE_UNISTD_H #include diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index d8b6412..54e82fa 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -21,10 +21,6 @@ #include "H5public.h" /* Include Public Definitions */ -/* - * Include ANSI-C header files. - */ -#ifdef H5_STDC_HEADERS #include #include #include @@ -37,7 +33,6 @@ #include #include #include -#endif /* maximum of two, three, or four values */ #undef MAX -- cgit v0.12 From 0262a49f9c6b687b38a2527ef75763d8f8e68a1c Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 28 May 2021 21:56:29 -0500 Subject: Java and fortran cmake changes (#694) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- .github/workflows/pr-check.yml | 2 +- fortran/src/CMakeLists.txt | 10 +-- fortran/test/CMakeLists.txt | 4 +- hl/fortran/src/CMakeLists.txt | 4 +- java/src/hdf/hdf5lib/H5.java | 39 +++++++++++- java/src/jni/h5rImp.c | 6 +- java/src/jni/h5rImp.h | 6 +- java/test/TestH5Rref.java | 136 +++++++++++++++++++++-------------------- 9 files changed, 122 insertions(+), 87 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 78e1115..ae429a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: os: ubuntu-latest build_type: "Release" cpp: ON - fortran: OFF + fortran: ON java: ON ts: OFF hl: ON diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index b50bf59..0acaf2d 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -31,7 +31,7 @@ jobs: os: ubuntu-latest build_type: "Release" cpp: ON - fortran: OFF + fortran: ON java: ON ts: OFF hl: ON diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index d849086..e59a829 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -74,7 +74,7 @@ add_executable (H5match_types target_include_directories (H5match_types PRIVATE "${HDF5_SRC_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") add_custom_command (TARGET H5match_types POST_BUILD - BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 + BYPRODUCTS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} DEPENDS H5match_types @@ -82,7 +82,7 @@ add_custom_command (TARGET H5match_types POST_BUILD if (NOT ONLY_SHARED_LIBS) add_custom_command (TARGET H5match_types POST_BUILD - BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 + BYPRODUCTS ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h COMMAND ${CMAKE_COMMAND} @@ -95,7 +95,7 @@ if (NOT ONLY_SHARED_LIBS) endif () if (BUILD_SHARED_LIBS) add_custom_command (TARGET H5match_types POST_BUILD - BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 + BYPRODUCTS ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h COMMAND ${CMAKE_COMMAND} @@ -235,7 +235,7 @@ add_custom_command (TARGET H5_buildiface POST_BUILD ) if (NOT ONLY_SHARED_LIBS) add_custom_command (TARGET H5_buildiface POST_BUILD - BYPRODUCTS H5_gen.F90 + BYPRODUCTS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static @@ -250,7 +250,7 @@ endif () if (BUILD_SHARED_LIBS) add_custom_command (TARGET H5_buildiface POST_BUILD - BYPRODUCTS H5_gen.F90 + BYPRODUCTS ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 147746c..1e879e7 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -92,7 +92,7 @@ endif () if (NOT BUILD_SHARED_LIBS) add_custom_command (TARGET H5_test_buildiface POST_BUILD - BYPRODUCTS tf_gen.F90 + BYPRODUCTS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static DEPENDS H5_test_buildiface @@ -104,7 +104,7 @@ if (NOT BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) else () add_custom_command (TARGET H5_test_buildiface POST_BUILD - BYPRODUCTS tf_gen.F90 + BYPRODUCTS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared DEPENDS H5_test_buildiface diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 6c97886..973299f 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -115,7 +115,7 @@ set (HDF5_HL_F90_F_BASE_SOURCES if (NOT ONLY_SHARED_LIBS) add_custom_command (TARGET H5HL_buildiface POST_BUILD - BYPRODUCTS $H5LTff_gen.F90 H5TBff_gen.F90 + BYPRODUCTS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} @@ -132,7 +132,7 @@ if (NOT ONLY_SHARED_LIBS) endif () if (BUILD_SHARED_LIBS) add_custom_command (TARGET H5HL_buildiface POST_BUILD - BYPRODUCTS H5LTff_gen.F90 H5TBff_gen.F90 + BYPRODUCTS ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/shared DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index aef0ba1..63547df 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -10726,7 +10726,18 @@ public class H5 implements java.io.Serializable { * @exception IllegalArgumentException * - an input array is invalid. **/ - public synchronized static native long H5Ropen_object(byte[] ref_ptr, long rapl_id, long oapl_id) + public static long H5Ropen_object(byte[] ref_ptr, long rapl_id, long oapl_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + long id = _H5Ropen_object(ref_ptr, rapl_id, oapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Ropen_object add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Ropen_object(byte[] ref_ptr, long rapl_id, long oapl_id) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** @@ -10754,7 +10765,18 @@ public class H5 implements java.io.Serializable { * @exception IllegalArgumentException * - an input array is invalid. **/ - public synchronized static native long H5Ropen_region(byte[] ref_ptr, long rapl_id, long oapl_id) + public static long H5Ropen_region(byte[] ref_ptr, long rapl_id, long oapl_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + long id = _H5Ropen_region(ref_ptr, rapl_id, oapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Ropen_region add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Ropen_region(byte[] ref_ptr, long rapl_id, long oapl_id) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** @@ -10782,7 +10804,18 @@ public class H5 implements java.io.Serializable { * @exception IllegalArgumentException * - an input array is invalid. **/ - public synchronized static native long H5Ropen_attr(byte[] ref_ptr, long rapl_id, long aapl_id) + public static long H5Ropen_attr(byte[] ref_ptr, long rapl_id, long aapl_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + long id = _H5Ropen_attr(ref_ptr, rapl_id, aapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Ropen_attr add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Ropen_attr(byte[] ref_ptr, long rapl_id, long aapl_id) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; // Get type // diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index c08f5de..9fe0701 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -336,7 +336,7 @@ done: * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Ropen_1object(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id) +Java_hdf_hdf5lib_H5__1H5Ropen_1object(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id) { jboolean isCopy; jbyte * refBuf = NULL; @@ -371,7 +371,7 @@ done: * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Ropen_1region(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id) +Java_hdf_hdf5lib_H5__1H5Ropen_1region(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id) { jboolean isCopy; jbyte * refBuf = NULL; @@ -406,7 +406,7 @@ done: * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Ropen_1attr(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong aapl_id) +Java_hdf_hdf5lib_H5__1H5Ropen_1attr(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong aapl_id) { jboolean isCopy; jbyte * refBuf = NULL; diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h index cdfdd8e..ffd7737 100644 --- a/java/src/jni/h5rImp.h +++ b/java/src/jni/h5rImp.h @@ -78,21 +78,21 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Rcopy(JNIEnv *, jclass, jbyte * Method: H5Ropen_object * Signature: ([BJJ)J */ -JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ropen_1object(JNIEnv *, jclass, jbyteArray, jlong, jlong); +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Ropen_1object(JNIEnv *, jclass, jbyteArray, jlong, jlong); /* * Class: hdf_hdf5lib_H5 * Method: H5Ropen_region * Signature: ([BJJ)J */ -JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ropen_1region(JNIEnv *, jclass, jbyteArray, jlong, jlong); +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Ropen_1region(JNIEnv *, jclass, jbyteArray, jlong, jlong); /* * Class: hdf_hdf5lib_H5 * Method: H5Ropen_attr * Signature: ([BJJ)J */ -JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ropen_1attr(JNIEnv *, jclass, jbyteArray, jlong, jlong); +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Ropen_1attr(JNIEnv *, jclass, jbyteArray, jlong, jlong); /* * Class: hdf_hdf5lib_H5 diff --git a/java/test/TestH5Rref.java b/java/test/TestH5Rref.java index cbdabdd..5733aae 100644 --- a/java/test/TestH5Rref.java +++ b/java/test/TestH5Rref.java @@ -134,7 +134,7 @@ public class TestH5Rref { try {H5.H5Tclose(f_type);} catch (Exception ex) {} } try { - ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); } catch (Throwable err) { err.printStackTrace(); @@ -209,7 +209,7 @@ public class TestH5Rref { try {H5.H5Tclose(f_type);} catch (Exception ex) {} } try { - ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); } catch (Throwable err) { err.printStackTrace(); @@ -286,7 +286,7 @@ public class TestH5Rref { try {H5.H5Tclose(f_type);} catch (Exception ex) {} } try { - ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); } catch (Throwable err) { err.printStackTrace(); @@ -305,80 +305,81 @@ public class TestH5Rref { } for (int i = 0; i < ndims; i++) { try { - ret_val = H5.H5Rget_type(refbuf[i]); + try { + ret_val = H5.H5Rget_type(refbuf[i]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: H5Rget_type["+i+"]: " + err); + } assertTrue("testH5Rget_region_dataset: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); try { loc_id = H5.H5Ropen_object(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue(loc_id >= 0); - boolean regionzero = byteArrayCheck(refbuf[i]); - if (i > 1) - assertTrue(regionzero); - else { + try { + loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_sid >= 0); + int region_type = -1; try { - loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - assertTrue(loc_sid >= 0); - int region_type = -1; - try { - int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid); - region_type = H5.H5Sget_select_type(loc_sid); - if (i == 1) - assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS); - else - assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS); - if (region_type == HDF5Constants.H5S_SEL_POINTS) { - long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid); - // Coordinates for get point selection - long getcoord[] = new long[reg_ndims * (int)reg_npoints]; - // Known coordinates for point selection - long coord[][] = {{6,9},{2,2},{8,4},{1,6},{2,8},{3,2}, - {0,4},{9,0},{7,1},{3,3}}; - try { - H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]); - } - catch (Throwable err3) { - err3.printStackTrace(); - fail("H5.H5Sget_select_elem_pointlist: " + err3); - } + int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid); + region_type = H5.H5Sget_select_type(loc_sid); + if (i == 1) + assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS); + else + assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS); + if (region_type == HDF5Constants.H5S_SEL_POINTS) { + long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid); + // Coordinates for get point selection + long getcoord[] = new long[reg_ndims * (int)reg_npoints]; + // Known coordinates for point selection + long coord[][] = {{6,9},{2,2},{8,4},{1,6},{2,8},{3,2}, + {0,4},{9,0},{7,1},{3,3}}; + try { + H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]); } - else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) { - long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid); - assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1); - // Coordinates for get block selection - long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2]; - long start[] = {2,2}; - long block[] = {8,8}; - try { - H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks); - assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]); - assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]); - assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == getblocks[2]); - assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == getblocks[3]); - } - catch (Throwable err3) { - err3.printStackTrace(); - fail("H5.H5Sget_select_hyper_blocklist: " + err3); - } + catch (Throwable err3) { + err3.printStackTrace(); + fail("H5.H5Sget_select_elem_pointlist: " + err3); } } - catch (Throwable err2) { - err2.printStackTrace(); - fail("testH5Rget_region_dataset: H5Sget_select_type: " + err2); + else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) { + long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid); + assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1); + // Coordinates for get block selection + long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2]; + long start[] = {2,2}; + long block[] = {8,8}; + try { + H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == getblocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == getblocks[3]); + } + catch (Throwable err3) { + err3.printStackTrace(); + fail("H5.H5Sget_select_hyper_blocklist: " + err3); + } } } - catch (Throwable err1) { - err1.printStackTrace(); - fail("testH5Rget_region_dataset: " + err1); - } - finally { - try {H5.H5Sclose(loc_sid);} catch (Exception ex) {} + catch (Throwable err2) { + err2.printStackTrace(); + assertTrue("testH5Rget_region_dataset: H5Sget_select_type: " + err2, i > 1); } } + catch (Throwable err1) { + err1.printStackTrace(); + fail("testH5Rget_region_dataset: " + err1); + } + finally { + try {H5.H5Sclose(loc_sid);} catch (Exception ex) {} + } } catch (Throwable err0) { err0.printStackTrace(); @@ -432,7 +433,7 @@ public class TestH5Rref { try {H5.H5Tclose(f_type);} catch (Exception ex) {} } try { - ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); } catch (Throwable err) { err.printStackTrace(); @@ -473,7 +474,8 @@ public class TestH5Rref { } catch (Throwable err0) { err0.printStackTrace(); - fail("testH5Rget_region_attribute: " + err0); + // second attribute is null + assertTrue("testH5Rget_region_attribute: " + err0, i == 1); } finally { try {H5.H5Aclose(loc_id);} catch (Exception ex) {} -- cgit v0.12 From 552ce4952b48c6c16d51023d0e30daa823706dc3 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 28 May 2021 19:58:13 -0700 Subject: Removes alternative function enter/leave macro scheme (#678) * Committing clang-format changes * Converted BEGIN_FUNC, etc. macros to FUNC_ENTER * Rips out the BEGIN_FUNC, etc. macros * Removes 'end if', etc. comments from H5HL package * Committing clang-format changes * Fixes an H5EA iterate issue * Fixes an issue in the H5FA iterator code * Further cleanup in bin/trace after macro removal * Iterator changes in H5EA and H5FA Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- bin/trace | 31 +- src/H5.c | 4 - src/H5EA.c | 410 ++++++++++++++------------- src/H5EAcache.c | 699 ++++++++++++++++++++++++++-------------------- src/H5EAdbg.c | 145 +++++----- src/H5EAdblkpage.c | 126 +++++---- src/H5EAdblock.c | 177 +++++++----- src/H5EAhdr.c | 317 +++++++++++++-------- src/H5EAiblock.c | 169 ++++++----- src/H5EAint.c | 32 ++- src/H5EAsblock.c | 164 ++++++----- src/H5EAstat.c | 14 +- src/H5EAtest.c | 183 +++++++----- src/H5Eprivate.h | 47 ---- src/H5FA.c | 337 +++++++++++----------- src/H5FAcache.c | 398 +++++++++++++++----------- src/H5FAdbg.c | 79 +++--- src/H5FAdblkpage.c | 121 ++++---- src/H5FAdblock.c | 155 +++++----- src/H5FAhdr.c | 263 ++++++++++------- src/H5FAint.c | 32 ++- src/H5FAstat.c | 14 +- src/H5FAtest.c | 129 +++++---- src/H5HL.c | 392 ++++++++++++++------------ src/H5HLcache.c | 24 +- src/H5HLdbg.c | 28 +- src/H5HLdblk.c | 82 +++--- src/H5HLint.c | 60 ++-- src/H5HLpkg.h | 2 +- src/H5HLprfx.c | 33 ++- src/H5HLprivate.h | 2 +- src/H5private.h | 242 +--------------- tools/lib/h5tools_error.h | 26 +- 33 files changed, 2674 insertions(+), 2263 deletions(-) diff --git a/bin/trace b/bin/trace index a2052ce..0eef8ce 100755 --- a/bin/trace +++ b/bin/trace @@ -283,8 +283,8 @@ my $file_api = 0; my $file_args = 0; my $total_api = 0; my $total_args = 0; -sub rewrite_func ($$$$$$$$) { - my ($file, $begin, $type, $aftertype, $name, $args, $close, $body) = @_; +sub rewrite_func ($$$$$) { + my ($file, $type, $name, $args, $body) = @_; my ($arg, $trace, $argtrace); my (@arg_name, @arg_str, @arg_type); local $_; @@ -459,7 +459,7 @@ sub rewrite_func ($$$$$$$$) { } error: - return "\n$begin$type$aftertype$name($orig_args)$close$body"; + return "\n$type\n$name($orig_args)\n$body"; } ############################################################################## @@ -481,25 +481,12 @@ for $file (@ARGV) { # Make a copy of the original data my $original = $Source; - # Check which style of function declaration is used in this file - if ( $Source =~ /BEGIN_FUNC/ ) { - # Make modifications - $Source =~ s/\n(BEGIN_FUNC.*?\n) #begin - ([A-Za-z]\w*(\s+[A-Za-z]\w*)*\s*\**) #type - (.*?\n) #aftertype - (H5[A-Z]{0,2}_?[a-zA-Z0-9_]\w*) #name - \s*\((.*?)\)\s* #args - (\)) #close - (\n.*?\nEND_FUNC\([^\n]*) #body - /rewrite_func($file,$1,$2,$4,$5,$6,$7,$8)/segx; - } else { - # Make modifications - $Source =~ s/\n([A-Za-z]\w*(\s+[A-Za-z]\w*)*\s*\**)\n #type - (H5[A-Z]{0,2}_?[a-zA-Z0-9_]\w*) #name - \s*\((.*?)\)\s* #args - (\{.*?\n\}[^\n]*) #body - /rewrite_func($file,"",$1,"\n",$3,$4,"\n",$5)/segx; - } + # Make modifications + $Source =~ s/\n([A-Za-z]\w*(\s+[A-Za-z]\w*)*\s*\**)\n #type + (H5[A-Z]{0,2}_?[a-zA-Z0-9_]\w*) #name + \s*\((.*?)\)\s* #args + (\{.*?\n\}[^\n]*) #body + /rewrite_func($file,$1,$3,$4,$5)/segx; # If the source changed then print out the new version if ($original ne $Source) { diff --git a/src/H5.c b/src/H5.c index 14a65db..ce4a001 100644 --- a/src/H5.c +++ b/src/H5.c @@ -70,10 +70,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Library Private Variables */ /*****************************/ -/* HDF5 API Entered variable */ -/* (move to H5.c when new FUNC_ENTER macros in actual use -QAK) */ -hbool_t H5_api_entered_g = FALSE; - /* statically initialize block for pthread_once call used in initializing */ /* the first global mutex */ #ifdef H5_HAVE_THREADSAFE diff --git a/src/H5EA.c b/src/H5EA.c index 4d6b7c1..8f9a4b6 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -116,39 +116,40 @@ H5FL_BLK_DEFINE(ea_native_elmt); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, H5EA_t *, NULL, NULL, - H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata)) +static H5EA_t * +H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata) +{ + H5EA_t * ea = NULL; /* Pointer to new extensible array */ + H5EA_hdr_t *hdr = NULL; /* The extensible array header information */ + H5EA_t * ret_value = NULL; - /* Local variables */ - H5EA_t * ea = NULL; /* Pointer to new extensible array */ - H5EA_hdr_t *hdr = NULL; /* The extensible array header information */ + FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(ea_addr)); /* Allocate extensible array wrapper */ if (NULL == (ea = H5FL_CALLOC(H5EA_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for extensible array info") /* Lock the array header into memory */ if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to load extensible array header") /* Check for pending array deletion */ if (from_open && hdr->pending_delete) - H5E_THROW(H5E_CANTOPENOBJ, "can't open extensible array pending deletion") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTOPENOBJ, NULL, "can't open extensible array pending deletion") /* Point extensible array wrapper at header and bump it's ref count */ ea->hdr = hdr; if (H5EA__hdr_incr(ea->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") /* Increment # of files using this array header */ if (H5EA__hdr_fuse_incr(ea->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, + "can't increment file reference count on shared array header") /* Set file pointer for this array open context */ ea->f = f; @@ -156,15 +157,16 @@ BEGIN_FUNC(STATIC, ERR, H5EA_t *, NULL, NULL, /* Set the return value */ ret_value = ea; - CATCH +done: if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to release extensible array header") if (!ret_value) if (ea && H5EA_close(ea) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") + HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array") -END_FUNC(STATIC) /* end H5EA__new() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__new() */ /*------------------------------------------------------------------------- * Function: H5EA_create @@ -179,16 +181,16 @@ END_FUNC(STATIC) /* end H5EA__new() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL, - H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) - - /* Local variables */ +H5EA_t * +H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) +{ H5EA_t *ea = NULL; /* Pointer to new extensible array */ haddr_t ea_addr; /* Array header address */ + H5EA_t *ret_value = NULL; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(NULL) + + /* Check arguments */ HDassert(f); HDassert(cparam); @@ -197,22 +199,23 @@ BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL, /* Create extensible array header */ if (HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, cparam, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "can't create extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create extensible array header") /* Allocate and initialize new extensible array wrapper */ if (NULL == (ea = H5EA__new(f, ea_addr, FALSE, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, + "allocation and/or initialization failed for extensible array wrapper") /* Set the return value */ ret_value = ea; - CATCH - +done: if (!ret_value) if (ea && H5EA_close(ea) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") + HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array") -END_FUNC(PRIV) /* end H5EA_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA_create() */ /*------------------------------------------------------------------------- * Function: H5EA_open @@ -227,31 +230,33 @@ END_FUNC(PRIV) /* end H5EA_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL, H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata)) +H5EA_t * +H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata) +{ + H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */ + H5EA_t *ret_value = NULL; - /* Local variables */ - H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */ + FUNC_ENTER_NOAPI(NULL) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(ea_addr)); /* Allocate and initialize new extensible array wrapper */ if (NULL == (ea = H5EA__new(f, ea_addr, TRUE, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, + "allocation and/or initialization failed for extensible array wrapper") /* Set the return value */ ret_value = ea; - CATCH - +done: if (!ret_value) if (ea && H5EA_close(ea) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") + HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array") -END_FUNC(PRIV) /* end H5EA_open() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA_open() */ /*------------------------------------------------------------------------- * Function: H5EA_get_nelmts @@ -265,20 +270,20 @@ END_FUNC(PRIV) /* end H5EA_open() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts)) - - /* Local variables */ +herr_t +H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts) +{ + FUNC_ENTER_NOAPI_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(ea); HDassert(nelmts); /* Retrieve the max. index set */ *nelmts = ea->hdr->stats.stored.max_idx_set; -END_FUNC(PRIV) /* end H5EA_get_nelmts() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA_get_nelmts() */ /*------------------------------------------------------------------------- * Function: H5EA_get_addr @@ -292,13 +297,12 @@ END_FUNC(PRIV) /* end H5EA_get_nelmts() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_addr(const H5EA_t *ea, haddr_t *addr)) - - /* Local variables */ +herr_t +H5EA_get_addr(const H5EA_t *ea, haddr_t *addr) +{ + FUNC_ENTER_NOAPI_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(ea); HDassert(ea->hdr); HDassert(addr); @@ -306,7 +310,8 @@ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_addr(const H5EA_t *ea, hadd /* Retrieve the address of the extensible array's header */ *addr = ea->hdr->addr; -END_FUNC(PRIV) /* end H5EA_get_addr() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA_get_addr() */ /*------------------------------------------------------------------------- * Function: H5EA__lookup_elmt @@ -321,12 +326,11 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned thing_acc, - void **thing, uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx, - H5EA__unprotect_func_t *thing_unprot_func)) - - /* Local variables */ +static herr_t +H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned thing_acc, void **thing, + uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx, + H5EA__unprotect_func_t *thing_unprot_func) +{ H5EA_hdr_t * hdr = ea->hdr; /* Header for EA */ H5EA_iblock_t * iblock = NULL; /* Pointer to index block for EA */ H5EA_sblock_t * sblock = NULL; /* Pointer to super block for EA */ @@ -336,10 +340,11 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */ hbool_t stats_changed = FALSE; /* Whether array statistics changed */ hbool_t hdr_dirty = FALSE; /* Whether the array header changed */ + herr_t ret_value = SUCCEED; - /* - * Check arguments. - */ + FUNC_ENTER_STATIC + + /* Check arguments */ HDassert(ea); HDassert(hdr); HDassert(thing); @@ -365,17 +370,18 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Create the index block */ hdr->idx_blk_addr = H5EA__iblock_create(hdr, &stats_changed); if (!H5F_addr_defined(hdr->idx_blk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create index block") hdr_dirty = TRUE; } /* end if */ else - H5_LEAVE(SUCCEED) + HGOTO_DONE(SUCCEED) } /* end if */ /* Protect index block */ if (NULL == (iblock = H5EA__iblock_protect(hdr, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array index block, address = %llu", + (unsigned long long)hdr->idx_blk_addr) /* Check if element is in index block */ if (idx < hdr->cparam.idx_blk_elmts) { @@ -416,21 +422,23 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, dblk_addr = H5EA__dblock_create(hdr, iblock, &stats_changed, dblk_off, hdr->sblk_info[sblk_idx].dblk_nelmts); if (!H5F_addr_defined(dblk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, + "unable to create extensible array data block") /* Set data block address in index block */ iblock->dblk_addrs[dblk_idx] = dblk_addr; iblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else - H5_LEAVE(SUCCEED) + HGOTO_DONE(SUCCEED) } /* end if */ /* Protect data block */ if (NULL == (dblock = H5EA__dblock_protect(hdr, iblock, iblock->dblk_addrs[dblk_idx], hdr->sblk_info[sblk_idx].dblk_nelmts, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", - (unsigned long long)iblock->dblk_addrs[dblk_idx]) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array data block, address = %llu", + (unsigned long long)iblock->dblk_addrs[dblk_idx]) /* Adjust index to offset in data block */ elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; @@ -438,9 +446,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Check if there is already a dependency on the header */ if (will_extend && !dblock->has_hdr_depend) { if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between data block and header, index = %llu", - (unsigned long long)idx) + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, + "unable to create flush dependency between data block and header, index = %llu", + (unsigned long long)idx) dblock->has_hdr_depend = TRUE; } /* end if */ @@ -465,21 +474,23 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Create super block */ sblk_addr = H5EA__sblock_create(hdr, iblock, &stats_changed, sblk_idx); if (!H5F_addr_defined(sblk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, + "unable to create extensible array super block") /* Set super block address in index block */ iblock->sblk_addrs[sblk_off] = sblk_addr; iblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else - H5_LEAVE(SUCCEED) + HGOTO_DONE(SUCCEED) } /* end if */ /* Protect super block */ if (NULL == (sblock = H5EA__sblock_protect(hdr, iblock, iblock->sblk_addrs[sblk_off], sblk_idx, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", - (unsigned long long)iblock->sblk_addrs[sblk_off]) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array super block, address = %llu", + (unsigned long long)iblock->sblk_addrs[sblk_off]) /* Compute the data block index in super block */ dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts); @@ -498,7 +509,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, dblk_addr = H5EA__dblock_create(hdr, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts); if (!H5F_addr_defined(dblk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, + "unable to create extensible array data block") /* Set data block address in index block */ sblock->dblk_addrs[dblk_idx] = dblk_addr; @@ -508,8 +520,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, */ if (will_extend && !sblock->has_hdr_depend) { if (H5EA__create_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between super block and header, address " "= %llu", (unsigned long long)sblock->addr) @@ -517,7 +529,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, } /* end if */ } /* end if */ else - H5_LEAVE(SUCCEED) + HGOTO_DONE(SUCCEED) } /* end if */ /* Adjust index to offset in data block */ @@ -548,29 +560,29 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ /* Create the data block page */ if (H5EA__dblk_page_create(hdr, sblock, dblk_page_addr) < 0) - H5E_THROW(H5E_CANTCREATE, "unable to create data block page") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page") /* Mark data block page as initialized in super block */ H5VM_bit_set(sblock->page_init, page_init_idx, TRUE); sblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else - H5_LEAVE(SUCCEED) + HGOTO_DONE(SUCCEED) } /* end if */ /* Protect data block page */ if (NULL == (dblk_page = H5EA__dblk_page_protect(hdr, sblock, dblk_page_addr, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, - "unable to protect extensible array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array data block page, address = %llu", + (unsigned long long)dblk_page_addr) /* Check if there is already a dependency on the header */ if (will_extend && !dblk_page->has_hdr_depend) { if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between data block page and header, " - "index = %llu", - (unsigned long long)idx) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, + "unable to create flush dependency between data block page and header, " + "index = %llu", + (unsigned long long)idx) dblk_page->has_hdr_depend = TRUE; } /* end if */ @@ -584,15 +596,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Protect data block */ if (NULL == (dblock = H5EA__dblock_protect(hdr, sblock, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, - "unable to protect extensible array data block, address = %llu", - (unsigned long long)sblock->dblk_addrs[dblk_idx]) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array data block, address = %llu", + (unsigned long long)sblock->dblk_addrs[dblk_idx]) /* Check if there is already a dependency on the header */ if (will_extend && !dblock->has_hdr_depend) { if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW( - H5E_CANTDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block and header, index = %llu", (unsigned long long)idx) dblock->has_hdr_depend = TRUE; @@ -611,7 +623,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, HDassert(*thing != NULL); HDassert(*thing_unprot_func != NULL); - CATCH +done: /* Reset 'thing' info on error */ if (ret_value < 0) { *thing = NULL; @@ -627,20 +639,22 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Check for header modified */ if (hdr_dirty) if (H5EA__hdr_modified(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified") + HDONE_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, + "unable to mark extensible array header as modified") /* Release resources */ if (iblock && *thing != iblock && H5EA__iblock_unprotect(iblock, iblock_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block") /* (Note: super blocks don't contain elements, so don't have a '*thing != sblock' check) */ if (sblock && H5EA__sblock_unprotect(sblock, sblock_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block") if (dblock && *thing != dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block") if (dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block page") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block page") -END_FUNC(STATIC) /* end H5EA__lookup_elmt() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__lookup_elmt() */ /*------------------------------------------------------------------------- * Function: H5EA_set @@ -654,9 +668,9 @@ END_FUNC(STATIC) /* end H5EA__lookup_elmt() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt)) - - /* Local variables */ +herr_t +H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt) +{ H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ void * thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ @@ -664,10 +678,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ hbool_t will_extend; /* Flag indicating if setting the element will extend the array */ unsigned thing_cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting array metadata */ + herr_t ret_value = SUCCEED; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ HDassert(ea); HDassert(hdr); @@ -678,7 +693,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t will_extend = (idx >= hdr->stats.stored.max_idx_set); if (H5EA__lookup_elmt(ea, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) - H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata") /* Sanity check */ HDassert(thing); @@ -695,15 +710,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t /* Update the max index for the array */ hdr->stats.stored.max_idx_set = idx + 1; if (H5EA__hdr_modified(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified") - } /* end if */ + HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, + "unable to mark extensible array header as modified") + } - CATCH +done: /* Release resources */ if (thing && (thing_unprot_func)(thing, thing_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata") -END_FUNC(PRIV) /* end H5EA_set() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA_set() */ /*------------------------------------------------------------------------- * Function: H5EA_get @@ -717,17 +734,18 @@ END_FUNC(PRIV) /* end H5EA_set() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt)) - - /* Local variables */ +herr_t +H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt) +{ H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ H5EA__unprotect_func_t thing_unprot_func = NULL; /* Function pointer for unprotecting the array metadata */ + herr_t ret_value = SUCCEED; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ HDassert(ea); HDassert(hdr); @@ -735,7 +753,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t if (idx >= hdr->stats.stored.max_idx_set) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value") } /* end if */ else { uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ @@ -747,13 +765,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t /* Look up the array metadata containing the element we want to set */ if (H5EA__lookup_elmt(ea, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) - H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata") /* Check if the thing holding the element has been created yet */ if (NULL == thing) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value") } /* end if */ else /* Get element from thing's element buffer */ @@ -761,12 +779,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t hdr->cparam.cls->nat_elmt_size); } /* end else */ - CATCH +done: /* Release thing */ if (thing && (thing_unprot_func)(thing, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata") -END_FUNC(PRIV) /* end H5EA_get() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA_get() */ /*------------------------------------------------------------------------- * Function: H5EA_depend @@ -781,14 +800,15 @@ END_FUNC(PRIV) /* end H5EA_get() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent)) +herr_t +H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent) +{ + H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ + FUNC_ENTER_NOAPI(FAIL) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(ea); HDassert(hdr); HDassert(parent); @@ -807,13 +827,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_depend(H5EA_t *ea, H5AC_proxy_ /* Add the extensible array as a child of the parent (proxy) */ if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array as child of proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "unable to add extensible array as child of proxy") hdr->parent = parent; - } /* end if */ - - CATCH + } -END_FUNC(PRIV) /* end H5EA_depend() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA_depend() */ /*------------------------------------------------------------------------- * Function: H5EA_close @@ -827,15 +847,16 @@ END_FUNC(PRIV) /* end H5EA_depend() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea)) - - /* Local variables */ +herr_t +H5EA_close(H5EA_t *ea) +{ hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */ haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */ + herr_t ret_value = SUCCEED; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ HDassert(ea); /* Close the header, if it was set */ @@ -868,8 +889,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea)) /* Check the header's status in the metadata cache */ if (H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0) - H5E_THROW(H5E_CANTGET, - "unable to check metadata cache status for extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, + "unable to check metadata cache status for extensible array header") /* Sanity checks on header */ HDassert(hdr_status & H5AC_ES__IN_CACHE); @@ -881,7 +902,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea)) /* Lock the array header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ if (NULL == (hdr = H5EA__hdr_protect(ea->f, ea_addr, NULL, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTLOAD, FAIL, "unable to load extensible array header") /* Set the shared array header's file context for this operation */ hdr->f = ea->f; @@ -891,11 +912,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea)) * immediately -QAK) */ if (H5EA__hdr_decr(ea->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") /* Delete array, starting with header (unprotects header) */ if (H5EA__hdr_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array") } /* end if */ else { /* Decrement the reference count on the array header */ @@ -903,16 +925,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea)) * immediately -QAK) */ if (H5EA__hdr_decr(ea->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") } /* end else */ } /* end if */ /* Release the extensible array wrapper */ ea = (H5EA_t *)H5FL_FREE(H5EA_t, ea); - CATCH - -END_FUNC(PRIV) /* end H5EA_close() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA_close() */ /*------------------------------------------------------------------------- * Function: H5EA_delete @@ -926,21 +949,22 @@ END_FUNC(PRIV) /* end H5EA_close() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata)) +herr_t +H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata) +{ + H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */ + FUNC_ENTER_NOAPI(FAIL) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(ea_addr)); /* Lock the array header into memory */ if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", - (unsigned long long)ea_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) /* Check for files using shared array header */ if (hdr->file_rc) @@ -951,17 +975,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_delete(H5F_t *f, haddr_t ea_ad /* Delete array now, starting with header (unprotects header) */ if (H5EA__hdr_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array") hdr = NULL; - } /* end if */ + } - CATCH - - /* Unprotect the header, if an error occurred */ +done: + /* Unprotect the header if an error occurred */ if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") -END_FUNC(PRIV) /* end H5EA_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA_delete() */ /*------------------------------------------------------------------------- * Function: H5EA_iterate @@ -975,13 +999,14 @@ END_FUNC(PRIV) /* end H5EA_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR, - H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata)) - - /* Local variables */ +int +H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata) +{ uint8_t *elmt = NULL; hsize_t u; - int cb_ret = H5_ITER_CONT; /* Return value from callback */ + int ret_value = H5_ITER_CONT; + + FUNC_ENTER_NOAPI(H5_ITER_ERROR) /* Check arguments */ HDassert(ea); @@ -990,27 +1015,28 @@ BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR, /* Allocate space for a native array element */ if (NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, H5_ITER_ERROR, + "memory allocation failed for extensible array element") /* Iterate over all elements in array */ - for (u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) { + for (u = 0; u < ea->hdr->stats.stored.max_idx_set && ret_value == H5_ITER_CONT; u++) { /* Get array element */ if (H5EA_get(ea, u, elmt) < 0) - H5E_THROW(H5E_CANTGET, "unable to delete fixed array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array") /* Make callback */ - if ((cb_ret = (*op)(u, elmt, udata)) < 0) { - H5E_PRINTF(H5E_BADITER, "iterator function failed"); - H5_LEAVE(cb_ret) - } /* end if */ - } /* end for */ - - CATCH + if ((ret_value = (*op)(u, elmt, udata)) < 0) { + HERROR(H5E_EARRAY, H5E_BADITER, "iteration callback error"); + break; + } + } +done: if (elmt) elmt = H5FL_BLK_FREE(ea_native_elmt, elmt); -END_FUNC(PRIV) /* end H5EA_iterate() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA_iterate() */ /*------------------------------------------------------------------------- * Function: H5EA_patch_file @@ -1024,17 +1050,17 @@ END_FUNC(PRIV) /* end H5EA_iterate() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_patch_file(H5EA_t *ea, H5F_t *f)) - - /* Local variables */ +herr_t +H5EA_patch_file(H5EA_t *ea, H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(ea); HDassert(f); if (ea->f != f || ea->hdr->f != f) ea->f = ea->hdr->f = f; -END_FUNC(PRIV) /* end H5EA_patch_file() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA_patch_file() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 2a3153c..eeac1a2 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -221,12 +221,13 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; /* User data for callback */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->f); @@ -235,7 +236,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f); -END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_hdr_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_verify_chksum @@ -250,13 +252,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -267,7 +271,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5EA__cache_hdr_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_deserialize @@ -282,16 +287,17 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_cls_id_t id; /* ID of extensible array class, as found in file */ H5EA_hdr_t * hdr = NULL; /* Extensible array info */ H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(image); @@ -301,24 +307,25 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate space for the extensible array data structure */ if (NULL == (hdr = H5EA__hdr_alloc(udata->f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array shared header") /* Set the extensible array header's address */ hdr->addr = udata->addr; /* Magic number */ if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_HDR_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array header version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array header version") /* Extensible array class */ id = (H5EA_cls_id_t)*image++; if (id >= H5EA_NUM_CLS_ID) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") hdr->cparam.cls = H5EA_client_class_g[id]; /* General array creation/configuration information */ @@ -379,20 +386,20 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Finish initializing extensible array header */ if (H5EA__hdr_init(hdr, udata->ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "initialization failed for extensible array header") HDassert(hdr->size == len); /* Set return value */ ret_value = hdr; - CATCH - +done: /* Release resources */ if (!ret_value) if (hdr && H5EA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header") -END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_hdr_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_image_len @@ -406,12 +413,13 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len) +{ const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(hdr); HDassert(image_len); @@ -419,7 +427,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = hdr->size; -END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_hdr_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_serialize @@ -433,14 +442,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the extensible array header */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + FUNC_ENTER_STATIC_NOERR + /* check arguments */ HDassert(f); HDassert(image); @@ -488,7 +498,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); -END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_hdr_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_notify @@ -502,11 +513,13 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) +{ + H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(hdr); @@ -538,23 +551,24 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Destroy flush dependency on object header proxy */ if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between extensible array and proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between extensible array and proxy") hdr->parent = NULL; } /* end if */ /* Detach from 'top' proxy for extensible array */ if (hdr->top_proxy) { if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between header and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between header and " + "extensible array 'top' proxy") /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ } /* end if */ break; default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ @@ -563,9 +577,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, else HDassert(NULL == hdr->parent); - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_hdr_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_hdr_free_icr @@ -580,18 +594,23 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_hdr_free_icr(void *thing)) +static herr_t +H5EA__cache_hdr_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array header */ if (H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array header") - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_hdr_free_icr() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_get_initial_load_size @@ -605,13 +624,14 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */ H5EA_iblock_t iblock; /* Fake index block for computing size */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(hdr); HDassert(image_len); @@ -626,7 +646,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5EA_IBLOCK_SIZE(&iblock); -END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_iblock_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_verify_chksum @@ -641,13 +662,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -658,7 +681,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_deserialize @@ -673,17 +697,18 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_iblock_t *iblock = NULL; /* Index block info */ H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ haddr_t arr_addr; /* Address of array header in the file */ size_t u; /* Local index variable */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(image); @@ -691,28 +716,29 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the extensible array index block */ if (NULL == (iblock = H5EA__iblock_alloc(hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array index block") /* Set the extensible array index block's address */ iblock->addr = hdr->idx_blk_addr; /* Magic number */ if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array index block signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_IBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array index block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array index block version") /* Extensible array type */ if (*image++ != (uint8_t)hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(hdr->f, &image, &arr_addr); if (H5F_addr_ne(arr_addr, hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") /* Internal information */ @@ -721,7 +747,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Convert from raw elements on disk into native elements in memory */ if ((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array index elements") image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size); } /* end if */ @@ -757,14 +783,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = iblock; - CATCH - +done: /* Release resources */ if (!ret_value) if (iblock && H5EA__iblock_dest(iblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block") -END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_image_len @@ -778,12 +804,13 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len) +{ const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(iblock); HDassert(image_len); @@ -791,7 +818,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = iblock->size; -END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_iblock_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_serialize @@ -805,14 +833,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, - void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* check arguments */ HDassert(f); @@ -843,7 +872,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Convert from native elements in memory into raw elements on disk */ if ((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts, iblock->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array index elements") image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size); } /* end if */ @@ -874,9 +903,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_notify @@ -890,11 +919,13 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) +{ + H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(iblock); @@ -905,9 +936,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on extensible array header */ if (H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between index block and header, address = %llu", - (unsigned long long)iblock->addr) + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, + "unable to create flush dependency between index block and header, address = %llu", + (unsigned long long)iblock->addr) break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -923,30 +955,32 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on extensible array header */ if (H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between index block and header, address = %llu", - (unsigned long long)iblock->addr) + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between index block and header, address = %llu", + (unsigned long long)iblock->addr) /* Detach from 'top' proxy for extensible array */ if (iblock->top_proxy) { if (H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between index block and " + "extensible array 'top' proxy") iblock->top_proxy = NULL; } /* end if */ break; default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_free_icr @@ -961,18 +995,23 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_iblock_free_icr(void *thing)) +static herr_t +H5EA__cache_iblock_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array index block */ if (H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array index block") - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_iblock_free_icr() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_get_initial_load_size @@ -986,13 +1025,14 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */ H5EA_sblock_t sblock; /* Fake super block for computing size */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->hdr); @@ -1026,7 +1066,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5EA_SBLOCK_SIZE(&sblock); -END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_sblock_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_verify_chksum @@ -1041,13 +1082,15 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -1058,7 +1101,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_deserialize @@ -1073,17 +1117,18 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_sblock_t * sblock = NULL; /* Super block info */ H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ haddr_t arr_addr; /* Address of array header in the file */ size_t u; /* Local index variable */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(udata); @@ -1094,28 +1139,29 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the extensible array super block */ if (NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array super block") /* Set the extensible array super block's address */ sblock->addr = udata->sblk_addr; /* Magic number */ if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array super block signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_SBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array super block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array super block version") /* Extensible array type */ if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") /* Offset of block within the array's address space */ UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size); @@ -1154,14 +1200,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = sblock; - CATCH - +done: /* Release resources */ if (!ret_value) if (sblock && H5EA__sblock_dest(sblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block") -END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_image_len @@ -1175,12 +1221,13 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len) +{ const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(sblock); HDassert(image_len); @@ -1188,7 +1235,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = sblock->size; -END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_sblock_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_serialize @@ -1202,16 +1250,16 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, - void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ size_t u; /* Local index variable */ + FUNC_ENTER_STATIC_NOERR + /* check arguments */ HDassert(f); HDassert(image); @@ -1260,7 +1308,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); -END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_sblock_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_notify @@ -1274,11 +1323,13 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) +{ + H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(sblock); @@ -1289,8 +1340,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on index block */ if (H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) break; @@ -1299,8 +1350,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Destroy flush dependency on extensible array header, if set */ if (sblock->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr) sblock->has_hdr_depend = FALSE; @@ -1310,16 +1361,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on index block */ if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) /* Destroy flush dependency on extensible array header, if set */ if (sblock->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr) sblock->has_hdr_depend = FALSE; @@ -1328,8 +1379,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Detach from 'top' proxy for extensible array */ if (sblock->top_proxy) { if (H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between super block and " + "extensible array 'top' proxy") sblock->top_proxy = NULL; } /* end if */ break; @@ -1345,15 +1397,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_free_icr @@ -1368,18 +1420,23 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_sblock_free_icr(void *thing)) +static herr_t +H5EA__cache_sblock_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array super block */ if (H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array super block") - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_free_icr() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_get_initial_load_size @@ -1393,13 +1450,14 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */ H5EA_dblock_t dblock; /* Fake data block for computing size */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->hdr); @@ -1434,7 +1492,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, else *image_len = H5EA_DBLOCK_PREFIX_SIZE(&dblock); -END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblock_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_verify_chksum @@ -1449,13 +1508,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -1466,7 +1527,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_sblock_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_deserialize @@ -1481,16 +1543,18 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, + hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_dblock_t * dblock = NULL; /* Data block info */ H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ haddr_t arr_addr; /* Address of array header in the file */ + void * ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(udata); @@ -1501,7 +1565,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the extensible array data block */ if (NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array data block") HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) || (len == H5EA_DBLOCK_PREFIX_SIZE(dblock))); @@ -1511,21 +1576,21 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Magic number */ if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array data block signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_DBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array data block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array data block version") /* Extensible array type */ if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") /* Offset of block within the array's address space */ UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size); @@ -1537,7 +1602,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Decode elements in data block */ /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements") image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); } /* end if */ @@ -1560,14 +1625,15 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = dblock; - CATCH +done: /* Release resources */ if (!ret_value) if (dblock && H5EA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block") -END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5EA__cache_dblock_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_image_len @@ -1581,12 +1647,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len) +{ const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblock); HDassert(image_len); @@ -1597,7 +1664,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, else *image_len = (size_t)H5EA_DBLOCK_PREFIX_SIZE(dblock); -END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblock_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_serialize @@ -1611,14 +1679,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, - void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* check arguments */ HDassert(f); @@ -1651,7 +1720,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Convert from native elements in memory into raw elements on disk */ if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements") image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size); } /* end if */ @@ -1664,9 +1733,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblock_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_notify @@ -1680,11 +1749,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) +{ + H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Check arguments */ HDassert(dblock); @@ -1695,17 +1766,17 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on parent */ if (H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between data block and parent, address = %llu", - (unsigned long long)dblock->addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, + "unable to create flush dependency between data block and parent, address = %llu", + (unsigned long long)dblock->addr) break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: /* Destroy flush dependency on extensible array header, if set */ if (dblock->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between direct block and header, address = %llu", (unsigned long long)dblock->addr) dblock->has_hdr_depend = FALSE; @@ -1715,15 +1786,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block and parent, address = %llu", - (unsigned long long)dblock->addr) + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block and parent, address = %llu", + (unsigned long long)dblock->addr) /* Destroy flush dependency on extensible array header, if set */ if (dblock->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block and header, address = %llu", (unsigned long long)dblock->addr) dblock->has_hdr_depend = FALSE; @@ -1732,8 +1804,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Detach from 'top' proxy for extensible array */ if (dblock->top_proxy) { if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block and " + "extensible array 'top' proxy") dblock->top_proxy = NULL; } /* end if */ break; @@ -1749,15 +1822,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblock_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_free_icr @@ -1772,18 +1845,23 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblock_free_icr(void *thing)) +static herr_t +H5EA__cache_dblock_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array data block */ if (H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block") - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblock_free_icr() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_fsf_size @@ -1814,12 +1892,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)) - - /* Local variables */ +static herr_t +H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) +{ const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblock); HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); @@ -1828,7 +1907,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, *fsf_size = dblock->size; -END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblock_fsf_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_get_initial_load_size @@ -1842,12 +1922,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len) +{ H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->hdr); @@ -1856,7 +1937,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr); -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblk_page_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_verify_chksum @@ -1871,13 +1953,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -1888,7 +1972,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_deserialize @@ -1903,16 +1988,17 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5EA_dblk_page_t * dblk_page = NULL; /* Data block page info */ H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(udata); @@ -1922,7 +2008,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the extensible array data block page */ if (NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array data block page") /* Set the extensible array data block page's information */ dblk_page->addr = udata->dblk_page_addr; @@ -1933,7 +2020,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts, udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements") image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size); /* Sanity check */ @@ -1954,14 +2041,13 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = dblk_page; - CATCH - +done: /* Release resources */ if (!ret_value) if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") - -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_deserialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_image_len @@ -1975,12 +2061,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len) +{ const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblk_page); HDassert(image_len); @@ -1988,7 +2075,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = dblk_page->size; -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__cache_dblk_page_image_len() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_serialize @@ -2002,14 +2090,16 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, - size_t H5_ATTR_UNUSED len, void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, + void *_thing) +{ H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(f); @@ -2024,7 +2114,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Convert from native elements in memory into raw elements on disk */ if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts, dblk_page->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements") image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size); /* Compute metadata checksum */ @@ -2036,9 +2126,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_serialize() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_notify @@ -2052,11 +2142,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)) - - /* Local variables */ +static herr_t +H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) +{ H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(dblk_page); @@ -2067,8 +2159,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on parent */ if (H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW( - H5E_CANTDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) break; @@ -2077,10 +2169,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Destroy flush dependency on extensible array header, if set */ if (dblk_page->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and header, " - "address = %llu", - (unsigned long long)dblk_page->addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block page and header, " + "address = %llu", + (unsigned long long)dblk_page->addr) dblk_page->has_hdr_depend = FALSE; } /* end if */ break; @@ -2088,27 +2180,27 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) /* Destroy flush dependency on extensible array header, if set */ if (dblk_page->has_hdr_depend) { if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and header, " - "address = %llu", - (unsigned long long)dblk_page->addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block page and header, " + "address = %llu", + (unsigned long long)dblk_page->addr) dblk_page->has_hdr_depend = FALSE; } /* end if */ /* Detach from 'top' proxy for extensible array */ if (dblk_page->top_proxy) { if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and " - "extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block page and " + "extensible array 'top' proxy") dblk_page->top_proxy = NULL; } /* end if */ break; @@ -2124,15 +2216,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_notify() */ /*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_free_icr @@ -2147,15 +2239,20 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblk_page_free_icr(void *thing)) +static herr_t +H5EA__cache_dblk_page_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array data block page */ if (H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array data block page") - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block page") -END_FUNC(STATIC) /* end H5EA__cache_dblk_page_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cache_dblk_page_free_icr() */ diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 72d2f38..b0e564c 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -79,13 +79,16 @@ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5EA_class_t *cls, haddr_t obj_addr)) - +herr_t +H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, + haddr_t obj_addr) +{ /* Local variables */ - H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ - void * dbg_ctx = NULL; /* Extensible array debugging context */ + H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + void * dbg_ctx = NULL; /* Extensible array debugging context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -100,11 +103,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context") /* Load the extensible array header */ if (NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header") /* Print opening message */ HDfprintf(stream, "%*sExtensible Array Header...\n", indent, ""); @@ -137,13 +140,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Index Block Address:", hdr->idx_blk_addr); - CATCH +done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") + HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context") if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") -END_FUNC(PKG) /* end H5EA__hdr_debug() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_debug() */ /*------------------------------------------------------------------------- * Function: H5EA__iblock_debug @@ -157,14 +161,17 @@ END_FUNC(PKG) /* end H5EA__hdr_debug() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth, - const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr)) - +herr_t +H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth, + const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr) +{ /* Local variables */ - H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ - H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ - void * dbg_ctx = NULL; /* Extensible array context */ + H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ + H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ + void * dbg_ctx = NULL; /* Extensible array context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -180,19 +187,20 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context") /* Load the extensible array header */ if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header") /* Sanity check */ HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr)); /* Protect index block */ if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array index block, address = %llu", + (unsigned long long)hdr->idx_blk_addr) /* Print opening message */ HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, ""); @@ -216,7 +224,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging") } /* end for */ } /* end if */ @@ -250,15 +258,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, } /* end for */ } /* end if */ - CATCH +done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") + HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context") if (iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block") if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") -END_FUNC(PKG) /* end H5EA__iblock_debug() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__iblock_debug() */ /*------------------------------------------------------------------------- * Function: H5EA__sblock_debug @@ -272,14 +281,17 @@ END_FUNC(PKG) /* end H5EA__iblock_debug() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr)) - +herr_t +H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, + haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr) +{ /* Local variables */ - H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ - H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ - void * dbg_ctx = NULL; /* Extensible array context */ + H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ + H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ + void * dbg_ctx = NULL; /* Extensible array context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -295,18 +307,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context") /* Load the extensible array header */ if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header") /* Protect super block */ /* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */ if (NULL == (sblock = H5EA__sblock_protect(hdr, (H5EA_iblock_t *)hdr, addr, sblk_idx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", - (unsigned long long)addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array super block, address = %llu", + (unsigned long long)addr) /* Print opening message */ HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, ""); @@ -334,15 +347,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, } /* end for */ } /* end if */ - CATCH +done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") + HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context") if (sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block") if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") -END_FUNC(PKG) /* end H5EA__sblock_debug() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__sblock_debug() */ /*------------------------------------------------------------------------- * Function: H5EA__dblock_debug @@ -356,16 +370,18 @@ END_FUNC(PKG) /* end H5EA__sblock_debug() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts, - haddr_t obj_addr)) - +herr_t +H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, + haddr_t hdr_addr, size_t dblk_nelmts, haddr_t obj_addr) +{ /* Local variables */ - H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ - H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ - void * dbg_ctx = NULL; /* Extensible array context */ - size_t u; /* Local index variable */ + H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ + H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ + void * dbg_ctx = NULL; /* Extensible array context */ + size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -382,17 +398,17 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context") /* Load the extensible array header */ if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header") /* Protect data block */ /* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */ if (NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %" PRIuHADDR, - addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array data block, address = %" PRIuHADDR, addr) /* Print opening message */ HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, ""); @@ -407,15 +423,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Call the class's 'debug' callback */ if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging") } /* end for */ - CATCH +done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") + HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context") if (dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block") if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") -END_FUNC(PKG) /* end H5EA__dblock_debug() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblock_debug() */ diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index b42599c..c0a92f0 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -84,22 +84,25 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL, - H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent)) - - /* Local variables */ +H5EA_dblk_page_t * +H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent) +{ H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ + H5EA_dblk_page_t *ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); /* Allocate memory for the data block */ if (NULL == (dblk_page = H5FL_CALLOC(H5EA_dblk_page_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array data block page") /* Share common array information */ if (H5EA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") dblk_page->hdr = hdr; /* Set non-zero internal fields */ @@ -107,17 +110,19 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL, /* Allocate buffer for elements in data block page */ if (NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for data block page element buffer") /* Set the return value */ ret_value = dblk_page; - CATCH +done: if (!ret_value) if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page") -END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblk_page_alloc() */ /*------------------------------------------------------------------------- * Function: H5EA__dblk_page_create @@ -131,19 +136,22 @@ END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr)) - - /* Local variables */ +herr_t +H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr) +{ H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); /* Allocate the data block page */ if (NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL, + "memory allocation failed for extensible array data block page") /* Set info about data block page on disk */ dblk_page->addr = addr; @@ -151,34 +159,39 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Clear any elements in data block page to fill value */ if ((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, + "can't set extensible array data block page elements to class's fill value") /* Cache the new extensible array data block page */ if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, FAIL, "can't add extensible array data block page to cache") inserted = TRUE; /* Add data block page as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, + "unable to add extensible array entry as child of array proxy") dblk_page->top_proxy = hdr->top_proxy; } /* end if */ - CATCH +done: if (ret_value < 0) if (dblk_page) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(dblk_page) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block page from cache") + HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, FAIL, + "unable to remove extensible array data block page from cache") /* Destroy data block page */ if (H5EA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, + "unable to destroy extensible array data block page") } /* end if */ -END_FUNC(PKG) /* end H5EA__dblk_page_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblk_page_create() */ /*------------------------------------------------------------------------- * Function: H5EA__dblk_page_protect @@ -193,13 +206,14 @@ END_FUNC(PKG) /* end H5EA__dblk_page_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL, - H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_page_addr, - unsigned flags)) - - /* Local variables */ +H5EA_dblk_page_t * +H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_page_addr, unsigned flags) +{ H5EA_dblk_page_t * dblk_page = NULL; /* Extensible array data block page */ H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */ + H5EA_dblk_page_t * ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -216,32 +230,34 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL, /* Protect the data block page */ if (NULL == (dblk_page = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, + "unable to protect extensible array data block page, address = %llu", + (unsigned long long)dblk_page_addr) /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == dblk_page->top_proxy) { /* Add data block page as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, + "unable to add extensible array entry as child of array proxy") dblk_page->top_proxy = hdr->top_proxy; } /* end if */ /* Set return value */ ret_value = dblk_page; - CATCH +done: /* Clean up on error */ if (!ret_value) { /* Release the data block page, if it was protected */ if (dblk_page && H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, - "unable to unprotect extensible array data block page, address = %llu", - (unsigned long long)dblk_page->addr) + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, + "unable to unprotect extensible array data block page, address = %llu", + (unsigned long long)dblk_page->addr) } /* end if */ - -END_FUNC(PKG) /* end H5EA__dblk_page_protect() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblk_page_protect() */ /*------------------------------------------------------------------------- * Function: H5EA__dblk_page_unprotect @@ -256,22 +272,25 @@ END_FUNC(PKG) /* end H5EA__dblk_page_protect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags)) +herr_t +H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; - /* Local variables */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dblk_page); /* Unprotect the data block page */ if (H5AC_unprotect(dblk_page->hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", - (unsigned long long)dblk_page->addr) - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to unprotect extensible array data block page, address = %llu", + (unsigned long long)dblk_page->addr) -END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblk_page_unprotect() */ /*------------------------------------------------------------------------- * Function: H5EA__dblk_page_dest @@ -285,7 +304,12 @@ END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page)) +herr_t +H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dblk_page); @@ -297,13 +321,15 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_ if (dblk_page->elmts) { /* Free buffer for data block page elements */ if (H5EA__hdr_free_elmts(dblk_page->hdr, dblk_page->hdr->dblk_page_nelmts, dblk_page->elmts) < 0) - H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, + "unable to free extensible array data block element buffer") dblk_page->elmts = NULL; } /* end if */ /* Decrement reference count on shared info */ if (H5EA__hdr_decr(dblk_page->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") dblk_page->hdr = NULL; } /* end if */ @@ -313,6 +339,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_ /* Free the data block page itself */ dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page); - CATCH - -END_FUNC(PKG) /* end H5EA__dblk_page_dest() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblk_page_dest() */ diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index 45696c7..f17aae3 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -85,11 +85,13 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, - H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts)) +H5EA_dblock_t * +H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts) +{ + H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ + H5EA_dblock_t *ret_value = NULL; - /* Local variables */ - H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); @@ -98,11 +100,12 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, /* Allocate memory for the data block */ if (NULL == (dblock = H5FL_CALLOC(H5EA_dblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array data block") /* Share common array information */ if (H5EA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") dblock->hdr = hdr; /* Set non-zero internal fields */ @@ -118,18 +121,20 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, else { /* Allocate buffer for elements in data block */ if (NULL == (dblock->elmts = H5EA__hdr_alloc_elmts(hdr, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for data block element buffer") } /* end else */ /* Set the return value */ ret_value = dblock; - CATCH +done: if (!ret_value) if (dblock && H5EA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block") -END_FUNC(PKG) /* end H5EA__dblock_alloc() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblock_alloc() */ /*------------------------------------------------------------------------- * Function: H5EA__dblock_create @@ -143,14 +148,15 @@ END_FUNC(PKG) /* end H5EA__dblock_alloc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, - H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off, - size_t nelmts)) +haddr_t +H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts) +{ + H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ + haddr_t dblock_addr; /* Extensible array data block address */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + haddr_t ret_value = HADDR_UNDEF; - /* Local variables */ - H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ - haddr_t dblock_addr; /* Extensible array data block address */ - hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -159,7 +165,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Allocate the data block */ if (NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "memory allocation failed for extensible array data block") /* Set size of data block on disk */ dblock->size = H5EA_DBLOCK_SIZE(dblock); @@ -169,24 +176,27 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Allocate space for the data block on disk */ if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, (hsize_t)dblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "file allocation failed for extensible array data block") dblock->addr = dblock_addr; /* Don't initialize elements if paged */ if (!dblock->npages) /* Clear any elements in data block to fill value */ if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, + "can't set extensible array data block elements to class's fill value") /* Cache the new extensible array data block */ if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array data block to cache") inserted = TRUE; /* Add data block as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, + "unable to add extensible array entry as child of array proxy") dblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -203,25 +213,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Set address of data block to return */ ret_value = dblock_addr; - CATCH +done: if (!H5F_addr_defined(ret_value)) if (dblock) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(dblock) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block from cache") + HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF, + "unable to remove extensible array data block from cache") /* Release data block's disk space */ if (H5F_addr_defined(dblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to release extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to release extensible array data block") /* Destroy data block */ if (H5EA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to destroy extensible array data block") } /* end if */ -END_FUNC(PKG) /* end H5EA__dblock_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblock_create() */ /*------------------------------------------------------------------------- * Function: H5EA__dblock_sblk_idx @@ -236,10 +250,12 @@ END_FUNC(PKG) /* end H5EA__dblock_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, unsigned, 0, -, H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx)) +unsigned +H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx) +{ + unsigned sblk_idx = 0; /* Which superblock does this index fall in? */ - /* Local variables */ - unsigned sblk_idx; /* Which superblock does this index fall in? */ + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -252,10 +268,8 @@ BEGIN_FUNC(PKG, NOERR, unsigned, 0, -, H5EA__dblock_sblk_idx(const H5EA_hdr_t *h H5_CHECK_OVERFLOW(idx, /*From:*/ hsize_t, /*To:*/ uint64_t); sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); - /* Set return value */ - ret_value = sblk_idx; - -END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */ + FUNC_LEAVE_NOAPI(sblk_idx) +} /* end H5EA__dblock_sblk_idx() */ /*------------------------------------------------------------------------- * Function: H5EA__dblock_protect @@ -269,13 +283,14 @@ END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, - H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts, - unsigned flags)) - - /* Local variables */ +H5EA_dblock_t * +H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts, unsigned flags) +{ H5EA_dblock_t * dblock; /* Extensible array data block */ H5EA_dblock_cache_ud_t udata; /* Information needed for loading data block */ + H5EA_dblock_t * ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -294,32 +309,36 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, /* Protect the data block */ if (NULL == (dblock = (H5EA_dblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLOCK, dblk_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", - (unsigned long long)dblk_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, + "unable to protect extensible array data block, address = %llu", + (unsigned long long)dblk_addr) /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == dblock->top_proxy) { /* Add data block as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, + "unable to add extensible array entry as child of array proxy") dblock->top_proxy = hdr->top_proxy; - } /* end if */ + } /* Set return value */ ret_value = dblock; - CATCH +done: /* Clean up on error */ if (!ret_value) { /* Release the data block, if it was protected */ if (dblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", - (unsigned long long)dblock->addr) - } /* end if */ + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, + "unable to unprotect extensible array data block, address = %llu", + (unsigned long long)dblock->addr) + } -END_FUNC(PKG) /* end H5EA__dblock_protect() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblock_protect() */ /*------------------------------------------------------------------------- * Function: H5EA__dblock_unprotect @@ -333,22 +352,26 @@ END_FUNC(PKG) /* end H5EA__dblock_protect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags)) +herr_t +H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; - /* Local variables */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dblock); /* Unprotect the data block */ if (H5AC_unprotect(dblock->hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", - (unsigned long long)dblock->addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to unprotect extensible array data block, address = %llu", + (unsigned long long)dblock->addr) - CATCH +done: -END_FUNC(PKG) /* end H5EA__dblock_unprotect() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblock_unprotect() */ /*------------------------------------------------------------------------- * Function: H5EA__dblock_delete @@ -362,11 +385,13 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts)) +herr_t +H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts) +{ + H5EA_dblock_t *dblock = NULL; /* Pointer to data block */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_dblock_t *dblock = NULL; /* Pointer to data block */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -376,8 +401,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Protect data block */ if (NULL == (dblock = H5EA__dblock_protect(hdr, parent, dblk_addr, dblk_nelmts, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", - (unsigned long long)dblk_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array data block, address = %llu", + (unsigned long long)dblk_addr) /* Check if this is a paged data block */ if (dblk_nelmts > hdr->dblk_page_nelmts) { @@ -395,20 +421,22 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Evict the data block page from the metadata cache */ /* (OK to call if it doesn't exist in the cache) */ if (H5AC_expunge_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTEXPUNGE, FAIL, + "unable to remove array data block page from metadata cache") /* Advance to next page address */ dblk_page_addr += dblk_page_size; } /* end for */ } /* end if */ - CATCH +done: /* Finished deleting data block in metadata cache */ if (dblock && H5EA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block") -END_FUNC(PKG) /* end H5EA__dblock_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblock_delete() */ /*------------------------------------------------------------------------- * Function: H5EA__dblock_dest @@ -422,7 +450,12 @@ END_FUNC(PKG) /* end H5EA__dblock_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dblock)) +herr_t +H5EA__dblock_dest(H5EA_dblock_t *dblock) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dblock); @@ -435,14 +468,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dbl /* Free buffer for data block elements */ HDassert(dblock->nelmts > 0); if (H5EA__hdr_free_elmts(dblock->hdr, dblock->nelmts, dblock->elmts) < 0) - H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, + "unable to free extensible array data block element buffer") dblock->elmts = NULL; dblock->nelmts = 0; } /* end if */ /* Decrement reference count on shared info */ if (H5EA__hdr_decr(dblock->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") dblock->hdr = NULL; } /* end if */ @@ -452,6 +487,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dbl /* Free the data block itself */ dblock = H5FL_FREE(H5EA_dblock_t, dblock); - CATCH - -END_FUNC(PKG) /* end H5EA__dblock_dest() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__dblock_dest() */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 7f142af..2c68949 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -102,17 +102,21 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_alloc(H5F_t *f)) +H5EA_hdr_t * +H5EA__hdr_alloc(H5F_t *f) +{ + H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + H5EA_hdr_t *ret_value = NULL; - /* Local variables */ - H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); /* Allocate space for the shared information */ if (NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array shared header") /* Set non-zero internal fields */ hdr->addr = HADDR_UNDEF; @@ -126,12 +130,13 @@ BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_alloc(H5F_t *f)) /* Set the return value */ ret_value = hdr; - CATCH +done: if (!ret_value) if (hdr && H5EA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header") -END_FUNC(PKG) /* end H5EA__hdr_alloc() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_alloc() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_init @@ -168,12 +173,15 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata)) - - /* Local variables */ +herr_t +H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata) +{ hsize_t start_idx; /* First element index for each super block */ hsize_t start_dblk; /* First data block index for each super block */ size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -188,7 +196,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void /* Allocate information for each super block */ if (NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block info array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL, "memory allocation failed for super block info array") /* Compute information about each super block */ start_idx = 0; @@ -202,7 +210,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void /* Advance starting indices for next super block */ start_idx += (hsize_t)hdr->sblk_info[u].ndblks * (hsize_t)hdr->sblk_info[u].dblk_nelmts; start_dblk += (hsize_t)hdr->sblk_info[u].ndblks; - } /* end for */ + } /* Set size of header on disk (locally and in statistics) */ hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr); @@ -210,12 +218,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void /* Create the callback context, if there's one */ if (hdr->cparam.cls->crt_context) { if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) - H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context") - } /* end if */ - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, + "unable to create extensible array client callback context") + } -END_FUNC(PKG) /* end H5EA__hdr_init() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_init() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_alloc_elmts @@ -229,11 +238,14 @@ END_FUNC(PKG) /* end H5EA__hdr_init() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts)) - - /* Local variables */ +void * +H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts) +{ void * elmts = NULL; /* Element buffer allocated */ unsigned idx; /* Index of element buffer factory in header */ + void * ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); @@ -251,8 +263,8 @@ BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, /* Re-allocate array of element factories */ if (NULL == (new_fac = H5FL_SEQ_REALLOC(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac, new_nalloc))) - H5E_THROW(H5E_CANTALLOC, - "memory allocation failed for data block data element buffer factory array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for data block data element buffer factory array") /* Zero out new elements allocated */ HDmemset(new_fac + hdr->elmt_fac.nalloc, 0, @@ -266,22 +278,24 @@ BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, /* Check for un-initialized factory at index */ if (NULL == hdr->elmt_fac.fac[idx]) { if (NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTINIT, "can't create data block data element buffer factory") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create data block data element buffer factory") } /* end if */ /* Allocate buffer for elements in index block */ if (NULL == (elmts = H5FL_FAC_MALLOC(hdr->elmt_fac.fac[idx]))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for data block data element buffer") /* Set the return value */ ret_value = elmts; - CATCH +done: if (!ret_value) if (elmts) elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts); -END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_alloc_elmts() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_free_elmts @@ -295,11 +309,13 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts)) - - /* Local variables */ +herr_t +H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts) +{ unsigned idx; /* Index of element buffer factory in header */ + FUNC_ENTER_PACKAGE_NOERR + /* Check arguments */ HDassert(hdr); HDassert(nelmts > 0); @@ -314,26 +330,30 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, HDassert(hdr->elmt_fac.fac[idx]); elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts); -END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__hdr_free_elmts() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_create * * Purpose: Creates a new extensible array header in the file * - * Return: SUCCEED/FAIL + * Return: Success: Address of new header in the file + * Failure: HADDR_UNDEF * * Programmer: Quincey Koziol * Jun 17 2008 * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, - H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) +haddr_t +H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) +{ + H5EA_hdr_t *hdr = NULL; /* Extensible array header */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + haddr_t ret_value = HADDR_UNDEF; - /* Local variables */ - H5EA_hdr_t *hdr = NULL; /* Extensible array header */ - hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -347,39 +367,45 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Check for valid parameters */ if (cparam->raw_elmt_size == 0) - H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero") if (cparam->max_nelmts_bits == 0) - H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, + "max. # of elements bits must be greater than zero") if (cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX) - H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be <= %u", - (unsigned)H5EA_MAX_NELMTS_IDX_MAX) + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "max. # of elements bits must be <= %u", + (unsigned)H5EA_MAX_NELMTS_IDX_MAX) if (cparam->sup_blk_min_data_ptrs < 2) - H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be >= two") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, + "min # of data block pointers in super block must be >= two") if (!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs)) - H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be power of two") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, + "min # of data block pointers in super block must be power of two") if (!POWER_OF_TWO(cparam->data_blk_min_elmts)) - H5E_THROW(H5E_BADVALUE, "min # of elements per data block must be power of two") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, + "min # of elements per data block must be power of two") dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; if (dblk_page_nelmts < cparam->idx_blk_elmts) - H5E_THROW(H5E_BADVALUE, - "# of elements per data block page must be greater than # of elements in index block") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, + "# of elements per data block page must be greater than # of elements in index block") /* Compute the number of elements in data blocks for first actual super block */ sblk_idx = H5EA_SBLK_FIRST_IDX(cparam->sup_blk_min_data_ptrs); dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(sblk_idx, cparam->data_blk_min_elmts); if (dblk_page_nelmts < dblk_nelmts) - H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be > # of elements in " - "first data block from super block") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, + "max. # of elements per data block page bits must be > # of elements in " + "first data block from super block") if (cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits) - H5E_THROW(H5E_BADVALUE, - "max. # of elements per data block page bits must be <= max. # of elements bits") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, + "max. # of elements per data block page bits must be <= max. # of elements bits") } #endif /* NDEBUG */ /* Allocate space for the shared information */ if (NULL == (hdr = H5EA__hdr_alloc(f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "memory allocation failed for extensible array shared header") /* Set the internal parameters for the array */ hdr->idx_blk_addr = HADDR_UNDEF; @@ -389,49 +415,55 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Finish initializing extensible array header */ if (H5EA__hdr_init(hdr, ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, HADDR_UNDEF, + "initialization failed for extensible array header") /* Allocate space for the header on disk */ if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, (hsize_t)hdr->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "file allocation failed for extensible array header") /* Create 'top' proxy for extensible array entries */ if (hdr->swmr_write) if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create extensible array entry proxy") /* Cache the new extensible array header */ if (H5AC_insert_entry(f, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array header to cache") inserted = TRUE; /* Add header as child of 'top' proxy */ if (hdr->top_proxy) if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, + "unable to add extensible array entry as child of array proxy") /* Set address of array header to return */ ret_value = hdr->addr; - CATCH +done: if (!H5F_addr_defined(ret_value)) if (hdr) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(hdr) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array header from cache") + HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF, + "unable to remove extensible array header from cache") /* Release header's disk space */ if (H5F_addr_defined(hdr->addr) && H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to free extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free extensible array header") /* Destroy header */ if (H5EA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to destroy extensible array header") } /* end if */ -END_FUNC(PKG) /* end H5EA__hdr_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_create() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_incr @@ -445,7 +477,12 @@ END_FUNC(PKG) /* end H5EA__hdr_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_incr(H5EA_hdr_t *hdr)) +herr_t +H5EA__hdr_incr(H5EA_hdr_t *hdr) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -453,14 +490,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_incr(H5EA_hdr_t *hdr)) /* Mark header as un-evictable when something is depending on it */ if (hdr->rc == 0) if (H5AC_pin_protected_entry(hdr) < 0) - H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPIN, FAIL, "unable to pin extensible array header") /* Increment reference count on shared header */ hdr->rc++; - CATCH - -END_FUNC(PKG) /* end H5EA__hdr_incr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_incr() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_decr @@ -474,7 +511,12 @@ END_FUNC(PKG) /* end H5EA__hdr_incr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_decr(H5EA_hdr_t *hdr)) +herr_t +H5EA__hdr_decr(H5EA_hdr_t *hdr) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -487,12 +529,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_decr(H5EA_hdr_t *hdr)) if (hdr->rc == 0) { HDassert(hdr->file_rc == 0); if (H5AC_unpin_entry(hdr) < 0) - H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header") - } /* end if */ - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin extensible array header") + } -END_FUNC(PKG) /* end H5EA__hdr_decr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_decr() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_fuse_incr @@ -506,7 +548,10 @@ END_FUNC(PKG) /* end H5EA__hdr_decr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr)) +herr_t +H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr) +{ + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -514,21 +559,28 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr)) /* Increment file reference count on shared header */ hdr->file_rc++; -END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__hdr_fuse_incr() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_fuse_decr * * Purpose: Decrement file reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: Success: The reference count of the header + * Failure: Can't fail * * Programmer: Quincey Koziol * Aug 26 2008 * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr)) +size_t +H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr) +{ + size_t ret_value = 0; + + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -540,7 +592,8 @@ BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr)) /* Set return value */ ret_value = hdr->file_rc; -END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_fuse_decr() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_modified @@ -554,7 +607,12 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_modified(H5EA_hdr_t *hdr)) +herr_t +H5EA__hdr_modified(H5EA_hdr_t *hdr) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -562,11 +620,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_modified(H5EA_hdr_t *hdr)) /* Mark header as dirty in cache */ if (H5AC_mark_entry_dirty(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty") - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark extensible array header as dirty") -END_FUNC(PKG) /* end H5EA__hdr_modified() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_modified() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_protect @@ -580,12 +638,14 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, - H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags)) - - /* Local variables */ +H5EA_hdr_t * +H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags) +{ H5EA_hdr_t * hdr; /* Extensible array header */ H5EA_hdr_cache_ud_t udata; /* User data for cache callbacks */ + H5EA_hdr_t * ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -601,27 +661,28 @@ BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, /* Protect the header */ if (NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, H5AC_EARRAY_HDR, ea_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", - (unsigned long long)ea_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, + "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ /* Create top proxy, if it doesn't exist */ if (hdr->swmr_write && NULL == hdr->top_proxy) { /* Create 'top' proxy for extensible array entries */ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, NULL, "can't create extensible array entry proxy") /* Add header as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, + "unable to add extensible array entry as child of array proxy") } /* end if */ /* Set return value */ ret_value = hdr; - CATCH - -END_FUNC(PKG) /* end H5EA__hdr_protect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_protect() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_unprotect @@ -635,21 +696,24 @@ END_FUNC(PKG) /* end H5EA__hdr_protect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags)) +herr_t +H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; - /* Local variables */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); /* Unprotect the header */ if (H5AC_unprotect(hdr->f, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array hdr, address = %llu", - (unsigned long long)hdr->addr) - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to unprotect extensible array hdr, address = %llu", (unsigned long long)hdr->addr) -END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_unprotect() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_delete @@ -663,46 +727,48 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_delete(H5EA_hdr_t *hdr)) - - /* Local variables */ +herr_t +H5EA__hdr_delete(H5EA_hdr_t *hdr) +{ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); HDassert(!hdr->file_rc); #ifndef NDEBUG - { - unsigned hdr_status = 0; /* Array header's status in the metadata cache */ + unsigned hdr_status = 0; /* Array header's status in the metadata cache */ - /* Check the array header's status in the metadata cache */ - if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) - H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header") + /* Check the array header's status in the metadata cache */ + if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header") - /* Sanity checks on array header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PROTECTED); - } /* end block */ + /* Sanity checks on array header */ + HDassert(hdr_status & H5AC_ES__IN_CACHE); + HDassert(hdr_status & H5AC_ES__IS_PROTECTED); #endif /* NDEBUG */ /* Check for index block */ if (H5F_addr_defined(hdr->idx_blk_addr)) { /* Delete index block */ if (H5EA__iblock_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array index block") } /* end if */ /* Set flags to finish deleting header on unprotect */ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; - CATCH +done: /* Unprotect the header, deleting it if an error hasn't occurred */ if (H5EA__hdr_unprotect(hdr, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") -END_FUNC(PKG) /* end H5EA__hdr_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_delete() */ /*------------------------------------------------------------------------- * Function: H5EA__hdr_dest @@ -716,7 +782,12 @@ END_FUNC(PKG) /* end H5EA__hdr_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr)) +herr_t +H5EA__hdr_dest(H5EA_hdr_t *hdr) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); @@ -725,7 +796,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr)) /* Destroy the callback context */ if (hdr->cb_ctx) { if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, + "unable to destroy extensible array client callback context") } /* end if */ hdr->cb_ctx = NULL; @@ -741,7 +813,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr)) /* Check if this factory has been initialized */ if (hdr->elmt_fac.fac[u]) { if (H5FL_fac_term(hdr->elmt_fac.fac[u]) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array header factory") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, + "unable to destroy extensible array header factory") hdr->elmt_fac.fac[u] = NULL; } /* end if */ } /* end for */ @@ -757,13 +830,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr)) /* Destroy the 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy extensible array 'top' proxy") hdr->top_proxy = NULL; } /* end if */ /* Free the shared info itself */ hdr = H5FL_FREE(H5EA_hdr_t, hdr); - CATCH - -END_FUNC(PKG) /* end H5EA__hdr_dest() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__hdr_dest() */ diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 1ef7980..5afb28a 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -91,21 +91,25 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t *hdr)) +H5EA_iblock_t * +H5EA__iblock_alloc(H5EA_hdr_t *hdr) +{ + H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ + H5EA_iblock_t *ret_value = NULL; - /* Local variables */ - H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); /* Allocate memory for the index block */ if (NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array index block") /* Share common array information */ if (H5EA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") iblock->hdr = hdr; /* Set non-zero internal fields */ @@ -121,27 +125,30 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t if (NULL == (iblock->elmts = H5FL_BLK_MALLOC( idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size)))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data element buffer") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for index block data element buffer") /* Allocate buffer for data block addresses in index block */ if (iblock->ndblk_addrs > 0) if (NULL == (iblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->ndblk_addrs))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data block addresses") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for index block data block addresses") /* Allocate buffer for super block addresses in index block */ if (iblock->nsblk_addrs > 0) if (NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block super block addresses") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for index block super block addresses") /* Set the return value */ ret_value = iblock; - CATCH +done: if (!ret_value) if (iblock && H5EA__iblock_dest(iblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") - -END_FUNC(PKG) /* end H5EA__iblock_alloc() */ + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__iblock_alloc() */ /*------------------------------------------------------------------------- * Function: H5EA__iblock_create @@ -155,13 +162,15 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, - H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed)) +haddr_t +H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed) +{ + H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ + haddr_t iblock_addr; /* Extensible array index block address */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + haddr_t ret_value = HADDR_UNDEF; - /* Local variables */ - H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ - haddr_t iblock_addr; /* Extensible array index block address */ - hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -169,21 +178,24 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Allocate the index block */ if (NULL == (iblock = H5EA__iblock_alloc(hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "memory allocation failed for extensible array index block") /* Set size of index block on disk */ iblock->size = H5EA_IBLOCK_SIZE(iblock); /* Allocate space for the index block on disk */ if (HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "file allocation failed for extensible array index block") iblock->addr = iblock_addr; /* Clear any elements in index block to fill value */ if (hdr->cparam.idx_blk_elmts > 0) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set extensible array index block elements to class's fill value") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, + "can't set extensible array index block elements to class's fill value") } /* end if */ /* Reset any data block addresses in the index block */ @@ -204,13 +216,15 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Cache the new extensible array index block */ if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, + "can't add extensible array index block to cache") inserted = TRUE; /* Add index block as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, + "unable to add extensible array entry as child of array proxy") iblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -229,25 +243,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Set address of index block to return */ ret_value = iblock_addr; - CATCH +done: if (!H5F_addr_defined(ret_value)) if (iblock) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(iblock) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array index block from cache") + HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF, + "unable to remove extensible array index block from cache") /* Release index block's disk space */ if (H5F_addr_defined(iblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to release file space for extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to release file space for extensible array index block") /* Destroy index block */ if (H5EA__iblock_dest(iblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to destroy extensible array index block") } /* end if */ -END_FUNC(PKG) /* end H5EA__iblock_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__iblock_create() */ /*------------------------------------------------------------------------- * Function: H5EA__iblock_protect @@ -261,10 +279,13 @@ END_FUNC(PKG) /* end H5EA__iblock_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags)) +H5EA_iblock_t * +H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags) +{ + H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ + H5EA_iblock_t *ret_value = NULL; - /* Local variables */ - H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -275,31 +296,35 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_ /* Protect the index block */ if (NULL == (iblock = (H5EA_iblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, hdr, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, + "unable to protect extensible array index block, address = %llu", + (unsigned long long)hdr->idx_blk_addr) /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == iblock->top_proxy) { /* Add index block as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, + "unable to add extensible array entry as child of array proxy") iblock->top_proxy = hdr->top_proxy; } /* end if */ /* Set return value */ ret_value = iblock; - CATCH +done: /* Clean up on error */ if (!ret_value) { /* Release the index block, if it was protected */ if (iblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", - (unsigned long long)iblock->addr) + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, + "unable to unprotect extensible array index block, address = %llu", + (unsigned long long)iblock->addr) } /* end if */ -END_FUNC(PKG) /* end H5EA__iblock_protect() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__iblock_protect() */ /*------------------------------------------------------------------------- * Function: H5EA__iblock_unprotect @@ -313,22 +338,25 @@ END_FUNC(PKG) /* end H5EA__iblock_protect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags)) +herr_t +H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; - /* Local variables */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(iblock); /* Unprotect the index block */ if (H5AC_unprotect(iblock->hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", - (unsigned long long)iblock->addr) - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to unprotect extensible array index block, address = %llu", + (unsigned long long)iblock->addr) -END_FUNC(PKG) /* end H5EA__iblock_unprotect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__iblock_unprotect() */ /*------------------------------------------------------------------------- * Function: H5EA__iblock_delete @@ -342,10 +370,13 @@ END_FUNC(PKG) /* end H5EA__iblock_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr)) +herr_t +H5EA__iblock_delete(H5EA_hdr_t *hdr) +{ + H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -353,8 +384,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr) /* Protect index block */ if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array index block, address = %llu", + (unsigned long long)hdr->idx_blk_addr) /* Check for index block having data block pointers */ if (iblock->ndblk_addrs > 0) { @@ -370,7 +402,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr) /* Delete data block */ if (H5EA__dblock_delete(hdr, iblock, iblock->dblk_addrs[u], hdr->sblk_info[sblk_idx].dblk_nelmts) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, + "unable to delete extensible array data block") iblock->dblk_addrs[u] = HADDR_UNDEF; } /* end if */ @@ -396,19 +429,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr) /* Delete super block */ if (H5EA__sblock_delete(hdr, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, + "unable to delete extensible array super block") iblock->sblk_addrs[u] = HADDR_UNDEF; - } /* end if */ - } /* end for */ - } /* end if */ + } + } + } - CATCH +done: /* Finished deleting index block in metadata cache */ if (iblock && H5EA__iblock_unprotect(iblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block") -END_FUNC(PKG) /* end H5EA__iblock_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__iblock_delete() */ /*------------------------------------------------------------------------- * Function: H5EA__iblock_dest @@ -422,7 +457,12 @@ END_FUNC(PKG) /* end H5EA__iblock_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *iblock)) +herr_t +H5EA__iblock_dest(H5EA_iblock_t *iblock) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(iblock); @@ -454,7 +494,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *ibl /* Decrement reference count on shared info */ if (H5EA__hdr_decr(iblock->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") iblock->hdr = NULL; } /* end if */ @@ -464,6 +505,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *ibl /* Free the index block itself */ iblock = H5FL_FREE(H5EA_iblock_t, iblock); - CATCH - -END_FUNC(PKG) /* end H5EA__iblock_dest() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__iblock_dest() */ diff --git a/src/H5EAint.c b/src/H5EAint.c index 472cfb4..af7ff4c 100644 --- a/src/H5EAint.c +++ b/src/H5EAint.c @@ -79,8 +79,12 @@ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) +herr_t +H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(parent_entry); @@ -88,11 +92,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Create a flush dependency between parent and child entry */ if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) - H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency") - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") -END_FUNC(PKG) /* end H5EA__create_flush_depend() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__create_flush_depend() */ /*------------------------------------------------------------------------- * Function: H5EA__destroy_flush_depend @@ -106,8 +110,12 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) +herr_t +H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(parent_entry); @@ -115,8 +123,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Destroy a flush dependency between parent and child entry */ if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") -END_FUNC(PKG) /* end H5EA__destroy_flush_depend() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__destroy_flush_depend() */ diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index 8639217..30cb220 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -91,22 +91,25 @@ H5FL_BLK_DEFINE(page_init); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, - H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx)) +H5EA_sblock_t * +H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx) +{ + H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ + H5EA_sblock_t *ret_value = NULL; - /* Local variables */ - H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); /* Allocate memory for the index block */ if (NULL == (sblock = H5FL_CALLOC(H5EA_sblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for extensible array super block") /* Share common array information */ if (H5EA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") sblock->hdr = hdr; /* Set non-zero internal fields */ @@ -121,7 +124,8 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, /* Allocate buffer for data block addresses in super block */ if (NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block data block addresses") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for super block data block addresses") /* Check if # of elements in data blocks requires paging */ if (sblock->dblk_nelmts > hdr->dblk_page_nelmts) { @@ -141,7 +145,8 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, /* Allocate buffer for all 'page init' bitmasks in super block */ if (NULL == (sblock->page_init = H5FL_BLK_CALLOC(page_init, sblock->ndblks * sblock->dblk_page_init_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block page init bitmask") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for super block page init bitmask") /* Compute data block page size */ sblock->dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM; @@ -150,12 +155,13 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, /* Set the return value */ ret_value = sblock; - CATCH +done: if (!ret_value) if (sblock && H5EA__sblock_dest(sblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block") -END_FUNC(PKG) /* end H5EA__sblock_alloc() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__sblock_alloc() */ /*------------------------------------------------------------------------- * Function: H5EA__sblock_create @@ -169,15 +175,16 @@ END_FUNC(PKG) /* end H5EA__sblock_alloc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, - H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed, - unsigned sblk_idx)) +haddr_t +H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed, unsigned sblk_idx) +{ + H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ + haddr_t sblock_addr; /* Extensible array super block address */ + haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + haddr_t ret_value = HADDR_UNDEF; - /* Local variables */ - H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ - haddr_t sblock_addr; /* Extensible array super block address */ - haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */ - hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -185,7 +192,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Allocate the super block */ if (NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "memory allocation failed for extensible array super block") /* Set size of super block on disk */ sblock->size = H5EA_SBLOCK_SIZE(sblock); @@ -195,7 +203,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Allocate space for the super block on disk */ if (HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, (hsize_t)sblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "file allocation failed for extensible array super block") sblock->addr = sblock_addr; /* Reset data block addresses to "undefined" address value */ @@ -203,13 +212,15 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Cache the new extensible array super block */ if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, + "can't add extensible array super block to cache") inserted = TRUE; /* Add super block as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, + "unable to add extensible array entry as child of array proxy") sblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -223,25 +234,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Set address of super block to return */ ret_value = sblock_addr; - CATCH +done: if (!H5F_addr_defined(ret_value)) if (sblock) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(sblock) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array super block from cache") + HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF, + "unable to remove extensible array super block from cache") /* Release super block's disk space */ if (H5F_addr_defined(sblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_SBLOCK, sblock->addr, (hsize_t)sblock->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to release extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to release extensible array super block") /* Destroy super block */ if (H5EA__sblock_dest(sblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to destroy extensible array super block") } /* end if */ -END_FUNC(PKG) /* end H5EA__sblock_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__sblock_create() */ /*------------------------------------------------------------------------- * Function: H5EA__sblock_protect @@ -255,13 +270,15 @@ END_FUNC(PKG) /* end H5EA__sblock_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, - H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx, - unsigned flags)) - - /* Local variables */ +H5EA_sblock_t * +H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx, + unsigned flags) +{ H5EA_sblock_t * sblock = NULL; /* Pointer to super block */ H5EA_sblock_cache_ud_t udata; /* Information needed for loading super block */ + H5EA_sblock_t * ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -279,31 +296,35 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, /* Protect the super block */ if (NULL == (sblock = (H5EA_sblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_SBLOCK, sblk_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", - (unsigned long long)sblk_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, + "unable to protect extensible array super block, address = %llu", + (unsigned long long)sblk_addr) /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == sblock->top_proxy) { /* Add super block as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, + "unable to add extensible array entry as child of array proxy") sblock->top_proxy = hdr->top_proxy; - } /* end if */ + } /* Set return value */ ret_value = sblock; - CATCH +done: /* Clean up on error */ if (!ret_value) { /* Release the super block, if it was protected */ if (sblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", - (unsigned long long)sblock->addr) - } /* end if */ + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, + "unable to unprotect extensible array super block, address = %llu", + (unsigned long long)sblock->addr) + } -END_FUNC(PKG) /* end H5EA__sblock_protect() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__sblock_protect() */ /*------------------------------------------------------------------------- * Function: H5EA__sblock_unprotect @@ -317,22 +338,25 @@ END_FUNC(PKG) /* end H5EA__sblock_protect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags)) +herr_t +H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; - /* Local variables */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(sblock); /* Unprotect the super block */ if (H5AC_unprotect(sblock->hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", - (unsigned long long)sblock->addr) - - CATCH + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to unprotect extensible array super block, address = %llu", + (unsigned long long)sblock->addr) -END_FUNC(PKG) /* end H5EA__sblock_unprotect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__sblock_unprotect() */ /*------------------------------------------------------------------------- * Function: H5EA__sblock_delete @@ -346,12 +370,14 @@ END_FUNC(PKG) /* end H5EA__sblock_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx)) - - /* Local variables */ +herr_t +H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx) +{ H5EA_sblock_t *sblock = NULL; /* Pointer to super block */ size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -359,8 +385,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Protect super block */ if (NULL == (sblock = H5EA__sblock_protect(hdr, parent, sblk_addr, sblk_idx, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", - (unsigned long long)sblk_addr) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect extensible array super block, address = %llu", + (unsigned long long)sblk_addr) /* Iterate over data blocks */ for (u = 0; u < sblock->ndblks; u++) { @@ -368,18 +395,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if (H5F_addr_defined(sblock->dblk_addrs[u])) { /* Delete data block */ if (H5EA__dblock_delete(hdr, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array data block") sblock->dblk_addrs[u] = HADDR_UNDEF; } /* end if */ } /* end for */ - CATCH +done: /* Finished deleting super block in metadata cache */ if (sblock && H5EA__sblock_unprotect(sblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block") -END_FUNC(PKG) /* end H5EA__sblock_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__sblock_delete() */ /*------------------------------------------------------------------------- * Function: H5EA__sblock_dest @@ -393,7 +421,12 @@ END_FUNC(PKG) /* end H5EA__sblock_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sblock)) +herr_t +H5EA__sblock_dest(H5EA_sblock_t *sblock) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(sblock); @@ -413,7 +446,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sbl /* Decrement reference count on shared info */ if (H5EA__hdr_decr(sblock->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") sblock->hdr = NULL; } /* end if */ @@ -423,6 +457,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sbl /* Free the super block itself */ sblock = H5FL_FREE(H5EA_sblock_t, sblock); - CATCH - -END_FUNC(PKG) /* end H5EA__sblock_dest() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__sblock_dest() */ diff --git a/src/H5EAstat.c b/src/H5EAstat.c index 47b9a86..5705cb8 100644 --- a/src/H5EAstat.c +++ b/src/H5EAstat.c @@ -80,17 +80,17 @@ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats)) +herr_t +H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats) +{ + FUNC_ENTER_NOAPI_NOERR - /* Local variables */ - - /* - * Check arguments. - */ + /* Check arguments */ HDassert(ea); HDassert(stats); /* Copy extensible array statistics */ H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats)); -END_FUNC(PRIV) /* end H5EA_get_stats() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA_get_stats() */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index dd669fc..7924eaa 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -119,17 +119,19 @@ H5FL_DEFINE_STATIC(H5EA__ctx_cb_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__test_crt_context(void *_udata)) +static void * +H5EA__test_crt_context(void *_udata) +{ + H5EA__test_ctx_t *ctx; /* Context for callbacks */ + H5EA__ctx_cb_t * udata = (H5EA__ctx_cb_t *)_udata; /* User data for context */ + void * ret_value = NULL; - /* Local variables */ - H5EA__test_ctx_t *ctx; /* Context for callbacks */ - H5EA__ctx_cb_t * udata = (H5EA__ctx_cb_t *)_udata; /* User data for context */ - - /* Sanity checks */ + FUNC_ENTER_STATIC /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "can't allocate extensible array client callback context") /* Initialize the context */ ctx->bogus = H5EA__TEST_BOGUS_VAL; @@ -138,9 +140,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__test_crt_context(void *_udata) /* Set return value */ ret_value = ctx; - CATCH - -END_FUNC(STATIC) /* end H5EA__test_crt_context() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__test_crt_context() */ /*------------------------------------------------------------------------- * Function: H5EA__test_dst_context @@ -155,18 +157,21 @@ END_FUNC(STATIC) /* end H5EA__test_crt_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_dst_context(void *_ctx)) - - /* Local variables */ +static herr_t +H5EA__test_dst_context(void *_ctx) +{ H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); /* Release context structure */ ctx = H5FL_FREE(H5EA__test_ctx_t, ctx); -END_FUNC(STATIC) /* end H5EA__test_dst_context() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__test_dst_context() */ /*------------------------------------------------------------------------- * Function: H5EA__test_fill @@ -181,18 +186,21 @@ END_FUNC(STATIC) /* end H5EA__test_dst_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_fill(void *nat_blk, size_t nelmts)) - - /* Local variables */ +static herr_t +H5EA__test_fill(void *nat_blk, size_t nelmts) +{ uint64_t fill_val = H5EA_TEST_FILL; /* Value to fill elements with */ + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(nat_blk); HDassert(nelmts); H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); -END_FUNC(STATIC) /* end H5EA__test_fill() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__test_fill() */ /*------------------------------------------------------------------------- * Function: H5EA__test_encode @@ -207,12 +215,14 @@ END_FUNC(STATIC) /* end H5EA__test_fill() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)) +static herr_t +H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) +{ + H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ + const uint64_t * elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ - const uint64_t * elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(raw); @@ -223,13 +233,12 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Check for callback action */ if (ctx->cb) { if ((*ctx->cb->encode)(elmt, nelmts, ctx->cb->udata) < 0) - H5E_THROW(H5E_BADVALUE, "extensible array testing callback action failed") - } /* end if */ + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "extensible array testing callback action failed") + } /* Encode native elements into raw elements */ while (nelmts) { - /* Encode element */ - /* (advances 'raw' pointer) */ + /* Encode element - advances 'raw' pointer */ UINT64ENCODE(raw, *elmt); /* Advance native element pointer */ @@ -237,11 +246,11 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Decrement # of elements to encode */ nelmts--; - } /* end while */ + } - CATCH - -END_FUNC(STATIC) /* end H5EA__test_encode() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__test_encode() */ /*------------------------------------------------------------------------- * Function: H5EA__test_decode @@ -256,16 +265,17 @@ END_FUNC(STATIC) /* end H5EA__test_encode() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx)) - -/* Local variables */ +static herr_t +H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx) +{ #ifndef NDEBUG H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ #endif /* NDEBUG */ uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(raw); HDassert(elmt); @@ -274,8 +284,7 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Decode raw elements into native elements */ while (nelmts) { - /* Decode element */ - /* (advances 'raw' pointer) */ + /* Decode element - advances 'raw' pointer */ UINT64DECODE(raw, *elmt); /* Advance native element pointer */ @@ -283,9 +292,10 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Decrement # of elements to decode */ nelmts--; - } /* end while */ + } -END_FUNC(STATIC) /* end H5EA__test_decode() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__test_decode() */ /*------------------------------------------------------------------------- * Function: H5EA__test_debug @@ -300,12 +310,13 @@ END_FUNC(STATIC) /* end H5EA__test_decode() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)) - - /* Local variables */ +static herr_t +H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt) +{ char temp_str[128]; /* Temporary string, for formatting */ + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(stream); HDassert(elmt); @@ -315,7 +326,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, (unsigned long long)*(const uint64_t *)elmt); -END_FUNC(STATIC) /* end H5EA__test_debug() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__test_debug() */ /*------------------------------------------------------------------------- * Function: H5EA__test_crt_dbg_context @@ -329,22 +341,25 @@ END_FUNC(STATIC) /* end H5EA__test_debug() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr)) - - /* Local variables */ +static void * +H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr) +{ H5EA__ctx_cb_t *ctx; /* Context for callbacks */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5EA__ctx_cb_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, + "can't allocate extensible array client callback context") /* Set return value */ ret_value = ctx; - CATCH - -END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__test_crt_dbg_context() */ /*------------------------------------------------------------------------- * Function: H5EA__test_dst_dbg_context @@ -358,17 +373,20 @@ END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_dst_dbg_context(void *_ctx)) - - /* Local variables */ +static herr_t +H5EA__test_dst_dbg_context(void *_ctx) +{ H5EA__ctx_cb_t *ctx = (H5EA__ctx_cb_t *)_ctx; /* Callback context to destroy */ + FUNC_ENTER_STATIC_NOERR + HDassert(_ctx); /* Release context structure */ ctx = H5FL_FREE(H5EA__ctx_cb_t, ctx); -END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__test_dst_dbg_context() */ /*------------------------------------------------------------------------- * Function: H5EA__get_cparam_test @@ -383,7 +401,10 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) +herr_t +H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam) +{ + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(ea); @@ -397,7 +418,8 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__get_cparam_test(const H5EA_t *e cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts; cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits; -END_FUNC(PKG) /* end H5EA__get_cparam_test() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5EA__get_cparam_test() */ /*------------------------------------------------------------------------- * Function: H5EA__cmp_cparam_test @@ -412,39 +434,48 @@ END_FUNC(PKG) /* end H5EA__get_cparam_test() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, - H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) +int +H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2) +{ + int ret_value = 0; - /* Check arguments. */ + FUNC_ENTER_PACKAGE_NOERR + + /* Check arguments */ HDassert(cparam1); HDassert(cparam2); /* Compare creation parameters for array */ if (cparam1->raw_elmt_size < cparam2->raw_elmt_size) - H5_LEAVE(-1) + HGOTO_DONE(-1) else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size) - H5_LEAVE(1) + HGOTO_DONE(1) + if (cparam1->max_nelmts_bits < cparam2->max_nelmts_bits) - H5_LEAVE(-1) + HGOTO_DONE(-1) else if (cparam1->max_nelmts_bits > cparam2->max_nelmts_bits) - H5_LEAVE(1) + HGOTO_DONE(1) + if (cparam1->idx_blk_elmts < cparam2->idx_blk_elmts) - H5_LEAVE(-1) + HGOTO_DONE(-1) else if (cparam1->idx_blk_elmts > cparam2->idx_blk_elmts) - H5_LEAVE(1) + HGOTO_DONE(1) + if (cparam1->sup_blk_min_data_ptrs < cparam2->sup_blk_min_data_ptrs) - H5_LEAVE(-1) + HGOTO_DONE(-1) else if (cparam1->sup_blk_min_data_ptrs > cparam2->sup_blk_min_data_ptrs) - H5_LEAVE(1) + HGOTO_DONE(1) + if (cparam1->data_blk_min_elmts < cparam2->data_blk_min_elmts) - H5_LEAVE(-1) + HGOTO_DONE(-1) else if (cparam1->data_blk_min_elmts > cparam2->data_blk_min_elmts) - H5_LEAVE(1) + HGOTO_DONE(1) + if (cparam1->max_dblk_page_nelmts_bits < cparam2->max_dblk_page_nelmts_bits) - H5_LEAVE(-1) + HGOTO_DONE(-1) else if (cparam1->max_dblk_page_nelmts_bits > cparam2->max_dblk_page_nelmts_bits) - H5_LEAVE(1) - - CATCH + HGOTO_DONE(1) -END_FUNC(PKG) /* end H5EA__cmp_cparam_test() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5EA__cmp_cparam_test() */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 4cd8b70..cd567aa 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -180,53 +180,6 @@ extern int H5E_mpi_error_str_len; } #endif /* H5_HAVE_PARALLEL */ -/******************************************************************************/ -/* Revisions to Error Macros, to go with Revisions to FUNC_ENTER/LEAVE Macros */ -/******************************************************************************/ - -/* - * H5E_PRINTF macro, used to facilitate error reporting between a BEGIN_FUNC() - * and an END_FUNC() within a function body. The arguments are the minor - * error number, a description of the error (as a printf-like format string), - * and an optional set of arguments for the printf format arguments. - */ -#define H5E_PRINTF(...) \ - H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__) - -/* - * H5_LEAVE macro, used to facilitate control flow between a - * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is - * the return value. - * The return value is assigned to a variable `ret_value' and control branches - * to the `catch_except' label, if we're not already past it. - */ -#define H5_LEAVE(v) \ - { \ - ret_value = v; \ - if (!past_catch) \ - goto catch_except; \ - } - -/* - * H5E_THROW macro, used to facilitate error reporting between a - * FUNC_ENTER() and a FUNC_LEAVE() within a function body. The arguments are - * the minor error number, and an error string. - * The return value is assigned to a variable `ret_value' and control branches - * to the `catch_except' label, if we're not already past it. - */ -#define H5E_THROW(...) \ - { \ - H5E_PRINTF(__VA_ARGS__); \ - H5_LEAVE(fail_value) \ - } - -/* Macro for "catching" flow of control when an error occurs. Note that the - * H5_LEAVE macro won't jump back here once it's past this point. - */ -#define CATCH \ -catch_except:; \ - past_catch = TRUE; - /* Library-private functions defined in H5E package */ H5_DLL herr_t H5E_init(void); H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, diff --git a/src/H5FA.c b/src/H5FA.c index 05b0bd8..ad69ee2 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -105,39 +105,40 @@ H5FL_BLK_DEFINE(fa_native_elmt); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, H5FA_t *, NULL, NULL, - H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata)) +static H5FA_t * +H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata) +{ + H5FA_t * fa = NULL; /* Pointer to new fixed array */ + H5FA_hdr_t *hdr = NULL; /* The fixed array header information */ + H5FA_t * ret_value = NULL; - /* Local variables */ - H5FA_t * fa = NULL; /* Pointer to new fixed array */ - H5FA_hdr_t *hdr = NULL; /* The fixed array header information */ + FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(fa_addr)); /* Allocate fixed array wrapper */ if (NULL == (fa = H5FL_CALLOC(H5FA_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array info") /* Lock the array header into memory */ if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to load fixed array header") /* Check for pending array deletion */ if (from_open && hdr->pending_delete) - H5E_THROW(H5E_CANTOPENOBJ, "can't open fixed array pending deletion") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTOPENOBJ, NULL, "can't open fixed array pending deletion") /* Point fixed array wrapper at header and bump it's ref count */ fa->hdr = hdr; if (H5FA__hdr_incr(fa->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") /* Increment # of files using this array header */ if (H5FA__hdr_fuse_incr(fa->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, + "can't increment file reference count on shared array header") /* Set file pointer for this array open context */ fa->f = f; @@ -145,15 +146,15 @@ BEGIN_FUNC(STATIC, ERR, H5FA_t *, NULL, NULL, /* Set the return value */ ret_value = fa; - CATCH - +done: if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL, "unable to release fixed array header") if (!ret_value) if (fa && H5FA_close(fa) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") + HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array") -END_FUNC(STATIC) /* end H5FA__new() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__new() */ /*------------------------------------------------------------------------- * Function: H5FA_create @@ -168,16 +169,16 @@ END_FUNC(STATIC) /* end H5FA__new() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL, - H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)) - - /* Local variables */ +H5FA_t * +H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) +{ H5FA_t *fa = NULL; /* Pointer to new fixed array */ haddr_t fa_addr; /* Fixed array header address */ + H5FA_t *ret_value = NULL; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(NULL) + + /* Check arguments */ HDassert(f); HDassert(cparam); @@ -186,22 +187,23 @@ BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL, /* Create fixed array header */ if (HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, cparam, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "can't create fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "can't create fixed array header") /* Allocate and initialize new fixed array wrapper */ if (NULL == (fa = H5FA__new(f, fa_addr, FALSE, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, + "allocation and/or initialization failed for fixed array wrapper") /* Set the return value */ ret_value = fa; - CATCH - +done: if (!ret_value) if (fa && H5FA_close(fa) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") + HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array") -END_FUNC(PRIV) /* end H5FA_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA_create() */ /*------------------------------------------------------------------------- * Function: H5FA_open @@ -216,31 +218,33 @@ END_FUNC(PRIV) /* end H5FA_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL, H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata)) +H5FA_t * +H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata) +{ + H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */ + H5FA_t *ret_value = NULL; - /* Local variables */ - H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */ + FUNC_ENTER_NOAPI(NULL) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(fa_addr)); /* Allocate and initialize new fixed array wrapper */ if (NULL == (fa = H5FA__new(f, fa_addr, TRUE, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, + "allocation and/or initialization failed for fixed array wrapper") /* Set the return value */ ret_value = fa; - CATCH - +done: if (!ret_value) if (fa && H5FA_close(fa) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") + HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array") -END_FUNC(PRIV) /* end H5FA_open() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA_open() */ /*------------------------------------------------------------------------- * Function: H5FA_get_nelmts @@ -254,20 +258,20 @@ END_FUNC(PRIV) /* end H5FA_open() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts)) - - /* Local variables */ +herr_t +H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts) +{ + FUNC_ENTER_NOAPI_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(fa); HDassert(nelmts); /* Retrieve the current number of elements in the fixed array */ *nelmts = fa->hdr->stats.nelmts; -END_FUNC(PRIV) /* end H5FA_get_nelmts() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA_get_nelmts() */ /*------------------------------------------------------------------------- * Function: H5FA_get_addr @@ -281,13 +285,12 @@ END_FUNC(PRIV) /* end H5FA_get_nelmts() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_addr(const H5FA_t *fa, haddr_t *addr)) - - /* Local variables */ +herr_t +H5FA_get_addr(const H5FA_t *fa, haddr_t *addr) +{ + FUNC_ENTER_NOAPI_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(fa); HDassert(fa->hdr); HDassert(addr); @@ -295,7 +298,8 @@ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_addr(const H5FA_t *fa, hadd /* Retrieve the address of the fixed array's header */ *addr = fa->hdr->addr; -END_FUNC(PRIV) /* end H5FA_get_addr() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA_get_addr() */ /*------------------------------------------------------------------------- * Function: H5FA_set @@ -309,9 +313,9 @@ END_FUNC(PRIV) /* end H5FA_get_addr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt)) - - /* Local variables */ +herr_t +H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt) +{ H5FA_hdr_t * hdr = fa->hdr; /* Header for fixed array */ H5FA_dblock_t * dblock = NULL; /* Pointer to fixed array Data block */ H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to fixed array Data block page */ @@ -319,10 +323,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t unsigned dblk_page_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting FIxed Array Data block page */ hbool_t hdr_dirty = FALSE; /* Whether header information changed */ + herr_t ret_value = SUCCEED; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ HDassert(fa); HDassert(fa->hdr); @@ -334,15 +339,16 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t /* Create the data block */ hdr->dblk_addr = H5FA__dblock_create(hdr, &hdr_dirty); if (!H5F_addr_defined(hdr->dblk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create fixed array data block") - } /* end if */ + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create fixed array data block") + } HDassert(idx < hdr->cparam.nelmts); /* Protect data block */ if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)hdr->dblk_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect fixed array data block, address = %llu", + (unsigned long long)hdr->dblk_addr) /* Check for paging data block */ if (!dblock->npages) { @@ -375,7 +381,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { /* Create the data block page */ if (H5FA__dblk_page_create(hdr, dblk_page_addr, dblk_page_nelmts) < 0) - H5E_THROW(H5E_CANTCREATE, "unable to create data block page") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page") /* Mark data block page as initialized in data block */ H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE); @@ -385,8 +391,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t /* Protect the data block page */ if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect fixed array data block page, address = %llu", + (unsigned long long)dblk_page_addr) /* Set the element in the data block page */ H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, @@ -394,19 +401,20 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t dblk_page_cache_flags |= H5AC__DIRTIED_FLAG; } /* end else */ - CATCH +done: /* Check for header modified */ if (hdr_dirty) if (H5FA__hdr_modified(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as modified") + HDONE_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as modified") /* Release resources */ if (dblock && H5FA__dblock_unprotect(dblock, dblock_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block") if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, dblk_page_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page") -END_FUNC(PRIV) /* end H5FA_set() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA_set() */ /*------------------------------------------------------------------------- * Function: H5FA_get @@ -420,16 +428,17 @@ END_FUNC(PRIV) /* end H5FA_set() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt)) - - /* Local variables */ +herr_t +H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt) +{ H5FA_hdr_t * hdr = fa->hdr; /* Header for FA */ H5FA_dblock_t * dblock = NULL; /* Pointer to data block for FA */ H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for FA */ + herr_t ret_value = SUCCEED; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ HDassert(fa); HDassert(fa->hdr); @@ -440,14 +449,15 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t if (!H5F_addr_defined(hdr->dblk_addr)) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value") } /* end if */ else { /* Get the data block */ HDassert(H5F_addr_defined(hdr->dblk_addr)); if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)hdr->dblk_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect fixed array data block, address = %llu", + (unsigned long long)hdr->dblk_addr) /* Check for paged data block */ if (!dblock->npages) @@ -464,10 +474,10 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value") /* We've retrieved the value, leave now */ - H5_LEAVE(SUCCEED) + HGOTO_DONE(SUCCEED) } /* end if */ else { /* get the page */ size_t dblk_page_nelmts; /* # of elements in a data block page */ @@ -490,9 +500,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t /* Protect the data block page */ if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, - "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect fixed array data block page, address = %llu", + (unsigned long long)dblk_page_addr) /* Retrieve element from data block */ H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), @@ -501,13 +511,14 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t } /* end else */ } /* end else */ - CATCH +done: if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block") if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page") -END_FUNC(PRIV) /* end H5FA_get() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA_get() */ /*------------------------------------------------------------------------- * Function: H5FA_close @@ -521,18 +532,19 @@ END_FUNC(PRIV) /* end H5FA_get() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa)) - - /* Local variables */ +herr_t +H5FA_close(H5FA_t *fa) +{ hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */ haddr_t fa_addr = HADDR_UNDEF; /* Address of array (for deletion) */ + herr_t ret_value = SUCCEED; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ HDassert(fa); - /* Close the header, if it was set */ + /* Close the header if it was set */ if (fa->hdr) { /* Decrement file reference & check if this is the last open fixed array using the shared array header */ @@ -562,7 +574,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa)) /* Check the header's status in the metadata cache */ if (H5AC_get_entry_status(fa->f, fa_addr, &hdr_status) < 0) - H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, + "unable to check metadata cache status for fixed array header") /* Sanity checks on header */ HDassert(hdr_status & H5AC_ES__IN_CACHE); @@ -574,7 +587,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa)) /* Lock the array header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ if (NULL == (hdr = H5FA__hdr_protect(fa->f, fa_addr, NULL, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTLOAD, "unable to load fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTLOAD, FAIL, "unable to load fixed array header") /* Set the shared array header's file context for this operation */ hdr->f = fa->f; @@ -584,11 +597,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa)) * immediately -QAK) */ if (H5FA__hdr_decr(fa->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") /* Delete array, starting with header (unprotects header) */ if (H5FA__hdr_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array") } /* end if */ else { /* Decrement the reference count on the array header */ @@ -596,16 +610,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa)) * immediately -QAK) */ if (H5FA__hdr_decr(fa->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") } /* end else */ } /* end if */ /* Release the fixed array wrapper */ fa = H5FL_FREE(H5FA_t, fa); - CATCH - -END_FUNC(PRIV) /* end H5FA_close() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA_close() */ /*------------------------------------------------------------------------- * Function: H5FA_delete @@ -619,21 +634,22 @@ END_FUNC(PRIV) /* end H5FA_close() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata)) +herr_t +H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata) +{ + H5FA_hdr_t *hdr = NULL; /* The fixed array header information */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5FA_hdr_t *hdr = NULL; /* The fixed array header information */ + FUNC_ENTER_NOAPI(FAIL) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(fa_addr)); /* Lock the array header into memory */ if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", - (unsigned long long)fa_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array header, address = %llu", + (unsigned long long)fa_addr) /* Check for files using shared array header */ if (hdr->file_rc) @@ -644,17 +660,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_delete(H5F_t *f, haddr_t fa_ad /* Delete array now, starting with header (unprotects header) */ if (H5FA__hdr_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array") hdr = NULL; - } /* end if */ - - CATCH + } - /* Unprotect the header, if an error occurred */ +done: + /* Unprotect the header if an error occurred */ if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header") -END_FUNC(PRIV) /* end H5FA_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA_delete() */ /*------------------------------------------------------------------------- * Function: H5FA_iterate @@ -671,44 +687,44 @@ END_FUNC(PRIV) /* end H5FA_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR, - H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata)) - - /* Local variables */ +int +H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata) +{ uint8_t *elmt = NULL; hsize_t u; - int cb_ret = H5_ITER_CONT; /* Return value from callback */ + int ret_value = H5_ITER_CONT; - /* - * Check arguments. - */ + FUNC_ENTER_NOAPI(H5_ITER_ERROR) + + /* Check arguments */ HDassert(fa); HDassert(op); HDassert(udata); /* Allocate space for a native array element */ if (NULL == (elmt = H5FL_BLK_MALLOC(fa_native_elmt, fa->hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, H5_ITER_ERROR, + "memory allocation failed for fixed array element") /* Iterate over all elements in array */ - for (u = 0; u < fa->hdr->stats.nelmts && cb_ret == H5_ITER_CONT; u++) { + for (u = 0; u < fa->hdr->stats.nelmts && ret_value == H5_ITER_CONT; u++) { /* Get array element */ if (H5FA_get(fa, u, elmt) < 0) - H5E_THROW(H5E_CANTGET, "unable to delete fixed array") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array") - /* Make callback */ - if ((cb_ret = (*op)(u, elmt, udata)) < 0) { - H5E_PRINTF(H5E_BADITER, "iterator function failed"); - H5_LEAVE(cb_ret) - } /* end if */ - } /* end for */ - - CATCH + /* Invoke callback */ + if ((ret_value = (*op)(u, elmt, udata)) < 0) { + HERROR(H5E_FARRAY, H5E_BADITER, "iteration callback error"); + break; + } + } +done: if (elmt) elmt = H5FL_BLK_FREE(fa_native_elmt, elmt); -END_FUNC(PRIV) /* end H5FA_iterate() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA_iterate() */ /*------------------------------------------------------------------------- * Function: H5FA_depend @@ -723,14 +739,15 @@ END_FUNC(PRIV) /* end H5FA_iterate() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent)) +herr_t +H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent) +{ + H5FA_hdr_t *hdr = fa->hdr; /* Header for FA */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5FA_hdr_t *hdr = fa->hdr; /* Header for FA */ + FUNC_ENTER_NOAPI(FAIL) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(fa); HDassert(hdr); HDassert(parent); @@ -749,13 +766,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_depend(H5FA_t *fa, H5AC_proxy_ /* Add the fixed array as a child of the parent (proxy) */ if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array as child of proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "unable to add fixed array as child of proxy") hdr->parent = parent; - } /* end if */ - - CATCH + } -END_FUNC(PRIV) /* end H5FA_depend() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA_depend() */ /*------------------------------------------------------------------------- * Function: H5FA_patch_file @@ -769,17 +786,17 @@ END_FUNC(PRIV) /* end H5FA_depend() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_patch_file(H5FA_t *fa, H5F_t *f)) +herr_t +H5FA_patch_file(H5FA_t *fa, H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOERR - /* Local variables */ - - /* - * Check arguments. - */ + /* Check arguments */ HDassert(fa); HDassert(f); if (fa->f != f || fa->hdr->f != f) fa->f = fa->hdr->f = f; -END_FUNC(PRIV) /* end H5FA_patch_file() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA_patch_file() */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 1b127c7..367b4b0 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -167,12 +167,13 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) +{ H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata; /* User data for callback */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->f); @@ -181,7 +182,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5FA_HEADER_SIZE_FILE(udata->f); -END_FUNC(STATIC) /* end H5FA__cache_hdr_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__cache_hdr_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_hdr_verify_chksum @@ -196,13 +198,15 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -213,7 +217,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_hdr_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_hdr_deserialize @@ -228,16 +233,18 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, + hbool_t H5_ATTR_UNUSED *dirty) +{ H5FA_cls_id_t id; /* ID of fixed array class, as found in file */ H5FA_hdr_t * hdr = NULL; /* Fixed array info */ H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata; const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(udata); @@ -246,24 +253,24 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate space for the fixed array data structure */ if (NULL == (hdr = H5FA__hdr_alloc(udata->f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array shared header") /* Set the fixed array header's address */ hdr->addr = udata->addr; /* Magic number */ if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5FA_HDR_VERSION) - H5E_THROW(H5E_VERSION, "wrong fixed array header version") + HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array header version") /* Fixed array class */ id = (H5FA_cls_id_t)*image++; if (id >= H5FA_NUM_CLS_ID) - H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") + HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class") hdr->cparam.cls = H5FA_client_class_g[id]; /* General array creation/configuration information */ @@ -311,20 +318,20 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Finish initializing fixed array header */ if (H5FA__hdr_init(hdr, udata->ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "initialization failed for fixed array header") HDassert(hdr->size == len); /* Set return value */ ret_value = hdr; - CATCH - +done: /* Release resources */ if (!ret_value) if (hdr && H5FA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header") -END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_hdr_deserialize() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_hdr_image_len @@ -338,12 +345,13 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len) +{ const H5FA_hdr_t *hdr = (const H5FA_hdr_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(hdr); HDassert(image_len); @@ -351,7 +359,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = hdr->size; -END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__cache_hdr_image_len() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_hdr_serialize @@ -365,15 +374,16 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) - - /* Local variables */ +static herr_t +H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the fixed array header */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ - /* check arguments */ + FUNC_ENTER_STATIC_NOERR + + /* Check arguments */ HDassert(f); HDassert(image); HDassert(hdr); @@ -410,7 +420,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); -END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__cache_hdr_serialize() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_hdr_notify @@ -424,11 +435,13 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) +{ + H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(hdr); @@ -460,16 +473,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Destroy flush dependency on object header proxy */ if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between fixed array and proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between fixed array and proxy") hdr->parent = NULL; } /* end if */ /* Detach from 'top' proxy for fixed array */ if (hdr->top_proxy) { if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, + HGOTO_ERROR( + H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between header and fixed array 'top' proxy") /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ } /* end if */ @@ -477,7 +490,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ @@ -486,9 +499,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, else HDassert(NULL == hdr->parent); - CATCH +done: -END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_hdr_notify() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_hdr_free_icr @@ -503,18 +517,23 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_hdr_free_icr(void *thing)) +static herr_t +H5FA__cache_hdr_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the extensible array header */ if (H5FA__hdr_dest((H5FA_hdr_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free fixed array header") - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array header") -END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_hdr_free_icr() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblock_get_initial_load_size @@ -528,14 +547,15 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) +{ H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data */ H5FA_dblock_t dblock; /* Fake data block for computing size */ size_t dblk_page_nelmts; /* # of elements per data block page */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->hdr); @@ -564,7 +584,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, else *image_len = (size_t)H5FA_DBLOCK_PREFIX_SIZE(&dblock); -END_FUNC(STATIC) /* end H5FA__cache_dblock_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__cache_dblock_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblock_verify_chksum @@ -579,13 +600,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -596,7 +619,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblock_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblock_deserialize @@ -611,16 +635,18 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, + hbool_t H5_ATTR_UNUSED *dirty) +{ H5FA_dblock_t * dblock = NULL; /* Data block info */ H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data for loading data block */ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ haddr_t arr_addr; /* Address of array header in the file */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(udata); @@ -628,7 +654,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the fixed array data block */ if (NULL == (dblock = H5FA__dblock_alloc(udata->hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block") HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock))) || (len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock))); @@ -638,27 +664,27 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Magic number */ if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array data block signature") image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5FA_DBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong fixed array data block version") + HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array data block version") /* Fixed array type */ if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") + HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array header address") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header address") /* Page initialization flags */ if (dblock->npages > 0) { H5MM_memcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size); image += dblock->dblk_page_init_size; - } /* end if */ + } /* Only decode elements if the data block is not paged */ if (!dblock->npages) { @@ -666,9 +692,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, (size_t)udata->hdr->cparam.nelmts, udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements") image += (udata->hdr->cparam.nelmts * udata->hdr->cparam.raw_elmt_size); - } /* end if */ + } /* Sanity check */ /* (allow for checksum not decoded yet) */ @@ -688,14 +714,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = dblock; - CATCH - +done: /* Release resources */ if (!ret_value) if (dblock && H5FA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block") -END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblock_deserialize() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblock_image_len @@ -709,12 +735,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len) +{ const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblock); HDassert(image_len); @@ -725,7 +752,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, else *image_len = H5FA_DBLOCK_PREFIX_SIZE(dblock); -END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__cache_dblock_image_len() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblock_serialize @@ -739,14 +767,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, - void *_thing)) - - /* Local variables */ +static herr_t +H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing) +{ H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(f); @@ -773,7 +802,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Store the 'page init' bitmasks */ H5MM_memcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size); image += dblock->dblk_page_init_size; - } /* end if */ + } /* Only encode elements if the data block is not paged */ if (!dblock->npages) { @@ -783,9 +812,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5_CHECK_OVERFLOW(dblock->hdr->cparam.nelmts, /* From: */ hsize_t, /* To: */ size_t); if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, (size_t)dblock->hdr->cparam.nelmts, dblock->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements") image += (dblock->hdr->cparam.nelmts * dblock->hdr->cparam.raw_elmt_size); - } /* end if */ + } /* Compute metadata checksum */ metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); @@ -796,9 +825,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); - CATCH - -END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblock_serialize() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblock_notify @@ -812,11 +841,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)) +static herr_t +H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) +{ + H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; + herr_t ret_value = SUCCEED; - /* Local variables */ - H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; + FUNC_ENTER_STATIC /* Sanity check */ HDassert(dblock); @@ -829,8 +860,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on parent */ if (H5FA__create_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW( - H5E_CANTDEPEND, + HGOTO_ERROR( + H5E_FARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block and header, address = %llu", (unsigned long long)dblock->addr) break; @@ -842,35 +873,35 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, case H5AC_NOTIFY_ACTION_CHILD_CLEANED: case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5FA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") /* Detach from 'top' proxy for fixed array */ if (dblock->top_proxy) { if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block " - "and fixed array 'top' proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block " + "and fixed array 'top' proxy") dblock->top_proxy = NULL; - } /* end if */ + } break; default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") +#else HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ +#endif } /* end switch */ } /* end if */ - CATCH - -END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblock_notify() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblock_free_icr @@ -885,20 +916,24 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblock_free_icr(void *_thing)) +static herr_t +H5FA__cache_dblock_free_icr(void *_thing) +{ + H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; - H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC /* Check arguments */ HDassert(dblock); /* Release the fixed array data block */ if (H5FA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "can't free fixed array data block") - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block") -END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblock_free_icr() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblock_fsf_size @@ -929,11 +964,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)) - +static herr_t +H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) +{ const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblock); HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); @@ -942,7 +979,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, *fsf_size = dblock->size; -END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__cache_dblock_fsf_size() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblk_page_get_initial_load_size @@ -956,12 +994,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)) - - /* Local variables */ +static herr_t +H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len) +{ H5FA_dblk_page_cache_ud_t *udata = (H5FA_dblk_page_cache_ud_t *)_udata; /* User data */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(udata); HDassert(udata->hdr); @@ -971,7 +1010,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = (size_t)H5FA_DBLK_PAGE_SIZE(udata->hdr, udata->nelmts); -END_FUNC(STATIC) /* end H5FA__cache_dblk_page_get_initial_load_size() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__cache_dblk_page_get_initial_load_size() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblk_page_verify_chksum @@ -986,13 +1026,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_get_initial_load_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, - H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) - - /* Local variables */ +static htri_t +H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata) +{ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; + + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(image); @@ -1003,7 +1045,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, if (stored_chksum != computed_chksum) ret_value = FALSE; -END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblk_page_verify_chksum() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblk_page_deserialize @@ -1018,18 +1061,19 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty)) - - /* Local variables */ +static void * +H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) +{ H5FA_dblk_page_t * dblk_page = NULL; /* Data block page info */ H5FA_dblk_page_cache_ud_t *udata = (H5FA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ + void * ret_value = NULL; /* Sanity check */ + FUNC_ENTER_STATIC + HDassert(udata); HDassert(udata->hdr); HDassert(udata->nelmts > 0); @@ -1037,7 +1081,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Allocate the fixed array data block page */ if (NULL == (dblk_page = H5FA__dblk_page_alloc(udata->hdr, udata->nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for fixed array data block page") /* Set the fixed array data block's information */ dblk_page->addr = udata->dblk_page_addr; @@ -1047,7 +1092,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Decode elements in data block page */ /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements") image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); /* Sanity check */ @@ -1068,14 +1113,15 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = dblk_page; - CATCH +done: /* Release resources */ if (!ret_value) if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page") -END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblk_page_deserialize() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblk_page_image_len @@ -1089,12 +1135,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)) - - /* Local variables */ +static herr_t +H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len) +{ const H5FA_dblk_page_t *dblk_page = (const H5FA_dblk_page_t *)_thing; /* Pointer to the object */ + FUNC_ENTER_STATIC_NOERR + /* Check arguments */ HDassert(dblk_page); HDassert(image_len); @@ -1102,7 +1149,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Set the image length size */ *image_len = dblk_page->size; -END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__cache_dblk_page_image_len() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblk_page_serialize @@ -1116,14 +1164,16 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, - size_t H5_ATTR_UNUSED len, void *_thing)) - - /* Local variables */ +static herr_t +H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, + void *_thing) +{ H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object to serialize */ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -1138,7 +1188,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Convert from native elements in memory into raw elements on disk */ if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->nelmts, dblk_page->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements") image += (dblk_page->nelmts * dblk_page->hdr->cparam.raw_elmt_size); /* Compute metadata checksum */ @@ -1150,9 +1200,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) == len); - CATCH - -END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblk_page_serialize() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblk_page_notify @@ -1166,11 +1216,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, - H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)) - - /* Local variables */ +static herr_t +H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) +{ H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Sanity check */ HDassert(dblk_page); @@ -1187,8 +1239,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, /* Detach from 'top' proxy for fixed array */ if (dblk_page->top_proxy) { if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page " - "and fixed array 'top' proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, + "unable to destroy flush dependency between data block page " + "and fixed array 'top' proxy") dblk_page->top_proxy = NULL; } /* end if */ break; @@ -1204,15 +1257,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") #else /* NDEBUG */ HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ - CATCH - -END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblk_page_notify() */ /*------------------------------------------------------------------------- * Function: H5FA__cache_dblk_page_free_icr @@ -1227,15 +1280,20 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblk_page_free_icr(void *thing)) +static herr_t +H5FA__cache_dblk_page_free_icr(void *thing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* Check arguments */ HDassert(thing); /* Release the fixed array data block page */ if (H5FA__dblk_page_dest((H5FA_dblk_page_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free fixed array data block page") - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block page") -END_FUNC(STATIC) /* end H5FA__cache_dblk_page_free_icr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__cache_dblk_page_free_icr() */ diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index 8c2c9a8..a69c078 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -79,13 +79,16 @@ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5FA_class_t *cls, haddr_t obj_addr)) - +herr_t +H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, + haddr_t obj_addr) +{ /* Local variables */ - H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ - void * dbg_ctx = NULL; /* Fixed array debugging context */ + H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ + void * dbg_ctx = NULL; /* Fixed array debugging context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -100,11 +103,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context") /* Load the fixed array header */ if (NULL == (hdr = H5FA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header") /* Print opening message */ HDfprintf(stream, "%*sFixed Array Header...\n", indent, ""); @@ -126,13 +129,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Fixed Array Data Block Address:", hdr->dblk_addr); - CATCH +done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context") if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header") -END_FUNC(PKG) /* end H5FA__hdr_debug() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_debug() */ /*------------------------------------------------------------------------- * Function: H5FA__dblock_debug @@ -146,15 +150,18 @@ END_FUNC(PKG) /* end H5FA__hdr_debug() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr)) - +herr_t +H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, + haddr_t hdr_addr, haddr_t obj_addr) +{ /* Local variables */ - H5FA_hdr_t * hdr = NULL; /* Shared fixed array header */ - H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ - void * dbg_ctx = NULL; /* Fixed array context */ - size_t u; /* Local index variable */ + H5FA_hdr_t * hdr = NULL; /* Shared fixed array header */ + H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ + void * dbg_ctx = NULL; /* Fixed array context */ + size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -170,16 +177,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context") /* Load the fixed array header */ if (NULL == (hdr = H5FA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header") /* Protect data block */ if (NULL == (dblock = H5FA__dblock_protect(hdr, addr, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect fixed array data block, address = %llu", (unsigned long long)addr) /* Print opening message */ HDfprintf(stream, "%*sFixed Array data Block...\n", indent, ""); @@ -222,9 +229,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, - "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect fixed array data block page, address = %llu", + (unsigned long long)dblk_page_addr) HDfprintf(stream, "%*sElements in page %zu:\n", indent, "", page_idx); for (u = 0; u < dblk_page_nelmts; u++) { @@ -232,10 +239,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging") } /* end for */ if (H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to release fixed array data block page") /* Advance to next page address */ dblk_page_addr += dblock->dblk_page_size; @@ -250,16 +258,17 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging") } /* end for */ } /* end else */ - CATCH +done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context") if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block") if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header") -END_FUNC(PKG) /* end H5FA__dblock_debug() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblock_debug() */ diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index 0f5ee29..1dca0fb 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -84,21 +84,25 @@ H5FL_BLK_DEFINE(page_elmts); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts)) - - /* Local variables */ +H5FA_dblk_page_t * +H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts) +{ H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */ + H5FA_dblk_page_t *ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); /* Allocate memory for the data block */ if (NULL == (dblk_page = H5FL_CALLOC(H5FA_dblk_page_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for fixed array data block page") /* Share common array information */ if (H5FA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") dblk_page->hdr = hdr; /* Set non-zero internal fields */ @@ -106,37 +110,41 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, H5FA__dblk_page_alloc(H5FA_ /* Allocate buffer for elements in data block page */ if (NULL == (dblk_page->elmts = H5FL_BLK_MALLOC(page_elmts, nelmts * hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for data block page element buffer") /* Set the return value */ ret_value = dblk_page; - CATCH +done: if (!ret_value) if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page") -END_FUNC(PKG) /* end H5FA__dblk_page_alloc() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblk_page_alloc() */ /*------------------------------------------------------------------------- * Function: H5FA__dblk_page_create * * Purpose: Creates a new fixed array data block page in the file * - * Return: Valid file address on success/HADDR_UNDEF on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts)) - - /* Local variables */ +herr_t +H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts) +{ H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); @@ -147,7 +155,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Allocate the data block page */ if (NULL == (dblk_page = H5FA__dblk_page_alloc(hdr, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, FAIL, + "memory allocation failed for fixed array data block page") /* Set info about data block page on disk */ dblk_page->addr = addr; @@ -158,34 +167,38 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Clear any elements in data block page to fill value */ if ((hdr->cparam.cls->fill)(dblk_page->elmts, nelmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set fixed array data block page elements to class's fill value") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, + "can't set fixed array data block page elements to class's fill value") /* Cache the new fixed array data block page */ if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, FAIL, "can't add fixed array data block page to cache") inserted = TRUE; /* Add data block page as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, + "unable to add fixed array entry as child of array proxy") dblk_page->top_proxy = hdr->top_proxy; } /* end if */ - CATCH +done: if (ret_value < 0) if (dblk_page) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(dblk_page) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block page from cache") + HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, FAIL, + "unable to remove fixed array data block page from cache") /* Destroy data block page */ if (H5FA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "unable to destroy fixed array data block page") } /* end if */ -END_FUNC(PKG) /* end H5FA__dblk_page_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblk_page_create() */ /*------------------------------------------------------------------------- * Function: H5FA__dblk_page_protect @@ -200,13 +213,14 @@ END_FUNC(PKG) /* end H5FA__dblk_page_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, - H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, - unsigned flags)) - - /* Local variables */ +H5FA_dblk_page_t * +H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags) +{ H5FA_dblk_page_t * dblk_page = NULL; /* Fixed array data block page */ H5FA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */ + H5FA_dblk_page_t * ret_value = NULL; + + FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG HDfprintf(stderr, "%s: Called\n", FUNC); @@ -227,32 +241,36 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, /* Protect the data block page */ if (NULL == (dblk_page = (H5FA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, + "unable to protect fixed array data block page, address = %llu", + (unsigned long long)dblk_page_addr) /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == dblk_page->top_proxy) { /* Add data block page as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL, + "unable to add fixed array entry as child of array proxy") dblk_page->top_proxy = hdr->top_proxy; } /* end if */ /* Set return value */ ret_value = dblk_page; - CATCH +done: /* Clean up on error */ if (!ret_value) { /* Release the data block page, if it was protected */ if (dblk_page && H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu", - (unsigned long long)dblk_page->addr) + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL, + "unable to unprotect fixed array data block page, address = %llu", + (unsigned long long)dblk_page->addr) } /* end if */ -END_FUNC(PKG) /* end H5FA__dblk_page_protect() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblk_page_protect() */ /*------------------------------------------------------------------------- * Function: H5FA__dblk_page_unprotect @@ -267,10 +285,12 @@ END_FUNC(PKG) /* end H5FA__dblk_page_protect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags)) +herr_t +H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; -/* Local variables */ + FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG HDfprintf(stderr, "%s: Called\n", FUNC); @@ -281,12 +301,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Unprotect the data block page */ if (H5AC_unprotect(dblk_page->hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu", - (unsigned long long)dblk_page->addr) - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to unprotect fixed array data block page, address = %llu", + (unsigned long long)dblk_page->addr) -END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblk_page_unprotect() */ /*------------------------------------------------------------------------- * Function: H5FA__dblk_page_dest @@ -300,7 +321,12 @@ END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page)) +herr_t +H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dblk_page); @@ -315,7 +341,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_ /* Decrement reference count on shared info */ if (H5FA__hdr_decr(dblk_page->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") dblk_page->hdr = NULL; } /* end if */ @@ -325,6 +352,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_ /* Free the data block page itself */ dblk_page = H5FL_FREE(H5FA_dblk_page_t, dblk_page); - CATCH - -END_FUNC(PKG) /* end H5FA__dblk_page_dest() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblk_page_dest() */ diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c index 21e2e03..1ccc97d 100644 --- a/src/H5FAdblock.c +++ b/src/H5FAdblock.c @@ -88,10 +88,13 @@ H5FL_BLK_DEFINE(fa_page_init); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t *hdr)) +H5FA_dblock_t * +H5FA__dblock_alloc(H5FA_hdr_t *hdr) +{ + H5FA_dblock_t *dblock = NULL; /* fixed array data block */ + H5FA_dblock_t *ret_value = NULL; - /* Local variables */ - H5FA_dblock_t *dblock = NULL; /* fixed array data block */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); @@ -99,11 +102,11 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t /* Allocate memory for the data block */ if (NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block") /* Share common array information */ if (H5FA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") dblock->hdr = hdr; /* Set non-zero internal fields */ @@ -126,7 +129,7 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t /* Allocate space for 'page init' flags */ if (NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for page init bitmask") /* Compute data block page size */ dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; @@ -143,19 +146,20 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t /* Allocate buffer for elements in data block */ H5_CHECK_OVERFLOW(dblk_size, /* From: */ hsize_t, /* To: */ size_t); if (NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for data block element buffer") } /* end else */ /* Set the return value */ ret_value = dblock; - CATCH - +done: if (!ret_value) if (dblock && H5FA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block") -END_FUNC(PKG) /* end H5FA__dblock_alloc() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblock_alloc() */ /*------------------------------------------------------------------------- * Function: H5FA__dblock_create @@ -169,13 +173,15 @@ END_FUNC(PKG) /* end H5FA__dblock_alloc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, - H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty)) +haddr_t +H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty) +{ + H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ + haddr_t dblock_addr; /* Fixed array data block address */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + haddr_t ret_value = HADDR_UNDEF; - /* Local variables */ - H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ - haddr_t dblock_addr; /* Fixed array data block address */ - hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -183,31 +189,35 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Allocate the data block */ if (NULL == (dblock = H5FA__dblock_alloc(hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "memory allocation failed for fixed array data block") /* Set size of data block on disk */ hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock); /* Allocate space for the data block on disk */ if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, (hsize_t)dblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "file allocation failed for fixed array data block") dblock->addr = dblock_addr; /* Don't initialize elements if paged */ if (!dblock->npages) /* Clear any elements in data block to fill value */ if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)hdr->cparam.nelmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set fixed array data block elements to class's fill value") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF, + "can't set fixed array data block elements to class's fill value") /* Cache the new fixed array data block */ if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array data block to cache") inserted = TRUE; /* Add data block as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF, + "unable to add fixed array entry as child of array proxy") dblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -217,26 +227,28 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Set address of data block to return */ ret_value = dblock_addr; - CATCH +done: if (!H5F_addr_defined(ret_value)) if (dblock) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(dblock) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block from cache") + HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, HADDR_UNDEF, + "unable to remove fixed array data block from cache") /* Release data block's disk space */ if (H5F_addr_defined(dblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to release fixed array data block") /* Destroy data block */ if (H5FA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy fixed array data block") } /* end if */ -END_FUNC(PKG) /* end H5FA__dblock_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblock_create() */ /*------------------------------------------------------------------------- * Function: H5FA__dblock_protect @@ -250,12 +262,14 @@ END_FUNC(PKG) /* end H5FA__dblock_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, - H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags)) +H5FA_dblock_t * +H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags) +{ + H5FA_dblock_t * dblock = NULL; /* Fixed array data block */ + H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */ + H5FA_dblock_t * ret_value = NULL; - /* Local variables */ - H5FA_dblock_t * dblock; /* Fixed array data block */ - H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -271,31 +285,33 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, /* Protect the data block */ if (NULL == (dblock = (H5FA_dblock_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLOCK, dblk_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)dblk_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, + "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr) /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == dblock->top_proxy) { /* Add data block as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL, + "unable to add fixed array entry as child of array proxy") dblock->top_proxy = hdr->top_proxy; } /* end if */ /* Set return value */ ret_value = dblock; - CATCH - +done: /* Clean up on error */ if (!ret_value) /* Release the data block, if it was protected */ if (dblock && H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu", - (unsigned long long)dblock->addr) + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL, + "unable to unprotect fixed array data block, address = %llu", + (unsigned long long)dblock->addr) -END_FUNC(PKG) /* end H5FA__dblock_protect() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblock_protect() */ /*------------------------------------------------------------------------- * Function: H5FA__dblock_unprotect @@ -309,22 +325,25 @@ END_FUNC(PKG) /* end H5FA__dblock_protect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags)) +herr_t +H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; - /* Local variables */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dblock); /* Unprotect the data block */ if (H5AC_unprotect(dblock->hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu", - (unsigned long long)dblock->addr) - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to unprotect fixed array data block, address = %llu", + (unsigned long long)dblock->addr) -END_FUNC(PKG) /* end H5FA__dblock_unprotect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblock_unprotect() */ /*------------------------------------------------------------------------- * Function: H5FA__dblock_delete @@ -338,10 +357,13 @@ END_FUNC(PKG) /* end H5FA__dblock_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr)) +herr_t +H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr) +{ + H5FA_dblock_t *dblock = NULL; /* Pointer to data block */ + herr_t ret_value = SUCCEED; - /* Local variables */ - H5FA_dblock_t *dblock = NULL; /* Pointer to data block */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -349,8 +371,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr, /* Protect data block */ if (NULL == (dblock = H5FA__dblock_protect(hdr, dblk_addr, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)dblk_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, + "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr) /* Check if data block is paged */ if (dblock->npages) { @@ -365,21 +387,22 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr, /* Evict the data block page from the metadata cache */ /* (OK to call if it doesn't exist in the cache) */ if (H5AC_expunge_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTEXPUNGE, FAIL, + "unable to remove array data block page from metadata cache") /* Advance to next page address */ dblk_page_addr += dblock->dblk_page_size; } /* end for */ } /* end if */ - CATCH - +done: /* Finished deleting data block in metadata cache */ if (dblock && H5FA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block") -END_FUNC(PKG) /* end H5FA__dblock_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblock_delete() */ /*------------------------------------------------------------------------- * Function: H5FA__dblock_dest @@ -393,7 +416,12 @@ END_FUNC(PKG) /* end H5FA__dblock_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dblock)) +herr_t +H5FA__dblock_dest(H5FA_dblock_t *dblock) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dblock); @@ -417,7 +445,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dbl /* Decrement reference count on shared info */ if (H5FA__hdr_decr(dblock->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL, + "can't decrement reference count on shared array header") dblock->hdr = NULL; } /* end if */ @@ -427,6 +456,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dbl /* Free the data block itself */ dblock = H5FL_FREE(H5FA_dblock_t, dblock); - CATCH - -END_FUNC(PKG) /* end H5FA__dblock_dest() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__dblock_dest() */ diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 867160f..aeb3fb1 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -82,17 +82,20 @@ H5FL_DEFINE_STATIC(H5FA_hdr_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, H5FA__hdr_alloc(H5F_t *f)) +H5FA_hdr_t * +H5FA__hdr_alloc(H5F_t *f) +{ + H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */ + H5FA_hdr_t *ret_value = NULL; - /* Local variables */ - H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); /* Allocate space for the shared information */ if (NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for Fixed Array shared header") /* Set non-zero internal fields */ hdr->addr = HADDR_UNDEF; @@ -106,13 +109,12 @@ BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, H5FA__hdr_alloc(H5F_t *f)) /* Set the return value */ ret_value = hdr; - CATCH - +done: if (!ret_value) if (hdr && H5FA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header") - -END_FUNC(PKG) /* end H5FA__hdr_alloc() */ + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_alloc() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_init @@ -126,9 +128,12 @@ END_FUNC(PKG) /* end H5FA__hdr_alloc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata)) +herr_t +H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata) +{ + herr_t ret_value = SUCCEED; - /* Local variables */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); @@ -140,33 +145,36 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_init(H5FA_hdr_t *hdr, void hdr->stats.nelmts = hdr->cparam.nelmts; /* Create the callback context, if there's one */ - if (hdr->cparam.cls->crt_context) { + if (hdr->cparam.cls->crt_context) if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) - H5E_THROW(H5E_CANTCREATE, "unable to create fixed array client callback context") - } /* end if */ + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, + "unable to create fixed array client callback context") - CATCH - -END_FUNC(PKG) /* end H5FA__hdr_init() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_init() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_create * * Purpose: Creates a new Fixed Array header in the file * - * Return: SUCCEED/FAIL + * Return: Success: Address of new header in the file + * Failure: HADDR_UNDEF * * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, - H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)) +haddr_t +H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) +{ + H5FA_hdr_t *hdr = NULL; /* Fixed array header */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + haddr_t ret_value = HADDR_UNDEF; - /* Local variables */ - H5FA_hdr_t *hdr = NULL; /* Fixed array header */ - hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -176,17 +184,19 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, { /* Check for valid parameters */ if (cparam->raw_elmt_size == 0) - H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero") if (cparam->max_dblk_page_nelmts_bits == 0) - H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, + "max. # of elements bits must be greater than zero") if (cparam->nelmts == 0) - H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "# of elements must be greater than zero") } #endif /* NDEBUG */ /* Allocate space for the shared information */ if (NULL == (hdr = H5FA__hdr_alloc(f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, + "memory allocation failed for Fixed Array shared header") hdr->dblk_addr = HADDR_UNDEF; @@ -195,50 +205,52 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, /* Finish initializing fixed array header */ if (H5FA__hdr_init(hdr, ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, HADDR_UNDEF, "initialization failed for fixed array header") /* Allocate space for the header on disk */ if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, (hsize_t)hdr->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for Fixed Array header") /* Create 'top' proxy for extensible array entries */ if (hdr->swmr_write) if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create fixed array entry proxy") /* Cache the new Fixed Array header */ if (H5AC_insert_entry(f, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array header to cache") inserted = TRUE; /* Add header as child of 'top' proxy */ if (hdr->top_proxy) if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF, + "unable to add fixed array entry as child of array proxy") /* Set address of array header to return */ ret_value = hdr->addr; - CATCH - +done: if (!H5F_addr_defined(ret_value)) if (hdr) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(hdr) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array header from cache") + HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, HADDR_UNDEF, + "unable to remove fixed array header from cache") /* Release header's disk space */ if (H5F_addr_defined(hdr->addr) && H5MF_xfree(f, H5FD_MEM_FARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to free Fixed Array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free Fixed Array header") /* Destroy header */ if (H5FA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy Fixed Array header") - } /* end if */ + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy Fixed Array header") + } -END_FUNC(PKG) /* end H5FA__hdr_create() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_create() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_incr @@ -252,7 +264,12 @@ END_FUNC(PKG) /* end H5FA__hdr_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_incr(H5FA_hdr_t *hdr)) +herr_t +H5FA__hdr_incr(H5FA_hdr_t *hdr) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -260,14 +277,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_incr(H5FA_hdr_t *hdr)) /* Mark header as un-evictable when something is depending on it */ if (hdr->rc == 0) if (H5AC_pin_protected_entry(hdr) < 0) - H5E_THROW(H5E_CANTPIN, "unable to pin fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPIN, FAIL, "unable to pin fixed array header") /* Increment reference count on shared header */ hdr->rc++; - CATCH - -END_FUNC(PKG) /* end H5FA__hdr_incr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_incr() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_decr @@ -281,7 +298,12 @@ END_FUNC(PKG) /* end H5FA__hdr_incr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_decr(H5FA_hdr_t *hdr)) +herr_t +H5FA__hdr_decr(H5FA_hdr_t *hdr) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -294,12 +316,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_decr(H5FA_hdr_t *hdr)) if (hdr->rc == 0) { HDassert(hdr->file_rc == 0); if (H5AC_unpin_entry(hdr) < 0) - H5E_THROW(H5E_CANTUNPIN, "unable to unpin fixed array header") - } /* end if */ - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin fixed array header") + } -END_FUNC(PKG) /* end H5FA__hdr_decr() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_decr() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_fuse_incr @@ -313,7 +335,10 @@ END_FUNC(PKG) /* end H5FA__hdr_decr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr)) +herr_t +H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr) +{ + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -321,21 +346,28 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr)) /* Increment file reference count on shared header */ hdr->file_rc++; -END_FUNC(PKG) /* end H5FA__hdr_fuse_incr() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__hdr_fuse_incr() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_fuse_decr * * Purpose: Decrement file reference count on shared array header * - * Return: SUCCEED/FAIL + * Return: Success: The reference count of the header + * Failure: Can't fail * * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr)) +size_t +H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr) +{ + size_t ret_value = 0; + + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -347,7 +379,8 @@ BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr)) /* Set return value */ ret_value = hdr->file_rc; -END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_fuse_decr() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_modified @@ -361,18 +394,23 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_modified(H5FA_hdr_t *hdr)) +herr_t +H5FA__hdr_modified(H5FA_hdr_t *hdr) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); /* Mark header as dirty in cache */ if (H5AC_mark_entry_dirty(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as dirty") - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as dirty") -END_FUNC(PKG) /* end H5FA__hdr_modified() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_modified() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_protect @@ -386,12 +424,14 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, - H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags)) - - /* Local variables */ +H5FA_hdr_t * +H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags) +{ H5FA_hdr_t * hdr; /* Fixed array header */ H5FA_hdr_cache_ud_t udata; /* User data for cache callbacks */ + H5FA_hdr_t * ret_value = NULL; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -407,27 +447,28 @@ BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, /* Protect the header */ if (NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, H5AC_FARRAY_HDR, fa_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", - (unsigned long long)fa_addr) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to protect fixed array header, address = %llu", + (unsigned long long)fa_addr) hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ /* Create top proxy, if it doesn't exist */ if (hdr->swmr_write && NULL == hdr->top_proxy) { /* Create 'top' proxy for fixed array entries */ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, NULL, "can't create fixed array entry proxy") /* Add header as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") - } /* end if */ + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL, + "unable to add fixed array entry as child of array proxy") + } /* Set return value */ ret_value = hdr; - CATCH - -END_FUNC(PKG) /* end H5FA__hdr_protect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_protect() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_unprotect @@ -441,21 +482,24 @@ END_FUNC(PKG) /* end H5FA__hdr_protect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags)) +herr_t +H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; - /* Local variables */ + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); /* Unprotect the header */ if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array hdr, address = %llu", - (unsigned long long)hdr->addr) - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr) -END_FUNC(PKG) /* end H5FA__hdr_unprotect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_unprotect() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_delete @@ -469,46 +513,49 @@ END_FUNC(PKG) /* end H5FA__hdr_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_delete(H5FA_hdr_t *hdr)) - - /* Local variables */ +herr_t +H5FA__hdr_delete(H5FA_hdr_t *hdr) +{ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); HDassert(!hdr->file_rc); #ifndef NDEBUG - { - unsigned hdr_status = 0; /* Array header's status in the metadata cache */ - /* Check the array header's status in the metadata cache */ - if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) - H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header") + unsigned hdr_status = 0; /* Array header's status in the metadata cache */ + + /* Check the array header's status in the metadata cache */ + if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header") + + /* Sanity checks on array header */ + HDassert(hdr_status & H5AC_ES__IN_CACHE); + HDassert(hdr_status & H5AC_ES__IS_PROTECTED); - /* Sanity checks on array header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PROTECTED); - } /* end block */ #endif /* NDEBUG */ /* Check for Fixed Array Data block */ if (H5F_addr_defined(hdr->dblk_addr)) { /* Delete Fixed Array Data block */ if (H5FA__dblock_delete(hdr, hdr->dblk_addr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block") - } /* end if */ + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array data block") + } /* Set flags to finish deleting header on unprotect */ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; - CATCH - +done: /* Unprotect the header, deleting it if an error hasn't occurred */ if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header") -END_FUNC(PKG) /* end H5FA__hdr_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_delete() */ /*------------------------------------------------------------------------- * Function: H5FA__hdr_dest @@ -522,7 +569,12 @@ END_FUNC(PKG) /* end H5FA__hdr_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_dest(H5FA_hdr_t *hdr)) +herr_t +H5FA__hdr_dest(H5FA_hdr_t *hdr) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(hdr); @@ -531,20 +583,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_dest(H5FA_hdr_t *hdr)) /* Destroy the callback context */ if (hdr->cb_ctx) { if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array client callback context") - } /* end if */ + HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, + "unable to destroy fixed array client callback context") + } hdr->cb_ctx = NULL; /* Destroy the 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array 'top' proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy fixed array 'top' proxy") hdr->top_proxy = NULL; - } /* end if */ + } /* Free the shared info itself */ hdr = H5FL_FREE(H5FA_hdr_t, hdr); - CATCH - -END_FUNC(PKG) /* end H5FA__hdr_dest() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__hdr_dest() */ diff --git a/src/H5FAint.c b/src/H5FAint.c index 864c7ee..2206901 100644 --- a/src/H5FAint.c +++ b/src/H5FAint.c @@ -79,8 +79,12 @@ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) +herr_t +H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(parent_entry); @@ -88,11 +92,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Create a flush dependency between parent and child entry */ if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) - H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency") - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") -END_FUNC(PKG) /* end H5FA__create_flush_depend() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__create_flush_depend() */ /*------------------------------------------------------------------------- * Function: H5FA__destroy_flush_depend @@ -106,8 +110,12 @@ END_FUNC(PKG) /* end H5FA__create_flush_depend() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, - H5FA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) +herr_t +H5FA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(parent_entry); @@ -115,8 +123,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Destroy a flush dependency between parent and child entry */ if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") - - CATCH + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") -END_FUNC(PKG) /* end H5FA__destroy_flush_depend() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__destroy_flush_depend() */ diff --git a/src/H5FAstat.c b/src/H5FAstat.c index 1fdf47f..98f7195 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -78,21 +78,21 @@ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats)) - -/* Local variables */ +herr_t +H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats) +{ + FUNC_ENTER_NOAPI_NOERR #ifdef H5FA_DEBUG HDfprintf(stderr, "%s: Called\n", FUNC); #endif /* H5FA_DEBUG */ - /* - * Check arguments. - */ + /* Check arguments */ HDassert(fa); HDassert(stats); /* Copy fixed array statistics */ H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats)); -END_FUNC(PRIV) /* end H5FA_get_stats() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA_get_stats() */ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index 6dd6e00..384a657 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -112,14 +112,17 @@ H5FL_DEFINE_STATIC(H5FA__test_ctx_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__test_crt_context(void H5_ATTR_UNUSED *udata)) - - /* Local variables */ +static void * +H5FA__test_crt_context(void H5_ATTR_UNUSED *udata) +{ H5FA__test_ctx_t *ctx; /* Context for callbacks */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context") /* Initialize the context */ ctx->bogus = H5FA__TEST_BOGUS_VAL; @@ -127,9 +130,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__test_crt_context(void H5_ATTR_ /* Set return value */ ret_value = ctx; - CATCH - -END_FUNC(STATIC) /* end H5FA__test_crt_context() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FA__test_crt_context() */ /*------------------------------------------------------------------------- * Function: H5FA__test_dst_context @@ -143,18 +146,21 @@ END_FUNC(STATIC) /* end H5FA__test_crt_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_dst_context(void *_ctx)) - - /* Local variables */ +static herr_t +H5FA__test_dst_context(void *_ctx) +{ H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); /* Release context structure */ ctx = H5FL_FREE(H5FA__test_ctx_t, ctx); -END_FUNC(STATIC) /* end H5FA__test_dst_context() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__test_dst_context() */ /*------------------------------------------------------------------------- * Function: H5FA__test_fill @@ -168,18 +174,21 @@ END_FUNC(STATIC) /* end H5FA__test_dst_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_fill(void *nat_blk, size_t nelmts)) - - /* Local variables */ +static herr_t +H5FA__test_fill(void *nat_blk, size_t nelmts) +{ uint64_t fill_val = H5FA_TEST_FILL; /* Value to fill elements with */ + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(nat_blk); HDassert(nelmts); H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); -END_FUNC(STATIC) /* end H5FA__test_fill() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__test_fill() */ /*------------------------------------------------------------------------- * Function: H5FA__test_encode @@ -193,14 +202,15 @@ END_FUNC(STATIC) /* end H5FA__test_fill() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__test_encode(void *raw, const void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx)) - -/* Local variables */ +static herr_t +H5FA__test_encode(void *raw, const void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx) +{ #ifndef NDEBUG H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ -#endif /* NDEBUG */ - const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ +#endif + const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ + + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(raw); @@ -221,7 +231,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, nelmts--; } /* end while */ -END_FUNC(STATIC) /* end H5FA__test_encode() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__test_encode() */ /*------------------------------------------------------------------------- * Function: H5FA__test_decode @@ -235,15 +246,16 @@ END_FUNC(STATIC) /* end H5FA__test_encode() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx)) - -/* Local variables */ +static herr_t +H5FA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx) +{ #ifndef NDEBUG H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ -#endif /* NDEBUG */ - uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ - const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ +#endif + uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ + const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ + + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(raw); @@ -264,7 +276,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, nelmts--; } /* end while */ -END_FUNC(STATIC) /* end H5FA__test_decode() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__test_decode() */ /*------------------------------------------------------------------------- * Function: H5FA__test_debug @@ -278,12 +291,13 @@ END_FUNC(STATIC) /* end H5FA__test_decode() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, - H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)) - - /* Local variables */ +static herr_t +H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt) +{ char temp_str[128]; /* Temporary string, for formatting */ + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(stream); HDassert(elmt); @@ -293,7 +307,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, (unsigned long long)*(const uint64_t *)elmt); -END_FUNC(STATIC) /* end H5FA__test_debug() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FA__test_debug() */ /*------------------------------------------------------------------------- * Function: H5FA__test_crt_dbg_context @@ -308,15 +323,17 @@ END_FUNC(STATIC) /* end H5FA__test_debug() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, - H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr)) - - /* Local variables */ +static void * +H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr) +{ H5FA__test_ctx_t *ctx; /* Context for callbacks */ + void * ret_value = NULL; + + FUNC_ENTER_STATIC /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context") /* Initialize the context */ ctx->bogus = H5FA__TEST_BOGUS_VAL; @@ -324,9 +341,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, /* Set return value */ ret_value = ctx; - CATCH - -END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FA__test_crt_dbg_context() */ /*------------------------------------------------------------------------- * Function: H5FA__get_cparam_test @@ -340,7 +357,10 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) +herr_t +H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam) +{ + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(fa); @@ -350,22 +370,27 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__get_cparam_test(const H5FA_t *f cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size; cparam->nelmts = fa->hdr->cparam.nelmts; -END_FUNC(PKG) /* end H5FA__get_cparam_test() */ + FUNC_LEAVE_NOAPI(SUCCEED); +} /* end H5FA__get_cparam_test() */ /*------------------------------------------------------------------------- * Function: H5FA__cmp_cparam_test * * Purpose: Compare the parameters used to create the fixed array * - * Return: SUCCEED/FAIL + * Return: An integer value like strcmp * * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, - H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)) +int +H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2) +{ + int ret_value = 0; + + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(cparam1); @@ -373,10 +398,10 @@ BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, /* Compare creation parameters for array */ if (cparam1->raw_elmt_size < cparam2->raw_elmt_size) - H5_LEAVE(-1) + ret_value = -1; else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size) - H5_LEAVE(1) + ret_value = 1; - CATCH + FUNC_LEAVE_NOAPI(ret_value) -END_FUNC(PKG) /* end H5FA__cmp_cparam_test() */ +} /* end H5FA__cmp_cparam_test() */ diff --git a/src/H5HL.c b/src/H5HL.c index ca83445..1f2369a 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -98,11 +98,15 @@ H5FL_BLK_DEFINE(lheap_chunk); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/)) - +herr_t +H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/) +{ H5HL_t * heap = NULL; /* Heap created */ H5HL_prfx_t *prfx = NULL; /* Heap prefix */ hsize_t total_size = 0; /* Total heap size on disk */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) /* check arguments */ HDassert(f); @@ -115,12 +119,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_h /* Allocate new heap structure */ if (NULL == (heap = H5HL__new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f)))) - H5E_THROW(H5E_CANTALLOC, "can't allocate new heap struct"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate new heap struct"); /* Allocate file space */ total_size = heap->prfx_size + size_hint; if (HADDR_UNDEF == (heap->prfx_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, total_size))) - H5E_THROW(H5E_CANTALLOC, "unable to allocate file memory"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file memory"); /* Initialize info */ heap->single_cache_obj = TRUE; @@ -128,52 +132,52 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_h heap->dblk_size = size_hint; if (size_hint) if (NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* free list */ if (size_hint) { if (NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); heap->freelist->offset = 0; heap->freelist->size = size_hint; heap->freelist->prev = heap->freelist->next = NULL; heap->free_block = 0; - } /* end if */ + } else { heap->freelist = NULL; heap->free_block = H5HL_FREE_NULL; - } /* end else */ + } /* Allocate the heap prefix */ if (NULL == (prfx = H5HL__prfx_new(heap))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Add to cache */ if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) - H5E_THROW(H5E_CANTINIT, "unable to cache local heap prefix"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap prefix"); /* Set address to return */ *addr_p = heap->prfx_addr; - CATCH +done: if (ret_value < 0) { *addr_p = HADDR_UNDEF; if (prfx) { if (FAIL == H5HL__prfx_dest(prfx)) - H5E_THROW(H5E_CANTFREE, "unable to destroy local heap prefix"); - } /* end if */ + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix"); + } else { if (heap) { if (H5F_addr_defined(heap->prfx_addr)) if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, heap->prfx_addr, total_size)) - H5E_THROW(H5E_CANTFREE, "can't release heap data?"); + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release heap data?"); if (FAIL == H5HL__dest(heap)) - H5E_THROW(H5E_CANTFREE, "unable to destroy local heap"); - } /* end if */ - } /* end else */ - } /* end if */ - -END_FUNC(PRIV) /* end H5HL_create() */ + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap"); + } + } + } + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_create() */ /*------------------------------------------------------------------------- * Function: H5HL__minimize_heap_space @@ -188,16 +192,19 @@ END_FUNC(PRIV) /* end H5HL_create() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap)) - +static herr_t +H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap) +{ size_t new_heap_size = heap->dblk_size; /* New size of heap */ + herr_t ret_value = SUCCEED; - /* check args */ + FUNC_ENTER_STATIC + + /* Check args */ HDassert(f); HDassert(heap); - /* - * Check to see if we can reduce the size of the heap in memory by + /* Check to see if we can reduce the size of the heap in memory by * eliminating free blocks at the tail of the buffer before flushing the * buffer out. */ @@ -211,29 +218,25 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t * if (tmp_fl->offset + tmp_fl->size == heap->dblk_size) { last_fl = tmp_fl; break; - } /* end if */ + } - /* - * Found free block at the end of the buffer, decide what to do + /* Found free block at the end of the buffer, decide what to do * about it */ if (last_fl) { - /* - * If the last free block's size is more than half the memory + /* If the last free block's size is more than half the memory * buffer size (and the memory buffer is larger than the * minimum size), reduce or eliminate it. */ if (last_fl->size >= (heap->dblk_size / 2) && heap->dblk_size > H5HL_MIN_HEAP) { - /* - * Reduce size of buffer until it's too small or would + /* Reduce size of buffer until it's too small or would * eliminate the free block */ while (new_heap_size > H5HL_MIN_HEAP && new_heap_size >= (last_fl->offset + H5HL_SIZEOF_FREE(f))) new_heap_size /= 2; - /* - * Check if reducing the memory buffer size would + /* Check if reducing the memory buffer size would * eliminate the free block */ if (new_heap_size < (last_fl->offset + H5HL_SIZEOF_FREE(f))) { @@ -246,31 +249,29 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t * last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); - } /* end if */ + } else { - /* - * Set the size of the memory buffer to the start + /* Set the size of the memory buffer to the start * of the free list */ new_heap_size = last_fl->offset; /* Eliminate the free block from the list */ last_fl = H5HL__remove_free(heap, last_fl); - } /* end else */ - } /* end if */ + } + } else { /* Truncate the free block */ last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); - } /* end else */ - } /* end if */ - } /* end if */ - } /* end if */ + } + } + } + } - /* - * If the heap grew smaller than disk storage then move the + /* If the heap grew smaller than disk storage then move the * data segment of the heap to another contiguous block of disk * storage. */ @@ -279,17 +280,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t * /* Resize the memory buffer */ if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Reallocate data block in file */ if (FAIL == H5HL__dblk_realloc(f, heap, new_heap_size)) - H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed"); - } /* end if */ - - CATCH - /* No special processing on errors */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed"); + } -END_FUNC(STATIC) /* H5HL__minimize_heap_space() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HL__minimize_heap_space() */ /*------------------------------------------------------------------------- * Function: H5HL_protect @@ -304,20 +304,24 @@ END_FUNC(STATIC) /* H5HL__minimize_heap_space() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags)) - +H5HL_t * +H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags) +{ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ H5HL_dblk_t * dblk = NULL; /* Local heap data block */ H5HL_t * heap = NULL; /* Heap data structure */ unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */ unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */ + H5HL_t * ret_value = NULL; - /* check arguments */ + FUNC_ENTER_NOAPI(NULL) + + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); - /* only the H5AC__READ_ONLY_FLAG may appear in flags */ + /* Only the H5AC__READ_ONLY_FLAG may appear in flags */ HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Construct the user data for protect callback */ @@ -328,7 +332,7 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr, /* Protect the local heap prefix */ if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap prefix"); /* Get the pointer to the heap */ heap = prfx->heap; @@ -344,12 +348,12 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr, /* Protect the local heap data block */ if (NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block"); /* Set the flag for pinning the data block when unprotecting it */ dblk_cache_flags |= H5AC__PIN_ENTRY_FLAG; - } /* end if */ - } /* end if */ + } + } /* Increment # of times heap is protected */ heap->prots++; @@ -357,16 +361,17 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr, /* Set return value */ ret_value = heap; - CATCH +done: /* Release the prefix from the cache, now pinned */ if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix"); /* Release the data block from the cache, now pinned */ if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block"); + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block"); -END_FUNC(PRIV) /* end H5HL_protect() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_protect() */ /*------------------------------------------------------------------------- * Function: H5HL_offset_into @@ -374,26 +379,31 @@ END_FUNC(PRIV) /* end H5HL_protect() */ * Purpose: Called directly after the call to H5HL_protect so that * a pointer to the object in the heap can be obtained. * - * Return: Success: Valid pointer. - * Failure: Can't fail + * Return: Success: Valid pointer + * Failure: NULL * * Programmer: Bill Wendling * Sept. 17, 2003 * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, void *, NULL, NULL, H5HL_offset_into(const H5HL_t *heap, size_t offset)) +void * +H5HL_offset_into(const H5HL_t *heap, size_t offset) +{ + void *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) /* Sanity check */ HDassert(heap); if (offset >= heap->dblk_size) - H5E_THROW(H5E_CANTGET, "unable to offset into local heap data block"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, NULL, "unable to offset into local heap data block"); ret_value = heap->dblk_image + offset; - CATCH -/* No special processing on errors */ -END_FUNC(PRIV) /* end H5HL_offset_into() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_offset_into() */ /*------------------------------------------------------------------------- * Function: H5HL_unprotect @@ -407,9 +417,14 @@ END_FUNC(PRIV) /* end H5HL_offset_into() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap)) +herr_t +H5HL_unprotect(H5HL_t *heap) +{ + herr_t ret_value = SUCCEED; - /* check arguments */ + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ HDassert(heap); /* Decrement # of times heap is protected */ @@ -421,8 +436,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap)) if (heap->single_cache_obj) { /* Mark local heap prefix as evictable again */ if (FAIL == H5AC_unpin_entry(heap->prfx)) - H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block"); - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block"); + } else { /* Sanity check */ HDassert(heap->dblk); @@ -430,14 +445,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap)) /* Mark local heap data block as evictable again */ /* (data block still pins prefix) */ if (FAIL == H5AC_unpin_entry(heap->dblk)) - H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block"); - } /* end else */ - } /* end if */ - - CATCH - /* No special processing on errors */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block"); + } + } -END_FUNC(PRIV) /* end H5HL_unprotect() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_unprotect() */ /*------------------------------------------------------------------------- * Function: H5HL__remove_free @@ -452,7 +466,12 @@ END_FUNC(PRIV) /* end H5HL_unprotect() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, NOERR, H5HL_free_t *, NULL, -, H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl)) +static H5HL_free_t * +H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl) +{ + H5HL_free_t *ret_value = NULL; + + FUNC_ENTER_STATIC_NOERR if (fl->prev) fl->prev->next = fl->next; @@ -465,7 +484,8 @@ BEGIN_FUNC(STATIC, NOERR, H5HL_free_t *, NULL, -, H5HL__remove_free(H5HL_t *heap /* H5FL_FREE always returns NULL so we can't check for errors */ ret_value = (H5HL_free_t *)H5FL_FREE(H5HL_free_t, fl); -END_FUNC(STATIC) /* end H5HL__remove_free() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__remove_free() */ /*------------------------------------------------------------------------- * Function: H5HL__dirty @@ -479,9 +499,14 @@ END_FUNC(STATIC) /* end H5HL__remove_free() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__dirty(H5HL_t *heap)) +static herr_t +H5HL__dirty(H5HL_t *heap) +{ + herr_t ret_value = SUCCEED; - /* check arguments */ + FUNC_ENTER_STATIC + + /* Check arguments */ HDassert(heap); HDassert(heap->prfx); @@ -491,17 +516,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__dirty(H5HL_t *heap)) HDassert(heap->dblk); if (FAIL == H5AC_mark_entry_dirty(heap->dblk)) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap data block as dirty"); - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty"); + } /* Mark heap prefix as dirty */ if (FAIL == H5AC_mark_entry_dirty(heap->prfx)) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap prefix as dirty"); - - CATCH - /* No special processing on errors */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap prefix as dirty"); -END_FUNC(STATIC) /* end H5HL__dirty() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__dirty() */ /*------------------------------------------------------------------------- * Function: H5HL_insert @@ -519,13 +543,16 @@ END_FUNC(STATIC) /* end H5HL__dirty() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, - H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out)) - +herr_t +H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out) +{ H5HL_free_t *fl = NULL, *last_fl = NULL; size_t need_size; size_t offset = 0; hbool_t found; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(f); @@ -541,7 +568,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, * if an error occurs -QAK) */ if (FAIL == H5HL__dirty(heap)) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty"); /* In order to keep the free list descriptors aligned on word boundaries, * whatever that might mean, we round the size up to the next multiple of @@ -574,7 +601,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, /* Track free space that's closest to end of heap */ last_fl = fl; } - } /* end for */ + } /* If no free chunk was large enough, then allocate more space and * add it to the free list. If the heap ends with a free chunk, we @@ -612,7 +639,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, was_extended = H5MF_try_extend(f, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), (hsize_t)need_more); if (FAIL == was_extended) - H5E_THROW(H5E_CANTEXTEND, "error trying to extend heap"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "error trying to extend heap"); /* Check if we extended the heap data block in file */ if (was_extended == TRUE) { @@ -620,22 +647,22 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, if (heap->single_cache_obj) { /* Resize prefix+data block */ if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size))) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache"); - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache"); + } else { /* Resize 'standalone' data block */ if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_dblk_size)) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); - } /* end else */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache"); + } /* Note new size */ heap->dblk_size = new_dblk_size; - } /* end if */ + } else { /* ...if we can't, allocate a new chunk & release the old */ /* Reallocate data block in file */ if (FAIL == H5HL__dblk_realloc(f, heap, new_dblk_size)) - H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed"); - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed"); + } /* If the last free list in the heap is at the end of the heap, extend it */ if (last_fl && last_fl->offset + last_fl->size == old_dblk_size) { @@ -657,7 +684,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, #endif last_fl = H5HL__remove_free(heap, last_fl); } - } /* end if */ + } else { /* Create a new free list element large enough that we can * take some space out of it right away. @@ -665,7 +692,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, offset = old_dblk_size; if (need_more - need_size >= H5HL_SIZEOF_FREE(f)) { if (NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); fl->offset = old_dblk_size + need_size; fl->size = need_more - need_size; HDassert(fl->offset == H5HL_ALIGN(fl->offset)); @@ -682,7 +709,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, (unsigned long)(need_more - need_size), __LINE__); #endif } - } /* end else */ + } #ifdef H5HL_DEBUG if (H5DEBUG(HL)) { @@ -691,22 +718,21 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, } #endif if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Clear new section so junk doesn't appear in the file */ /* (Avoid clearing section which will be overwritten with newly inserted data) */ HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size))); - } /* end if */ + } /* Copy the data into the heap */ H5MM_memcpy(heap->dblk_image + offset, buf, buf_size); *offset_out = offset; - CATCH - /* No special processing on exit */ - -END_FUNC(PRIV) /* H5HL_insert() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HL_insert() */ /*------------------------------------------------------------------------- * Function: H5HL_remove @@ -731,11 +757,15 @@ END_FUNC(PRIV) /* H5HL_insert() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size)) +herr_t +H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) +{ + H5HL_free_t *fl = NULL; + herr_t ret_value = SUCCEED; - H5HL_free_t *fl = NULL; + FUNC_ENTER_NOAPI(FAIL) - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(heap); HDassert(size > 0); @@ -746,17 +776,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, HDassert(offset < heap->dblk_size); HDassert(offset + size <= heap->dblk_size); - /* Mark heap as dirty in cache */ - /* (A bit early in the process, but it's difficult to determine in the + /* Mark heap as dirty in cache + * + * (A bit early in the process, but it's difficult to determine in the * code below where to mark the heap as dirty, especially in error cases, * so we just accept that an extra flush of the heap info could occur * if an error occurs -QAK) */ if (FAIL == H5HL__dirty(heap)) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty"); - /* - * Check if this chunk can be prepended or appended to an already + /* Check if this chunk can be prepended or appended to an already * free chunk. It might also fall between two chunks in such a way * that all three chunks can be combined into one. */ @@ -779,17 +809,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, fl2 = H5HL__remove_free(heap, fl2); if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); } - H5_LEAVE(SUCCEED); + HGOTO_DONE(SUCCEED) } fl2 = fl2->next; } if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); } - H5_LEAVE(SUCCEED); + HGOTO_DONE(SUCCEED) } else if (fl->offset + fl->size == offset) { fl->size += size; @@ -802,20 +832,20 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, fl2 = H5HL__remove_free(heap, fl2); if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); - } /* end if */ - H5_LEAVE(SUCCEED); - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); + } + HGOTO_DONE(SUCCEED) + } fl2 = fl2->next; - } /* end while */ + } if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); - } /* end if */ - H5_LEAVE(SUCCEED); - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); + } + HGOTO_DONE(SUCCEED) + } fl = fl->next; - } /* end while */ + } /* * The amount which is being removed must be large enough to @@ -828,14 +858,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size); } #endif - H5_LEAVE(SUCCEED); - } /* end if */ + HGOTO_DONE(SUCCEED) + } - /* - * Add an entry to the free list. - */ + /* Add an entry to the free list */ if (NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); fl->offset = offset; fl->size = size; HDassert(fl->offset == H5HL_ALIGN(fl->offset)); @@ -848,12 +876,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); - - CATCH - /* No special processing on exit */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); -END_FUNC(PRIV) /* end H5HL_remove() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_remove() */ /*------------------------------------------------------------------------- * Function: H5HL_delete @@ -867,15 +894,19 @@ END_FUNC(PRIV) /* end H5HL_remove() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr)) - +herr_t +H5HL_delete(H5F_t *f, haddr_t addr) +{ H5HL_t * heap = NULL; /* Local heap to delete */ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ H5HL_dblk_t * dblk = NULL; /* Local heap data block */ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */ + herr_t ret_value = SUCCEED; - /* check arguments */ + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); @@ -888,7 +919,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr) /* Protect the local heap prefix */ if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix"); /* Get the pointer to the heap */ heap = prfx->heap; @@ -898,21 +929,22 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr) /* Protect the local heap data block */ if (NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap data block"); /* Set the flags for releasing the prefix and data block */ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; - CATCH +done: /* Release the data block from the cache, now deleted */ if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block"); + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap data block"); /* Release the prefix from the cache, now deleted */ if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix"); -END_FUNC(PRIV) /* end H5HL_delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_delete() */ /*------------------------------------------------------------------------- * Function: H5HL_get_size @@ -926,13 +958,17 @@ END_FUNC(PRIV) /* end H5HL_delete() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size)) +herr_t +H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size) +{ + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ + H5HL_t * heap = NULL; /* Heap data structure */ + herr_t ret_value = SUCCEED; - H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ - H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ - H5HL_t * heap = NULL; /* Heap data structure */ + FUNC_ENTER_NOAPI(FAIL) - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(size); @@ -946,7 +982,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add /* Protect the local heap prefix */ if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix"); /* Get the pointer to the heap */ heap = prfx->heap; @@ -954,11 +990,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add /* Set the size to return */ *size = heap->dblk_size; - CATCH +done: if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix"); -END_FUNC(PRIV) /* end H5HL_get_size() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_get_size() */ /*------------------------------------------------------------------------- * Function: H5HL_heapsize @@ -973,13 +1010,17 @@ END_FUNC(PRIV) /* end H5HL_get_size() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size)) +herr_t +H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size) +{ + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ + H5HL_t * heap = NULL; /* Heap data structure */ + herr_t ret_value = SUCCEED; - H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ - H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ - H5HL_t * heap = NULL; /* Heap data structure */ + FUNC_ENTER_NOAPI(FAIL) - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(heap_size); @@ -993,7 +1034,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add /* Protect the local heap prefix */ if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix"); /* Get the pointer to the heap */ heap = prfx->heap; @@ -1001,8 +1042,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add /* Accumulate the size of the local heap */ *heap_size += (hsize_t)(heap->prfx_size + heap->dblk_size); - CATCH +done: if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix"); -END_FUNC(PRIV) /* end H5HL_heapsize() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_heapsize() */ diff --git a/src/H5HLcache.c b/src/H5HLcache.c index b46280e..9eb390b 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -250,7 +250,7 @@ H5HL__fl_deserialize(H5HL_t *heap) heap->freelist = fl; tail = fl; fl = NULL; - } /* end while */ + } done: if (ret_value < 0) @@ -296,7 +296,7 @@ H5HL__fl_serialize(const H5HL_t *heap) H5F_ENCODE_LENGTH_LEN(image, H5HL_FREE_NULL, heap->sizeof_size) H5F_ENCODE_LENGTH_LEN(image, fl->size, heap->sizeof_size) - } /* end for */ + } FUNC_LEAVE_NOAPI_VOID @@ -450,13 +450,13 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Build free list */ if (H5HL__fl_deserialize(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") - } /* end if */ + } else /* Note that the heap should _NOT_ be a single * object in the cache */ heap->single_cache_obj = FALSE; - } /* end if */ + } /* Set return value */ ret_value = prfx; @@ -467,12 +467,12 @@ done: if (prfx) { if (FAIL == H5HL__prfx_dest(prfx)) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix"); - } /* end if */ + } else { if (heap && FAIL == H5HL__dest(heap)) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap"); - } /* end else */ - } /* end if */ + } + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL__cache_prefix_deserialize() */ @@ -588,7 +588,7 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, gap = heap->prfx_size - (size_t)(image - (uint8_t *)_image); HDmemset(image, 0, gap); image += gap; - } /* end if */ + } /* Serialize the free list into the heap data's image */ H5HL__fl_serialize(heap); @@ -598,14 +598,14 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len); - } /* end if */ + } else { /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); /* Clear rest of local heap */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); - } /* end else */ + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HL__cache_prefix_serialize() */ @@ -736,7 +736,7 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, h /* Build free list */ if (FAIL == H5HL__fl_deserialize(heap)) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list"); - } /* end if */ + } /* Set return value */ ret_value = dblk; @@ -892,7 +892,7 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing) default: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache") break; - } /* end switch */ + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 76e4ec0..305014b 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -44,14 +44,17 @@ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, - H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)) - +herr_t +H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) +{ H5HL_t * h = NULL; int free_block; H5HL_free_t *freelist; uint8_t * marker = NULL; size_t amount_free = 0; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) /* check arguments */ HDassert(f); @@ -61,7 +64,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, HDassert(fwidth >= 0); if (NULL == (h = (H5HL_t *)H5HL_protect(f, addr, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load/protect local heap"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load/protect local heap") HDfprintf(stream, "%*sLocal Heap...\n", indent, ""); HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size (in bytes):", h->prfx_size); @@ -73,7 +76,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, * the heap. */ if (NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); for (free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { @@ -92,13 +95,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, if (marker[freelist->offset + i]) overlap++; marker[freelist->offset + i] = 1; - } /* end for */ + } if (overlap) HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); else amount_free += freelist->size; - } /* end else */ - } /* end for */ + } + } if (h->dblk_size) HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", @@ -107,11 +110,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, /* Print the data in a VMS-style octal dump */ H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); - CATCH +done: if (h && FAIL == H5HL_unprotect(h)) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release/unprotect local heap"); + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release/unprotect local heap") if (marker && NULL != (marker = (uint8_t *)H5MM_xfree(marker))) - H5E_THROW(H5E_CANTFREE, "can't free marker buffer"); + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't free marker buffer") -END_FUNC(PRIV) /* end H5HL_debug() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_debug() */ diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c index f771de5..9e6fc4a 100644 --- a/src/H5HLdblk.c +++ b/src/H5HLdblk.c @@ -81,20 +81,24 @@ H5FL_DEFINE_STATIC(H5HL_dblk_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5HL_dblk_t *, NULL, NULL, H5HL__dblk_new(H5HL_t *heap)) +H5HL_dblk_t * +H5HL__dblk_new(H5HL_t *heap) +{ + H5HL_dblk_t *dblk = NULL; /* New local heap data block */ + H5HL_dblk_t *ret_value = NULL; - H5HL_dblk_t *dblk = NULL; /* New local heap data block */ + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(heap); /* Allocate new local heap data block */ if (NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap data block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap data block") /* Increment ref. count on heap data structure */ if (FAIL == H5HL__inc_rc(heap)) - H5E_THROW(H5E_CANTINC, "can't increment heap ref. count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") /* Link the heap & the data block */ dblk->heap = heap; @@ -103,13 +107,14 @@ BEGIN_FUNC(PKG, ERR, H5HL_dblk_t *, NULL, NULL, H5HL__dblk_new(H5HL_t *heap)) /* Set the return value */ ret_value = dblk; - CATCH +done: /* Ensure that the data block memory is deallocated on errors */ if (!ret_value && dblk != NULL) /* H5FL_FREE always returns NULL so we can't check for errors */ dblk = H5FL_FREE(H5HL_dblk_t, dblk); -END_FUNC(PKG) /* end H5HL__dblk_new() */ + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5HL__dblk_new() */ /*------------------------------------------------------------------------- * Function: H5HL__dblk_dest @@ -123,7 +128,12 @@ END_FUNC(PKG) /* end H5HL__dblk_new() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_dest(H5HL_dblk_t *dblk)) +herr_t +H5HL__dblk_dest(H5HL_dblk_t *dblk) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(dblk); @@ -135,18 +145,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_dest(H5HL_dblk_t *dblk)) /* Decrement ref. count on heap data structure */ if (FAIL == H5HL__dec_rc(dblk->heap)) - H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") /* Unlink heap from data block */ dblk->heap = NULL; - } /* end if */ + } - CATCH +done: /* Free local heap data block */ /* H5FL_FREE always returns NULL so we can't check for errors */ dblk = H5FL_FREE(H5HL_dblk_t, dblk); -END_FUNC(PKG) /* end H5HL__dblk_dest() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__dblk_dest() */ /*------------------------------------------------------------------------- * Function: H5HL__dblk_realloc @@ -160,14 +171,18 @@ END_FUNC(PKG) /* end H5HL__dblk_dest() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size)) - +herr_t +H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size) +{ H5HL_dblk_t *dblk; /* Local heap data block */ haddr_t old_addr; /* Old location of heap data block */ haddr_t new_addr; /* New location of heap data block */ size_t old_heap_size; /* Old size of heap data block */ + herr_t ret_value = SUCCEED; - /* check arguments */ + FUNC_ENTER_PACKAGE + + /* Check arguments */ HDassert(heap); HDassert(new_heap_size > 0); @@ -176,12 +191,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t old_heap_size = heap->dblk_size; H5_CHECK_OVERFLOW(old_heap_size, size_t, hsize_t); if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, old_addr, (hsize_t)old_heap_size)) - H5E_THROW(H5E_CANTFREE, "can't free old local heap data"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't free old local heap data"); /* Allocate new space on disk */ H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t); if (HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, (hsize_t)new_heap_size))) - H5E_THROW(H5E_CANTALLOC, "unable to allocate file space for local heap"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file space for local heap"); /* Update heap info*/ heap->dblk_addr = new_addr; @@ -197,8 +212,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t /* Resize the heap prefix in the cache */ if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size))) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap in cache"); - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache"); + } else { /* Sanity check */ HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr)); @@ -206,50 +221,49 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t /* Resize the heap data block in the cache */ if (H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap (data block) in cache"); - } /* end else */ - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap (data block) in cache"); + } + } else { /* Check if heap data block was contiguous w/prefix previously */ if (heap->single_cache_obj) { /* Create new heap data block */ if (NULL == (dblk = H5HL__dblk_new(heap))) - H5E_THROW(H5E_CANTALLOC, "unable to allocate local heap data block"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate local heap data block"); /* Resize current heap prefix */ heap->prfx_size = H5HL_SIZEOF_HDR(f); if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)heap->prfx_size)) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache"); /* Insert data block into cache (pinned) */ if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG)) - H5E_THROW(H5E_CANTINIT, "unable to cache local heap data block"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap data block"); dblk = NULL; /* Reset 'single cache object' flag */ heap->single_cache_obj = FALSE; - } /* end if */ + } else { /* Resize the heap data block in the cache */ /* (ignore [unlikely] case where heap data block ends up * contiguous w/heap prefix again. */ if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_heap_size)) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache"); /* Relocate the heap data block in the cache */ if (FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr)) - H5E_THROW(H5E_CANTMOVE, "unable to move heap data block in cache"); - - } /* end else */ - } /* end else */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move heap data block in cache"); + } + } - CATCH +done: /* Restore old heap address & size on errors */ if (FAIL == ret_value) { heap->dblk_addr = old_addr; heap->dblk_size = old_heap_size; - } /* end if */ - -END_FUNC(PKG) /* end H5HL__dblk_realloc() */ + } + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__dblk_realloc() */ diff --git a/src/H5HLint.c b/src/H5HLint.c index 069bad8..42d6744 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -80,10 +80,13 @@ H5FL_DEFINE_STATIC(H5HL_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL, - H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)) +H5HL_t * +H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) +{ + H5HL_t *heap = NULL; /* New local heap */ + H5HL_t *ret_value = NULL; - H5HL_t *heap = NULL; /* New local heap */ + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(sizeof_size > 0); @@ -92,7 +95,7 @@ BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL, /* Allocate new local heap structure */ if (NULL == (heap = H5FL_CALLOC(H5HL_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Initialize non-zero fields */ heap->sizeof_size = sizeof_size; @@ -102,12 +105,13 @@ BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL, /* Set the return value */ ret_value = heap; - CATCH +done: if (!ret_value && heap != NULL) if (NULL == (heap = H5FL_FREE(H5HL_t, heap))) - H5E_THROW(H5E_CANTFREE, "can't free heap memory"); + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't free heap memory") -END_FUNC(PKG) /* end H5HL__new() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__new() */ /*------------------------------------------------------------------------- * Function: H5HL__inc_rc @@ -121,7 +125,10 @@ END_FUNC(PKG) /* end H5HL__new() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5HL__inc_rc(H5HL_t *heap)) +herr_t +H5HL__inc_rc(H5HL_t *heap) +{ + FUNC_ENTER_PACKAGE_NOERR /* check arguments */ HDassert(heap); @@ -129,7 +136,8 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5HL__inc_rc(H5HL_t *heap)) /* Increment heap's ref. count */ heap->rc++; -END_FUNC(PKG) /* end H5HL__inc_rc() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5HL__inc_rc() */ /*------------------------------------------------------------------------- * Function: H5HL__dec_rc @@ -143,7 +151,12 @@ END_FUNC(PKG) /* end H5HL__inc_rc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dec_rc(H5HL_t *heap)) +herr_t +H5HL__dec_rc(H5HL_t *heap) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(heap); @@ -151,12 +164,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dec_rc(H5HL_t *heap)) /* Decrement heap's ref. count */ heap->rc--; - CATCH /* Check if we should destroy the heap */ if (heap->rc == 0 && FAIL == H5HL__dest(heap)) - H5E_THROW(H5E_CANTFREE, "unable to destroy local heap"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap"); -END_FUNC(PKG) /* end H5HL__dec_rc() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__dec_rc() */ /*------------------------------------------------------------------------- * Function: H5HL__dest @@ -170,7 +184,12 @@ END_FUNC(PKG) /* end H5HL__dec_rc() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dest(H5HL_t *heap)) +herr_t +H5HL__dest(H5HL_t *heap) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(heap); @@ -181,20 +200,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dest(H5HL_t *heap)) HDassert(heap->prfx == NULL); HDassert(heap->dblk == NULL); - CATCH + /* Use DONE errors here to try to free as much as possible */ if (heap->dblk_image) if (NULL != (heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image))) - H5E_THROW(H5E_CANTFREE, "unable to free local heap data block image"); + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data block image"); while (heap->freelist) { H5HL_free_t *fl; fl = heap->freelist; heap->freelist = fl->next; if (NULL != (fl = H5FL_FREE(H5HL_free_t, fl))) - H5E_THROW(H5E_CANTFREE, "unable to free local heap free list"); - } /* end while */ + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap free list"); + } if (NULL != (heap = H5FL_FREE(H5HL_t, heap))) - H5E_THROW(H5E_CANTFREE, "unable to free local heap"); + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap"); -END_FUNC(PKG) /* end H5HL__dest() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__dest() */ diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index dbac1b9..0ba3b1c 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -54,7 +54,7 @@ H5FL_BLK_EXTERN(lheap_chunk); #define H5_MY_PKG H5HL #define H5_MY_PKG_ERR H5E_HEAP #define H5_MY_PKG_INIT NO -#endif /* H5HL_PACKAGE */ +#endif #define H5HL_SIZEOF_HDR(F) \ H5HL_ALIGN(H5_SIZEOF_MAGIC + /* heap signature */ \ diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c index 90f6c74..03e3999 100644 --- a/src/H5HLprfx.c +++ b/src/H5HLprfx.c @@ -80,20 +80,24 @@ H5FL_DEFINE_STATIC(H5HL_prfx_t); * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, H5HL_prfx_t *, NULL, NULL, H5HL__prfx_new(H5HL_t *heap)) +H5HL_prfx_t * +H5HL__prfx_new(H5HL_t *heap) +{ + H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ + H5HL_prfx_t *ret_value = NULL; - H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(heap); /* Allocate new local heap prefix */ if (NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap prefix") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap prefix") /* Increment ref. count on heap data structure */ if (FAIL == H5HL__inc_rc(heap)) - H5E_THROW(H5E_CANTINC, "can't increment heap ref. count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") /* Link the heap & the prefix */ prfx->heap = heap; @@ -102,13 +106,14 @@ BEGIN_FUNC(PKG, ERR, H5HL_prfx_t *, NULL, NULL, H5HL__prfx_new(H5HL_t *heap)) /* Set the return value */ ret_value = prfx; - CATCH +done: /* Ensure that the prefix memory is deallocated on errors */ if (!ret_value && prfx != NULL) /* H5FL_FREE always returns NULL so we can't check for errors */ prfx = H5FL_FREE(H5HL_prfx_t, prfx); -END_FUNC(PKG) /* end H5HL__prfx_new() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__prfx_new() */ /*------------------------------------------------------------------------- * Function: H5HL__prfx_dest @@ -122,7 +127,12 @@ END_FUNC(PKG) /* end H5HL__prfx_new() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__prfx_dest(H5HL_prfx_t *prfx)) +herr_t +H5HL__prfx_dest(H5HL_prfx_t *prfx) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(prfx); @@ -134,15 +144,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__prfx_dest(H5HL_prfx_t *prfx)) /* Decrement ref. count on heap data structure */ if (FAIL == H5HL__dec_rc(prfx->heap)) - H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") /* Unlink heap from prefix */ prfx->heap = NULL; - } /* end if */ + } - CATCH +done: /* Free prefix memory */ /* H5FL_FREE always returns NULL so we can't check for errors */ prfx = H5FL_FREE(H5HL_prfx_t, prfx); -END_FUNC(PKG) /* end H5HL__prfx_dest() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL__prfx_dest() */ diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 5c98846..02e07eb 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -66,4 +66,4 @@ H5_DLL herr_t H5HL_unprotect(H5HL_t *heap); /* Debugging routines for dumping file structures */ H5_DLL herr_t H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth); -#endif +#endif /* H5HLprivate_H */ diff --git a/src/H5private.h b/src/H5private.h index 7888772..d197465 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2591,256 +2591,26 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); return (ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -/****************************************/ -/* Revisions to FUNC_ENTER/LEAVE Macros */ -/****************************************/ - -/* Macros to check if a package is initialized */ -#define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg)); -#define H5_CHECK_PACKAGE_INIT_REG_NO(asrt) -#define H5_CHECK_PACKAGE_INIT_INIT_YES(asrt) -#define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt) -#define H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) - -/* Macros to initialize package, if a package initialization routine is defined */ -#define H5_PKG_YES_INIT(pkg) \ - if (!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) { \ - H5_PACKAGE_INIT_VAR(pkg) = TRUE; \ - if (H5_PACKAGE_INIT_FUNC(pkg)() < 0) { \ - H5_PACKAGE_INIT_VAR(pkg) = FALSE; \ - /* (Can't use H5E_THROW here) */ \ - H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ - } /* end if */ -#define H5_PKG_NO_INIT(pkg) \ - if (!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) \ - H5_PACKAGE_INIT_VAR(pkg) = TRUE; -#define H5_PKG_INIT(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) - /* Macros to declare package initialization function, if a package initialization routine is defined */ #ifdef H5_PKG_SINGLE_SOURCE #define H5_PKG_DECLARE_YES_FUNC(pkg) static herr_t H5_PACKAGE_INIT_FUNC(pkg)(void); -#else /* H5_PKG_SINGLE_SOURCE */ +#else #define H5_PKG_DECLARE_YES_FUNC(pkg) extern herr_t H5_PACKAGE_INIT_FUNC(pkg)(void); -#endif /* H5_PKG_SINGLE_SOURCE */ +#endif #define H5_PKG_DECLARE_NO_FUNC(pkg) /* Declare package initialization symbols (if in a package) */ #ifdef H5_PKG_SINGLE_SOURCE #define H5_PKG_DECLARE_VAR(pkg) static hbool_t H5_PACKAGE_INIT_VAR(pkg); -#else /* H5_PKG_SINGLE_SOURCE */ +#else #define H5_PKG_DECLARE_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(pkg); -#endif /* H5_PKG_SINGLE_SOURCE */ +#endif #define H5_PKG_DECLARE_FUNC(pkg_init, pkg) H5_GLUE3(H5_PKG_DECLARE_, pkg_init, _FUNC)(pkg) + #ifdef H5_MY_PKG H5_PKG_DECLARE_VAR(H5_MY_PKG) H5_PKG_DECLARE_FUNC(H5_MY_PKG_INIT, H5_MY_PKG) -#endif /* H5_MY_PKG */ - -/* API re-entrance variable */ -extern hbool_t H5_api_entered_g; /* Has library already been entered through API? */ - -/* Macros for entering different scopes of routines */ -#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ - FUNC_ENTER_CHECK_NAME(H5_IS_PKG(FUNC)) \ - \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ - \ - /* This interface should be initialized already */ \ - /* (except for package initialization routines :-) */ \ - H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) \ - \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ - \ - /* Enter scope for this type of function */ \ - { - -#define H5_PRIVATE_ENTER(pkg, pkg_init) \ - FUNC_ENTER_CHECK_NAME(H5_IS_PRIV(FUNC)) \ - \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ - \ - /* Initialize this interface if desired */ \ - H5_PKG_INIT(pkg_init, pkg) \ - \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ - \ - /* Enter scope for this type of function */ \ - { \ - { - -#define H5_PUBLIC_ENTER(pkg, pkg_init) \ - FUNC_ENTER_API_VARS \ - FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_CHECK_NAME(H5_IS_PUB(FUNC)) \ - \ - /* Clear thread error stack when entering public functions */ \ - H5E_clear_stack(NULL); \ - \ - /* Initialize the library or bust */ \ - if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \ - if (H5_init_library() < 0) { \ - /* (Can't use H5E_THROW here) */ \ - H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ - } /* end if */ \ - \ - /* Initialize this interface if desired */ \ - H5_PKG_INIT(pkg_init, pkg) \ - \ - /* Check for re-entering API routine */ \ - HDassert(!H5_api_entered_g); \ - H5_api_entered_g = TRUE; \ - \ - /* Start logging MPI's MPE information */ \ - BEGIN_MPE_LOG \ - \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ - \ - /* Enter scope for this type of function */ \ - { \ - { \ - { - -/* Macros for substituting the package name */ -#define FUNC_ENT_STATIC(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG) -#define FUNC_ENT_PKGINIT(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, INIT) -#define FUNC_ENT_PKG(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG) -#define FUNC_ENT_PRIV(pkg, pkg_init) H5_PRIVATE_ENTER(pkg, pkg_init) -#define FUNC_ENT_PUB(pkg, pkg_init) H5_PUBLIC_ENTER(pkg, pkg_init) - -/* Macros for substituting a function prefix */ -#define FUNC_PREFIX_STATIC static -#define FUNC_PREFIX_PKGINIT -#define FUNC_PREFIX_PKG -#define FUNC_PREFIX_PRIV -#define FUNC_PREFIX_PUB - -/* Macros for declaring error variables */ -/* Function can detect errors and has a specific error return value */ -#define FUNC_ERR_VAR_ERR(ret_typ, err) \ - hbool_t past_catch = FALSE; \ - ret_typ fail_value = err; -/* Function can detect errors but cannot return an error value (Cleanup only) */ -#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) hbool_t past_catch = FALSE; -/* Function has no need to detect or clean up from errors */ -#define FUNC_ERR_VAR_NOERR(ret_typ, err) - -/* Use this macro when entering all functions */ -#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ - H5_GLUE(FUNC_PREFIX_, scope) \ - ret_typ func \ - /* Open function */ \ - { \ - ret_typ ret_value = ret_init; \ - H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) H5_GLUE(FUNC_ENT_, scope)(H5_MY_PKG, H5_MY_PKG_INIT) - -/* Use this macro when entering functions that have no return value */ -#define BEGIN_FUNC_VOID(scope, use_err, func) \ - H5_GLUE(FUNC_PREFIX_, scope) \ - void func \ - /* Open function */ \ - { \ - H5_GLUE(FUNC_ERR_VAR_, use_err)(void, -, -) H5_GLUE(FUNC_ENT_, scope) - -/* Macros for label when a function initialization can fail */ -#define H5_PRIV_YES_FUNC_INIT_FAILED \ -func_init_failed: -#define H5_PRIV_NO_FUNC_INIT_FAILED -#define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED) - -/* Macros for leaving different scopes of routines */ -#define FUNC_LEAVE_PKGINIT \ - /* Leave scope for this type of function */ \ - } \ - \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC - -#define FUNC_LEAVE_STATIC \ - /* Leave scope for this type of function */ \ - } \ - \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC - -#define FUNC_LEAVE_PKG \ - /* Leave scope for this type of function */ \ - } \ - \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC - -#define FUNC_LEAVE_PRIV \ - /* Leave scope for this type of function */ \ - } \ - } \ - \ - /* Label for errors during FUNC_ENTER */ \ - H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ - \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC - -#define FUNC_LEAVE_PUB \ - /* Leave scope for this type of function */ \ - } \ - } \ - } \ - \ - /* Label for errors during FUNC_ENTER */ \ -func_init_failed: \ - \ - /* Dump error stack if an error occurred during API routine */ \ - if (ret_value == fail_value) \ - (void)H5E_dump_api_stack(TRUE); \ - \ - /* Finish the API tracing info */ \ - H5TRACE_RETURN(ret_value); \ - \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC \ - \ - /* Finish the MPE tracing info */ \ - FINISH_MPE_LOG \ - \ - /* Check for leaving API routine */ \ - HDassert(H5_api_entered_g); \ - H5_api_entered_g = FALSE; \ - \ - /* Release thread-safety semaphore */ \ - FUNC_LEAVE_API_THREADSAFE - -/* Use this macro when leaving all functions */ -#define END_FUNC(scope) \ - /* Scope-specific function conclusion */ \ - H5_GLUE(FUNC_LEAVE_, scope) \ - \ - /* Leave routine */ \ - return (ret_value); \ - \ - /* Close Function */ \ - } - -/* Use this macro when leaving void functions */ -#define END_FUNC_VOID(scope) \ - /* Scope-specific function conclusion */ \ - H5_GLUE(FUNC_LEAVE_, scope) \ - \ - /* Leave routine */ \ - return; \ - \ - /* Close Function */ \ - } +#endif /* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient). * Make sure to use HGOTO_ERROR_TAG and HGOTO_DONE_TAG between these macros! */ diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index 8fd33bb..5840a98 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -220,22 +220,22 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; /* Macro for "catching" flow of control when an error occurs. Note that the * H5_LEAVE macro won't jump back here once it's past this point. */ -/* #define CATCH catch_except:; past_catch = TRUE; defined in H5Eprivate.h */ +#define CATCH \ +catch_except:; \ + past_catch = TRUE; /* - * H5_LEAVE macro, used to facilitate control flow between a - * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is - * the return value. - * The return value is assigned to a variable `ret_value' and control branches - * to the `catch_except' label, if we're not already past it. + * H5_LEAVE macro, used to facilitate control flow in a function. The argument + * is the return value. The return value is assigned to a variable `ret_value' + * and control branches to the `catch_except' label, if we're not already past + * it. */ -/* - * #define H5_LEAVE(v) { \ - * ret_value = v; \ - * if(!past_catch) \ - * goto catch_except; \ - * } - * defined in H5Eprivate.h */ +#define H5_LEAVE(v) \ + { \ + ret_value = v; \ + if (!past_catch) \ + goto catch_except; \ + } /* * H5TOOLS_THROW macro, used to facilitate error reporting within a function body. -- cgit v0.12 From 2da5855900d6e11d1db87a38f307fb72f95e809a Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 28 May 2021 19:59:58 -0700 Subject: Split H5L.c internal code to H5Lint.c (#691) * Committing clang-format changes * Splits internal parts of H5L.c to H5Lint.c Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 1 + src/CMakeLists.txt | 1 + src/H5L.c | 2176 +------------------------------------------------- src/H5Lint.c | 2240 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Lprivate.h | 1 + src/Makefile.am | 2 +- 6 files changed, 2250 insertions(+), 2171 deletions(-) create mode 100644 src/H5Lint.c diff --git a/MANIFEST b/MANIFEST index 9832159..52ad0e5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -898,6 +898,7 @@ ./src/H5L.c ./src/H5Ldeprec.c ./src/H5Lexternal.c +./src/H5Lint.c ./src/H5Lmodule.h ./src/H5Lpkg.h ./src/H5Lprivate.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 97384f0..555fb98 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -398,6 +398,7 @@ set (H5L_SOURCES ${HDF5_SRC_DIR}/H5L.c ${HDF5_SRC_DIR}/H5Ldeprec.c ${HDF5_SRC_DIR}/H5Lexternal.c + ${HDF5_SRC_DIR}/H5Lint.c ) set (H5L_HDRS ${HDF5_SRC_DIR}/H5Lpublic.h diff --git a/src/H5L.c b/src/H5L.c index 982813b..d3c0fe3 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -21,17 +21,13 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5ESprivate.h" /* Event Sets */ -#include "H5Fprivate.h" /* File access */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lpkg.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VLnative_private.h" /* Native VOL */ @@ -40,96 +36,14 @@ /* Local Macros */ /****************/ -#define H5L_MIN_TABLE_SIZE 32 /* Minimum size of the user-defined link type table if it is allocated */ - /******************/ /* Local Typedefs */ /******************/ -/* User data for path traversal routine for getting link info by name */ -typedef struct { - H5L_info2_t *linfo; /* Buffer to return to user */ -} H5L_trav_gi_t; - -/* User data for path traversal callback to creating a link */ -typedef struct { - H5F_t * file; /* Pointer to the file */ - H5P_genplist_t * lc_plist; /* Link creation property list */ - H5G_name_t * path; /* Path to object being linked */ - H5O_obj_create_t *ocrt_info; /* Pointer to object creation info */ - H5O_link_t * lnk; /* Pointer to link information to insert */ -} H5L_trav_cr_t; - -/* User data for path traversal routine for moving and renaming a link */ -typedef struct { - const char * dst_name; /* Destination name for moving object */ - H5T_cset_t cset; /* Char set for new name */ - const H5G_loc_t *dst_loc; /* Destination location for moving object */ - unsigned dst_target_flags; /* Target flags for destination object */ - hbool_t copy; /* TRUE if this is a copy operation */ - size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */ -} H5L_trav_mv_t; - -/* User data for path traversal routine for moving and renaming an object */ -typedef struct { - H5F_t * file; /* Pointer to the file */ - H5O_link_t *lnk; /* Pointer to link information to insert */ - hbool_t copy; /* TRUE if this is a copy operation */ -} H5L_trav_mv2_t; - -/* User data for path traversal routine for checking if a link exists */ -typedef struct { - /* Down */ - char *sep; /* Pointer to next separator in the string */ - - /* Up */ - hbool_t *exists; /* Whether the link exists or not */ -} H5L_trav_le_t; - -/* User data for path traversal routine for getting link value */ -typedef struct { - size_t size; /* Size of user buffer */ - void * buf; /* User buffer */ -} H5L_trav_gv_t; - /********************/ /* Local Prototypes */ /********************/ -static int H5L__find_class_idx(H5L_type_t id); -static herr_t H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, - H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id); -static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size); -static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/); -static herr_t H5L__get_name_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/); static herr_t H5L__create_soft_api_common(const char *link_target, 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); @@ -151,9 +65,6 @@ static herr_t H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_it /* Package Variables */ /*********************/ -/* Package initialization variable */ -hbool_t H5_PKG_INIT_VAR = FALSE; - /*****************************/ /* Library Private Variables */ /*****************************/ @@ -162,99 +73,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Local Variables */ /*******************/ -/* Information about user-defined links */ -static size_t H5L_table_alloc_g = 0; -static size_t H5L_table_used_g = 0; -static H5L_class_t *H5L_table_g = NULL; - -/*------------------------------------------------------------------------- - * Function: H5L_init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: James Laird - * Thursday, July 13, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_init() */ - -/*------------------------------------------------------------------------- - * Function: H5L__init_package - * - * Purpose: Initialize information specific to H5L interface. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Tuesday, January 24, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L__init_package(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Initialize user-defined link classes */ - if (H5L_register_external() < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_init_package() */ - -/*------------------------------------------------------------------------- - * Function: H5L_term_package - * - * Purpose: Terminate any resources allocated in H5L__init_package. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Tuesday, January 24, 2006 - * - *------------------------------------------------------------------------- - */ -int -H5L_term_package(void) -{ - int n = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (H5_PKG_INIT_VAR) { - /* Free the table of link types */ - if (H5L_table_g) { - H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g); - H5L_table_used_g = H5L_table_alloc_g = 0; - n++; - } /* end if */ - - /* Mark the interface as uninitialized */ - if (0 == n) - H5_PKG_INIT_VAR = FALSE; - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* H5L_term_package() */ - /*------------------------------------------------------------------------- * Function: H5Lmove * @@ -1603,8 +1421,8 @@ done: htri_t H5Lis_registered(H5L_type_t id) { - size_t i; /* Local index variable */ - htri_t ret_value = FALSE; /* Return value */ + hbool_t is_registered = FALSE; + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "Ll", id); @@ -1614,11 +1432,10 @@ H5Lis_registered(H5L_type_t id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type id number") /* Is the link class already registered? */ - for (i = 0; i < H5L_table_used_g; i++) - if (H5L_table_g[i].id == id) { - ret_value = TRUE; - break; - } /* end if */ + if (H5L_is_registered(id, &is_registered) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "could not determine registration status of UD link type") + + ret_value = is_registered ? TRUE : FALSE; done: FUNC_LEAVE_API(ret_value) @@ -2110,1984 +1927,3 @@ H5Lunpack_elink_val(const void *_ext_linkval, size_t link_size, unsigned *flags, done: FUNC_LEAVE_API(ret_value) } /* end H5Lunpack_elink_val() */ - -/* - *------------------------------------------------------------------------- - *------------------------------------------------------------------------- - * N O A P I F U N C T I O N S B E Y O N D T H I S P O I N T - *------------------------------------------------------------------------- - *------------------------------------------------------------------------- - */ - -/*------------------------------------------------------------------------- - * Function: H5L__find_class_idx - * - * Purpose: Given a link class ID, return the offset in the global array - * that holds all the registered link classes. - * - * Return: Success: Non-negative index of entry in global - * link class table. - * Failure: Negative - * - * Programmer: James Laird - * Monday, July 10, 2006 - * - *------------------------------------------------------------------------- - */ -static int -H5L__find_class_idx(H5L_type_t id) -{ - size_t i; /* Local index variable */ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_NOERR - - for (i = 0; i < H5L_table_used_g; i++) - if (H5L_table_g[i].id == id) - HGOTO_DONE((int)i) - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__find_class_idx */ - -/*------------------------------------------------------------------------- - * Function: H5L_find_class - * - * Purpose: Given a link class ID return a pointer to a global struct that - * defines the link class. - * - * Return: Success: Ptr to entry in global link class table. - * Failure: NULL - * - * Programmer: James Laird - * Monday, July 10, 2006 - * - *------------------------------------------------------------------------- - */ -const H5L_class_t * -H5L_find_class(H5L_type_t id) -{ - int idx; /* Filter index in global table */ - H5L_class_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Get the index in the global table */ - if ((idx = H5L__find_class_idx(id)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class") - - /* Set return value */ - ret_value = H5L_table_g + idx; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_find_class */ - -/*------------------------------------------------------------------------- - * Function: H5L_register - * - * Purpose: Registers a class of user-defined links, or changes the - * behavior of an existing class. - * - * See H5Lregister for full documentation. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Monday, July 10, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L_register(const H5L_class_t *cls) -{ - size_t i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(cls); - HDassert(cls->id >= 0 && cls->id <= H5L_TYPE_MAX); - - /* Is the link type already registered? */ - for (i = 0; i < H5L_table_used_g; i++) - if (H5L_table_g[i].id == cls->id) - break; - - /* Filter not already registered */ - if (i >= H5L_table_used_g) { - if (H5L_table_used_g >= H5L_table_alloc_g) { - size_t n = MAX(H5L_MIN_TABLE_SIZE, (2 * H5L_table_alloc_g)); - H5L_class_t *table = (H5L_class_t *)H5MM_realloc(H5L_table_g, (n * sizeof(H5L_class_t))); - if (!table) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table") - H5L_table_g = table; - H5L_table_alloc_g = n; - } /* end if */ - - /* Initialize */ - i = H5L_table_used_g++; - } /* end if */ - - /* Copy link class info into table */ - H5MM_memcpy(H5L_table_g + i, cls, sizeof(H5L_class_t)); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_register */ - -/*------------------------------------------------------------------------- - * Function: H5L_unregister - * - * Purpose: Unregisters a class of user-defined links. - * - * See H5Lunregister for full documentation. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Monday, July 10, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L_unregister(H5L_type_t id) -{ - size_t i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(id >= 0 && id <= H5L_TYPE_MAX); - - /* Is the filter already registered? */ - for (i = 0; i < H5L_table_used_g; i++) - if (H5L_table_g[i].id == id) - break; - - /* Fail if filter not found */ - if (i >= H5L_table_used_g) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered") - - /* Remove filter from table */ - /* Don't worry about shrinking table size (for now) */ - HDmemmove(&H5L_table_g[i], &H5L_table_g[i + 1], sizeof(H5L_class_t) * ((H5L_table_used_g - 1) - i)); - H5L_table_used_g--; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_unregister() */ - -/*------------------------------------------------------------------------- - * Function: H5L_link - * - * Purpose: Creates a link from OBJ_ID to CUR_NAME. See H5Olink() for - * full documentation. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Tuesday, December 13, 2005 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id) -{ - H5O_link_t lnk; /* Link to insert */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - HDassert(new_loc); - HDassert(obj_loc); - HDassert(new_name && *new_name); - - /* The link callback will check that the object isn't being hard linked - * into a different file, so we don't need to do it here (there could be - * external links along the path). - */ - - /* Construct link information for eventual insertion */ - lnk.type = H5L_TYPE_HARD; - lnk.u.hard.addr = obj_loc->oloc->addr; - - /* Create the link */ - if (H5L__create_real(new_loc, new_name, obj_loc->path, obj_loc->oloc->file, &lnk, NULL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_link() */ - -/*------------------------------------------------------------------------- - * Function: H5L_link_object - * - * Purpose: Creates a new object and a link to it. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, April 9, 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t *ocrt_info, hid_t lcpl_id) -{ - H5O_link_t lnk; /* Link to insert */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - HDassert(new_loc); - HDassert(new_name && *new_name); - HDassert(ocrt_info); - - /* The link callback will check that the object isn't being hard linked - * into a different file, so we don't need to do it here (there could be - * external links along the path). - */ - - /* Construct link information for eventual insertion */ - lnk.type = H5L_TYPE_HARD; - - /* Create the link */ - if (H5L__create_real(new_loc, new_name, NULL, NULL, &lnk, ocrt_info, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_link_object() */ - -/*------------------------------------------------------------------------- - * Function: H5L__link_cb - * - * Purpose: Callback for creating a link to an object. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, September 19, 2005 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_ATTR_UNUSED *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_cr_t *udata = (H5L_trav_cr_t *)_udata; /* User data passed in */ - H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */ - hid_t grp_id = FAIL; /* Id for this group (passed to user callback */ - H5G_loc_t temp_loc; /* For UD callback */ - hbool_t temp_loc_init = FALSE; /* Temporary location for UD callback (temp_loc) has been initialized */ - hbool_t obj_created = FALSE; /* Whether an object was created (through a hard link) */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the name in this group resolved to a valid location */ - /* (which is not what we want) */ - if (obj_loc != NULL) - HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name already exists") - - /* Check for crossing file boundaries with a new hard link */ - if (udata->lnk->type == H5L_TYPE_HARD) { - /* Check for creating an object */ - /* (only for hard links) */ - if (udata->ocrt_info) { - H5G_loc_t new_loc; /* Group location for new object */ - - /* Create new object at this location */ - if (NULL == - (udata->ocrt_info->new_obj = H5O_obj_create(grp_loc->oloc->file, udata->ocrt_info->obj_type, - udata->ocrt_info->crt_info, &new_loc))) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create object") - - /* Set address for hard link */ - udata->lnk->u.hard.addr = new_loc.oloc->addr; - - /* Set object path to use for setting object name (below) */ - udata->path = new_loc.path; - - /* Indicate that an object was created */ - obj_created = TRUE; - } /* end if */ - else { - /* Check that both objects are in same file */ - if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "interfile hard links are not allowed") - } /* end else */ - } /* end if */ - - /* Set 'standard' aspects of link */ - udata->lnk->corder = - 0; /* Will be re-written during group insertion, if the group is tracking creation order */ - udata->lnk->corder_valid = FALSE; /* Creation order not valid (yet) */ - - /* Check for non-default link creation properties */ - if (udata->lc_plist) { - /* Get character encoding property */ - if (H5CX_get_encoding(&udata->lnk->cset) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property") - } /* end if */ - else - udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */ - - /* Set the link's name correctly */ - /* Casting away const OK -QAK */ - udata->lnk->name = (char *)name; - - /* Insert link into group */ - if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, - udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN, - udata->ocrt_info ? udata->ocrt_info->crt_info : NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object") - - /* Set object's path if it has been passed in and is not set */ - if (udata->path != NULL && udata->path->user_path_r == NULL) - if (H5G_name_set(grp_loc->path, udata->path, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "cannot set name") - - /* If link is a user-defined link, trigger its creation callback if it has one */ - if (udata->lnk->type >= H5L_TYPE_UD_MIN) { - const H5L_class_t *link_class; /* User-defined link class */ - - /* Get the link class for this type of link. */ - if (NULL == (link_class = H5L_find_class(udata->lnk->type))) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get class of UD link") - - if (link_class->create_func != NULL) { - H5O_loc_t temp_oloc; - H5G_name_t temp_path; - - /* Create a temporary location (or else H5G_open will do a shallow - * copy and wipe out grp_loc) - */ - H5G_name_reset(&temp_path); - if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location") - - temp_loc.oloc = &temp_oloc; - temp_loc.path = &temp_path; - temp_loc_init = TRUE; - - /* Set up location for user-defined callback */ - if (NULL == (grp = H5G_open(&temp_loc))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") - - /* Make callback */ - if ((link_class->create_func)(name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size, - H5P_DEFAULT) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link creation callback failed") - } /* end if */ - } /* end if */ - -done: - /* Check if an object was created */ - if (obj_created) { - H5O_loc_t oloc; /* Object location for created object */ - - /* Set up object location */ - HDmemset(&oloc, 0, sizeof(oloc)); - oloc.file = grp_loc->oloc->file; - oloc.addr = udata->lnk->u.hard.addr; - - /* Decrement refcount on new object's object header in memory */ - if (H5O_dec_rc_by_loc(&oloc) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") - } /* end if */ - - /* Close the location given to the user callback if it was created */ - if (grp_id >= 0) { - if (H5I_dec_app_ref(grp_id) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") - } /* end if */ - else if (grp != NULL) { - if (H5G_close(grp) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback") - } /* end if */ - else if (temp_loc_init) - H5G_loc_free(&temp_loc); - - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__link_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__create_real - * - * Purpose: Creates a link at a path location - * - * lnk should have linkclass-specific information already - * set, but this function will take care of setting name. - * - * obj_path can be NULL if the object's path doesn't need to - * be set, and obj_file can be NULL if the object is not a - * hard link. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, December 5, 2005 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file, - H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id) -{ - char * norm_link_name = NULL; /* Pointer to normalized link name */ - unsigned target_flags = H5G_TARGET_NORMAL; /* Flags to pass to group traversal function */ - H5P_genplist_t *lc_plist = NULL; /* Link creation property list */ - H5L_trav_cr_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check args */ - HDassert(link_loc); - HDassert(link_name && *link_name); - HDassert(lnk); - HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX); - - /* Get normalized link name */ - if ((norm_link_name = H5G_normalize(link_name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") - - /* Check for flags present in creation property list */ - if (lcpl_id != H5P_DEFAULT) { - unsigned crt_intmd_group; - - /* Get link creation property list */ - if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Get intermediate group creation property */ - if (H5CX_get_intermediate_group(&crt_intmd_group) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property") - - if (crt_intmd_group > 0) - target_flags |= H5G_CRT_INTMD_GROUP; - } /* end if */ - - /* Set up user data - * FILE is used to make sure that hard links don't cross files, and - * should be NULL for other link types. - * LC_PLIST is a pointer to the link creation property list. - * PATH is a pointer to the path of the object being inserted if this is - * a hard link; this is used to set the paths to objects when they are - * created. For other link types, this is NULL. - * OCRT_INFO is a pointer to the structure for object creation. - * LNK is the link struct passed into this function. At this point all - * of its fields should be populated except for name, which is set when - * inserting it in the callback. - */ - udata.file = obj_file; - udata.lc_plist = lc_plist; - udata.path = obj_path; - udata.ocrt_info = ocrt_info; - udata.lnk = lnk; - - /* Traverse the destination path & create new link */ - if (H5G_traverse(link_loc, link_name, target_flags, H5L__link_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert link") - -done: - /* Free the normalized path name */ - if (norm_link_name) - H5MM_xfree(norm_link_name); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__create_real() */ - -/*------------------------------------------------------------------------- - * Function: H5L__create_hard - * - * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Monday, April 6, 1998 - * - *------------------------------------------------------------------------- - */ -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) -{ - char * norm_cur_name = NULL; /* Pointer to normalized current name */ - H5F_t * link_file = NULL; /* Pointer to file to link to */ - H5O_link_t lnk; /* Link to insert */ - H5G_loc_t obj_loc; /* Location of object to link to */ - H5G_name_t path; /* obj_loc's path*/ - H5O_loc_t oloc; /* obj_loc's oloc */ - hbool_t loc_valid = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check args */ - HDassert(cur_loc); - HDassert(cur_name && *cur_name); - HDassert(link_loc); - HDassert(link_name && *link_name); - - /* Get normalized copy of the current name */ - if ((norm_cur_name = H5G_normalize(cur_name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") - - /* Set up link data specific to hard links */ - lnk.type = H5L_TYPE_HARD; - - /* Get object location for object pointed to */ - obj_loc.path = &path; - obj_loc.oloc = &oloc; - H5G_loc_reset(&obj_loc); - if (H5G_loc_find(cur_loc, norm_cur_name, &obj_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "source object not found") - loc_valid = TRUE; - - /* Construct link information for eventual insertion */ - lnk.u.hard.addr = obj_loc.oloc->addr; - - /* Set destination's file information */ - link_file = obj_loc.oloc->file; - - /* Create actual link to the object. Pass in NULL for the path, since this - * function shouldn't change an object's user path. */ - if (H5L__create_real(link_loc, link_name, NULL, link_file, &lnk, NULL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") - -done: - /* Free the object header location */ - if (loc_valid) - if (H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to free location") - - /* Free the normalized path name */ - if (norm_cur_name) - H5MM_xfree(norm_cur_name); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__create_hard() */ - -/*------------------------------------------------------------------------- - * Function: H5L__create_soft - * - * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. - * - * Return: SUCCEED/FAIL - * - * Programmer: Robb Matzke - * Monday, April 6, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) -{ - char * norm_target = NULL; /* Pointer to normalized current name */ - H5O_link_t lnk; /* Link to insert */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check args */ - HDassert(link_loc); - HDassert(target_path && *target_path); - HDassert(link_name && *link_name); - - /* Get normalized copy of the link target */ - if ((norm_target = H5G_normalize(target_path)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") - - /* Set up link data specific to soft links */ - lnk.type = H5L_TYPE_SOFT; - lnk.u.soft.name = norm_target; - - /* Create actual link to the object */ - if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") - -done: - /* Free the normalized target name */ - if (norm_target) - H5MM_xfree(norm_target); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__create_soft() */ - -/*------------------------------------------------------------------------- - * Function: H5L__create_ud - * - * Purpose: Creates a user-defined link. See H5Lcreate_ud for - * full documentation. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Friday, May 19, 2006 - * - *------------------------------------------------------------------------- - */ -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) -{ - H5O_link_t lnk; /* Link to insert */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check args */ - HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX); - HDassert(link_loc); - HDassert(link_name && *link_name); - HDassert(ud_data_size == 0 || ud_data); - - /* Initialize the link struct's pointer to its udata buffer */ - lnk.u.ud.udata = NULL; - - /* Make sure that this link class is registered */ - if (H5L__find_class_idx(type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library") - - /* Fill in UD link-specific information in the link struct*/ - if (ud_data_size > 0) { - lnk.u.ud.udata = H5MM_malloc((size_t)ud_data_size); - H5MM_memcpy(lnk.u.ud.udata, ud_data, (size_t)ud_data_size); - } /* end if */ - else - lnk.u.ud.udata = NULL; - - lnk.u.ud.size = ud_data_size; - lnk.type = type; - - /* Create actual link to the object */ - if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to register new name for object") - -done: - /* Free the link's udata buffer if it's been allocated */ - H5MM_xfree(lnk.u.ud.udata); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__create_ud() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_val_real - * - * Purpose: Retrieve link value from a link object - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, November 13 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(lnk); - - /* Check for soft link */ - if (H5L_TYPE_SOFT == lnk->type) { - /* Copy to output buffer */ - if (size > 0 && buf) { - HDstrncpy((char *)buf, lnk->u.soft.name, size); - if (HDstrlen(lnk->u.soft.name) >= size) - ((char *)buf)[size - 1] = '\0'; - } /* end if */ - } /* end if */ - /* Check for user-defined link */ - else if (lnk->type >= H5L_TYPE_UD_MIN) { - const H5L_class_t *link_class; /* User-defined link class */ - - /* Get the link class for this type of link. It's okay if the class - * isn't registered, though--we just can't give any more information - * about it - */ - link_class = H5L_find_class(lnk->type); - - if (link_class != NULL && link_class->query_func != NULL) { - if ((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure") - } /* end if */ - else if (buf && size > 0) - ((char *)buf)[0] = '\0'; - } /* end if */ - else - HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "object is not a symbolic or user-defined link") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_val_real() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_val_cb - * - * Purpose: Callback for retrieving link value or udata. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, September 20, 2005 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_val_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_gv_t *udata = (H5L_trav_gv_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the name in this group resolved to a valid link */ - if (lnk == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name) - - /* Retrieve the value for the link */ - if (H5L__get_val_real(lnk, udata->buf, udata->size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value") - -done: - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_val_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_val - * - * Purpose: Returns the value of a symbolic link or the udata for a - * user-defined link. - * - * Return: Success: Non-negative, with at most SIZE bytes of the - * link value copied into the BUF buffer. If the - * link value is larger than SIZE characters - * counting the null terminator then the BUF - * result will not be null terminated. - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Monday, April 13, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size) -{ - H5L_trav_gv_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(loc); - HDassert(name && *name); - - /* Set up user data for retrieving information */ - udata.size = size; - udata.buf = buf; - - /* Traverse the group hierarchy to locate the object to get info about */ - if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5L__get_val() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_val_by_idx_cb - * - * Purpose: Callback for retrieving a link's value according to an - * index's order. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, November 13 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_val_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ - H5O_link_t fnd_lnk; /* Link within group */ - hbool_t lnk_copied = FALSE; /* Whether the link was copied */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the name of the group resolved to a valid object */ - if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") - - /* Query link */ - if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") - lnk_copied = TRUE; - - /* Retrieve the value for the link */ - if (H5L__get_val_real(&fnd_lnk, udata->buf, udata->size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value") - -done: - /* Reset the link information, if we have a copy */ - if (lnk_copied) - H5O_msg_reset(H5O_LINK_ID, &fnd_lnk); - - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_val_by_idx_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_val_by_idx - * - * Purpose: Internal routine to query a link value according to the - * index within a group - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -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) -{ - H5L_trav_gvbi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Set up user data for retrieving information */ - udata.idx_type = idx_type; - udata.order = order; - udata.n = n; - udata.buf = buf; - udata.size = size; - - /* Traverse the group hierarchy to locate the object to get info about */ - if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n) - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_val_by_idx() */ - -/*------------------------------------------------------------------------- - * Function: H5L__delete_cb - * - * Purpose: Callback for deleting a link. This routine - * actually deletes the link - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, September 19, 2005 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t H5_ATTR_UNUSED *obj_loc, void H5_ATTR_UNUSED *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_STATIC - - /* Check if the group resolved to a valid link */ - if (grp_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") - - /* Check if the name in this group resolved to a valid link */ - if (name == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") - - /* Check for non-existent (NULL) link. - * Note that this can also occur when attempting to remove '.' - */ - if (lnk == NULL) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, - "callback link pointer is NULL (specified link may be '.' or not exist)") - - /* Remove the link from the group */ - if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group") - -done: - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__delete_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__delete - * - * Purpose: Delete a link from a group. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, September 17, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L__delete(const H5G_loc_t *loc, const char *name) -{ - char * norm_name = NULL; /* Pointer to normalized name */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(loc); - HDassert(name && *name); - - /* Get normalized copy of the name */ - if ((norm_name = H5G_normalize(name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") - - /* Set up user data for unlink operation */ - if (H5G_traverse(loc, norm_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, H5L__delete_cb, - NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTREMOVE, FAIL, "can't unlink object") - -done: - /* Free the normalized path name */ - if (norm_name) - H5MM_xfree(norm_name); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__delete() */ - -/*------------------------------------------------------------------------- - * Function: H5L__delete_by_idx_cb - * - * Purpose: Callback for removing a link according to an index's order. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, November 13 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__delete_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_TAG((obj_loc) ? (obj_loc->oloc->addr) : HADDR_UNDEF) - - /* Check if the name of the group resolved to a valid object */ - if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") - - /* Delete link */ - if (H5G_obj_remove_by_idx(obj_loc->oloc, obj_loc->path->full_path_r, udata->idx_type, udata->order, - udata->n) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") - -done: - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5L__delete_by_idx_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__delete_by_idx - * - * Purpose: Internal routine to delete a link according to its index - * within a group. - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -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) -{ - H5L_trav_rmbi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(loc); - HDassert(name && *name); - - /* Set up user data for unlink operation */ - udata.idx_type = idx_type; - udata.order = order; - udata.n = n; - - /* Traverse the group hierarchy to remove the link */ - if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, - H5L__delete_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__delete_by_idx() */ - -/*------------------------------------------------------------------------- - * Function: H5L__move_dest_cb - * - * Purpose: Second callback for moving and renaming an object. This routine - * inserts a new link into the group returned by the traversal. - * It is called by H5L__move_cb. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Monday, April 3, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_ATTR_UNUSED *lnk, - H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_mv2_t *udata = (H5L_trav_mv2_t *)_udata; /* User data passed in */ - H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */ - hid_t grp_id = FAIL; /* ID for this group (passed to user callback */ - H5G_loc_t temp_loc; /* For UD callback */ - hbool_t temp_loc_init = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Make sure an object with this name doesn't already exist */ - if (obj_loc != NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "an object with that name already exists") - - /* Check for crossing file boundaries with a new hard link */ - if (udata->lnk->type == H5L_TYPE_HARD) - /* Check that both objects are in same file */ - if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed") - - /* Give the object its new name */ - /* Casting away const okay -JML */ - HDassert(udata->lnk->name == NULL); - udata->lnk->name = (char *)name; - - /* Insert the link into the group */ - if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") - - /* If the link was a user-defined link, call its move callback if it has one */ - if (udata->lnk->type >= H5L_TYPE_UD_MIN) { - const H5L_class_t *link_class; /* User-defined link class */ - - /* Get the link class for this type of link. */ - if (NULL == (link_class = H5L_find_class(udata->lnk->type))) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered") - - if ((!udata->copy && link_class->move_func) || (udata->copy && link_class->copy_func)) { - H5O_loc_t temp_oloc; - H5G_name_t temp_path; - - /* Create a temporary location (or else H5G_open will do a shallow - * copy and wipe out grp_loc) - */ - H5G_name_reset(&temp_path); - if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location") - - temp_loc.oloc = &temp_oloc; - temp_loc.path = &temp_path; - temp_loc_init = TRUE; - - /* Set up location for user-defined callback */ - if (NULL == (grp = H5G_open(&temp_loc))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") - - if (udata->copy) { - if ((link_class->copy_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, - udata->lnk->u.ud.size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD copy callback returned error") - } /* end if */ - else { - if ((link_class->move_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, - udata->lnk->u.ud.size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD move callback returned error") - } /* end else */ - } /* end if */ - } /* end if */ - -done: - /* Close the location given to the user callback if it was created */ - if (grp_id >= 0) { - if (H5I_dec_app_ref(grp_id) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") - } /* end if */ - else if (grp != NULL) { - if (H5G_close(grp) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback") - } /* end if */ - else if (temp_loc_init) - H5G_loc_free(&temp_loc); - - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - /* Reset the "name" field in udata->lnk because it is owned by traverse() - * and must not be manipulated after traverse closes */ - udata->lnk->name = NULL; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__move_dest_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__move_cb - * - * Purpose: Callback for moving and renaming an object. This routine - * replaces the names of open objects with the moved object - * in the path - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Friday, April 3, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, - void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_mv_t *udata = (H5L_trav_mv_t *)_udata; /* User data passed in */ - H5L_trav_mv2_t udata_out; /* User data for H5L__move_dest_cb traversal */ - char * orig_name = NULL; /* The name of the link in this group */ - hbool_t link_copied = FALSE; /* Has udata_out.lnk been allocated? */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the name in this group resolved to a valid link */ - if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") - - /* Check for operations on '.' */ - if (lnk == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "the name of a link must be supplied to move or copy") - - /* Set up user data for move_dest_cb */ - if (NULL == (udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL))) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved") - - /* In this special case, the link's name is going to be replaced at its - * destination, so we should free it here. - */ - udata_out.lnk->name = (char *)H5MM_xfree(udata_out.lnk->name); - link_copied = TRUE; - - udata_out.lnk->cset = udata->cset; - udata_out.file = grp_loc->oloc->file; - udata_out.copy = udata->copy; - - /* Keep a copy of link's name (it's "owned" by the H5G_traverse() routine) */ - orig_name = H5MM_xstrdup(name); - - /* Reset the # of soft / UD links that can be traversed, so that the second - * (destination) traversal has the correct value - */ - if (H5CX_set_nlinks(udata->orig_nlinks) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't reset # of soft / UD links to traverse") - - /* Insert the link into its new location */ - if (H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb, - &udata_out) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") - - /* If this is a move and not a copy operation, change the object's name and remove the old link */ - if (!udata->copy) { - H5RS_str_t *dst_name_r; /* Ref-counted version of dest name */ - - /* Make certain that the destination name is a full (not relative) path */ - if (*(udata->dst_name) != '/') { - HDassert(udata->dst_loc->path->full_path_r); - - /* Create reference counted string for full dst path */ - if ((dst_name_r = H5G_build_fullpath_refstr_str(udata->dst_loc->path->full_path_r, - udata->dst_name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_PATH, FAIL, "can't build destination path name") - } /* end if */ - else - dst_name_r = H5RS_wrap(udata->dst_name); - HDassert(dst_name_r); - - /* Fix names up */ - if (H5G_name_replace(lnk, H5G_NAME_MOVE, obj_loc->oloc->file, obj_loc->path->full_path_r, - udata->dst_loc->oloc->file, dst_name_r) < 0) { - H5RS_decr(dst_name_r); - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to replace name") - } /* end if */ - - /* Remove the old link */ - if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, orig_name) < 0) { - H5RS_decr(dst_name_r); - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to remove old name") - } /* end if */ - - H5RS_decr(dst_name_r); - } /* end if */ - -done: - /* Cleanup */ - if (orig_name) - H5MM_xfree(orig_name); - - /* If udata_out.lnk was copied, free any memory allocated - * In this special case, the H5L__move_dest_cb callback resets the name - * so H5O_msg_free shouldn't try to free it - */ - if (link_copied) - H5O_msg_free(H5O_LINK_ID, udata_out.lnk); - - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__move_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__move - * - * Purpose: Atomically move or copy a link. - * - * Creates a copy of a link in a new destination with a new name. - * SRC_LOC and SRC_NAME together define the link's original - * location, while DST_LOC and DST_NAME together define its - * final location. - * - * If copy_flag is FALSE, the original link is removed - * (effectively moving the link). - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Monday, May 1, 2006 - * - *------------------------------------------------------------------------- - */ -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) -{ - unsigned dst_target_flags = H5G_TARGET_NORMAL; - H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */ - H5P_genplist_t *lc_plist; /* Link creation property list */ - H5L_trav_mv_t udata; /* User data for traversal */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(src_loc); - HDassert(dst_loc); - HDassert(src_name && *src_name); - HDassert(dst_name && *dst_name); - - /* Check for flags present in creation property list */ - if (lcpl_id != H5P_DEFAULT) { - unsigned crt_intmd_group; - - if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Get intermediate group creation property */ - if (H5CX_get_intermediate_group(&crt_intmd_group) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups") - - /* Set target flags for source and destination */ - if (crt_intmd_group > 0) - dst_target_flags |= H5G_CRT_INTMD_GROUP; - - /* Get character encoding property */ - if (H5CX_get_encoding(&char_encoding) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding") - } /* end if */ - - /* Set up user data */ - udata.dst_loc = dst_loc; - udata.dst_name = dst_name; - udata.dst_target_flags = dst_target_flags; - udata.cset = char_encoding; - udata.copy = copy_flag; - - /* Retrieve the original # of soft / UD links that can be traversed, so - * that the countdown can be reset after the first path is traversed. - */ - if (H5CX_get_nlinks(&udata.orig_nlinks) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") - - /* Do the move */ - if (H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__move_cb, - &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__move() */ - -/*------------------------------------------------------------------------- - * Function: H5L__exists_final_cb - * - * Purpose: Callback for checking whether a link exists, as the final - * component of a path - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, March 16 2007 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */ - - FUNC_ENTER_STATIC_NOERR - - /* Check if the name in this group resolved to a valid link */ - *udata->exists = (hbool_t)(lnk != NULL); - - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5L__exists_final_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__exists_inter_cb - * - * Purpose: Callback for checking whether a link exists, as an intermediate - * component of a path - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, December 31 2015 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the name in this group resolved to a valid link */ - if (lnk != NULL) { - /* Check for more components to the path */ - if (udata->sep) { - H5G_traverse_t cb_func; /* Callback function for tranversal */ - char * next; /* Pointer to next component name */ - - /* Look for another separator */ - next = udata->sep; - if (NULL == (udata->sep = HDstrchr(udata->sep, '/'))) - cb_func = H5L__exists_final_cb; - else { - /* Chew through adjacent separators, if present */ - do { - *udata->sep = '\0'; - udata->sep++; - } while ('/' == *udata->sep); - cb_func = H5L__exists_inter_cb; - } /* end else */ - if (H5G_traverse(obj_loc, next, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists") - } /* end if */ - else - *udata->exists = TRUE; - } /* end if */ - else - *udata->exists = FALSE; - - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__exists_inter_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L_exists_tolerant - * - * Purpose: Returns whether a link exists in a group - * - * Note: Same as H5L__exists, except that missing links are reported - * as 'FALSE' instead of causing failures - * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, December 31 2015 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hbool_t *exists) -{ - H5L_trav_le_t udata; /* User data for traversal */ - H5G_traverse_t cb_func; /* Callback function for tranversal */ - char * name_copy = NULL; /* Duplicate of name */ - char * name_trav; /* Name to traverse */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(loc); - HDassert(name); - HDassert(exists); - - /* Copy the name and skip leading '/'s */ - name_trav = name_copy = H5MM_strdup(name); - while ('/' == *name_trav) - name_trav++; - - /* A path of "/" will always exist in a file */ - if ('\0' == *name_trav) - *exists = TRUE; - else { - /* Set up user data & correct callback */ - udata.exists = exists; - if (NULL == (udata.sep = HDstrchr(name_trav, '/'))) - cb_func = H5L__exists_final_cb; - else { - /* Chew through adjacent separators, if present */ - do { - *udata.sep = '\0'; - udata.sep++; - } while ('/' == *udata.sep); - cb_func = H5L__exists_inter_cb; - } /* end else */ - - /* Traverse the group hierarchy to locate the link to check */ - if (H5G_traverse(loc, name_trav, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists") - } - -done: - /* Release duplicated string */ - H5MM_xfree(name_copy); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_exists_tolerant() */ - -/*------------------------------------------------------------------------- - * Function: H5L__exists - * - * Purpose: Returns whether a link exists in a group - * - * Note: Same as H5L_exists_tolerant, except that missing links are reported - * as failures - * - * Return: Non-negative on success, with *exists set/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, March 16 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists) -{ - H5L_trav_le_t udata; /* User data for traversal */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(loc); - HDassert(name); - HDassert(exists); - - /* A path of "/" will always exist in a file */ - if (0 == HDstrcmp(name, "/")) - *exists = TRUE; - else { - /* Traverse the group hierarchy to locate the object to get info about */ - udata.exists = exists; - if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__exists_final_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "link doesn't exist") - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5L__exists() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_info_cb - * - * Purpose: Callback for retrieving a link's metadata - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Monday, April 17 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t *lnk, - H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_gi_t *udata = (H5L_trav_gi_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the name in this group resolved to a valid link */ - if (lnk == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") - - /* Get information from the link */ - if (H5G_link_to_info(grp_loc->oloc, lnk, udata->linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") - -done: - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_info_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L_get_info - * - * Purpose: Returns metadata about a link. - * - * Return: SUCCEED/FAIL - * - * Programmer: James Laird - * Monday, April 17 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo /*out*/) -{ - H5L_trav_gi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - udata.linfo = linfo; - - /* Traverse the group hierarchy to locate the object to get info about */ - if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_get_info() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_info_by_idx_cb - * - * Purpose: Callback for retrieving a link's metadata according to an - * index's order. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, November 6 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_info_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_gibi_t *udata = (H5L_trav_gibi_t *)_udata; /* User data passed in */ - H5O_link_t fnd_lnk; /* Link within group */ - hbool_t lnk_copied = FALSE; /* Whether the link was copied */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the name of the group resolved to a valid object */ - if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") - - /* Query link */ - if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") - lnk_copied = TRUE; - - /* Get information from the link */ - if (H5G_link_to_info(obj_loc->oloc, &fnd_lnk, udata->linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") - -done: - /* Reset the link information, if we have a copy */ - if (lnk_copied) - H5O_msg_reset(H5O_LINK_ID, &fnd_lnk); - - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_info_by_idx_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_info_by_idx - * - * Purpose: Internal routine to retrieve link info according to an - * index's order. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -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*/) -{ - H5L_trav_gibi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(linfo); - - /* Set up user data for callback */ - udata.idx_type = idx_type; - udata.order = order; - udata.n = n; - udata.linfo = linfo; - - /* Traverse the group hierarchy to locate the object to get info about */ - if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_info_by_idx() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_name_by_idx_cb - * - * Purpose: Callback for retrieving a link's name according to an - * index's order. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, November 11 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_name_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, - H5G_own_loc_t *own_loc /*out*/) -{ - H5L_trav_gnbi_t *udata = (H5L_trav_gnbi_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the name of the group resolved to a valid object */ - if (obj_loc == NULL) - 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) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") - -done: - /* Indicate that this callback didn't take ownership of the group * - * location for the object */ - *own_loc = H5G_OWN_NONE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_name_by_idx_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5L__get_name_by_idx - * - * Purpose: Internal routine to retrieve link name according to an - * index's order. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -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) -{ - H5L_trav_gnbi_t udata; /* User data for callback */ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - HDassert(loc); - HDassert(group_name && *group_name); - - /* Set up user data for callback */ - udata.idx_type = idx_type; - udata.order = order; - udata.n = n; - udata.name = name; - udata.size = size; - udata.name_len = -1; - - /* 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) < - 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get name") - - /* Set the return value */ - ret_value = udata.name_len; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_name_by_idx() */ - -/*------------------------------------------------------------------------- - * Function: H5L__link_copy_file - * - * Purpose: Copy a link and the object it points to from one file to - * another. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Sep 29 2006 - * - *------------------------------------------------------------------------- - */ -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) -{ - H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */ - const H5O_link_t *src_lnk = _src_lnk; /* Source link */ - hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */ - hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */ - H5G_loc_t tmp_src_loc; /* Group location holding target object */ - H5G_name_t tmp_src_path; /* Path for target object */ - H5O_loc_t tmp_src_oloc; /* Object location for target object */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* check arguments */ - HDassert(dst_file); - HDassert(src_lnk); - HDassert(dst_lnk); - HDassert(cpy_info); - - /* 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 */ - - /* Set up group location for link */ - H5G_name_reset(&lnk_grp_path); - lnk_grp_loc.path = &lnk_grp_path; - 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) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to check if target object exists") - - if (tar_exists) { - /* Make a temporary copy of the link, so that it will not change the - * info in the cache when we change it to a hard link */ - if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk)) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message") - - /* Set up group location for target object. Let H5G_traverse expand - * the link. */ - tmp_src_loc.path = &tmp_src_path; - tmp_src_loc.oloc = &tmp_src_oloc; - if (H5G_loc_reset(&tmp_src_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to reset location") - - /* Find the target object */ - if (H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to find target object") - expanded_link_open = TRUE; - - /* Convert symbolic link to hard link */ - if (tmp_src_lnk.type == H5L_TYPE_SOFT) - tmp_src_lnk.u.soft.name = (char *)H5MM_xfree(tmp_src_lnk.u.soft.name); - else if (tmp_src_lnk.u.ud.size > 0) - tmp_src_lnk.u.ud.udata = H5MM_xfree(tmp_src_lnk.u.ud.udata); - tmp_src_lnk.type = H5L_TYPE_HARD; - tmp_src_lnk.u.hard.addr = tmp_src_oloc.addr; - src_lnk = &tmp_src_lnk; - } /* end if */ - } /* end if */ - - /* Copy src link information to dst link information */ - if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk)) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message") - dst_lnk_init = TRUE; - - /* Check if object in source group is a hard link & copy it */ - if (H5L_TYPE_HARD == src_lnk->type) { - H5O_loc_t new_dst_oloc; /* Copied object location in destination */ - - /* Set up copied object location to fill in */ - H5O_loc_reset(&new_dst_oloc); - new_dst_oloc.file = dst_file; - - if (!expanded_link_open) { - /* Build temporary object location for source */ - H5O_loc_reset(&tmp_src_oloc); - tmp_src_oloc.file = src_oloc->file; - tmp_src_oloc.addr = src_lnk->u.hard.addr; - } /* end if */ - HDassert(H5F_addr_defined(tmp_src_oloc.addr)); - - /* Copy the shared object from source to destination */ - /* Don't care about obj_type or udata because those are only important - * for old style groups */ - if (H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, cpy_info, TRUE, NULL, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object") - - /* Copy new destination object's information for eventual insertion */ - dst_lnk->u.hard.addr = new_dst_oloc.addr; - } /* end if */ - -done: - /* Check if we used a temporary src link */ - if (src_lnk != _src_lnk) { - HDassert(src_lnk == &tmp_src_lnk); - H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk); - } /* end if */ - if (ret_value < 0) - if (dst_lnk_init) - H5O_msg_reset(H5O_LINK_ID, dst_lnk); - /* Check if we need to free the temp source oloc */ - if (expanded_link_open) - if (H5G_loc_free(&tmp_src_loc) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTFREE, FAIL, "unable to free object") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__link_copy_file() */ - -/*------------------------------------------------------------------------- - * Function: H5L_iterate - * - * Purpose: Iterates through links in a group - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5L_iterate(H5G_loc_t *loc, 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) -{ - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Sanity checks */ - HDassert(loc); - HDassert(group_name); - HDassert(op); - - /* Set up iteration beginning/end info */ - idx = (idx_p == NULL ? 0 : *idx_p); - last_lnk = 0; - - /* Build link operator info */ - lnk_op.op_type = H5G_LINK_OP_NEW; - lnk_op.op_func.op_new = op; - - /* Iterate over the links */ - if ((ret_value = H5G_iterate(loc, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") - - /* Set the index we stopped at */ - if (idx_p) - *idx_p = last_lnk; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_iterate() */ diff --git a/src/H5Lint.c b/src/H5Lint.c new file mode 100644 index 0000000..a8e9ba2 --- /dev/null +++ b/src/H5Lint.c @@ -0,0 +1,2240 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Lmodule.h" /* This source code file is part of the H5L module */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* File objects */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + +/****************/ +/* Local Macros */ +/****************/ + +#define H5L_MIN_TABLE_SIZE 32 /* Minimum size of the user-defined link type table if it is allocated */ + +/******************/ +/* Local Typedefs */ +/******************/ + +/* User data for path traversal routine for getting link info by name */ +typedef struct { + H5L_info2_t *linfo; /* Buffer to return to user */ +} H5L_trav_gi_t; + +/* User data for path traversal callback to creating a link */ +typedef struct { + H5F_t * file; /* Pointer to the file */ + H5P_genplist_t * lc_plist; /* Link creation property list */ + H5G_name_t * path; /* Path to object being linked */ + H5O_obj_create_t *ocrt_info; /* Pointer to object creation info */ + H5O_link_t * lnk; /* Pointer to link information to insert */ +} H5L_trav_cr_t; + +/* User data for path traversal routine for moving and renaming a link */ +typedef struct { + const char * dst_name; /* Destination name for moving object */ + H5T_cset_t cset; /* Char set for new name */ + const H5G_loc_t *dst_loc; /* Destination location for moving object */ + unsigned dst_target_flags; /* Target flags for destination object */ + hbool_t copy; /* TRUE if this is a copy operation */ + size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */ +} H5L_trav_mv_t; + +/* User data for path traversal routine for moving and renaming an object */ +typedef struct { + H5F_t * file; /* Pointer to the file */ + H5O_link_t *lnk; /* Pointer to link information to insert */ + hbool_t copy; /* TRUE if this is a copy operation */ +} H5L_trav_mv2_t; + +/* User data for path traversal routine for checking if a link exists */ +typedef struct { + /* Down */ + char *sep; /* Pointer to next separator in the string */ + + /* Up */ + hbool_t *exists; /* Whether the link exists or not */ +} H5L_trav_le_t; + +/* User data for path traversal routine for getting link value */ +typedef struct { + size_t size; /* Size of user buffer */ + void * buf; /* User buffer */ +} H5L_trav_gv_t; + +/********************/ +/* Local Prototypes */ +/********************/ + +static int H5L__find_class_idx(H5L_type_t id); +static herr_t H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, + H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id); +static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size); +static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L__get_name_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Information about user-defined links */ +static size_t H5L_table_alloc_g = 0; +static size_t H5L_table_used_g = 0; +static H5L_class_t *H5L_table_g = NULL; + +/*------------------------------------------------------------------------- + * Function: H5L_init + * + * Purpose: Initialize the interface from some other package. + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: James Laird + * Thursday, July 13, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_init() */ + +/*------------------------------------------------------------------------- + * Function: H5L__init_package + * + * Purpose: Initialize information specific to H5L interface. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Tuesday, January 24, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L__init_package(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Initialize user-defined link classes */ + if (H5L_register_external() < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_init_package() */ + +/*------------------------------------------------------------------------- + * Function: H5L_term_package + * + * Purpose: Terminate any resources allocated in H5L__init_package. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Tuesday, January 24, 2006 + * + *------------------------------------------------------------------------- + */ +int +H5L_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (H5_PKG_INIT_VAR) { + /* Free the table of link types */ + if (H5L_table_g) { + H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g); + H5L_table_used_g = H5L_table_alloc_g = 0; + n++; + } /* end if */ + + /* Mark the interface as uninitialized */ + if (0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* H5L_term_package() */ + +/*------------------------------------------------------------------------- + * Function: H5L__find_class_idx + * + * Purpose: Given a link class ID, return the offset in the global array + * that holds all the registered link classes. + * + * Return: Success: Non-negative index of entry in global + * link class table. + * Failure: Negative + * + * Programmer: James Laird + * Monday, July 10, 2006 + * + *------------------------------------------------------------------------- + */ +static int +H5L__find_class_idx(H5L_type_t id) +{ + size_t i; /* Local index variable */ + int ret_value = FAIL; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + for (i = 0; i < H5L_table_used_g; i++) + if (H5L_table_g[i].id == id) + HGOTO_DONE((int)i) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__find_class_idx */ + +/*------------------------------------------------------------------------- + * Function: H5L_find_class + * + * Purpose: Given a link class ID return a pointer to a global struct that + * defines the link class. + * + * Return: Success: Ptr to entry in global link class table. + * Failure: NULL + * + * Programmer: James Laird + * Monday, July 10, 2006 + * + *------------------------------------------------------------------------- + */ +const H5L_class_t * +H5L_find_class(H5L_type_t id) +{ + int idx; /* Filter index in global table */ + H5L_class_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Get the index in the global table */ + if ((idx = H5L__find_class_idx(id)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class") + + /* Set return value */ + ret_value = H5L_table_g + idx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_find_class */ + +/*------------------------------------------------------------------------- + * Function: H5L_register + * + * Purpose: Registers a class of user-defined links, or changes the + * behavior of an existing class. + * + * See H5Lregister for full documentation. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Monday, July 10, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_register(const H5L_class_t *cls) +{ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(cls); + HDassert(cls->id >= 0 && cls->id <= H5L_TYPE_MAX); + + /* Is the link type already registered? */ + for (i = 0; i < H5L_table_used_g; i++) + if (H5L_table_g[i].id == cls->id) + break; + + /* Filter not already registered */ + if (i >= H5L_table_used_g) { + if (H5L_table_used_g >= H5L_table_alloc_g) { + size_t n = MAX(H5L_MIN_TABLE_SIZE, (2 * H5L_table_alloc_g)); + H5L_class_t *table = (H5L_class_t *)H5MM_realloc(H5L_table_g, (n * sizeof(H5L_class_t))); + if (!table) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table") + H5L_table_g = table; + H5L_table_alloc_g = n; + } /* end if */ + + /* Initialize */ + i = H5L_table_used_g++; + } /* end if */ + + /* Copy link class info into table */ + H5MM_memcpy(H5L_table_g + i, cls, sizeof(H5L_class_t)); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_register */ + +/*------------------------------------------------------------------------- + * Function: H5L_unregister + * + * Purpose: Unregisters a class of user-defined links. + * + * See H5Lunregister for full documentation. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Monday, July 10, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_unregister(H5L_type_t id) +{ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(id >= 0 && id <= H5L_TYPE_MAX); + + /* Is the filter already registered? */ + for (i = 0; i < H5L_table_used_g; i++) + if (H5L_table_g[i].id == id) + break; + + /* Fail if filter not found */ + if (i >= H5L_table_used_g) + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered") + + /* Remove filter from table */ + /* Don't worry about shrinking table size (for now) */ + HDmemmove(&H5L_table_g[i], &H5L_table_g[i + 1], sizeof(H5L_class_t) * ((H5L_table_used_g - 1) - i)); + H5L_table_used_g--; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_unregister() */ + +/*------------------------------------------------------------------------- + * Function: H5L_is_registered + * + * Purpose: Tests whether a user-defined link class has been registered + * or not. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_is_registered(H5L_type_t id, hbool_t *is_registered) +{ + size_t i; /* Local index variable */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check args */ + HDassert(is_registered); + + /* Is the link class already registered? */ + *is_registered = FALSE; + for (i = 0; i < H5L_table_used_g; i++) + if (H5L_table_g[i].id == id) { + *is_registered = TRUE; + break; + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5L_is_registered() */ + +/*------------------------------------------------------------------------- + * Function: H5L_link + * + * Purpose: Creates a link from OBJ_ID to CUR_NAME. See H5Olink() for + * full documentation. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Tuesday, December 13, 2005 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id) +{ + H5O_link_t lnk; /* Link to insert */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Check args */ + HDassert(new_loc); + HDassert(obj_loc); + HDassert(new_name && *new_name); + + /* The link callback will check that the object isn't being hard linked + * into a different file, so we don't need to do it here (there could be + * external links along the path). + */ + + /* Construct link information for eventual insertion */ + lnk.type = H5L_TYPE_HARD; + lnk.u.hard.addr = obj_loc->oloc->addr; + + /* Create the link */ + if (H5L__create_real(new_loc, new_name, obj_loc->path, obj_loc->oloc->file, &lnk, NULL, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_link() */ + +/*------------------------------------------------------------------------- + * Function: H5L_link_object + * + * Purpose: Creates a new object and a link to it. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, April 9, 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t *ocrt_info, hid_t lcpl_id) +{ + H5O_link_t lnk; /* Link to insert */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Check args */ + HDassert(new_loc); + HDassert(new_name && *new_name); + HDassert(ocrt_info); + + /* The link callback will check that the object isn't being hard linked + * into a different file, so we don't need to do it here (there could be + * external links along the path). + */ + + /* Construct link information for eventual insertion */ + lnk.type = H5L_TYPE_HARD; + + /* Create the link */ + if (H5L__create_real(new_loc, new_name, NULL, NULL, &lnk, ocrt_info, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_link_object() */ + +/*------------------------------------------------------------------------- + * Function: H5L__link_cb + * + * Purpose: Callback for creating a link to an object. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, September 19, 2005 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_ATTR_UNUSED *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_cr_t *udata = (H5L_trav_cr_t *)_udata; /* User data passed in */ + H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */ + hid_t grp_id = FAIL; /* Id for this group (passed to user callback */ + H5G_loc_t temp_loc; /* For UD callback */ + hbool_t temp_loc_init = FALSE; /* Temporary location for UD callback (temp_loc) has been initialized */ + hbool_t obj_created = FALSE; /* Whether an object was created (through a hard link) */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid location */ + /* (which is not what we want) */ + if (obj_loc != NULL) + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name already exists") + + /* Check for crossing file boundaries with a new hard link */ + if (udata->lnk->type == H5L_TYPE_HARD) { + /* Check for creating an object */ + /* (only for hard links) */ + if (udata->ocrt_info) { + H5G_loc_t new_loc; /* Group location for new object */ + + /* Create new object at this location */ + if (NULL == + (udata->ocrt_info->new_obj = H5O_obj_create(grp_loc->oloc->file, udata->ocrt_info->obj_type, + udata->ocrt_info->crt_info, &new_loc))) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create object") + + /* Set address for hard link */ + udata->lnk->u.hard.addr = new_loc.oloc->addr; + + /* Set object path to use for setting object name (below) */ + udata->path = new_loc.path; + + /* Indicate that an object was created */ + obj_created = TRUE; + } /* end if */ + else { + /* Check that both objects are in same file */ + if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "interfile hard links are not allowed") + } /* end else */ + } /* end if */ + + /* Set 'standard' aspects of link */ + udata->lnk->corder = + 0; /* Will be re-written during group insertion, if the group is tracking creation order */ + udata->lnk->corder_valid = FALSE; /* Creation order not valid (yet) */ + + /* Check for non-default link creation properties */ + if (udata->lc_plist) { + /* Get character encoding property */ + if (H5CX_get_encoding(&udata->lnk->cset) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property") + } /* end if */ + else + udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */ + + /* Set the link's name correctly */ + /* Casting away const OK -QAK */ + udata->lnk->name = (char *)name; + + /* Insert link into group */ + if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, + udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN, + udata->ocrt_info ? udata->ocrt_info->crt_info : NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object") + + /* Set object's path if it has been passed in and is not set */ + if (udata->path != NULL && udata->path->user_path_r == NULL) + if (H5G_name_set(grp_loc->path, udata->path, name) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "cannot set name") + + /* If link is a user-defined link, trigger its creation callback if it has one */ + if (udata->lnk->type >= H5L_TYPE_UD_MIN) { + const H5L_class_t *link_class; /* User-defined link class */ + + /* Get the link class for this type of link. */ + if (NULL == (link_class = H5L_find_class(udata->lnk->type))) + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get class of UD link") + + if (link_class->create_func != NULL) { + H5O_loc_t temp_oloc; + H5G_name_t temp_path; + + /* Create a temporary location (or else H5G_open will do a shallow + * copy and wipe out grp_loc) + */ + H5G_name_reset(&temp_path); + if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location") + + temp_loc.oloc = &temp_oloc; + temp_loc.path = &temp_path; + temp_loc_init = TRUE; + + /* Set up location for user-defined callback */ + if (NULL == (grp = H5G_open(&temp_loc))) + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") + if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") + + /* Make callback */ + if ((link_class->create_func)(name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size, + H5P_DEFAULT) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link creation callback failed") + } /* end if */ + } /* end if */ + +done: + /* Check if an object was created */ + if (obj_created) { + H5O_loc_t oloc; /* Object location for created object */ + + /* Set up object location */ + HDmemset(&oloc, 0, sizeof(oloc)); + oloc.file = grp_loc->oloc->file; + oloc.addr = udata->lnk->u.hard.addr; + + /* Decrement refcount on new object's object header in memory */ + if (H5O_dec_rc_by_loc(&oloc) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + } /* end if */ + + /* Close the location given to the user callback if it was created */ + if (grp_id >= 0) { + if (H5I_dec_app_ref(grp_id) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") + } /* end if */ + else if (grp != NULL) { + if (H5G_close(grp) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback") + } /* end if */ + else if (temp_loc_init) + H5G_loc_free(&temp_loc); + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__link_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__create_real + * + * Purpose: Creates a link at a path location + * + * lnk should have linkclass-specific information already + * set, but this function will take care of setting name. + * + * obj_path can be NULL if the object's path doesn't need to + * be set, and obj_file can be NULL if the object is not a + * hard link. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, December 5, 2005 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file, + H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id) +{ + char * norm_link_name = NULL; /* Pointer to normalized link name */ + unsigned target_flags = H5G_TARGET_NORMAL; /* Flags to pass to group traversal function */ + H5P_genplist_t *lc_plist = NULL; /* Link creation property list */ + H5L_trav_cr_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(link_loc); + HDassert(link_name && *link_name); + HDassert(lnk); + HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX); + + /* Get normalized link name */ + if ((norm_link_name = H5G_normalize(link_name)) == NULL) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") + + /* Check for flags present in creation property list */ + if (lcpl_id != H5P_DEFAULT) { + unsigned crt_intmd_group; + + /* Get link creation property list */ + if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get intermediate group creation property */ + if (H5CX_get_intermediate_group(&crt_intmd_group) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property") + + if (crt_intmd_group > 0) + target_flags |= H5G_CRT_INTMD_GROUP; + } /* end if */ + + /* Set up user data + * FILE is used to make sure that hard links don't cross files, and + * should be NULL for other link types. + * LC_PLIST is a pointer to the link creation property list. + * PATH is a pointer to the path of the object being inserted if this is + * a hard link; this is used to set the paths to objects when they are + * created. For other link types, this is NULL. + * OCRT_INFO is a pointer to the structure for object creation. + * LNK is the link struct passed into this function. At this point all + * of its fields should be populated except for name, which is set when + * inserting it in the callback. + */ + udata.file = obj_file; + udata.lc_plist = lc_plist; + udata.path = obj_path; + udata.ocrt_info = ocrt_info; + udata.lnk = lnk; + + /* Traverse the destination path & create new link */ + if (H5G_traverse(link_loc, link_name, target_flags, H5L__link_cb, &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert link") + +done: + /* Free the normalized path name */ + if (norm_link_name) + H5MM_xfree(norm_link_name); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__create_real() */ + +/*------------------------------------------------------------------------- + * Function: H5L__create_hard + * + * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Monday, April 6, 1998 + * + *------------------------------------------------------------------------- + */ +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) +{ + char * norm_cur_name = NULL; /* Pointer to normalized current name */ + H5F_t * link_file = NULL; /* Pointer to file to link to */ + H5O_link_t lnk; /* Link to insert */ + H5G_loc_t obj_loc; /* Location of object to link to */ + H5G_name_t path; /* obj_loc's path*/ + H5O_loc_t oloc; /* obj_loc's oloc */ + hbool_t loc_valid = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + HDassert(cur_loc); + HDassert(cur_name && *cur_name); + HDassert(link_loc); + HDassert(link_name && *link_name); + + /* Get normalized copy of the current name */ + if ((norm_cur_name = H5G_normalize(cur_name)) == NULL) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") + + /* Set up link data specific to hard links */ + lnk.type = H5L_TYPE_HARD; + + /* Get object location for object pointed to */ + obj_loc.path = &path; + obj_loc.oloc = &oloc; + H5G_loc_reset(&obj_loc); + if (H5G_loc_find(cur_loc, norm_cur_name, &obj_loc) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "source object not found") + loc_valid = TRUE; + + /* Construct link information for eventual insertion */ + lnk.u.hard.addr = obj_loc.oloc->addr; + + /* Set destination's file information */ + link_file = obj_loc.oloc->file; + + /* Create actual link to the object. Pass in NULL for the path, since this + * function shouldn't change an object's user path. */ + if (H5L__create_real(link_loc, link_name, NULL, link_file, &lnk, NULL, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + +done: + /* Free the object header location */ + if (loc_valid) + if (H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to free location") + + /* Free the normalized path name */ + if (norm_cur_name) + H5MM_xfree(norm_cur_name); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__create_hard() */ + +/*------------------------------------------------------------------------- + * Function: H5L__create_soft + * + * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. + * + * Return: SUCCEED/FAIL + * + * Programmer: Robb Matzke + * Monday, April 6, 1998 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) +{ + char * norm_target = NULL; /* Pointer to normalized current name */ + H5O_link_t lnk; /* Link to insert */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + HDassert(link_loc); + HDassert(target_path && *target_path); + HDassert(link_name && *link_name); + + /* Get normalized copy of the link target */ + if ((norm_target = H5G_normalize(target_path)) == NULL) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") + + /* Set up link data specific to soft links */ + lnk.type = H5L_TYPE_SOFT; + lnk.u.soft.name = norm_target; + + /* Create actual link to the object */ + if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + +done: + /* Free the normalized target name */ + if (norm_target) + H5MM_xfree(norm_target); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__create_soft() */ + +/*------------------------------------------------------------------------- + * Function: H5L__create_ud + * + * Purpose: Creates a user-defined link. See H5Lcreate_ud for + * full documentation. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Friday, May 19, 2006 + * + *------------------------------------------------------------------------- + */ +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) +{ + H5O_link_t lnk; /* Link to insert */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX); + HDassert(link_loc); + HDassert(link_name && *link_name); + HDassert(ud_data_size == 0 || ud_data); + + /* Initialize the link struct's pointer to its udata buffer */ + lnk.u.ud.udata = NULL; + + /* Make sure that this link class is registered */ + if (H5L__find_class_idx(type) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library") + + /* Fill in UD link-specific information in the link struct*/ + if (ud_data_size > 0) { + lnk.u.ud.udata = H5MM_malloc((size_t)ud_data_size); + H5MM_memcpy(lnk.u.ud.udata, ud_data, (size_t)ud_data_size); + } /* end if */ + else + lnk.u.ud.udata = NULL; + + lnk.u.ud.size = ud_data_size; + lnk.type = type; + + /* Create actual link to the object */ + if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to register new name for object") + +done: + /* Free the link's udata buffer if it's been allocated */ + H5MM_xfree(lnk.u.ud.udata); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__create_ud() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_val_real + * + * Purpose: Retrieve link value from a link object + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, November 13 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(lnk); + + /* Check for soft link */ + if (H5L_TYPE_SOFT == lnk->type) { + /* Copy to output buffer */ + if (size > 0 && buf) { + HDstrncpy((char *)buf, lnk->u.soft.name, size); + if (HDstrlen(lnk->u.soft.name) >= size) + ((char *)buf)[size - 1] = '\0'; + } /* end if */ + } /* end if */ + /* Check for user-defined link */ + else if (lnk->type >= H5L_TYPE_UD_MIN) { + const H5L_class_t *link_class; /* User-defined link class */ + + /* Get the link class for this type of link. It's okay if the class + * isn't registered, though--we just can't give any more information + * about it + */ + link_class = H5L_find_class(lnk->type); + + if (link_class != NULL && link_class->query_func != NULL) { + if ((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure") + } /* end if */ + else if (buf && size > 0) + ((char *)buf)[0] = '\0'; + } /* end if */ + else + HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "object is not a symbolic or user-defined link") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_val_real() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_val_cb + * + * Purpose: Callback for retrieving link value or udata. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, September 20, 2005 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__get_val_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_gv_t *udata = (H5L_trav_gv_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if (lnk == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name) + + /* Retrieve the value for the link */ + if (H5L__get_val_real(lnk, udata->buf, udata->size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value") + +done: + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_val_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_val + * + * Purpose: Returns the value of a symbolic link or the udata for a + * user-defined link. + * + * Return: Success: Non-negative, with at most SIZE bytes of the + * link value copied into the BUF buffer. If the + * link value is larger than SIZE characters + * counting the null terminator then the BUF + * result will not be null terminated. + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Monday, April 13, 1998 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size) +{ + H5L_trav_gv_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(loc); + HDassert(name && *name); + + /* Set up user data for retrieving information */ + udata.size = size; + udata.buf = buf; + + /* Traverse the group hierarchy to locate the object to get info about */ + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_cb, &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5L__get_val() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_val_by_idx_cb + * + * Purpose: Callback for retrieving a link's value according to an + * index's order. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, November 13 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__get_val_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ + H5O_link_t fnd_lnk; /* Link within group */ + hbool_t lnk_copied = FALSE; /* Whether the link was copied */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name of the group resolved to a valid object */ + if (obj_loc == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + + /* Query link */ + if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") + lnk_copied = TRUE; + + /* Retrieve the value for the link */ + if (H5L__get_val_real(&fnd_lnk, udata->buf, udata->size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value") + +done: + /* Reset the link information, if we have a copy */ + if (lnk_copied) + H5O_msg_reset(H5O_LINK_ID, &fnd_lnk); + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_val_by_idx_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_val_by_idx + * + * Purpose: Internal routine to query a link value according to the + * index within a group + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * December 27, 2017 + * + *------------------------------------------------------------------------- + */ +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) +{ + H5L_trav_gvbi_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + HDassert(loc); + HDassert(name && *name); + + /* Set up user data for retrieving information */ + udata.idx_type = idx_type; + udata.order = order; + udata.n = n; + udata.buf = buf; + udata.size = size; + + /* Traverse the group hierarchy to locate the object to get info about */ + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_by_idx_cb, &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_val_by_idx() */ + +/*------------------------------------------------------------------------- + * Function: H5L__delete_cb + * + * Purpose: Callback for deleting a link. This routine + * actually deletes the link + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, September 19, 2005 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t H5_ATTR_UNUSED *obj_loc, void H5_ATTR_UNUSED *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Check if the group resolved to a valid link */ + if (grp_loc == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + + /* Check if the name in this group resolved to a valid link */ + if (name == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") + + /* Check for non-existent (NULL) link. + * Note that this can also occur when attempting to remove '.' + */ + if (lnk == NULL) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, + "callback link pointer is NULL (specified link may be '.' or not exist)") + + /* Remove the link from the group */ + if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group") + +done: + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__delete_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__delete + * + * Purpose: Delete a link from a group. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Thursday, September 17, 1998 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L__delete(const H5G_loc_t *loc, const char *name) +{ + char * norm_name = NULL; /* Pointer to normalized name */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(loc); + HDassert(name && *name); + + /* Get normalized copy of the name */ + if ((norm_name = H5G_normalize(name)) == NULL) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") + + /* Set up user data for unlink operation */ + if (H5G_traverse(loc, norm_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, H5L__delete_cb, + NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTREMOVE, FAIL, "can't unlink object") + +done: + /* Free the normalized path name */ + if (norm_name) + H5MM_xfree(norm_name); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__delete() */ + +/*------------------------------------------------------------------------- + * Function: H5L__delete_by_idx_cb + * + * Purpose: Callback for removing a link according to an index's order. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, November 13 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__delete_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC_TAG((obj_loc) ? (obj_loc->oloc->addr) : HADDR_UNDEF) + + /* Check if the name of the group resolved to a valid object */ + if (obj_loc == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + + /* Delete link */ + if (H5G_obj_remove_by_idx(obj_loc->oloc, obj_loc->path->full_path_r, udata->idx_type, udata->order, + udata->n) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") + +done: + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI_TAG(ret_value) +} /* end H5L__delete_by_idx_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__delete_by_idx + * + * Purpose: Internal routine to delete a link according to its index + * within a group. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * December 27, 2017 + * + *------------------------------------------------------------------------- + */ +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) +{ + H5L_trav_rmbi_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(loc); + HDassert(name && *name); + + /* Set up user data for unlink operation */ + udata.idx_type = idx_type; + udata.order = order; + udata.n = n; + + /* Traverse the group hierarchy to remove the link */ + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, + H5L__delete_by_idx_cb, &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__delete_by_idx() */ + +/*------------------------------------------------------------------------- + * Function: H5L__move_dest_cb + * + * Purpose: Second callback for moving and renaming an object. This routine + * inserts a new link into the group returned by the traversal. + * It is called by H5L__move_cb. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Monday, April 3, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_ATTR_UNUSED *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_mv2_t *udata = (H5L_trav_mv2_t *)_udata; /* User data passed in */ + H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */ + hid_t grp_id = FAIL; /* ID for this group (passed to user callback */ + H5G_loc_t temp_loc; /* For UD callback */ + hbool_t temp_loc_init = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make sure an object with this name doesn't already exist */ + if (obj_loc != NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "an object with that name already exists") + + /* Check for crossing file boundaries with a new hard link */ + if (udata->lnk->type == H5L_TYPE_HARD) + /* Check that both objects are in same file */ + if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed") + + /* Give the object its new name */ + /* Casting away const okay -JML */ + HDassert(udata->lnk->name == NULL); + udata->lnk->name = (char *)name; + + /* Insert the link into the group */ + if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + + /* If the link was a user-defined link, call its move callback if it has one */ + if (udata->lnk->type >= H5L_TYPE_UD_MIN) { + const H5L_class_t *link_class; /* User-defined link class */ + + /* Get the link class for this type of link. */ + if (NULL == (link_class = H5L_find_class(udata->lnk->type))) + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered") + + if ((!udata->copy && link_class->move_func) || (udata->copy && link_class->copy_func)) { + H5O_loc_t temp_oloc; + H5G_name_t temp_path; + + /* Create a temporary location (or else H5G_open will do a shallow + * copy and wipe out grp_loc) + */ + H5G_name_reset(&temp_path); + if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location") + + temp_loc.oloc = &temp_oloc; + temp_loc.path = &temp_path; + temp_loc_init = TRUE; + + /* Set up location for user-defined callback */ + if (NULL == (grp = H5G_open(&temp_loc))) + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") + if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") + + if (udata->copy) { + if ((link_class->copy_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, + udata->lnk->u.ud.size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD copy callback returned error") + } /* end if */ + else { + if ((link_class->move_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, + udata->lnk->u.ud.size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD move callback returned error") + } /* end else */ + } /* end if */ + } /* end if */ + +done: + /* Close the location given to the user callback if it was created */ + if (grp_id >= 0) { + if (H5I_dec_app_ref(grp_id) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") + } /* end if */ + else if (grp != NULL) { + if (H5G_close(grp) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback") + } /* end if */ + else if (temp_loc_init) + H5G_loc_free(&temp_loc); + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + /* Reset the "name" field in udata->lnk because it is owned by traverse() + * and must not be manipulated after traverse closes */ + udata->lnk->name = NULL; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__move_dest_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__move_cb + * + * Purpose: Callback for moving and renaming an object. This routine + * replaces the names of open objects with the moved object + * in the path + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Friday, April 3, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, + void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_mv_t *udata = (H5L_trav_mv_t *)_udata; /* User data passed in */ + H5L_trav_mv2_t udata_out; /* User data for H5L__move_dest_cb traversal */ + char * orig_name = NULL; /* The name of the link in this group */ + hbool_t link_copied = FALSE; /* Has udata_out.lnk been allocated? */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if (obj_loc == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") + + /* Check for operations on '.' */ + if (lnk == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "the name of a link must be supplied to move or copy") + + /* Set up user data for move_dest_cb */ + if (NULL == (udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL))) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved") + + /* In this special case, the link's name is going to be replaced at its + * destination, so we should free it here. + */ + udata_out.lnk->name = (char *)H5MM_xfree(udata_out.lnk->name); + link_copied = TRUE; + + udata_out.lnk->cset = udata->cset; + udata_out.file = grp_loc->oloc->file; + udata_out.copy = udata->copy; + + /* Keep a copy of link's name (it's "owned" by the H5G_traverse() routine) */ + orig_name = H5MM_xstrdup(name); + + /* Reset the # of soft / UD links that can be traversed, so that the second + * (destination) traversal has the correct value + */ + if (H5CX_set_nlinks(udata->orig_nlinks) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't reset # of soft / UD links to traverse") + + /* Insert the link into its new location */ + if (H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb, + &udata_out) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") + + /* If this is a move and not a copy operation, change the object's name and remove the old link */ + if (!udata->copy) { + H5RS_str_t *dst_name_r; /* Ref-counted version of dest name */ + + /* Make certain that the destination name is a full (not relative) path */ + if (*(udata->dst_name) != '/') { + HDassert(udata->dst_loc->path->full_path_r); + + /* Create reference counted string for full dst path */ + if ((dst_name_r = H5G_build_fullpath_refstr_str(udata->dst_loc->path->full_path_r, + udata->dst_name)) == NULL) + HGOTO_ERROR(H5E_LINK, H5E_PATH, FAIL, "can't build destination path name") + } /* end if */ + else + dst_name_r = H5RS_wrap(udata->dst_name); + HDassert(dst_name_r); + + /* Fix names up */ + if (H5G_name_replace(lnk, H5G_NAME_MOVE, obj_loc->oloc->file, obj_loc->path->full_path_r, + udata->dst_loc->oloc->file, dst_name_r) < 0) { + H5RS_decr(dst_name_r); + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to replace name") + } /* end if */ + + /* Remove the old link */ + if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, orig_name) < 0) { + H5RS_decr(dst_name_r); + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to remove old name") + } /* end if */ + + H5RS_decr(dst_name_r); + } /* end if */ + +done: + /* Cleanup */ + if (orig_name) + H5MM_xfree(orig_name); + + /* If udata_out.lnk was copied, free any memory allocated + * In this special case, the H5L__move_dest_cb callback resets the name + * so H5O_msg_free shouldn't try to free it + */ + if (link_copied) + H5O_msg_free(H5O_LINK_ID, udata_out.lnk); + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__move_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__move + * + * Purpose: Atomically move or copy a link. + * + * Creates a copy of a link in a new destination with a new name. + * SRC_LOC and SRC_NAME together define the link's original + * location, while DST_LOC and DST_NAME together define its + * final location. + * + * If copy_flag is FALSE, the original link is removed + * (effectively moving the link). + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Monday, May 1, 2006 + * + *------------------------------------------------------------------------- + */ +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) +{ + unsigned dst_target_flags = H5G_TARGET_NORMAL; + H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */ + H5P_genplist_t *lc_plist; /* Link creation property list */ + H5L_trav_mv_t udata; /* User data for traversal */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(src_loc); + HDassert(dst_loc); + HDassert(src_name && *src_name); + HDassert(dst_name && *dst_name); + + /* Check for flags present in creation property list */ + if (lcpl_id != H5P_DEFAULT) { + unsigned crt_intmd_group; + + if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get intermediate group creation property */ + if (H5CX_get_intermediate_group(&crt_intmd_group) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups") + + /* Set target flags for source and destination */ + if (crt_intmd_group > 0) + dst_target_flags |= H5G_CRT_INTMD_GROUP; + + /* Get character encoding property */ + if (H5CX_get_encoding(&char_encoding) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding") + } /* end if */ + + /* Set up user data */ + udata.dst_loc = dst_loc; + udata.dst_name = dst_name; + udata.dst_target_flags = dst_target_flags; + udata.cset = char_encoding; + udata.copy = copy_flag; + + /* Retrieve the original # of soft / UD links that can be traversed, so + * that the countdown can be reset after the first path is traversed. + */ + if (H5CX_get_nlinks(&udata.orig_nlinks) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") + + /* Do the move */ + if (H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__move_cb, + &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__move() */ + +/*------------------------------------------------------------------------- + * Function: H5L__exists_final_cb + * + * Purpose: Callback for checking whether a link exists, as the final + * component of a path + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, March 16 2007 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */ + + FUNC_ENTER_STATIC_NOERR + + /* Check if the name in this group resolved to a valid link */ + *udata->exists = (hbool_t)(lnk != NULL); + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5L__exists_final_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__exists_inter_cb + * + * Purpose: Callback for checking whether a link exists, as an intermediate + * component of a path + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, December 31 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if (lnk != NULL) { + /* Check for more components to the path */ + if (udata->sep) { + H5G_traverse_t cb_func; /* Callback function for tranversal */ + char * next; /* Pointer to next component name */ + + /* Look for another separator */ + next = udata->sep; + if (NULL == (udata->sep = HDstrchr(udata->sep, '/'))) + cb_func = H5L__exists_final_cb; + else { + /* Chew through adjacent separators, if present */ + do { + *udata->sep = '\0'; + udata->sep++; + } while ('/' == *udata->sep); + cb_func = H5L__exists_inter_cb; + } /* end else */ + if (H5G_traverse(obj_loc, next, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists") + } /* end if */ + else + *udata->exists = TRUE; + } /* end if */ + else + *udata->exists = FALSE; + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__exists_inter_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L_exists_tolerant + * + * Purpose: Returns whether a link exists in a group + * + * Note: Same as H5L__exists, except that missing links are reported + * as 'FALSE' instead of causing failures + * + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, December 31 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hbool_t *exists) +{ + H5L_trav_le_t udata; /* User data for traversal */ + H5G_traverse_t cb_func; /* Callback function for tranversal */ + char * name_copy = NULL; /* Duplicate of name */ + char * name_trav; /* Name to traverse */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(loc); + HDassert(name); + HDassert(exists); + + /* Copy the name and skip leading '/'s */ + name_trav = name_copy = H5MM_strdup(name); + while ('/' == *name_trav) + name_trav++; + + /* A path of "/" will always exist in a file */ + if ('\0' == *name_trav) + *exists = TRUE; + else { + /* Set up user data & correct callback */ + udata.exists = exists; + if (NULL == (udata.sep = HDstrchr(name_trav, '/'))) + cb_func = H5L__exists_final_cb; + else { + /* Chew through adjacent separators, if present */ + do { + *udata.sep = '\0'; + udata.sep++; + } while ('/' == *udata.sep); + cb_func = H5L__exists_inter_cb; + } /* end else */ + + /* Traverse the group hierarchy to locate the link to check */ + if (H5G_traverse(loc, name_trav, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists") + } + +done: + /* Release duplicated string */ + H5MM_xfree(name_copy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5L_exists_tolerant() */ + +/*------------------------------------------------------------------------- + * Function: H5L__exists + * + * Purpose: Returns whether a link exists in a group + * + * Note: Same as H5L_exists_tolerant, except that missing links are reported + * as failures + * + * Return: Non-negative on success, with *exists set/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, March 16 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists) +{ + H5L_trav_le_t udata; /* User data for traversal */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + HDassert(loc); + HDassert(name); + HDassert(exists); + + /* A path of "/" will always exist in a file */ + if (0 == HDstrcmp(name, "/")) + *exists = TRUE; + else { + /* Traverse the group hierarchy to locate the object to get info about */ + udata.exists = exists; + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__exists_final_cb, &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "link doesn't exist") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5L__exists() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_info_cb + * + * Purpose: Callback for retrieving a link's metadata + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Monday, April 17 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t *lnk, + H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_gi_t *udata = (H5L_trav_gi_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if (lnk == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") + + /* Get information from the link */ + if (H5G_link_to_info(grp_loc->oloc, lnk, udata->linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") + +done: + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_info_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L_get_info + * + * Purpose: Returns metadata about a link. + * + * Return: SUCCEED/FAIL + * + * Programmer: James Laird + * Monday, April 17 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo /*out*/) +{ + H5L_trav_gi_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + udata.linfo = linfo; + + /* Traverse the group hierarchy to locate the object to get info about */ + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_cb, &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5L_get_info() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_info_by_idx_cb + * + * Purpose: Callback for retrieving a link's metadata according to an + * index's order. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, November 6 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__get_info_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_gibi_t *udata = (H5L_trav_gibi_t *)_udata; /* User data passed in */ + H5O_link_t fnd_lnk; /* Link within group */ + hbool_t lnk_copied = FALSE; /* Whether the link was copied */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name of the group resolved to a valid object */ + if (obj_loc == NULL) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + + /* Query link */ + if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") + lnk_copied = TRUE; + + /* Get information from the link */ + if (H5G_link_to_info(obj_loc->oloc, &fnd_lnk, udata->linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") + +done: + /* Reset the link information, if we have a copy */ + if (lnk_copied) + H5O_msg_reset(H5O_LINK_ID, &fnd_lnk); + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_info_by_idx_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_info_by_idx + * + * Purpose: Internal routine to retrieve link info according to an + * index's order. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +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*/) +{ + H5L_trav_gibi_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + HDassert(loc); + HDassert(name && *name); + HDassert(linfo); + + /* Set up user data for callback */ + udata.idx_type = idx_type; + udata.order = order; + udata.n = n; + udata.linfo = linfo; + + /* Traverse the group hierarchy to locate the object to get info about */ + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_info_by_idx() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_name_by_idx_cb + * + * Purpose: Callback for retrieving a link's name according to an + * index's order. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, November 11 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__get_name_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) +{ + H5L_trav_gnbi_t *udata = (H5L_trav_gnbi_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name of the group resolved to a valid object */ + if (obj_loc == NULL) + 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) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") + +done: + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_name_by_idx_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5L__get_name_by_idx + * + * Purpose: Internal routine to retrieve link name according to an + * index's order. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +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) +{ + H5L_trav_gnbi_t udata; /* User data for callback */ + ssize_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + HDassert(loc); + HDassert(group_name && *group_name); + + /* Set up user data for callback */ + udata.idx_type = idx_type; + udata.order = order; + udata.n = n; + udata.name = name; + udata.size = size; + udata.name_len = -1; + + /* 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) < + 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get name") + + /* Set the return value */ + ret_value = udata.name_len; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__get_name_by_idx() */ + +/*------------------------------------------------------------------------- + * Function: H5L__link_copy_file + * + * Purpose: Copy a link and the object it points to from one file to + * another. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Sep 29 2006 + * + *------------------------------------------------------------------------- + */ +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) +{ + H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */ + const H5O_link_t *src_lnk = _src_lnk; /* Source link */ + hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */ + hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */ + H5G_loc_t tmp_src_loc; /* Group location holding target object */ + H5G_name_t tmp_src_path; /* Path for target object */ + H5O_loc_t tmp_src_oloc; /* Object location for target object */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* check arguments */ + HDassert(dst_file); + HDassert(src_lnk); + HDassert(dst_lnk); + HDassert(cpy_info); + + /* 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 */ + + /* Set up group location for link */ + H5G_name_reset(&lnk_grp_path); + lnk_grp_loc.path = &lnk_grp_path; + 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) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to check if target object exists") + + if (tar_exists) { + /* Make a temporary copy of the link, so that it will not change the + * info in the cache when we change it to a hard link */ + if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk)) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message") + + /* Set up group location for target object. Let H5G_traverse expand + * the link. */ + tmp_src_loc.path = &tmp_src_path; + tmp_src_loc.oloc = &tmp_src_oloc; + if (H5G_loc_reset(&tmp_src_loc) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to reset location") + + /* Find the target object */ + if (H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to find target object") + expanded_link_open = TRUE; + + /* Convert symbolic link to hard link */ + if (tmp_src_lnk.type == H5L_TYPE_SOFT) + tmp_src_lnk.u.soft.name = (char *)H5MM_xfree(tmp_src_lnk.u.soft.name); + else if (tmp_src_lnk.u.ud.size > 0) + tmp_src_lnk.u.ud.udata = H5MM_xfree(tmp_src_lnk.u.ud.udata); + tmp_src_lnk.type = H5L_TYPE_HARD; + tmp_src_lnk.u.hard.addr = tmp_src_oloc.addr; + src_lnk = &tmp_src_lnk; + } /* end if */ + } /* end if */ + + /* Copy src link information to dst link information */ + if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk)) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message") + dst_lnk_init = TRUE; + + /* Check if object in source group is a hard link & copy it */ + if (H5L_TYPE_HARD == src_lnk->type) { + H5O_loc_t new_dst_oloc; /* Copied object location in destination */ + + /* Set up copied object location to fill in */ + H5O_loc_reset(&new_dst_oloc); + new_dst_oloc.file = dst_file; + + if (!expanded_link_open) { + /* Build temporary object location for source */ + H5O_loc_reset(&tmp_src_oloc); + tmp_src_oloc.file = src_oloc->file; + tmp_src_oloc.addr = src_lnk->u.hard.addr; + } /* end if */ + HDassert(H5F_addr_defined(tmp_src_oloc.addr)); + + /* Copy the shared object from source to destination */ + /* Don't care about obj_type or udata because those are only important + * for old style groups */ + if (H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, cpy_info, TRUE, NULL, NULL) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object") + + /* Copy new destination object's information for eventual insertion */ + dst_lnk->u.hard.addr = new_dst_oloc.addr; + } /* end if */ + +done: + /* Check if we used a temporary src link */ + if (src_lnk != _src_lnk) { + HDassert(src_lnk == &tmp_src_lnk); + H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk); + } /* end if */ + if (ret_value < 0) + if (dst_lnk_init) + H5O_msg_reset(H5O_LINK_ID, dst_lnk); + /* Check if we need to free the temp source oloc */ + if (expanded_link_open) + if (H5G_loc_free(&tmp_src_loc) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTFREE, FAIL, "unable to free object") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__link_copy_file() */ + +/*------------------------------------------------------------------------- + * Function: H5L_iterate + * + * Purpose: Iterates through links in a group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_iterate(H5G_loc_t *loc, 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) +{ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity checks */ + HDassert(loc); + HDassert(group_name); + HDassert(op); + + /* Set up iteration beginning/end info */ + idx = (idx_p == NULL ? 0 : *idx_p); + last_lnk = 0; + + /* Build link operator info */ + lnk_op.op_type = H5G_LINK_OP_NEW; + lnk_op.op_func.op_new = op; + + /* Iterate over the links */ + if ((ret_value = H5G_iterate(loc, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + + /* Set the index we stopped at */ + if (idx_p) + *idx_p = last_lnk; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_iterate() */ diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index 740fc1e..b114c17 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -123,6 +123,7 @@ H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx /* User-defined link functions */ H5_DLL herr_t H5L_register(const H5L_class_t *cls); H5_DLL herr_t H5L_unregister(H5L_type_t id); +H5_DLL herr_t H5L_is_registered(H5L_type_t id, hbool_t *is_registered); H5_DLL const H5L_class_t *H5L_find_class(H5L_type_t id); #endif /* H5Lprivate_H */ diff --git a/src/Makefile.am b/src/Makefile.am index 6d5a56e..51d847f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -76,7 +76,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c \ H5HP.c \ H5I.c H5Idbg.c H5Iint.c H5Itest.c \ - H5L.c H5Ldeprec.c H5Lexternal.c \ + H5L.c H5Ldeprec.c H5Lexternal.c H5Lint.c \ H5M.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ -- cgit v0.12 From 4ef33ef7cd0f2af55b34682b6949a101a68436bb Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 28 May 2021 20:03:21 -0700 Subject: Clean up type size checks in configure.ac (#702) --- configure.ac | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/configure.ac b/configure.ac index 921e8c6..5fc0558 100644 --- a/configure.ac +++ b/configure.ac @@ -1365,16 +1365,15 @@ CFLAGS="$H5_CFLAGS $AM_CFLAGS $CFLAGS" ## Checkpoint the cache AC_CACHE_SAVE -## Posix.1g types (C9x) +## Write the confdefs.h header for checking sizes cat >>confdefs.h <<\EOF -#include -EOF - -if test "X$C9x" = "Xyes"; then - cat >>confdefs.h <<\EOF +#include #include +#ifdef HAVE_UNISTD_H +#include +#endif +#include EOF -fi AC_CHECK_SIZEOF( [int8_t]) AC_CHECK_SIZEOF( [uint8_t]) @@ -1404,30 +1403,12 @@ AC_CHECK_SIZEOF([uint_least64_t]) AC_CHECK_SIZEOF( [int_fast64_t]) AC_CHECK_SIZEOF( [uint_fast64_t]) +AC_CHECK_SIZEOF([bool]) +AC_CHECK_SIZEOF([off_t]) +AC_CHECK_SIZEOF([ptrdiff_t]) AC_CHECK_SIZEOF([size_t]) AC_CHECK_SIZEOF([ssize_t]) -AC_CHECK_SIZEOF([ptrdiff_t]) - -cat >>confdefs.h <<\EOF -#include /*for off_t definition*/ -EOF -AC_CHECK_SIZEOF([off_t]) - -if test "X$C9x" = "Xyes"; then - cat >>confdefs.h <<\EOF -#include -EOF -AC_CHECK_SIZEOF([bool]) -fi - -AC_CHECK_SIZEOF(time_t, [], [ -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif -]) +AC_CHECK_SIZEOF([time_t]) ## Checkpoint the cache AC_CACHE_SAVE -- cgit v0.12 From 50d0888f491821435f6884c0c4c516f69ff67927 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 1 Jun 2021 06:49:39 -0700 Subject: C++ warning and build fixes (#707) * Committing clang-format changes * C++ build and warning updates * Fixes all warnings on C++ (with gcc 9.3) * Updates CMake and Autotools C++ builds * Undo warning clobber Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- CMakeLists.txt | 1 - MANIFEST | 5 +- c++/src/CMakeLists.txt | 7 -- c++/src/H5Cpp.h | 10 -- c++/src/H5DataSpace.cpp | 7 +- c++/src/H5DataType.cpp | 24 ++--- c++/src/H5DxferProp.cpp | 4 +- c++/src/H5Exception.cpp | 2 +- c++/src/H5File.cpp | 6 +- c++/src/H5LcreatProp.cpp | 4 +- c++/src/H5Location.cpp | 2 +- c++/src/H5PropList.cpp | 8 +- c++/test/dsets.cpp | 49 ++++++--- c++/test/tarray.cpp | 12 ++- c++/test/tattr.cpp | 148 +++++++++++++++----------- c++/test/tcompound.cpp | 78 +++++++------- c++/test/tdspl.cpp | 18 ++-- c++/test/tfile.cpp | 51 ++++----- c++/test/th5s.cpp | 20 ++-- c++/test/titerate.cpp | 29 +++--- c++/test/tlinks.cpp | 12 ++- c++/test/tobject.cpp | 38 ++++--- c++/test/trefer.cpp | 162 ++++++++++++++++------------- c++/test/ttypes.cpp | 9 +- c++/test/tvlstr.cpp | 54 ++++++---- config/cmake/H5cxx_config.h.in | 16 --- config/cmake/H5pubconf.h.in | 3 - config/cmake/HDFCXXCompilerFlags.cmake | 25 ++--- config/cmake/HDFCompilerFlags.cmake | 22 ++-- config/cmake/HDFFortranCompilerFlags.cmake | 14 +-- config/cmake_ext_mod/HDFCXXTests.cpp | 46 -------- config/cmake_ext_mod/HDFUseCXX.cmake | 99 ------------------ config/gnu-cxxflags | 1 + config/gnu-warnings/cxx-9 | 2 + configure.ac | 14 --- hl/c++/src/H5PacketTable.cpp | 8 +- hl/c++/src/H5PacketTable.h | 3 +- hl/c++/test/ptableTest.cpp | 12 +-- m4/aclocal_cxx.m4 | 79 -------------- 39 files changed, 453 insertions(+), 651 deletions(-) delete mode 100644 config/cmake/H5cxx_config.h.in delete mode 100644 config/cmake_ext_mod/HDFCXXTests.cpp delete mode 100644 config/cmake_ext_mod/HDFUseCXX.cmake create mode 100644 config/gnu-warnings/cxx-9 delete mode 100644 m4/aclocal_cxx.m4 diff --git a/CMakeLists.txt b/CMakeLists.txt index f4cad5b..c44c5d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1125,7 +1125,6 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") endif () endif () - include (${HDF_RESOURCES_EXT_DIR}/HDFUseCXX.cmake) include (${HDF_RESOURCES_DIR}/HDFCXXCompilerFlags.cmake) add_subdirectory (c++) diff --git a/MANIFEST b/MANIFEST index 52ad0e5..46771bb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -40,7 +40,6 @@ ./.github/workflows/main.yml _DO_NOT_DISTRIBUTE_ ./.github/workflows/pr-check.yml _DO_NOT_DISTRIBUTE_ -./m4/aclocal_cxx.m4 ./m4/aclocal_fc.m4 ./m4/aclocal_fc.f90 ./m4/ax_check_class.m4 @@ -172,6 +171,7 @@ ./config/gnu-warnings/cxx-4.8 ./config/gnu-warnings/cxx-4.9 ./config/gnu-warnings/cxx-5 +./config/gnu-warnings/cxx-9 ./config/gnu-warnings/cxx-error-5 ./config/gnu-warnings/cxx-error-general ./config/gnu-warnings/cxx-noerror-5 @@ -3546,7 +3546,6 @@ ./config/cmake/CTestCustom.cmake ./config/cmake/fileCompareTest.cmake ./config/cmake/FindHDFS.cmake -./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in ./config/cmake/hdf5-config.cmake.in ./config/cmake/hdf5-config-version.cmake.in @@ -3581,11 +3580,9 @@ ./config/cmake_ext_mod/hdf.bmp ./config/cmake_ext_mod/hdf.icns ./config/cmake_ext_mod/hdf.ico -./config/cmake_ext_mod/HDFCXXTests.cpp ./config/cmake_ext_mod/HDFLibMacros.cmake ./config/cmake_ext_mod/HDFMacros.cmake ./config/cmake_ext_mod/HDFTests.c -./config/cmake_ext_mod/HDFUseCXX.cmake ./config/cmake_ext_mod/HDFUseFortran.cmake ./config/cmake_ext_mod/NSIS.InstallOptions.ini.in ./config/cmake_ext_mod/NSIS.template.in diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 835d422..2a37dea 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -2,13 +2,6 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_CPP_SRC CXX) #----------------------------------------------------------------------------- -# Generate configure file -#----------------------------------------------------------------------------- -configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in - ${HDF5_SRC_BINARY_DIR}/H5cxx_pubconf.h -) - -#----------------------------------------------------------------------------- # Define cpp Library #----------------------------------------------------------------------------- set (CPP_SOURCES diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h index 9272bdb..202d584 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -48,14 +48,4 @@ #include "H5File.h" #include "H5Library.h" -/* Some C++ compilers do not have offsetof macro; define to bypass the problem - - BMR- -EIP- 2007/08/01 -*/ -#ifndef H5_CXX_HAVE_OFFSETOF -#ifdef HOFFSET -#undef HOFFSET -#endif -#define HOFFSET(TYPE, MEMBER) ((size_t) & ((TYPE *)0)->MEMBER) -#endif - #endif // H5Cpp_H diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index c20a88c..342e9fa 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -88,9 +88,8 @@ const DataSpace &DataSpace::ALL = *getConstant(); ///\exception H5::DataSpaceIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSpace::DataSpace(H5S_class_t type) : IdComponent() +DataSpace::DataSpace(H5S_class_t type) : IdComponent(), id{H5Screate(type)} { - id = H5Screate(type); if (id < 0) { throw DataSpaceIException("DataSpace constructor", "H5Screate failed"); } @@ -105,9 +104,9 @@ DataSpace::DataSpace(H5S_class_t type) : IdComponent() ///\exception H5::DataSpaceIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSpace::DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims) : IdComponent() +DataSpace::DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims) + : IdComponent(), id{H5Screate_simple(rank, dims, maxdims)} { - id = H5Screate_simple(rank, dims, maxdims); if (id < 0) { throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed"); } diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 3228dcb..cdf28cf 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -76,10 +76,9 @@ DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id), encod ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), encoded_buf(NULL), buf_size(0) +DataType::DataType(const H5T_class_t type_class, size_t size) + : H5Object(), id{H5Tcreate(type_class, size)}, encoded_buf(NULL), buf_size(0) { - // Call C routine to create the new datatype - id = H5Tcreate(type_class, size); if (id < 0) { throw DataTypeIException("DataType constructor", "H5Tcreate failed"); } @@ -97,9 +96,10 @@ DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), enco // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- DataType::DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) - : H5Object(), encoded_buf(NULL), buf_size(0) + : H5Object(), id{H5Location::p_dereference(loc.getId(), ref, ref_type, plist, + "constructor - by dereference")}, + encoded_buf(NULL), buf_size(0) { - id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } //-------------------------------------------------------------------------- @@ -146,10 +146,9 @@ DataType::DataType(const DataType &original) : H5Object(), id(original.id), enco // unnecessarily and will produce undefined behavior. // -BMR, Apr 2015 //-------------------------------------------------------------------------- -DataType::DataType(const PredType &pred_type) : H5Object(), encoded_buf(NULL), buf_size(0) +DataType::DataType(const PredType &pred_type) + : H5Object(), id{H5Tcopy(pred_type.getId())}, encoded_buf(NULL), buf_size(0) { - // Call C routine to copy the datatype - id = H5Tcopy(pred_type.getId()); if (id < 0) throw DataTypeIException("DataType constructor", "H5Tcopy failed"); } @@ -168,9 +167,9 @@ DataType::DataType(const PredType &pred_type) : H5Object(), encoded_buf(NULL), b // improve usability. // -BMR, Dec 2016 //-------------------------------------------------------------------------- -DataType::DataType(const H5Location &loc, const char *dtype_name) : H5Object(), encoded_buf(NULL), buf_size(0) +DataType::DataType(const H5Location &loc, const char *dtype_name) + : H5Object(), id{p_opentype(loc, dtype_name)}, encoded_buf(NULL), buf_size(0) { - id = p_opentype(loc, dtype_name); } //-------------------------------------------------------------------------- @@ -188,9 +187,8 @@ DataType::DataType(const H5Location &loc, const char *dtype_name) : H5Object(), // -BMR, Dec 2016 //-------------------------------------------------------------------------- DataType::DataType(const H5Location &loc, const H5std_string &dtype_name) - : H5Object(), encoded_buf(NULL), buf_size(0) + : H5Object(), id{p_opentype(loc, dtype_name.c_str())}, encoded_buf(NULL), buf_size(0) { - id = p_opentype(loc, dtype_name.c_str()); } //-------------------------------------------------------------------------- @@ -318,7 +316,7 @@ DataType::encode() // Allocate buffer and call C function again to encode if (buf_size > 0) { - encoded_buf = (unsigned char *)HDcalloc((size_t)1, buf_size); + encoded_buf = static_cast(HDcalloc(1, buf_size)); ret_value = H5Tencode(id, encoded_buf, &buf_size); if (ret_value < 0) { throw DataTypeIException("DataType::encode", "H5Tencode failed"); diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 43ea6f4..40faac2 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -175,7 +175,7 @@ DSetMemXferPropList::getBuffer(void **tconv, void **bkg) const void DSetMemXferPropList::setPreserve(bool status) const { - herr_t ret_value = H5Pset_preserve(id, (hbool_t)status); + herr_t ret_value = H5Pset_preserve(id, static_cast(status)); if (ret_value < 0) { throw PropListIException("DSetMemXferPropList::setPreserve", "H5Pset_preserve failed"); } @@ -314,7 +314,7 @@ DSetMemXferPropList::getDataTransform() const H5std_string expression; // Preliminary call to get the expression's length - ssize_t exp_len = H5Pget_data_transform(id, NULL, (size_t)0); + ssize_t exp_len = H5Pget_data_transform(id, NULL, 0); // If H5Pget_data_transform returns a negative value, raise an exception if (exp_len < 0) { diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 6769439..a42c151 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -25,7 +25,7 @@ const char Exception::DEFAULT_MSG[] = "No detailed information provided"; ///\brief Default constructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::Exception() +Exception::Exception() : detail_message{""}, func_name{""} { } diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 9a6f191..f92171b 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -165,9 +165,8 @@ H5File::p_get_file(const char *name, unsigned int flags, const FileCreatPropList // constructor is needed by the library in order to return // an object, H5File doesn't need it. -BMR (HDFFV-8766 partially) //-------------------------------------------------------------------------- -H5File::H5File(hid_t existing_id) : Group() +H5File::H5File(hid_t existing_id) : Group(), id{existing_id} { - id = existing_id; incRefCount(); // increment number of references to this id } @@ -180,9 +179,8 @@ H5File::H5File(hid_t existing_id) : Group() ///\param original - IN: H5File instance to copy // December 2000 //-------------------------------------------------------------------------- -H5File::H5File(const H5File &original) : Group(original) +H5File::H5File(const H5File &original) : Group(original), id{original.getId()} { - id = original.getId(); incRefCount(); // increment number of references to this id } diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp index 63fe861..3851d56 100644 --- a/c++/src/H5LcreatProp.cpp +++ b/c++/src/H5LcreatProp.cpp @@ -121,7 +121,7 @@ LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const { - herr_t ret_value = H5Pset_create_intermediate_group(id, (unsigned)crt_intmd_group); + herr_t ret_value = H5Pset_create_intermediate_group(id, static_cast(crt_intmd_group)); // Throw exception if H5Pset_create_intermediate_group returns failure if (ret_value < 0) { throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed"); @@ -146,7 +146,7 @@ LinkCreatPropList::getCreateIntermediateGroup() const throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed"); } - return ((bool)crt_intmd_group); + return static_cast(crt_intmd_group); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 065de0c..bb754a2 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -351,7 +351,7 @@ H5Location::getComment(const char *name, size_t buf_size) const H5std_string comment; // Preliminary call to get the comment's length - ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, (size_t)0, H5P_DEFAULT); + ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, 0, H5P_DEFAULT); // If H5Oget_comment_by_name returns a negative value, raise an exception if (comment_len < 0) { diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 8b45f79..46e4931 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -113,11 +113,8 @@ PropList::PropList(const PropList &original) : IdComponent(), id(original.id) // property's id to H5P_DEFAULT. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PropList::PropList(const hid_t plist_id) : IdComponent() +PropList::PropList(const hid_t plist_id) : IdComponent(), id{H5P_DEFAULT} { - if (plist_id <= 0) - id = H5P_DEFAULT; - H5I_type_t id_type = H5Iget_type(plist_id); switch (id_type) { case H5I_GENPROP_CLS: @@ -633,11 +630,12 @@ PropList::setProperty(const char *name, void *value) const void PropList::setProperty(const char *name, const char *charptr) const { - herr_t ret_value = H5Pset(id, name, (const void *)charptr); + herr_t ret_value = H5Pset(id, name, static_cast(charptr)); if (ret_value < 0) { throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); } } + //-------------------------------------------------------------------------- // Function: PropList::setProperty ///\brief This is an overloaded member function, provided for convenience. diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index a16061b..53b56fc 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -23,6 +23,8 @@ ***************************************************************************/ +#include +#include #include using std::cerr; using std::endl; @@ -189,9 +191,9 @@ test_simple_io(H5File &file) SUBTEST("Simple I/O"); - int points[100][200]; - int check[100][200]; - int i, j, n; + auto points = new int[100][200]; + auto check = new int[100][200](); + int i, j, n; // Initialize the dataset for (i = n = 0; i < 100; i++) { @@ -233,6 +235,8 @@ test_simple_io(H5File &file) // clean up and return with success delete[] tconv_buf; + delete[] points; + delete[] check; PASSED(); return 0; } // end try @@ -244,6 +248,8 @@ test_simple_io(H5File &file) // clean up and return with failure delete[] tconv_buf; + delete[] points; + delete[] check; return -1; } } // test_simple_io @@ -408,6 +414,13 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[ size_t *buf_size, void **buf) // H5_ATTR_UNUSED variables caused warning, but taking them out caused failure. { + // Unused + (void)flags; + (void)cd_nelmts; + (void)cd_values; + (void)buf_size; + (void)buf; + return nbytes; } @@ -431,8 +444,8 @@ test_compression(H5File &file) const char *not_supported; not_supported = " Deflate compression is not enabled."; #endif /* H5_HAVE_FILTER_DEFLATE */ - int points[100][200]; - int check[100][200]; + auto points = new int[100][200]; + auto check = new int[100][200]; hsize_t i, j, n; // Initialize the dataset @@ -667,6 +680,8 @@ test_compression(H5File &file) */ delete dataset; delete[] tconv_buf; + delete[] points; + delete[] check; return 0; } // end try @@ -678,6 +693,8 @@ test_compression(H5File &file) // clean up and return with failure delete dataset; delete[] tconv_buf; + delete[] points; + delete[] check; return -1; } } // test_compression @@ -713,6 +730,9 @@ test_nbit_compression(H5File &file) SUBTEST("N-bit compression (setup)"); + HDmemset(orig_data, 0, DIM1 * DIM2 * sizeof(s1_t)); + HDmemset(new_data, 0, DIM1 * DIM2 * sizeof(s1_t)); + try { // Define datatypes of members of compound datatype IntType i_type(PredType::NATIVE_INT); @@ -1079,7 +1099,7 @@ test_getnativeinfo(H5File &file) H5O_native_info_t ninfo; HDmemset(&ninfo, 0, sizeof(ninfo)); dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); - verify_val(ninfo.hdr.nchunks, 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); + verify_val(static_cast(ninfo.hdr.nchunks), 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); dataset.close(); // Open the dataset we created above and then close it. This is one @@ -1087,7 +1107,7 @@ test_getnativeinfo(H5File &file) dataset = file.openDataSet(DSET_DEFAULT_NAME); HDmemset(&ninfo, 0, sizeof(ninfo)); dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_ALL); - verify_val(ninfo.hdr.nchunks, 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); + verify_val(static_cast(ninfo.hdr.nchunks), 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); dataset.close(); PASSED(); @@ -1139,12 +1159,15 @@ test_chunk_cache(const FileAccPropList &fapl) dapl.getChunkCache(nslots_4, nbytes_4, w0_4); verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__); verify_val(nbytes_1, nbytes_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__); - verify_val(w0_1, w0_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__); + if (abs(w0_1 - w0_4) > DBL_EPSILON) + TestErrPrintf("%d: w0_1 and w0_4 different: w0_1=%f, " + "w0_4=%f\n", + __LINE__, w0_1, w0_4); // Set a link access property on dapl to verify property list inheritance - dapl.setNumLinks((size_t)134); + dapl.setNumLinks(134); size_t nlinks = dapl.getNumLinks(); - verify_val(nlinks, (size_t)134, "DSetAccPropList::getNumLinks", __LINE__, __FILE__); + verify_val(static_cast(nlinks), 134, "DSetAccPropList::getNumLinks", __LINE__, __FILE__); // Make a copy of the external fapl FileAccPropList fapl_local(fapl); @@ -1255,7 +1278,8 @@ test_virtual() // Get the current layout, should be default, H5D_CONTIGUOUS H5D_layout_t layout = dcpl.getLayout(); - verify_val(layout, H5D_CONTIGUOUS, "DSetCreatPropList::getLayout", __LINE__, __FILE__); + verify_val(static_cast(layout), static_cast(H5D_CONTIGUOUS), + "DSetCreatPropList::getLayout", __LINE__, __FILE__); // Create fixed mapping hsize_t dims[RANK]; @@ -1277,7 +1301,8 @@ test_virtual() // Get and verify the new layout layout = dcpl.getLayout(); - verify_val(layout, H5D_VIRTUAL, "DSetCreatPropList::getLayout", __LINE__, __FILE__); + verify_val(static_cast(layout), static_cast(H5D_VIRTUAL), "DSetCreatPropList::getLayout", + __LINE__, __FILE__); PASSED(); return 0; diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index 7525c5f..c7c0b65 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -83,7 +83,8 @@ test_array_compound_array() for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { wdata[idxi][idxj].i = static_cast(idxi * 10 + idxj); for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) { - float temp = idxi * 10.0 + idxj * 2.5 + idxk; + float temp = static_cast(idxi) * 10.0F + static_cast(idxj) * 2.5F + + static_cast(idxk); wdata[idxi][idxj].f[idxk] = temp; } } // end for @@ -242,7 +243,7 @@ test_array_compound_array() verify_val(ndims, ARRAY1_RANK, "f2_atype_check.getArrayNDims", __LINE__, __FILE__); // Get the array dimensions - HDmemset(rdims1, 0, H5S_MAX_RANK); + HDmemset(rdims1, 0, sizeof(rdims1)); f2_atype_check.getArrayDims(rdims1); // Check the array dimensions @@ -288,7 +289,7 @@ test_array_compound_array() /* * Helper routine to demonstrate the issue in HDFFV-9562 */ -H5::DataType +static H5::DataType getArr() { hsize_t *dims = new hsize_t; @@ -388,10 +389,11 @@ test_array_info() for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { wdata[idxi][idxj].i = static_cast(idxi * 10 + idxj); for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) { - float temp = idxi * 10.0 + idxj * 2.5 + idxk; + float temp = static_cast(idxi) * 10.0F + static_cast(idxj) * 2.5F + + static_cast(idxk); wdata[idxi][idxj].f[idxk] = temp; } - } // end for + } try { // Create File diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index adaa237..45ccc98 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -17,6 +17,8 @@ C attribute interface (H5A) ***************************************************************************/ +#include +#include #include using std::cerr; using std::endl; @@ -93,7 +95,7 @@ struct attr4_struct { const H5std_string ATTR5_NAME("Attr5"); const int ATTR5_RANK = 0; -float attr_data5 = (float)-5.123; // Test data for 5th attribute +float attr_data5 = -5.123f; // Test data for 5th attribute /* Info for another attribute */ const H5std_string ATTR1A_NAME("Attr1_a"); @@ -208,7 +210,7 @@ test_attr_basic_write() // Check storage size for attribute hsize_t attr_size = gr_attr.getStorageSize(); - verify_val((long)attr_size, (long)(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), + verify_val(static_cast(attr_size), static_cast(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "Attribute::getStorageSize", __LINE__, __FILE__); // Try to create the same attribute again (should fail) @@ -227,7 +229,7 @@ test_attr_basic_write() // Check storage size for attribute attr_size = gr_attr.getStorageSize(); - verify_val((long)attr_size, (long)(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), + verify_val(static_cast(attr_size), static_cast(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "Attribute::getStorageSize", __LINE__, __FILE__); PASSED(); @@ -298,8 +300,10 @@ test_attr_getname() ssize_t name_size = 0; // actual length of attribute name name_size = fattr1.getName(fattr1_name, buf_size + 1); CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__); - verify_val((size_t)name_size, FATTR1_NAME.length(), "Attribute::getName", __LINE__, __FILE__); - verify_val((const char *)fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__); + verify_val(static_cast(name_size), FATTR1_NAME.length(), "Attribute::getName", __LINE__, + __FILE__); + verify_val(const_cast(fattr1_name), FATTR1_NAME, "Attribute::getName", __LINE__, + __FILE__); delete[] fattr1_name; // 2. With arbitrary buf_size that is smaller than the name's length. @@ -310,9 +314,10 @@ test_attr_getname() HDmemset(fattr1_name, 0, buf_size + 1); name_size = fattr1.getName(fattr1_name, buf_size + 1); CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__); - verify_val((size_t)name_size, FATTR1_NAME.size(), "Attribute::getName", __LINE__, __FILE__); - verify_val((const char *)fattr1_name, (const char *)short_name, "Attribute::getName", __LINE__, + verify_val(static_cast(name_size), FATTR1_NAME.size(), "Attribute::getName", __LINE__, __FILE__); + verify_val(const_cast(fattr1_name), const_cast(short_name), + "Attribute::getName", __LINE__, __FILE__); delete[] fattr1_name; // 3. With a buf_size that equals the name's length. @@ -525,7 +530,7 @@ test_attr_basic_read() H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); - verify_val(oinfo.num_attrs, 3, "DataSet::getObjinfo", __LINE__, __FILE__); + verify_val(static_cast(oinfo.num_attrs), 3, "DataSet::getObjinfo", __LINE__, __FILE__); // Open an attribute for the dataset Attribute ds_attr = dataset.openAttribute(ATTR1_NAME); @@ -553,7 +558,7 @@ test_attr_basic_read() // Verify the correct number of attributes another way HDmemset(&oinfo, 0, sizeof(oinfo)); group.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); - verify_val(oinfo.num_attrs, 1, "Group::getObjinfo", __LINE__, __FILE__); + verify_val(static_cast(oinfo.num_attrs), 1, "Group::getObjinfo", __LINE__, __FILE__); // Open an attribute for the group Attribute gr_attr = group.openAttribute(ATTR2_NAME); @@ -678,10 +683,10 @@ test_attr_compound_read() H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); - verify_val(oinfo.num_attrs, 1, "DataSet::getObjinfo", __LINE__, __FILE__); + verify_val(static_cast(oinfo.num_attrs), 1, "DataSet::getObjinfo", __LINE__, __FILE__); // Open 1st attribute for the dataset - Attribute attr = dataset.openAttribute((unsigned)0); + Attribute attr = dataset.openAttribute(static_cast(0)); /* Verify Dataspace */ @@ -695,14 +700,17 @@ test_attr_compound_read() // Get the dims of the dataspace and verify them int ndims = space.getSimpleExtentDims(dims); verify_val(ndims, ATTR4_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - verify_val((long)dims[0], (long)ATTR4_DIM1, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - verify_val((long)dims[1], (long)ATTR4_DIM2, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + verify_val(static_cast(dims[0]), static_cast(ATTR4_DIM1), + "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + verify_val(static_cast(dims[1]), static_cast(ATTR4_DIM2), + "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); // Get the class of the datatype that is used by attr H5T_class_t type_class = attr.getTypeClass(); // Verify that the type is of compound datatype - verify_val(type_class, H5T_COMPOUND, "Attribute::getTypeClass", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_COMPOUND), "Attribute::getTypeClass", + __LINE__, __FILE__); // Get the compound datatype CompType datatype = attr.getCompType(); @@ -734,11 +742,13 @@ test_attr_compound_read() // Get and verify the type class of the first member type_class = datatype.getMemberClass(0); - verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_INTEGER), "DataType::getMemberClass", + __LINE__, __FILE__); // Get and verify the order of this member's type IntType i_type = datatype.getMemberIntType(0); H5T_order_t order = i_type.getOrder(); - verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__); + verify_val(static_cast(order), static_cast(PredType::NATIVE_INT.getOrder()), + "DataType::getOrder", __LINE__, __FILE__); // Get and verify the size of this member's type size = i_type.getSize(); @@ -746,21 +756,25 @@ test_attr_compound_read() // Get and verify class, order, and size of the second member's type type_class = datatype.getMemberClass(1); - verify_val(type_class, H5T_FLOAT, "DataType::getMemberClass", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_FLOAT), "DataType::getMemberClass", + __LINE__, __FILE__); FloatType f_type = datatype.getMemberFloatType(1); order = f_type.getOrder(); - verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__); + verify_val(static_cast(order), static_cast(PredType::NATIVE_DOUBLE.getOrder()), + "DataType::getOrder", __LINE__, __FILE__); size = f_type.getSize(); verify_val(size, PredType::NATIVE_DOUBLE.getSize(), "DataType::getSize", __LINE__, __FILE__); // Get and verify class, order, and size of the third member's type type_class = datatype.getMemberClass(2); - verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_INTEGER), "DataType::getMemberClass", + __LINE__, __FILE__); // Note: H5T_INTEGER is correct here! StrType s_type = datatype.getMemberStrType(2); order = s_type.getOrder(); - verify_val(order, PredType::NATIVE_SCHAR.getOrder(), "DataType::getOrder", __LINE__, __FILE__); + verify_val(static_cast(order), static_cast(PredType::NATIVE_SCHAR.getOrder()), + "DataType::getOrder", __LINE__, __FILE__); size = s_type.getSize(); verify_val(size, PredType::NATIVE_SCHAR.getSize(), "DataType::getSize", __LINE__, __FILE__); @@ -902,15 +916,18 @@ test_attr_scalar_read() // Read attribute information float read_data2 = 0.0; // Buffer for reading 1st attribute ds_attr.read(PredType::NATIVE_FLOAT, &read_data2); - if (HDfabs(read_data2 - attr_data5) > FP_EPSILON) - verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__); + if (abs(read_data2 - attr_data5) > FLT_EPSILON) + TestErrPrintf("%d: attribute data different: read_data2=%f, " + "attr_data5=%f\n", + __LINE__, static_cast(read_data2), static_cast(attr_data5)); // Get the dataspace of the attribute DataSpace att_space = ds_attr.getSpace(); // Make certain the dataspace is scalar H5S_class_t space_type = att_space.getSimpleExtentType(); - verify_val(space_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__); + verify_val(static_cast(space_type), static_cast(H5S_SCALAR), + "DataSpace::getSimpleExtentType", __LINE__, __FILE__); PASSED(); } // end try block @@ -1029,7 +1046,7 @@ test_attr_mult_read() verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open 1st attribute for the dataset - Attribute attr = dataset.openAttribute((unsigned)0); + Attribute attr = dataset.openAttribute(static_cast(0)); /* Verify Dataspace */ @@ -1042,10 +1059,10 @@ test_attr_mult_read() // Get the dims of the dataspace and verify them hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions - int ndims = space.getSimpleExtentDims(dims); - if ((long)dims[0] != (long)ATTR1_DIM1) + (void)space.getSimpleExtentDims(dims); + if (dims[0] != ATTR1_DIM1) TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %llu\n", __LINE__, - (int)dims[0], ATTR1_DIM1); + static_cast(dims[0]), ATTR1_DIM1); /* Verify Datatype */ @@ -1053,14 +1070,16 @@ test_attr_mult_read() H5T_class_t type_class = attr.getTypeClass(); // Verify that the type is of integer datatype - verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_INTEGER), "Attribute::getTypeClass", + __LINE__, __FILE__); // Get the integer datatype IntType i_type1 = attr.getIntType(); // Get and verify the order of this type H5T_order_t order = i_type1.getOrder(); - verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__); + verify_val(static_cast(order), static_cast(PredType::NATIVE_INT.getOrder()), + "DataType::getOrder", __LINE__, __FILE__); // Get and verify the size of this type size_t size = i_type1.getSize(); @@ -1083,7 +1102,7 @@ test_attr_mult_read() space.close(); // Open 2nd attribute for the dataset - attr = dataset.openAttribute((unsigned)1); + attr = dataset.openAttribute(static_cast(1)); /* Verify Dataspace */ @@ -1095,10 +1114,12 @@ test_attr_mult_read() verify_val(rank, ATTR2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); // Get the dims of the dataspace and verify them - ndims = space.getSimpleExtentDims(dims); + (void)space.getSimpleExtentDims(dims); - verify_val((long)dims[0], (long)ATTR2_DIM1, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - verify_val((long)dims[1], (long)ATTR2_DIM2, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + verify_val(static_cast(dims[0]), static_cast(ATTR2_DIM1), + "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + verify_val(static_cast(dims[1]), static_cast(ATTR2_DIM2), + "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); /* Verify Datatype */ @@ -1106,14 +1127,16 @@ test_attr_mult_read() type_class = attr.getTypeClass(); // Verify that the type is of integer datatype - verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_INTEGER), "Attribute::getTypeClass", + __LINE__, __FILE__); // Get the integer datatype IntType i_type2 = attr.getIntType(); // Get and verify the order of this type order = i_type2.getOrder(); - verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__); + verify_val(static_cast(order), static_cast(PredType::NATIVE_INT.getOrder()), + "DataType::getOrder", __LINE__, __FILE__); // Get and verify the size of this type size = i_type2.getSize(); @@ -1138,7 +1161,7 @@ test_attr_mult_read() space.close(); // Open 3rd attribute for the dataset - attr = dataset.openAttribute((unsigned)2); + attr = dataset.openAttribute(static_cast(2)); /* Verify Dataspace */ @@ -1150,10 +1173,13 @@ test_attr_mult_read() verify_val(rank, ATTR3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); // Get the dims of the dataspace and verify them - ndims = space.getSimpleExtentDims(dims); - verify_val((long)dims[0], (long)ATTR3_DIM1, "attribute dimensions", __FILE__, __LINE__); - verify_val((long)dims[1], (long)ATTR3_DIM2, "attribute dimensions", __FILE__, __LINE__); - verify_val((long)dims[2], (long)ATTR3_DIM3, "attribute dimensions", __FILE__, __LINE__); + (void)space.getSimpleExtentDims(dims); + verify_val(static_cast(dims[0]), static_cast(ATTR3_DIM1), "attribute dimensions", + __FILE__, __LINE__); + verify_val(static_cast(dims[1]), static_cast(ATTR3_DIM2), "attribute dimensions", + __FILE__, __LINE__); + verify_val(static_cast(dims[2]), static_cast(ATTR3_DIM3), "attribute dimensions", + __FILE__, __LINE__); /* Verify Datatype */ @@ -1161,14 +1187,16 @@ test_attr_mult_read() type_class = attr.getTypeClass(); // Verify that the type is of compound datatype - verify_val(type_class, H5T_FLOAT, "Attribute::getTypeClass", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_FLOAT), "Attribute::getTypeClass", + __LINE__, __FILE__); // Get the double datatype FloatType f_type = attr.getFloatType(); // Get and verify the order of this type order = f_type.getOrder(); - verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__); + verify_val(static_cast(order), static_cast(PredType::NATIVE_DOUBLE.getOrder()), + "DataType::getOrder", __LINE__, __FILE__); // Get and verify the size of this type size = f_type.getSize(); @@ -1181,7 +1209,7 @@ test_attr_mult_read() for (i = 0; i < ATTR3_DIM1; i++) for (j = 0; j < ATTR3_DIM2; j++) for (k = 0; k < ATTR3_DIM3; k++) - if (attr_data3[i][j][k] != read_data3[i][j][k]) + if (abs(attr_data3[i][j][k] - read_data3[i][j][k]) > DBL_EPSILON) TestErrPrintf("%d: attribute data different: attr_data3[%llu][%llu][%llu]=%f, " "read_data3[%llu][%llu][%llu]=%f\n", __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]); @@ -1230,7 +1258,7 @@ test_attr_delete() verify_val(num_attrs, 1, "H5File::getNumAttrs", __LINE__, __FILE__); // Verify the name of the only file attribute left - Attribute fattr = fid1.openAttribute((unsigned)0); + Attribute fattr = fid1.openAttribute(static_cast(0)); attr_name = fattr.getName(); verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__); fattr.close(); @@ -1270,7 +1298,7 @@ test_attr_delete() verify_val(num_attrs, 2, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open 1st attribute for the dataset - Attribute attr = dataset.openAttribute((unsigned)0); + Attribute attr = dataset.openAttribute(static_cast(0)); // Verify Name attr_name = attr.getName(); @@ -1280,7 +1308,7 @@ test_attr_delete() attr.close(); // Open last (formally 3rd) attribute for the dataset - attr = dataset.openAttribute((unsigned)1); + attr = dataset.openAttribute(static_cast(1)); // Verify Name attr_name = attr.getName(); @@ -1296,7 +1324,7 @@ test_attr_delete() verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open the only attribute for the dataset (formally 3rd) - attr = dataset.openAttribute((unsigned)0); + attr = dataset.openAttribute(static_cast(0)); // Verify Name attr_name = attr.getName(); @@ -1370,7 +1398,7 @@ test_attr_dtype_shared() #ifndef H5_NO_DEPRECATED_SYMBOLS // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__); + verify_val(static_cast(statbuf.nlink), 1, "DataType::getObjinfo", __LINE__, __FILE__); #endif // Create dataspace for dataset @@ -1381,7 +1409,7 @@ test_attr_dtype_shared() #ifndef H5_NO_DEPRECATED_SYMBOLS // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__); + verify_val(static_cast(statbuf.nlink), 2, "H5File::getObjinfo", __LINE__, __FILE__); #endif // Create attribute on dataset @@ -1390,7 +1418,7 @@ test_attr_dtype_shared() #ifndef H5_NO_DEPRECATED_SYMBOLS // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__); + verify_val(static_cast(statbuf.nlink), 3, "DataSet::getObjinfo", __LINE__, __FILE__); #endif // Close attribute @@ -1402,8 +1430,8 @@ test_attr_dtype_shared() #ifndef H5_NO_DEPRECATED_SYMBOLS // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, - __FILE__); + verify_val(static_cast(statbuf.nlink), 2, "DataSet::getObjinfo after DataSet::removeAttr", + __LINE__, __FILE__); #endif // Create attribute on dataset @@ -1412,7 +1440,7 @@ test_attr_dtype_shared() #ifndef H5_NO_DEPRECATED_SYMBOLS // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__); + verify_val(static_cast(statbuf.nlink), 3, "DataSet::createAttribute", __LINE__, __FILE__); #endif // Write data into the attribute @@ -1449,7 +1477,7 @@ test_attr_dtype_shared() #ifndef H5_NO_DEPRECATED_SYMBOLS // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__); + verify_val(static_cast(statbuf.nlink), 3, "DataSet::openAttribute", __LINE__, __FILE__); #endif } // end of second enclosing @@ -1459,7 +1487,7 @@ test_attr_dtype_shared() #ifndef H5_NO_DEPRECATED_SYMBOLS // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__); + verify_val(static_cast(statbuf.nlink), 1, "H5File::unlink", __LINE__, __FILE__); #endif // Unlink the named datatype @@ -1470,7 +1498,8 @@ test_attr_dtype_shared() // Check size of file filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); - verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__); + verify_val(static_cast(filesize), static_cast(empty_filesize), "Checking file size", + __LINE__, __FILE__); PASSED(); } // end try block @@ -1806,7 +1835,8 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl) // Get creation order indexing on object unsigned crt_order_flags = 0; crt_order_flags = dcpl.getAttrCrtOrder(); - verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__); + verify_val(static_cast(crt_order_flags), 0, "DSetCreatPropList::getAttrCrtOrder", __LINE__, + __FILE__); // Setting invalid combination of a attribute order creation order // indexing on should fail @@ -1825,7 +1855,7 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl) // verify them dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED); crt_order_flags = dcpl.getAttrCrtOrder(); - verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), + verify_val(crt_order_flags, static_cast(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__); // Create dataspace for dataset @@ -1861,7 +1891,7 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl) // Query the attribute creation properties crt_order_flags = dcpl.getAttrCrtOrder(); - verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), + verify_val(crt_order_flags, static_cast(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__); PASSED(); diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 2170a9d..c27171b 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -101,11 +101,11 @@ test_compound_2() SUBTEST("Compound Element Reordering"); try { // Sizes should be the same, but be careful just in case - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t)); + buf = static_cast(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); + bkg = static_cast(HDmalloc(nelmts * sizeof(dst_typ_t))); + orig = static_cast(HDmalloc(nelmts * sizeof(src_typ_t))); for (i = 0; i < nelmts; i++) { - s_ptr = ((src_typ_t *)orig) + i; + s_ptr = (reinterpret_cast(orig)) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; s_ptr->c[0] = i * 8 + 2; @@ -115,7 +115,7 @@ test_compound_2() s_ptr->d = i * 8 + 6; s_ptr->e = i * 8 + 7; } - memcpy(buf, orig, nelmts * sizeof(src_typ_t)); + HDmemcpy(buf, orig, nelmts * sizeof(src_typ_t)); // Build hdf5 datatypes array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); @@ -142,12 +142,12 @@ test_compound_2() array_dt->close(); // Perform the conversion - st.convert(dt, (size_t)nelmts, buf, bkg); + st.convert(dt, static_cast(nelmts), buf, bkg); // Compare results for (i = 0; i < nelmts; i++) { - s_ptr = ((src_typ_t *)orig) + i; - d_ptr = ((dst_typ_t *)buf) + i; + s_ptr = (reinterpret_cast(orig)) + i; + d_ptr = (reinterpret_cast(buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] || s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) { @@ -214,11 +214,11 @@ test_compound_3() SUBTEST("Compound Datatype Subset Conversions"); try { /* Initialize */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t)); + buf = static_cast(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); + bkg = static_cast(HDmalloc(nelmts * sizeof(dst_typ_t))); + orig = static_cast(HDmalloc(nelmts * sizeof(src_typ_t))); for (i = 0; i < nelmts; i++) { - s_ptr = ((src_typ_t *)orig) + i; + s_ptr = (reinterpret_cast(orig)) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; s_ptr->c[0] = i * 8 + 2; @@ -253,12 +253,12 @@ test_compound_3() array_dt->close(); /* Perform the conversion */ - st.convert(dt, (size_t)nelmts, buf, bkg); + st.convert(dt, static_cast(nelmts), buf, bkg); /* Compare results */ for (i = 0; i < nelmts; i++) { - s_ptr = ((src_typ_t *)orig) + i; - d_ptr = ((dst_typ_t *)buf) + i; + s_ptr = (reinterpret_cast(orig)) + i; + d_ptr = (reinterpret_cast(buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] || s_ptr->e != d_ptr->e) { H5_FAILED(); @@ -268,8 +268,8 @@ test_compound_3() << ", e=" << s_ptr->e << "}" << endl; cerr << " dst={a=" << d_ptr->a << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << "," << d_ptr->c[2] << "," << d_ptr->c[3] << "], e=" << d_ptr->e << "}" << endl; - } // if - } // for + } + } /* Release resources */ HDfree(buf); @@ -329,11 +329,11 @@ test_compound_4() SUBTEST("Compound Element Shrinking & Reordering"); try { /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t)); + buf = static_cast(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); + bkg = static_cast(HDmalloc(nelmts * sizeof(dst_typ_t))); + orig = static_cast(HDmalloc(nelmts * sizeof(src_typ_t))); for (i = 0; i < nelmts; i++) { - s_ptr = ((src_typ_t *)orig) + i; + s_ptr = (reinterpret_cast(orig)) + i; s_ptr->a = i * 8 + 0; s_ptr->b = (i * 8 + 1) & 0x7fff; s_ptr->c[0] = i * 8 + 2; @@ -370,12 +370,12 @@ test_compound_4() array_dt->close(); /* Perform the conversion */ - st.convert(dt, (size_t)nelmts, buf, bkg); + st.convert(dt, static_cast(nelmts), buf, bkg); /* Compare results */ for (i = 0; i < nelmts; i++) { - s_ptr = ((src_typ_t *)orig) + i; - d_ptr = ((dst_typ_t *)buf) + i; + s_ptr = (reinterpret_cast(orig)) + i; + d_ptr = (reinterpret_cast(buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] || s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) { @@ -473,8 +473,8 @@ test_compound_5() /* Convert data */ memcpy(buf, src, sizeof(src)); - src_type.convert(dst_type, (size_t)2, buf, bkg); - dst = (dst_typ_t *)buf; + src_type.convert(dst_type, 2, buf, bkg); + dst = static_cast(buf); /* Cleanup */ src_type.close(); @@ -540,11 +540,11 @@ test_compound_6() SUBTEST("Compound Element Growing"); try { /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t)); + buf = static_cast(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); + bkg = static_cast(HDmalloc(nelmts * sizeof(dst_typ_t))); + orig = static_cast(HDmalloc(nelmts * sizeof(src_typ_t))); for (i = 0; i < nelmts; i++) { - s_ptr = ((src_typ_t *)orig) + i; + s_ptr = (reinterpret_cast(orig)) + i; s_ptr->b = (i * 8 + 1) & 0x7fff; s_ptr->d = (i * 8 + 6) & 0x7fff; } @@ -560,19 +560,19 @@ test_compound_6() dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_LONG); /* Perform the conversion */ - st.convert(dt, (size_t)nelmts, buf, bkg); + st.convert(dt, static_cast(nelmts), buf, bkg); /* Compare results */ for (i = 0; i < nelmts; i++) { - s_ptr = ((src_typ_t *)orig) + i; - d_ptr = ((dst_typ_t *)buf) + i; + s_ptr = (reinterpret_cast(orig)) + i; + d_ptr = (reinterpret_cast(buf)) + i; if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) { H5_FAILED(); cerr << " i=" << i << endl; cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d << "}" << endl; cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d << "}" << endl; - } // if - } // for + } + } /* Release resources */ HDfree(buf); @@ -715,22 +715,22 @@ test_compound_set_size() // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__); // Expand the type, and verify that it became unpacked - dtype.setSize((size_t)33); + dtype.setSize(33); // packed = dtype.packed(); // not until C library provides API // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__); // Verify setSize() actually set size size_t new_size = dtype.getSize(); - verify_val(new_size, (size_t)33, "DataType::getSize", __LINE__, __FILE__); + verify_val(static_cast(new_size), 33, "DataType::getSize", __LINE__, __FILE__); // Shrink the type, and verify that it became packed - dtype.setSize((size_t)32); + dtype.setSize(32); // packed = dtype.packed(); // not until C library provides API // verify_val(packed, TRUE, "DataType::packed", __LINE__, __FILE__); // Verify setSize() actually set size again new_size = dtype.getSize(); - verify_val(new_size, (size_t)32, "DataType::getSize", __LINE__, __FILE__); + verify_val(static_cast(new_size), 32, "DataType::getSize", __LINE__, __FILE__); /* Close types and file */ dtype_tmp.close(); diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index 257233e..5a78133 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -61,11 +61,11 @@ test_transfplist() // Find out the length of the transform expression, allocate the buffer // for it, then read and verify the expression from the copied plist ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL); - char * c_to_f_read = (char *)HDmalloc(tran_len + 1); + char * c_to_f_read = static_cast(HDmalloc(tran_len + 1)); HDmemset(c_to_f_read, 0, tran_len + 1); dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len + 1); - verify_val((const char *)c_to_f_read, (const char *)c_to_f, "DSetMemXferPropList::getDataTransform", - __LINE__, __FILE__); + verify_val(const_cast(c_to_f_read), const_cast(c_to_f), + "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); HDfree(c_to_f_read); // @@ -76,26 +76,26 @@ test_transfplist() // Get and verify the expression with: // ssize_t getDataTransform(char* exp, const size_t buf_size [default=0]) tran_len = dxpl_c_to_f.getDataTransform(NULL); - c_to_f_read = (char *)HDmalloc(tran_len + 1); + c_to_f_read = static_cast(HDmalloc(tran_len + 1)); HDmemset(c_to_f_read, 0, tran_len + 1); dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len + 1); - verify_val((const char *)c_to_f_read, (const char *)c_to_f, "DSetMemXferPropList::getDataTransform", - __LINE__, __FILE__); + verify_val(const_cast(c_to_f_read), const_cast(c_to_f), + "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); HDfree(c_to_f_read); // Get and verify the expression with: // H5std_string DSetMemXferPropList::getDataTransform() H5std_string simple_read = dxpl_simple.getDataTransform(); - verify_val((const char *)simple_read.c_str(), (const char *)simple, + verify_val(const_cast(simple_read.c_str()), const_cast(simple), "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); // Get and verify the expression with: // ssize_t getDataTransform(char* exp, const size_t buf_size) tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0); - char *utrans_inv_read = (char *)HDmalloc(tran_len + 1); + char *utrans_inv_read = static_cast(HDmalloc(tran_len + 1)); HDmemset(utrans_inv_read, 0, tran_len + 1); dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len + 1); - verify_val((const char *)utrans_inv_read, (const char *)utrans_inv, + verify_val(const_cast(utrans_inv_read), const_cast(utrans_inv), "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); HDfree(utrans_inv_read); diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 255fc30..15bad64 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -31,14 +31,14 @@ using namespace H5; #include "h5test.h" #include "h5cpputil.h" // C++ utilility header file -const hsize_t F1_USERBLOCK_SIZE = (hsize_t)0; +const hsize_t F1_USERBLOCK_SIZE = 0; const size_t F1_OFFSET_SIZE = sizeof(haddr_t); const size_t F1_LENGTH_SIZE = sizeof(hsize_t); const unsigned F1_SYM_LEAF_K = 4; const unsigned F1_SYM_INTERN_K = 16; const H5std_string FILE1("tfile1.h5"); -const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512; +const hsize_t F2_USERBLOCK_SIZE = 512; const size_t F2_OFFSET_SIZE = 8; const size_t F2_LENGTH_SIZE = 8; const unsigned F2_SYM_LEAF_K = 8; @@ -46,7 +46,7 @@ const unsigned F2_SYM_INTERN_K = 32; const unsigned F2_ISTORE = 64; const H5std_string FILE2("tfile2.h5"); -const hsize_t F3_USERBLOCK_SIZE = (hsize_t)0; +const hsize_t F3_USERBLOCK_SIZE = 0; const size_t F3_OFFSET_SIZE = F2_OFFSET_SIZE; const size_t F3_LENGTH_SIZE = F2_LENGTH_SIZE; const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K; @@ -153,8 +153,8 @@ test_file_create() FileCreatPropList tmpl1 = file1->getCreatePlist(); hsize_t ublock = tmpl1.getUserblock(); - verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, - __FILE__); + verify_val(static_cast(ublock), static_cast(F1_USERBLOCK_SIZE), + "FileCreatPropList::getUserblock", __LINE__, __FILE__); size_t parm1, parm2; // file-creation parameters tmpl1.getSizes(parm1, parm2); @@ -209,8 +209,8 @@ test_file_create() // Get the file-creation parameters hsize_t ublock = tmpl1->getUserblock(); - verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, - __FILE__); + verify_val(static_cast(ublock), static_cast(F2_USERBLOCK_SIZE), + "FileCreatPropList::getUserblock", __LINE__, __FILE__); size_t parm1, parm2; // file-creation parameters tmpl1->getSizes(parm1, parm2); @@ -242,8 +242,8 @@ test_file_create() // Get the file-creation parameters ublock = tmpl1->getUserblock(); - verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, - __FILE__); + verify_val(static_cast(ublock), static_cast(F3_USERBLOCK_SIZE), + "FileCreatPropList::getUserblock", __LINE__, __FILE__); tmpl1->getSizes(parm1, parm2); verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); @@ -300,8 +300,8 @@ test_file_open() // Get the file-creation parameters hsize_t ublock = tmpl1.getUserblock(); - verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, - __FILE__); + verify_val(static_cast(ublock), static_cast(F2_USERBLOCK_SIZE), + "FileCreatPropList::getUserblock", __LINE__, __FILE__); size_t parm1, parm2; // file-creation parameters tmpl1.getSizes(parm1, parm2); @@ -645,7 +645,8 @@ test_file_attribute() // Get the class of a file attribute's datatype H5T_class_t atclass = fattr1.getTypeClass(); - verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__); + verify_val(static_cast(atclass), static_cast(H5T_FLOAT), "Attribute::getTypeClass()", + __LINE__, __FILE__); // Get and verify the number of attributes attached to a file int n_attrs = file5.getNumAttrs(); @@ -896,9 +897,9 @@ test_file_info() // Get the file's version information. H5F_info2_t finfo; tempfile.getFileInfo(finfo); - verify_val(finfo.super.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.super.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); // Close the file. tempfile.close(); @@ -910,9 +911,10 @@ test_file_info() fcpl.getFileSpaceStrategy(out_strategy, out_persist, out_threshold); // Verify file space information. - verify_val(out_strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(out_strategy), static_cast(H5F_FSPACE_STRATEGY_FSM_AGGR), + "H5File::getFileInfo", __LINE__, __FILE__); verify_val(out_persist, FALSE, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(out_threshold, 1, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(out_threshold), 1, "H5File::getFileInfo", __LINE__, __FILE__); /* Retrieve file space page size */ hsize_t out_fsp_psize = fcpl.getFileSpacePagesize(); @@ -943,9 +945,9 @@ test_file_info() // Get the file's version information. file7.getFileInfo(finfo); - verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.super.version), 2, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); // Close the file. file7.close(); @@ -958,9 +960,9 @@ test_file_info() // Get the file's version information. file7.getFileInfo(finfo); - verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.super.version), 2, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); // Retrieve the property values & check them. hsize_t userblock = fcpl2.getUserblock(); @@ -986,7 +988,8 @@ test_file_info() // Get and verify the file space info from the creation property list */ fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold); - verify_val(out_strategy, strategy, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); + verify_val(static_cast(out_strategy), static_cast(strategy), + "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); verify_val(out_persist, persist, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); verify_val(out_threshold, threshold, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 9952e68..5808136 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -73,7 +73,7 @@ struct space4_struct { unsigned u; float f; char c2; -} space4_data = {'v', 987123, (float)-3.14, 'g'}; /* Test data for 4th dataspace */ +} space4_data = {'v', 987123, -3.14f, 'g'}; /* Test data for 4th dataspace */ /* Null dataspace */ int space5_data = 7; @@ -118,7 +118,7 @@ test_h5s_basic() // Get simple extent npoints of the dataspace sid1 and verify it hssize_t n; // Number of dataspace elements n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, (long)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3), + verify_val(static_cast(n), SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); // Get the logical rank of dataspace sid1 and verify it @@ -140,7 +140,7 @@ test_h5s_basic() // Get simple extent npoints of dataspace sid2 and verify it n = sid2.getSimpleExtentNpoints(); - verify_val((long)n, (long)(SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4), + verify_val(static_cast(n), SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); // Get the logical rank of dataspace sid2 and verify it @@ -200,6 +200,7 @@ test_h5s_basic() // CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure // in the p_close see how this will handle it. - BMR + // When running in valgrind, this PASSED macro will be missed PASSED(); } // end of try block @@ -248,7 +249,7 @@ test_h5s_scalar_write() // n = H5Sget_simple_extent_npoints(sid1); hssize_t n; // Number of dataspace elements n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val(static_cast(n), 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); int rank; // Logical rank of dataspace rank = sid1.getSimpleExtentNdims(); @@ -263,7 +264,8 @@ test_h5s_scalar_write() // Verify extent type H5S_class_t ext_type; // Extent type ext_type = sid1.getSimpleExtentType(); - verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__); + verify_val(static_cast(ext_type), static_cast(H5S_SCALAR), + "DataSpace::getSimpleExtentType", __LINE__, __FILE__); // Create and write a dataset DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1); @@ -314,7 +316,7 @@ test_h5s_scalar_read() // Get the number of dataspace elements hssize_t n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val(static_cast(n), 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); // Get the logical rank of the dataspace int ndims = sid1.getSimpleExtentNdims(); @@ -371,7 +373,7 @@ test_h5s_null() hssize_t n; // Number of dataspace elements n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val(static_cast(n), 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); // Create a dataset DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1); @@ -436,7 +438,7 @@ test_h5s_compound_scalar_write() // Get the number of dataspace elements hssize_t n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val(static_cast(n), 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); // Get the logical rank of the dataspace int ndims = sid1.getSimpleExtentNdims(); @@ -496,7 +498,7 @@ test_h5s_compound_scalar_read() // Get the number of dataspace elements hssize_t n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val(static_cast(n), 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); // Get the logical rank of the dataspace int ndims = sid1.getSimpleExtentNdims(); diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index 17620ca..b6a9436 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -67,7 +67,8 @@ typedef struct { iter_enum command; /* The type of return value */ } iter_info; -int iter_strcmp(const void *s1, const void *s2); +static int iter_strcmp(const void *s1, const void *s2); +static void printelems(const Group &group, const H5std_string &dsname, const H5std_string &atname); /*------------------------------------------------------------------------- * Function: iter_strcmp @@ -75,10 +76,10 @@ int iter_strcmp(const void *s1, const void *s2); * Purpose String comparison routine for qsort *------------------------------------------------------------------------- */ -int +static int iter_strcmp(const void *s1, const void *s2) { - return (HDstrcmp(*(const char *const *)s1, *(const char *const *)s2)); + return (HDstrcmp(*reinterpret_cast(s1), *reinterpret_cast(s2))); } /*------------------------------------------------------------------------- @@ -91,7 +92,7 @@ static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { - iter_info *info = (iter_info *)op_data; + iter_info *info = static_cast(op_data); static int count = 0; static int count2 = 0; @@ -133,7 +134,6 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR static void test_iter_group(FileAccPropList &fapl) { - int i; /* counting variable */ hsize_t idx; /* Index in the group */ char name[NAMELEN]; /* temporary name buffer */ char * lnames[NDATASETS + 2]; /* Names of the links created */ @@ -159,7 +159,7 @@ test_iter_group(FileAccPropList &fapl) // Create a scalar file space DataSpace filespace; - for (i = 0; i < NDATASETS; i++) { + for (int i = 0; i < NDATASETS; i++) { sprintf(name, "Dataset %d", i); // Create a dataset in the file @@ -168,8 +168,7 @@ test_iter_group(FileAccPropList &fapl) /* Keep a copy of the dataset names */ lnames[i] = HDstrdup(name); check_values(lnames[i], "HDstrdup returns NULL", __LINE__, __FILE__); - - } /* end for */ + } /* Create a group and named datatype under root group for testing */ Group grp(file.createGroup(GROUP1, 0)); @@ -181,7 +180,7 @@ test_iter_group(FileAccPropList &fapl) check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__); /* Sort the dataset names */ - HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); + HDqsort(lnames, NDATASETS + 2, sizeof(char *), iter_strcmp); /* Iterate through the datasets in the root group in various ways */ @@ -193,10 +192,10 @@ test_iter_group(FileAccPropList &fapl) // Get the number of object in the root group hsize_t nobjs = root_group.getNumObjs(); - verify_val(nobjs, (hsize_t)(NDATASETS + 2), "H5Gget_info", __LINE__, __FILE__); + verify_val(static_cast(nobjs), NDATASETS + 2, "H5Gget_info", __LINE__, __FILE__); H5std_string obj_name; - for (i = 0; i < nobjs; i++) { + for (hsize_t i = 0; i < nobjs; i++) { // H5O_info2_t oinfo; /* Object info */ obj_name = root_group.getObjnameByIdx(i); @@ -206,7 +205,7 @@ test_iter_group(FileAccPropList &fapl) // oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, "."); // ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, // H5P_DEFAULT); - } /* end for */ + } // Attempted to iterate with invalid index, should fail try { @@ -222,7 +221,7 @@ test_iter_group(FileAccPropList &fapl) // Attempted to iterate with negative index, should fail try { info.command = RET_ZERO; - idx = (hsize_t)-1; + idx = HSIZE_UNDEF; obj_name = root_group.getObjnameByIdx(idx); // Should FAIL but didn't, so throw an invalid action exception @@ -268,7 +267,7 @@ test_iter_group(FileAccPropList &fapl) } // do nothing, exception expected /* Free the dataset names */ - for (i = 0; i < (NDATASETS + 2); i++) + for (int i = 0; i < NDATASETS + 2; i++) HDfree(lnames[i]); // Everything will be closed as they go out of scope @@ -360,7 +359,7 @@ const H5std_string ATTR_NAME("Units"); const H5std_string FATTR_NAME("F attr"); const H5std_string GATTR_NAME("G attr"); const int DIM1 = 2; -void +static void printelems(const Group &group, const H5std_string &dsname, const H5std_string &atname) { try { diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index e8dad5b..8c7f0cd 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -201,7 +201,8 @@ test_lcpl(hid_t fapl_id, hbool_t new_format) // Check that its character encoding is the default. linfo = file.getLinkInfo("/type"); - verify_val(linfo.cset, H5T_CSET_ASCII, "Character encoding is not default", __LINE__, __FILE__); + verify_val(static_cast(linfo.cset), static_cast(H5T_CSET_ASCII), + "Character encoding is not default", __LINE__, __FILE__); // Create a simple dataspace. dims[0] = H5L_DIM1; @@ -214,7 +215,8 @@ test_lcpl(hid_t fapl_id, hbool_t new_format) // Check that its character encoding is the default. linfo = file.getLinkInfo("/dataset"); - verify_val(linfo.cset, H5T_CSET_ASCII, "Character encoding is not default", __LINE__, __FILE__); + verify_val(static_cast(linfo.cset), static_cast(H5T_CSET_ASCII), + "Character encoding is not default", __LINE__, __FILE__); // Create a link creation property list with the UTF-8 character encoding. LinkCreatPropList lcpl; @@ -226,7 +228,8 @@ test_lcpl(hid_t fapl_id, hbool_t new_format) // Check that its character encoding is UTF-8. linfo = file.getLinkInfo(GROUP2NAME); - verify_val(linfo.cset, H5T_CSET_UTF8, "Character encoding is not UTF-8", __LINE__, __FILE__); + verify_val(static_cast(linfo.cset), static_cast(H5T_CSET_UTF8), + "Character encoding is not UTF-8", __LINE__, __FILE__); PASSED(); } // end of try block @@ -580,12 +583,13 @@ const H5std_string GROUP_NAME("/Data"); const H5std_string DSET1_NAME("/Data/Compressed_Data"); const H5std_string DSET2_NAME("/Data/Float_Data"); const int RANK = 2; -const int DIM1 = 2; // Operator function static int visit_obj_cb(H5Object &obj, const H5std_string name, const H5O_info2_t *oinfo, void *_op_data) { + (void)obj; // Unused + ovisit_ud_t *op_data = static_cast(_op_data); // Check for correct object information diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 5892f39..2b694da 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -87,7 +87,7 @@ test_get_objname() if (name_len > 4) { char *grp1_name = new char[5]; name_len = grp1.getObjName(grp1_name, 5); - verify_val((const char *)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__); + verify_val(const_cast(grp1_name), "/Top", "Group::getObjName", __LINE__, __FILE__); delete[] grp1_name; } @@ -317,8 +317,8 @@ test_get_objname_ontypes() // Name this datatype new_int_type.commit(grp, "IntType NATIVE_INT"); ssize_t name_len = new_int_type.getObjName(type_name); // default len - verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName", - __LINE__, __FILE__); + verify_val(name_len, static_cast(HDstrlen("/typetests/IntType NATIVE_INT")), + "DataType::getObjName", __LINE__, __FILE__); verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__); // Close everything or they can be closed when objects go out of scope @@ -366,25 +366,29 @@ test_get_objtype() // Get and verify object type with // H5O_type_t childObjType(const H5std_string& objname) H5O_type_t objtype = file.childObjType(DSET_IN_FILE); - verify_val(objtype, H5O_TYPE_DATASET, "DataSet::childObjType", __LINE__, __FILE__); + verify_val(static_cast(objtype), static_cast(H5O_TYPE_DATASET), "DataSet::childObjType", + __LINE__, __FILE__); // Get and verify object type with // H5O_type_t childObjType(const char* objname) objtype = grp1.childObjType(GROUP1_1.c_str()); - verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__); + verify_val(static_cast(objtype), static_cast(H5O_TYPE_GROUP), "DataSet::childObjType", + __LINE__, __FILE__); // Get and verify object type with // H5O_type_t childObjType(hsize_t index, H5_index_t index_type, // H5_iter_order_t order, const char* objname=".") - objtype = grp1.childObjType((hsize_t)1, H5_INDEX_NAME, H5_ITER_INC); - verify_val(objtype, H5O_TYPE_NAMED_DATATYPE, "DataSet::childObjType", __LINE__, __FILE__); + objtype = grp1.childObjType(1, H5_INDEX_NAME, H5_ITER_INC); + verify_val(static_cast(objtype), static_cast(H5O_TYPE_NAMED_DATATYPE), + "DataSet::childObjType", __LINE__, __FILE__); // Get and verify object type with // H5O_type_t childObjType(hsize_t index, // H5_index_t index_type=H5_INDEX_NAME, // H5_iter_order_t order=H5_ITER_INC, const char* objname=".") - objtype = grp1.childObjType((hsize_t)2); - verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__); + objtype = grp1.childObjType(2); + verify_val(static_cast(objtype), static_cast(H5O_TYPE_GROUP), "DataSet::childObjType", + __LINE__, __FILE__); // Everything will be closed as they go out of scope @@ -455,17 +459,20 @@ test_open_object_header() // Make sure that each is the right kind of ID H5I_type_t id_type = IdComponent::getHDFObjType(obj_grp); - verify_val(id_type, H5I_GROUP, "H5Iget_type for group ID", __LINE__, __FILE__); + verify_val(static_cast(id_type), static_cast(H5I_GROUP), "H5Iget_type for group ID", + __LINE__, __FILE__); id_type = IdComponent::getHDFObjType(obj_dtype); - verify_val(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID", __LINE__, __FILE__); + verify_val(static_cast(id_type), static_cast(H5I_DATATYPE), "H5Iget_type for datatype ID", + __LINE__, __FILE__); id_type = IdComponent::getHDFObjType(obj_dset); - verify_val(id_type, H5I_DATASET, "H5Iget_type for dataset ID", __LINE__, __FILE__); + verify_val(static_cast(id_type), static_cast(H5I_DATASET), "H5Iget_type for dataset ID", + __LINE__, __FILE__); /* Do something more complex with each of the IDs to make sure */ Group grp2(obj_grp); hsize_t num_objs = grp2.getNumObjs(); - verify_val(num_objs, 1, "H5Gget_info", __LINE__, __FILE__); + verify_val(static_cast(num_objs), 1, "H5Gget_info", __LINE__, __FILE__); // There should be one object, the datatype // Close datatype object opened from the file @@ -482,7 +489,8 @@ test_open_object_header() dtype.setId(obj_dtype); H5T_class_t type_class = dtype.getClass(); - verify_val(type_class, H5T_INTEGER, "H5Tget_class", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_INTEGER), "H5Tget_class", __LINE__, + __FILE__); dtype.close(); // Close datatype object @@ -493,7 +501,7 @@ test_open_object_header() // Try doing something with group, the ID should still work num_objs = grp2.getNumObjs(); - verify_val(num_objs, 1, "H5Gget_info", __LINE__, __FILE__); + verify_val(static_cast(num_objs), 1, "H5Gget_info", __LINE__, __FILE__); // Close the cloned group grp2.close(); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 604ccc0..53a4ed3 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -81,9 +81,9 @@ test_reference_params() // Allocate write & read buffers int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t)); - wbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1); - rbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1); - tbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1); + wbuf = static_cast(HDmalloc(temp_size * SPACE1_DIM1)); + rbuf = static_cast(HDmalloc(temp_size * SPACE1_DIM1)); + tbuf = static_cast(HDmalloc(temp_size * SPACE1_DIM1)); // Create file FILE1 file1 = new H5File(FILE1, H5F_ACC_TRUNC); @@ -103,7 +103,7 @@ test_reference_params() unsigned *tu32; // Temporary pointer to uint32 data int i; - for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + for (tu32 = reinterpret_cast(wbuf), i = 0; i < SPACE1_DIM1; i++) *tu32++ = i * 3; // from C test // Write selection to disk @@ -208,9 +208,9 @@ test_reference_obj() // Allocate write & read buffers int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t)); - wbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1); - rbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1); - tbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1); + wbuf = static_cast(HDmalloc(temp_size * SPACE1_DIM1)); + rbuf = static_cast(HDmalloc(temp_size * SPACE1_DIM1)); + tbuf = static_cast(HDmalloc(temp_size * SPACE1_DIM1)); // Create file FILE1 file1 = new H5File(FILE1, H5F_ACC_TRUNC); @@ -232,7 +232,7 @@ test_reference_obj() DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); unsigned *tu32; // Temporary pointer to uint32 data - for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + for (tu32 = reinterpret_cast(wbuf), i = 0; i < SPACE1_DIM1; i++) *tu32++ = i * 3; // from C test // Write selection to disk @@ -268,22 +268,26 @@ test_reference_obj() // Create reference to dataset and test getRefObjType file1->reference(&wbuf[0], "/Group1/Dataset1"); H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(static_cast(refobj_type), static_cast(H5O_TYPE_DATASET), + "DataSet::getRefObjType", __LINE__, __FILE__); // Create reference to dataset and test getRefObjType file1->reference(&wbuf[1], "/Group1/Dataset2"); refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(static_cast(refobj_type), static_cast(H5O_TYPE_DATASET), + "DataSet::getRefObjType", __LINE__, __FILE__); // Create reference to group file1->reference(&wbuf[2], "/Group1"); refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(static_cast(refobj_type), static_cast(H5O_TYPE_GROUP), + "DataSet::getRefObjType", __LINE__, __FILE__); // Create reference to named datatype file1->reference(&wbuf[3], "/Group1/Datatype1"); refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(static_cast(refobj_type), static_cast(H5O_TYPE_NAMED_DATATYPE), + "DataSet::getRefObjType", __LINE__, __FILE__); // Write selection to disk dataset.write(wbuf, PredType::STD_REF_OBJ); @@ -309,13 +313,14 @@ test_reference_obj() // Check information in the referenced dataset sid1 = dset2.getSpace(); hssize_t n_elements = sid1.getSimpleExtentNpoints(); - verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val(static_cast(n_elements), 4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); // Read from disk dset2.read(tbuf, PredType::NATIVE_UINT); - for (tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - verify_val(*tu32, (uint32_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + for (tu32 = reinterpret_cast(tbuf), i = 0; i < SPACE1_DIM1; i++, tu32++) + verify_val(*tu32, static_cast(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, + __FILE__); // Close dereferenced dataset dset2.close(); @@ -353,7 +358,8 @@ test_reference_obj() H5T_class_t tclass; tclass = dtype1.getClass(); - verify_val(tclass, H5T_COMPOUND, "DataType::getClass", __LINE__, __FILE__); + verify_val(static_cast(tclass), static_cast(H5T_COMPOUND), "DataType::getClass", __LINE__, + __FILE__); int n_members = dtype1.getNmembers(); verify_val(n_members, 3, "CompType::getNmembers", __LINE__, __FILE__); @@ -468,11 +474,11 @@ test_reference_group() // Check number of objects in the group dereferenced by constructor hsize_t nobjs = refgroup.getNumObjs(); - verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs", __LINE__, __FILE__); + verify_val(static_cast(nobjs), 3, "H5Group::getNumObjs", __LINE__, __FILE__); // Check number of objects in the group dereferenced by ::reference nobjs = group.getNumObjs(); - verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs", __LINE__, __FILE__); + verify_val(static_cast(nobjs), 3, "H5Group::getNumObjs", __LINE__, __FILE__); // Check getting file name given the group dereferenced via constructor H5std_string fname = refgroup.getFileName(); @@ -485,13 +491,14 @@ test_reference_group() // Check object type using Group::getObjinfo() H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); - group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo); - verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo", __LINE__, __FILE__); + group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, 0, oinfo); + verify_val(static_cast(oinfo.type), static_cast(H5O_TYPE_DATASET), "Group::getObjinfo", + __LINE__, __FILE__); // Check for out of bound query by index try { HDmemset(&oinfo, 0, sizeof(oinfo)); - group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)9, oinfo); + group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, 9, oinfo); // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("Group::getObjinfo", "Out of bound index."); @@ -502,7 +509,7 @@ test_reference_group() // Unlink one of the objects in the dereferenced group, and re-check refgroup.unlink(GROUPNAME2); nobjs = refgroup.getNumObjs(); - verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs", __LINE__, __FILE__); + verify_val(static_cast(nobjs), 2, "H5Group::getNumObjs", __LINE__, __FILE__); // Close resources group.close(); @@ -550,10 +557,10 @@ test_reference_region_1D() *drbuf; // Buffer for reading numeric data from disk // Allocate write & read buffers - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); - rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); - dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); - drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); + wbuf = static_cast(HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1)); + rbuf = static_cast(HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1)); + dwbuf = static_cast(HDmalloc(sizeof(uint8_t) * SPACE3_DIM1)); + drbuf = static_cast(HDcalloc(sizeof(uint8_t), SPACE3_DIM1)); // Create file FILE1 H5File file1(FILE2, H5F_ACC_TRUNC); @@ -570,7 +577,7 @@ test_reference_region_1D() uint8_t *tu8; // Temporary pointer to uint8 data for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) - *tu8++ = i * 3; // from C test + *tu8++ = static_cast(i); // from C test // Write selection to disk dset3.write(dwbuf, PredType::STD_U8LE); @@ -607,7 +614,8 @@ test_reference_region_1D() // Get and verify object type H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); - verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(static_cast(obj_type), static_cast(H5O_TYPE_DATASET), "DataSet::getRefObjType", + __LINE__, __FILE__); /* Select sequence of ten points for second reference */ coord1[0][0] = 16; @@ -622,7 +630,7 @@ test_reference_region_1D() coord1[9][0] = 3; // Selects array elements to be included in the selection for sid3 - sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); + sid3.selectElements(H5S_SELECT_SET, POINT1_NPOINTS, reinterpret_cast(coord1)); // Get and verify the number of elements in a dataspace selection nelms = sid3.getSelectNpoints(); @@ -658,12 +666,14 @@ test_reference_region_1D() // Get and verify object type obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); - verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(static_cast(obj_type), static_cast(H5O_TYPE_DATASET), + "DataSet::getRefObjType", __LINE__, __FILE__); // Get dataspace of dset3 the verify number of elements sid1 = dset3.getSpace(); nelms = sid1.getSimpleExtentNpoints(); - verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val(static_cast(nelms), 100, "DataSpace::getSimpleExtentNpoints", __LINE__, + __FILE__); } // End of test DataSet::dereference { // Test DataSet constructor -by dereference @@ -674,7 +684,8 @@ test_reference_region_1D() // Get dataspace of newds then verify number of elements sid1 = newds.getSpace(); nelms = sid1.getSimpleExtentNpoints(); - verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val(static_cast(nelms), 100, "DataSpace::getSimpleExtentNpoints", __LINE__, + __FILE__); // Close objects for this mini test newds.close(); @@ -684,8 +695,9 @@ test_reference_region_1D() // Read from disk dset3.read(drbuf, PredType::STD_U8LE); - for (tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) - verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + for (tu8 = static_cast(drbuf), i = 0; i < SPACE3_DIM1; i++, tu8++) + verify_val(*tu8, static_cast(i), "DataSpace::getSimpleExtentNpoints", __LINE__, + __FILE__); /* * Test getting the referenced region @@ -696,56 +708,56 @@ test_reference_region_1D() // Get and verify number of elements in a dataspace selection nelms = reg_sp.getSelectNpoints(); - verify_val((long)nelms, 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + verify_val(static_cast(nelms), 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__); // Get and verify number of hyperslab blocks nelms = reg_sp.getSelectHyperNblocks(); - verify_val((long)nelms, 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + verify_val(static_cast(nelms), 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__); /* Allocate space for the hyperslab blocks */ - coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); + coords = static_cast(HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2)); // Get the list of hyperslab blocks currently selected - reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); + reg_sp.getSelectHyperBlocklist(0, static_cast(nelms), coords); // Verify values in the list - verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[4], (hsize_t)12, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[5], (hsize_t)13, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[6], (hsize_t)17, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[7], (hsize_t)18, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[8], (hsize_t)22, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[9], (hsize_t)23, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[10], (hsize_t)27, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[11], (hsize_t)28, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[12], (hsize_t)32, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[13], (hsize_t)33, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[14], (hsize_t)37, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[15], (hsize_t)38, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[16], (hsize_t)42, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[17], (hsize_t)43, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[18], (hsize_t)47, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[19], (hsize_t)48, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[20], (hsize_t)52, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[21], (hsize_t)53, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[22], (hsize_t)57, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[23], (hsize_t)58, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[24], (hsize_t)62, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[25], (hsize_t)63, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[26], (hsize_t)67, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[27], (hsize_t)68, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[28], (hsize_t)72, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[29], (hsize_t)73, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[0]), 2, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[1]), 3, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[2]), 7, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[3]), 8, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[4]), 12, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[5]), 13, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[6]), 17, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[7]), 18, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[8]), 22, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[9]), 23, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[10]), 27, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[11]), 28, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[12]), 32, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[13]), 33, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[14]), 37, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[15]), 38, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[16]), 42, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[17]), 43, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[18]), 47, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[19]), 48, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[20]), 52, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[21]), 53, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[22]), 57, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[23]), 58, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[24]), 62, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[25]), 63, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[26]), 67, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[27]), 68, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[28]), 72, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(static_cast(coords[29]), 73, "Hyperslab Coordinates", __LINE__, __FILE__); HDfree(coords); // Check boundaries reg_sp.getSelectBounds(low, high); - verify_val(low[0], (hsize_t)2, "DataSpace::getSelectBounds", __LINE__, __FILE__); - verify_val(high[0], (hsize_t)73, "DataSpace::getSelectBounds", __LINE__, __FILE__); + verify_val(static_cast(low[0]), 2, "DataSpace::getSelectBounds", __LINE__, __FILE__); + verify_val(static_cast(high[0]), 73, "DataSpace::getSelectBounds", __LINE__, __FILE__); /* Close region space */ reg_sp.close(); @@ -759,13 +771,13 @@ test_reference_region_1D() // Get and verify number of element points in the current selection hssize_t nelmspts = elm_sp.getSelectElemNpoints(); - verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + verify_val(static_cast(nelmspts), 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__); /* Allocate space for the hyperslab blocks */ - coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); + coords = static_cast(HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t))); // Get the list of element points currently selected - elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); + elm_sp.getSelectElemPointlist(0, static_cast(nelmspts), coords); // Verify points verify_val(coords[0], coord1[0][0], "Element Coordinates", __LINE__, __FILE__); @@ -783,8 +795,8 @@ test_reference_region_1D() // Check boundaries elm_sp.getSelectBounds(low, high); - verify_val(low[0], (hsize_t)3, "DataSpace::getSelectBounds", __LINE__, __FILE__); - verify_val(high[0], (hsize_t)97, "DataSpace::getSelectBounds", __LINE__, __FILE__); + verify_val(static_cast(low[0]), 3, "DataSpace::getSelectBounds", __LINE__, __FILE__); + verify_val(static_cast(high[0]), 97, "DataSpace::getSelectBounds", __LINE__, __FILE__); // Close element space elm_sp.close(); diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 7d0337d..1cedef6 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -110,8 +110,8 @@ test_classes() // PredType::NATIVE_DOUBLE should be in H5T_FLOAT class tcls = PredType::NATIVE_DOUBLE.getClass(); if (H5T_FLOAT != tcls) { - verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, - __FILE__); + verify_val(static_cast(tcls), static_cast(H5T_FLOAT), + "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, __FILE__); } PASSED(); } // end of try block @@ -727,7 +727,7 @@ test_named() Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space); for (hsize_t i = 0; i < ds_size[0]; i++) { for (hsize_t j = 0; j < ds_size[1]; j++) { - attr_data[i][j] = (unsigned)(i * ds_size[1] + j); + attr_data[i][j] = static_cast(i * ds_size[1] + j); } } attr1.write(PredType::NATIVE_UINT, attr_data); @@ -989,7 +989,8 @@ test_encode_decode() // Create an IntType instance from the decoded pointer and verify it IntType * decoded_int_ptr(static_cast(inttyp.decode())); H5T_sign_t int_sign = decoded_int_ptr->getSign(); - verify_val(int_sign, H5T_SGN_NONE, "DataType::decode", __LINE__, __FILE__); + verify_val(static_cast(int_sign), static_cast(H5T_SGN_NONE), "DataType::decode", __LINE__, + __FILE__); verify_val(inttyp == *decoded_int_ptr, true, "DataType::decode", __LINE__, __FILE__); delete decoded_int_ptr; diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 9c0f78a..c91b566 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -183,7 +183,7 @@ test_vlstring_dataset() // Test scalar type dataset with 1 value. dset1 = root.createDataSet("test_scalar_small", vlst, ds_space); - dynstring_ds_write = (char *)HDcalloc(2, sizeof(char)); + dynstring_ds_write = static_cast(HDcalloc(2, sizeof(char))); HDmemset(dynstring_ds_write, 'A', 1); // Write data to the dataset, then read it back. @@ -285,7 +285,7 @@ test_vlstring_array_dataset() // Create and write another dataset. DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space)); - char * wdata2 = (char *)HDcalloc(65534, sizeof(char)); + char * wdata2 = static_cast(HDcalloc(65534, sizeof(char))); HDmemset(wdata2, 'A', 65533); dataset2.write(&wdata2, vlst); @@ -360,7 +360,7 @@ test_vlstrings_special() hsize_t ii; // counting variable for (ii = 0; ii < SPACE1_DIM1; ii++) if (rdata[ii] != NULL) - TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]); + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast(ii), rdata[ii]); // Write dataset to disk, then read it back. dataset.write(wdata, vlst); @@ -372,18 +372,19 @@ test_vlstrings_special() size_t rlen = HDstrlen(rdata[ii]); if (wlen != rlen) { TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n", - (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen); + static_cast(ii), static_cast(wlen), static_cast(ii), + static_cast(rlen)); continue; - } // end if + } if (HDstrcmp(wdata[ii], rdata[ii]) != 0) { - TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii], - (int)ii, rdata[ii]); + TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", + static_cast(ii), wdata[ii], static_cast(ii), rdata[ii]); continue; - } // end if - } // end for + } + } // Reclaim the read VL data. - DataSet::vlenReclaim((void *)rdata, vlst, sid1); + DataSet::vlenReclaim(static_cast(rdata), vlst, sid1); // Close Dataset. dataset.close(); @@ -408,7 +409,7 @@ test_vlstrings_special() // Check data read in. for (ii = 0; ii < SPACE1_DIM1; ii++) if (rdata[ii] != NULL) - TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]); + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast(ii), rdata[ii]); // Try to write nil strings to disk. dataset.write(wdata2, vlst); @@ -419,7 +420,7 @@ test_vlstrings_special() // Check data read in. for (ii = 0; ii < SPACE1_DIM1; ii++) if (rdata[ii] != NULL) - TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]); + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast(ii), rdata[ii]); // Close objects and file. dataset.close(); @@ -467,22 +468,26 @@ test_vlstring_type() // Change padding and verify it. vlst.setStrpad(H5T_STR_NULLPAD); H5T_str_t pad = vlst.getStrpad(); - verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__); + verify_val(static_cast(pad), static_cast(H5T_STR_NULLPAD), "StrType::getStrpad", __LINE__, + __FILE__); // Convert to variable-length string. vlst.setSize(H5T_VARIABLE); // Check if datatype is VL string. H5T_class_t type_class = vlst.getClass(); - verify_val(type_class, H5T_STRING, "DataType::getClass", __LINE__, __FILE__); + verify_val(static_cast(type_class), static_cast(H5T_STRING), "DataType::getClass", + __LINE__, __FILE__); bool is_variable_str = vlst.isVariableStr(); verify_val(is_variable_str, true, "DataType::isVariableStr", __LINE__, __FILE__); // Check default character set and padding. H5T_cset_t cset = vlst.getCset(); - verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__); + verify_val(static_cast(cset), static_cast(H5T_CSET_ASCII), "StrType::getCset", __LINE__, + __FILE__); pad = vlst.getStrpad(); - verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__); + verify_val(static_cast(pad), static_cast(H5T_STR_NULLPAD), "StrType::getStrpad", __LINE__, + __FILE__); // Commit variable-length string datatype to storage. vlst.commit(*file1, VLSTR_TYPE); @@ -510,9 +515,11 @@ test_vlstring_type() // Verify character set and padding cset = vlst2.getCset(); - verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__); + verify_val(static_cast(cset), static_cast(H5T_CSET_ASCII), "StrType::getCset", __LINE__, + __FILE__); pad = vlst2.getStrpad(); - verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__); + verify_val(static_cast(pad), static_cast(H5T_STR_NULLPAD), "StrType::getStrpad", __LINE__, + __FILE__); // Close datatype and file vlst2.close(); @@ -578,18 +585,19 @@ test_compact_vlstring() for (i = 0; i < SPACE1_DIM1; i++) { if (HDstrlen(wdata[i]) != strlen(rdata[i])) { TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", - (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i])); + static_cast(i), static_cast(HDstrlen(wdata[i])), static_cast(i), + static_cast(HDstrlen(rdata[i]))); continue; } // end if if (HDstrcmp(wdata[i], rdata[i]) != 0) { - TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], - (int)i, rdata[i]); + TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", + static_cast(i), wdata[i], static_cast(i), rdata[i]); continue; } // end if } // end for // Reclaim the read VL data - DataSet::vlenReclaim((void *)rdata, vlst, sid1); + DataSet::vlenReclaim(static_cast(rdata), vlst, sid1); // Close objects and file dataset.close(); @@ -670,7 +678,7 @@ test_vlstring_attribute() // Test creating a "large" sized string attribute gr_attr = root.createAttribute("test_scalar_large", vlst, att_space); - string_att_write = (char *)HDcalloc(8192, sizeof(char)); + string_att_write = static_cast(HDcalloc(8192, sizeof(char))); HDmemset(string_att_write, 'A', 8191); // Write data to the attribute, then read it back. diff --git a/config/cmake/H5cxx_config.h.in b/config/cmake/H5cxx_config.h.in deleted file mode 100644 index b5ae8ce..0000000 --- a/config/cmake/H5cxx_config.h.in +++ /dev/null @@ -1,16 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* src/H5cxx_config.h.in Created manually. */ - -/* Define if offsetof extension is present */ -#cmakedefine H5_HAVE_OFFSETOF ${H5_HAVE_OFFSETOF} - diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 0176c7a..45ab8b8 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -26,9 +26,6 @@ /* Define if using a Windows compiler (i.e. Visual Studio) */ #cmakedefine H5_HAVE_VISUAL_STUDIO @H5_HAVE_VISUAL_STUDIO@ -/* Define if C++ compiler recognizes offsetof */ -#cmakedefine H5_CXX_HAVE_OFFSETOF @CXX_HAVE_OFFSETOF@ - /* Define the default plugins path to compile */ #cmakedefine H5_DEFAULT_PLUGINDIR "@H5_DEFAULT_PLUGINDIR@" diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index e2904ca..260bbe0 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -71,10 +71,6 @@ endif () # HDF5 library compile options #----------------------------------------------------------------------------- -#----------------------------------------------------------------------------- -# CDash is configured to only allow 3000 warnings, so -# break into groups (from the config/gnu-flags file) -#----------------------------------------------------------------------------- if (NOT MSVC AND NOT MINGW) if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") list (APPEND HDF5_CMAKE_CXX_FLAGS "-erroff=%none -DBSD_COMP") @@ -121,9 +117,9 @@ if (NOT MSVC AND NOT MINGW) #----------------------------------------------------------------------------- if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") - # if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - # list (APPEND H5_CXXFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") - # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + # list (APPEND H5_CXXFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") + # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") @@ -147,7 +143,7 @@ if (NOT MSVC AND NOT MINGW) ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") endif () - # Append more extra warning flags that only gcc 4.8+ know about + # Append more extra warning flags that only gcc 4.8+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") if (HDF5_ENABLE_DEV_WARNINGS) @@ -157,14 +153,14 @@ if (NOT MSVC AND NOT MINGW) endif () endif () - # Append more extra warning flags that only gcc 4.9+ know about + # Append more extra warning flags that only gcc 4.9+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9") endif () - # Append more extra warning flags that only gcc 5.1+ know about + # Append more extra warning flags that only gcc 5.1+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") @@ -175,13 +171,13 @@ if (NOT MSVC AND NOT MINGW) endif () endif () - # Append more extra warning flags that only gcc 6.x+ know about + # Append more extra warning flags that only gcc 6.x+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () - # Append more extra warning flags that only gcc 7.x+ know about + # Append more extra warning flags that only gcc 7.x+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") @@ -193,7 +189,7 @@ if (NOT MSVC AND NOT MINGW) endif () endif () - # Append more extra warning flags that only gcc 8.x+ know about + # Append more extra warning flags that only gcc 8.x+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") @@ -211,10 +207,11 @@ if (NOT MSVC AND NOT MINGW) endif () endif () - # Append more extra warning flags that only gcc 9.x+ know about + # Append more extra warning flags that only gcc 9.x+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-9") endif () endif () else () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index bb6ad78..0775f59 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -81,10 +81,6 @@ endif () # HDF5 library compile options #----------------------------------------------------------------------------- -#----------------------------------------------------------------------------- -# CDash is configured to only allow 3000 warnings, so -# break into groups (from the config/gnu-flags file) -#----------------------------------------------------------------------------- if (NOT MSVC AND NOT MINGW) #----------------------------------------------------------------------------- # Option to allow the user to interpret certain warnings as errors @@ -178,7 +174,7 @@ if (NOT MSVC AND NOT MINGW) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") endif () - # Append more extra warning flags that only gcc 4.8+ know about + # Append more extra warning flags that only gcc 4.8+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") if (HDF5_ENABLE_DEV_WARNINGS) @@ -188,12 +184,12 @@ if (NOT MSVC AND NOT MINGW) endif () endif () - # Append more extra warning flags that only gcc 4.9+ know about + # Append more extra warning flags that only gcc 4.9+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") endif () - # Append more extra warning flags that only gcc 5.x+ know about + # Append more extra warning flags that only gcc 5.x+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) @@ -203,12 +199,12 @@ if (NOT MSVC AND NOT MINGW) endif () endif () - # Append more extra warning flags that only gcc 6.x+ know about + # Append more extra warning flags that only gcc 6.x+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () - # Append more extra warning flags that only gcc 7.x+ know about + # Append more extra warning flags that only gcc 7.x+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") if (HDF5_ENABLE_DEV_WARNINGS) @@ -218,7 +214,7 @@ if (NOT MSVC AND NOT MINGW) endif () endif () - # Append more extra warning flags that only gcc 8.x+ know about + # Append more extra warning flags that only gcc 8.x+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) @@ -231,17 +227,17 @@ if (NOT MSVC AND NOT MINGW) endif () endif () - # Append more extra warning flags that only gcc 9.x+ know about + # Append more extra warning flags that only gcc 9.x+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") endif () - # Append more extra warning flags that only gcc 9.3+ know about + # Append more extra warning flags that only gcc 9.3+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3") endif () - # Append more extra warning flags that only gcc 10.x+ know about + # Append more extra warning flags that only gcc 10.x+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0) if (HDF5_ENABLE_DEV_WARNINGS) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10") diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake index 8b631ad..18ab621 100644 --- a/config/cmake/HDFFortranCompilerFlags.cmake +++ b/config/cmake/HDFFortranCompilerFlags.cmake @@ -80,37 +80,37 @@ if (NOT MSVC AND NOT MINGW) if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - # Append more extra warning flags that only gcc 4.8+ know about + # Append more extra warning flags that only gcc 4.8+ knows about if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.8) ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.8") endif () - # Append more extra warning flags that only gcc 4.9+ know about + # Append more extra warning flags that only gcc 4.9+ knows about #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.9) # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.9") #endif () - # Append more extra warning flags that only gcc 5.x+ know about + # Append more extra warning flags that only gcc 5.x+ knows about if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.0) ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-5") endif () - # Append more extra warning flags that only gcc 6.x+ know about + # Append more extra warning flags that only gcc 6.x+ knows about if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0) ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-6") endif () - # Append more extra warning flags that only gcc 7.x+ know about + # Append more extra warning flags that only gcc 7.x+ knows about #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0) # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-7") #endif () - # Append more extra warning flags that only gcc 8.x+ know about + # Append more extra warning flags that only gcc 8.x+ knows about if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0) ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-8") endif () - # Append more extra warning flags that only gcc 9.x+ know about + # Append more extra warning flags that only gcc 9.x+ knows about #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0) # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-9") #endif () diff --git a/config/cmake_ext_mod/HDFCXXTests.cpp b/config/cmake_ext_mod/HDFCXXTests.cpp deleted file mode 100644 index 08ccb34..0000000 --- a/config/cmake_ext_mod/HDFCXXTests.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifdef CXX_HAVE_OFFSETOF - -#include -#include - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int -main () -{ - - struct index_st - { - unsigned char type; - unsigned char num; - unsigned int len; - }; - typedef struct index_st index_t; - int x,y; - x = offsetof(struct index_st, len); - y = offsetof(index_t, num) - - ; - return 0; -} - -#endif diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake deleted file mode 100644 index 423f74a..0000000 --- a/config/cmake_ext_mod/HDFUseCXX.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# -# 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://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -# -# This file provides functions for C++ support. -# -#------------------------------------------------------------------------------- -ENABLE_LANGUAGE (CXX) -set (HDF_PREFIX "H5") - -#------------------------------------------------------------------------------- -# Fix CXX flags if we are compiling staticly on Windows using -# Windows_MT.cmake from config/cmake/UserMacros -#------------------------------------------------------------------------------- -if (BUILD_STATIC_CRT_LIBS) - TARGET_STATIC_CRT_FLAGS () -endif () - -#----------------------------------------------------------------------------- -# Configure Checks which require CXX compilation must go in here -# not in the main ConfigureChecks.cmake files, because if the user has -# no CXX compiler, problems arise. -#----------------------------------------------------------------------------- -include (CheckIncludeFileCXX) -include (TestForSTDNamespace) - -# For other CXX specific tests, use this MACRO. -macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) - if (NOT DEFINED ${OTHER_TEST}) - set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - set (OTHER_TEST_ADD_LIBRARIES) - if (HDF5_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}") - endif () - - foreach (def - HAVE_SYS_TIME_H - HAVE_UNISTD_H - HAVE_SYS_TYPES_H - HAVE_SYS_SOCKET_H - HAVE_SYS_FILE_H - ) - if ("${${HDF_PREFIX}_${def}}") - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif () - endforeach () - - if (LARGEFILE) - set (MACRO_CHECK_FUNCTION_DEFINITIONS - "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" - ) - endif () - - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (TRACE "Performing ${OTHER_TEST}") - endif () - TRY_COMPILE (${OTHER_TEST} - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFCXXTests.cpp - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${OTHER_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - if (${OTHER_TEST} EQUAL 0) - set (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Performing CXX Test ${OTHER_TEST} - Success") - endif () - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Performing CXX Test ${OTHER_TEST} - Failed") - endif () - set (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" - "${OUTPUT}\n" - ) - endif () - endif () -endmacro () - -#----------------------------------------------------------------------------- -# Check a bunch of cxx functions -#----------------------------------------------------------------------------- -if (CMAKE_CXX_COMPILER_LOADED) - foreach (cxx_test - CXX_HAVE_OFFSETOF - ) - HDF_CXX_FUNCTION_TEST (${cxx_test}) - endforeach () -endif () diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 0a7c63e..4fe5782 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -260,6 +260,7 @@ if test "X-g++" = "X-$cxx_vendor"; then # gcc 9 if test $cxx_vers_major -ge 9; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 9)" + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-9)" fi ################# diff --git a/config/gnu-warnings/cxx-9 b/config/gnu-warnings/cxx-9 new file mode 100644 index 0000000..d897de2 --- /dev/null +++ b/config/gnu-warnings/cxx-9 @@ -0,0 +1,2 @@ +# Turn this on when the C++ wrappers obey the Rule of Five +-Wno-deprecated-copy diff --git a/configure.ac b/configure.ac index 5fc0558..56bfbcb 100644 --- a/configure.ac +++ b/configure.ac @@ -776,20 +776,6 @@ if test "X$HDF_CXX" = "Xyes"; then ## Change to the C++ language AC_LANG_PUSH(C++) - ## Checking if C++ needs old style header files in includes - PAC_PROG_CXX_HEADERS - - ## Checking if C++ can handle namespaces - PAC_PROG_CXX_NAMESPACE - - ## if C++ can handle static cast - PAC_PROG_CXX_STATIC_CAST - - ## Checking if C++ has offsetof extension, - ## note: this test has to be the last of the C++ tests because it sets a definition - ## which would be used in the other tests, causing them to fail. - PAC_PROG_CXX_OFFSETOF - else AC_MSG_RESULT([no]) CXX="no" diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp index 0f47b0d..3fcc9b2 100644 --- a/hl/c++/src/H5PacketTable.cpp +++ b/hl/c++/src/H5PacketTable.cpp @@ -32,15 +32,13 @@ * Opens an existing packet table, which can contain either fixed-length or * variable-length packets. */ -PacketTable::PacketTable(hid_t fileID, const char *name) +PacketTable::PacketTable(hid_t fileID, const char *name) : table_id{H5PTopen(fileID, name)} { - table_id = H5PTopen(fileID, name); } /* "Open" Constructor - will be deprecated because of char* name */ -PacketTable::PacketTable(hid_t fileID, char *name) +PacketTable::PacketTable(hid_t fileID, char *name) : table_id{H5PTopen(fileID, name)} { - table_id = H5PTopen(fileID, name); } /* Destructor @@ -271,7 +269,7 @@ FL_PacketTable::GetPackets(hsize_t startIndex, hsize_t endIndex, void *data) if (startIndex > endIndex) return -1; - return H5PTread_packets(table_id, startIndex, (size_t)(endIndex - startIndex + 1), data); + return H5PTread_packets(table_id, startIndex, static_cast(endIndex - startIndex + 1), data); } /* GetNextPacket (single packet) diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index acd0ccf..306cc2f 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -33,9 +33,8 @@ class H5_HLCPPDLL PacketTable { /* Null constructor * Sets table_id to "invalid" */ - PacketTable() + PacketTable() : table_id{H5I_INVALID_HID} { - table_id = H5I_INVALID_HID; } /* "Open" Constructor diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 2600367..6deb24d 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -307,7 +307,7 @@ TestCompress() if (HDstrncmp(filter_name, "deflate", 7) != 0) H5_FAILED() } - catch (Exception e) { + catch (Exception const &) { H5_FAILED(); return 1; } @@ -605,8 +605,8 @@ const int STRING_LENGTH = 19; // including terminating NULL int TestHDFFV_9758() { - hid_t strtype; - hid_t compound_type; + hid_t strtype = H5I_INVALID_HID; + hid_t compound_type = H5I_INVALID_HID; herr_t err; struct s1_t { int a; @@ -620,9 +620,9 @@ TestHDFFV_9758() for (hsize_t i = 0; i < NUM_PACKETS; i++) { s1[i].a = static_cast(i); - s1[i].b = 1.f * static_cast(i * i); - s1[i].c = 1. / (i + 1); - HDsprintf(s1[i].d, "string%d", (int)i); + s1[i].b = 1.0f * static_cast(i * i); + s1[i].c = 1.0 / static_cast(i + 1); + HDsprintf(s1[i].d, "string%" PRIuHSIZE "", i); s1[i].e = static_cast(100 + i); } diff --git a/m4/aclocal_cxx.m4 b/m4/aclocal_cxx.m4 deleted file mode 100644 index 2779066..0000000 --- a/m4/aclocal_cxx.m4 +++ /dev/null @@ -1,79 +0,0 @@ -dnl ------------------------------------------------------------------------- -dnl ------------------------------------------------------------------------- -dnl -dnl Copyright by the Board of Trustees of the University of Illinois. -dnl All rights reserved. -dnl -dnl This file is part of HDF5. The full HDF5 copyright notice, including -dnl terms governing use, modification, and redistribution, is contained in -dnl the COPYING file, which can be found at the root of the source code -dnl distribution tree, or in https://www.hdfgroup.org/licenses. -dnl If you do not have access to either file, you may request a copy from -dnl help@hdfgroup.org -dnl -dnl ------------------------------------------------------------------------- -dnl ------------------------------------------------------------------------- - -dnl ********************************* -dnl PURPOSE -dnl Contains Macros for HDF5 C++ -dnl ********************************* -dnl -dnl Special characteristics that have no autoconf counterpart but that -dnl we need as part of the C++ support. To distinquish these, they -dnl have a [PAC] prefix. - -dnl Checking if C++ needs old style header files in includes -AC_DEFUN([PAC_PROG_CXX_HEADERS],[ - AC_MSG_CHECKING([if $CXX needs old style header files in includes]) - TEST_SRC="`(echo \"#define OLD_HEADER_FILENAME 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" - - AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([yes]) - CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME" - AM_CXXFLAGS="${AM_CXXFLAGS} -DOLD_HEADER_FILENAME"]) -]) - -dnl Checking if ++ can handle namespaces -AC_DEFUN([PAC_PROG_CXX_NAMESPACE],[ - AC_MSG_CHECKING([if $CXX can handle namespaces]) - TEST_SRC="`(echo \"#define HDF_NO_NAMESPACE 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" - - AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - CXXFLAGS="${CXXFLAGS} -DHDF_NO_NAMESPACE" - AM_CXXFLAGS="${AM_CXXFLAGS} -DHDF_NO_NAMESPACE"]) -]) - -dnl Checking if C++ supports std -AC_DEFUN([PAC_PROG_CXX_STD],[ - AC_MSG_CHECKING([if $CXX supports std]) - TEST_SRC="`(echo \"#define HDF_NO_STD 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" - - AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - CXXFLAGS="${CXXFLAGS} -DH5_NO_STD" - AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_STD"]) -]) - -dnl Checking if C++ has offsetof extension -AC_DEFUN([PAC_PROG_CXX_OFFSETOF],[ - AC_MSG_CHECKING([if $CXX has offsetof extension]) - TEST_SRC="`(echo \"#define CXX_HAVE_OFFSETOF 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" - - AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],[AC_MSG_RESULT([yes]) - AC_DEFINE([CXX_HAVE_OFFSETOF], [1], [Define if C++ compiler recognizes offsetof])], - AC_MSG_RESULT([no])) -]) - -dnl Checking if C++ can handle static cast -AC_DEFUN([PAC_PROG_CXX_STATIC_CAST],[ - AC_MSG_CHECKING([if $CXX can handle static cast]) - TEST_SRC="`(echo \"#define NO_STATIC_CAST 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" - - AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST" - AM_CXXFLAGS="${AM_CXXFLAGS} -DNO_STATIC_CAST"]) -]) -- cgit v0.12 From 5e4625c04f970464b0d46475214f707a895d03b1 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 1 Jun 2021 19:01:40 -0700 Subject: Removes some DEC Alpha cruft from H5detect and H5private.h (#708) --- config/cmake/H5pubconf.h.in | 3 --- config/cmake_ext_mod/ConfigureChecks.cmake | 9 --------- configure.ac | 6 +++--- src/H5detect.c | 15 --------------- src/H5private.h | 16 +--------------- tools/test/perform/overhead.c | 4 ---- 6 files changed, 4 insertions(+), 49 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 45ab8b8..44b36ca 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -198,9 +198,6 @@ /* Define to 1 if you have the `ioctl' function. */ #cmakedefine H5_HAVE_IOCTL @H5_HAVE_IOCTL@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_IO_H @H5_HAVE_IO_H@ - /* Define to 1 if you have the `crypto' library (-lcrypto). */ #cmakedefine H5_HAVE_LIBCRYPTO @H5_HAVE_LIBCRYPTO@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 12510eb..708fb3e 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -123,19 +123,10 @@ CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) # Windows -CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) if (NOT CYGWIN) CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) endif () -if (CMAKE_SYSTEM_NAME MATCHES "OSF") - CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H) - CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H) -else () - set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) - set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) -endif () - CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) diff --git a/configure.ac b/configure.ac index 56bfbcb..e369f61 100644 --- a/configure.ac +++ b/configure.ac @@ -1252,15 +1252,15 @@ esac ## Windows case "`uname`" in CYGWIN*) - AC_CHECK_HEADERS([io.h sys/timeb.h]) + AC_CHECK_HEADERS([sys/timeb.h]) UNAME_CYGWIN="yes" ;; MINGW*) - AC_CHECK_HEADERS([io.h winsock2.h sys/timeb.h]) + AC_CHECK_HEADERS([winsock2.h sys/timeb.h]) AC_HAVE_LIBRARY([ws2_32]) ;; *) - AC_CHECK_HEADERS([io.h winsock2.h sys/timeb.h]) + AC_CHECK_HEADERS([winsock2.h sys/timeb.h]) ;; esac diff --git a/src/H5detect.c b/src/H5detect.c index 84b34e6..d148301 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -1655,21 +1655,6 @@ main(int argc, char *argv[]) if (!rawoutstream) rawoutstream = stdout; -#if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) -#if defined(UAC_NOPRINT) && defined(UAC_SIGBUS) - /* - * Make sure unaligned access generates SIGBUS and doesn't print warning - * messages so that we can detect alignment constraints on the DEC Alpha. - */ - int nvpairs[2]; - nvpairs[0] = SSIN_UACPROC; - nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; - if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0) < 0) { - fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); - } -#endif -#endif - #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { diff --git a/src/H5private.h b/src/H5private.h index d197465..0ff4c56 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -127,21 +127,6 @@ #endif /* - * System information. These are needed on the DEC Alpha to turn off fixing - * of unaligned accesses by the operating system during detection of - * alignment constraints in H5detect.c:main(). - */ -#ifdef H5_HAVE_SYS_SYSINFO_H -#include -#endif -#ifdef H5_HAVE_SYS_PROC_H -#include -#endif -#ifdef H5_HAVE_IO_H -#include -#endif - -/* * Dynamic library handling. These are needed for dynamically loading I/O * filters and VFDs. */ @@ -175,6 +160,7 @@ #include #include /* For _getcwd() */ +#include /* POSIX I/O */ #endif /*H5_HAVE_WIN32_API*/ diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c index 345c5c8..60ec8d8 100644 --- a/tools/test/perform/overhead.c +++ b/tools/test/perform/overhead.c @@ -29,10 +29,6 @@ #include #include -#ifdef H5_HAVE_IO_H -#include -#endif - #ifdef H5_HAVE_UNISTD_H #include #include -- cgit v0.12 From 88a83d56c07f7c462d1866a2a2642a9f2e37dd22 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 1 Jun 2021 19:27:53 -0700 Subject: Cleans up hsize_t and haddr_t size guessing (#709) * Cleans up definitions of haddr_t and hsize_t + cruft removal * Formatted source --- src/H5public.h | 171 +++++++++++++++------------------------------------------ 1 file changed, 44 insertions(+), 127 deletions(-) diff --git a/src/H5public.h b/src/H5public.h index 33f8b37..b548889 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -217,7 +217,14 @@ typedef int herr_t; typedef bool hbool_t; typedef int htri_t; -/* Define the ssize_t type if it not is defined */ +/* The signed version of size_t + * + * ssize_t is POSIX and not defined in any C standard. It's used in some + * public HDF5 API calls so this work-around will define it if it's not + * present. + * + * Use of ssize_t should be discouraged in new code. + */ #if H5_SIZEOF_SSIZE_T == 0 /* Undefine this size, we will re-define it in one of the sections below */ #undef H5_SIZEOF_SSIZE_T @@ -235,137 +242,47 @@ typedef long long ssize_t; #endif #endif -/* int64_t type is used for creation order field for links. It may be - * defined in Posix.1g, otherwise it is defined here. - */ -#if H5_SIZEOF_INT64_T >= 8 -#elif H5_SIZEOF_INT >= 8 -typedef int int64_t; -#undef H5_SIZEOF_INT64_T -#define H5_SIZEOF_INT64_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG >= 8 -typedef long int64_t; -#undef H5_SIZEOF_INT64_T -#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG -#elif H5_SIZEOF_LONG_LONG >= 8 -typedef long long int64_t; -#undef H5_SIZEOF_INT64_T -#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG -#else -#error "nothing appropriate for int64_t" -#endif - -/* uint64_t type is used for fields for H5O_info_t. It may be - * defined in Posix.1g, otherwise it is defined here. +/** + * The size of file objects. + * + * \internal Defined as a (minimum) 64-bit integer type. */ -#if H5_SIZEOF_UINT64_T >= 8 -#ifndef UINT64_MAX -#define UINT64_MAX ((uint64_t)-1) -#endif -#elif H5_SIZEOF_INT >= 8 -typedef unsigned uint64_t; -#define UINT64_MAX UINT_MAX -#undef H5_SIZEOF_UINT64_T -#define H5_SIZEOF_UINT64_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG >= 8 -typedef unsigned long uint64_t; -#define UINT64_MAX ULONG_MAX -#undef H5_SIZEOF_UINT64_T -#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG -#elif H5_SIZEOF_LONG_LONG >= 8 -typedef unsigned long long uint64_t; -#define UINT64_MAX ULLONG_MAX -#undef H5_SIZEOF_UINT64_T -#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG -#else -#error "nothing appropriate for uint64_t" -#endif - -/* - * The sizes of file objects have their own types defined here, use a minimum - * 64-bit type. - */ -#if H5_SIZEOF_LONG_LONG >= 8 -H5_GCC_DIAG_OFF("long-long") -typedef unsigned long long hsize_t; -typedef signed long long hssize_t; -H5_GCC_DIAG_ON("long-long") -#define PRIdHSIZE H5_PRINTF_LL_WIDTH "d" -#define PRIiHSIZE H5_PRINTF_LL_WIDTH "i" -#define PRIoHSIZE H5_PRINTF_LL_WIDTH "o" -#define PRIuHSIZE H5_PRINTF_LL_WIDTH "u" -#define PRIxHSIZE H5_PRINTF_LL_WIDTH "x" -#define PRIXHSIZE H5_PRINTF_LL_WIDTH "X" -#define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG -#define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG -#define HSIZE_UNDEF ULLONG_MAX -#else -#error "nothing appropriate for hsize_t" -#endif +typedef uint64_t hsize_t; +/** + * The size of file objects. Used when negative values are needed to indicate errors. + * + * \internal Defined as a (minimum) 64-bit integer type. Use of hssize_t + * should be discouraged in new code. + */ +typedef int64_t hssize_t; +#define PRIdHSIZE PRId64 +#define PRIiHSIZE PRIi64 +#define PRIoHSIZE PRIo64 +#define PRIuHSIZE PRIu64 +#define PRIxHSIZE PRIx64 +#define PRIXHSIZE PRIX64 +#define H5_SIZEOF_HSIZE_T 8 +#define H5_SIZEOF_HSSIZE_T 8 +#define HSIZE_UNDEF UINT64_MAX -/* - * File addresses have their own types. - */ -#if H5_SIZEOF_INT >= 8 -typedef unsigned haddr_t; -#define HADDR_UNDEF UINT_MAX -#define H5_SIZEOF_HADDR_T H5_SIZEOF_INT -#ifdef H5_HAVE_PARALLEL -#define HADDR_AS_MPI_TYPE MPI_UNSIGNED -#endif /* H5_HAVE_PARALLEL */ -#define PRIdHADDR "d" -#define PRIoHADDR "o" -#define PRIuHADDR "u" -#define PRIxHADDR "x" -#define PRIXHADDR "X" -#elif H5_SIZEOF_LONG >= 8 -typedef unsigned long haddr_t; -#define HADDR_UNDEF ULONG_MAX -#define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG -#ifdef H5_HAVE_PARALLEL -#define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG -#endif /* H5_HAVE_PARALLEL */ -#define PRIdHADDR "ld" -#define PRIoHADDR "lo" -#define PRIuHADDR "lu" -#define PRIxHADDR "lx" -#define PRIXHADDR "lX" -#elif H5_SIZEOF_LONG_LONG >= 8 -typedef unsigned long long haddr_t; -#define HADDR_UNDEF ULLONG_MAX -#define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG -#ifdef H5_HAVE_PARALLEL -#define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT -#endif /* H5_HAVE_PARALLEL */ -#define PRIdHADDR H5_PRINTF_LL_WIDTH "d" -#define PRIoHADDR H5_PRINTF_LL_WIDTH "o" -#define PRIuHADDR H5_PRINTF_LL_WIDTH "u" -#define PRIxHADDR H5_PRINTF_LL_WIDTH "x" -#define PRIXHADDR H5_PRINTF_LL_WIDTH "X" -#else -#error "nothing appropriate for haddr_t" -#endif +/** + * The address of an object in the file. + * + * \internal Defined as a (minimum) 64-bit unsigned integer type. + */ +typedef uint64_t haddr_t; +#define PRIdHADDR PRId64 +#define PRIoHADDR PRIo64 +#define PRIuHADDR PRIu64 +#define PRIxHADDR PRIx64 +#define PRIXHADDR PRIX64 +#define H5_SIZEOF_HADDR_T 8 +#define HADDR_UNDEF UINT64_MAX #define H5_PRINTF_HADDR_FMT "%" PRIuHADDR #define HADDR_MAX (HADDR_UNDEF - 1) -/* uint32_t type is used for creation order field for messages. It may be - * defined in Posix.1g, otherwise it is defined here. - */ -#if H5_SIZEOF_UINT32_T >= 4 -#elif H5_SIZEOF_SHORT >= 4 -typedef short uint32_t; -#undef H5_SIZEOF_UINT32_T -#define H5_SIZEOF_UINT32_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 4 -typedef unsigned int uint32_t; -#undef H5_SIZEOF_UINT32_T -#define H5_SIZEOF_UINT32_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG >= 4 -typedef unsigned long uint32_t; -#undef H5_SIZEOF_UINT32_T -#define H5_SIZEOF_UINT32_T H5_SIZEOF_LONG -#else -#error "nothing appropriate for uint32_t" +#ifdef H5_HAVE_PARALLEL +#define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT #endif //! -- cgit v0.12 From 4b7f34acc16c7d071a5c1d4519ba2a01354e51db Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 2 Jun 2021 15:29:46 -0500 Subject: Combo set of async and other changes (#161) * Update API tracing for new H5VL_request_status_t typedef * Finish converting internal event set operations to use list iterator callbacks, instead of directly accessing the list structure * Add H5VL_REQUEST_GET_ERR_STACK operation to request subclass, for retrieving a copy of the error stack for a failed asynchronous operation * Remove 'canceled' event status from Java constants * Be safer about releasing resources when inserting a newly opened/created object or file into an event set * Remove H5EStest, add H5ES_WAIT_NONE for 0 timeout, and revise parameters to H5ESwait, to make it more "aggregate". * Remove H5ES_STATUS_CANCELED from Java wrappers also * Apply patch for dynamically registering optional VOL operations * (a) Add async APIs for H5O module as listed in jira issue ID-283. (b) Remove verification of name parameter in async related routines for H55A and H5L modules because it is checked in H5VL_setup* routine. (c) Modify h5dump expected output due to the async changes. * Corrections based on PR feedback. * Further changes to make based on PR feedback. * Remove H5Dwait & H5Fwait (moved to the async connector). Added H5atclose routine. Updated 'optional op' operations. * Fix missed merge marker, and reformatted line * Update API tracing infrastructure for H5atclose callback * Clean up some warnings * Normalize against develop branch * Correct level of indirection * Add doxygen info for H5is_library_terminating and regression tests for it and H5atclose * Relocate prototype (and doxygen info) for H5Aclose * Align w/changes on develop * Move group package initialization code to H5Gint.c, and update tracing macros * Change non-static function declarations to be static * Correct GCC diagnostic macro * Ensure that H5TSpublic.h header gets installed (#129) * Finish moving API routines that invoke VOL framework to main source files. * Fix position of H5Fmount and H5Funmount * Add 'wrapper' versions of async calls, to allow language wrappers and layers on top of HDF5 to pass in their application information. * Add wrappers for dynamically registered optional operations * Fix typo * Update doxygen comment for H5atclose with additional detail. * Add H5VL\*_vararg versions of H5VL routines that use va_list parameters * Implement and test H5S_BLOCK * Switch H5Aexists\*_async and H5Lexists\*_async to use flag to return status, instead of return value. Make the corresponding changes through most of the v1 and v2 B-tree code. Clean up warnings in H5public.h and cmpd_dtransform.c. * Add H5Iregister_future routine and tests. * Correct return value for H5Lexists_async * Add H5_DLL macro to public H5ES API routines * Update supported -> flags parameter for introspect_query callback * Remove my email address. Update passthrough VOL connector ID. * Fix comment for post_open_api_common * Remove unused non-blocking VOL connector * Minor cleanup in async branch in preparation for merge to develop * Update CMake and the Autotools to use the new pass-through VOL ID * Finish another iteration on public H5ES routines, along with running the code reformatter * Another round of reformatting * Fix for SWMR daily test failures (#160) The H5I_register_using_existing_id() call did not initialize the future ID callbacks, causing the library to segfault when it tried to resolve those function pointers. * Added selective async APIs (#150) * Added selective async APIs Description: Added the following APIs: H5Ropen_attr_async H5Ropen_object_async H5Ropen_region_async H5Mcreate_async H5Mopen_async H5Mput_async H5Mget_async H5Mclose_async H5Tcommit_async H5Topen_async H5Tcopy_async H5Tclose_async - Updated an expected output file to include a new internal function in the error stack for the failure case. * Updated async APIs per reviews, including removing async version of H5Tcopy. * Removed statements that were added by mistake in the previous commit. * Fix compile issues in H5M and warnings elsewhere * Reformat code * Brings VOL_LIST changes from develop. (#163) * Remove H5Dwait and H5Fwait calls, which were incorrectly brought back in * Tiny cleanup of H5Lcreate_hard_async * Run source formatter * Allow for canceled operation in wait_cb * Attempt to fix switch on string value * Re-run source formatter * Add H5S_BLOCK testfile to CMake clean target * Add H5Pset_vol_async API routine and 'get_cap_flags' VOL introspection callback * Clean up warnings * Add H5P(set\|get)_vol_implicit_async API routines to allow \/ disallow implicit asynchronous operations (default is disallowed) * Run formatting script * Remove H5VL_REQUEST_WAIT\* * Warning cleanup * Eliminate strdup()s on statically allocated strings * Warning cleanup * Split H5VLrestore_lib_state into H5VLstart_lib_state and H5VLrestore_lib_state, and rename H5VLreset_lib_state to H5VLfinish_lib_state. * Duplicate strings when building err_info to return to applicatin * Move connector author routines into seperate header files, all included in the new hdf5dev.h header * Run bin/trace to add TRACE macros * Allow H5ES_NONE as a valid, but no-op, parameter to all H5ES API routines that accept an event set ID * Clean up formatting * Remove H5Pset/get_vol_implicit_async * Clean up warning * Remove H5Pget_vol_async and replace with more generic H5Pget_vol_cap_flags * Clean up warnings * Add H5ESfree_err_info convenience routine * Fix typo * Correct matching for cached VOL plugins * Add developer header file * Update for C99 compatibility * Add missing trace macro * Stop clang-format from messing with the trace macros. Don't set up VOL wrappers for 'infrastructure' objects like requests and blobs * Fix warning about formatting a directory * Clean up formatting for H5E_BEGIN_TRY / H5E_END_TRY * Reduce scope of H5ES__close * Enable CMake checks for various types on MacOS * Clean up properly when H5CX_retrieve_state() fails. Also clean up many compiler warnings. * Committing clang-format changes * Merge from develop * Fix mis-placed assert * Remove commented-out code * Re-add macro for unsetenv on Windows (I think it accidentally was merged out) * Strengthen sanity check from error report to assertion * Committing clang-format changes * Add units to the comments for a few fields * Switch 'get execution time' operation for async request tokens to be an optional operation and query if connector supports operation before retrieving it. * Committing clang-format changes * Remove H5ESget_time_estimate * Committing clang-format changes * Create developer header for datatype routines and move type conversion register/unregister routines there. * Simplify internal H5VL_setup_name_args and H5VL_setup_idx_args routines * Add H5VLlink_optional_op, allowing dynamicly registered optional operations for the link VOL subclass, also added H5VL_loc_params argument to the link 'optional' callback to allow them to work correctly. * Run bin/format_source on current code * Add H5VLobject_optional_op, allowing dynamicly registered optional operations for the object VOL subclass, also added H5VL_loc_params argument to the object 'optional' callback to allow them to work correctly. * Run bin/format_source on current code * Committing clang-format changes * Revert "Switch 'get execution time' operation for async request tokens to be an optional operation and query if connector supports operation before retrieving it." This reverts commit 5ac92014da2682bdba62d7a2524b8d90e38f6b19. * Committing clang-format changes * Convert attribute 'get' operation to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Update tracing macros * Convert attribute 'specific' operation to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Convert dataset 'get' and 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also, minor tweaks to attribute 'get' and 'specific' operation parameters. * Convert datatype 'get' and 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also, minor tweaks to H5O_refresh_metadata arguments. * Reduce warnings * Reduce warnings * Track change to datatype 'get' callback * Fix bug with file pointer getting invalidated when object closed * Reformat source * Convert file and group VOL classes 'get' and 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also small cleanup to the attribute get name operation. Also moved 'mount' and 'unmount' operations to be group specific operations, instead of file specific, to better align with their behavior (mounted files are on groups, so a group is what is operated on). * Remove remainder of merge conflict marking * Convert link VOL class 'create' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Remove some unused local variables * Convert link VOL class 'get' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also refactor 'get name by idx' routines to return actual length of name with a parameter instead of the return value, and move some callback context structs for the link interface from the private header file into the source code module, to reduce their visibility scope. * Update tracing macros * Convert link VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Convert object VOL class 'get' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Convert object VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also refactor H5G_loc_exists, et al, to return 'exists' flag in a parameter and errors with the function return value, instead of overloading both into the return value. And, corrected logic error in test/links.c around non-existant objects in a file. * Convert request VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Convert blob VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also removes the H5VL_BLOB_GETSIZE operation, as it's unused in the library and the blob ID size for a container is now returned with H5VL_FILE_GET_CONT_INFO. * Add 'const' to several parameters that are only queried. * Convert all VOL classes' 'optional' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Convert several 'get' routines to return the length of an array in a parameter instead of combining it into the return value. Move several routines to be in less public namespace. Correct direct_chunk test to verify that parameters aren't modified on error. * Switch get/specific/optional VOL callback argument structures to be 'async-friendly'. Also other minor cleanups and bug-fixes. * Add H5Pset_dataset_io_hyperslab_selection / H5S_PLIST feature, to allow skipping H5Dget_space + H5Sselect_hyperslab for async operation * Add dynamic optional operations for request objects * Update dynamic operation test for optional request operations * Update a comment for an operation argument * Run trace and format_source scripts * Committing clang-format changes * Committing clang-format changes Co-authored-by: vchoi Co-authored-by: vchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com> Co-authored-by: jhendersonHDF Co-authored-by: Dana Robinson Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 11 +- bin/trace | 4 +- c++/src/H5DataType.h | 3 + config/cmake_ext_mod/ConfigureChecks.cmake | 16 +- examples/h5_elink_unix2win.c | 1 + examples/h5_extlink.c | 1 + fortran/src/H5Tf.c | 3 + fortran/src/H5Zf.c | 1 + fortran/src/H5_f.c | 1 + java/src/jni/h5Constants.c | 1 + java/src/jni/h5lImp.c | 1 + java/src/jni/h5zImp.c | 1 + src/CMakeLists.txt | 11 +- src/H5A.c | 355 +++--- src/H5AC.c | 25 +- src/H5ACprivate.h | 10 +- src/H5Adeprec.c | 35 +- src/H5Aint.c | 40 +- src/H5Apkg.h | 16 +- src/H5CS.c | 14 +- src/H5CX.c | 435 +++---- src/H5Cmpio.c | 2 + src/H5Cprivate.h | 8 +- src/H5Cquery.c | 10 +- src/H5D.c | 391 ++++--- src/H5Dchunk.c | 107 +- src/H5Ddeprec.c | 31 +- src/H5Dint.c | 27 +- src/H5Dio.c | 77 +- src/H5Dpkg.h | 4 +- src/H5Dprivate.h | 11 +- src/H5Dpublic.h | 5 +- src/H5Dvirtual.c | 2 +- src/H5E.c | 33 +- src/H5ES.c | 407 +++++-- src/H5ESdevelop.h | 50 + src/H5ESevent.c | 16 +- src/H5ESint.c | 434 ++++++- src/H5ESpkg.h | 18 +- src/H5ESprivate.h | 5 +- src/H5ESpublic.h | 70 +- src/H5Eint.c | 20 +- src/H5F.c | 756 +++++++++---- src/H5FDdevelop.h | 262 +++++ src/H5FDlog.c | 2 - src/H5FDmulti.c | 1 + src/H5FDprivate.h | 3 +- src/H5FDpublic.h | 238 +--- src/H5FDstdio.c | 1 + src/H5FL.c | 56 +- src/H5Faccum.c | 2 +- src/H5Fdeprec.c | 53 +- src/H5Fint.c | 72 +- src/H5Fmount.c | 25 +- src/H5Fmpi.c | 45 +- src/H5Fpkg.h | 32 +- src/H5Fprivate.h | 8 +- src/H5Fpublic.h | 3 +- src/H5G.c | 83 +- src/H5Gcompact.c | 18 +- src/H5Gdense.c | 39 +- src/H5Gdeprec.c | 291 +++-- src/H5Gloc.c | 62 +- src/H5Gname.c | 55 +- src/H5Gobj.c | 21 +- src/H5Gpkg.h | 79 +- src/H5Gprivate.h | 73 +- src/H5Gstab.c | 26 +- src/H5Gtest.c | 6 +- src/H5I.c | 20 +- src/H5Idevelop.h | 139 +++ src/H5Iprivate.h | 3 +- src/H5Ipublic.h | 90 -- src/H5Itest.c | 10 +- src/H5L.c | 425 ++++--- src/H5Ldeprec.c | 146 ++- src/H5Ldevelop.h | 314 ++++++ src/H5Lexternal.c | 14 +- src/H5Lint.c | 69 +- src/H5Lpkg.h | 43 +- src/H5Lprivate.h | 47 +- src/H5Lpublic.h | 257 ----- src/H5M.c | 346 ++++-- src/H5MF.c | 22 +- src/H5MFprivate.h | 3 +- src/H5Mprivate.h | 7 +- src/H5Mpublic.h | 110 ++ src/H5O.c | 450 +++++--- src/H5Odeprec.c | 155 ++- src/H5Oflush.c | 31 +- src/H5Opkg.h | 5 + src/H5Oprivate.h | 7 +- src/H5PLextern.h | 4 +- src/H5PLint.c | 2 + src/H5PLplugin_cache.c | 80 +- src/H5Pdxpl.c | 278 ++++- src/H5Pfapl.c | 58 + src/H5Pint.c | 3 +- src/H5Ppublic.h | 87 +- src/H5R.c | 199 ++-- src/H5RS.c | 6 +- src/H5RSprivate.h | 2 +- src/H5Rdeprec.c | 133 ++- src/H5Rint.c | 13 +- src/H5S.c | 51 +- src/H5Sprivate.h | 1 - src/H5Spublic.h | 8 +- src/H5T.c | 11 +- src/H5TSdevelop.h | 50 + src/H5TSprivate.h | 4 +- src/H5TSpublic.h | 52 - src/H5Tcommit.c | 119 +- src/H5Tdevelop.h | 227 ++++ src/H5Tprivate.h | 5 +- src/H5Tpublic.h | 179 +-- src/H5Tref.c | 125 ++- src/H5Tvlen.c | 50 +- src/H5VL.c | 180 ++- src/H5VLcallback.c | 1687 +++++++++++++++------------- src/H5VLconnector.h | 883 ++++++++++++--- src/H5VLconnector_passthru.h | 101 +- src/H5VLdyn_ops.c | 334 ++++++ src/H5VLint.c | 270 ++++- src/H5VLnative.c | 45 +- src/H5VLnative.h | 403 ++++++- src/H5VLnative_attr.c | 244 ++-- src/H5VLnative_blob.c | 34 +- src/H5VLnative_dataset.c | 425 ++++--- src/H5VLnative_datatype.c | 77 +- src/H5VLnative_file.c | 387 +++---- src/H5VLnative_group.c | 160 ++- src/H5VLnative_introspect.c | 38 +- src/H5VLnative_link.c | 166 +-- src/H5VLnative_object.c | 207 ++-- src/H5VLnative_private.h | 72 +- src/H5VLnative_token.c | 4 + src/H5VLpassthru.c | 684 ++++------- src/H5VLpkg.h | 12 + src/H5VLprivate.h | 116 +- src/H5VLpublic.h | 8 +- src/H5VLtest.c | 96 ++ src/H5Zdevelop.h | 421 +++++++ src/H5Zprivate.h | 3 +- src/H5Zpublic.h | 373 +----- src/H5err.txt | 4 +- src/H5private.h | 3 + src/H5system.c | 9 +- src/H5trace.c | 88 +- src/H5win32defs.h | 1 + src/Makefile.am | 11 +- src/hdf5.h | 1 - src/hdf5dev.h | 38 + test/CMakeTests.cmake | 2 + test/Makefile.am | 2 +- test/chunk_info.c | 6 +- test/direct_chunk.c | 94 +- test/dsets.c | 369 ++++++ test/event_set.c | 66 ++ test/filter_plugin1_dsets.c | 2 +- test/filter_plugin2_dsets.c | 2 +- test/filter_plugin3_dsets.c | 2 +- test/filter_plugin4_groups.c | 2 +- test/h5test.h | 3 +- test/links.c | 8 +- test/null_vol_connector.c | 2 +- test/tfile.c | 1 + test/trefstr.c | 2 +- test/vol.c | 926 ++++++++++++++- testpar/t_filters_parallel.c | 8 +- tools/lib/h5tools.c | 1 + tools/test/h5copy/dynlib_copy.c | 2 +- tools/test/h5diff/dynlib_diff.c | 2 +- tools/test/h5diff/h5diffgentest.c | 1 + tools/test/h5dump/dynlib_dump.c | 2 +- tools/test/h5jam/h5jamgentest.c | 1 + tools/test/h5ls/dynlib_ls.c | 2 +- tools/test/h5repack/dynlib_rpk.c | 2 +- tools/test/h5repack/dynlib_vrpk.c | 2 +- tools/test/perform/chunk.c | 2 +- utils/mirror_vfd/mirror_remote.h | 1 + 180 files changed, 12450 insertions(+), 6135 deletions(-) create mode 100644 src/H5ESdevelop.h create mode 100644 src/H5FDdevelop.h create mode 100644 src/H5Idevelop.h create mode 100644 src/H5Ldevelop.h create mode 100644 src/H5TSdevelop.h delete mode 100644 src/H5TSpublic.h create mode 100644 src/H5Tdevelop.h create mode 100644 src/H5VLdyn_ops.c create mode 100644 src/H5VLtest.c create mode 100644 src/H5Zdevelop.h create mode 100644 src/hdf5dev.h diff --git a/MANIFEST b/MANIFEST index 46771bb..e114586 100644 --- a/MANIFEST +++ b/MANIFEST @@ -733,6 +733,7 @@ ./src/H5EAstat.c ./src/H5EAtest.c ./src/H5ES.c +./src/H5ESdevelop.h ./src/H5ESevent.c ./src/H5ESint.c ./src/H5ESlist.c @@ -776,6 +777,7 @@ ./src/H5FD.c ./src/H5FDcore.c ./src/H5FDcore.h +./src/H5FDdevelop.h ./src/H5FDdirect.c ./src/H5FDdirect.h ./src/H5FDdrvr_module.h @@ -889,6 +891,7 @@ ./src/H5HPprivate.h ./src/H5I.c ./src/H5Idbg.c +./src/H5Idevelop.h ./src/H5Iint.c ./src/H5Imodule.h ./src/H5Ipkg.h @@ -897,6 +900,7 @@ ./src/H5Itest.c ./src/H5L.c ./src/H5Ldeprec.c +./src/H5Ldevelop.h ./src/H5Lexternal.c ./src/H5Lint.c ./src/H5Lmodule.h @@ -1047,6 +1051,7 @@ ./src/H5Tcset.c ./src/H5Tdbg.c ./src/H5Tdeprec.c +./src/H5Tdevelop.h ./src/H5Tenum.c ./src/H5Tfields.c ./src/H5Tfixed.c @@ -1067,14 +1072,15 @@ ./src/H5Tvisit.c ./src/H5Tvlen.c ./src/H5TS.c +./src/H5TSdevelop.h ./src/H5TSprivate.h -./src/H5TSpublic.h ./src/H5UC.c ./src/H5UCprivate.h ./src/H5VL.c ./src/H5VLcallback.c ./src/H5VLconnector.h ./src/H5VLconnector_passthru.h +./src/H5VLdyn_ops.c ./src/H5VLint.c ./src/H5VLmodule.h ./src/H5VLnative.c @@ -1095,12 +1101,14 @@ ./src/H5VLpkg.h ./src/H5VLprivate.h ./src/H5VLpublic.h +./src/H5VLtest.c ./src/H5VM.c ./src/H5VMprivate.h ./src/H5WB.c ./src/H5WBprivate.h ./src/H5Z.c ./src/H5Zdeflate.c +./src/H5Zdevelop.h ./src/H5Zfletcher32.c ./src/H5Zmodule.h ./src/H5Znbit.c @@ -1113,6 +1121,7 @@ ./src/H5Ztrans.c ./src/Makefile.am ./src/hdf5.h +./src/hdf5dev.h ./src/libhdf5.settings.in ./src/H5win32defs.h ./src/uthash.h diff --git a/bin/trace b/bin/trace index 0eef8ce..1623438 100755 --- a/bin/trace +++ b/bin/trace @@ -57,8 +57,10 @@ $Source = ""; "herr_t" => "e", "H5E_auto1_t" => "Ea", "H5E_auto2_t" => "EA", + "H5ES_event_complete_func_t" => "EC", "H5E_direction_t" => "Ed", "H5E_error_t" => "Ee", + "H5ES_event_insert_func_t" => "EI", "H5ES_status_t" => "Es", "H5E_type_t" => "Et", "H5FD_class_t" => "FC", @@ -159,7 +161,7 @@ $Source = ""; "H5VL_file_specific_t" => "Vh", "H5VL_group_get_t" => "Vi", "H5VL_group_specific_t" => "Vj", - "H5VL_link_create_type_t" => "Vk", + "H5VL_link_create_t" => "Vk", "H5VL_link_get_t" => "Vl", "H5VL_get_conn_lvl_t" => "VL", "H5VL_link_specific_t" => "Vm", diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 7dd371b..d696455 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -15,6 +15,9 @@ #ifndef H5DataType_H #define H5DataType_H +/* Include package's developer header */ +#include "H5Tdevelop.h" + namespace H5 { /*! \class DataType diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 708fb3e..0c310e2 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -376,15 +376,13 @@ HDF_CHECK_TYPE_SIZE (uint_least64_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST64_T) HDF_CHECK_TYPE_SIZE (int_fast64_t ${HDF_PREFIX}_SIZEOF_INT_FAST64_T) HDF_CHECK_TYPE_SIZE (uint_fast64_t ${HDF_PREFIX}_SIZEOF_UINT_FAST64_T) -if (NOT APPLE) - HDF_CHECK_TYPE_SIZE (size_t ${HDF_PREFIX}_SIZEOF_SIZE_T) - HDF_CHECK_TYPE_SIZE (ssize_t ${HDF_PREFIX}_SIZEOF_SSIZE_T) - if (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) - set (${HDF_PREFIX}_SIZEOF_SSIZE_T 0) - endif () - if (MINGW OR NOT WINDOWS) - HDF_CHECK_TYPE_SIZE (ptrdiff_t ${HDF_PREFIX}_SIZEOF_PTRDIFF_T) - endif () +HDF_CHECK_TYPE_SIZE (size_t ${HDF_PREFIX}_SIZEOF_SIZE_T) +HDF_CHECK_TYPE_SIZE (ssize_t ${HDF_PREFIX}_SIZEOF_SSIZE_T) +if (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) + set (${HDF_PREFIX}_SIZEOF_SSIZE_T 0) +endif () +if (MINGW OR NOT WINDOWS) + HDF_CHECK_TYPE_SIZE (ptrdiff_t ${HDF_PREFIX}_SIZEOF_PTRDIFF_T) endif () HDF_CHECK_TYPE_SIZE (off_t ${HDF_PREFIX}_SIZEOF_OFF_T) diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c index 6eca266..60c75dc 100644 --- a/examples/h5_elink_unix2win.c +++ b/examples/h5_elink_unix2win.c @@ -24,6 +24,7 @@ */ #include "hdf5.h" +#include "hdf5dev.h" #include #include diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index f9d4046..44e55a9 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -19,6 +19,7 @@ */ #include "hdf5.h" +#include "hdf5dev.h" #include #define SOURCE_FILE "extlink_source.h5" diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index 1516cc7..3da4a29 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -21,6 +21,9 @@ #include "H5f90.h" +/* Include package's developer header */ +#include "H5Tdevelop.h" + /****if* H5Tf/h5topen_c * NAME * h5topen_c diff --git a/fortran/src/H5Zf.c b/fortran/src/H5Zf.c index b31878c..33d9fb3 100644 --- a/fortran/src/H5Zf.c +++ b/fortran/src/H5Zf.c @@ -20,6 +20,7 @@ */ #include "H5f90.h" +#include "hdf5dev.h" /****if* H5Zf/h5zunregister_c * NAME diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index d245cae..52fc276 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -21,6 +21,7 @@ #include "H5f90.h" #include "H5fort_type_defines.h" +#include "hdf5dev.h" int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 7354e95..a0deea3 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -22,6 +22,7 @@ extern "C" { #endif /* __cplusplus */ #include "hdf5.h" +#include "hdf5dev.h" #include #include #include "h5jni.h" diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 43db4e9..1407fef 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -23,6 +23,7 @@ extern "C" { #include #include #include "hdf5.h" +#include "hdf5dev.h" #include "h5jni.h" #include "h5lImp.h" diff --git a/java/src/jni/h5zImp.c b/java/src/jni/h5zImp.c index d750ee8..d8c93be 100644 --- a/java/src/jni/h5zImp.c +++ b/java/src/jni/h5zImp.c @@ -22,6 +22,7 @@ extern "C" { #endif /* __cplusplus */ #include "hdf5.h" +#include "hdf5dev.h" #include #include #include "h5jni.h" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 555fb98..9eeac7b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,7 @@ set (H5_SOURCES set (H5_HDRS ${HDF5_SRC_DIR}/hdf5.h + ${HDF5_SRC_DIR}/hdf5dev.h ${HDF5_SRC_DIR}/H5api_adpt.h ${HDF5_SRC_DIR}/H5public.h #${HDF5_SRC_DIR}/H5version.h @@ -180,6 +181,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}" ) @@ -251,6 +253,7 @@ set (H5FD_SOURCES set (H5FD_HDRS ${HDF5_SRC_DIR}/H5FDcore.h + ${HDF5_SRC_DIR}/H5FDdevelop.h ${HDF5_SRC_DIR}/H5FDdirect.h ${HDF5_SRC_DIR}/H5FDfamily.h ${HDF5_SRC_DIR}/H5FDhdfs.h @@ -389,6 +392,7 @@ set (H5I_SOURCES ${HDF5_SRC_DIR}/H5Itest.c ) set (H5I_HDRS + ${HDF5_SRC_DIR}/H5Idevelop.h ${HDF5_SRC_DIR}/H5Ipublic.h ) IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" ) @@ -401,6 +405,7 @@ set (H5L_SOURCES ${HDF5_SRC_DIR}/H5Lint.c ) set (H5L_HDRS + ${HDF5_SRC_DIR}/H5Ldevelop.h ${HDF5_SRC_DIR}/H5Lpublic.h ) IDE_GENERATED_PROPERTIES ("H5L" "${H5L_HDRS}" "${H5L_SOURCES}" ) @@ -629,6 +634,7 @@ set (H5T_SOURCES ) set (H5T_HDRS + ${HDF5_SRC_DIR}/H5Tdevelop.h ${HDF5_SRC_DIR}/H5Tpublic.h ) IDE_GENERATED_PROPERTIES ("H5T" "${H5T_HDRS}" "${H5T_SOURCES}" ) @@ -638,7 +644,7 @@ set (H5TS_SOURCES ${HDF5_SRC_DIR}/H5TS.c ) set (H5TS_HDRS - ${HDF5_SRC_DIR}/H5TSpublic.h + ${HDF5_SRC_DIR}/H5TSdevelop.h ) IDE_GENERATED_PROPERTIES ("H5TS" "${H5TS_HDRS}" "${H5TS_SOURCES}" ) @@ -654,6 +660,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 @@ -667,6 +674,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 @@ -710,6 +718,7 @@ endif () set (H5Z_HDRS + ${HDF5_SRC_DIR}/H5Zdevelop.h ${HDF5_SRC_DIR}/H5Zpublic.h ) IDE_GENERATED_PROPERTIES ("H5Z" "${H5Z_HDRS}" "${H5Z_SOURCES}" ) diff --git a/src/H5A.c b/src/H5A.c index aaf3383..5d8737f 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/H5AC.c b/src/H5AC.c index 2eadd21..1c75aff 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -43,7 +43,6 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ -#include "H5FDprivate.h" /* File drivers */ #include "H5Iprivate.h" /* IDs */ #include "H5Pprivate.h" /* Property lists */ #include "H5SLprivate.h" /* Skip Lists */ @@ -61,8 +60,8 @@ /********************/ static herr_t H5AC__check_if_write_permitted(const H5F_t *f, hbool_t *write_permitted_ptr); -static herr_t H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr, - H5C_auto_size_ctl_t *int_conf_ptr); +static herr_t H5AC__ext_config_2_int_config(const H5AC_cache_config_t *ext_conf_ptr, + H5C_auto_size_ctl_t * int_conf_ptr); #if H5AC_DO_TAGGING_SANITY_CHECKS static herr_t H5AC__verify_tag(const H5AC_class_t *type); #endif /* H5AC_DO_TAGGING_SANITY_CHECKS */ @@ -1797,14 +1796,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, - uint32_t *cur_num_entries_ptr) +H5AC_get_cache_size(const H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, + size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if (H5C_get_cache_size((H5C_t *)cache_ptr, max_size_ptr, min_clean_size_ptr, cur_size_ptr, + if (H5C_get_cache_size((const H5C_t *)cache_ptr, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_size() failed") @@ -1851,13 +1850,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr) +H5AC_get_cache_hit_rate(const H5AC_t *cache_ptr, double *hit_rate_ptr) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if (H5C_get_cache_hit_rate((H5C_t *)cache_ptr, hit_rate_ptr) < 0) + if (H5C_get_cache_hit_rate((const H5C_t *)cache_ptr, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_hit_rate() failed") done: @@ -1903,7 +1902,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr) +H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t *config_ptr) { H5C_auto_size_ctl_t internal_config; herr_t ret_value = SUCCEED; /* Return value */ @@ -2004,7 +2003,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_validate_config(H5AC_cache_config_t *config_ptr) +H5AC_validate_config(const H5AC_cache_config_t *config_ptr) { H5C_auto_size_ctl_t internal_config; herr_t ret_value = SUCCEED; /* Return value */ @@ -2185,7 +2184,7 @@ H5AC__check_if_write_permitted(const H5F_t *------------------------------------------------------------------------- */ static herr_t -H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr, H5C_auto_size_ctl_t *int_conf_ptr) +H5AC__ext_config_2_int_config(const H5AC_cache_config_t *ext_conf_ptr, H5C_auto_size_ctl_t *int_conf_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2746,13 +2745,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len) +H5AC_get_mdc_image_info(const H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if (H5C_get_mdc_image_info((H5C_t *)cache_ptr, image_addr, image_len) < 0) + if (H5C_get_mdc_image_info((const H5C_t *)cache_ptr, image_addr, image_len) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 283989d..b14194b 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -404,20 +404,20 @@ H5_DLL herr_t H5AC_evict(H5F_t *f); H5_DLL herr_t H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, unsigned flags); H5_DLL herr_t H5AC_remove_entry(void *entry); H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr); -H5_DLL herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, +H5_DLL herr_t H5AC_get_cache_size(const H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr); H5_DLL herr_t H5AC_get_cache_flush_in_progress(H5AC_t *cache_ptr, hbool_t *flush_in_progress_ptr); -H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr); +H5_DLL herr_t H5AC_get_cache_hit_rate(const H5AC_t *cache_ptr, double *hit_rate_ptr); H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr); -H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr); -H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr); +H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t *config_ptr); +H5_DLL herr_t H5AC_validate_config(const H5AC_cache_config_t *config_ptr); /* Cache image routines */ H5_DLL herr_t H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_t rw); H5_DLL herr_t H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr); H5_DLL hbool_t H5AC_cache_image_pending(const H5F_t *f); H5_DLL herr_t H5AC_force_cache_image_load(H5F_t *f); -H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len); +H5_DLL herr_t H5AC_get_mdc_image_info(const H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len); /* Tag & Ring routines */ H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag); 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/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/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..ca30bdd 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,12 +1768,12 @@ 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 */ 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) @@ -1765,15 +1796,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,12 +1830,12 @@ 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 */ 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) @@ -1826,12 +1857,12 @@ 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 */ 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) @@ -1853,14 +1884,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 +1920,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 +1955,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 +1990,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 +2025,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 +2060,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 +2097,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 +2132,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 +2167,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 +2203,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 +2239,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 +2275,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 +2311,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 +2348,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 +2383,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 +2418,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 +2476,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 +2541,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 +2576,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 +2611,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 +2647,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 +2682,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 +2721,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 +2757,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 +2815,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 +2873,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 +2901,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 +2931,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 +2961,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 +2994,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 +3028,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 +3062,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 +3091,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 +3120,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 +3157,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 +3193,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 +3224,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 +3255,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 +3289,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 +3327,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 +3360,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 +3393,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 +3427,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 +3461,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 +3495,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 +3528,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 +3561,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 +3596,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 +3606,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/H5Cmpio.c b/src/H5Cmpio.c index 66c6601..d6da9b7 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -919,7 +919,9 @@ H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) entry_ptr = prev_ptr; } /* end while */ +#ifdef H5C_DO_SANITY_CHECKS done: +#endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) } /* H5C_clear_coll_entries */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 27a24c4..78d6f35 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -2242,10 +2242,10 @@ herr_t H5C_verify_tag(int id, haddr_t tag); H5_DLL herr_t H5C_flush_to_min_clean(H5F_t *f); H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); H5_DLL herr_t H5C_get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr); -H5_DLL herr_t H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, +H5_DLL herr_t H5C_get_cache_size(const H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr); -H5_DLL herr_t H5C_get_cache_flush_in_progress(H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr); -H5_DLL herr_t H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr); +H5_DLL herr_t H5C_get_cache_flush_in_progress(const H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr); +H5_DLL herr_t H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr); H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_ptr, hbool_t *in_cache_ptr, hbool_t *is_dirty_ptr, hbool_t *is_protected_ptr, hbool_t *is_pinned_ptr, hbool_t *is_corked_ptr, hbool_t *is_flush_dep_parent_ptr, @@ -2290,7 +2290,7 @@ H5_DLL herr_t H5C_unsettle_ring(H5F_t *f, H5C_ring_t ring); H5_DLL herr_t H5C_remove_entry(void *thing); H5_DLL herr_t H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr); H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr); -H5_DLL herr_t H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len); +H5_DLL herr_t H5C_get_mdc_image_info(const H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len); /* Logging functions */ H5_DLL herr_t H5C_start_logging(H5C_t *cache); diff --git a/src/H5Cquery.c b/src/H5Cquery.c index d8e2a72..6cf8ffc 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -114,8 +114,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, - uint32_t *cur_num_entries_ptr) +H5C_get_cache_size(const H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, + size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -151,7 +151,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_get_cache_flush_in_progress(H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr) +H5C_get_cache_flush_in_progress(const H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -184,7 +184,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr) +H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -405,7 +405,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len) +H5C_get_mdc_image_info(const H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5D.c b/src/H5D.c index aa09f5f..7d0e934 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -557,8 +557,9 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_ { H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */ H5VL_object_t **vol_obj_ptr = - (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */ + H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -566,11 +567,17 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_GET_SPACE; + vol_cb_args.args.get_space.space_id = H5I_INVALID_HID; + /* Get the dataspace */ - if (H5VL_dataset_get(*vol_obj_ptr, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, token_ptr, - &ret_value) < 0) + if (H5VL_dataset_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") + /* Set return value */ + ret_value = vol_cb_args.args.get_space.space_id; + done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D__get_space_api_common() */ @@ -591,7 +598,7 @@ done: hid_t H5Dget_space(hid_t dset_id) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); @@ -664,8 +671,9 @@ done: herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/) { - H5VL_object_t *vol_obj = NULL; /* Dataset structure */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Object for loc_id */ + H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", dset_id, allocation); @@ -674,9 +682,12 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/) if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_GET_SPACE_STATUS; + vol_cb_args.args.get_space_status.status = allocation; + /* Get dataspace status */ - if ((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, allocation)) < 0) + if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") done: @@ -699,8 +710,9 @@ done: hid_t H5Dget_type(hid_t dset_id) { - H5VL_object_t *vol_obj; /* Dataset structure */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5VL_object_t * vol_obj; /* Object for loc_id */ + H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); @@ -709,11 +721,17 @@ H5Dget_type(hid_t dset_id) if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_GET_TYPE; + vol_cb_args.args.get_type.type_id = H5I_INVALID_HID; + /* Get the datatype */ - if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - &ret_value) < 0) + if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") + /* Set return value */ + ret_value = vol_cb_args.args.get_type.type_id; + done: FUNC_LEAVE_API(ret_value) } /* end H5Dget_type() */ @@ -737,8 +755,9 @@ done: hid_t H5Dget_create_plist(hid_t dset_id) { - H5VL_object_t *vol_obj; /* Dataset structure */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5VL_object_t * vol_obj; /* Object for loc_id */ + H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); @@ -747,11 +766,17 @@ H5Dget_create_plist(hid_t dset_id) if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_GET_DCPL; + vol_cb_args.args.get_dcpl.dcpl_id = H5I_INVALID_HID; + /* Get the dataset creation property list */ - if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - &ret_value) < 0) + if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") + /* Set return value */ + ret_value = vol_cb_args.args.get_dcpl.dcpl_id; + done: FUNC_LEAVE_API(ret_value) } /* end H5Dget_create_plist() */ @@ -792,8 +817,9 @@ done: hid_t H5Dget_access_plist(hid_t dset_id) { - H5VL_object_t *vol_obj; /* Dataset structure */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5VL_object_t * vol_obj; /* Object for loc_id */ + H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); @@ -802,11 +828,17 @@ H5Dget_access_plist(hid_t dset_id) if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_GET_DAPL; + vol_cb_args.args.get_dapl.dapl_id = H5I_INVALID_HID; + /* Get the dataset access property list */ - if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - &ret_value) < 0) + if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") + /* Set return value */ + ret_value = vol_cb_args.args.get_dapl.dapl_id; + done: FUNC_LEAVE_API(ret_value) } /* end H5Dget_access_plist() */ @@ -829,8 +861,10 @@ done: hsize_t H5Dget_storage_size(hid_t dset_id) { - H5VL_object_t *vol_obj; /* Dataset for this operation */ - hsize_t ret_value = 0; /* Return value */ + H5VL_object_t * vol_obj; /* Object for loc_id */ + H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */ + hsize_t storage_size = 0; /* Storage size of dataset */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_API(0) H5TRACE1("h", "i", dset_id); @@ -839,11 +873,17 @@ H5Dget_storage_size(hid_t dset_id) if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_GET_STORAGE_SIZE; + vol_cb_args.args.get_storage_size.storage_size = &storage_size; + /* Get the storage size */ - if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - &ret_value) < 0) + if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") + /* Set return value */ + ret_value = storage_size; + done: FUNC_LEAVE_API(ret_value) } /* end H5Dget_storage_size() */ @@ -862,8 +902,11 @@ done: haddr_t H5Dget_offset(hid_t dset_id) { - H5VL_object_t *vol_obj; /* Dataset for this operation */ - haddr_t ret_value = HADDR_UNDEF; /* Return value */ + H5VL_object_t * vol_obj; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + haddr_t dset_offset = HADDR_UNDEF; /* Dataset's offset */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_API(HADDR_UNDEF) H5TRACE1("a", "i", dset_id); @@ -872,11 +915,18 @@ H5Dget_offset(hid_t dset_id) if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") + /* Set up VOL callback arguments */ + dset_opt_args.get_offset.offset = &dset_offset; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_OFFSET; + vol_cb_args.args = &dset_opt_args; + /* Get the offset */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, &ret_value) < 0) + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") + /* Set return value */ + ret_value = dset_offset; + done: FUNC_LEAVE_API(ret_value) } /* end H5Dget_offset() */ @@ -941,7 +991,11 @@ done: * * The MEM_SPACE_ID can be the constant H5S_ALL in which case * the memory dataspace is the same as the file dataspace - * defined when the dataset was created. + * defined when the dataset was created. The MEM_SPACE_ID can + * also be the constant H5S_BLOCK, which indicates that the + * buffer provided is a single contiguous block of memory, with + * the same # of elements as specified in the FILE_SPACE_ID + * selection. * * The number of elements in the memory dataspace must match * the number of elements in the file dataspace. @@ -1032,13 +1086,15 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf) +H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf /*out*/) { - H5VL_object_t *vol_obj = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); + H5TRACE5("e", "ii*h*Iux", dset_id, dxpl_id, offset, filters, buf); /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) @@ -1056,11 +1112,20 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID") + /* Set up VOL callback arguments */ + dset_opt_args.chunk_read.offset = offset; + dset_opt_args.chunk_read.filters = 0; + dset_opt_args.chunk_read.buf = buf; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_READ; + vol_cb_args.args = &dset_opt_args; + /* Read the raw chunk */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset, - filters, buf) < 0) + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") + /* Set return value */ + *filters = dset_opt_args.chunk_read.filters; + done: FUNC_LEAVE_API(ret_value) } /* end H5Dread_chunk() */ @@ -1126,7 +1191,11 @@ done: * * The MEM_SPACE_ID can be the constant H5S_ALL in which case * the memory dataspace is the same as the file dataspace - * defined when the dataset was created. + * defined when the dataset was created. The MEM_SPACE_ID can + * also be the constant H5S_BLOCK, which indicates that the + * buffer provided is a single contiguous block of memory, with + * the same # of elements as specified in the FILE_SPACE_ID + * selection. * * The number of elements in the memory dataspace must match * the number of elements in the file dataspace. @@ -1222,9 +1291,11 @@ herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size, const void *buf) { - H5VL_object_t *vol_obj = NULL; - uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); @@ -1250,9 +1321,16 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID") + /* Set up VOL callback arguments */ + dset_opt_args.chunk_write.offset = offset; + dset_opt_args.chunk_write.filters = filters; + dset_opt_args.chunk_write.size = data_size_32; + dset_opt_args.chunk_write.buf = buf; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_WRITE; + vol_cb_args.args = &dset_opt_args; + /* Write chunk */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, filters, - offset, data_size_32, buf) < 0) + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: @@ -1348,7 +1426,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_ done: /* Release selection iterator */ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator") if (iter) iter = H5FL_FREE(H5S_sel_iter_t, iter); @@ -1447,7 +1525,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf done: /* Release selection iterator */ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator") if (iter) iter = H5FL_FREE(H5S_sel_iter_t, iter); @@ -1642,9 +1720,18 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s &supported) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for 'get vlen buf size' operation") if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + + /* Set up VOL callback arguments */ + dset_opt_args.get_vlen_buf_size.type_id = type_id; + dset_opt_args.get_vlen_buf_size.space_id = space_id; + dset_opt_args.get_vlen_buf_size.size = size; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE; + vol_cb_args.args = &dset_opt_args; + /* Make the 'get_vlen_buf_size' callback */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, type_id, space_id, size) < 0) + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size") } /* end if */ else { @@ -1673,7 +1760,8 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */ H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1687,9 +1775,12 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr if (H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_SET_EXTENT; + vol_cb_args.args.set_extent.size = size; + /* Set the extent */ - if ((ret_value = H5VL_dataset_specific(*vol_obj_ptr, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, - token_ptr, size)) < 0) + if (H5VL_dataset_specific(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") done: @@ -1775,8 +1866,9 @@ done: herr_t H5Dflush(hid_t dset_id) { - H5VL_object_t *vol_obj; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Object for loc_id */ + H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); @@ -1789,12 +1881,15 @@ H5Dflush(hid_t dset_id) if (H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_FLUSH; + vol_cb_args.args.flush.dset_id = dset_id; + /* Flush dataset information cached in memory * XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t * callback needs it and that's in the public API. */ - if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, dset_id)) < 0) + if (H5VL_dataset_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") done: @@ -1802,41 +1897,6 @@ done: } /* H5Dflush */ /*------------------------------------------------------------------------- - * Function: H5Dwait - * - * Purpose: Wait for all operations on a dataset. - * Tang: added for async - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5Dwait(hid_t dset_id) -{ - H5VL_object_t *vol_obj; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", dset_id); - - /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") - - /* Set up collective metadata if appropriate */ - if (H5CX_set_loc(dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - - if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_WAIT, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, dset_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "unable to wait dataset") - -done: - FUNC_LEAVE_API(ret_value) -} /* H5Dwait*/ - -/*------------------------------------------------------------------------- * Function: H5Drefresh * * Purpose: Refreshes all buffers associated with a dataset. @@ -1848,8 +1908,9 @@ done: herr_t H5Drefresh(hid_t dset_id) { - H5VL_object_t *vol_obj; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Object for loc_id */ + H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); @@ -1862,9 +1923,12 @@ H5Drefresh(hid_t dset_id) if (H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_DATASET_REFRESH; + vol_cb_args.args.refresh.dset_id = dset_id; + /* Refresh the dataset object */ - if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, dset_id)) < 0) + if (H5VL_dataset_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") done: @@ -1891,8 +1955,9 @@ done: herr_t H5Dformat_convert(hid_t dset_id) { - H5VL_object_t *vol_obj; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); @@ -1905,9 +1970,12 @@ H5Dformat_convert(hid_t dset_id) if (H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_NATIVE_DATASET_FORMAT_CONVERT; + vol_cb_args.args = NULL; + /* Convert the dataset */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL) < 0) + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") done: @@ -1929,8 +1997,10 @@ done: herr_t H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/) { - H5VL_object_t *vol_obj; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", dset_id, idx_type); @@ -1941,9 +2011,13 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/) if (NULL == idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") + /* Set up VOL callback arguments */ + dset_opt_args.get_chunk_idx_type.idx_type = idx_type; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE; + vol_cb_args.args = &dset_opt_args; + /* Get the chunk indexing type */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, idx_type) < 0) + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") done: @@ -1968,8 +2042,10 @@ done: herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes /*out*/) { - H5VL_object_t *vol_obj; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t * vol_obj; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*hx", dset_id, offset, chunk_nbytes); @@ -1982,9 +2058,14 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n if (NULL == chunk_nbytes) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") + /* Set up VOL callback arguments */ + dset_opt_args.get_chunk_storage_size.offset = offset; + dset_opt_args.get_chunk_storage_size.size = chunk_nbytes; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE; + vol_cb_args.args = &dset_opt_args; + /* Get the dataset creation property list */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, offset, chunk_nbytes) < 0) + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") done: @@ -2015,8 +2096,10 @@ done: herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/) { - H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; + H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE3("e", "iix", dset_id, fspace_id, nchunks); @@ -2027,10 +2110,15 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/) if (NULL == nchunks) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") + /* Set up VOL callback arguments */ + dset_opt_args.get_num_chunks.space_id = fspace_id; + dset_opt_args.get_num_chunks.nchunks = nchunks; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_NUM_CHUNKS; + vol_cb_args.args = &dset_opt_args; + /* Get the number of written chunks */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, fspace_id, nchunks) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks") + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks") done: FUNC_LEAVE_API(ret_value); @@ -2062,9 +2150,11 @@ herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *offset /*out*/, unsigned *filter_mask /*out*/, haddr_t *addr /*out*/, hsize_t *size /*out*/) { - H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ - hsize_t nchunks = 0; - herr_t ret_value = SUCCEED; + H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + hsize_t nchunks = 0; /* Number of chunks */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE7("e", "iihxxxx", dset_id, fspace_id, chk_index, offset, filter_mask, addr, size); @@ -2076,19 +2166,33 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + /* Set up VOL callback arguments */ + dset_opt_args.get_num_chunks.space_id = fspace_id; + dset_opt_args.get_num_chunks.nchunks = &nchunks; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_NUM_CHUNKS; + vol_cb_args.args = &dset_opt_args; + /* Get the number of written chunks to check range */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, fspace_id, &nchunks) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks") + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks") /* Check range for chunk index */ if (chk_index >= nchunks) HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range") + /* Set up VOL callback arguments */ + dset_opt_args.get_chunk_info_by_idx.space_id = fspace_id; + dset_opt_args.get_chunk_info_by_idx.chk_index = chk_index; + dset_opt_args.get_chunk_info_by_idx.offset = offset; + dset_opt_args.get_chunk_info_by_idx.filter_mask = filter_mask; + dset_opt_args.get_chunk_info_by_idx.addr = addr; + dset_opt_args.get_chunk_info_by_idx.size = size; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX; + vol_cb_args.args = &dset_opt_args; + /* Call private function to get the chunk info given the chunk's index */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, fspace_id, chk_index, offset, filter_mask, addr, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by index") + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index") done: FUNC_LEAVE_API(ret_value); @@ -2119,8 +2223,10 @@ herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask /*out*/, haddr_t *addr /*out*/, hsize_t *size /*out*/) { - H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; + H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*hxxx", dset_id, offset, filter_mask, addr, size); @@ -2134,10 +2240,17 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte if (NULL == offset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") + /* Set up VOL callback arguments */ + dset_opt_args.get_chunk_info_by_coord.offset = offset; + dset_opt_args.get_chunk_info_by_coord.filter_mask = filter_mask; + dset_opt_args.get_chunk_info_by_coord.addr = addr; + dset_opt_args.get_chunk_info_by_coord.size = size; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD; + vol_cb_args.args = &dset_opt_args; + /* Call private function to get the chunk info given the chunk's index */ - if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, offset, filter_mask, addr, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates") + if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates") done: FUNC_LEAVE_API(ret_value) @@ -2150,6 +2263,7 @@ done: * * Parameters: * hid_t dset_id; IN: Chunked dataset ID + * hid_t dxpl_id; IN: Dataset transfer property list ID * H5D_chunk_iter_op_t cb IN: User callback function, called for every chunk. * void *op_data IN/OUT: Optional user data passed on to user callback. * @@ -2187,22 +2301,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Dchunk_iter(hid_t dset_id, H5D_chunk_iter_op_t cb, void *op_data) +H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; + H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */ + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ix*x", dset_id, cb, op_data); + H5TRACE4("e", "iix*x", dset_id, dxpl_id, op, op_data); /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + if (NULL == op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback to chunk iteration") - /* Call private function to get the chunk info given the chunk's index */ - if (H5VL_dataset_specific(vol_obj, H5VL_DATASET_CHUNK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cb, - op_data) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't iterate over chunks") + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID") + + /* Set up VOL callback arguments */ + dset_opt_args.chunk_iter.op = op; + dset_opt_args.chunk_iter.op_data = op_data; + vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_ITER; + vol_cb_args.args = &dset_opt_args; + + /* Iterate over the chunks */ + if ((ret_value = H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0) + HERROR(H5E_BADITER, H5E_BADITER, "error iterating over dataset chunks"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 6be29fd..67ac99b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -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 */ @@ -602,8 +602,6 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage HDassert(offset); HDassert(storage_size); - *storage_size = 0; - /* Allocate dataspace and initialize it if it hasn't been. */ if (!(*layout->ops->is_space_alloc)(&layout->storage)) HGOTO_DONE(SUCCEED) @@ -6026,6 +6024,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if (udata->chunk_in_cache) { HDassert(H5F_addr_defined(chunk_rec->chunk_addr)); + HDassert(ent); HDassert(H5F_addr_defined(ent->chunk_block.offset)); H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t); @@ -7459,6 +7458,38 @@ done: } /* end H5D__get_chunk_info_by_coord() */ /*------------------------------------------------------------------------- + * Function: H5D__chunk_iter_cb + * + * Purpose: Call the user-defined function with the chunk data. The iterator continues if + * the user-defined function returns H5_ITER_CONT, and stops if H5_ITER_STOP is + * returned. + * + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * Failure: Negative (H5_ITER_ERROR) + * + * Programmer: Gaute Hope + * August 2020 + * + *------------------------------------------------------------------------- + */ +static int +H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata) +{ + const H5D_chunk_iter_ud_t *data = (H5D_chunk_iter_ud_t *)udata; + int ret_value = H5_ITER_CONT; + + FUNC_ENTER_STATIC + + /* 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"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__chunk_iter_cb */ + +/*------------------------------------------------------------------------- * Function: H5D__chunk_iter * * Purpose: Iterate over all the chunks in the dataset with given callbak. @@ -7472,7 +7503,7 @@ done: *------------------------------------------------------------------------- */ 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 */ @@ -7497,7 +7528,7 @@ H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t cb, void *op_data) for (ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "cannot flush indexed storage buffer") /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -7507,13 +7538,16 @@ 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: @@ -7521,31 +7555,48 @@ done: } /* end H5D__chunk_iter() */ /*------------------------------------------------------------------------- - * Function: H5D__chunk_iter_cb + * Function: H5D__chunk_get_offset_copy * - * Purpose: Call the user-defined function with the chunk data. The iterator continues if - * the user-defined function returns H5_ITER_CONT, and stops if H5_ITER_STOP is - * returned. + * Purpose: Copies an offset buffer and performs bounds checks on the + * values. * - * Return: Success: H5_ITER_CONT or H5_ITER_STOP - * Failure: Negative (H5_ITER_ERROR) + * This helper function ensures that the offset buffer given + * by the user is suitable for use with the rest of the library. * - * Programmer: Gaute Hope - * August 2020 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata) +herr_t +H5D__chunk_get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy) { - int ret_value = 0; + unsigned u; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_NOAPI(FAIL) - const H5D_chunk_iter_cb_data_t *data = (H5D_chunk_iter_cb_data_t *)udata; + HDassert(dset); + HDassert(offset); + HDassert(offset_copy); - ret_value = (data->cb)(chunk_rec->scaled, chunk_rec->filter_mask, chunk_rec->chunk_addr, - chunk_rec->nbytes, data->op_data); + /* 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_iter_cb */ +} /* 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 207181a..6d3f4a3 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..600f08a 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. */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 28561c9..e07ba30 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -575,7 +575,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); @@ -650,7 +650,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/H5Dprivate.h b/src/H5Dprivate.h index f9ef772..ad9794d 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -79,11 +79,12 @@ #define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME \ "local_no_collective_cause" /* cause of broken collective I/O in each process */ #define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME \ - "global_no_collective_cause" /* cause of broken collective I/O in all processes */ -#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ -#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ -#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ -#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ + "global_no_collective_cause" /* cause of broken collective I/O in all processes */ +#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ +#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ +#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ +#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ +#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */ #ifdef H5_HAVE_INSTRUMENTED_LIBRARY /* Collective chunk instrumentation properties */ #define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard" diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 0b5fac6..63cc61c 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -641,6 +641,7 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u * \brief Iterate over all chunks * * \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 * @@ -677,7 +678,7 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u * indicating failure. * */ -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); /** * -------------------------------------------------------------------------- @@ -1339,8 +1340,6 @@ H5_DLL herr_t H5Dset_extent_async(const char *app_file, const char *app_func, un */ H5_DLL herr_t H5Dflush(hid_t dset_id); -H5_DLL herr_t H5Dwait(hid_t dset_id); - /** * -------------------------------------------------------------------------- * \ingroup H5D diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index f582ec5..4012188 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -3151,7 +3151,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..b132103 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -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/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..4cf71c5 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 */ + 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 */ + + /* 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; + //! /** * 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_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 ); 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? -"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..b38833f 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -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/H5F.c b/src/H5F.c index 8618851..5950d9e 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 = §_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,57 +2761,27 @@ 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: FUNC_LEAVE_API(ret_value) } /* 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() */ diff --git a/src/H5FDdevelop.h b/src/H5FDdevelop.h new file mode 100644 index 0000000..57f0a42 --- /dev/null +++ b/src/H5FDdevelop.h @@ -0,0 +1,262 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 H5FD (file drivers) developer + * support routines. + */ + +#ifndef _H5FDdevelop_H +#define _H5FDdevelop_H + +/* Include package's public header */ +#include "H5FDpublic.h" + +/*****************/ +/* Public Macros */ +/*****************/ + +/* Map "fractal heap" header blocks to 'ohdr' type file memory, since its + * a fair amount of work to add a new kind of file memory and they are similar + * enough to object headers and probably too minor to deserve their own type. + * + * Map "fractal heap" indirect blocks to 'ohdr' type file memory, since they + * are similar to fractal heap header blocks. + * + * Map "fractal heap" direct blocks to 'lheap' type file memory, since they + * will be replacing local heaps. + * + * Map "fractal heap" 'huge' objects to 'draw' type file memory, since they + * represent large objects that are directly stored in the file. + * + * -QAK + */ +#define H5FD_MEM_FHEAP_HDR H5FD_MEM_OHDR +#define H5FD_MEM_FHEAP_IBLOCK H5FD_MEM_OHDR +#define H5FD_MEM_FHEAP_DBLOCK H5FD_MEM_LHEAP +#define H5FD_MEM_FHEAP_HUGE_OBJ H5FD_MEM_DRAW + +/* Map "free space" header blocks to 'ohdr' type file memory, since its + * a fair amount of work to add a new kind of file memory and they are similar + * enough to object headers and probably too minor to deserve their own type. + * + * Map "free space" serialized sections to 'lheap' type file memory, since they + * are similar enough to local heap info. + * + * -QAK + */ +#define H5FD_MEM_FSPACE_HDR H5FD_MEM_OHDR +#define H5FD_MEM_FSPACE_SINFO H5FD_MEM_LHEAP + +/* Map "shared object header message" master table to 'ohdr' type file memory, + * since its a fair amount of work to add a new kind of file memory and they are + * similar enough to object headers and probably too minor to deserve their own + * type. + * + * Map "shared object header message" indices to 'btree' type file memory, + * since they are similar enough to B-tree nodes. + * + * -QAK + */ +#define H5FD_MEM_SOHM_TABLE H5FD_MEM_OHDR +#define H5FD_MEM_SOHM_INDEX H5FD_MEM_BTREE + +/* Map "extensible array" header blocks to 'ohdr' type file memory, since its + * a fair amount of work to add a new kind of file memory and they are similar + * enough to object headers and probably too minor to deserve their own type. + * + * Map "extensible array" index blocks to 'ohdr' type file memory, since they + * are similar to extensible array header blocks. + * + * Map "extensible array" super blocks to 'btree' type file memory, since they + * are similar enough to B-tree nodes. + * + * Map "extensible array" data blocks & pages to 'lheap' type file memory, since + * they are similar enough to local heap info. + * + * -QAK + */ +#define H5FD_MEM_EARRAY_HDR H5FD_MEM_OHDR +#define H5FD_MEM_EARRAY_IBLOCK H5FD_MEM_OHDR +#define H5FD_MEM_EARRAY_SBLOCK H5FD_MEM_BTREE +#define H5FD_MEM_EARRAY_DBLOCK H5FD_MEM_LHEAP +#define H5FD_MEM_EARRAY_DBLK_PAGE H5FD_MEM_LHEAP + +/* Map "fixed array" header blocks to 'ohdr' type file memory, since its + * a fair amount of work to add a new kind of file memory and they are similar + * enough to object headers and probably too minor to deserve their own type. + * + * Map "fixed array" data blocks & pages to 'lheap' type file memory, since + * they are similar enough to local heap info. + * + */ +#define H5FD_MEM_FARRAY_HDR H5FD_MEM_OHDR +#define H5FD_MEM_FARRAY_DBLOCK H5FD_MEM_LHEAP +#define H5FD_MEM_FARRAY_DBLK_PAGE H5FD_MEM_LHEAP + +/* + * A free-list map which maps all types of allocation requests to a single + * free list. This is useful for drivers that don't really care about + * keeping different requests segregated in the underlying file and which + * want to make most efficient reuse of freed memory. The use of the + * H5FD_MEM_SUPER free list is arbitrary. + */ +#define H5FD_FLMAP_SINGLE \ + { \ + H5FD_MEM_SUPER, /*default*/ \ + H5FD_MEM_SUPER, /*super*/ \ + H5FD_MEM_SUPER, /*btree*/ \ + H5FD_MEM_SUPER, /*draw*/ \ + H5FD_MEM_SUPER, /*gheap*/ \ + H5FD_MEM_SUPER, /*lheap*/ \ + H5FD_MEM_SUPER /*ohdr*/ \ + } + +/* + * A free-list map which segregates requests into `raw' or `meta' data + * pools. + */ +#define H5FD_FLMAP_DICHOTOMY \ + { \ + H5FD_MEM_SUPER, /*default*/ \ + H5FD_MEM_SUPER, /*super*/ \ + H5FD_MEM_SUPER, /*btree*/ \ + H5FD_MEM_DRAW, /*draw*/ \ + H5FD_MEM_DRAW, /*gheap*/ \ + H5FD_MEM_SUPER, /*lheap*/ \ + H5FD_MEM_SUPER /*ohdr*/ \ + } + +/* + * The default free list map which causes each request type to use it's own + * free-list. + */ +#define H5FD_FLMAP_DEFAULT \ + { \ + H5FD_MEM_DEFAULT, /*default*/ \ + H5FD_MEM_DEFAULT, /*super*/ \ + H5FD_MEM_DEFAULT, /*btree*/ \ + H5FD_MEM_DEFAULT, /*draw*/ \ + H5FD_MEM_DEFAULT, /*gheap*/ \ + H5FD_MEM_DEFAULT, /*lheap*/ \ + H5FD_MEM_DEFAULT /*ohdr*/ \ + } + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* Forward declaration */ +typedef struct H5FD_t H5FD_t; + +/* Class information for each file driver */ +typedef struct H5FD_class_t { + const char * name; + haddr_t maxaddr; + H5F_close_degree_t fc_degree; + herr_t (*terminate)(void); + hsize_t (*sb_size)(H5FD_t *file); + herr_t (*sb_encode)(H5FD_t *file, char *name /*out*/, unsigned char *p /*out*/); + herr_t (*sb_decode)(H5FD_t *f, const char *name, const unsigned char *p); + size_t fapl_size; + void *(*fapl_get)(H5FD_t *file); + void *(*fapl_copy)(const void *fapl); + herr_t (*fapl_free)(void *fapl); + size_t dxpl_size; + void *(*dxpl_copy)(const void *dxpl); + herr_t (*dxpl_free)(void *dxpl); + H5FD_t *(*open)(const char *name, unsigned flags, hid_t fapl, haddr_t maxaddr); + herr_t (*close)(H5FD_t *file); + int (*cmp)(const H5FD_t *f1, const H5FD_t *f2); + herr_t (*query)(const H5FD_t *f1, unsigned long *flags); + herr_t (*get_type_map)(const H5FD_t *file, H5FD_mem_t *type_map); + haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); + herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); + haddr_t (*get_eoa)(const H5FD_t *file, H5FD_mem_t type); + herr_t (*set_eoa)(H5FD_t *file, H5FD_mem_t type, haddr_t addr); + haddr_t (*get_eof)(const H5FD_t *file, H5FD_mem_t type); + herr_t (*get_handle)(H5FD_t *file, hid_t fapl, void **file_handle); + herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, void *buffer); + herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, const void *buffer); + herr_t (*flush)(H5FD_t *file, hid_t dxpl_id, hbool_t closing); + herr_t (*truncate)(H5FD_t *file, hid_t dxpl_id, hbool_t closing); + herr_t (*lock)(H5FD_t *file, hbool_t rw); + herr_t (*unlock)(H5FD_t *file); + herr_t (*del)(const char *name, hid_t fapl); + H5FD_mem_t fl_map[H5FD_MEM_NTYPES]; +} H5FD_class_t; + +/* A free list is a singly-linked list of address/size pairs. */ +typedef struct H5FD_free_t { + haddr_t addr; + hsize_t size; + struct H5FD_free_t *next; +} H5FD_free_t; + +/* + * The main datatype for each driver. Public fields common to all drivers + * are declared here and the driver appends private fields in memory. + */ +struct H5FD_t { + hid_t driver_id; /*driver ID for this file */ + const H5FD_class_t *cls; /*constant class info */ + unsigned long fileno; /* File 'serial' number */ + unsigned access_flags; /* File access flags (from create or open) */ + unsigned long feature_flags; /* VFL Driver feature Flags */ + haddr_t maxaddr; /* For this file, overrides class */ + haddr_t base_addr; /* Base address for HDF5 data w/in file */ + + /* Space allocation management fields */ + hsize_t threshold; /* Threshold for alignment */ + hsize_t alignment; /* Allocation alignment */ + hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */ +}; + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +H5_DLL hid_t H5FDregister(const H5FD_class_t *cls); +H5_DLL herr_t H5FDunregister(hid_t driver_id); +H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +H5_DLL herr_t H5FDclose(H5FD_t *file); +H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2); +H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags); +H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); +H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type); +H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa); +H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type); +H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle); +H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + void *buf /*out*/); +H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + const void *buf); +H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); +H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); +H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); +H5_DLL herr_t H5FDunlock(H5FD_t *file); +H5_DLL herr_t H5FDdelete(const char *name, hid_t fapl_id); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5FDdevelop_H */ 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/H5FDmulti.c b/src/H5FDmulti.c index 9347eab..97d1d7a 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -27,6 +27,7 @@ #include #include "hdf5.h" +#include "hdf5dev.h" #ifndef FALSE #define FALSE 0 diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 6dfb7b4..c00c123 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -18,8 +18,9 @@ #ifndef H5FDprivate_H #define H5FDprivate_H -/* Include package's public header */ +/* Include package's public headers */ #include "H5FDpublic.h" +#include "H5FDdevelop.h" /* Private headers needed by this file */ #include "H5Pprivate.h" /* Property lists */ diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 7794f24..0cfb072 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -18,140 +18,15 @@ #ifndef H5FDpublic_H #define H5FDpublic_H -#include "H5public.h" -#include "H5Fpublic.h" /*for H5F_close_degree_t */ +/* Public headers needed by this file */ +#include "H5public.h" /* Generic Functions */ +#include "H5Fpublic.h" /* Files */ -#define H5_HAVE_VFL 1 /*define a convenient app feature test*/ -#define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */ - -/* Types of allocation requests: see H5Fpublic.h */ -typedef enum H5F_mem_t H5FD_mem_t; - -/* Map "fractal heap" header blocks to 'ohdr' type file memory, since its - * a fair amount of work to add a new kind of file memory and they are similar - * enough to object headers and probably too minor to deserve their own type. - * - * Map "fractal heap" indirect blocks to 'ohdr' type file memory, since they - * are similar to fractal heap header blocks. - * - * Map "fractal heap" direct blocks to 'lheap' type file memory, since they - * will be replacing local heaps. - * - * Map "fractal heap" 'huge' objects to 'draw' type file memory, since they - * represent large objects that are directly stored in the file. - * - * -QAK - */ -#define H5FD_MEM_FHEAP_HDR H5FD_MEM_OHDR -#define H5FD_MEM_FHEAP_IBLOCK H5FD_MEM_OHDR -#define H5FD_MEM_FHEAP_DBLOCK H5FD_MEM_LHEAP -#define H5FD_MEM_FHEAP_HUGE_OBJ H5FD_MEM_DRAW - -/* Map "free space" header blocks to 'ohdr' type file memory, since its - * a fair amount of work to add a new kind of file memory and they are similar - * enough to object headers and probably too minor to deserve their own type. - * - * Map "free space" serialized sections to 'lheap' type file memory, since they - * are similar enough to local heap info. - * - * -QAK - */ -#define H5FD_MEM_FSPACE_HDR H5FD_MEM_OHDR -#define H5FD_MEM_FSPACE_SINFO H5FD_MEM_LHEAP - -/* Map "shared object header message" master table to 'ohdr' type file memory, - * since its a fair amount of work to add a new kind of file memory and they are - * similar enough to object headers and probably too minor to deserve their own - * type. - * - * Map "shared object header message" indices to 'btree' type file memory, - * since they are similar enough to B-tree nodes. - * - * -QAK - */ -#define H5FD_MEM_SOHM_TABLE H5FD_MEM_OHDR -#define H5FD_MEM_SOHM_INDEX H5FD_MEM_BTREE - -/* Map "extensible array" header blocks to 'ohdr' type file memory, since its - * a fair amount of work to add a new kind of file memory and they are similar - * enough to object headers and probably too minor to deserve their own type. - * - * Map "extensible array" index blocks to 'ohdr' type file memory, since they - * are similar to extensible array header blocks. - * - * Map "extensible array" super blocks to 'btree' type file memory, since they - * are similar enough to B-tree nodes. - * - * Map "extensible array" data blocks & pages to 'lheap' type file memory, since - * they are similar enough to local heap info. - * - * -QAK - */ -#define H5FD_MEM_EARRAY_HDR H5FD_MEM_OHDR -#define H5FD_MEM_EARRAY_IBLOCK H5FD_MEM_OHDR -#define H5FD_MEM_EARRAY_SBLOCK H5FD_MEM_BTREE -#define H5FD_MEM_EARRAY_DBLOCK H5FD_MEM_LHEAP -#define H5FD_MEM_EARRAY_DBLK_PAGE H5FD_MEM_LHEAP +/*****************/ +/* Public Macros */ +/*****************/ -/* Map "fixed array" header blocks to 'ohdr' type file memory, since its - * a fair amount of work to add a new kind of file memory and they are similar - * enough to object headers and probably too minor to deserve their own type. - * - * Map "fixed array" data blocks & pages to 'lheap' type file memory, since - * they are similar enough to local heap info. - * - */ -#define H5FD_MEM_FARRAY_HDR H5FD_MEM_OHDR -#define H5FD_MEM_FARRAY_DBLOCK H5FD_MEM_LHEAP -#define H5FD_MEM_FARRAY_DBLK_PAGE H5FD_MEM_LHEAP - -/* - * A free-list map which maps all types of allocation requests to a single - * free list. This is useful for drivers that don't really care about - * keeping different requests segregated in the underlying file and which - * want to make most efficient reuse of freed memory. The use of the - * H5FD_MEM_SUPER free list is arbitrary. - */ -#define H5FD_FLMAP_SINGLE \ - { \ - H5FD_MEM_SUPER, /*default*/ \ - H5FD_MEM_SUPER, /*super*/ \ - H5FD_MEM_SUPER, /*btree*/ \ - H5FD_MEM_SUPER, /*draw*/ \ - H5FD_MEM_SUPER, /*gheap*/ \ - H5FD_MEM_SUPER, /*lheap*/ \ - H5FD_MEM_SUPER /*ohdr*/ \ - } - -/* - * A free-list map which segregates requests into `raw' or `meta' data - * pools. - */ -#define H5FD_FLMAP_DICHOTOMY \ - { \ - H5FD_MEM_SUPER, /*default*/ \ - H5FD_MEM_SUPER, /*super*/ \ - H5FD_MEM_SUPER, /*btree*/ \ - H5FD_MEM_DRAW, /*draw*/ \ - H5FD_MEM_DRAW, /*gheap*/ \ - H5FD_MEM_SUPER, /*lheap*/ \ - H5FD_MEM_SUPER /*ohdr*/ \ - } - -/* - * The default free list map which causes each request type to use it's own - * free-list. - */ -#define H5FD_FLMAP_DEFAULT \ - { \ - H5FD_MEM_DEFAULT, /*default*/ \ - H5FD_MEM_DEFAULT, /*super*/ \ - H5FD_MEM_DEFAULT, /*btree*/ \ - H5FD_MEM_DEFAULT, /*draw*/ \ - H5FD_MEM_DEFAULT, /*gheap*/ \ - H5FD_MEM_DEFAULT, /*lheap*/ \ - H5FD_MEM_DEFAULT /*ohdr*/ \ - } +#define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */ /* Define VFL driver features that can be enabled on a per-driver basis */ /* These are returned with the 'query' function pointer in H5FD_class_t */ @@ -263,71 +138,12 @@ typedef enum H5F_mem_t H5FD_mem_t; */ #define H5FD_FEAT_DEFAULT_VFD_COMPATIBLE 0x00008000 -/* Forward declaration */ -typedef struct H5FD_t H5FD_t; - -/* Class information for each file driver */ -typedef struct H5FD_class_t { - const char * name; - haddr_t maxaddr; - H5F_close_degree_t fc_degree; - herr_t (*terminate)(void); - hsize_t (*sb_size)(H5FD_t *file); - herr_t (*sb_encode)(H5FD_t *file, char *name /*out*/, unsigned char *p /*out*/); - herr_t (*sb_decode)(H5FD_t *f, const char *name, const unsigned char *p); - size_t fapl_size; - void *(*fapl_get)(H5FD_t *file); - void *(*fapl_copy)(const void *fapl); - herr_t (*fapl_free)(void *fapl); - size_t dxpl_size; - void *(*dxpl_copy)(const void *dxpl); - herr_t (*dxpl_free)(void *dxpl); - H5FD_t *(*open)(const char *name, unsigned flags, hid_t fapl, haddr_t maxaddr); - herr_t (*close)(H5FD_t *file); - int (*cmp)(const H5FD_t *f1, const H5FD_t *f2); - herr_t (*query)(const H5FD_t *f1, unsigned long *flags); - herr_t (*get_type_map)(const H5FD_t *file, H5FD_mem_t *type_map); - haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); - herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); - haddr_t (*get_eoa)(const H5FD_t *file, H5FD_mem_t type); - herr_t (*set_eoa)(H5FD_t *file, H5FD_mem_t type, haddr_t addr); - haddr_t (*get_eof)(const H5FD_t *file, H5FD_mem_t type); - herr_t (*get_handle)(H5FD_t *file, hid_t fapl, void **file_handle); - herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, void *buffer); - herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, const void *buffer); - herr_t (*flush)(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - herr_t (*truncate)(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - herr_t (*lock)(H5FD_t *file, hbool_t rw); - herr_t (*unlock)(H5FD_t *file); - herr_t (*del)(const char *name, hid_t fapl); - H5FD_mem_t fl_map[H5FD_MEM_NTYPES]; -} H5FD_class_t; - -/* A free list is a singly-linked list of address/size pairs. */ -typedef struct H5FD_free_t { - haddr_t addr; - hsize_t size; - struct H5FD_free_t *next; -} H5FD_free_t; - -/* - * The main datatype for each driver. Public fields common to all drivers - * are declared here and the driver appends private fields in memory. - */ -struct H5FD_t { - hid_t driver_id; /*driver ID for this file */ - const H5FD_class_t *cls; /*constant class info */ - unsigned long fileno; /* File 'serial' number */ - unsigned access_flags; /* File access flags (from create or open) */ - unsigned long feature_flags; /* VFL Driver feature Flags */ - haddr_t maxaddr; /* For this file, overrides class */ - haddr_t base_addr; /* Base address for HDF5 data w/in file */ +/*******************/ +/* Public Typedefs */ +/*******************/ - /* Space allocation management fields */ - hsize_t threshold; /* Threshold for alignment */ - hsize_t alignment; /* Allocation alignment */ - hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */ -}; +/* Types of allocation requests: see H5Fpublic.h */ +typedef enum H5F_mem_t H5FD_mem_t; /** * Define enum for the source of file image callbacks @@ -437,33 +253,19 @@ typedef struct { } H5FD_file_image_callbacks_t; //! +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + #ifdef __cplusplus extern "C" { #endif /* Function prototypes */ -H5_DLL hid_t H5FDregister(const H5FD_class_t *cls); -H5_DLL herr_t H5FDunregister(hid_t driver_id); -H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -H5_DLL herr_t H5FDclose(H5FD_t *file); -H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2); -H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags); -H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); -H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); -H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type); -H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa); -H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type); -H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle); -H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, - void *buf /*out*/); -H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, - const void *buf); -H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); -H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); -H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); -H5_DLL herr_t H5FDunlock(H5FD_t *file); -H5_DLL herr_t H5FDdelete(const char *name, hid_t fapl_id); - /* Allows querying a VFD ID for features before the file is opened */ H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/); diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 6631325..e23aca8 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -29,6 +29,7 @@ #include #include "hdf5.h" +#include "hdf5dev.h" #ifdef H5_HAVE_FLOCK /* Needed for lock type definitions (e.g., LOCK_EX) */ diff --git a/src/H5FL.c b/src/H5FL.c index 95188d5..0aca4b7 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/H5Fint.c b/src/H5Fint.c index e1be2b6..c2d3e77 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2360,11 +2360,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); @@ -2374,7 +2374,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 @@ -3109,27 +3109,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 @@ -3150,7 +3151,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 @@ -3158,7 +3159,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. @@ -3172,30 +3173,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") - - /* set ret_value = to eoa -- will overwrite this if appropriate */ - ret_value = (ssize_t)eoa; + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") - /* 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); @@ -3207,6 +3202,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() */ @@ -3902,11 +3900,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) @@ -3914,9 +3913,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/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 087c9c9..b016696 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -33,6 +33,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Bprivate.h" /* B-trees */ +#include "H5FDprivate.h" /* File drivers */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FOprivate.h" /* File objects */ #include "H5FSprivate.h" /* File free space */ @@ -404,21 +405,20 @@ 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__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 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); /* 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); @@ -448,6 +448,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); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 7044835..051abd9 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -755,6 +755,7 @@ typedef struct H5F_t H5F_t; /* 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; @@ -830,7 +831,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); @@ -908,7 +908,9 @@ 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 */ +/* 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*/); @@ -961,8 +963,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 */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 51c06f4..98d2a9f 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -1026,7 +1026,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 * @@ -1685,7 +1685,6 @@ H5_DLL herr_t H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize); * */ H5_DLL herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize); -H5_DLL herr_t H5Fwait(hid_t file_id); #ifdef H5_HAVE_PARALLEL /** diff --git a/src/H5G.c b/src/H5G.c index 0163d65..d7e4da9 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/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 86b6e1b..da565af 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -359,14 +359,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 */ @@ -406,41 +406,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/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/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/H5Idevelop.h b/src/H5Idevelop.h new file mode 100644 index 0000000..3cd951e --- /dev/null +++ b/src/H5Idevelop.h @@ -0,0 +1,139 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 H5I (ID management) developer + * support routines. + */ + +#ifndef _H5Idevelop_H +#define _H5Idevelop_H + +/* Include package's public header */ +#include "H5Ipublic.h" /* ID management */ + +/*****************/ +/* Public Macros */ +/*****************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/** + * The type of the realize_cb callback for H5Iregister_future + */ +//! +typedef herr_t (*H5I_future_realize_func_t)(void *future_object, hid_t *actual_object_id); +//! + +/** + * The type of the discard_cb callback for H5Iregister_future + */ +//! +typedef herr_t (*H5I_future_discard_func_t)(void *future_object); +//! + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \ingroup H5I + * + * \brief Registers a "future" object under a type and returns an ID for it + * + * \param[in] type The identifier of the type of the new ID + * \param[in] object Pointer to "future" object for which a new ID is created + * \param[in] realize_cb Function pointer to realize a future object + * \param[in] discard_cb Function pointer to destroy a future object + * + * \return \hid_t{object} + * + * \details H5Iregister_future() creates and returns a new ID for a "future" object. + * Future objects are a special kind of object and represent a + * placeholder for an object that has not yet been created or opened. + * The \p realize_cb will be invoked by the HDF5 library to 'realize' + * the future object as an actual object. A call to H5Iobject_verify() + * will invoke the \p realize_cb callback and if it successfully + * returns, will return the actual object, not the future object. + * + * \details The \p type parameter is the identifier for the ID type to which + * this new future ID will belong. This identifier may have been created + * by a call to H5Iregister_type() or may be one of the HDF5 pre-defined + * ID classes (e.g. H5I_FILE, H5I_GROUP, H5I_DATASPACE, etc). + * + * \details The \p object parameter is a pointer to the memory which the new ID + * will be a reference to. This pointer will be stored by the library, + * but will not be returned to a call to H5Iobject_verify() until the + * \p realize_cb callback has returned the actual pointer for the object. + * + * A NULL value for \p object is allowed. + * + * \details The \p realize_cb parameter is a function pointer that will be + * invoked by the HDF5 library to convert a future object into an + * actual object. The \p realize_cb function may be invoked by + * H5Iobject_verify() to return the actual object for a user-defined + * ID class (i.e. an ID class registered with H5Iregister_type()) or + * internally by the HDF5 library in order to use or get information + * from an HDF5 pre-defined ID type. For example, the \p realize_cb + * for a future dataspace object will be called during the process + * of returning information from H5Sget_simple_extent_dims(). + * + * Note that although the \p realize_cb routine returns + * an ID (as a parameter) for the actual object, the HDF5 library + * will swap the actual object in that ID for the future object in + * the future ID. This ensures that the ID value for the object + * doesn't change for the user when the object is realized. + * + * Note that the \p realize_cb callback could receive a NULL value + * for a future object pointer, if one was used when H5Iregister_future() + * was initially called. This is permitted as a means of allowing + * the \p realize_cb to act as a generator of new objects, without + * requiring creation of unnecessary future objects. + * + * It is an error to pass NULL for \p realize_cb. + * + * \details The \p discard_cb parameter is a function pointer that will be + * invoked by the HDF5 library to destroy a future object. This + * callback will always be invoked for _every_ future object, whether + * the \p realize_cb is invoked on it or not. It's possible that + * the \p discard_cb is invoked on a future object without the + * \p realize_cb being invoked, e.g. when a future ID is closed without + * requiring the future object to be realized into an actual one. + * + * Note that the \p discard_cb callback could receive a NULL value + * for a future object pointer, if one was used when H5Iregister_future() + * was initially called. + * + * It is an error to pass NULL for \p discard_cb. + * + * \note The H5Iregister_future() function is primarily targeted at VOL connector + * authors and is _not_ designed for general-purpose application use. + * + */ +H5_DLL hid_t H5Iregister_future(H5I_type_t type, const void *object, H5I_future_realize_func_t realize_cb, + H5I_future_discard_func_t discard_cb); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5Idevelop_H */ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index d1b6248..831ff76 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -20,8 +20,9 @@ #ifndef H5Iprivate_H #define H5Iprivate_H -/* Include package's public header */ +/* Include package's public headers */ #include "H5Ipublic.h" +#include "H5Idevelop.h" /* Private headers needed by this file */ #include "H5private.h" diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 8e5e167..a5f830b 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -99,20 +99,6 @@ typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); //! -/** - * The type of the realize_cb callback for H5Iregister_future - */ -//! -typedef herr_t (*H5I_future_realize_func_t)(void *future_object, hid_t *actual_object_id); -//! - -/** - * The type of the discard_cb callback for H5Iregister_future - */ -//! -typedef herr_t (*H5I_future_discard_func_t)(void *future_object); -//! - #ifdef __cplusplus extern "C" { #endif @@ -144,82 +130,6 @@ H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object); /** * \ingroup H5I * - * \brief Registers a "future" object under a type and returns an ID for it - * - * \param[in] type The identifier of the type of the new ID - * \param[in] object Pointer to "future" object for which a new ID is created - * \param[in] realize_cb Function pointer to realize a future object - * \param[in] discard_cb Function pointer to destroy a future object - * - * \return \hid_t{object} - * - * \details H5Iregister_future() creates and returns a new ID for a "future" object. - * Future objects are a special kind of object and represent a - * placeholder for an object that has not yet been created or opened. - * The \p realize_cb will be invoked by the HDF5 library to 'realize' - * the future object as an actual object. A call to H5Iobject_verify() - * will invoke the \p realize_cb callback and if it successfully - * returns, will return the actual object, not the future object. - * - * \details The \p type parameter is the identifier for the ID type to which - * this new future ID will belong. This identifier may have been created - * by a call to H5Iregister_type() or may be one of the HDF5 pre-defined - * ID classes (e.g. H5I_FILE, H5I_GROUP, H5I_DATASPACE, etc). - * - * \details The \p object parameter is a pointer to the memory which the new ID - * will be a reference to. This pointer will be stored by the library, - * but will not be returned to a call to H5Iobject_verify() until the - * \p realize_cb callback has returned the actual pointer for the object. - * - * A NULL value for \p object is allowed. - * - * \details The \p realize_cb parameter is a function pointer that will be - * invoked by the HDF5 library to convert a future object into an - * actual object. The \p realize_cb function may be invoked by - * H5Iobject_verify() to return the actual object for a user-defined - * ID class (i.e. an ID class registered with H5Iregister_type()) or - * internally by the HDF5 library in order to use or get information - * from an HDF5 pre-defined ID type. For example, the \p realize_cb - * for a future dataspace object will be called during the process - * of returning information from H5Sget_simple_extent_dims(). - * - * Note that although the \p realize_cb routine returns - * an ID (as a parameter) for the actual object, the HDF5 library - * will swap the actual object in that ID for the future object in - * the future ID. This ensures that the ID value for the object - * doesn't change for the user when the object is realized. - * - * Note that the \p realize_cb callback could receive a NULL value - * for a future object pointer, if one was used when H5Iregister_future() - * was initially called. This is permitted as a means of allowing - * the \p realize_cb to act as a generator of new objects, without - * requiring creation of unnecessary future objects. - * - * It is an error to pass NULL for \p realize_cb. - * - * \details The \p discard_cb parameter is a function pointer that will be - * invoked by the HDF5 library to destroy a future object. This - * callback will always be invoked for _every_ future object, whether - * the \p realize_cb is invoked on it or not. It's possible that - * the \p discard_cb is invoked on a future object without the - * \p realize_cb being invoked, e.g. when a future ID is closed without - * requiring the future object to be realized into an actual one. - * - * Note that the \p discard_cb callback could receive a NULL value - * for a future object pointer, if one was used when H5Iregister_future() - * was initially called. - * - * It is an error to pass NULL for \p discard_cb. - * - * \note The H5Iregister_future() function is primarily targeted at VOL connector - * authors and is _not_ designed for general-purpose application use. - * - */ -H5_DLL hid_t H5Iregister_future(H5I_type_t type, const void *object, H5I_future_realize_func_t realize_cb, - H5I_future_discard_func_t discard_cb); -/** - * \ingroup H5I - * * \brief Returns the object referenced by an ID * * \param[in] id ID to be dereferenced 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 d3c0fe3..487599b 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/H5Ldevelop.h b/src/H5Ldevelop.h new file mode 100644 index 0000000..43ed7de --- /dev/null +++ b/src/H5Ldevelop.h @@ -0,0 +1,314 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 H5L (link) developer + * support routines. + */ + +#ifndef _H5Ldevelop_H +#define _H5Ldevelop_H + +/* Include package's public header */ +#include "H5Lpublic.h" + +/*****************/ +/* Public Macros */ +/*****************/ + +/** + * \brief Current version of the H5L_class_t struct + */ +#define H5L_LINK_CLASS_T_VERS 1 + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* The H5L_class_t struct can be used to override the behavior of a + * "user-defined" link class. Users should populate the struct with callback + * functions defined below. + */ +/* Callback prototypes for user-defined links */ +/** + * \brief Link creation callback + */ +typedef herr_t (*H5L_create_func_t)(const char *link_name, hid_t loc_group, const void *lnkdata, + size_t lnkdata_size, hid_t lcpl_id); +/** + * \brief Callback for link move + */ +typedef herr_t (*H5L_move_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata, + size_t lnkdata_size); +/** + * \brief Callback for link copy + */ +typedef herr_t (*H5L_copy_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata, + size_t lnkdata_size); +/** + * \brief Callback during link traversal + */ +typedef hid_t (*H5L_traverse_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata, + size_t lnkdata_size, hid_t lapl_id, hid_t dxpl_id); +/** + * \brief Callback for link deletion + */ +typedef herr_t (*H5L_delete_func_t)(const char *link_name, hid_t file, const void *lnkdata, + size_t lnkdata_size); +/** + * \brief Callback for querying the link. + * + * Returns the size of the buffer needed. + */ +typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, size_t lnkdata_size, + void *buf /*out*/, size_t buf_size); + +/** + * \brief Link prototype + * + * The H5L_class_t struct can be used to override the behavior of a + * "user-defined" link class. Users should populate the struct with callback + * functions defined elsewhere. + */ +//! +typedef struct { + int version; /**< Version number of this struct */ + H5L_type_t id; /**< Link type ID */ + const char * comment; /**< Comment for debugging */ + H5L_create_func_t create_func; /**< Callback during link creation */ + H5L_move_func_t move_func; /**< Callback after moving link */ + H5L_copy_func_t copy_func; /**< Callback after copying link */ + H5L_traverse_func_t trav_func; /**< Callback during link traversal */ + H5L_delete_func_t del_func; /**< Callback for link deletion */ + H5L_query_func_t query_func; /**< Callback for queries */ +} H5L_class_t; +//! + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \ingroup H5LA + * + * \brief Registers a user-defined link class or changes behavior of an + * existing class + * + * \param[in] cls Pointer to a buffer containing the struct describing the + * user-defined link class + * + * \return \herr_t + * + * \details H5Lregister() registers a class of user-defined links, or changes + * the behavior of an existing class. + * + * \p cls is a pointer to a buffer containing a copy of the + * H5L_class_t struct. This struct is defined in H5Lpublic.h as + * follows: + * \snippet this H5L_class_t_snip + * + * The class definition passed with \p cls must include at least the + * following: + * \li An H5L_class_t version (which should be #H5L_LINK_CLASS_T_VERS) + * \li A link class identifier, \c class_id + * \li A traversal function, \c trav_func + * + * Remaining \c struct members are optional and may be passed as NULL. + * + * The link class passed in \c class_id must be in the user-definable + * range between #H5L_TYPE_UD_MIN and #H5L_TYPE_UD_MAX + * (see the table below) and will override + * any existing link class with that identifier. + * + * As distributed, valid values of \c class_id used in HDF5 include + * the following (defined in H5Lpublic.h): + * \link_types + * + * The hard and soft link class identifiers cannot be modified or + * reassigned, but the external link class is implemented as an + * example in the user-definable link class identifier range. + * H5Lregister() is used to register additional link classes. It could + * also be used to modify the behavior of the external link class, + * though that is not recommended. + * + * The following table summarizes existing link types and values and + * the reserved and user-definable link class identifier value ranges. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Link class identifier or Value rangeDescriptionLink class or label
    0 to 63Reserved range
    64 to 255User-definable range
    64Minimum user-defined value#H5L_TYPE_UD_MIN
    64External link#H5L_TYPE_EXTERNAL
    255Maximum user-defined value#H5L_TYPE_UD_MAX
    255Maximum value#H5L_TYPE_MAX
    -1Error#H5L_TYPE_ERROR
    + * + * Note that HDF5 internally registers user-defined link classes only + * by the numeric value of the link class identifier. An application, + * on the other hand, will generally use a name for a user-defined + * class, if for no other purpose than as a variable name. Assume, + * for example, that a complex link type is registered with the link + * class identifier 73 and that the code includes the following + * assignment: + * \code + * H5L_TYPE_COMPLEX_A = 73 + * \endcode + * The application can refer to the link class with a term, + * \c H5L_TYPE_COMPLEX_A, that conveys meaning to a human reviewing + * the code, while HDF5 recognizes it by the more cryptic numeric + * identifier, 73. + * + * \attention Important details and considerations include the following: + * \li If you plan to distribute files or software with a + * user-defined link class, please contact the Help Desk at + * The HDF Group to help prevent collisions between \c class_id + * values. See below. + * \li As distributed with HDF5, the external link class is + * implemented as an example of a user-defined link class with + * #H5L_TYPE_EXTERNAL equal to #H5L_TYPE_UD_MIN. \c class_id in + * the H5L_class_t \c struct must not equal #H5L_TYPE_UD_MIN + * unless you intend to overwrite or modify the behavior of + * external links. + * \li H5Lregister() can be used only with link class identifiers + * in the user-definable range (see table above). + * \li The hard and soft links defined by the HDF5 library, + * #H5L_TYPE_HARD and #H5L_TYPE_SOFT, reside in the reserved + * range below #H5L_TYPE_UD_MIN and cannot be redefined or + * modified. + * \li H5Lis_registered() can be used to determine whether a desired + * link class identifier is available. \Emph{Note that this + * function will tell you only whether the link class identifier + * has been registered with the installed copy of HDF5; it + * cannot tell you whether the link class has been registered + * with The HDF Group.} + * \li #H5L_TYPE_MAX is the maximum allowed value for a link type + * identifier. + * \li #H5L_TYPE_UD_MIN equals #H5L_TYPE_EXTERNAL. + * \li #H5L_TYPE_UD_MAX equals #H5L_TYPE_MAX. + * \li #H5L_TYPE_ERROR indicates that an error has occurred. + * + * \note \Bold{Registration with The HDF Group:}\n + * There are sometimes reasons to take a broader approach to registering + * a user-defined link class than just invoking H5Lregister(). For + * example: + * \li A user-defined link class is intended for use across an + * organization, among collaborators, or across a community of users. + * \li An application or library overlying HDF5 invokes a user-defined + * link class that must be shipped with the software. + * \li Files are distributed that make use of a user-defined link class. + * \li Or simply, a specific user-defined link class is thought to be + * widely useful. + * + * In such cases, you are encouraged to register that link class with + * The HDF Group's Helpdesk. The HDF Group maintains a registry of known + * user-defined link classes and tracks the selected link class + * identifiers. This registry is intended to reduce the risk of + * collisions between \c class_id values and to help coordinate the use + * of specialized link classes. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Lregister(const H5L_class_t *cls); +/** + * \ingroup H5LA + * + * \brief Unregisters a class of user-defined links + * + * \param[in] id User-defined link class identifier + * + * \return \herr_t + * + * \details H5Lunregister() unregisters a class of user-defined links, + * preventing them from being traversed, queried, moved, etc. + * + * \note A link class can be re-registered using H5Lregister(). + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Lunregister(H5L_type_t id); + +#ifdef __cplusplus +} +#endif + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/* Previous versions of the H5L_class_t struct */ +#define H5L_LINK_CLASS_T_VERS_0 0 + +/** Callback during link traversal */ +typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata, + size_t lnkdata_size, hid_t lapl_id); + +/** User-defined link types */ +typedef struct { + int version; /**< Version number of this struct */ + H5L_type_t id; /**< Link type ID */ + const char * comment; /**< Comment for debugging */ + H5L_create_func_t create_func; /**< Callback during link creation */ + H5L_move_func_t move_func; /**< Callback after moving link */ + H5L_copy_func_t copy_func; /**< Callback after copying link */ + H5L_traverse_0_func_t trav_func; /**< Callback during link traversal */ + H5L_delete_func_t del_func; /**< Callback for link deletion */ + H5L_query_func_t query_func; /**< Callback for queries */ +} H5L_class_0_t; + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +#endif /* _H5Ldevelop_H */ 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/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 b114c17..98e3051 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -18,8 +18,9 @@ #ifndef H5Lprivate_H #define H5Lprivate_H -/* Include package's public header */ +/* Include package's public headers */ #include "H5Lpublic.h" +#include "H5Ldevelop.h" /* Private headers needed by this file */ #include "H5Gprivate.h" /* Groups */ @@ -51,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 5274649..f665526 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -46,11 +46,6 @@ */ #define H5L_SAME_LOC 0 /* (hid_t) */ -/** - * \brief Current version of the H5L_class_t struct - */ -#define H5L_LINK_CLASS_T_VERS 1 - #ifdef __cplusplus extern "C" { #endif @@ -105,65 +100,6 @@ typedef struct { } H5L_info2_t; //! -/* The H5L_class_t struct can be used to override the behavior of a - * "user-defined" link class. Users should populate the struct with callback - * functions defined below. - */ -/* Callback prototypes for user-defined links */ -/** - * \brief Link creation callback - */ -typedef herr_t (*H5L_create_func_t)(const char *link_name, hid_t loc_group, const void *lnkdata, - size_t lnkdata_size, hid_t lcpl_id); -/** - * \brief Callback for link move - */ -typedef herr_t (*H5L_move_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata, - size_t lnkdata_size); -/** - * \brief Callback for link copy - */ -typedef herr_t (*H5L_copy_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata, - size_t lnkdata_size); -/** - * \brief Callback during link traversal - */ -typedef hid_t (*H5L_traverse_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata, - size_t lnkdata_size, hid_t lapl_id, hid_t dxpl_id); -/** - * \brief Callback for link deletion - */ -typedef herr_t (*H5L_delete_func_t)(const char *link_name, hid_t file, const void *lnkdata, - size_t lnkdata_size); -/** - * \brief Callback for querying the link. - * - * Returns the size of the buffer needed. - */ -typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, size_t lnkdata_size, - void *buf /*out*/, size_t buf_size); - -/** - * \brief Link prototype - * - * The H5L_class_t struct can be used to override the behavior of a - * "user-defined" link class. Users should populate the struct with callback - * functions defined elsewhere. - */ -//! -typedef struct { - int version; /**< Version number of this struct */ - H5L_type_t id; /**< Link type ID */ - const char * comment; /**< Comment for debugging */ - H5L_create_func_t create_func; /**< Callback during link creation */ - H5L_move_func_t move_func; /**< Callback after moving link */ - H5L_copy_func_t copy_func; /**< Callback after copying link */ - H5L_traverse_func_t trav_func; /**< Callback during link traversal */ - H5L_delete_func_t del_func; /**< Callback for link deletion */ - H5L_query_func_t query_func; /**< Callback for queries */ -} H5L_class_t; -//! - /** * \brief Prototype for H5Literate2(), H5Literate_by_name2() operator * @@ -1250,179 +1186,6 @@ H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t /** * \ingroup H5LA * - * \brief Registers a user-defined link class or changes behavior of an - * existing class - * - * \param[in] cls Pointer to a buffer containing the struct describing the - * user-defined link class - * - * \return \herr_t - * - * \details H5Lregister() registers a class of user-defined links, or changes - * the behavior of an existing class. - * - * \p cls is a pointer to a buffer containing a copy of the - * H5L_class_t struct. This struct is defined in H5Lpublic.h as - * follows: - * \snippet this H5L_class_t_snip - * - * The class definition passed with \p cls must include at least the - * following: - * \li An H5L_class_t version (which should be #H5L_LINK_CLASS_T_VERS) - * \li A link class identifier, \c class_id - * \li A traversal function, \c trav_func - * - * Remaining \c struct members are optional and may be passed as NULL. - * - * The link class passed in \c class_id must be in the user-definable - * range between #H5L_TYPE_UD_MIN and #H5L_TYPE_UD_MAX - * (see the table below) and will override - * any existing link class with that identifier. - * - * As distributed, valid values of \c class_id used in HDF5 include - * the following (defined in H5Lpublic.h): - * \link_types - * - * The hard and soft link class identifiers cannot be modified or - * reassigned, but the external link class is implemented as an - * example in the user-definable link class identifier range. - * H5Lregister() is used to register additional link classes. It could - * also be used to modify the behavior of the external link class, - * though that is not recommended. - * - * The following table summarizes existing link types and values and - * the reserved and user-definable link class identifier value ranges. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Link class identifier or Value rangeDescriptionLink class or label
    0 to 63Reserved range
    64 to 255User-definable range
    64Minimum user-defined value#H5L_TYPE_UD_MIN
    64External link#H5L_TYPE_EXTERNAL
    255Maximum user-defined value#H5L_TYPE_UD_MAX
    255Maximum value#H5L_TYPE_MAX
    -1Error#H5L_TYPE_ERROR
    - * - * Note that HDF5 internally registers user-defined link classes only - * by the numeric value of the link class identifier. An application, - * on the other hand, will generally use a name for a user-defined - * class, if for no other purpose than as a variable name. Assume, - * for example, that a complex link type is registered with the link - * class identifier 73 and that the code includes the following - * assignment: - * \code - * H5L_TYPE_COMPLEX_A = 73 - * \endcode - * The application can refer to the link class with a term, - * \c H5L_TYPE_COMPLEX_A, that conveys meaning to a human reviewing - * the code, while HDF5 recognizes it by the more cryptic numeric - * identifier, 73. - * - * \attention Important details and considerations include the following: - * \li If you plan to distribute files or software with a - * user-defined link class, please contact the Help Desk at - * The HDF Group to help prevent collisions between \c class_id - * values. See below. - * \li As distributed with HDF5, the external link class is - * implemented as an example of a user-defined link class with - * #H5L_TYPE_EXTERNAL equal to #H5L_TYPE_UD_MIN. \c class_id in - * the H5L_class_t \c struct must not equal #H5L_TYPE_UD_MIN - * unless you intend to overwrite or modify the behavior of - * external links. - * \li H5Lregister() can be used only with link class identifiers - * in the user-definable range (see table above). - * \li The hard and soft links defined by the HDF5 library, - * #H5L_TYPE_HARD and #H5L_TYPE_SOFT, reside in the reserved - * range below #H5L_TYPE_UD_MIN and cannot be redefined or - * modified. - * \li H5Lis_registered() can be used to determine whether a desired - * link class identifier is available. \Emph{Note that this - * function will tell you only whether the link class identifier - * has been registered with the installed copy of HDF5; it - * cannot tell you whether the link class has been registered - * with The HDF Group.} - * \li #H5L_TYPE_MAX is the maximum allowed value for a link type - * identifier. - * \li #H5L_TYPE_UD_MIN equals #H5L_TYPE_EXTERNAL. - * \li #H5L_TYPE_UD_MAX equals #H5L_TYPE_MAX. - * \li #H5L_TYPE_ERROR indicates that an error has occurred. - * - * \note \Bold{Registration with The HDF Group:}\n - * There are sometimes reasons to take a broader approach to registering - * a user-defined link class than just invoking H5Lregister(). For - * example: - * \li A user-defined link class is intended for use across an - * organization, among collaborators, or across a community of users. - * \li An application or library overlying HDF5 invokes a user-defined - * link class that must be shipped with the software. - * \li Files are distributed that make use of a user-defined link class. - * \li Or simply, a specific user-defined link class is thought to be - * widely useful. - * - * In such cases, you are encouraged to register that link class with - * The HDF Group's Helpdesk. The HDF Group maintains a registry of known - * user-defined link classes and tracks the selected link class - * identifiers. This registry is intended to reduce the risk of - * collisions between \c class_id values and to help coordinate the use - * of specialized link classes. - * - * \since 1.8.0 - * - */ -H5_DLL herr_t H5Lregister(const H5L_class_t *cls); -/** - * \ingroup H5LA - * - * \brief Unregisters a class of user-defined links - * - * \param[in] id User-defined link class identifier - * - * \return \herr_t - * - * \details H5Lunregister() unregisters a class of user-defined links, - * preventing them from being traversed, queried, moved, etc. - * - * \note A link class can be re-registered using H5Lregister(). - * - * \since 1.8.0 - * - */ -H5_DLL herr_t H5Lunregister(H5L_type_t id); -/** - * \ingroup H5LA - * * \brief Determines whether a class of user-defined links is registered * * \param[in] id User-defined link class identifier @@ -1647,9 +1410,6 @@ H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hi /* Macros */ -/* Previous versions of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS_0 0 - /* Typedefs */ //! @@ -1668,23 +1428,6 @@ typedef struct { } H5L_info1_t; //! -/** Callback during link traversal */ -typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata, - size_t lnkdata_size, hid_t lapl_id); - -/** User-defined link types */ -typedef struct { - int version; /**< Version number of this struct */ - H5L_type_t id; /**< Link type ID */ - const char * comment; /**< Comment for debugging */ - H5L_create_func_t create_func; /**< Callback during link creation */ - H5L_move_func_t move_func; /**< Callback after moving link */ - H5L_copy_func_t copy_func; /**< Callback after copying link */ - H5L_traverse_0_func_t trav_func; /**< Callback during link traversal */ - H5L_delete_func_t del_func; /**< Callback for link deletion */ - H5L_query_func_t query_func; /**< Callback for queries */ -} H5L_class_0_t; - /** Prototype for H5Literate1() / H5Literate_by_name1() operator */ //! typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, void *op_data); diff --git a/src/H5M.c b/src/H5M.c index 552d3fc..c7d1bc9 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.create.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,23 @@ 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.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 +1412,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 +1443,25 @@ 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.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 +1485,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 +1510,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 17301f7..d1809ca 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -2323,15 +2323,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 */ @@ -2340,9 +2340,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); @@ -2404,7 +2404,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 */ @@ -2412,7 +2412,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], §_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 */ @@ -2421,13 +2421,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 292e85c..65e6e94 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/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..b3a0903 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); //! +/* 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 */ /********************/ diff --git a/src/H5O.c b/src/H5O.c index 4876bb0..a1c9c2d 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") @@ -448,6 +448,7 @@ H5O__copy_api_common(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, c /* Set the LCPL for the API context */ H5CX_set_lcpl(lcpl_id); + /* Setup and check args */ if (H5VL_setup_loc_args(src_loc_id, &vol_obj1, &loc_params1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments") @@ -616,19 +617,23 @@ 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 - /* Check args */ - + /* Setup and check args */ 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,19 +723,23 @@ 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 - /* Check args */ - + /* Setup and check args */ 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: @@ -829,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); @@ -864,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: @@ -923,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); @@ -941,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: @@ -973,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); @@ -991,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: @@ -1016,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); @@ -1043,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() */ @@ -1067,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); @@ -1088,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: @@ -1114,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 @@ -1127,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: @@ -1230,9 +1277,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); @@ -1253,6 +1301,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; @@ -1265,9 +1314,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: @@ -1289,9 +1342,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); @@ -1310,9 +1365,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: @@ -1335,9 +1396,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); @@ -1366,9 +1429,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: @@ -1393,9 +1462,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); @@ -1416,6 +1487,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; @@ -1428,9 +1500,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: @@ -1457,9 +1535,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); @@ -1476,9 +1556,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: @@ -1505,9 +1590,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); @@ -1530,9 +1617,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: @@ -1558,9 +1650,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); @@ -1573,11 +1668,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() */ @@ -1601,9 +1706,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); @@ -1626,11 +1734,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() */ @@ -1674,9 +1792,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); @@ -1699,10 +1818,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: @@ -1748,9 +1874,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); @@ -1783,10 +1910,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: @@ -1794,23 +1928,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: @@ -1836,14 +1970,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 @@ -1871,7 +2004,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) @@ -1903,7 +2036,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 */ @@ -1943,7 +2076,7 @@ done: } /* end H5Oclose_async() */ /*------------------------------------------------------------------------- - * Function: H5O_disable_mdc_flushes + * Function: H5O__disable_mdc_flushes * * Purpose: Private version of the metadata cache cork function. * @@ -1952,18 +2085,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 @@ -1982,9 +2115,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); @@ -2001,9 +2135,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: @@ -2011,7 +2149,7 @@ done: } /* H5Odisable_mdc_flushes() */ /*------------------------------------------------------------------------- - * Function: H5O_enable_mdc_flushes + * Function: H5O__enable_mdc_flushes * * Purpose: Private version of the metadata cache uncork function. * @@ -2020,18 +2158,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 @@ -2050,9 +2188,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); @@ -2069,9 +2208,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: @@ -2079,7 +2222,7 @@ done: } /* H5Oenable_mdc_flushes() */ /*------------------------------------------------------------------------- - * Function: H5O_are_mdc_flushes_disabled + * Function: H5O__are_mdc_flushes_disabled * * Purpose: Private version of cork status getter. * @@ -2088,11 +2231,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); @@ -2101,7 +2244,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 @@ -2123,9 +2266,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); @@ -2146,9 +2291,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/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 ea25550..801ef01 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -48,7 +48,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 */ @@ -193,7 +193,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) +H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid) { H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */ hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */ @@ -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; @@ -217,7 +217,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; /* Save important datatype state */ @@ -239,11 +239,11 @@ 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 */ - if ((H5O_refresh_metadata_reopen(oid, &obj_loc, connector, FALSE)) < 0) + if (H5O_refresh_metadata_reopen(oid, &obj_loc, connector, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Restore the number of references on the VOL connector */ @@ -258,7 +258,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() */ @@ -283,8 +283,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 */ @@ -305,28 +306,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/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 65f0308..050bd49 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -981,15 +981,10 @@ 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(H5O_loc_t *oloc, hid_t oid); H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr); -/* 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); - /* Object copying routines */ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, H5O_copy_t *cpy_info, hbool_t inc_depth, H5O_type_t *obj_type, diff --git a/src/H5PLextern.h b/src/H5PLextern.h index 7f3df5e..5042069 100644 --- a/src/H5PLextern.h +++ b/src/H5PLextern.h @@ -17,8 +17,8 @@ #ifndef H5PLextern_H #define H5PLextern_H -/* Include HDF5 header */ -#include "hdf5.h" +/* Include package's public header */ +#include "H5PLpublic.h" /* plugins always export */ #if defined(_MSC_VER) /* MSVC Compiler Case */ diff --git a/src/H5PLint.c b/src/H5PLint.c index cf6135d..6bb8404 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: diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c index 2ec0845..4f5c0ce 100644 --- a/src/H5PLplugin_cache.c +++ b/src/H5PLplugin_cache.c @@ -263,33 +263,59 @@ 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) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index de67dfd..046b046 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -159,6 +159,16 @@ #define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy #define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp #define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close +/* Definitions for dataset I/O selection property */ +#define H5D_XFER_DSET_IO_SEL_SIZE sizeof(H5S_t *) +#define H5D_XFER_DSET_IO_SEL_DEF NULL +#define H5D_XFER_DSET_IO_SEL_COPY H5P__dxfr_dset_io_hyp_sel_copy +#define H5D_XFER_DSET_IO_SEL_CMP H5P__dxfr_dset_io_hyp_sel_cmp +#define H5D_XFER_DSET_IO_SEL_CLOSE H5P__dxfr_dset_io_hyp_sel_close +#ifdef QAK +#define H5D_XFER_DSET_IO_SEL_ENC H5P__dxfr_edc_enc +#define H5D_XFER_DSET_IO_SEL_DEC H5P__dxfr_edc_dec +#endif /* QAK */ /******************/ /* Local Typedefs */ @@ -196,6 +206,9 @@ static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char *name, size_t size, static herr_t H5P__dxfr_xform_copy(const char *name, size_t size, void *value); static int H5P__dxfr_xform_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P__dxfr_xform_close(const char *name, size_t size, void *value); +static herr_t H5P__dxfr_dset_io_hyp_sel_copy(const char *name, size_t size, void *value); +static int H5P__dxfr_dset_io_hyp_sel_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__dxfr_dset_io_hyp_sel_close(const char *name, size_t size, void *value); /*********************/ /* Package Variables */ @@ -262,7 +275,9 @@ static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* Default static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */ static const H5T_conv_cb_t H5D_def_conv_cb_g = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */ -static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */ +static const void * H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */ +static const H5S_t *H5D_def_dset_io_sel_g = + H5D_XFER_DSET_IO_SEL_DEF; /* Default value for dataset I/O selection */ /*------------------------------------------------------------------------- * Function: H5P__dxfr_reg_prop @@ -420,6 +435,13 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the dataset I/O selection property */ + if (H5P__register_real(pclass, H5D_XFER_DSET_IO_SEL_NAME, H5D_XFER_DSET_IO_SEL_SIZE, + &H5D_def_dset_io_sel_g, NULL, NULL, NULL, NULL, NULL, NULL, + H5D_XFER_DSET_IO_SEL_COPY, H5D_XFER_DSET_IO_SEL_CMP, + H5D_XFER_DSET_IO_SEL_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ @@ -894,7 +916,7 @@ H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t H5_ATTR_UNU done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dxfr_xform_copy() */ +} /* end H5P__dxfr_xform_cmp() */ /*------------------------------------------------------------------------- * Function: H5P__dxfr_xform_close @@ -965,7 +987,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) /* Create data transform info from expression */ if (NULL == (data_xform_prop = H5Z_xform_create(expression))) - HGOTO_ERROR(H5E_PLINE, H5E_NOSPACE, FAIL, "unable to create data transform info") + HGOTO_ERROR(H5E_PLIST, H5E_NOSPACE, FAIL, "unable to create data transform info") /* Update property list (takes ownership of transform) */ if (H5P_poke(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) @@ -974,7 +996,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) done: if (ret_value < 0) if (data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") + HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") FUNC_LEAVE_API(ret_value) } /* end H5Pset_data_transform() */ @@ -2109,3 +2131,251 @@ H5P__dxfr_edc_dec(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__dxfr_edc_dec() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_dset_io_hyp_sel_copy + * + * Purpose: Creates a copy of the dataset I/O selection. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Sunday, January 31, 2021 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_dset_io_hyp_sel_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + H5S_t *orig_space = *(H5S_t **)value; /* Original dataspace for property */ + H5S_t *new_space = NULL; /* New dataspace for property */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* If there's a dataspace I/O selection set, copy it */ + if (orig_space) { + /* Make copy of dataspace */ + if (NULL == (new_space = H5S_copy(orig_space, FALSE, TRUE))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the dataset I/O selection") + + /* Set new value for property */ + *(void **)value = new_space; + } /* end if */ + +done: + /* Cleanup on error */ + if (ret_value < 0) + if (new_space && H5S_close(new_space) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_dset_io_hyp_sel_copy() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_dset_io_hyp_sel_cmp + * + * Purpose: Compare two dataset I/O selections. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Sunday, January 31, 2021 + * + *------------------------------------------------------------------------- + */ +static int +H5P__dxfr_dset_io_hyp_sel_cmp(const void *_space1, const void *_space2, size_t H5_ATTR_UNUSED size) +{ + const H5S_t *const *space1 = (const H5S_t *const *)_space1; /* Create local aliases for values */ + const H5S_t *const *space2 = (const H5S_t *const *)_space2; /* Create local aliases for values */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(space1); + HDassert(space1); + HDassert(size == sizeof(H5S_t *)); + + /* Check for a property being set */ + if (*space1 == NULL && *space2 != NULL) + HGOTO_DONE(-1); + if (*space1 != NULL && *space2 == NULL) + HGOTO_DONE(1); + + if (*space1) { + HDassert(*space2); + + /* Compare the extents of the dataspaces */ + /* (Error & not-equal count the same) */ + if (TRUE != H5S_extent_equal(*space1, *space2)) + HGOTO_DONE(-1); + + /* Compare the selection "shape" of the dataspaces */ + /* (Error & not-equal count the same) */ + if (TRUE != H5S_select_shape_same(*space1, *space2)) + HGOTO_DONE(-1); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_dset_io_hyp_sel_cmp() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_dset_io_hyp_sel_close + * + * Purpose: Frees resources for dataset I/O selection + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Sunday, January 31, 2021 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_dset_io_hyp_sel_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *_value) +{ + H5S_t *space = *(H5S_t **)_value; /* Dataspace for property */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Release any dataspace */ + if (space && H5S_close(space) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_dset_io_hyp_sel_close() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_dataset_io_hyperslab_selection + * + * Purpose: 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. + * + * 'rank' is the dimensionality of the selection and determines + * the size of the 'start', 'stride', 'count', and 'block' arrays. + * 'rank' must be between 1 and H5S_MAX_RANK, inclusive. + * + * The 'op', 'start', 'stride', 'count', and 'block' parameters + * behave identically to their behavior for H5Sselect_hyperslab(), + * please see the documentation for that routine for details about + * their use. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, January 30, 2021 + * + *------------------------------------------------------------------------- + */ +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 */ + 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 */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "iIuSs*h*h*h*h", plist_id, rank, op, start, stride, count, block); + + /* Check arguments */ + if (rank < 1 || rank > H5S_MAX_RANK) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank value: %u", rank) + if (!(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID)) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + if (start == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'count' pointer is NULL") + if (stride != NULL) { + unsigned u; /* Local index variable */ + + /* Check for 0-sized strides */ + for (u = 0; u < rank; u++) + if (stride[u] == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value - stride[%u]==0", u) + } /* end if */ + if (count == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'start' pointer is NULL") + /* block is allowed to be NULL, and will be assumed to be all '1's when NULL */ + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + + /* See if a dataset I/O selection is already set, and free it if it is */ + if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting dataset I/O selection") + + /* Check for operation on existing dataspace selection */ + if (NULL != space) { + int sndims; /* Rank of existing dataspace */ + + /* Get dimensions from current dataspace for selection */ + if ((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection's dataspace rank") + + /* Check for different # of dimensions */ + if ((unsigned)sndims != rank) { + /* Set up new dataspace for 'set' operation, otherwise fail */ + if (op == H5S_SELECT_SET) { + /* Close previous dataspace */ + if (H5S_close(space) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + + /* Reset 'space' pointer, so it's re-created */ + space = NULL; + + /* Set flag to reset property list on error */ + reset_prop_on_error = TRUE; + } /* end if */ + else + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "different rank for previous and new selections") + } /* end if */ + } /* end if */ + + /* Check for first time called */ + if (NULL == space) { + hsize_t dims[H5S_MAX_RANK]; /* Dimensions for new dataspace */ + unsigned u; /* Local index variable */ + + /* Initialize dimensions to largest possible actual size */ + for (u = 0; u < rank; u++) + dims[u] = (H5S_UNLIMITED - 1); + + /* Create dataspace of the correct dimensionality, with maximum dimensions */ + if (NULL == (space = H5S_create_simple(rank, dims, NULL))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create dataspace for selection") + space_created = TRUE; + } /* end if */ + + /* Set selection for dataspace */ + if (H5S_select_hyperslab(space, op, start, stride, count, block) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSELECT, FAIL, "can't create selection") + + /* Update property list (takes ownership of dataspace, if new) */ + if (H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection") + space_created = FALSE; /* Reset now that property owns the dataspace */ + +done: + /* Cleanup on failure */ + if (ret_value < 0) { + if (reset_prop_on_error && 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") + } /* end if */ + + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_dataset_io_hyperslab_selection() */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 49cc27e..a8e0d8e 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5703,6 +5703,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 dd1ad9b..9530d87 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -4878,7 +4878,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/H5Ppublic.h b/src/H5Ppublic.h index 3d6968e..10609b2 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 */ @@ -5206,6 +5207,34 @@ 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 @@ -7999,6 +8028,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 \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 */ /** diff --git a/src/H5R.c b/src/H5R.c index f23b993..5fa2a8b 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..31fa23a 100644 --- a/src/H5RS.c +++ b/src/H5RS.c @@ -698,7 +698,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 +706,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 +715,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..e1a5dcd 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) diff --git a/src/H5S.c b/src/H5S.c index 747d297..13d32cf 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -84,7 +84,7 @@ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK); static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ H5I_DATASPACE, /* ID class value */ 0, /* Class flags */ - 2, /* # of reserved IDs for class */ + 3, /* # of reserved IDs for class */ (H5I_free_t)H5S__close_cb /* Callback routine for closing objects of this class */ }}; @@ -277,55 +277,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_get_validiated_dataspace - PURPOSE - Get a pointer to a validated H5S_t pointer - USAGE - H5S_t *H5S_get_validated_space(dataspace_id, space) - hid_t space_id; IN: The ID of the dataspace - const H5S_t * space; OUT: A pointer to the dataspace - RETURNS - SUCCEED/FAIL - DESCRIPTION - Gets a pointer to a dataspace struct after validating it. The pointer - can be NULL (if the ID is H5S_ALL, for example). - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -herr_t -H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(space); - - /* Check for invalid ID */ - if (space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)") - - /* No special dataspace struct for H5S_ALL */ - if (H5S_ALL == space_id) - *space = NULL; - else { - /* Get the dataspace pointer */ - if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID") - - /* Check for valid selection */ - if (H5S_SELECT_VALID(*space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent") - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_get_validated_dataspace() */ - -/*-------------------------------------------------------------------------- - NAME H5S_create PURPOSE Create empty, typed dataspace diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 56c1646..51a98a6 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -217,7 +217,6 @@ H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size); H5_DLL herr_t H5S_set_extent_real(H5S_t *space, const hsize_t *size); H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max); H5_DLL H5S_t *H5S_create(H5S_class_t type); -H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space /*out*/); H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]); H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds); H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc); diff --git a/src/H5Spublic.h b/src/H5Spublic.h index c2c0aef..7962035 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -21,8 +21,12 @@ #include "H5public.h" #include "H5Ipublic.h" -/* Define atomic datatypes */ -#define H5S_ALL 0 /* (hid_t) */ +/* Define special dataspaces for dataset I/O operations */ +#define H5S_ALL 0 /* (hid_t) */ +#define H5S_BLOCK 1 /* (hid_t) */ +#define H5S_PLIST 2 /* (hid_t) */ + +/* Define value for 'unlimited' dimensions */ #define H5S_UNLIMITED HSIZE_UNDEF /* Define user-level maximum number of dimensions */ diff --git a/src/H5T.c b/src/H5T.c index 532feac..74b7655 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1892,19 +1892,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/H5TSdevelop.h b/src/H5TSdevelop.h new file mode 100644 index 0000000..9e8f718 --- /dev/null +++ b/src/H5TSdevelop.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://www.hdfgroup.org/licenses. * + * 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 H5TS (threadsafety) developer + * support routines. + */ + +#ifndef H5TSdevelop_H +#define H5TSdevelop_H + +/*****************/ +/* Public Macros */ +/*****************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* HDF5 global library lock routines */ +H5_DLL herr_t H5TSmutex_acquire(unsigned int lock_count, hbool_t *acquired); +H5_DLL herr_t H5TSmutex_release(unsigned int *lock_count); +H5_DLL herr_t H5TSmutex_get_attempt_count(unsigned int *count); + +#ifdef __cplusplus +} +#endif + +#endif /* H5TSdevelop_H */ diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index 6f9f1c0..3150f59 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -25,8 +25,8 @@ #define H5TSprivate_H_ #ifdef H5_HAVE_THREADSAFE -/* Public headers needed by this file */ -#include "H5TSpublic.h" /* Public API prototypes */ +/* Include package's public headers */ +#include "H5TSdevelop.h" #ifdef H5_HAVE_WIN_THREADS diff --git a/src/H5TSpublic.h b/src/H5TSpublic.h deleted file mode 100644 index 41213f9..0000000 --- a/src/H5TSpublic.h +++ /dev/null @@ -1,52 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * 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 H5TS (threadsafety) module. - */ - -#ifndef H5TSpublic_H -#define H5TSpublic_H - -/* Public headers needed by this file */ -#include "H5public.h" /* Generic Functions */ - -/*****************/ -/* Public Macros */ -/*****************/ - -/*******************/ -/* Public Typedefs */ -/*******************/ - -/********************/ -/* Public Variables */ -/********************/ - -/*********************/ -/* Public Prototypes */ -/*********************/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* HDF5 global library lock routines */ -H5_DLL herr_t H5TSmutex_acquire(unsigned int lock_count, hbool_t *acquired); -H5_DLL herr_t H5TSmutex_release(unsigned int *lock_count); -H5_DLL herr_t H5TSmutex_get_attempt_count(unsigned int *count); - -#ifdef __cplusplus -} -#endif - -#endif /* H5TSpublic_H */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index d214ca1..451a1a8 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/H5Tdevelop.h b/src/H5Tdevelop.h new file mode 100644 index 0000000..e642d7c --- /dev/null +++ b/src/H5Tdevelop.h @@ -0,0 +1,227 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 H5T (datatype) developer + * support routines. + */ + +#ifndef _H5Tdevelop_H +#define _H5Tdevelop_H + +/* Include package's public header */ +#include "H5Tpublic.h" + +/*****************/ +/* Public Macros */ +/*****************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/** + * Commands sent to conversion functions + */ +typedef enum H5T_cmd_t { + H5T_CONV_INIT = 0, /**< query and/or initialize private data */ + H5T_CONV_CONV = 1, /**< convert data from source to dest datatype */ + H5T_CONV_FREE = 2 /**< function is being removed from path */ +} H5T_cmd_t; + +/** + * How is the `bkg' buffer used by the conversion function? + */ +typedef enum H5T_bkg_t { + H5T_BKG_NO = 0, /**< background buffer is not needed, send NULL */ + H5T_BKG_TEMP = 1, /**< bkg buffer used as temp storage only */ + H5T_BKG_YES = 2 /**< init bkg buf with data before conversion */ +} H5T_bkg_t; + +/** + * Type conversion client data + */ +//! +typedef struct H5T_cdata_t { + H5T_cmd_t command; /**< what should the conversion function do? */ + H5T_bkg_t need_bkg; /**< is the background buffer needed? */ + hbool_t recalc; /**< recalculate private data */ + void * priv; /**< private data */ +} H5T_cdata_t; +//! + +/** + * Conversion function persistence + */ +typedef enum H5T_pers_t { + H5T_PERS_DONTCARE = -1, /**< wild card */ + H5T_PERS_HARD = 0, /**< hard conversion function */ + H5T_PERS_SOFT = 1 /**< soft conversion function */ +} H5T_pers_t; + +/** + * All datatype conversion functions are... + */ +//! +typedef herr_t (*H5T_conv_t)(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +//! + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \ingroup CONV + * + * \brief Registers a datatype conversion function + * + * \param[in] pers Conversion function type + * \param[in] name Name displayed in diagnostic output + * \type_id{src_id} of source datatype + * \type_id{dst_id} of destination datatype + * \param[in] func Function to convert between source and destination datatypes + * + * \return \herr_t + * + * \details H5Tregister() registers a hard or soft conversion function for a + * datatype conversion path. The parameter \p pers indicates whether a + * conversion function is hard (#H5T_PERS_HARD) or soft + * (#H5T_PERS_SOFT). User-defined functions employing compiler casting + * are designated as \Emph{hard}; other user-defined conversion + * functions registered with the HDF5 library (with H5Tregister() ) + * are designated as \Emph{soft}. The HDF5 library also has its own + * hard and soft conversion functions. + * + * A conversion path can have only one hard function. When type is + * #H5T_PERS_HARD, \p func replaces any previous hard function. + * + * When type is #H5T_PERS_SOFT, H5Tregister() adds the function to the + * end of the master soft list and replaces the soft function in all + * applicable existing conversion paths. Soft functions are used when + * determining which conversion function is appropriate for this path. + * + * The \p name is used only for debugging and should be a short + * identifier for the function. + * + * The path is specified by the source and destination datatypes \p + * src_id and \p dst_id. For soft conversion functions, only the class + * of these types is important. + * + * The type of the conversion function pointer is declared as: + * \snippet this H5T_conv_t_snip + * + * The \ref H5T_cdata_t \c struct is declared as: + * \snippet this H5T_cdata_t_snip + * + * \since 1.6.3 The following change occurred in the \ref H5T_conv_t function: + * the \c nelmts parameter type changed to size_t. + * + */ +H5_DLL herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func); +/** + * \ingroup CONV + * + * \brief Removes a conversion function + * + * \param[in] pers Conversion function type + * \param[in] name Name displayed in diagnostic output + * \type_id{src_id} of source datatype + * \type_id{dst_id} of destination datatype + * \param[in] func Function to convert between source and destination datatypes + * + * \return \herr_t + * + * \details H5Tunregister() removes a conversion function matching criteria + * such as soft or hard conversion, source and destination types, and + * the conversion function. + * + * If a user is trying to remove a conversion function he registered, + * all parameters can be used. If he is trying to remove a library’s + * default conversion function, there is no guarantee the \p name and + * \p func parameters will match the user’s chosen values. Passing in + * some values may cause this function to fail. A good practice is to + * pass in NULL as their values. + * + * All parameters are optional. The missing parameters will be used to + * generalize the search criteria. + * + * The conversion function pointer type declaration is described in + * H5Tregister(). + * + * \version 1.6.3 The following change occurred in the \ref H5T_conv_t function: + * the \c nelmts parameter type changed to size_t. + * + */ +H5_DLL herr_t H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func); +/** + * \ingroup CONV + * + * \brief Finds a conversion function + * + * \type_id{src_id} of source datatype + * \type_id{dst_id} of destination datatype + * \param[out] pcdata Pointer to type conversion data + * + * \return Returns a pointer to a suitable conversion function if successful. + * Otherwise returns NULL. + * + * \details H5Tfind() finds a conversion function that can handle a conversion + * from type \p src_id to type \p dst_id. The \p pcdata argument is a + * pointer to a pointer to type conversion data which was created and + * initialized by the soft type conversion function of this path when + * the conversion function was installed on the path. + * + */ +H5_DLL H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata); +/** + * \ingroup CONV + * + * \brief Check whether the library’s default conversion is hard conversion + * + * \type_id{src_id} of source datatype + * \type_id{dst_id} of destination datatype + * + * \return \htri_t + * + * \details H5Tcompiler_conv() determines whether the library’s conversion + * function from type \p src_id to type \p dst_id is a compiler (hard) + * conversion or not. A compiler conversion uses compiler’s casting; a + * library (soft) conversion uses the library’s own conversion + * function. + * + * \since 1.8.0 + * + */ +H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id); + +#ifdef __cplusplus +} +#endif + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +#endif /* _H5Tdevelop_H */ diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 9ee0d04..6624096 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -20,8 +20,9 @@ /* Early typedefs to avoid circular dependencies */ typedef struct H5T_t H5T_t; -/* Get package's public header */ +/* Include package's public headers */ #include "H5Tpublic.h" +#include "H5Tdevelop.h" /* Other public headers needed by this file */ #include "H5MMpublic.h" /* Memory management */ @@ -151,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 70a119d..bb5b0ef 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -153,52 +153,13 @@ typedef enum H5T_pad_t { //! /** - * Commands sent to conversion functions - */ -typedef enum H5T_cmd_t { - H5T_CONV_INIT = 0, /**< query and/or initialize private data */ - H5T_CONV_CONV = 1, /**< convert data from source to dest datatype */ - H5T_CONV_FREE = 2 /**< function is being removed from path */ -} H5T_cmd_t; - -/** - * How is the `bkg' buffer used by the conversion function? - */ -typedef enum H5T_bkg_t { - H5T_BKG_NO = 0, /**< background buffer is not needed, send NULL */ - H5T_BKG_TEMP = 1, /**< bkg buffer used as temp storage only */ - H5T_BKG_YES = 2 /**< init bkg buf with data before conversion */ -} H5T_bkg_t; - -/** - * Type conversion client data - */ -//! -typedef struct H5T_cdata_t { - H5T_cmd_t command; /**< what should the conversion function do? */ - H5T_bkg_t need_bkg; /**< is the background buffer needed? */ - hbool_t recalc; /**< recalculate private data */ - void * priv; /**< private data */ -} H5T_cdata_t; -//! - -/** - * Conversion function persistence - */ -typedef enum H5T_pers_t { - H5T_PERS_DONTCARE = -1, /**< wild card */ - H5T_PERS_HARD = 0, /**< hard conversion function */ - H5T_PERS_SOFT = 1 /**< soft conversion function */ -} H5T_pers_t; - -/** * The order to retrieve atomic native datatype */ //! typedef enum H5T_direction_t { - H5T_DIR_DEFAULT = 0, /**< default direction is inscendent */ - H5T_DIR_ASCEND = 1, /**< in inscendent order */ - H5T_DIR_DESCEND = 2 /**< in descendent order */ + H5T_DIR_DEFAULT = 0, /**< default direction is ascending */ + H5T_DIR_ASCEND = 1, /**< in ascending order */ + H5T_DIR_DESCEND = 2 /**< in descending order */ } H5T_direction_t; //! @@ -258,14 +219,6 @@ typedef struct { extern "C" { #endif -/** - * All datatype conversion functions are... - */ -//! -typedef herr_t (*H5T_conv_t)(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); -//! - //! /** * \brief Exception handler. @@ -279,7 +232,7 @@ typedef herr_t (*H5T_conv_t)(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, siz * \returns Valid callback function return values are #H5T_CONV_ABORT, * #H5T_CONV_UNHANDLED and #H5T_CONV_HANDLED. * - * \details If an exception like overflow happenes during conversion, this + * \details If an exception like overflow happens during conversion, this * function is called if it's registered through H5Pset_type_conv_cb(). * */ @@ -2710,130 +2663,6 @@ H5_DLL herr_t H5Tset_cset(hid_t type_id, H5T_cset_t cset); */ H5_DLL herr_t H5Tset_strpad(hid_t type_id, H5T_str_t strpad); -/* Type conversion database */ -/** - * \ingroup CONV - * - * \brief Registers a datatype conversion function - * - * \param[in] pers Conversion function type - * \param[in] name Name displayed in diagnostic output - * \type_id{src_id} of source datatype - * \type_id{dst_id} of destination datatype - * \param[in] func Function to convert between source and destination datatypes - * - * \return \herr_t - * - * \details H5Tregister() registers a hard or soft conversion function for a - * datatype conversion path. The parameter \p pers indicates whether a - * conversion function is hard (#H5T_PERS_HARD) or soft - * (#H5T_PERS_SOFT). User-defined functions employing compiler casting - * are designated as \Emph{hard}; other user-defined conversion - * functions registered with the HDF5 library (with H5Tregister() ) - * are designated as \Emph{soft}. The HDF5 library also has its own - * hard and soft conversion functions. - * - * A conversion path can have only one hard function. When type is - * #H5T_PERS_HARD, \p func replaces any previous hard function. - * - * When type is #H5T_PERS_SOFT, H5Tregister() adds the function to the - * end of the master soft list and replaces the soft function in all - * applicable existing conversion paths. Soft functions are used when - * determining which conversion function is appropriate for this path. - * - * The \p name is used only for debugging and should be a short - * identifier for the function. - * - * The path is specified by the source and destination datatypes \p - * src_id and \p dst_id. For soft conversion functions, only the class - * of these types is important. - * - * The type of the conversion function pointer is declared as: - * \snippet this H5T_conv_t_snip - * - * The \ref H5T_cdata_t \c struct is declared as: - * \snippet this H5T_cdata_t_snip - * - * \since 1.6.3 The following change occurred in the \ref H5T_conv_t function: - * the \c nelmts parameter type changed to size_t. - * - */ -H5_DLL herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func); -/** - * \ingroup CONV - * - * \brief Removes a conversion function - * - * \param[in] pers Conversion function type - * \param[in] name Name displayed in diagnostic output - * \type_id{src_id} of source datatype - * \type_id{dst_id} of destination datatype - * \param[in] func Function to convert between source and destination datatypes - * - * \return \herr_t - * - * \details H5Tunregister() removes a conversion function matching criteria - * such as soft or hard conversion, source and destination types, and - * the conversion function. - * - * If a user is trying to remove a conversion function he registered, - * all parameters can be used. If he is trying to remove a library’s - * default conversion function, there is no guarantee the \p name and - * \p func parameters will match the user’s chosen values. Passing in - * some values may cause this function to fail. A good practice is to - * pass in NULL as their values. - * - * All parameters are optional. The missing parameters will be used to - * generalize the search criteria. - * - * The conversion function pointer type declaration is described in - * H5Tregister(). - * - * \version 1.6.3 The following change occurred in the \ref H5T_conv_t function: - * the \c nelmts parameter type changed to size_t. - * - */ -H5_DLL herr_t H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func); -/** - * \ingroup CONV - * - * \brief Finds a conversion function - * - * \type_id{src_id} of source datatype - * \type_id{dst_id} of destination datatype - * \param[out] pcdata Pointer to type conversion data - * - * \return Returns a pointer to a suitable conversion function if successful. - * Otherwise returns NULL. - * - * \details H5Tfind() finds a conversion function that can handle a conversion - * from type \p src_id to type \p dst_id. The \p pcdata argument is a - * pointer to a pointer to type conversion data which was created and - * initialized by the soft type conversion function of this path when - * the conversion function was installed on the path. - * - */ -H5_DLL H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata); -/** - * \ingroup CONV - * - * \brief Check whether the library’s default conversion is hard conversion - * - * \type_id{src_id} of source datatype - * \type_id{dst_id} of destination datatype - * - * \return \htri_t - * - * \details H5Tcompiler_conv() determines whether the library’s conversion - * function from type \p src_id to type \p dst_id is a compiler (hard) - * conversion or not. A compiler conversion uses compiler’s casting; a - * library (soft) conversion uses the library’s own conversion - * function. - * - * \since 1.8.0 - * - */ -H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id); /** * -------------------------------------------------------------------------- * \ingroup CONV diff --git a/src/H5Tref.c b/src/H5Tref.c index 1114c25..cac8cf6 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) */ @@ -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; + /* 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(""); @@ -770,8 +821,11 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) /* Skip the size / header */ p_bg += (H5_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: @@ -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); + /* 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 */ 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..2cece6d 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -764,6 +764,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 +834,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 +855,7 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLreset_lib_state(void) +H5VLfinish_lib_state(void) { herr_t ret_value = SUCCEED; /* Return value */ @@ -831,12 +864,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 +944,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 02e0ee0..baedbf1 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -29,11 +29,13 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ +#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,15 @@ 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 */ 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,11 +3559,16 @@ 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; + /* 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; @@ -3428,7 +3576,7 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in * 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 == SUCCEED && is_accessible) { /* 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. @@ -3479,21 +3627,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 +3650,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 +3726,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 +3737,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 +3755,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 +3768,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 +3790,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 +3805,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 +3823,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 +3835,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 +3853,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 +3900,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 +3924,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 +3956,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 +3967,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 +3985,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 +3998,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 +4020,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 +4036,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 +4044,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 +4403,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 +4414,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 +4432,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 +4445,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 +4467,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 +4482,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 +4500,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 +4512,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 +4530,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 +4543,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 +4565,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 +4581,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 +4599,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 +4611,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 +4630,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 +4643,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 +4666,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 +4682,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 +4847,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 +4859,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 +4877,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 +4901,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 +4926,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 +5173,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 +5184,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 +5202,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 +5216,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 +5238,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 +5254,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 +5273,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 +5284,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 +5304,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 +5317,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 +5342,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 +5357,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 +5376,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 +5388,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 +5406,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 +5420,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 +5442,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 +5458,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 +5466,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 +5751,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 +5762,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 +5780,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 +5794,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 +5816,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 +5832,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 +5851,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 +5862,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 +5882,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 +5895,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 +5920,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 +5934,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 +5954,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 +5966,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 +5984,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 +5998,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 +6020,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 +6036,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 +6044,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 +6219,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 +6435,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 +6529,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 +6622,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 +6648,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 +6679,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 +6694,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 +6713,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 +6742,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 +6774,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 +6789,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 +6808,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 +6837,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 +6859,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 +6941,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 +7036,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 +7045,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 +7131,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 +7140,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 +7193,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 +7209,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 +7227,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 +7237,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 +7255,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 +7270,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 +7290,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 +7306,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 +7324,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 +7334,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 +7352,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 +7367,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 +7441,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 +7449,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 +7550,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 +7559,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 +7657,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 +7666,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 +7723,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 +7734,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 +7752,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 +7765,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 +7787,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 +7802,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; //! @@ -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 / + * + *--------------------------------------------------------------------------- + */ +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/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 4a46e9e..fe8ede2 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 */ /*****************/ @@ -39,21 +40,140 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS #define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ +/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro + * 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 /* H5Dget_offset */ +/* 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 @@ -85,9 +205,195 @@ #define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */ #define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */ #define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */ -#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */ -#define H5VL_NATIVE_FILE_POST_OPEN 28 /* Adjust file after open, with wrapping context */ +#ifdef H5_HAVE_PARALLEL +#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */ +#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */ +#endif /* H5_HAVE_PARALLEL */ +#define H5VL_NATIVE_FILE_POST_OPEN 28 /* Adjust file after open, with wrapping context */ +/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro + * 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_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 @@ -97,6 +403,36 @@ #define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */ #define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ +/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro + * 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 @@ -108,6 +444,47 @@ #define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 3 /* H5Oenable_mdc_flushes */ #define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 4 /* H5Oare_mdc_flushes_disabled */ #define H5VL_NATIVE_OBJECT_GET_NATIVE_INFO 5 /* H5Oget_native_info(_by_idx, _by_name) */ +/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro + * 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 7beb98f..834ae40 100644 --- a/src/H5VLnative_attr.c +++ b/src/H5VLnative_attr.c @@ -15,8 +15,15 @@ * */ +/****************/ +/* Module Setup */ +/****************/ + #define H5A_FRIEND /* Suppress error about including H5Apkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Apkg.h" /* Attributes */ #include "H5Eprivate.h" /* Error handling */ @@ -30,6 +37,30 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + /*------------------------------------------------------------------------- * Function: H5VL__native_attr_create * @@ -214,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; @@ -255,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 */ @@ -303,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 */ @@ -362,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; } @@ -388,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 */ @@ -400,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 @@ -449,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 @@ -510,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 21491e7..1375344 100644 --- a/src/H5VLnative_dataset.c +++ b/src/H5VLnative_dataset.c @@ -15,8 +15,15 @@ * */ +/****************/ +/* Module Setup */ +/****************/ + #define H5D_FRIEND /* Suppress error about including H5Dpkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Dpkg.h" /* Datasets */ @@ -30,6 +37,128 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Helper routines for read/write API calls */ +static herr_t H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t file_space_id, + hid_t mem_space_id, H5S_t **file_space, H5S_t **mem_space); + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_io_setup + * + * Purpose: Set up file and memory dataspaces for dataset I/O operation + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t file_space_id, hid_t mem_space_id, + H5S_t **file_space, H5S_t **mem_space) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(dset); + HDassert(file_space && NULL == *file_space); + HDassert(mem_space && NULL == *mem_space); + + /* Set up file dataspace */ + if (H5S_ALL == file_space_id) + /* Use dataspace for dataset */ + *file_space = dset->shared->space; + else if (H5S_BLOCK == file_space_id) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_BLOCK is not allowed for file dataspace") + else if (H5S_PLIST == file_space_id) { + H5P_genplist_t *plist; /* Property list pointer */ + H5S_t * space; /* Dataspace to hold selection */ + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_DATASET, H5E_BADID, FAIL, "bad dataset transfer property list") + + /* See if a dataset I/O selection is already set, and free it if it is */ + if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting dataset I/O selection") + + /* Use dataspace for dataset */ + *file_space = dset->shared->space; + + /* Copy, but share, selection from property list to dataset's dataspace */ + if (H5S_SELECT_COPY(*file_space, space, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataset I/O selection") + } /* end else-if */ + else { + /* Get the dataspace pointer */ + if (NULL == (*file_space = (H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID") + } /* end else */ + + /* Get dataspace for memory buffer */ + if (H5S_ALL == mem_space_id) + *mem_space = *file_space; + else if (H5S_BLOCK == mem_space_id) { + hsize_t nelmts; /* # of selected elements in file */ + + /* Get the # of elements selected */ + nelmts = H5S_GET_SELECT_NPOINTS(*file_space); + + /* Check for any elements */ + if (nelmts > 0) { + /* Create a 1-D dataspace of the same # of elements */ + if (NULL == (*mem_space = H5S_create_simple(1, &nelmts, NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create simple memory dataspace") + } /* end if */ + else { + /* Create a NULL dataspace of the same # of elements */ + if (NULL == (*mem_space = H5S_create(H5S_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create NULL memory dataspace") + } /* end else */ + } /* end if */ + else if (H5S_PLIST == mem_space_id) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_PLIST is not allowed for memory dataspace") + else { + /* Get the dataspace pointer */ + if (NULL == (*mem_space = (H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID") + } /* end else */ + + /* Check for valid selections */ + if (H5S_SELECT_VALID(*file_space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "selection + offset not within extent for file dataspace") + if (H5S_SELECT_VALID(*mem_space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "selection + offset not within extent for memory dataspace") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_io_setup() */ + /*------------------------------------------------------------------------- * Function: H5VL__native_dataset_create * @@ -141,10 +270,10 @@ herr_t H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, void H5_ATTR_UNUSED **req) { - H5D_t * dset = (H5D_t *)obj; - const H5S_t *mem_space = NULL; - const H5S_t *file_space = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset = (H5D_t *)obj; + H5S_t *mem_space = NULL; + H5S_t *file_space = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -152,11 +281,10 @@ H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_ if (NULL == dset->oloc.file) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - /* Get validated dataspace pointers */ - if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") - if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") + /* Get file & memory dataspaces */ + if (H5VL__native_dataset_io_setup(dset, dxpl_id, file_space_id, mem_space_id, &file_space, &mem_space) < + 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -166,6 +294,17 @@ H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") done: + /* Clean up */ + if (H5S_BLOCK == mem_space_id && mem_space) { + if (H5S_close(mem_space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, + "unable to release temporary memory dataspace for H5S_BLOCK") + } /* end if */ + else if (H5S_PLIST == file_space_id && file_space) + if (H5S_select_all(file_space, TRUE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, + "unable to release file dataspace selection for H5S_PLIST") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_dataset_read() */ @@ -182,10 +321,10 @@ herr_t H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void H5_ATTR_UNUSED **req) { - H5D_t * dset = (H5D_t *)obj; - const H5S_t *mem_space = NULL; - const H5S_t *file_space = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset = (H5D_t *)obj; + H5S_t *mem_space = NULL; + H5S_t *file_space = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -193,11 +332,10 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid if (NULL == dset->oloc.file) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - /* Get validated dataspace pointers */ - if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") - if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") + /* Get file & memory dataspaces */ + if (H5VL__native_dataset_io_setup(dset, dxpl_id, file_space_id, mem_space_id, &file_space, &mem_space) < + 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -207,6 +345,17 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: + /* Clean up */ + if (H5S_BLOCK == mem_space_id && mem_space) { + if (H5S_close(mem_space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, + "unable to release temporary memory dataspace for H5S_BLOCK") + } /* end if */ + else if (H5S_PLIST == file_space_id && file_space) + if (H5S_select_all(file_space, TRUE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, + "unable to release file dataspace selection for H5S_PLIST") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_dataset_write() */ @@ -220,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; @@ -252,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; } @@ -308,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 */ @@ -389,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 @@ -403,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; @@ -418,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; @@ -438,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 */ @@ -486,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 */ @@ -516,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); @@ -534,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) @@ -555,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) @@ -581,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 9551f50..bf6f37c 100644 --- a/src/H5VLnative_datatype.c +++ b/src/H5VLnative_datatype.c @@ -15,8 +15,15 @@ * */ +/****************/ +/* Module Setup */ +/****************/ + #define H5T_FRIEND /* Suppress error about including H5Tpkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gprivate.h" /* Groups */ @@ -28,6 +35,30 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + /*------------------------------------------------------------------------- * Function: H5VL__native_datatype_commit * @@ -144,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") - if (H5T_encode(dt, (unsigned char *)buf, &size) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype") + break; + } + + /* 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; @@ -193,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 fd86414..1e674dc 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -15,8 +15,15 @@ * */ +/****************/ +/* Module Setup */ +/****************/ + #define H5F_FRIEND /* Suppress error about including H5Fpkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Cprivate.h" /* Cache */ @@ -31,6 +38,30 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + /*------------------------------------------------------------------------- * Function: H5VL__native_file_create * @@ -116,21 +147,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5F_t *f = NULL; /* File struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - switch (get_type) { + switch (args->op_type) { /* "get container info" */ case H5VL_FILE_GET_CONT_INFO: { - H5VL_file_cont_info_t *info = HDva_arg(arguments, H5VL_file_cont_info_t *); - - /* Retrieve the file's container info */ - if (H5F__get_cont_info((H5F_t *)obj, info) < 0) + if (H5F__get_cont_info((H5F_t *)obj, args->args.get_cont_info.info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file container info") break; @@ -138,31 +166,22 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED /* H5Fget_access_plist */ case H5VL_FILE_GET_FAPL: { - H5P_genplist_t *new_plist; /* New property list */ - hid_t * plist_id = HDva_arg(arguments, hid_t *); - - f = (H5F_t *)obj; - - /* Retrieve the file's access property list */ - if ((*plist_id = H5F_get_access_plist(f, TRUE)) < 0) + if ((args->args.get_fapl.fapl_id = H5F_get_access_plist((H5F_t *)obj, TRUE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file access property list") - if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") break; } /* H5Fget_create_plist */ case H5VL_FILE_GET_FCPL: { H5P_genplist_t *plist; /* Property list */ - hid_t * plist_id = HDva_arg(arguments, hid_t *); f = (H5F_t *)obj; if (NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Create the property list object to return */ - if ((*plist_id = H5P_copy_plist(plist, TRUE)) < 0) + if ((args->args.get_fcpl.fcpl_id = H5P_copy_plist(plist, TRUE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties") break; @@ -170,8 +189,6 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED /* H5Fget_intent */ case H5VL_FILE_GET_INTENT: { - unsigned *intent_flags = HDva_arg(arguments, unsigned *); - f = (H5F_t *)obj; /* HDF5 uses some flags internally that users don't know about. @@ -179,18 +196,18 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED * or H5F_ACC_RDONLY and any SWMR flags. */ if (H5F_INTENT(f) & H5F_ACC_RDWR) { - *intent_flags = H5F_ACC_RDWR; + *args->args.get_intent.flags = H5F_ACC_RDWR; /* Check for SWMR write access on the file */ if (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) - *intent_flags |= H5F_ACC_SWMR_WRITE; + *args->args.get_intent.flags |= H5F_ACC_SWMR_WRITE; } /* end if */ else { - *intent_flags = H5F_ACC_RDONLY; + *args->args.get_intent.flags = H5F_ACC_RDONLY; /* Check for SWMR read access on the file */ if (H5F_INTENT(f) & H5F_ACC_SWMR_READ) - *intent_flags |= H5F_ACC_SWMR_READ; + *args->args.get_intent.flags |= H5F_ACC_SWMR_READ; } /* end else */ break; @@ -198,71 +215,52 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED /* H5Fget_fileno */ case H5VL_FILE_GET_FILENO: { - unsigned long *fno = HDva_arg(arguments, unsigned long *); - unsigned long my_fileno = 0; + unsigned long fileno = 0; - f = (H5F_t *)obj; - H5F_GET_FILENO(f, my_fileno); - *fno = my_fileno; /* sigh */ + H5F_GET_FILENO((H5F_t *)obj, fileno); + *args->args.get_fileno.fileno = fileno; break; } /* H5Fget_name */ case H5VL_FILE_GET_NAME: { - H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */ - size_t size = HDva_arg(arguments, size_t); - char * name = HDva_arg(arguments, char *); - ssize_t * ret = HDva_arg(arguments, ssize_t *); - size_t len; + H5VL_file_get_name_args_t *file_args = &args->args.get_name; - if (H5VL_native_get_file_struct(obj, type, &f) < 0) + if (H5VL_native_get_file_struct(obj, file_args->type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - len = HDstrlen(H5F_OPEN_NAME(f)); + /* Get length of file name */ + *file_args->file_name_len = HDstrlen(H5F_OPEN_NAME(f)); - if (name) { - HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1, size)); - if (len >= size) - name[size - 1] = '\0'; + /* Populate buffer with name, if given */ + if (file_args->buf) { + HDstrncpy(file_args->buf, H5F_OPEN_NAME(f), + MIN(*file_args->file_name_len + 1, file_args->buf_size)); + if (*file_args->file_name_len >= file_args->buf_size) + file_args->buf[file_args->buf_size - 1] = '\0'; } /* end if */ - /* Set the return value for the API call */ - *ret = (ssize_t)len; break; } /* H5Fget_obj_count */ case H5VL_FILE_GET_OBJ_COUNT: { - unsigned types = HDva_arg(arguments, unsigned); - ssize_t *ret = HDva_arg(arguments, ssize_t *); - size_t obj_count = 0; /* Number of opened objects */ - - f = (H5F_t *)obj; - /* Perform the query */ - if (H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + if (H5F_get_obj_count((H5F_t *)obj, args->args.get_obj_count.types, TRUE, + args->args.get_obj_count.count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object count") - /* Set the return value */ - *ret = (ssize_t)obj_count; break; } /* H5Fget_obj_ids */ case H5VL_FILE_GET_OBJ_IDS: { - unsigned types = HDva_arg(arguments, unsigned); - size_t max_objs = HDva_arg(arguments, size_t); - hid_t * oid_list = HDva_arg(arguments, hid_t *); - ssize_t *ret = HDva_arg(arguments, ssize_t *); - size_t obj_count = 0; /* Number of opened objects */ + H5VL_file_get_obj_ids_args_t *file_args = &args->args.get_obj_ids; - f = (H5F_t *)obj; - /* Perform the query */ - if (H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed") + if (H5F_get_obj_ids((H5F_t *)obj, file_args->types, file_args->max_objs, file_args->oid_list, + TRUE, file_args->count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object IDs") - /* Set the return value */ - *ret = (ssize_t)obj_count; break; } @@ -284,22 +282,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - switch (specific_type) { + switch (args->op_type) { /* H5Fflush */ case H5VL_FILE_FLUSH: { - H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */ - H5F_scope_t scope = (H5F_scope_t)HDva_arg(arguments, int); /* enum work-around */ - H5F_t * f = NULL; /* File to flush */ + H5F_t *f = NULL; /* File to flush */ /* Get the file for the object */ - if (H5VL_native_get_file_struct(obj, type, &f) < 0) + if (H5VL_native_get_file_struct(obj, args->args.flush.obj_type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Nothing to do if the file is read only. This determination is @@ -310,7 +306,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t */ if (H5F_ACC_RDWR & H5F_INTENT(f)) { /* Flush other files, depending on scope */ - if (H5F_SCOPE_GLOBAL == scope) { + if (H5F_SCOPE_GLOBAL == args->args.flush.scope) { /* Call the flush routine for mounted file hierarchies */ if (H5F_flush_mounts(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") @@ -322,98 +318,55 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t "unable to flush file's cached information") } /* end else */ } /* end if */ + break; } /* H5Freopen */ case H5VL_FILE_REOPEN: { - void **ret = HDva_arg(arguments, void **); - H5F_t *new_file = NULL; + H5F_t *new_file; /* Reopen the file through the VOL connector */ if (NULL == (new_file = H5F__reopen((H5F_t *)obj))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") new_file->id_exists = TRUE; - *ret = (void *)new_file; - break; - } - - /* H5Fmount */ - case H5VL_FILE_MOUNT: { - H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */ - const char *name = HDva_arg(arguments, const char *); - H5F_t * child = HDva_arg(arguments, H5F_t *); - hid_t fmpl_id = HDva_arg(arguments, hid_t); - H5G_loc_t loc; - - if (H5G_loc_real(obj, type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - - /* Do the mount */ - if (H5F__mount(&loc, name, child, fmpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") - - break; - } - - /* H5Funmount */ - case H5VL_FILE_UNMOUNT: { - H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */ - const char *name = HDva_arg(arguments, const char *); - H5G_loc_t loc; - - if (H5G_loc_real(obj, type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - - /* Unmount */ - if (H5F__unmount(&loc, name) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") + /* Set 'out' value */ + *args->args.reopen.file = new_file; break; } /* H5Fis_accessible */ case H5VL_FILE_IS_ACCESSIBLE: { - hid_t fapl_id = HDva_arg(arguments, hid_t); - const char *name = HDva_arg(arguments, const char *); - htri_t * result = HDva_arg(arguments, htri_t *); + htri_t result; + + if ((result = H5F__is_hdf5(args->args.is_accessible.filename, args->args.is_accessible.fapl_id)) < + 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "error in HDF5 file check") + + /* Set 'out' value */ + *args->args.is_accessible.accessible = (hbool_t)result; - /* Call private routine */ - if ((*result = H5F__is_hdf5(name, fapl_id)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "error in HDF5 file check") break; } /* H5Fdelete */ case H5VL_FILE_DELETE: { - hid_t fapl_id = HDva_arg(arguments, hid_t); - const char *name = HDva_arg(arguments, const char *); - herr_t * ret = HDva_arg(arguments, herr_t *); + if (H5F__delete(args->args.del.filename, args->args.del.fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file deletion") - /* Call private routine */ - if ((*ret = H5F_delete(name, fapl_id)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file check") break; } /* Check if two files are the same */ case H5VL_FILE_IS_EQUAL: { - H5F_t * file2 = (H5F_t *)HDva_arg(arguments, void *); - hbool_t *is_equal = HDva_arg(arguments, hbool_t *); - - if (!obj || !file2) - *is_equal = FALSE; + if (!obj || !args->args.is_equal.obj2) + *args->args.is_equal.same_file = FALSE; else - *is_equal = (((H5F_t *)obj)->shared == file2->shared); - break; - } + *args->args.is_equal.same_file = + (((H5F_t *)obj)->shared == ((H5F_t *)args->args.is_equal.obj2)->shared); - /* H5Fwait */ - case H5VL_FILE_WAIT: { - /* The native VOL connector doesn't support asynchronous - * operations, so this is a no-op. - */ break; } @@ -435,85 +388,78 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { - H5F_t *f = NULL; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t * f = (H5F_t *)obj; /* File */ + H5VL_native_file_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - f = (H5F_t *)obj; - switch (optional_type) { + switch (args->op_type) { /* H5Fget_filesize */ case H5VL_NATIVE_FILE_GET_SIZE: { - haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ - haddr_t base_addr; /* Base address for the file */ - hsize_t *size = HDva_arg(arguments, hsize_t *); + haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ + haddr_t base_addr; /* Base address for the file */ - /* Go get the actual file size */ + /* Get the actual file size & base address */ if (H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") - base_addr = H5FD_get_base_addr(f->shared->lf); - if (size) - *size = (hsize_t)(max_eof_eoa + - base_addr); /* Convert relative base address for file to absolute address */ + /* Convert relative base address for file to absolute address */ + *opt_args->get_size.size = (hsize_t)(max_eof_eoa + base_addr); break; } /* H5Fget_file_image */ case H5VL_NATIVE_FILE_GET_FILE_IMAGE: { - void * buf_ptr = HDva_arg(arguments, void *); - ssize_t *ret = HDva_arg(arguments, ssize_t *); - size_t buf_len = HDva_arg(arguments, size_t); + H5VL_native_file_get_file_image_t *gfi_args = &opt_args->get_file_image; - /* Do the actual work */ - if ((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0) + /* Get file image */ + if (H5F__get_file_image(f, gfi_args->buf, gfi_args->buf_size, gfi_args->image_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed") + break; } /* H5Fget_freespace */ case H5VL_NATIVE_FILE_GET_FREE_SPACE: { - hsize_t tot_space; /* Amount of free space in the file */ - hssize_t *ret = HDva_arg(arguments, hssize_t *); + H5VL_native_file_get_freespace_t *gfs_args = &opt_args->get_freespace; - /* Go get the actual amount of free space in the file */ - if (H5MF_get_freespace(f, &tot_space, NULL) < 0) + /* Get the actual amount of free space in the file */ + if (H5MF_get_freespace(f, gfs_args->size, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") - *ret = (hssize_t)tot_space; + break; } /* H5Fget_free_sections */ case H5VL_NATIVE_FILE_GET_FREE_SECTIONS: { - H5F_sect_info_t *sect_info = HDva_arg(arguments, H5F_sect_info_t *); - ssize_t * ret = HDva_arg(arguments, ssize_t *); - H5F_mem_t type = (H5F_mem_t)HDva_arg(arguments, int); /* enum work-around */ - size_t nsects = HDva_arg(arguments, size_t); + H5VL_native_file_get_free_sections_t *gfs_args = &opt_args->get_free_sections; /* Go get the free-space section information in the file */ - if ((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) + if (H5MF_get_free_sections(f, gfs_args->type, gfs_args->nsects, gfs_args->sect_info, + gfs_args->sect_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + break; } /* H5Fget_info1/2 */ case H5VL_NATIVE_FILE_GET_INFO: { - H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */ - H5F_info2_t *finfo = HDva_arg(arguments, H5F_info2_t *); + H5VL_native_file_get_info_t *gfi_args = &opt_args->get_info; /* Get the file struct. This call is careful to not return the file pointer * for the top file in a mount hierarchy. */ - if (H5VL_native_get_file_struct(obj, type, &f) < 0) + if (H5VL_native_get_file_struct(obj, gfi_args->type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") /* Get the file info */ - if (H5F__get_info(f, finfo) < 0) + if (H5F__get_info(f, gfi_args->finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") break; @@ -521,50 +467,42 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* H5Fget_mdc_config */ case H5VL_NATIVE_FILE_GET_MDC_CONF: { - H5AC_cache_config_t *config_ptr = HDva_arg(arguments, H5AC_cache_config_t *); + /* Get the metadata cache configuration */ + if (H5AC_get_cache_auto_resize_config(f->shared->cache, opt_args->get_mdc_config.config) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache configuration") - /* Go get the resize configuration */ - if (H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") break; } /* H5Fget_mdc_hit_rate */ case H5VL_NATIVE_FILE_GET_MDC_HR: { - double *hit_rate_ptr = HDva_arg(arguments, double *); + /* Get the current hit rate */ + if (H5AC_get_cache_hit_rate(f->shared->cache, opt_args->get_mdc_hit_rate.hit_rate) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache hit rate") - /* Go get the current hit rate */ - if (H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") break; } /* H5Fget_mdc_size */ case H5VL_NATIVE_FILE_GET_MDC_SIZE: { - size_t * max_size_ptr = HDva_arg(arguments, size_t *); - size_t * min_clean_size_ptr = HDva_arg(arguments, size_t *); - size_t * cur_size_ptr = HDva_arg(arguments, size_t *); - int * cur_num_entries_ptr = HDva_arg(arguments, int *); - uint32_t cur_num_entries; + H5VL_native_file_get_mdc_size_t *gms_args = &opt_args->get_mdc_size; - /* Go get the size data */ - if (H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr, - &cur_num_entries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + /* Get the size data */ + if (H5AC_get_cache_size(f->shared->cache, gms_args->max_size, gms_args->min_clean_size, + gms_args->cur_size, gms_args->cur_num_entries) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache size") - if (cur_num_entries_ptr != NULL) - *cur_num_entries_ptr = (int)cur_num_entries; break; } /* H5Fget_vfd_handle */ case H5VL_NATIVE_FILE_GET_VFD_HANDLE: { - void **file_handle = HDva_arg(arguments, void **); - hid_t fapl_id = HDva_arg(arguments, hid_t); + H5VL_native_file_get_vfd_handle_t *gvh_args = &opt_args->get_vfd_handle; /* Retrieve the VFD handle for the file */ - if (H5F_get_vfd_handle(f, fapl_id, file_handle) < 0) + if (H5F_get_vfd_handle(f, gvh_args->fapl_id, gvh_args->file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + break; } @@ -574,6 +512,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t if (f->shared->efc) if (H5F__efc_release(f->shared->efc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + break; } @@ -581,26 +520,24 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE: { /* Reset the hit rate statistic */ if (H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") + break; } /* H5Fset_mdc_config */ case H5VL_NATIVE_FILE_SET_MDC_CONFIG: { - H5AC_cache_config_t *config_ptr = HDva_arg(arguments, H5AC_cache_config_t *); + /* Set the metadata cache configuration */ + if (H5AC_set_cache_auto_resize_config(f->shared->cache, opt_args->set_mdc_config.config) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set metadata cache configuration") - /* set the resize configuration */ - if (H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed") break; } /* H5Fget_metadata_read_retry_info */ case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO: { - H5F_retry_info_t *info = HDva_arg(arguments, H5F_retry_info_t *); - - if (H5F_get_metadata_read_retry_info(f, info) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info") + if (H5F_get_metadata_read_retry_info(f, opt_args->get_metadata_read_retry_info.info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info") break; } @@ -608,7 +545,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* H5Fstart_swmr_write */ case H5VL_NATIVE_FILE_START_SWMR_WRITE: { if (H5F__start_swmr_write(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't start SWMR write") break; } @@ -633,11 +570,11 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* H5Fget_mdc_logging_status */ case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS: { - hbool_t *is_enabled = HDva_arg(arguments, hbool_t *); - hbool_t *is_currently_logging = HDva_arg(arguments, hbool_t *); + H5VL_native_file_get_mdc_logging_status_t *gmls_args = &opt_args->get_mdc_logging_status; /* Call mdc logging function */ - if (H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0) + if (H5C_get_logging_status(f->shared->cache, gmls_args->is_enabled, + gmls_args->is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status") break; @@ -667,18 +604,15 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* H5Fget_page_buffering_stats */ case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS: { - unsigned *accesses = HDva_arg(arguments, unsigned *); - unsigned *hits = HDva_arg(arguments, unsigned *); - unsigned *misses = HDva_arg(arguments, unsigned *); - unsigned *evictions = HDva_arg(arguments, unsigned *); - unsigned *bypasses = HDva_arg(arguments, unsigned *); + H5VL_native_file_get_page_buffering_stats_t *gpbs_args = &opt_args->get_page_buffering_stats; /* Sanity check */ if (NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") /* Get the statistics */ - if (H5PB_get_stats(f->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0) + if (H5PB_get_stats(f->shared->page_buf, gpbs_args->accesses, gpbs_args->hits, gpbs_args->misses, + gpbs_args->evictions, gpbs_args->bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") break; @@ -686,11 +620,10 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* H5Fget_mdc_image_info */ case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO: { - haddr_t *image_addr = HDva_arg(arguments, haddr_t *); - hsize_t *image_len = HDva_arg(arguments, hsize_t *); + H5VL_native_file_get_mdc_image_info_t *gmii_args = &opt_args->get_mdc_image_info; /* Go get the address and size of the cache image */ - if (H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0) + if (H5AC_get_mdc_image_info(f->shared->cache, gmii_args->addr, gmii_args->len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") break; @@ -698,11 +631,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* H5Fget_eoa */ case H5VL_NATIVE_FILE_GET_EOA: { - haddr_t *eoa = HDva_arg(arguments, haddr_t *); - haddr_t rel_eoa; /* Relative address of EOA */ - - /* Sanity check */ - HDassert(eoa); + haddr_t rel_eoa; /* Relative address of EOA */ /* This routine will work only for drivers with this feature enabled.*/ /* We might introduce a new feature flag in the future */ @@ -716,14 +645,13 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* Set return value */ /* (Note compensating for base address subtraction in internal routine) */ - *eoa = rel_eoa + H5F_get_base_addr(f); + *opt_args->get_eoa.eoa = rel_eoa + H5F_get_base_addr(f); break; } /* H5Fincrement_filesize */ case H5VL_NATIVE_FILE_INCR_FILESIZE: { - hsize_t increment = HDva_arg(arguments, hsize_t); haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ /* This public routine will work only for drivers with this feature enabled.*/ @@ -737,7 +665,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") /* Set EOA to the maximum value + increment */ - if (H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) + if (H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + opt_args->increment_filesize.increment) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") break; @@ -745,11 +673,10 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* H5Fset_latest_format, H5Fset_libver_bounds */ case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS: { - H5F_libver_t low = (H5F_libver_t)HDva_arg(arguments, int); /* enum work-around */ - H5F_libver_t high = (H5F_libver_t)HDva_arg(arguments, int); /* enum work-around */ + H5VL_native_file_set_libver_bounds_t *slb_args = &opt_args->set_libver_bounds; /* Call internal set_libver_bounds function */ - if (H5F__set_libver_bounds(f, low, high) < 0) + if (H5F__set_libver_bounds(f, slb_args->low, slb_args->high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") break; @@ -757,34 +684,34 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* H5Fget_dset_no_attrs_hint */ case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG: { - hbool_t *minimize = HDva_arg(arguments, hbool_t *); - *minimize = H5F_GET_MIN_DSET_OHDR(f); + *opt_args->get_min_dset_ohdr_flag.minimize = H5F_GET_MIN_DSET_OHDR(f); + break; } /* H5Fset_dset_no_attrs_hint */ case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: { - int minimize = HDva_arg(arguments, int); - if (H5F_set_min_dset_ohdr(f, (hbool_t)minimize) < 0) + if (H5F_set_min_dset_ohdr(f, opt_args->set_min_dset_ohdr_flag.minimize) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set file's dataset object header minimization flag") + break; } #ifdef H5_HAVE_PARALLEL /* H5Fget_mpi_atomicity */ case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: { - hbool_t *flag = (hbool_t *)HDva_arg(arguments, hbool_t *); - if (H5F_get_mpi_atomicity(f, flag) < 0) + if (H5F__get_mpi_atomicity(f, opt_args->get_mpi_atomicity.flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "cannot get MPI atomicity"); + break; } /* H5Fset_mpi_atomicity */ case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: { - hbool_t flag = (hbool_t)HDva_arg(arguments, int); - if (H5F_set_mpi_atomicity(f, flag) < 0) + if (H5F__set_mpi_atomicity(f, opt_args->set_mpi_atomicity.flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set MPI atomicity"); + break; } #endif /* H5_HAVE_PARALLEL */ @@ -792,7 +719,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t /* Finalize H5Fopen */ case H5VL_NATIVE_FILE_POST_OPEN: { /* Call package routine */ - if (H5F__post_open((H5F_t *)obj) < 0) + if (H5F__post_open(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file") break; } @@ -843,7 +770,7 @@ H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "can't get ID ref count") if (nref == 1) if (H5F__flush(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } /* end if */ /* Close the file */ diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c index e3fa702..54f8337 100644 --- a/src/H5VLnative_group.c +++ b/src/H5VLnative_group.c @@ -15,8 +15,15 @@ * */ +/****************/ +/* Module Setup */ +/****************/ + #define H5G_FRIEND /* Suppress error about including H5Gpkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gpkg.h" /* Groups */ @@ -27,6 +34,30 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + /*------------------------------------------------------------------------- * Function: H5VL__native_group_create * @@ -138,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 @@ -212,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") + + break; + } - /* Flush object's metadata to file */ - if (H5O_flush_common(&grp->oloc, group_id) < 0) + /* 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; @@ -259,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 6af33ba..fa11bea 100644 --- a/src/H5VLnative_introspect.c +++ b/src/H5VLnative_introspect.c @@ -15,14 +15,46 @@ * */ +/****************/ +/* Module Setup */ +/****************/ + +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VLnative_private.h" /* Native VOL connector */ -/* 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. +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/* 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. */ /*--------------------------------------------------------------------------- @@ -150,8 +182,10 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS: case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG: case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: +#ifdef H5_HAVE_PARALLEL case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: +#endif /* H5_HAVE_PARALLEL */ case H5VL_NATIVE_FILE_POST_OPEN: break; diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c index 72f6cde..042c778 100644 --- a/src/H5VLnative_link.c +++ b/src/H5VLnative_link.c @@ -15,8 +15,15 @@ * */ +/****************/ +/* Module Setup */ +/****************/ + #define H5L_FRIEND /* Suppress error about including H5Lpkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gprivate.h" /* Groups */ @@ -27,6 +34,30 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + /*------------------------------------------------------------------------- * Function: H5VL__native_link_create * @@ -37,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") @@ -73,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; } @@ -218,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 */ @@ -229,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 @@ -253,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; @@ -269,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 @@ -309,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) @@ -345,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 449f389..d237617 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -15,9 +15,16 @@ * */ -#define H5O_FRIEND /* Suppress error about including H5Opkg */ +/****************/ +/* Module Setup */ +/****************/ + #define H5F_FRIEND /* Suppress error about including H5Fpkg */ +#define H5O_FRIEND /* Suppress error about including H5Opkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files (pkg needed for id_exists) */ @@ -29,6 +36,30 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + /*------------------------------------------------------------------------- * Function: H5VL__native_object_open * @@ -138,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 */ @@ -149,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 @@ -166,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) { @@ -194,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 */ @@ -222,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; @@ -265,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 */ @@ -276,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; } @@ -298,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 */ @@ -309,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; @@ -323,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 */ @@ -357,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") @@ -370,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; @@ -433,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; @@ -498,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; @@ -508,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; @@ -519,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 */ @@ -551,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/H5VLnative_token.c b/src/H5VLnative_token.c index 65591c7..bed0164 100644 --- a/src/H5VLnative_token.c +++ b/src/H5VLnative_token.c @@ -14,6 +14,10 @@ * Purpose: Object token callbacks for the native VOL connector */ +/****************/ +/* Module Setup */ +/****************/ + /***********/ /* Headers */ /***********/ diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 5ccc082..ede2f5f 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -36,7 +36,7 @@ #include /* Public HDF5 file */ -#include "hdf5.h" +#include "hdf5dev.h" /* This connector's header */ #include "H5VLpassthru.h" @@ -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..78e39e3 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; /********************/ @@ -358,9 +361,4 @@ H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_t } #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/H5Zdevelop.h b/src/H5Zdevelop.h new file mode 100644 index 0000000..328e221 --- /dev/null +++ b/src/H5Zdevelop.h @@ -0,0 +1,421 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 H5Z (data filter) developer + * support routines. + */ + +#ifndef _H5Zdevelop_H +#define _H5Zdevelop_H + +/* Include package's public header */ +#include "H5Zpublic.h" + +/*****************/ +/* Public Macros */ +/*****************/ + +/** + * Current version of the H5Z_class_t struct + */ +#define H5Z_CLASS_T_VERS (1) + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/** + * Structure for filter callback property + */ +typedef struct H5Z_cb_t { + H5Z_filter_func_t func; + void * op_data; +} H5Z_cb_t; + +/** + * \brief This callback determines if a filter can be applied to the dataset + * with the characteristics provided + * + * \dcpl_id + * \type_id + * \space_id + * + * \return \htri_t + * + * \details Before a dataset gets created, the \ref H5Z_can_apply_func_t + * callbacks for any filters used in the dataset creation property list + * are called with the dataset's dataset creation property list, the + * dataset's datatype and a dataspace describing a chunk (for chunked + * dataset storage). + * + * The \ref H5Z_can_apply_func_t callback must determine if the + * combination of the dataset creation property list setting, the + * datatype and the dataspace represent a valid combination to apply + * this filter to. For example, some cases of invalid combinations may + * involve the filter not operating correctly on certain datatypes (or + * certain datatype sizes), or certain sizes of the chunk dataspace. + * + * The \ref H5Z_can_apply_func_t callback can be the NULL pointer, in + * which case, the library will assume that it can apply to any + * combination of dataset creation property list values, datatypes and + * dataspaces. + * + * The \ref H5Z_can_apply_func_t callback returns positive a valid + * combination, zero for an invalid combination and negative for an + * error. + */ +//! +typedef htri_t (*H5Z_can_apply_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id); +//! + +/** + * \brief The filter operation callback function, defining a filter's operation + * on data + * + * \dcpl_id + * \type_id + * \space_id + * + * \return \herr_t + * + * \details After the \ref H5Z_can_apply_func_t callbacks are checked for new + * datasets, the \ref H5Z_set_local_func_t callbacks for any filters + * used in the dataset creation property list are called. These + * callbacks receive the dataset's private copy of the dataset creation + * property list passed in to H5Dcreate() (i.e. not the actual property + * list passed in to H5Dcreate()) and the datatype ID passed in to + * H5Dcreate() (which is not copied and should not be modified) and a + * dataspace describing the chunk (for chunked dataset storage) (which + * should also not be modified). + * + * The \ref H5Z_set_local_func_t callback must set any parameters that + * are specific to this dataset, based on the combination of the + * dataset creation property list values, the datatype and the + * dataspace. For example, some filters perform different actions based + * on different datatypes (or datatype sizes) or different number of + * dimensions or dataspace sizes. + * + * The \ref H5Z_set_local_func_t callback can be the NULL pointer, in + * which case, the library will assume that there are no + * dataset-specific settings for this filter. + * + * The \ref H5Z_set_local_func_t callback must return non-negative on + * success and negative for an error. + */ +//! +typedef herr_t (*H5Z_set_local_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id); +//! + +/** + * \brief The filter operation callback function, defining a filter's operation + * on data + * + * \param[in] flags Bit vector specifying certain general properties of the filter + * \param[in] cd_nelmts Number of elements in \p cd_values + * \param[in] cd_values Auxiliary data for the filter + * \param[in] nbytes The number of valid bytes in \p buf to be filtered + * \param[in,out] buf_size The size of \p buf + * \param[in,out] buf The filter buffer + * + * \return Returns the number of valid bytes of data contained in \p buf. In the + * case of failure, the return value is 0 (zero) and all pointer + * arguments are left unchanged. + * + * \details A filter gets definition flags and invocation flags (defined + * above), the client data array and size defined when the filter was + * added to the pipeline, the size in bytes of the data on which to + * operate, and pointers to a buffer and its allocated size. + * + * The filter should store the result in the supplied buffer if + * possible, otherwise it can allocate a new buffer, freeing the + * original. The allocated size of the new buffer should be returned + * through the \p buf_size pointer and the new buffer through the \p + * buf pointer. + * + * The return value from the filter is the number of bytes in the + * output buffer. If an error occurs then the function should return + * zero and leave all pointer arguments unchanged. + */ +//! +typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], + size_t nbytes, size_t *buf_size, void **buf); +//! + +/** + * The filter table maps filter identification numbers to structs that + * contain a pointers to the filter function and timing statistics. + */ +//! +typedef struct H5Z_class2_t { + int version; /**< Version number of the H5Z_class_t struct */ + H5Z_filter_t id; /**< Filter ID number */ + unsigned encoder_present; /**< Does this filter have an encoder? */ + unsigned decoder_present; /**< Does this filter have a decoder? */ + const char * name; /**< Comment for debugging */ + H5Z_can_apply_func_t can_apply; /**< The "can apply" callback for a filter */ + H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */ + H5Z_func_t filter; /**< The actual filter function */ +} H5Z_class2_t; +//! + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \ingroup H5Z + * + * \brief Registers a new filter with the HDF5 library + * + * \param[in] cls A pointer to a buffer for the struct containing the + * filter-definition + * + * \return \herr_t + * + * \details H5Zregister() registers a new filter with the HDF5 library. + * + * \details Making a new filter available to an application is a two-step + * process. The first step is to write the three filter callback + * functions described below: \c can_apply, \c set_local, and \c + * filter. This call to H5Zregister(), registering the filter with the + * library, is the second step. The can_apply and set_local fields can + * be set to NULL if they are not required for the filter being + * registered. + * + * H5Zregister() accepts a single parameter, a pointer to a buffer for + * the \p cls data structure. That data structure must conform to one + * of the following definitions: + * \snippet this H5Z_class1_t_snip + * or + * \snippet this H5Z_class2_t_snip + * + * \c version is a library-defined value reporting the version number + * of the #H5Z_class_t struct. This currently must be set to + * #H5Z_CLASS_T_VERS. + * + * \c id is the identifier for the new filter. This is a user-defined + * value between #H5Z_FILTER_RESERVED and #H5Z_FILTER_MAX. These + * values are defined in the HDF5 source file H5Zpublic.h, but the + * symbols #H5Z_FILTER_RESERVED and #H5Z_FILTER_MAX should always be + * used instead of the literal values. + * + * \c encoder_present is a library-defined value indicating whether + * the filter’s encoding capability is available to the application. + * + * \c decoder_present is a library-defined value indicating whether + * the filter’s encoding capability is available to the application. + * + * \c name is a descriptive comment used for debugging, may contain a + * descriptive name for the filter, and may be the null pointer. + * + * \c can_apply, described in detail below, is a user-defined callback + * function which determines whether the combination of the dataset + * creation property list values, the datatype, and the dataspace + * represent a valid combination to apply this filter to. + * + * \c set_local, described in detail below, is a user-defined callback + * function which sets any parameters that are specific to this + * dataset, based on the combination of the dataset creation property + * list values, the datatype, and the dataspace. + * + * \c filter, described in detail below, is a user-defined callback + * function which performs the action of the filter. + * + * The statistics associated with a filter are not reset by this + * function; they accumulate over the life of the library. + * + * #H5Z_class_t is a macro which maps to either H5Z_class1_t or + * H5Z_class2_t, depending on the needs of the application. To affect + * only this macro, H5Z_class_t_vers may be defined to either 1 or 2. + * Otherwise, it will behave in the same manner as other API + * compatibility macros. See API Compatibility Macros in HDF5 for more + * information. H5Z_class1_t matches the #H5Z_class_t structure that is + * used in the 1.6.x versions of the HDF5 library. + * + * H5Zregister() will automatically detect which structure type has + * been passed in, regardless of the mapping of the #H5Z_class_t macro. + * However, the application must make sure that the fields are filled + * in according to the correct structure definition if the macro is + * used to declare the structure. + * + * \Bold{The callback functions:}\n Before H5Zregister() can link a + * filter into an application, three callback functions must be + * defined as described in the HDF5 library header file H5Zpublic.h. + * + * When a filter is applied to the fractal heap for a group (e.g., + * when compressing group metadata) and if the can apply and set local + * callback functions have been defined for that filter, HDF5 passes + * the value -1 for all parameters for those callback functions. This + * is done to ensure that the filter will not be applied to groups if + * it relies on these parameters, as they are not applicable to group + * fractal heaps; to operate on group fractal heaps, a filter must be + * capable of operating on an opaque block of binary data. + * + * The \Emph{can apply} callback function must return a positive value + * for a valid combination, zero for an invalid combination, and a + * negative value for an error. + * \snippet this H5Z_can_apply_func_t_snip + * + * Before a dataset is created, the \Emph{can apply} callbacks for any + * filters used in the dataset creation property list are called with + * the dataset's dataset creation property list, \c dcpl_id, the + * dataset's datatype, \p type_id, and a dataspace describing a chunk, + * \p space_id, (for chunked dataset storage). + * + * This callback must determine whether the combination of the dataset + * creation property list settings, the datatype, and the dataspace + * represent a valid combination to which to apply this filter. For + * example, an invalid combination may involve the filter not + * operating correctly on certain datatypes, on certain datatype + * sizes, or on certain sizes of the chunk dataspace. If this filter + * is enabled through H5Pset_filter() as optional and the can apply + * function returns 0, the library will skip the filter in the filter + * pipeline. + * + * This callback can be the NULL pointer, in which case the library + * will assume that the filter can be applied to a dataset with any + * combination of dataset creation property list values, datatypes, + * and dataspaces. + * + * The \Emph{set local} callback function is defined as follows: + * \snippet this H5Z_set_local_func_t_snip + * + * After the can apply callbacks are checked for a new dataset, the + * \Emph{set local} callback functions for any filters used in the + * dataset creation property list are called. These callbacks receive + * \c dcpl_id, the dataset's private copy of the dataset creation + * property list passed in to H5Dcreate() (i.e. not the actual + * property list passed in to H5Dcreate()); \c type_id, the datatype + * identifier passed in to H5Dcreate(), which is not copied and should + * not be modified; and \c space_id, a dataspace describing the chunk + * (for chunked dataset storage), which should also not be modified. + * + * The set local callback must set any filter parameters that are + * specific to this dataset, based on the combination of the dataset + * creation property list values, the datatype, and the dataspace. For + * example, some filters perform different actions based on different + * datatypes, datatype sizes, numbers of dimensions, or dataspace + * sizes. + * + * The \Emph{set local} callback may be the NULL pointer, in which + * case, the library will assume that there are no dataset-specific + * settings for this filter. + * + * The \Emph{set local} callback function must return a non-negative + * value on success and a negative value for an error. + * + * The \Emph{filter operation} callback function, defining the + * filter's operation on the data, is defined as follows: + * \snippet this H5Z_func_t_snip + * + * The parameters \c flags, \c cd_nelmts, and \c cd_values are the + * same as for the function H5Pset_filter(). The one exception is that + * an additional flag, #H5Z_FLAG_REVERSE, is set when the filter is + * called as part of the input pipeline. + * + * The parameter \c buf points to the input buffer which has a size of + * \c buf_size bytes, \c nbytes of which are valid data. + * + * The filter should perform the transformation in place if possible. + * If the transformation cannot be done in place, then the filter + * should allocate a new buffer with malloc() and assign it to \c buf, + * assigning the allocated size of that buffer to \c buf_size. The old + * buffer should be freed by calling free(). + * + * If successful, the \Emph{filter operation} callback function + * returns the number of valid bytes of data contained in \c buf. In + * the case of failure, the return value is 0 (zero) and all pointer + * arguments are left unchanged. + * + * \version 1.8.6 Return type for the \Emph{can apply} callback function, + * \ref H5Z_can_apply_func_t, changed to \ref htri_t. + * \version 1.8.5 Semantics of the \Emph{can apply} and \Emph{set local} + * callback functions changed to accommodate the use of filters + * with group fractal heaps. + * \version 1.8.3 #H5Z_class_t renamed to H5Z_class2_t, H5Z_class1_t structure + * introduced for backwards compatibility with release 1.6.x, + * and #H5Z_class_t macro introduced in this release. Function + * modified to accept either structure type. + * \version 1.8.0 The fields \c version, \c encoder_present, and + * \c decoder_present were added to the #H5Z_class_t \c struct + * in this release. + * \version 1.6.0 This function was substantially revised in Release 1.6.0 with + * a new #H5Z_class_t struct and new set local and can apply + * callback functions. + * + */ +H5_DLL herr_t H5Zregister(const void *cls); +/** + * \ingroup H5Z + * + * \brief Unregisters a filter. + * + * \param[in] id Identifier of the filter to be unregistered. + * \return \herr_t + * + * \details H5Zunregister() unregisters the filter specified in \p id. + * + * \details This function first iterates through all opened datasets and + * groups. If an open object that uses this filter is found, the + * function will fail with a message indicating that an object using + * the filter is still open. All open files are then flushed to make + * sure that all cached data that may use this filter are written out. + * + * If the application is a parallel program, all processes that + * participate in collective data write should call this function to + * ensure that all data is flushed. + * + * After a call to H5Zunregister(), the filter specified in filter + * will no longer be available to the application. + * + * \version 1.8.12 Function modified to check for open objects using the + * filter. + * \since 1.6.0 + */ +H5_DLL herr_t H5Zunregister(H5Z_filter_t id); + +#ifdef __cplusplus +} +#endif + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/** + * The filter table maps filter identification numbers to structs that + * contain a pointers to the filter function and timing statistics. + */ +//! +typedef struct H5Z_class1_t { + H5Z_filter_t id; /**< Filter ID number */ + const char * name; /**< Comment for debugging */ + H5Z_can_apply_func_t can_apply; /**< The "can apply" callback for a filter */ + H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */ + H5Z_func_t filter; /**< The actual filter function */ +} H5Z_class1_t; +//! + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +#endif /* _H5Zdevelop_H */ diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index 51690b4..13eb26f 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -21,8 +21,9 @@ /* Early typedefs to avoid circular dependencies */ typedef struct H5Z_filter_info_t H5Z_filter_info_t; -/* Include package's public header */ +/* Include package's public headers */ #include "H5Zpublic.h" +#include "H5Zdevelop.h" /* Private headers needed by this file */ #include "H5Tprivate.h" /* Datatypes */ diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index 90277cf..5d04c9a 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -207,11 +207,6 @@ typedef enum H5Z_SO_scale_type_t { } H5Z_SO_scale_type_t; /** - * Current version of the H5Z_class_t struct - */ -#define H5Z_CLASS_T_VERS (1) - -/** * \ingroup FLETCHER32 * Values to decide if EDC is enabled for reading data */ @@ -243,354 +238,11 @@ typedef enum H5Z_cb_return_t { typedef H5Z_cb_return_t (*H5Z_filter_func_t)(H5Z_filter_t filter, void *buf, size_t buf_size, void *op_data); //! -/** - * Structure for filter callback property - */ -typedef struct H5Z_cb_t { - H5Z_filter_func_t func; - void * op_data; -} H5Z_cb_t; - #ifdef __cplusplus extern "C" { #endif /** - * \brief This callback determines if a filter can be applied to the dataset - * with the characteristics provided - * - * \dcpl_id - * \type_id - * \space_id - * - * \return \htri_t - * - * \details Before a dataset gets created, the \ref H5Z_can_apply_func_t - * callbacks for any filters used in the dataset creation property list - * are called with the dataset's dataset creation property list, the - * dataset's datatype and a dataspace describing a chunk (for chunked - * dataset storage). - * - * The \ref H5Z_can_apply_func_t callback must determine if the - * combination of the dataset creation property list setting, the - * datatype and the dataspace represent a valid combination to apply - * this filter to. For example, some cases of invalid combinations may - * involve the filter not operating correctly on certain datatypes (or - * certain datatype sizes), or certain sizes of the chunk dataspace. - * - * The \ref H5Z_can_apply_func_t callback can be the NULL pointer, in - * which case, the library will assume that it can apply to any - * combination of dataset creation property list values, datatypes and - * dataspaces. - * - * The \ref H5Z_can_apply_func_t callback returns positive a valid - * combination, zero for an invalid combination and negative for an - * error. - */ -//! -typedef htri_t (*H5Z_can_apply_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id); -//! -/** - * \brief The filter operation callback function, defining a filter's operation - * on data - * - * \dcpl_id - * \type_id - * \space_id - * - * \return \herr_t - * - * \details After the \ref H5Z_can_apply_func_t callbacks are checked for new - * datasets, the \ref H5Z_set_local_func_t callbacks for any filters - * used in the dataset creation property list are called. These - * callbacks receive the dataset's private copy of the dataset creation - * property list passed in to H5Dcreate() (i.e. not the actual property - * list passed in to H5Dcreate()) and the datatype ID passed in to - * H5Dcreate() (which is not copied and should not be modified) and a - * dataspace describing the chunk (for chunked dataset storage) (which - * should also not be modified). - * - * The \ref H5Z_set_local_func_t callback must set any parameters that - * are specific to this dataset, based on the combination of the - * dataset creation property list values, the datatype and the - * dataspace. For example, some filters perform different actions based - * on different datatypes (or datatype sizes) or different number of - * dimensions or dataspace sizes. - * - * The \ref H5Z_set_local_func_t callback can be the NULL pointer, in - * which case, the library will assume that there are no - * dataset-specific settings for this filter. - * - * The \ref H5Z_set_local_func_t callback must return non-negative on - * success and negative for an error. - */ -//! -typedef herr_t (*H5Z_set_local_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id); -//! - -/** - * \brief The filter operation callback function, defining a filter's operation - * on data - * - * \param[in] flags Bit vector specifying certain general properties of the filter - * \param[in] cd_nelmts Number of elements in \p cd_values - * \param[in] cd_values Auxiliary data for the filter - * \param[in] nbytes The number of valid bytes in \p buf to be filtered - * \param[in,out] buf_size The size of \p buf - * \param[in,out] buf The filter buffer - * - * \return Returns the number of valid bytes of data contained in \p buf. In the - * case of failure, the return value is 0 (zero) and all pointer - * arguments are left unchanged. - * - * \details A filter gets definition flags and invocation flags (defined - * above), the client data array and size defined when the filter was - * added to the pipeline, the size in bytes of the data on which to - * operate, and pointers to a buffer and its allocated size. - * - * The filter should store the result in the supplied buffer if - * possible, otherwise it can allocate a new buffer, freeing the - * original. The allocated size of the new buffer should be returned - * through the \p buf_size pointer and the new buffer through the \p - * buf pointer. - * - * The return value from the filter is the number of bytes in the - * output buffer. If an error occurs then the function should return - * zero and leave all pointer arguments unchanged. - */ -//! -typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], - size_t nbytes, size_t *buf_size, void **buf); -//! -/** - * The filter table maps filter identification numbers to structs that - * contain a pointers to the filter function and timing statistics. - */ -//! -typedef struct H5Z_class2_t { - int version; /**< Version number of the H5Z_class_t struct */ - H5Z_filter_t id; /**< Filter ID number */ - unsigned encoder_present; /**< Does this filter have an encoder? */ - unsigned decoder_present; /**< Does this filter have a decoder? */ - const char * name; /**< Comment for debugging */ - H5Z_can_apply_func_t can_apply; /**< The "can apply" callback for a filter */ - H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */ - H5Z_func_t filter; /**< The actual filter function */ -} H5Z_class2_t; -//! - -/** - * \ingroup H5Z - * - * \brief Registers a new filter with the HDF5 library - * - * \param[in] cls A pointer to a buffer for the struct containing the - * filter-definition - * - * \return \herr_t - * - * \details H5Zregister() registers a new filter with the HDF5 library. - * - * \details Making a new filter available to an application is a two-step - * process. The first step is to write the three filter callback - * functions described below: \c can_apply, \c set_local, and \c - * filter. This call to H5Zregister(), registering the filter with the - * library, is the second step. The can_apply and set_local fields can - * be set to NULL if they are not required for the filter being - * registered. - * - * H5Zregister() accepts a single parameter, a pointer to a buffer for - * the \p cls data structure. That data structure must conform to one - * of the following definitions: - * \snippet this H5Z_class1_t_snip - * or - * \snippet this H5Z_class2_t_snip - * - * \c version is a library-defined value reporting the version number - * of the #H5Z_class_t struct. This currently must be set to - * #H5Z_CLASS_T_VERS. - * - * \c id is the identifier for the new filter. This is a user-defined - * value between #H5Z_FILTER_RESERVED and #H5Z_FILTER_MAX. These - * values are defined in the HDF5 source file H5Zpublic.h, but the - * symbols #H5Z_FILTER_RESERVED and #H5Z_FILTER_MAX should always be - * used instead of the literal values. - * - * \c encoder_present is a library-defined value indicating whether - * the filter’s encoding capability is available to the application. - * - * \c decoder_present is a library-defined value indicating whether - * the filter’s encoding capability is available to the application. - * - * \c name is a descriptive comment used for debugging, may contain a - * descriptive name for the filter, and may be the null pointer. - * - * \c can_apply, described in detail below, is a user-defined callback - * function which determines whether the combination of the dataset - * creation property list values, the datatype, and the dataspace - * represent a valid combination to apply this filter to. - * - * \c set_local, described in detail below, is a user-defined callback - * function which sets any parameters that are specific to this - * dataset, based on the combination of the dataset creation property - * list values, the datatype, and the dataspace. - * - * \c filter, described in detail below, is a user-defined callback - * function which performs the action of the filter. - * - * The statistics associated with a filter are not reset by this - * function; they accumulate over the life of the library. - * - * #H5Z_class_t is a macro which maps to either H5Z_class1_t or - * H5Z_class2_t, depending on the needs of the application. To affect - * only this macro, H5Z_class_t_vers may be defined to either 1 or 2. - * Otherwise, it will behave in the same manner as other API - * compatibility macros. See API Compatibility Macros in HDF5 for more - * information. H5Z_class1_t matches the #H5Z_class_t structure that is - * used in the 1.6.x versions of the HDF5 library. - * - * H5Zregister() will automatically detect which structure type has - * been passed in, regardless of the mapping of the #H5Z_class_t macro. - * However, the application must make sure that the fields are filled - * in according to the correct structure definition if the macro is - * used to declare the structure. - * - * \Bold{The callback functions:}\n Before H5Zregister() can link a - * filter into an application, three callback functions must be - * defined as described in the HDF5 library header file H5Zpublic.h. - * - * When a filter is applied to the fractal heap for a group (e.g., - * when compressing group metadata) and if the can apply and set local - * callback functions have been defined for that filter, HDF5 passes - * the value -1 for all parameters for those callback functions. This - * is done to ensure that the filter will not be applied to groups if - * it relies on these parameters, as they are not applicable to group - * fractal heaps; to operate on group fractal heaps, a filter must be - * capable of operating on an opaque block of binary data. - * - * The \Emph{can apply} callback function must return a positive value - * for a valid combination, zero for an invalid combination, and a - * negative value for an error. - * \snippet this H5Z_can_apply_func_t_snip - * - * Before a dataset is created, the \Emph{can apply} callbacks for any - * filters used in the dataset creation property list are called with - * the dataset's dataset creation property list, \c dcpl_id, the - * dataset's datatype, \p type_id, and a dataspace describing a chunk, - * \p space_id, (for chunked dataset storage). - * - * This callback must determine whether the combination of the dataset - * creation property list settings, the datatype, and the dataspace - * represent a valid combination to which to apply this filter. For - * example, an invalid combination may involve the filter not - * operating correctly on certain datatypes, on certain datatype - * sizes, or on certain sizes of the chunk dataspace. If this filter - * is enabled through H5Pset_filter() as optional and the can apply - * function returns 0, the library will skip the filter in the filter - * pipeline. - * - * This callback can be the NULL pointer, in which case the library - * will assume that the filter can be applied to a dataset with any - * combination of dataset creation property list values, datatypes, - * and dataspaces. - * - * The \Emph{set local} callback function is defined as follows: - * \snippet this H5Z_set_local_func_t_snip - * - * After the can apply callbacks are checked for a new dataset, the - * \Emph{set local} callback functions for any filters used in the - * dataset creation property list are called. These callbacks receive - * \c dcpl_id, the dataset's private copy of the dataset creation - * property list passed in to H5Dcreate() (i.e. not the actual - * property list passed in to H5Dcreate()); \c type_id, the datatype - * identifier passed in to H5Dcreate(), which is not copied and should - * not be modified; and \c space_id, a dataspace describing the chunk - * (for chunked dataset storage), which should also not be modified. - * - * The set local callback must set any filter parameters that are - * specific to this dataset, based on the combination of the dataset - * creation property list values, the datatype, and the dataspace. For - * example, some filters perform different actions based on different - * datatypes, datatype sizes, numbers of dimensions, or dataspace - * sizes. - * - * The \Emph{set local} callback may be the NULL pointer, in which - * case, the library will assume that there are no dataset-specific - * settings for this filter. - * - * The \Emph{set local} callback function must return a non-negative - * value on success and a negative value for an error. - * - * The \Emph{filter operation} callback function, defining the - * filter's operation on the data, is defined as follows: - * \snippet this H5Z_func_t_snip - * - * The parameters \c flags, \c cd_nelmts, and \c cd_values are the - * same as for the function H5Pset_filter(). The one exception is that - * an additional flag, #H5Z_FLAG_REVERSE, is set when the filter is - * called as part of the input pipeline. - * - * The parameter \c buf points to the input buffer which has a size of - * \c buf_size bytes, \c nbytes of which are valid data. - * - * The filter should perform the transformation in place if possible. - * If the transformation cannot be done in place, then the filter - * should allocate a new buffer with malloc() and assign it to \c buf, - * assigning the allocated size of that buffer to \c buf_size. The old - * buffer should be freed by calling free(). - * - * If successful, the \Emph{filter operation} callback function - * returns the number of valid bytes of data contained in \c buf. In - * the case of failure, the return value is 0 (zero) and all pointer - * arguments are left unchanged. - * - * \version 1.8.6 Return type for the \Emph{can apply} callback function, - * \ref H5Z_can_apply_func_t, changed to \ref htri_t. - * \version 1.8.5 Semantics of the \Emph{can apply} and \Emph{set local} - * callback functions changed to accommodate the use of filters - * with group fractal heaps. - * \version 1.8.3 #H5Z_class_t renamed to H5Z_class2_t, H5Z_class1_t structure - * introduced for backwards compatibility with release 1.6.x, - * and #H5Z_class_t macro introduced in this release. Function - * modified to accept either structure type. - * \version 1.8.0 The fields \c version, \c encoder_present, and - * \c decoder_present were added to the #H5Z_class_t \c struct - * in this release. - * \version 1.6.0 This function was substantially revised in Release 1.6.0 with - * a new #H5Z_class_t struct and new set local and can apply - * callback functions. - * - */ -H5_DLL herr_t H5Zregister(const void *cls); -/** - * \ingroup H5Z - * - * \brief Unregisters a filter. - * - * \param[in] id Identifier of the filter to be unregistered. - * \return \herr_t - * - * \details H5Zunregister() unregisters the filter specified in \p id. - * - * \details This function first iterates through all opened datasets and - * groups. If an open object that uses this filter is found, the - * function will fail with a message indicating that an object using - * the filter is still open. All open files are then flushed to make - * sure that all cached data that may use this filter are written out. - * - * If the application is a parallel program, all processes that - * participate in collective data write should call this function to - * ensure that all data is flushed. - * - * After a call to H5Zunregister(), the filter specified in filter - * will no longer be available to the application. - * - * \version 1.8.12 Function modified to check for open objects using the - * filter. - * \since 1.6.0 - */ -H5_DLL herr_t H5Zunregister(H5Z_filter_t id); -/** * \ingroup H5Z * * \brief Determines whether a filter is available @@ -662,29 +314,8 @@ H5_DLL htri_t H5Zfilter_avail(H5Z_filter_t id); */ H5_DLL herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags); -/* Symbols defined for compatibility with previous versions of the HDF5 API. - * - * Use of these symbols is deprecated. - */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/** - * The filter table maps filter identification numbers to structs that - * contain a pointers to the filter function and timing statistics. - */ -//! -typedef struct H5Z_class1_t { - H5Z_filter_t id; /**< Filter ID number */ - const char * name; /**< Comment for debugging */ - H5Z_can_apply_func_t can_apply; /**< The "can apply" callback for a filter */ - H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */ - H5Z_func_t filter; /**< The actual filter function */ -} H5Z_class1_t; -//! - -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - #ifdef __cplusplus } #endif -#endif + +#endif /* _H5Zpublic_H */ diff --git a/src/H5err.txt b/src/H5err.txt index 64452ec..d2f1093 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -105,7 +105,7 @@ SECTION, PIPELINE, I/O pipeline errors SECTION, SYSTEM, System level errors SECTION, PLUGIN, Plugin errors SECTION, MAP, Map related errors -SECTION, ASYNC, Asynchronous I/O errors +SECTION, ASYNC, Asynchronous operation errors SECTION, NONE, No error # Minor errors @@ -139,6 +139,7 @@ MINOR, FILEACC, H5E_NOTHDF5, Not an HDF5 file MINOR, FILEACC, H5E_BADFILE, Bad file ID accessed MINOR, FILEACC, H5E_TRUNCATED, File has been truncated MINOR, FILEACC, H5E_MOUNT, File mount error +MINOR, FILEACC, H5E_UNMOUNT, File unmount error MINOR, FILEACC, H5E_CANTDELETEFILE, Unable to delete file MINOR, FILEACC, H5E_CANTLOCKFILE, Unable to lock file MINOR, FILEACC, H5E_CANTUNLOCKFILE, Unable to unlock file @@ -290,6 +291,7 @@ MINOR, MAP, H5E_CANTPUT, Can't put value # Asynchronous operation errors MINOR, ASYNC, H5E_CANTWAIT, Can't wait on operation +MINOR, ASYNC, H5E_CANTCANCEL, Can't cancel operation # No error, for backward compatibility */ MINOR, NONE, H5E_NONE_MINOR, No error diff --git a/src/H5private.h b/src/H5private.h index 0ff4c56..9c2459a 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1598,6 +1598,9 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #ifndef HDunlink #define HDunlink(S) unlink(S) #endif /* HDunlink */ +#ifndef HDunsetenv +#define HDunsetenv(S) unsetenv(S) +#endif /* HDsetenv */ #ifndef HDutime #define HDutime(S, T) utime(S, T) #endif /* HDutime */ diff --git a/src/H5system.c b/src/H5system.c index 144e0bc..7dd0b74 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -460,6 +460,9 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz) * Interestingly, getenv *is* available in the Windows * POSIX layer, just not setenv. * + * Note: Passing an empty string ("") for the value will remove + * the variable from the environment (like unsetenv(3)) + * * Return: Success: 0 * Failure: non-zero error code * @@ -471,14 +474,14 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz) int Wsetenv(const char *name, const char *value, int overwrite) { - size_t bufsize; - errno_t err; - /* If we're not overwriting, check if the environment variable exists. * If it does (i.e.: the required buffer size to store the variable's * value is non-zero), then return an error code. */ if (!overwrite) { + size_t bufsize; + errno_t err; + err = getenv_s(&bufsize, NULL, 0, name); if (err || bufsize) return (int)err; diff --git a/src/H5trace.c b/src/H5trace.c index ecb2705..3a5d420 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); @@ -2873,6 +2903,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 +2935,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 +3015,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 +3027,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 +3123,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 +3135,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 +3167,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 +3190,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 +3360,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; @@ -3608,6 +3626,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) H5RS_acat(rs, "H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG"); break; +#ifdef H5_HAVE_PARALLEL case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: H5RS_acat(rs, "H5VL_NATIVE_FILE_GET_MPI_ATOMICITY"); break; @@ -3615,6 +3634,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: H5RS_acat(rs, "H5VL_NATIVE_FILE_SET_MPI_ATOMICITY"); break; +#endif /* H5_HAVE_PARALLEL */ case H5VL_NATIVE_FILE_POST_OPEN: H5RS_acat(rs, "H5VL_NATIVE_FILE_POST_OPEN"); diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 88911b0..3718121 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -101,6 +101,7 @@ H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); #define HDgettimeofday(V, Z) Wgettimeofday(V, Z) #define HDsetenv(N, V, O) Wsetenv(N, V, O) +#define HDunsetenv(N, V, O) Wsetenv(N, "", 1) #define HDflock(F, L) Wflock(F, L) #define HDgetlogin() Wgetlogin() diff --git a/src/Makefile.am b/src/Makefile.am index 51d847f..ce29217 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -105,12 +105,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 @@ -151,11 +150,15 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5Mpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ - H5Rpublic.h H5Spublic.h H5Tpublic.h H5TSpublic.h \ + H5Rpublic.h H5Spublic.h H5Tpublic.h \ H5VLconnector.h H5VLconnector_passthru.h \ H5VLnative.h H5VLpassthru.h H5VLpublic.h \ H5Zpublic.h +# Public component author headers +include_HEADERS += hdf5dev.h H5ESdevelop.h H5FDdevelop.h H5Idevelop.h \ + H5Ldevelop.h H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h + # install libhdf5.settings in lib directory settingsdir=$(libdir) settings_DATA=libhdf5.settings diff --git a/src/hdf5.h b/src/hdf5.h index 6edc084..b6b5f59 100644 --- a/src/hdf5.h +++ b/src/hdf5.h @@ -38,7 +38,6 @@ #include "H5Rpublic.h" /* References */ #include "H5Spublic.h" /* Dataspaces */ #include "H5Tpublic.h" /* Datatypes */ -#include "H5TSpublic.h" /* Thread-safety */ #include "H5VLpublic.h" /* Virtual Object Layer */ #include "H5Zpublic.h" /* Data filters */ diff --git a/src/hdf5dev.h b/src/hdf5dev.h new file mode 100644 index 0000000..201442d --- /dev/null +++ b/src/hdf5dev.h @@ -0,0 +1,38 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 is the main public HDF5 include file for component authors. + */ + +#ifndef _HDF5DEV_H +#define _HDF5DEV_H + +/* Include general purpose application developer interfaces */ +#include "hdf5.h" + +/* Application developer headers for various interfaces */ +#include "H5ESdevelop.h" /* Event Sets */ +#include "H5FDdevelop.h" /* File drivers */ +#include "H5Idevelop.h" /* ID management */ +#include "H5Ldevelop.h" /* Links */ +#include "H5PLextern.h" /* Plugins */ +#include "H5Tdevelop.h" /* Datatypes */ +#include "H5TSdevelop.h" /* Threadsafety */ +#include "H5Zdevelop.h" /* Data filters */ + +/* 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 */ + +#endif /* _HDF5DEV_H */ diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 17931cf..e840559 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -402,6 +402,8 @@ set (test_CLEANFILES mirror_rw/* mirror_wo/* event_set_*.h5 + h5s_block.h5 + h5s_plist.h5 ) # Remove any output file left over from previous test run diff --git a/test/Makefile.am b/test/Makefile.am index 4bf9620..d465664 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -175,7 +175,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse zero_chunk.h5 chunk_single.h5 swmr_non_latest.h5 \ earray_hdr_fd.h5 farray_hdr_fd.h5 bt2_hdr_fd.h5 \ storage_size.h5 dls_01_strings.h5 power2up.h5 version_bounds.h5 \ - alloc_0sized.h5 \ + alloc_0sized.h5 h5s_block.h5 h5s_plist.h5 \ extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ stab.h5 extern_[1-5].h5 extern_[1-4][rw].raw gheap[0-4].h5 \ diff --git a/test/chunk_info.c b/test/chunk_info.c index 7104941..7c6dcc1 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -1676,7 +1676,7 @@ test_basic_query(hid_t fapl) /* iterate over all chunks */ cptr = &(chunk_infos[0]); - if (H5Dchunk_iter(dset, &iter_cb, &cptr) < 0) + if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb, &cptr) < 0) TEST_ERROR; VERIFY(cptr, &(chunk_infos[2]), "Iterator did not iterate all chunks"); @@ -1690,7 +1690,7 @@ test_basic_query(hid_t fapl) /* iterate and stop after one iteration */ cptr = &(chunk_infos[0]); - if (H5Dchunk_iter(dset, &iter_cb_stop, &cptr) < 0) + if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb_stop, &cptr) < 0) TEST_ERROR; VERIFY(cptr, &(chunk_infos[1]), "Verification of halted iterator failed\n"); @@ -1698,7 +1698,7 @@ test_basic_query(hid_t fapl) cptr = &(chunk_infos[0]); H5E_BEGIN_TRY { - ret = H5Dchunk_iter(dset, &iter_cb_fail, &cptr); + ret = H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb_fail, &cptr); } H5E_END_TRY; if (ret >= 0) diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 61e3df9..0d270bd 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -1990,23 +1990,23 @@ test_read_unallocated_chunk(hid_t file) /* Create the data space with unlimited dimensions. */ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; + FAIL_STACK_ERROR; if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; + FAIL_STACK_ERROR; /* Modify dataset creation properties, i.e. enable chunking, no compression */ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; + FAIL_STACK_ERROR; if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0) - goto error; + FAIL_STACK_ERROR; /* Create a new dataset within the file using cparms creation properties. */ if ((dataset = H5Dcreate2(file, DATASETNAME11, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) - goto error; + FAIL_STACK_ERROR; if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; + FAIL_STACK_ERROR; /* Write a single chunk to intialize the chunk storage */ HDmemset(direct_buf, 0, CHUNK_NX * CHUNK_NY * sizeof(int)); @@ -2014,7 +2014,7 @@ test_read_unallocated_chunk(hid_t file) offset[1] = 0; if (H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0) - goto error; + FAIL_STACK_ERROR; /* Attempt to read each chunk in the dataset. Chunks are not allocated, * therefore we expect the result of H5Dread_chunk to fail. Chunk idx starts @@ -2034,7 +2034,7 @@ test_read_unallocated_chunk(hid_t file) /* Check that the chunk read call does not succeed. */ if (status != -1) - goto error; + TEST_ERROR /* Query the size of the non-existant chunk */ direct_chunk_nbytes = ULONG_MAX; @@ -2046,18 +2046,23 @@ test_read_unallocated_chunk(hid_t file) /* Check that the chunk storage size call does not succeed. */ if (status != -1) - goto error; - if (direct_chunk_nbytes != 0) - goto error; + TEST_ERROR + if (direct_chunk_nbytes != ULONG_MAX) + TEST_ERROR } } /* Close/release resources. */ - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); + if (H5Dclose(dataset) < 0) + FAIL_STACK_ERROR; + if (H5Sclose(mem_space) < 0) + FAIL_STACK_ERROR; + if (H5Sclose(dataspace) < 0) + FAIL_STACK_ERROR; + if (H5Pclose(cparms) < 0) + FAIL_STACK_ERROR; + if (H5Pclose(dxpl) < 0) + FAIL_STACK_ERROR; PASSED(); return 0; @@ -2121,103 +2126,100 @@ test_single_chunk(unsigned config) TESTING("Single chunk I/O"); /* Initialize data */ - for (i = 0; i < DIM0; i++) { + for (i = 0; i < DIM0; i++) for (j = 0; j < DIM1; j++) wdata[i][j] = j / CHUNK0; - } /* Create a new file with the latest format */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_LATEST) if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; + FAIL_STACK_ERROR; if ((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + FAIL_STACK_ERROR; /* Create dataspace */ if ((sid = H5Screate_simple(2, dims, NULL)) < 0) - goto error; + FAIL_STACK_ERROR; /* Create the dataset creation property list and set the chunk size */ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Pset_chunk(dcpl, 2, chunk) < 0) - goto error; + FAIL_STACK_ERROR; /* Create the dataset */ if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_DIRECT_WRITE) { /* Write the data directly to the dataset */ if (H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0 * CHUNK1 * 4, (void *)wdata) < 0) - goto error; + FAIL_STACK_ERROR; } /* end if */ else /* Write the data to the dataset */ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0) - goto error; + FAIL_STACK_ERROR; /* * Close and release resources. */ if (H5Pclose(dcpl) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_REOPEN_DSET) if (H5Dclose(did) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Sclose(sid) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Pclose(fapl) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_REOPEN_FILE) if (H5Fclose(fid) < 0) - goto error; + FAIL_STACK_ERROR; /* Open the file and dataset with default properties */ if (config & CONFIG_REOPEN_FILE) if ((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_REOPEN_DSET) if ((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0) - goto error; + FAIL_STACK_ERROR; /* Retrieve dataset creation property list */ if ((dcpl = H5Dget_create_plist(did)) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_DIRECT_READ) { /* Read the data directly */ if (H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0) - goto error; + FAIL_STACK_ERROR; /* Verify returned filter mask */ if (filters != 0) - goto error; + TEST_ERROR } /* end if */ else /* Read the data */ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) - goto error; + FAIL_STACK_ERROR; /* Verify that the data read was correct. */ - for (i = 0; i < DIM0; i++) { - for (j = 0; j < DIM1; j++) { + for (i = 0; i < DIM0; i++) + for (j = 0; j < DIM1; j++) if (rdata[i][j] != wdata[i][j]) - goto error; - } - } + TEST_ERROR /* * Close and release resources */ if (H5Pclose(dcpl) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Dclose(did) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Fclose(fid) < 0) - goto error; + FAIL_STACK_ERROR; PASSED(); return 0; diff --git a/test/dsets.c b/test/dsets.c index 96f8b81..cc35fe3 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -83,6 +83,8 @@ const char *FILENAME[] = {"dataset", /* 0 */ "power2up", /* 24 */ "version_bounds", /* 25 */ "alloc_0sized", /* 26 */ + "h5s_block", /* 27 */ + "h5s_plist", /* 28 */ NULL}; #define OHMIN_FILENAME_A "ohdr_min_a" @@ -14963,6 +14965,370 @@ error: } /* end test_object_header_minimization_dcpl() */ /*----------------------------------------------------------------------------- + * Function: test_h5s_block + * + * Purpose: Test the H5S_BLOCK feature. + * + * Return: Success/pass: 0 + * Failure/error: -1 + * + * Programmer: Quincey Koziol + * 3 November 2020 + * + *----------------------------------------------------------------------------- + */ +static herr_t +test_h5s_block(void) +{ + hid_t file_id = H5I_INVALID_HID; /* File ID */ + char filename[FILENAME_BUF_SIZE] = ""; + hid_t dset_id = H5I_INVALID_HID; /* Dataset ID */ + hsize_t dims[1] = {20}; /* Dataset's dataspace size */ + hsize_t start = 2; /* Starting offset of hyperslab selection */ + hsize_t count = 10; /* Count of hyperslab selection */ + hid_t file_space_id = H5I_INVALID_HID; /* File dataspace ID */ + int buf[20]; /* Memory buffer for I/O */ + unsigned u; /* Local index variable */ + herr_t ret; + + TESTING("contiguous memory buffers with H5S_BLOCK"); + + /*********/ + /* SETUP */ + /*********/ + if (NULL == h5_fixname(FILENAME[27], H5P_DEFAULT, filename, sizeof(filename))) + TEST_ERROR + if (H5I_INVALID_HID == (file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))) + FAIL_STACK_ERROR + if ((file_space_id = H5Screate_simple(1, dims, NULL)) < 0) + FAIL_STACK_ERROR + if ((dset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_INT, file_space_id, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + for (u = 0; u < 20; u++) + buf[u] = (int)u; + + /*********/ + /* TESTS */ + /*********/ + + /* Check error cases */ + H5E_BEGIN_TRY + { + ret = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_BLOCK, H5P_DEFAULT, buf); + } + H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR + + /* Write the entire dataset */ + if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_BLOCK, H5S_ALL, H5P_DEFAULT, buf) < 0) + FAIL_STACK_ERROR + + /* Reset the memory buffer */ + HDmemset(buf, 0, sizeof(buf)); + + /* Read the entire dataset */ + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_BLOCK, H5S_ALL, H5P_DEFAULT, buf) < 0) + FAIL_STACK_ERROR + + /* Verify the data read in */ + for (u = 0; u < 20; u++) + if (buf[u] != (int)u) + TEST_ERROR + + /* Read a hyperslab from the file to the first 10 elements of the buffer */ + if (H5Sselect_hyperslab(file_space_id, H5S_SELECT_SET, &start, NULL, &count, NULL) < 0) + FAIL_STACK_ERROR + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_BLOCK, file_space_id, H5P_DEFAULT, buf) < 0) + FAIL_STACK_ERROR + + /* Verify the data read in */ + for (u = 0; u < count; u++) + if (buf[u] != (int)(u + start)) + TEST_ERROR + + /* Verify that reading 0 elements is handled correctly and doesn't modify buffer */ + if (H5Sselect_none(file_space_id) < 0) + FAIL_STACK_ERROR + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_BLOCK, file_space_id, H5P_DEFAULT, buf) < 0) + FAIL_STACK_ERROR + + /* Verify the data read in */ + for (u = 0; u < count; u++) + if (buf[u] != (int)(u + start)) + TEST_ERROR + + /************/ + /* TEARDOWN */ + /************/ + if (FAIL == H5Sclose(file_space_id)) + FAIL_STACK_ERROR + if (FAIL == H5Dclose(dset_id)) + FAIL_STACK_ERROR + if (FAIL == H5Fclose(file_id)) + FAIL_STACK_ERROR + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Sclose(file_space_id); + H5Dclose(dset_id); + H5Fclose(file_id); + } + H5E_END_TRY; + + return FAIL; +} /* end test_h5s_block() */ + +/*----------------------------------------------------------------------------- + * Function: test_h5s_plist + * + * Purpose: Test the H5S_PLIST feature. + * + * Return: Success/pass: 0 + * Failure/error: -1 + * + * Programmer: Quincey Koziol + * 28 January 2021 + * + *----------------------------------------------------------------------------- + */ +static herr_t +test_h5s_plist(void) +{ + hid_t file_id = H5I_INVALID_HID; /* File ID */ + char filename[FILENAME_BUF_SIZE] = ""; + hid_t dset_id = H5I_INVALID_HID; /* Dataset ID */ + hsize_t dims[1] = {20}; /* Dataset's dataspace size */ + hid_t dxpl_id = H5I_INVALID_HID; /* Dataset xfer property list ID */ + hid_t dxpl_id_copy = H5I_INVALID_HID; /* Copy of dataset xfer property list ID */ + hsize_t start = 2; /* Starting offset of hyperslab selection */ + hsize_t stride = 1; /* Stride of hyperslab selection */ + hsize_t count = 10; /* Count of hyperslab selection */ + hsize_t start2 = 14; /* Starting offset of hyperslab selection */ + hsize_t count2 = 4; /* Count of hyperslab selection */ + hsize_t block = 1; /* Block size of hyperslab selection */ + hid_t file_space_id = H5I_INVALID_HID; /* File dataspace ID */ + int buf[20]; /* Memory buffer for I/O */ + unsigned u; /* Local index variable */ + herr_t ret; + + TESTING("dataset's dataspace selection for I/O in DXPL with H5S_PLIST"); + + /*********/ + /* SETUP */ + /*********/ + if (NULL == h5_fixname(FILENAME[28], H5P_DEFAULT, filename, sizeof(filename))) + TEST_ERROR + if (H5I_INVALID_HID == (file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))) + FAIL_STACK_ERROR + if ((file_space_id = H5Screate_simple(1, dims, NULL)) < 0) + FAIL_STACK_ERROR + if ((dset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_INT, file_space_id, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + + for (u = 0; u < 20; u++) + buf[u] = (int)u; + + /*********/ + /* TESTS */ + /*********/ + + /* Check error cases */ + H5E_BEGIN_TRY + { + /* Bad rank */ + ret = H5Pset_dataset_io_hyperslab_selection(dxpl_id, 0, H5S_SELECT_SET, &start, &stride, &count, + &block); + } + H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR + H5E_BEGIN_TRY + { + /* Bad selection operator */ + ret = H5Pset_dataset_io_hyperslab_selection(dxpl_id, 1, H5S_SELECT_NOOP, &start, &stride, &count, + &block); + } + H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR + H5E_BEGIN_TRY + { + /* Bad start pointer */ + ret = + H5Pset_dataset_io_hyperslab_selection(dxpl_id, 1, H5S_SELECT_SET, NULL, &stride, &count, &block); + } + H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR + H5E_BEGIN_TRY + { + /* Bad stride value (stride of NULL is OK) */ + stride = 0; + ret = H5Pset_dataset_io_hyperslab_selection(dxpl_id, 1, H5S_SELECT_SET, &start, &stride, &count, + &block); + stride = 1; + } + H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR + H5E_BEGIN_TRY + { + /* Bad count pointer */ + ret = + H5Pset_dataset_io_hyperslab_selection(dxpl_id, 1, H5S_SELECT_SET, &start, &stride, NULL, &block); + } + H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR + + /* Block pointer is allowed to be NULL */ + + H5E_BEGIN_TRY + { + /* H5S_PLIST for memory dataspace */ + ret = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_PLIST, H5S_ALL, H5P_DEFAULT, buf); + } + H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR + + /* Write the entire dataset */ + if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_BLOCK, H5S_ALL, H5P_DEFAULT, buf) < 0) + FAIL_STACK_ERROR + + /* Reset the memory buffer */ + HDmemset(buf, 0, sizeof(buf)); + + /* Read the entire dataset */ + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_BLOCK, H5S_ALL, H5P_DEFAULT, buf) < 0) + FAIL_STACK_ERROR + + /* Verify the data read in */ + for (u = 0; u < 20; u++) + if (buf[u] != (int)u) + TEST_ERROR + + /* Reset the memory buffer */ + HDmemset(buf, 0, sizeof(buf)); + + /* Set valid selection in DXPL */ + if (H5Pset_dataset_io_hyperslab_selection(dxpl_id, 1, H5S_SELECT_SET, &start, &stride, &count, &block) < + 0) + FAIL_STACK_ERROR + + /* Read a hyperslab from the file to the first 10 elements of the buffer */ + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_BLOCK, H5S_PLIST, dxpl_id, buf) < 0) + FAIL_STACK_ERROR + + /* Verify the data read in */ + for (u = 0; u < count; u++) + if (buf[u] != (int)(u + start)) + TEST_ERROR + + /* Reset the memory buffer */ + HDmemset(buf, 0, sizeof(buf)); + + /* Check for copying property list w/selection */ + if ((dxpl_id_copy = H5Pcopy(dxpl_id)) < 0) + FAIL_STACK_ERROR + + /* Read a hyperslab from the file to the first 10 elements of the buffer */ + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_BLOCK, H5S_PLIST, dxpl_id_copy, buf) < 0) + FAIL_STACK_ERROR + + /* Verify the data read in */ + for (u = 0; u < count; u++) + if (buf[u] != (int)(u + start)) + TEST_ERROR + + /* Attempt to 'OR' block with invalid dimensions into the selection */ + H5E_BEGIN_TRY + { + ret = H5Pset_dataset_io_hyperslab_selection(dxpl_id_copy, 2, H5S_SELECT_OR, &start, &stride, &count, + &block); + } + H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR + + /* Set new valid selection in DXPL */ + if (H5Pset_dataset_io_hyperslab_selection(dxpl_id_copy, 1, H5S_SELECT_SET, &start, &stride, &count, + &block) < 0) + FAIL_STACK_ERROR + + /* Read a hyperslab from the file to the first 10 elements of the buffer */ + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_BLOCK, H5S_PLIST, dxpl_id_copy, buf) < 0) + FAIL_STACK_ERROR + + /* Verify the data read in */ + for (u = 0; u < count; u++) + if (buf[u] != (int)(u + start)) + TEST_ERROR + + /* Close the copy */ + if (FAIL == H5Pclose(dxpl_id_copy)) + FAIL_STACK_ERROR + dxpl_id_copy = H5I_INVALID_HID; + + /* 'OR' valid block into the existing selection in original DXPL */ + if (H5Pset_dataset_io_hyperslab_selection(dxpl_id, 1, H5S_SELECT_OR, &start2, &stride, &count2, &block) < + 0) + FAIL_STACK_ERROR + + /* Read a disjoint hyperslab from the file to the first 10 elements of the buffer */ + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_BLOCK, H5S_PLIST, dxpl_id, buf) < 0) + FAIL_STACK_ERROR + + /* Verify the data read in */ + for (u = 0; u < count; u++) + if (buf[u] != (int)(u + start)) + TEST_ERROR + for (u = 0; u < count2; u++) + if (buf[u + count] != (int)(u + start2)) + TEST_ERROR + + /************/ + /* TEARDOWN */ + /************/ + if (FAIL == H5Pclose(dxpl_id)) + FAIL_STACK_ERROR + if (FAIL == H5Sclose(file_space_id)) + FAIL_STACK_ERROR + if (FAIL == H5Dclose(dset_id)) + FAIL_STACK_ERROR + if (FAIL == H5Fclose(file_id)) + FAIL_STACK_ERROR + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(dxpl_id_copy); + H5Pclose(dxpl_id); + H5Sclose(file_space_id); + H5Dclose(dset_id); + H5Fclose(file_id); + } + H5E_END_TRY; + + return FAIL; +} /* end test_h5s_plist() */ + +/*----------------------------------------------------------------------------- * Function: test_0sized_dset_metadata_alloc * * Purpose: Tests the metadata allocation for 0-sized datasets. @@ -15407,7 +15773,10 @@ main(void) /* Tests version bounds using its own file */ nerrors += (test_versionbounds() < 0 ? 1 : 0); + /* Tests that use their own file */ nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0); + nerrors += (test_h5s_block() < 0 ? 1 : 0); + nerrors += (test_h5s_plist() < 0 ? 1 : 0); /* Run misc tests */ nerrors += (dls_01_main() < 0 ? 1 : 0); diff --git a/test/event_set.c b/test/event_set.c index 6568663..5df49e9 100644 --- a/test/event_set.c +++ b/test/event_set.c @@ -94,6 +94,71 @@ error: } /*------------------------------------------------------------------------- + * Function: test_es_none + * + * Purpose: Tests for passing H5ES_NONE to H5ES routines + * + * Return: Success: 0 + * Failure: number of errors + * + * Programmer: Quincey Koziol + * Friday, February 26, 2021 + * + *------------------------------------------------------------------------- + */ +static int +test_es_none(void) +{ + TESTING("event set H5ES_NONE"); + + /* Wait */ + if (H5ESwait(H5ES_NONE, 0, NULL, NULL) < 0) + TEST_ERROR; + + /* Cancel */ + if (H5EScancel(H5ES_NONE, NULL, NULL) < 0) + TEST_ERROR; + + /* Get count */ + if (H5ESget_count(H5ES_NONE, NULL) < 0) + TEST_ERROR; + + /* Get op counter */ + if (H5ESget_op_counter(H5ES_NONE, NULL) < 0) + TEST_ERROR; + + /* Get error status */ + if (H5ESget_err_status(H5ES_NONE, NULL) < 0) + TEST_ERROR; + + /* Get error count */ + if (H5ESget_err_count(H5ES_NONE, NULL) < 0) + TEST_ERROR; + + /* Get error info */ + if (H5ESget_err_info(H5ES_NONE, 0, NULL, NULL) < 0) + TEST_ERROR; + + /* Register insert function */ + if (H5ESregister_insert_func(H5ES_NONE, NULL, NULL) < 0) + TEST_ERROR; + + /* Register complete function */ + if (H5ESregister_complete_func(H5ES_NONE, NULL, NULL) < 0) + TEST_ERROR; + + /* Close */ + if (H5ESclose(H5ES_NONE) < 0) + TEST_ERROR; + + PASSED(); + return 0; + +error: + return 1; +} + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests event sets @@ -118,6 +183,7 @@ main(void) /* Tests */ nerrors += test_es_create(); + nerrors += test_es_none(); /* Cleanup */ h5_cleanup(FILENAME, fapl_id); diff --git a/test/filter_plugin1_dsets.c b/test/filter_plugin1_dsets.c index 5d6c1ef..2b1e4d2 100644 --- a/test/filter_plugin1_dsets.c +++ b/test/filter_plugin1_dsets.c @@ -17,7 +17,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define FILTER1_ID 257 diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c index d2011d4..0bef1a0 100644 --- a/test/filter_plugin2_dsets.c +++ b/test/filter_plugin2_dsets.c @@ -17,7 +17,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define FILTER2_ID 258 #define MULTIPLIER 3 diff --git a/test/filter_plugin3_dsets.c b/test/filter_plugin3_dsets.c index 618ce06..b9b3b82 100644 --- a/test/filter_plugin3_dsets.c +++ b/test/filter_plugin3_dsets.c @@ -18,7 +18,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define FILTER3_ID 259 diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c index 630dcd6..589347c 100644 --- a/test/filter_plugin4_groups.c +++ b/test/filter_plugin4_groups.c @@ -18,7 +18,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define FILTER4_ID 260 #define SUFFIX_LEN 8 diff --git a/test/h5test.h b/test/h5test.h index 0d7dade..f5c9608 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -22,9 +22,10 @@ /* * Include required headers. This file tests internal library functions, - * so we include the private headers here. + * so we include the private headers here, along with developer routines. */ #include "hdf5.h" +#include "hdf5dev.h" #include "H5private.h" #include "H5Eprivate.h" diff --git a/test/links.c b/test/links.c index b2d0d9a..f022783 100644 --- a/test/links.c +++ b/test/links.c @@ -3507,6 +3507,7 @@ done: case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: return FAIL; @@ -3597,6 +3598,7 @@ done: case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: return FAIL; @@ -13785,6 +13787,7 @@ done: case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: return FAIL; @@ -13876,6 +13879,7 @@ done: case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: return FAIL; @@ -16683,7 +16687,7 @@ obj_exists(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Hard links */ - /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ + /* Verify that H5Oexists_by_name() returns false for non-existent link in root group */ H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT); @@ -16702,7 +16706,7 @@ obj_exists(hid_t fapl, hbool_t new_format) if (TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) TEST_ERROR - /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ + /* Verify that H5Oexists_by_name() returns false for non-existent object in non-root group */ H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index b574a8e..7a1de6c 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -19,7 +19,7 @@ #include "hdf5.h" /* For HDF5 plugin functionality */ -#include "H5PLextern.h" +#include "hdf5dev.h" /* This connector's header */ #include "null_vol_connector.h" diff --git a/test/tfile.c b/test/tfile.c index 6a52392..62f3c73 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1452,6 +1452,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, hid_t gid2, case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: ERROR("H5Fget_obj_ids"); diff --git a/test/trefstr.c b/test/trefstr.c index a3f568a..d0575ab 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -186,7 +186,7 @@ test_refstr_cmp(void) H5RS_str_t *rs1; /* Ref-counted string created */ H5RS_str_t *rs2; /* Ref-counted string created */ int cmp; /* Comparison value */ - ssize_t len; /* Length of string */ + size_t len; /* Length of string */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ diff --git a/test/vol.c b/test/vol.c index d975243..c7586d5 100644 --- a/test/vol.c +++ b/test/vol.c @@ -20,6 +20,12 @@ /* Headers needed */ #include "h5test.h" +#include "H5Iprivate.h" /* IDs */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ +#include "H5Tpkg.h" /* Datatypes */ +#define H5VL_FRIEND /* Suppress error about including H5VLpkg */ +#define H5VL_TESTING +#include "H5VLpkg.h" /* Virtual Object Layer */ /* Filename */ const char *FILENAME[] = {"native_vol_test", NULL}; @@ -35,6 +41,136 @@ const char *FILENAME[] = {"native_vol_test", NULL}; #define N_ELEMENTS 10 +/* A VOL class struct to verify registering optional operations */ +static int reg_opt_curr_op_val; +static herr_t reg_opt_op_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t reg_opt_link_optional(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req); +static herr_t reg_opt_datatype_get(void *obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req); +#define REG_OPT_VOL_NAME "reg_opt" +#define REG_OPT_VOL_VALUE ((H5VL_class_value_t)502) +static const H5VL_class_t reg_opt_vol_g = { + H5VL_VERSION, /* VOL class struct version */ + REG_OPT_VOL_VALUE, /* value */ + REG_OPT_VOL_NAME, /* name */ + 0, /* version */ + 0, /* capability flags */ + NULL, /* initialize */ + NULL, /* terminate */ + { + /* info_cls */ + (size_t)0, /* size */ + NULL, /* copy */ + NULL, /* compare */ + NULL, /* free */ + NULL, /* to_str */ + NULL, /* from_str */ + }, + { + /* wrap_cls */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* unwrap_object */ + NULL, /* free_wrap_ctx */ + }, + { + /* attribute_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + reg_opt_op_optional, /* optional */ + NULL /* close */ + }, + { + /* dataset_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + reg_opt_op_optional, /* optional */ + NULL /* close */ + }, + { + /* datatype_cls */ + NULL, /* commit */ + NULL, /* open */ + reg_opt_datatype_get, /* get */ + NULL, /* specific */ + reg_opt_op_optional, /* optional */ + NULL /* close */ + }, + { + /* file_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + reg_opt_op_optional, /* optional */ + NULL /* close */ + }, + { + /* group_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + reg_opt_op_optional, /* optional */ + NULL /* close */ + }, + { + /* link_cls */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + reg_opt_link_optional /* optional */ + }, + { + /* object_cls */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + reg_opt_link_optional /* optional */ + }, + { + /* introspect_cls */ + NULL, /* get_conn_cls */ + NULL, /* get_cap_flags */ + NULL, /* opt_query */ + }, + { + /* request_cls */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ + }, + { + /* blob_cls */ + NULL, /* put */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { + /* token_cls */ + NULL, /* cmp */ + NULL, /* to_str */ + NULL /* from_str */ + }, + NULL /* optional */ +}; + #define FAKE_VOL_NAME "fake" #define FAKE_VOL_VALUE ((H5VL_class_value_t)501) @@ -90,6 +226,136 @@ static const H5VL_class_t fake_vol_g = { }, { /* datatype_cls */ + NULL, /* commit */ + NULL, /* open */ + reg_opt_datatype_get, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { + /* file_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { + /* group_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { + /* link_cls */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { + /* object_cls */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { + /* introspect_cls */ + NULL, /* get_conn_cls */ + NULL, /* get_cap_flags */ + NULL, /* opt_query */ + }, + { + /* request_cls */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ + }, + { + /* blob_cls */ + NULL, /* put */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { + /* token_cls */ + NULL, /* cmp */ + NULL, /* to_str */ + NULL /* from_str */ + }, + NULL /* optional */ +}; + +static herr_t fake_async_get_cap_flags(const void *info, unsigned *cap_flags); + +#define FAKE_ASYNC_VOL_NAME "fake_async" +#define FAKE_ASYNC_VOL_VALUE ((H5VL_class_value_t)503) + +/* A VOL class struct that describes a VOL class with no + * functionality except to set the async capability flag. + */ +static const H5VL_class_t fake_async_vol_g = { + H5VL_VERSION, /* VOL class struct version */ + FAKE_ASYNC_VOL_VALUE, /* value */ + FAKE_ASYNC_VOL_NAME, /* name */ + 0, /* connector version */ + H5VL_CAP_FLAG_ASYNC, /* capability flags */ + NULL, /* initialize */ + NULL, /* terminate */ + { + /* info_cls */ + (size_t)0, /* size */ + NULL, /* copy */ + NULL, /* compare */ + NULL, /* free */ + NULL, /* to_str */ + NULL, /* from_str */ + }, + { + /* wrap_cls */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* unwrap_object */ + NULL, /* free_wrap_ctx */ + }, + { + /* attribute_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { + /* dataset_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { + /* datatype_cls */ NULL, /* commit */ NULL, /* open */ NULL, /* get */ @@ -134,8 +400,9 @@ static const H5VL_class_t fake_vol_g = { }, { /* introspect_cls */ - NULL, /* get_conn_cls */ - NULL, /* opt_query */ + NULL, /* get_conn_cls */ + fake_async_get_cap_flags, /* get_cap_flags */ + NULL, /* opt_query */ }, { /* request_cls */ @@ -163,6 +430,146 @@ static const H5VL_class_t fake_vol_g = { }; /*------------------------------------------------------------------------- + * Function: reg_opt_op_optional_verify + * + * Purpose: Common verification routine for dynamic optional operations + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +reg_opt_op_optional_verify(void *obj, H5VL_optional_args_t *args) +{ + int *o = (int *)obj; + int *op_args; + + /* Check for receiving correct operation value */ + if (args->op_type != reg_opt_curr_op_val) + return -1; + + /* Check that the object is correct */ + if ((-1) != *o) + return -1; + + /* Update the object, with the operation value */ + *o = args->op_type; + + /* Check that the argument is correct */ + op_args = args->args; + if (NULL == op_args) + return -1; + if ((-1) != *op_args) + return -1; + + /* Update the argument return parameter */ + *op_args = args->op_type; + + return 0; +} /* end reg_opt_op_optional_verify() */ + +/*------------------------------------------------------------------------- + * Function: reg_opt_op_optional + * + * Purpose: Common callback to perform a connector-specific operation + * on an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +reg_opt_op_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + /* Invoke the common value verification routine */ + return reg_opt_op_optional_verify(obj, args); +} /* end reg_opt_op_optional() */ + +/*------------------------------------------------------------------------- + * Function: reg_opt_link_optional + * + * Purpose: Callback to perform a connector-specific operation + * on a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +reg_opt_link_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) +{ + /* Check for receiving correct loc_params info */ + if (loc_params->type != H5VL_OBJECT_BY_NAME) + return -1; + if (loc_params->obj_type != H5I_GROUP) + return -1; + if (HDstrcmp(loc_params->loc_data.loc_by_name.name, ".") != 0) + return -1; + if (loc_params->loc_data.loc_by_name.lapl_id != H5P_LINK_ACCESS_DEFAULT) + return -1; + + /* Invoke the common value verification routine */ + return reg_opt_op_optional_verify(obj, args); +} /* end reg_opt_link_optional() */ + +/*------------------------------------------------------------------------- + * Function: reg_opt_datatype_get + * + * Purpose: Handles the datatype get callback + * + * Note: This is _strictly_ a testing fixture to support the + * exercise_reg_opt_oper() testing routine. It fakes just + * enough of the named datatype VOL callback for the + * H5VL_register_using_vol_id() call in that test routine to + * succeed. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +reg_opt_datatype_get(void H5_ATTR_UNUSED *obj, H5VL_datatype_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + if (H5VL_DATATYPE_GET_BINARY_SIZE == args->op_type) { + if (H5Tencode(H5T_NATIVE_INT, NULL, args->args.get_binary_size.size) < 0) + ret_value = FAIL; + } /* end if */ + else if (H5VL_DATATYPE_GET_BINARY == args->op_type) { + if (H5Tencode(H5T_NATIVE_INT, args->args.get_binary.buf, &args->args.get_binary.buf_size) < 0) + ret_value = FAIL; + } /* end if */ + else + ret_value = FAIL; + + return ret_value; +} /* end reg_opt_datatype_get() */ + +/*------------------------------------------------------------------------- + * Function: fake_async_get_cap_flags + * + * Purpose: Return the capability flags for the 'fake async' connector + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +fake_async_get_cap_flags(const void H5_ATTR_UNUSED *info, unsigned *cap_flags) +{ + *cap_flags = fake_async_vol_g.cap_flags; + + return SUCCEED; +} /* end fake_async_get_cap_flags() */ + +/*------------------------------------------------------------------------- * Function: test_vol_registration() * * Purpose: Tests if we can load, register, and close a simple @@ -1176,6 +1583,519 @@ error: } /* end test_basic_datatype_operation() */ +typedef herr_t (*reg_opt_obj_oper_t)(const char *app_file, const char *app_func, unsigned app_line, + hid_t obj_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id); +typedef herr_t (*reg_opt_link_oper_t)(const char *app_file, const char *app_func, unsigned app_line, + hid_t obj_id, const char *name, hid_t lapl_id, + H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id); +typedef union { + reg_opt_obj_oper_t obj_op; + reg_opt_link_oper_t link_op; +} reg_opt_oper_t; + +/*------------------------------------------------------------------------- + * Function: exercise_reg_opt_oper() + * + * Purpose: Exercise a particular optional operation for a type. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +exercise_reg_opt_oper(hid_t fake_vol_id, hid_t reg_opt_vol_id, H5VL_subclass_t subcls, + const char *subcls_name, H5I_type_t id_type, reg_opt_oper_t reg_opt_op) +{ + char op_name[256]; /* Operation name to register */ + hid_t obj_id = H5I_INVALID_HID; + H5VL_object_t * vol_obj; + H5VL_optional_args_t vol_cb_args; + int fake_obj, fake_arg; + int op_val = -1, op_val2 = -1; + int find_op_val; + herr_t ret = SUCCEED; + + /* Test registering optional operation */ + HDsnprintf(op_name, sizeof(op_name), "%s-op1", subcls_name); + if (H5VLregister_opt_operation(subcls, op_name, &op_val) < 0) + TEST_ERROR; + + /* Verify that the reserved amount of optional operations is obeyed */ + /* (The first optional operation registered should be at the lower limit) */ + if (op_val != H5VL_RESERVED_NATIVE_OPTIONAL) + TEST_ERROR; + + /* Look up 1st registered optional operation */ + find_op_val = 0; + if (H5VLfind_opt_operation(subcls, op_name, &find_op_val) < 0) + TEST_ERROR; + + /* Verify that the operation was looked up successfully */ + if (op_val != find_op_val) + TEST_ERROR; + + /* Test registering second optional operation */ + HDsnprintf(op_name, sizeof(op_name), "%s-op2", subcls_name); + if (H5VLregister_opt_operation(subcls, op_name, &op_val2) < 0) + TEST_ERROR; + + /* Verify that the reserved amount of optional operations is obeyed */ + /* (The 2nd optional operation registered should be at the lower limit + 1) */ + if (op_val2 != (H5VL_RESERVED_NATIVE_OPTIONAL + 1)) + TEST_ERROR; + + /* Look up 2nd registered optional operation */ + find_op_val = 0; + if (H5VLfind_opt_operation(subcls, op_name, &find_op_val) < 0) + TEST_ERROR; + + /* Verify that the operation was looked up successfully */ + if (op_val2 != find_op_val) + TEST_ERROR; + + /* Push a new API context on the stack */ + /* (Necessary for the named datatype construction routines) */ + if (H5VL_SUBCLS_DATATYPE == subcls) + H5CX_push(); + + /* Create fake object on fake VOL connector */ + if (H5I_INVALID_HID == (obj_id = H5VL_register_using_vol_id(id_type, &fake_obj, fake_vol_id, TRUE))) + TEST_ERROR; + + /* Pop the API context off the stack */ + if (H5VL_SUBCLS_DATATYPE == subcls) + H5CX_pop(FALSE); + + /* Attempt to issue operation on fake VOL connector */ + fake_obj = -1; + fake_arg = -1; + vol_cb_args.op_type = op_val; + vol_cb_args.args = &fake_arg; + H5E_BEGIN_TRY + { + if (H5VL_SUBCLS_LINK == subcls || H5VL_SUBCLS_OBJECT == subcls) + ret = (*reg_opt_op.link_op)(__FILE__, __func__, __LINE__, obj_id, ".", H5P_DEFAULT, &vol_cb_args, + H5P_DEFAULT, H5ES_NONE); + else + ret = (*reg_opt_op.obj_op)(__FILE__, __func__, __LINE__, obj_id, &vol_cb_args, H5P_DEFAULT, + H5ES_NONE); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to perform an optional operation with a NULL callback"); + if ((-1) != fake_obj) + FAIL_PUTS_ERROR("'fake_obj' changed during failed operation?"); + if ((-1) != fake_arg) + FAIL_PUTS_ERROR("'fake_arg' changed during failed operation?"); + + /* Named datatypes must be destroyed differently */ + if (H5VL_SUBCLS_DATATYPE == subcls) { + H5T_t *dt; + + /* Destroy fake datatype object */ + if (NULL == (dt = H5I_remove(obj_id))) + TEST_ERROR; + if (H5VL_free_object(dt->vol_obj) < 0) + TEST_ERROR; + dt->vol_obj = NULL; + if (H5T_close(dt) < 0) + TEST_ERROR; + } /* end if */ + else { + /* Destroy fake object */ + if (NULL == (vol_obj = H5I_remove(obj_id))) + TEST_ERROR; + if (H5VL_free_object(vol_obj) < 0) + TEST_ERROR; + } /* end else */ + + /* Push a new API context on the stack */ + /* (Necessary for the named datatype construction routines) */ + if (H5VL_SUBCLS_DATATYPE == subcls) + H5CX_push(); + + /* Create fake object on reg_opt VOL connector */ + if (H5I_INVALID_HID == (obj_id = H5VL_register_using_vol_id(id_type, &fake_obj, reg_opt_vol_id, TRUE))) + TEST_ERROR; + + /* Pop the API context off the stack */ + if (H5VL_SUBCLS_DATATYPE == subcls) + H5CX_pop(FALSE); + + /* Issue first operation */ + fake_obj = -1; + fake_arg = -1; + reg_opt_curr_op_val = op_val; + vol_cb_args.op_type = op_val; + vol_cb_args.args = &fake_arg; + if (H5VL_SUBCLS_LINK == subcls || H5VL_SUBCLS_OBJECT == subcls) + ret = (*reg_opt_op.link_op)(__FILE__, __func__, __LINE__, obj_id, ".", H5P_DEFAULT, &vol_cb_args, + H5P_DEFAULT, H5ES_NONE); + else + ret = + (*reg_opt_op.obj_op)(__FILE__, __func__, __LINE__, obj_id, &vol_cb_args, H5P_DEFAULT, H5ES_NONE); + if (ret < 0) + TEST_ERROR; + + /* Verify that fake object & argument were modified correctly */ + if (op_val != fake_obj) + FAIL_PUTS_ERROR("'fake_obj' not updated"); + if (op_val != fake_arg) + FAIL_PUTS_ERROR("'fake_arg' not updated"); + + /* Issue second operation */ + fake_obj = -1; + fake_arg = -1; + reg_opt_curr_op_val = op_val2; + vol_cb_args.op_type = op_val2; + vol_cb_args.args = &fake_arg; + if (H5VL_SUBCLS_LINK == subcls || H5VL_SUBCLS_OBJECT == subcls) + ret = (*reg_opt_op.link_op)(__FILE__, __func__, __LINE__, obj_id, ".", H5P_DEFAULT, &vol_cb_args, + H5P_DEFAULT, H5ES_NONE); + else + ret = + (*reg_opt_op.obj_op)(__FILE__, __func__, __LINE__, obj_id, &vol_cb_args, H5P_DEFAULT, H5ES_NONE); + if (ret < 0) + TEST_ERROR; + + /* Verify that fake object & argument were modified correctly */ + if (op_val2 != fake_obj) + FAIL_PUTS_ERROR("'fake_obj' not updated"); + if (op_val2 != fake_arg) + FAIL_PUTS_ERROR("'fake_arg' not updated"); + + /* Named datatypes must be destroyed differently */ + if (H5VL_SUBCLS_DATATYPE == subcls) { + H5T_t *dt; + + /* Destroy fake datatype object */ + if (NULL == (dt = H5I_remove(obj_id))) + TEST_ERROR; + if (H5VL_free_object(dt->vol_obj) < 0) + TEST_ERROR; + dt->vol_obj = NULL; + if (H5T_close(dt) < 0) + TEST_ERROR; + } /* end if */ + else { + /* Destroy fake object */ + if (NULL == (vol_obj = H5I_remove(obj_id))) + TEST_ERROR; + if (H5VL_free_object(vol_obj) < 0) + TEST_ERROR; + } /* end else */ + + /* Unregister 2nd registered optional operation */ + if (H5VLunregister_opt_operation(subcls, op_name) < 0) + TEST_ERROR; + + return SUCCEED; + +error: + return FAIL; +} /* end exercise_reg_opt_oper() */ + +/*------------------------------------------------------------------------- + * Function: test_register_opt_operation() + * + * Purpose: Tests if we can load, register, and close a simple + * VOL connector. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_register_opt_operation(void) +{ + hid_t fake_vol_id = H5I_INVALID_HID; + hid_t reg_opt_vol_id = H5I_INVALID_HID; + struct { + H5VL_subclass_t subcls; + const char * subcls_name; + H5I_type_t id_type; + reg_opt_oper_t reg_opt_op; + } test_params[] = {{H5VL_SUBCLS_ATTR, "attr", H5I_ATTR, {.obj_op = H5VLattr_optional_op}}, + {H5VL_SUBCLS_DATASET, "dataset", H5I_DATASET, {.obj_op = H5VLdataset_optional_op}}, + {H5VL_SUBCLS_DATATYPE, "datatype", H5I_DATATYPE, {.obj_op = H5VLdatatype_optional_op}}, + {H5VL_SUBCLS_FILE, "file", H5I_FILE, {.obj_op = H5VLfile_optional_op}}, + {H5VL_SUBCLS_GROUP, "group", H5I_GROUP, {.obj_op = H5VLgroup_optional_op}}, + {H5VL_SUBCLS_LINK, "link", H5I_GROUP, {.link_op = H5VLlink_optional_op}}, + {H5VL_SUBCLS_OBJECT, "object", H5I_GROUP, {.link_op = H5VLobject_optional_op}}}; + int op_val = -1; + unsigned u; + herr_t ret = SUCCEED; + + TESTING("dynamically registering optional operations"); + + /* Register the VOL connectors for testing */ + if ((fake_vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((reg_opt_vol_id = H5VLregister_connector(®_opt_vol_g, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Test registering invalid optional VOL subclass operations */ + H5E_BEGIN_TRY + { + ret = H5VLregister_opt_operation(H5VL_SUBCLS_NONE, "fail", &op_val); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to register an optional operation for the 'NONE' VOL subclass"); + if ((-1) != op_val) + FAIL_PUTS_ERROR("'op_val' changed during failed operation?"); + H5E_BEGIN_TRY + { + ret = H5VLregister_opt_operation(H5VL_SUBCLS_INFO, "fail2", &op_val); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to register an optional operation for the 'INFO' VOL subclass"); + if ((-1) != op_val) + FAIL_PUTS_ERROR("'op_val' changed during failed operation?"); + H5E_BEGIN_TRY + { + ret = H5VLregister_opt_operation(H5VL_SUBCLS_WRAP, "fail3", &op_val); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to register an optional operation for the 'WRAP' VOL subclass"); + if ((-1) != op_val) + FAIL_PUTS_ERROR("'op_val' changed during failed operation?"); + H5E_BEGIN_TRY + { + ret = H5VLregister_opt_operation(H5VL_SUBCLS_BLOB, "fail4", &op_val); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to register an optional operation for the 'BLOB' VOL subclass"); + if ((-1) != op_val) + FAIL_PUTS_ERROR("'op_val' changed during failed operation?"); + H5E_BEGIN_TRY + { + ret = H5VLregister_opt_operation(H5VL_SUBCLS_TOKEN, "fail5", &op_val); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to register an optional operation for the 'TOKEN' VOL subclass"); + if ((-1) != op_val) + FAIL_PUTS_ERROR("'op_val' changed during failed operation?"); + + /* Test registering valid optional VOL subclass operation with NULL op_val ptr*/ + H5E_BEGIN_TRY + { + ret = H5VLregister_opt_operation(H5VL_SUBCLS_FILE, "fail6", NULL); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to register an optional operation with a NULL 'op_val'"); + + /* Try finding a non-existent optional VOL subclass operation */ + H5E_BEGIN_TRY + { + ret = H5VLfind_opt_operation(H5VL_SUBCLS_DATASET, "fail", &op_val); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to find a non-existent optional operation"); + + /* Try unregistering a non-existent optional VOL subclass operation */ + H5E_BEGIN_TRY + { + ret = H5VLunregister_opt_operation(H5VL_SUBCLS_DATASET, "fail"); + } + H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to unregister a non-existent optional operation"); + + /* Optional operations on requests are supported (but difficult to test further) */ + if (H5VLregister_opt_operation(H5VL_SUBCLS_REQUEST, "req_op", &op_val) < 0) + TEST_ERROR; + + /* Register & test calling optional operations for each valid VOL subclass */ + /* (Table-driven, with test_params array) */ + for (u = 0; u < NELMTS(test_params); u++) + /* Exercise appropriate callback, for each VOL subclass */ + if (exercise_reg_opt_oper(fake_vol_id, reg_opt_vol_id, test_params[u].subcls, + test_params[u].subcls_name, test_params[u].id_type, + test_params[u].reg_opt_op) < 0) + TEST_ERROR; + + /* Unregister the VOL connectors */ + if (H5VLunregister_connector(fake_vol_id) < 0) + TEST_ERROR; + if (H5VLunregister_connector(reg_opt_vol_id) < 0) + TEST_ERROR; + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5VLunregister_connector(fake_vol_id); + H5VLunregister_connector(reg_opt_vol_id); + } + H5E_END_TRY; + + return FAIL; +} /* end test_register_opt_operation() */ + +/*------------------------------------------------------------------------- + * Function: test_async_vol_props() + * + * Purpose: Test properties related to asynchronous VOL connector operation + * + * Note: Overrides the HDF5_VOL_CONNECTOR environment variable, to + * provide stable testing environment. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_async_vol_props(void) +{ + hid_t fapl_id = H5I_INVALID_HID; + hid_t vol_id = H5I_INVALID_HID; + H5VL_pass_through_info_t passthru_info; + unsigned cap_flags = 0; + char * conn_env_str = NULL; + + TESTING("Async VOL props"); + + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + + /* Test 'capability flags' property */ + + /* Test query w/NULL for cap_flags parameter */ + if (H5Pget_vol_cap_flags(fapl_id, NULL) < 0) + FAIL_STACK_ERROR; + + /* Override possible environment variable & re-initialize default VOL connector */ + conn_env_str = HDgetenv("HDF5_VOL_CONNECTOR"); + if (conn_env_str) { + if (NULL == (conn_env_str = HDstrdup(conn_env_str))) + TEST_ERROR + if (HDunsetenv("HDF5_VOL_CONNECTOR") < 0) + TEST_ERROR + if (H5VL__reparse_def_vol_conn_variable_test() < 0) + TEST_ERROR + } /* end if */ + + /* Test query w/default VOL, which should indicate no async, since native connector + * doesn't support async. + */ + if (H5Pget_vol_cap_flags(fapl_id, &cap_flags) < 0) + FAIL_STACK_ERROR; + if ((cap_flags & H5VL_CAP_FLAG_ASYNC) > 0) + TEST_ERROR + if ((cap_flags & H5VL_CAP_FLAG_NATIVE_FILES) == 0) + TEST_ERROR + + /* Close FAPL */ + if (H5Pclose(fapl_id) < 0) + FAIL_STACK_ERROR; + + /* Register a fake VOL connector that sets the async capability flag */ + if ((vol_id = H5VLregister_connector(&fake_async_vol_g, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* Set environment variable to use 'fake async' connector & re-init default connector */ + if (HDsetenv("HDF5_VOL_CONNECTOR", "fake_async", TRUE) < 0) + TEST_ERROR + if (H5VL__reparse_def_vol_conn_variable_test() < 0) + TEST_ERROR + + /* Retrieve the file access property again */ + fapl_id = h5_fileaccess(); + + /* Test query w/fake async VOL, which should succeed */ + cap_flags = 0; + if (H5Pget_vol_cap_flags(fapl_id, &cap_flags) < 0) + FAIL_STACK_ERROR; + if ((cap_flags & H5VL_CAP_FLAG_ASYNC) == 0) + TEST_ERROR + if ((cap_flags & H5VL_CAP_FLAG_NATIVE_FILES) > 0) + TEST_ERROR + + /* Reset environment variable & re-init default connector */ + if (HDunsetenv("HDF5_VOL_CONNECTOR") < 0) + TEST_ERROR + if (H5VL__reparse_def_vol_conn_variable_test() < 0) + TEST_ERROR + + /* Close FAPL */ + if (H5Pclose(fapl_id) < 0) + FAIL_STACK_ERROR; + + /* Retrieve the file access property again */ + fapl_id = h5_fileaccess(); + + /* Set the VOL connector for the FAPL to the fake async connector */ + if (H5Pset_vol(fapl_id, vol_id, NULL) < 0) + FAIL_STACK_ERROR; + + /* Test query w/fake async VOL, which should succeed */ + cap_flags = 0; + if (H5Pget_vol_cap_flags(fapl_id, &cap_flags) < 0) + FAIL_STACK_ERROR; + if ((cap_flags & H5VL_CAP_FLAG_ASYNC) == 0) + TEST_ERROR + if ((cap_flags & H5VL_CAP_FLAG_NATIVE_FILES) > 0) + TEST_ERROR + + /* Stack the [internal] passthrough VOL connector on top of the fake async connector */ + passthru_info.under_vol_id = vol_id; + passthru_info.under_vol_info = NULL; + if (H5Pset_vol(fapl_id, H5VL_PASSTHRU, &passthru_info) < 0) + FAIL_STACK_ERROR; + + /* Test query w/passthru -> fake async VOL, which should succeed */ + cap_flags = 0; + if (H5Pget_vol_cap_flags(fapl_id, &cap_flags) < 0) + FAIL_STACK_ERROR; + if ((cap_flags & H5VL_CAP_FLAG_ASYNC) == 0) + TEST_ERROR + if ((cap_flags & H5VL_CAP_FLAG_NATIVE_FILES) > 0) + TEST_ERROR + + /* Unregister the fake async VOL ID */ + if (H5VLunregister_connector(vol_id) < 0) + TEST_ERROR; + + /* Close FAPL */ + if (H5Pclose(fapl_id) < 0) + FAIL_STACK_ERROR; + + /* Restore environment variable, if there was one */ + if (conn_env_str) { + if (HDsetenv("HDF5_VOL_CONNECTOR", conn_env_str, TRUE) < 0) + TEST_ERROR + HDfree(conn_env_str); + + if (H5VL__reparse_def_vol_conn_variable_test() < 0) + TEST_ERROR + } /* end if */ + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + H5VLunregister_connector(vol_id); + } + H5E_END_TRY; + HDfree(conn_env_str); + + return FAIL; +} /* end test_async_vol_props() */ + /*------------------------------------------------------------------------- * Function: main * @@ -1201,6 +2121,7 @@ main(void) HDputs("Testing basic Virtual Object Layer (VOL) functionality."); nerrors += test_vol_registration() < 0 ? 1 : 0; + nerrors += test_register_opt_operation() < 0 ? 1 : 0; nerrors += test_native_vol_init() < 0 ? 1 : 0; nerrors += test_basic_file_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_basic_group_operation() < 0 ? 1 : 0; @@ -1209,6 +2130,7 @@ main(void) nerrors += test_basic_object_operation() < 0 ? 1 : 0; nerrors += test_basic_link_operation() < 0 ? 1 : 0; nerrors += test_basic_datatype_operation() < 0 ? 1 : 0; + nerrors += test_async_vol_props() < 0 ? 1 : 0; if (nerrors) { HDprintf("***** %d Virtual Object Layer TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 5153bce..50cd306 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -1762,8 +1762,8 @@ test_write_3d_filtered_dataset_overlap(void) WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS)) / (hsize_t)(WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH * WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS)) - /* Add the amount that gets added when a rank moves down to its next section vertically in the - dataset */ + /* Add the amount that gets added when a rank moves down to its next + section vertically in the dataset */ + ((hsize_t)(WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH * WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS) * (i / (hsize_t)(mpi_size * WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH * WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS)))); @@ -4497,8 +4497,8 @@ test_read_3d_filtered_dataset_overlap(void) READ_SHARED_FILTERED_CHUNKS_3D_NCOLS)) / (hsize_t)(READ_SHARED_FILTERED_CHUNKS_3D_DEPTH * READ_SHARED_FILTERED_CHUNKS_3D_NCOLS)) - /* Add the amount that gets added when a rank moves down to its next section vertically in the - dataset */ + /* Add the amount that gets added when a rank moves down to its next + section vertically in the dataset */ + ((hsize_t)(READ_SHARED_FILTERED_CHUNKS_3D_DEPTH * READ_SHARED_FILTERED_CHUNKS_3D_NCOLS) * (i / (hsize_t)(mpi_size * READ_SHARED_FILTERED_CHUNKS_3D_DEPTH * READ_SHARED_FILTERED_CHUNKS_3D_NCOLS)))); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index eee9c53..41bea54 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -21,6 +21,7 @@ #include "h5tools_ref.h" #include "h5tools_utils.h" #include "H5private.h" +#include "hdf5dev.h" #ifdef H5_TOOLS_DEBUG /* global debug variables */ diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index b954a22..e7d074d 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -15,7 +15,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 433522d..61abb90 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -15,7 +15,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index f03254e..58d6129 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -13,6 +13,7 @@ #include "hdf5.h" #include "H5private.h" +#include "hdf5dev.h" /* * The output functions need a temporary buffer to hold a piece of the diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index 433522d..61abb90 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -15,7 +15,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index 1da6b63..cea4e76 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -23,6 +23,7 @@ #include "hdf5.h" #include "H5private.h" +#include "hdf5dev.h" /* not used yet #define UBTXT1 "u0.txt" diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 433522d..61abb90 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -15,7 +15,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c index b228344..0fa0642 100644 --- a/tools/test/h5repack/dynlib_rpk.c +++ b/tools/test/h5repack/dynlib_rpk.c @@ -18,7 +18,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define H5Z_FILTER_DYNLIB1 257 diff --git a/tools/test/h5repack/dynlib_vrpk.c b/tools/test/h5repack/dynlib_vrpk.c index 5eac4f2..454ae49 100644 --- a/tools/test/h5repack/dynlib_vrpk.c +++ b/tools/test/h5repack/dynlib_vrpk.c @@ -15,7 +15,7 @@ #include #include -#include "H5PLextern.h" +#include "hdf5dev.h" #define H5Z_FILTER_DYNLIB4 260 diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 1b08e95..209fd43 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -21,8 +21,8 @@ */ /* See H5private.h for how to include headers */ -#undef NDEBUG #include "hdf5.h" +#include "hdf5dev.h" #include #include diff --git a/utils/mirror_vfd/mirror_remote.h b/utils/mirror_vfd/mirror_remote.h index 6f37b0b..7a72372 100644 --- a/utils/mirror_vfd/mirror_remote.h +++ b/utils/mirror_vfd/mirror_remote.h @@ -16,6 +16,7 @@ */ #include "hdf5.h" +#include "hdf5dev.h" #include "H5private.h" #ifdef H5_HAVE_MIRROR_VFD -- cgit v0.12 From 1558ee7b3086bf572d98f1a5698bceccb8aa8804 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 3 Jun 2021 09:44:09 -0700 Subject: Updates PGI C/C++ configurations (#715) * Updates PGI C/C++ configurations Tweaks some settings and configures pgc++ to use C++11 * Updated copyright information --- MANIFEST | 1 + config/linux-gnulibc1 | 10 +++-- config/pgi-cxxflags | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ config/pgi-flags | 63 +++++++++++++++---------------- release_docs/RELEASE.txt | 19 +++++++++- 5 files changed, 150 insertions(+), 39 deletions(-) create mode 100644 config/pgi-cxxflags diff --git a/MANIFEST b/MANIFEST index e114586..7e166bb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -146,6 +146,7 @@ ./config/lt_vers.am ./config/Makefile.am.blank ./config/netbsd +./config/pgi-cxxflags ./config/pgi-fflags ./config/pgi-flags ./config/solaris diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 0fef161..1da2236 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -202,6 +202,9 @@ fi # Figure out GNU CXX compiler flags . $srcdir/config/gnu-cxxflags +# Figure out PGI CXX compiler flags +. $srcdir/config/pgi-cxxflags + # Figure out Clang CXX compiler flags . $srcdir/config/clang-cxxflags @@ -314,6 +317,9 @@ fi # check if the compiler_version_info is already set if test -z "$cxx_version_info"; then case $CXX in + *pgc++*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'pgc++'` + ;; *g++*) cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` @@ -322,10 +328,6 @@ case $CXX in cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'Version' |\ sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` ;; - *pgCC*) - cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'pgCC'` - ;; - *mpicxx*) cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep 'version' |\ sed 's/^[a-z0-9]* for //' |\ diff --git a/config/pgi-cxxflags b/config/pgi-cxxflags new file mode 100644 index 0000000..3b87db2 --- /dev/null +++ b/config/pgi-cxxflags @@ -0,0 +1,96 @@ +# -*- shell-script -*- +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# PGI pgc++ compiler or a derivative. It is careful not to do anything +# if the compiler is not PGI; otherwise `cxx_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for pgc++ +# pgc++ unless a compiler version is already known +# +# cxx_vendor: The compiler name: pgc++ +# cxx_version: Version number: 5.0-2, 5.2-2 +# +if test X = "X$cxx_flags_set"; then + cxx_version="`$CXX $CXXFLAGS -V 2>&1 |grep '^pgc++ '`" + if test X != "X$cxx_version"; then + cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*++\).*/\1/'` + cxx_version=`echo $cxx_version |sed 's/pgc++ \([-a-z0-9\.\-]*\).*/\1/'` + echo "compiler '$CXX' is PGI $cxx_vendor-$cxx_version" + + # Some version numbers + # PGI version numbers are of the form: "major.minor-patch" + cxx_vers_major=`echo $cxx_version | cut -f1 -d.` + cxx_vers_minor=`echo $cxx_version | cut -f2 -d. | cut -f1 -d-` + cxx_vers_patch=`echo $cxx_version | cut -f2 -d. | cut -f2 -d-` + test -n "$cxx_vers_major" || cxx_vers_major=0 + test -n "$cxx_vers_minor" || cxx_vers_minor=0 + test -n "$cxx_vers_patch" || cxx_vers_patch=0 + cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` + fi +fi + +# Common PGI flags for various situations +if test "X-pgc++" = "X-$cxx_vendor"; then + + # C++-specific + H5_CXXFLAGS="$H5_CXXFLAGS -std=c++11 -Minform=warn" + + ############## + # Production # + ############## + + # NDEBUG is handled explicitly by the configure script + PROD_CXXFLAGS="-fast" + + ######### + # Debug # + ######### + + # NDEBUG is handled explicitly by the configure script + # -g is handled by the symbols flags + DEBUG_CXXFLAGS="-Mbounds" + + ########### + # Symbols # + ########### + + SYMBOLS_CXXFLAGS="-g" + NO_SYMBOLS_CXXFLAGS="-s" + + ############# + # Profiling # + ############# + + PROFILE_CXXFLAGS="-Mprof=func,line" + # Use this for profiling with gprof + #PROFILE_CXXFLAGS="-pg" + + ################ + # Optimization # + ################ + + HIGH_OPT_CXXFLAGS="-O4" + DEBUG_OPT_CXXFLAGS="-gopt -O2" + NO_OPT_CXXFLAGS="-O0" + + # Flags are set + cxx_flags_set=yes +fi + +# Clear cxx info if no flags set +if test "X-$cxx_flags_set" = "X-"; then + cxx_vendor= + cxx_version= +fi diff --git a/config/pgi-flags b/config/pgi-flags index e1bec00..24c7174 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -66,50 +66,45 @@ if test "X-pgcc" = "X-$cc_vendor"; then #esac # General - H5_CFLAGS="$H5_CFLAGS $arch -c99 -Minform=inform" - - # Production - case "$cc_vendor-$cc_version" in - pgcc-10.6*) - PROD_CFLAGS= - ;; - pgcc-9.*) - PROD_CFLAGS= - ;; - *) - PROD_CFLAGS="-fast" - ;; - esac - - # Debug + H5_CFLAGS="$H5_CFLAGS $arch -c99 -Minform=warn" + + ############## + # Production # + ############## + + # NDEBUG is handled explicitly by the configure script + PROD_CFLAGS="-fast" + + ######### + # Debug # + ######### + # NDEBUG is handled explicitly by the configure script + # -g is handled by the symbols flags DEBUG_CFLAGS="-Mbounds" - # Symbols + ########### + # Symbols # + ########### + SYMBOLS_CFLAGS="-g" NO_SYMBOLS_CFLAGS="-s" - # Profiling + ############# + # Profiling # + ############# + PROFILE_CFLAGS="-Mprof=func,line" # Use this for profiling with gprof #PROFILE_CFLAGS="-pg" - # Optimization - case "$cc_vendor-$cc_version" in - # Tweak down compiler optimizations for v10.6, it has a bug - pgcc-10.6*) - HIGH_OPT_CFLAGS="-O1" - ;; - # Tweak down compiler optimizations for v9.x - pgcc-9.*) - HIGH_OPT_CFLAGS="-O1" - ;; - *) - HIGH_OPT_CFLAGS= - ;; - esac - DEBUG_OPT_CFLAGS= - NO_OPT_CFLAGS= + ################ + # Optimization # + ################ + + HIGH_OPT_CFLAGS="-O4" + DEBUG_OPT_CFLAGS="-gopt -O2" + NO_OPT_CFLAGS="-O0" # Flags are set cc_flags_set=yes diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 20d561c..a53c4af 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,24 @@ New Features Configuration: ------------- + - Adds C++ Autotools configuration file for PGI + + * Checks for pgc++ as the compiler name (was: pgCC) + * Sets -std=c++11 + * Other options basically match new C options (below) + + (DER - 2021/06/02) + + - Updates PGI C options + + * -Minform set to warn (was: inform) to suppress spurious messages + * Sets -gopt -O2 as debug options + * Sets -O4 as 'high optimization' option + * Sets -O0 as 'no optimization' option + * Removes specific settings for PGI 9 and 10 + + (DER - 2021/06/02) + - A C++11-compliant compiler is now required to build the C++ wrappers CMAKE_CXX_STANDARD is now set to 11 when building with CMake and @@ -56,7 +74,6 @@ New Features (DER - 2021/05/27) - - CMake will now run the shell script tests in test/ by default The test directory includes several shell script tests that previously -- cgit v0.12 From 7739612291596e0561f90b26af1929a588e63f11 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 3 Jun 2021 09:51:25 -0700 Subject: Adds an Intel C++ configuration file (#716) * Adds an Intel C++ configuration file * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 1 + config/intel-cxxflags | 128 +++++++++++++++++++++++++++++++++++++++++++++++ config/linux-gnulibc1 | 4 ++ release_docs/RELEASE.txt | 8 +++ 4 files changed, 141 insertions(+) create mode 100644 config/intel-cxxflags diff --git a/MANIFEST b/MANIFEST index 7e166bb..f82d295 100644 --- a/MANIFEST +++ b/MANIFEST @@ -135,6 +135,7 @@ ./config/cygwin ./config/ibm-aix ./config/ibm-flags +./config/intel-cxxflags ./config/intel-fflags ./config/intel-flags ./config/libhdf5.pc.in diff --git a/config/intel-cxxflags b/config/intel-cxxflags new file mode 100644 index 0000000..3ef172f --- /dev/null +++ b/config/intel-cxxflags @@ -0,0 +1,128 @@ +# -*- shell-script -*- +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# Intel icpc compiler or a derivative. It is careful not to do anything +# if the compiler is not Intel; otherwise `cxx_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for icpc +# icpc unless a compiler version is already known +# +# cxx_vendor: The compiler name: icpc +# cxx_version: Version number: 8.0 +# +if test X = "X$cxx_flags_set"; then + cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 |grep 'Version'`" + if test X != "X$cxx_version"; then + cxx_vendor=icpc + cxx_version=`echo $cxx_version |sed 's/.*Version \([-a-z0-9\.\-]*\).*/\1/'` + echo "compiler '$CXX' is Intel $cxx_vendor-$cxx_version" + + # Some version numbers + # Intel version numbers are of the form: "major.minor" + cxx_vers_major=`echo $cxx_version | cut -f1 -d.` + cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` + #cxx_vers_patch=`echo $cxx_version | cut -f2 -d.` + test -n "$cxx_vers_major" || cxx_vers_major=0 + test -n "$cxx_vers_minor" || cxx_vers_minor=0 + test -n "$cxx_vers_patch" || cxx_vers_patch=0 + cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` + fi +fi + +# Common Intel flags for various situations +if test "X-icpc" = "X-$cxx_vendor"; then + # Insert section about version specific problems from compiler flags here, + # if necessary. + + arch= + # Architecture-specific flags + # Nothing currently. (Uncomment code below and modify to add any) + #case "$host_os-$host_cpu" in + # *-i686) + # arch="-march=i686" + # ;; + #esac + + # Host-specific flags + # Nothing currently. (Uncomment code below and modify to add any) + #case "`hostname`" in + # sleipnir.ncsa.uiuc.edu) + # arch="$arch -pipe" + # ;; + #esac + + ########### + # General # + ########### + + # Default to C++11 standard + H5_CXXFLAGS="$H5_CXXFLAGS $arch -std=c++11" + + ############## + # Production # + ############## + + PROD_CXXFLAGS= + + ######### + # Debug # + ######### + + # NDEBUG is handled explicitly by the configure script + # -g is handled by the symbols flags + DEBUG_CXXFLAGS= + + ########### + # Symbols # + ########### + + SYMBOLS_CXXFLAGS="-g" + NO_SYMBOLS_CXXFLAGS="-Wl,-s" + + ############# + # Profiling # + ############# + + # Use this for profiling with gprof + PROFILE_CXXFLAGS="-p" + + ################ + # Optimization # + ################ + + HIGH_OPT_CXXFLAGS="-O3" + DEBUG_OPT_CXXFLAGS="-O0" + NO_OPT_CXXFLAGS="-O0" + + ############ + # Warnings # + ############ + + ############################# + # Version-specific warnings # + ############################# + + ################# + # Flags are set # + ################# + cxx_flags_set=yes + +fi + +# Clear cc info if no flags set +if test "X-$cxx_flags_set" = "X-"; then + cxx_vendor= + cxx_version= +fi diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 1da2236..d952c4e 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -199,6 +199,10 @@ if test -z "$CXX"; then CXX_BASENAME=g++ fi +# Figure out Intel CXX compiler flags +# Do this ahead of GNU to avoid icpc being detected as g++ +. $srcdir/config/intel-cxxflags + # Figure out GNU CXX compiler flags . $srcdir/config/gnu-cxxflags diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a53c4af..2d55ae1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,14 @@ New Features Configuration: ------------- + - Adds C++ Autotools configuration file for Intel + + * Checks for icpc as the compiler + * Sets std=c++11 + * Copies most non-warning flags from intel-flags + + (DER - 2021/06/02) + - Adds C++ Autotools configuration file for PGI * Checks for pgc++ as the compiler name (was: pgCC) -- cgit v0.12 From dd6547db0d3cc69c55bed12f45f4077338ddd56b Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 3 Jun 2021 13:46:52 -0700 Subject: Updates bin/trace script to correctly wrap H5TRACE macros near clang-format column limit (#719) * Removes clang-format comments from H5O.c call * Fixes bin/trace to correctly wrap lines near the clang-format limit * Removed unused variable from bin/trace --- bin/trace | 38 +++++++++++++++++++++++++++++++------- src/H5O.c | 9 ++++----- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/bin/trace b/bin/trace index 1623438..d51b8cb 100755 --- a/bin/trace +++ b/bin/trace @@ -354,10 +354,32 @@ sub rewrite_func ($$$$$) { $argtrace = "H5ARG_TRACE" . scalar(@arg_str) . "(FUNC, \""; $trace .= join("", @arg_str) . "\""; $argtrace .= join("", @arg_str) . "\""; - my $len = 4 + length $trace; # Add 4, for indenting the line - for (@arg_name) { - # Wrap lines that will be longer than the limit, after ');' is added - if ($len + length >= ($max_trace_macro_line_len - 2)) { + + # Add 4 for indenting the line + my $len = 4 + length($trace); + + for my $i (0 .. $#arg_name) { + # Handle wrapping + + # Be VERY careful here! clang-format and this script MUST agree + # on which lines get wrapped or there will be churn as each tries + # to undo the other's output. + # + # TWO cases must be handled: + # 1) The argument is that last one and ');' will be appended + # 2) The argument is NOT the last one and ',' will be appended + # + # NB: clang-format does NOT consider terminal newlines when + # counting columns for the ColumnLimit + # + # The extra '2' added after $len includes the ', ' that would be + # added BEFORE the argument. + # + my $adjust = ($i + 1 == scalar(@arg_str)) ? 2 : 1; + my $len_if_added = $len + 2 + length($arg_name[$i]) + $adjust; + + # Wrap lines that will be longer than the limit + if ($len_if_added > $max_trace_macro_line_len) { # Wrap line, with indention $trace .= ",\n "; $len = 13; # Set to 13, for indention @@ -373,9 +395,11 @@ sub rewrite_func ($$$$$) { } # Append argument - $trace .= "$_"; - $argtrace .= ", $_"; - $len += length; # Add length of appended argument name + $trace .= "$arg_name[$i]"; + $argtrace .= ", $arg_name[$i]"; + + # Add length of appended argument name + $len += length($arg_name[$i]); } # Append final ');' for macro diff --git a/src/H5O.c b/src/H5O.c index a1c9c2d..3ad14dd 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1230,14 +1230,13 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a hid_t es_id) { H5VL_object_t *vol_obj = NULL; /* 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 */ + 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) - /* clang-format off */ - H5TRACE9("e", "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id); - /* clang-format on */ + H5TRACE9("e", "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, + es_id); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) -- cgit v0.12 From 032310b87f5b5a118b3206de9565f153062b8b78 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 3 Jun 2021 15:24:58 -0700 Subject: Adds a quick for for some egregious chunk_info badness (#722) --- test/chunk_info.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/test/chunk_info.c b/test/chunk_info.c index 7c6dcc1..7440459 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -1490,21 +1490,24 @@ typedef struct chunk_iter_info_t { uint32_t nbytes; } chunk_iter_info_t; +typedef struct chunk_iter_udata_t { + chunk_iter_info_t *chunk_info; + int last_index; +} chunk_iter_udata_t; + static int iter_cb(const hsize_t *offset, uint32_t filter_mask, haddr_t addr, uint32_t nbytes, void *op_data) { - chunk_iter_info_t **chunk_info = (chunk_iter_info_t **)op_data; + chunk_iter_udata_t *cidata = (chunk_iter_udata_t *)op_data; + int idx = cidata->last_index + 1; - (*chunk_info)->offset[0] = offset[0]; - (*chunk_info)->offset[1] = offset[1]; - (*chunk_info)->filter_mask = filter_mask; - (*chunk_info)->addr = addr; - (*chunk_info)->nbytes = nbytes; + cidata->chunk_info[idx].offset[0] = offset[0]; + cidata->chunk_info[idx].offset[1] = offset[1]; + cidata->chunk_info[idx].filter_mask = filter_mask; + cidata->chunk_info[idx].addr = addr; + cidata->chunk_info[idx].nbytes = nbytes; - /* printf("offset: [%lld, %lld], addr: %ld, size: %d, filter mask: %d\n", offset[0], offset[1], addr, - * nbytes, filter_mask); */ - - *chunk_info += 1; + cidata->last_index++; return H5_ITER_CONT; } @@ -1564,8 +1567,9 @@ test_basic_query(hid_t fapl) haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ hsize_t ii, jj; /* Array indices */ - chunk_iter_info_t chunk_infos[2]; /* chunk infos filled up by iterator */ - chunk_iter_info_t *cptr; /* pointer to array of chunks */ + chunk_iter_info_t chunk_infos[2]; /* Chunk infos filled up by iterator */ + chunk_iter_info_t *cptr; /* Pointer to array of chunks */ + chunk_iter_udata_t udata; /* udata for iteration */ herr_t ret; /* Temporary returned value for verifying failure */ TESTING("basic operations"); @@ -1674,12 +1678,13 @@ test_basic_query(hid_t fapl) if (verify_empty_chunk_info(dset, offset) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); - /* iterate over all chunks */ - cptr = &(chunk_infos[0]); - if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb, &cptr) < 0) + /* Iterate over all chunks */ + udata.chunk_info = chunk_infos; + udata.last_index = -1; + if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb, &udata) < 0) TEST_ERROR; - VERIFY(cptr, &(chunk_infos[2]), "Iterator did not iterate all chunks"); + VERIFY(udata.last_index, 1, "Iterator did not iterate all chunks"); VERIFY(chunk_infos[0].offset[0], 0, "Offset mismatch"); VERIFY(chunk_infos[0].offset[1], 0, "Offset mismatch"); VERIFY(chunk_infos[0].filter_mask, 0, "Filter mismatch"); @@ -1688,13 +1693,13 @@ test_basic_query(hid_t fapl) VERIFY(chunk_infos[1].offset[0], 1, "Offset mismatch"); VERIFY(chunk_infos[1].offset[1], 1, "Offset mismatch"); - /* iterate and stop after one iteration */ + /* Iterate and stop after one iteration */ cptr = &(chunk_infos[0]); if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb_stop, &cptr) < 0) TEST_ERROR; VERIFY(cptr, &(chunk_infos[1]), "Verification of halted iterator failed\n"); - /* iterate and fail after one iteration */ + /* Iterate and fail after one iteration */ cptr = &(chunk_infos[0]); H5E_BEGIN_TRY { -- cgit v0.12 From 9041351328a4f0c806da56653c3c8abdda2ad222 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 3 Jun 2021 19:56:43 -0700 Subject: Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations --- config/cmake/HDF5UseFortran.cmake | 76 ++++----------------------------------- 1 file changed, 7 insertions(+), 69 deletions(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 003f24f..67f47ec 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -129,74 +129,12 @@ endif () # Determine the available KINDs for REALs and INTEGERs #----------------------------------------------------------------------------- -#READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE) -set (PROG_SRC_CODE - " - PROGRAM FC_AVAIL_KINDS - IMPLICIT NONE - INTEGER :: ik, jk, k, max_decimal_prec - INTEGER :: num_rkinds = 1, num_ikinds = 1 - INTEGER, DIMENSION(1:10) :: list_ikinds = -1 - INTEGER, DIMENSION(1:10) :: list_rkinds = -1 - - OPEN(8, FILE='pac_fconftest.out', FORM='formatted') - - ! Find integer KINDs - list_ikinds(num_ikinds)=SELECTED_INT_KIND(1) - DO ik = 2, 36 - k = SELECTED_INT_KIND(ik) - IF(k.LT.0) EXIT - IF(k.GT.list_ikinds(num_ikinds))THEN - num_ikinds = num_ikinds + 1 - list_ikinds(num_ikinds) = k - ENDIF - ENDDO - - DO k = 1, num_ikinds - WRITE(8,'(I0)', ADVANCE='NO') list_ikinds(k) - IF(k.NE.num_ikinds)THEN - WRITE(8,'(A)',ADVANCE='NO') ',' - ELSE - WRITE(8,'()') - ENDIF - ENDDO - - ! Find real KINDs - list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1) - max_decimal_prec = 1 - - prec: DO ik = 2, 36 - exp: DO jk = 1, 17000 - k = SELECTED_REAL_KIND(ik,jk) - IF(k.LT.0) EXIT exp - IF(k.GT.list_rkinds(num_rkinds))THEN - num_rkinds = num_rkinds + 1 - list_rkinds(num_rkinds) = k - ENDIF - max_decimal_prec = ik - ENDDO exp - ENDDO prec - - DO k = 1, num_rkinds - WRITE(8,'(I0)', ADVANCE='NO') list_rkinds(k) - IF(k.NE.num_rkinds)THEN - WRITE(8,'(A)',ADVANCE='NO') ',' - ELSE - WRITE(8,'()') - ENDIF - ENDDO - - WRITE(8,'(I0)') max_decimal_prec - WRITE(8,'(I0)') num_ikinds - WRITE(8,'(I0)') num_rkinds - END PROGRAM FC_AVAIL_KINDS - " -) +READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE) if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - check_fortran_source_runs (${PROG_SRC_CODE} FC_AVAIL_KINDS_RESULT SRC_EXT f90) + check_fortran_source_runs (${SOURCE_CODE} FC_AVAIL_KINDS_RESULT SRC_EXT f90) else () FORTRAN_RUN ("REAL and INTEGER KINDs" - "${PROG_SRC_CODE}" + "${SOURCE_CODE}" XX YY FC_AVAIL_KINDS_RESULT @@ -260,7 +198,7 @@ foreach (KIND ${VAR}) USE ISO_C_BINDING IMPLICIT NONE INTEGER (KIND=${KIND}) a - OPEN(8,FILE='pac_validIntKinds.out',FORM='formatted') + OPEN(8,FILE='pac_validIntKinds.${KIND}.out',FORM='formatted') WRITE(8,'(I0)') ${FC_SIZEOF_A} CLOSE(8) END @@ -271,7 +209,7 @@ foreach (KIND ${VAR}) else () FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC_${KIND}} XX YY VALIDINTKINDS_RESULT_${KIND}) endif () - file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validIntKinds.out" PROG_OUTPUT1) + file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validIntKinds.${KIND}.out" PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -309,7 +247,7 @@ foreach (KIND ${VAR} ) USE ISO_C_BINDING IMPLICIT NONE REAL (KIND=${KIND}) a - OPEN(8,FILE='pac_validRealKinds.out',FORM='formatted') + OPEN(8,FILE='pac_validRealKinds.${KIND}.out',FORM='formatted') WRITE(8,'(I0)') ${FC_SIZEOF_A} CLOSE(8) END @@ -320,7 +258,7 @@ foreach (KIND ${VAR} ) else () FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC2_${KIND}} XX YY VALIDREALKINDS_RESULT_${KIND}) endif () - file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validRealKinds.out" PROG_OUTPUT1) + file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validRealKinds.${KIND}.out" PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") endforeach () -- cgit v0.12 From 9bf274e21a318b201a34b2d2e81a23f5c0bfecb2 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 4 Jun 2021 14:52:36 -0700 Subject: Moves gcc warning macros from H5public.h to H5private.h (#724) * Moves gcc warning suppression macros out of H5public.h * Update RELEASE.txt * Formatted source --- release_docs/RELEASE.txt | 13 +++++++++++++ src/H5FDmulti.c | 27 +++++++++++++++++++++++++-- src/H5private.h | 23 +++++++++++++++++++++++ src/H5public.h | 32 +++++++------------------------- 4 files changed, 68 insertions(+), 27 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2d55ae1..d77b2aa 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -463,6 +463,19 @@ New Features Library: -------- + - gcc warning suppression macros were moved out of H5public.h + + The HDF5 library uses a set of macros to suppress warnings on gcc. + These warnings were originally located in H5public.h so that the + multi VFD (which only uses public headers) could also make use of them + but internal macros should not be publicly exposed like this. + + These macros have now been moved to H5private.h. Pending future multi + VFD refactoring, the macros have been duplicated in H5FDmulti.c to + suppress the format string warnings there. + + (DER - 2021/06/03) + - H5Gcreate1() now rejects size_hint parameters larger than UINT32_MAX The size_hint value is ultimately stored in a uint32_t struct field, diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 97d1d7a..5562c23 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -45,6 +45,29 @@ #define my_strdup strdup #endif +/* Macros for enabling/disabling particular GCC warnings + * + * These are (renamed) duplicates of macros in H5private.h. If you make changes + * here, be sure to update those as well. + * + * (see the following web-sites for more info: + * 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_MULTI_GCC_DIAG_JOINSTR(x, y) x y +#define H5_MULTI_GCC_DIAG_DO_PRAGMA(x) _Pragma(#x) +#define H5_MULTI_GCC_DIAG_PRAGMA(x) H5_MULTI_GCC_DIAG_DO_PRAGMA(GCC diagnostic x) + +#define H5_MULTI_GCC_DIAG_OFF(x) \ + H5_MULTI_GCC_DIAG_PRAGMA(push) H5_MULTI_GCC_DIAG_PRAGMA(ignored H5_MULTI_GCC_DIAG_JOINSTR("-W", x)) +#define H5_MULTI_GCC_DIAG_ON(x) H5_MULTI_GCC_DIAG_PRAGMA(pop) +#else +#define H5_MULTI_GCC_DIAG_OFF(x) +#define H5_MULTI_GCC_DIAG_ON(x) +#endif + /* Loop through all mapped files */ #define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) \ { \ @@ -1959,7 +1982,7 @@ compute_next(H5FD_multi_t *file) * tmp 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_MULTI_GCC_DIAG_OFF("format-nonliteral") static int open_members(H5FD_multi_t *file) { @@ -2044,7 +2067,7 @@ H5FD_multi_delete(const char *filename, hid_t fapl_id) return 0; } /* end H5FD_multi_delete() */ -H5_GCC_DIAG_ON("format-nonliteral") +H5_MULTI_GCC_DIAG_ON("format-nonliteral") #ifdef H5private_H /* diff --git a/src/H5private.h b/src/H5private.h index 9c2459a..a1285ee 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -558,6 +558,29 @@ typedef long int32_t; #define LOCK_UN 0x08 #endif /* H5_HAVE_FLOCK */ +/* Macros for enabling/disabling particular GCC 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 + * changes here, be sure to update those as well. + * + * (see the following web-sites for more info: + * 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) +#else +#define H5_GCC_DIAG_OFF(x) +#define H5_GCC_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 diff --git a/src/H5public.h b/src/H5public.h index b548889..bf81605 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -59,31 +59,6 @@ #endif #endif -/* Include the Windows API adapter header early */ -#include "H5api_adpt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Macros for enabling/disabling particular GCC warnings */ -/* (see the following web-sites for more info: - * 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) -#else -#define H5_GCC_DIAG_OFF(x) -#define H5_GCC_DIAG_ON(x) -#endif - /* Macro to hide a symbol from further preprocessor substitutions */ #define H5_NO_EXPAND(x) (x) @@ -368,6 +343,13 @@ typedef struct H5_alloc_stats_t { */ typedef void (*H5_atclose_func_t)(void *ctx); +/* API adapter header (defines H5_DLL, etc.) */ +#include "H5api_adpt.h" + +#ifdef __cplusplus +extern "C" { +#endif + /* Functions in H5.c */ /** * \ingroup H5 -- cgit v0.12 From ce5f1ff1c502a1f341560254e4ed3b0dc65cfade Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 4 Jun 2021 14:54:00 -0700 Subject: Adds __STDC_FORMAT_MACROS before including inttypes.h w/ C++ (#726) * Adds __STDC_FORMAT_MACROS before including inttypes.h w/ C++ Allows C++ library to be built on older versions of gcc. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5public.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/H5public.h b/src/H5public.h index bf81605..cef15d9 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -42,7 +42,11 @@ #include /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */ #include /* For variadic functions in H5VLpublic.h */ -#include /* For C9x types */ +#include /* For C9x types */ + +#ifdef __cplusplus +#define __STDC_FORMAT_MACROS +#endif #include /* C99/POSIX.1 header for uint64_t, PRIu64 */ #ifdef H5_HAVE_STDDEF_H -- cgit v0.12 From 9ebe55b34c4d45db6b47d6cd0ee01efa20d0c31d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 5 Jun 2021 21:00:30 -0700 Subject: Moves H5PacketTable default ctor inside source file (#731) --- config/commence.am | 2 +- hl/c++/src/H5PacketTable.cpp | 7 +++++++ hl/c++/src/H5PacketTable.h | 6 ++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/config/commence.am b/config/commence.am index 96c2fc2..3fddc6a 100644 --- a/config/commence.am +++ b/config/commence.am @@ -45,7 +45,7 @@ LIBH5CPP_HL=$(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la docdir = $(exec_prefix)/doc # Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below -# has been removed. According to the official description of DESTDIR by Gnu at +# has been removed. According to the official description of DESTDIR by GNU at # http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is # prepended to the normal and complete install path that it precedes for the # purpose of installing in a temporary directory which is useful for building diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp index 3fcc9b2..2908626 100644 --- a/hl/c++/src/H5PacketTable.cpp +++ b/hl/c++/src/H5PacketTable.cpp @@ -28,6 +28,13 @@ /* PacketTable superclass */ /********************************/ +/* Null constructor + * Sets table_id to "invalid" + */ +PacketTable::PacketTable() : table_id{H5I_INVALID_HID} +{ +} + /* "Open" Constructor * Opens an existing packet table, which can contain either fixed-length or * variable-length packets. diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index 306cc2f..eae66f1 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -31,11 +31,9 @@ class H5_HLCPPDLL PacketTable { public: /* Null constructor - * Sets table_id to "invalid" + * Sets table_id to H5I_INVALID_HID */ - PacketTable() : table_id{H5I_INVALID_HID} - { - } + PacketTable(); /* "Open" Constructor * Opens an existing packet table, which can contain either fixed-length or -- cgit v0.12 From 62ddef9758585ec5556b7ff2465ecae75013322d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 6 Jun 2021 19:04:34 -0700 Subject: Includes hdf5dev.h in hdf5.h (#728) * Includes hdf5dev.h in hdf5.h * Removes hdf5dev.h * Restores H5PLextern.h as an independent header * H5PLextern.h missed in the null VOL connector --- MANIFEST | 1 - examples/h5_elink_unix2win.c | 1 - examples/h5_extlink.c | 1 - fortran/src/H5Zf.c | 1 - fortran/src/H5_f.c | 1 - java/src/jni/h5Constants.c | 1 - java/src/jni/h5lImp.c | 1 - java/src/jni/h5zImp.c | 1 - src/CMakeLists.txt | 1 - src/H5FDmulti.c | 1 - src/H5FDstdio.c | 1 - src/H5PLextern.h | 4 ++-- src/H5VLpassthru.c | 2 +- src/Makefile.am | 4 ++-- src/hdf5.h | 14 ++++++++++++++ src/hdf5dev.h | 38 -------------------------------------- test/filter_plugin1_dsets.c | 2 +- test/filter_plugin2_dsets.c | 2 +- test/filter_plugin3_dsets.c | 2 +- test/filter_plugin4_groups.c | 2 +- test/h5test.h | 1 - test/null_vol_connector.c | 5 +---- tools/lib/h5tools.c | 1 - tools/test/h5copy/dynlib_copy.c | 2 +- tools/test/h5diff/dynlib_diff.c | 2 +- tools/test/h5diff/h5diffgentest.c | 1 - tools/test/h5dump/dynlib_dump.c | 2 +- tools/test/h5jam/h5jamgentest.c | 1 - tools/test/h5ls/dynlib_ls.c | 2 +- tools/test/h5repack/dynlib_rpk.c | 2 +- tools/test/h5repack/dynlib_vrpk.c | 2 +- tools/test/perform/chunk.c | 1 - utils/mirror_vfd/mirror_remote.h | 1 - 33 files changed, 30 insertions(+), 74 deletions(-) delete mode 100644 src/hdf5dev.h diff --git a/MANIFEST b/MANIFEST index f82d295..09209d6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1123,7 +1123,6 @@ ./src/H5Ztrans.c ./src/Makefile.am ./src/hdf5.h -./src/hdf5dev.h ./src/libhdf5.settings.in ./src/H5win32defs.h ./src/uthash.h diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c index 60c75dc..6eca266 100644 --- a/examples/h5_elink_unix2win.c +++ b/examples/h5_elink_unix2win.c @@ -24,7 +24,6 @@ */ #include "hdf5.h" -#include "hdf5dev.h" #include #include diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 44e55a9..f9d4046 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -19,7 +19,6 @@ */ #include "hdf5.h" -#include "hdf5dev.h" #include #define SOURCE_FILE "extlink_source.h5" diff --git a/fortran/src/H5Zf.c b/fortran/src/H5Zf.c index 33d9fb3..b31878c 100644 --- a/fortran/src/H5Zf.c +++ b/fortran/src/H5Zf.c @@ -20,7 +20,6 @@ */ #include "H5f90.h" -#include "hdf5dev.h" /****if* H5Zf/h5zunregister_c * NAME diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 52fc276..d245cae 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -21,7 +21,6 @@ #include "H5f90.h" #include "H5fort_type_defines.h" -#include "hdf5dev.h" int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index a0deea3..7354e95 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -22,7 +22,6 @@ extern "C" { #endif /* __cplusplus */ #include "hdf5.h" -#include "hdf5dev.h" #include #include #include "h5jni.h" diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 1407fef..43db4e9 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -23,7 +23,6 @@ extern "C" { #include #include #include "hdf5.h" -#include "hdf5dev.h" #include "h5jni.h" #include "h5lImp.h" diff --git a/java/src/jni/h5zImp.c b/java/src/jni/h5zImp.c index d8c93be..d750ee8 100644 --- a/java/src/jni/h5zImp.c +++ b/java/src/jni/h5zImp.c @@ -22,7 +22,6 @@ extern "C" { #endif /* __cplusplus */ #include "hdf5.h" -#include "hdf5dev.h" #include #include #include "h5jni.h" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9eeac7b..ff47c8e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,6 @@ set (H5_SOURCES set (H5_HDRS ${HDF5_SRC_DIR}/hdf5.h - ${HDF5_SRC_DIR}/hdf5dev.h ${HDF5_SRC_DIR}/H5api_adpt.h ${HDF5_SRC_DIR}/H5public.h #${HDF5_SRC_DIR}/H5version.h diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 5562c23..86f7664 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -27,7 +27,6 @@ #include #include "hdf5.h" -#include "hdf5dev.h" #ifndef FALSE #define FALSE 0 diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index e23aca8..6631325 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -29,7 +29,6 @@ #include #include "hdf5.h" -#include "hdf5dev.h" #ifdef H5_HAVE_FLOCK /* Needed for lock type definitions (e.g., LOCK_EX) */ diff --git a/src/H5PLextern.h b/src/H5PLextern.h index 5042069..7f3df5e 100644 --- a/src/H5PLextern.h +++ b/src/H5PLextern.h @@ -17,8 +17,8 @@ #ifndef H5PLextern_H #define H5PLextern_H -/* Include package's public header */ -#include "H5PLpublic.h" +/* Include HDF5 header */ +#include "hdf5.h" /* plugins always export */ #if defined(_MSC_VER) /* MSVC Compiler Case */ diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index ede2f5f..681531e 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -36,7 +36,7 @@ #include /* Public HDF5 file */ -#include "hdf5dev.h" +#include "hdf5.h" /* This connector's header */ #include "H5VLpassthru.h" diff --git a/src/Makefile.am b/src/Makefile.am index ce29217..ce6e3b1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -156,8 +156,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Zpublic.h # Public component author headers -include_HEADERS += hdf5dev.h H5ESdevelop.h H5FDdevelop.h H5Idevelop.h \ - H5Ldevelop.h H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h +include_HEADERS += H5ESdevelop.h H5FDdevelop.h H5Idevelop.h H5Ldevelop.h \ + H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h # install libhdf5.settings in lib directory settingsdir=$(libdir) diff --git a/src/hdf5.h b/src/hdf5.h index b6b5f59..8751ec5 100644 --- a/src/hdf5.h +++ b/src/hdf5.h @@ -41,6 +41,20 @@ #include "H5VLpublic.h" /* Virtual Object Layer */ #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 */ +#include "H5Tdevelop.h" /* Datatypes */ +#include "H5TSdevelop.h" /* Threadsafety */ +#include "H5Zdevelop.h" /* Data filters */ + +/* 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 */ #include "H5FDdirect.h" /* Linux direct I/O */ diff --git a/src/hdf5dev.h b/src/hdf5dev.h deleted file mode 100644 index 201442d..0000000 --- a/src/hdf5dev.h +++ /dev/null @@ -1,38 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 is the main public HDF5 include file for component authors. - */ - -#ifndef _HDF5DEV_H -#define _HDF5DEV_H - -/* Include general purpose application developer interfaces */ -#include "hdf5.h" - -/* Application developer headers for various interfaces */ -#include "H5ESdevelop.h" /* Event Sets */ -#include "H5FDdevelop.h" /* File drivers */ -#include "H5Idevelop.h" /* ID management */ -#include "H5Ldevelop.h" /* Links */ -#include "H5PLextern.h" /* Plugins */ -#include "H5Tdevelop.h" /* Datatypes */ -#include "H5TSdevelop.h" /* Threadsafety */ -#include "H5Zdevelop.h" /* Data filters */ - -/* 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 */ - -#endif /* _HDF5DEV_H */ diff --git a/test/filter_plugin1_dsets.c b/test/filter_plugin1_dsets.c index 2b1e4d2..5d6c1ef 100644 --- a/test/filter_plugin1_dsets.c +++ b/test/filter_plugin1_dsets.c @@ -17,7 +17,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define FILTER1_ID 257 diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c index 0bef1a0..d2011d4 100644 --- a/test/filter_plugin2_dsets.c +++ b/test/filter_plugin2_dsets.c @@ -17,7 +17,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define FILTER2_ID 258 #define MULTIPLIER 3 diff --git a/test/filter_plugin3_dsets.c b/test/filter_plugin3_dsets.c index b9b3b82..618ce06 100644 --- a/test/filter_plugin3_dsets.c +++ b/test/filter_plugin3_dsets.c @@ -18,7 +18,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define FILTER3_ID 259 diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c index 589347c..630dcd6 100644 --- a/test/filter_plugin4_groups.c +++ b/test/filter_plugin4_groups.c @@ -18,7 +18,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define FILTER4_ID 260 #define SUFFIX_LEN 8 diff --git a/test/h5test.h b/test/h5test.h index f5c9608..89e30da 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -25,7 +25,6 @@ * so we include the private headers here, along with developer routines. */ #include "hdf5.h" -#include "hdf5dev.h" #include "H5private.h" #include "H5Eprivate.h" diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index 7a1de6c..2b375d8 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -15,11 +15,8 @@ * (registration, etc.). */ -/* Public HDF5 header */ -#include "hdf5.h" - /* For HDF5 plugin functionality */ -#include "hdf5dev.h" +#include "H5PLextern.h" /* This connector's header */ #include "null_vol_connector.h" diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 41bea54..eee9c53 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -21,7 +21,6 @@ #include "h5tools_ref.h" #include "h5tools_utils.h" #include "H5private.h" -#include "hdf5dev.h" #ifdef H5_TOOLS_DEBUG /* global debug variables */ diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index e7d074d..b954a22 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -15,7 +15,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 61abb90..433522d 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -15,7 +15,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 58d6129..f03254e 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -13,7 +13,6 @@ #include "hdf5.h" #include "H5private.h" -#include "hdf5dev.h" /* * The output functions need a temporary buffer to hold a piece of the diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index 61abb90..433522d 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -15,7 +15,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index cea4e76..1da6b63 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -23,7 +23,6 @@ #include "hdf5.h" #include "H5private.h" -#include "hdf5dev.h" /* not used yet #define UBTXT1 "u0.txt" diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 61abb90..433522d 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -15,7 +15,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c index 0fa0642..b228344 100644 --- a/tools/test/h5repack/dynlib_rpk.c +++ b/tools/test/h5repack/dynlib_rpk.c @@ -18,7 +18,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIB1 257 diff --git a/tools/test/h5repack/dynlib_vrpk.c b/tools/test/h5repack/dynlib_vrpk.c index 454ae49..5eac4f2 100644 --- a/tools/test/h5repack/dynlib_vrpk.c +++ b/tools/test/h5repack/dynlib_vrpk.c @@ -15,7 +15,7 @@ #include #include -#include "hdf5dev.h" +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIB4 260 diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 209fd43..5e2dde2 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -22,7 +22,6 @@ /* See H5private.h for how to include headers */ #include "hdf5.h" -#include "hdf5dev.h" #include #include diff --git a/utils/mirror_vfd/mirror_remote.h b/utils/mirror_vfd/mirror_remote.h index 7a72372..6f37b0b 100644 --- a/utils/mirror_vfd/mirror_remote.h +++ b/utils/mirror_vfd/mirror_remote.h @@ -16,7 +16,6 @@ */ #include "hdf5.h" -#include "hdf5dev.h" #include "H5private.h" #ifdef H5_HAVE_MIRROR_VFD -- cgit v0.12 From 47c7bd983473cabb854483954ead6ee400009df1 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 7 Jun 2021 17:59:47 -0500 Subject: Rework Fortran configure to allow multiple CMake reruns (#721) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- config/cmake/ConfigureChecks.cmake | 115 +++++++++++++++++++++++++++- config/cmake/H5pubconf.h.in | 16 ++-- config/cmake/HDF5UseFortran.cmake | 147 ++++-------------------------------- release_docs/RELEASE.txt | 20 ++++- tools/test/h5copy/CMakeTests.cmake | 22 +++--- tools/test/h5diff/CMakeTests.cmake | 2 +- tools/test/h5ls/CMakeTests.cmake | 4 +- tools/test/h5ls/CMakeTestsVDS.cmake | 4 +- 8 files changed, 167 insertions(+), 163 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 19e7dce..0717628 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -213,18 +213,125 @@ endif() # Check if C has __float128 extension #----------------------------------------------------------------------------- -CHECK_TYPE_SIZE("__float128" ${HDF_PREFIX}_SIZEOF___FLOAT128) -if (${${HDF_PREFIX}_SIZEOF___FLOAT128}) +HDF_CHECK_TYPE_SIZE(__float128 _SIZEOF___FLOAT128) +if (${_SIZEOF___FLOAT128}) set (${HDF_PREFIX}_HAVE_FLOAT128 1) + set (${HDF_PREFIX}_SIZEOF___FLOAT128 ${_SIZEOF___FLOAT128}) else () set (${HDF_PREFIX}_HAVE_FLOAT128 0) set (${HDF_PREFIX}_SIZEOF___FLOAT128 0) endif () -CHECK_TYPE_SIZE("_Quad" ${HDF_PREFIX}_SIZEOF__QUAD) -if (NOT ${${HDF_PREFIX}_SIZEOF__QUAD}) +HDF_CHECK_TYPE_SIZE(_Quad _SIZEOF__QUAD) +if (NOT ${_SIZEOF__QUAD}) set (${HDF_PREFIX}_SIZEOF__QUAD 0) +else () + set (${HDF_PREFIX}_SIZEOF__QUAD ${_SIZEOF__QUAD}) +endif () + +#----------------------------------------------------------------------------- +# The provided CMake C macros don't provide a general compile/run function +# so this one is used. +#----------------------------------------------------------------------------- +macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Detecting C ${FUNCTION_NAME}") + endif () + file (WRITE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c + ${SOURCE_CODE} + ) + TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c + COMPILE_DEFINITIONS "-D_SIZEOF___FLOAT128=${H5_SIZEOF___FLOAT128};-D_HAVE_QUADMATH_H=${H5_HAVE_QUADMATH_H}" + COMPILE_OUTPUT_VARIABLE COMPILEOUT + RUN_OUTPUT_VARIABLE OUTPUT_VAR + ) + + set (${RETURN_VAR} ${OUTPUT_VAR}) + + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + message (VERBOSE "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") + message (VERBOSE "Test COMPILE_OUTPUT ${COMPILEOUT} ") + message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + message (VERBOSE "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ") + message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + endif () + + if (${COMPILE_RESULT_VAR}) + if (${RUN_RESULT_VAR} MATCHES 0) + set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Testing C ${FUNCTION_NAME} - OK") + endif () + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n" + "${OUTPUT_VAR}\n\n" + ) + else () + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail") + endif () + set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n" + "${OUTPUT_VAR}\n\n") + endif () + else () + message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed") + endif () +endmacro () + +set (PROG_SRC + " +#include \n\ +#include \n\ +#define CHECK_FLOAT128 _SIZEOF___FLOAT128\n\ +#if CHECK_FLOAT128!=0\n\ +#if _HAVE_QUADMATH_H!=0\n\ +#include \n\ +#endif\n\ +#ifdef FLT128_DIG\n\ +#define C_FLT128_DIG FLT128_DIG\n\ +#else\n\ +#define C_FLT128_DIG 0\n\ +#endif\n\ +#else\n\ +#define C_FLT128_DIG 0\n\ +#endif\n\ +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\ +#define C_LDBL_DIG DECIMAL_DIG\n\ +#else\n\ +#define C_LDBL_DIG LDBL_DIG\n\ +#endif\n\nint main() {\nFILE *pFile = fopen(\"pac_Cconftest.out\",\"w\")\\\;\nfprintf(pFile, \"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n + " +) + +C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES) +file (READ "${CMAKE_BINARY_DIR}/pac_Cconftest.out" PROG_OUTPUT4) +message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}") + +# dnl The output from the above program will be: +# dnl -- long double decimal precision -- __float128 decimal precision + +list (GET PROG_OUTPUT4 0 H5_LDBL_DIG) +list (GET PROG_OUTPUT4 1 H5_FLT128_DIG) + +if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) + set (${HDF_PREFIX}_HAVE_FLOAT128 0) + set (${HDF_PREFIX}_SIZEOF___FLOAT128 0) + set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG}) +else () + set (_PAC_C_MAX_REAL_PRECISION ${H5_FLT128_DIG}) +endif () +if (NOT ${_PAC_C_MAX_REAL_PRECISION}) + set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION 0) +else () + set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${_PAC_C_MAX_REAL_PRECISION}) endif () +message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}") #----------------------------------------------------------------------------- # Macro to determine the various conversion capabilities diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 44b36ca..c4f0306 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -29,7 +29,7 @@ /* Define the default plugins path to compile */ #cmakedefine H5_DEFAULT_PLUGINDIR "@H5_DEFAULT_PLUGINDIR@" -/* Define if `dev_t' is a scalar */ +/* Define if dev_t is a scalar */ #cmakedefine H5_DEV_T_IS_SCALAR @H5_DEV_T_IS_SCALAR@ /* Define to dummy `main' function (if any) required to link to the Fortran @@ -85,6 +85,9 @@ /* Define to 1 if you have the `alarm' function. */ #cmakedefine H5_HAVE_ALARM @H5_HAVE_ALARM@ +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_ARPA_INET_H @H5_HAVE_ARPA_INET_H@ + /* Define to 1 if you have the `asprintf' function. */ #cmakedefine H5_HAVE_ASPRINTF @H5_HAVE_ASPRINTF@ @@ -98,9 +101,6 @@ /* Define if the compiler understands the __func__ keyword */ #cmakedefine H5_HAVE_C99_FUNC @H5_HAVE_C99_FUNC@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_ARPA_INET_H @H5_HAVE_ARPA_INET_H@ - /* Define to 1 if you have the `clock_gettime' function. */ #cmakedefine H5_HAVE_CLOCK_GETTIME @H5_HAVE_CLOCK_GETTIME@ @@ -249,7 +249,7 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_MEMORY_H @H5_HAVE_MEMORY_H@ -/* Define if we can build the Mirror VFD */ +/* Define whether the Mirror virtual file driver (VFD) will be compiled */ #cmakedefine H5_HAVE_MIRROR_VFD @H5_HAVE_MIRROR_VFD@ /* Define if we have MPE support */ @@ -258,10 +258,10 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_MPE_H @H5_HAVE_MPE_H@ -/* Define if MPI_Comm_c2f and MPI_Comm_f2c exists */ +/* Define if MPI_Comm_c2f and MPI_Comm_f2c exist */ #cmakedefine H5_HAVE_MPI_MULTI_LANG_Comm @H5_HAVE_MPI_MULTI_LANG_Comm@ -/* Define if MPI_Info_c2f and MPI_Info_f2c exists */ +/* Define if MPI_Info_c2f and MPI_Info_f2c exist */ #cmakedefine H5_HAVE_MPI_MULTI_LANG_Info @H5_HAVE_MPI_MULTI_LANG_Info@ /* Define to 1 if you have the header file. */ @@ -450,7 +450,7 @@ /* Define if the compiler understands __inline__ */ #cmakedefine H5_HAVE___INLINE__ @H5_HAVE___INLINE__@ -/* Define if the library will ignore file locks when disabled */ +/* Define if the library will ignore file locks when disabled */ #cmakedefine H5_IGNORE_DISABLED_FILE_LOCKS @H5_IGNORE_DISABLED_FILE_LOCKS@ /* Define if the high-level library headers should be included in hdf5.h */ diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 67f47ec..e192ec4 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -313,7 +313,7 @@ if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") else () FORTRAN_RUN ("SIZEOF NATIVE KINDs" ${PROG_SRC3} XX YY PAC_SIZEOF_NATIVE_KINDS_RESULT) endif () -file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT) +file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT3) # dnl The output from the above program will be: # dnl -- LINE 1 -- sizeof INTEGER # dnl -- LINE 2 -- kind of INTEGER @@ -323,14 +323,14 @@ file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT) # dnl -- LINE 6 -- kind of DOUBLE PRECISION # Convert the string to a list of strings by replacing the carriage return with a semicolon -string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") +string (REGEX REPLACE "\n" ";" PROG_OUTPUT3 "${PROG_OUTPUT3}") -list (GET PROG_OUTPUT 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) -list (GET PROG_OUTPUT 1 PAC_FORTRAN_NATIVE_INTEGER_KIND) -list (GET PROG_OUTPUT 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF) -list (GET PROG_OUTPUT 3 PAC_FORTRAN_NATIVE_REAL_KIND) -list (GET PROG_OUTPUT 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) -list (GET PROG_OUTPUT 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND) +list (GET PROG_OUTPUT3 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) +list (GET PROG_OUTPUT3 1 PAC_FORTRAN_NATIVE_INTEGER_KIND) +list (GET PROG_OUTPUT3 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF) +list (GET PROG_OUTPUT3 3 PAC_FORTRAN_NATIVE_REAL_KIND) +list (GET PROG_OUTPUT3 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) +list (GET PROG_OUTPUT3 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND) if (NOT PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) message (FATAL_ERROR "Failed to find SIZEOF NATIVE INTEGER KINDs for Fortran") @@ -372,132 +372,13 @@ endif () set (${HDF_PREFIX}_H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}") -string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS}) -string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) -set (${HDF_PREFIX}_H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)") - -string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) -string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) -set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)") - -ENABLE_LANGUAGE (C) - -if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - include (CheckCSourceRuns) -else () -#----------------------------------------------------------------------------- -# The provided CMake C macros don't provide a general compile/run function -# so this one is used. -#----------------------------------------------------------------------------- -macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Detecting C ${FUNCTION_NAME}") - endif () - if (HDF5_REQUIRED_LIBRARIES) - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}") - else () - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif () - file (WRITE - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c - ${SOURCE_CODE} - ) - TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c - CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - RUN_OUTPUT_VARIABLE OUTPUT_VAR - ) - - set (${RETURN_VAR} ${OUTPUT_VAR}) - - #if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - # message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - # message (TRACE "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") - # message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - # message (TRACE "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ") - # message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #endif () - - if (${COMPILE_RESULT_VAR}) - if (${RUN_RESULT_VAR} MATCHES 1) - set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Testing C ${FUNCTION_NAME} - OK") - endif () - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n" - "${OUTPUT_VAR}\n\n" - ) - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail") - endif () - set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n" - "${OUTPUT_VAR}\n\n") - endif () - else () - message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed") - endif () -endmacro () -endif () - -set (PROG_SRC - " -#include -#include -#define CHECK_FLOAT128 ${${HDF_PREFIX}_SIZEOF___FLOAT128} -#if CHECK_FLOAT128!=0 -# if ${${HDF_PREFIX}_HAVE_QUADMATH_H}!=0 -#include -# endif -# ifdef FLT128_DIG -#define C_FLT128_DIG FLT128_DIG -# else -#define C_FLT128_DIG 0 -# endif -#else -#define C_FLT128_DIG 0 -#endif -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#define C_LDBL_DIG DECIMAL_DIG -#else -#define C_LDBL_DIG LDBL_DIG -#endif - int main() { - printf(\"%d\\\\n%d\\\\n\", C_LDBL_DIG, C_FLT128_DIG)\\\; - return 1\\\; - } - " -) - -if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - check_c_source_runs (${PROG_SRC} PROG_OUTPUT) -else () - C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_OUTPUT) -endif () - -# dnl The output from the above program will be: -# dnl -- LINE 1 -- long double decimal precision -# dnl -- LINE 2 -- __float128 decimal precision - -# Convert the string to a list of strings by replacing the carriage return with a semicolon -string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") - -list (GET PROG_OUTPUT 0 LDBL_DIG) -list (GET PROG_OUTPUT 1 FLT128_DIG) - -if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) - set (${HDF_PREFIX}_HAVE_FLOAT128 0) - set (${HDF_PREFIX}_SIZEOF___FLOAT128 0) - set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG}) -else () - set(${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${FLT128_DIG}) -endif () +string (REGEX REPLACE "{" "" OUT_VAR1 ${PAC_FC_ALL_REAL_KINDS}) +string (REGEX REPLACE "}" "" OUT_VAR1 ${OUT_VAR1}) +set (${HDF_PREFIX}_H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR1}/)") +string (REGEX REPLACE "{" "" OUT_VAR2 ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) +string (REGEX REPLACE "}" "" OUT_VAR2 ${OUT_VAR2}) +set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR2}/)") # Setting definition if there is a 16 byte fortran integer string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index d77b2aa..3c1870e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -54,7 +54,7 @@ New Features * Checks for icpc as the compiler * Sets std=c++11 * Copies most non-warning flags from intel-flags - + (DER - 2021/06/02) - Adds C++ Autotools configuration file for PGI @@ -77,7 +77,7 @@ New Features - A C++11-compliant compiler is now required to build the C++ wrappers - CMAKE_CXX_STANDARD is now set to 11 when building with CMake and + CMAKE_CXX_STANDARD is now set to 11 when building with CMake and -std=c++11 is added when building with clang/gcc via the Autotools. (DER - 2021/05/27) @@ -1060,6 +1060,22 @@ Bug Fixes since HDF5-1.12.0 release Configuration ------------- + - Refactor CMake configure for Fortran + + The Fortran configure tests for KINDs reused a single output file that was + read to form the Integer and Real Kinds defines. However, if config was run + more then once, the CMake completed variable prevented the tests from executing + again and the last value saved in the file was used to create the define. + Creating separate files for each KIND solved the issue. + + In addition the test for H5_PAC_C_MAX_REAL_PRECISION was not pulling in + defines for proper operation and did not define H5_PAC_C_MAX_REAL_PRECISION + correctly for a zero value. This was fixed by supplying the required defines. + In addition it was moved from the Fortran specific HDF5UseFortran.camke file + to the C centric ConfigureChecks.cmake file. + + (ADB - 2021/06/03) + - Remove arbitrary warning flag groups from CMake builds The arbitrary groups were created to reduce the quantity of warnings being diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 73fbda6..e9b36fe 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -76,13 +76,13 @@ endif () # resultcode=2 will cause the test to skip the diff test - if (NOT ${resultcode} EQUAL 2) + if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY_F-${testname}-DIFF COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -110,13 +110,13 @@ endif () # resultcode=2 will cause the test to skip the diff test - if (NOT ${resultcode} EQUAL 2) + if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY-${testname}-DIFF COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -159,13 +159,13 @@ ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test - if (NOT ${resultcode} EQUAL 2) + if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY-${testname}-DIFF COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -198,13 +198,13 @@ ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test - if (NOT ${resultcode} EQUAL 2) + if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY_SAME-${testname}-DIFF COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -218,7 +218,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5COPY-CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () if (last_test) @@ -255,7 +255,7 @@ NAME H5COPY_UD-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.out.h5 ) - if (${resultcode} EQUAL 2) + if ("${resultcode}" STREQUAL "2") add_test ( NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -318,7 +318,7 @@ NAME H5COPY_UD_ERR-${testname}-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}_ERR.out.h5 ) - if (${resultcode} EQUAL 2) + if ("${resultcode}" STREQUAL "2") add_test ( NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 9c27076..5ada730 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -446,7 +446,7 @@ macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - if (${resultcode} EQUAL 2) + if ("${resultcode}" STREQUAL "2") add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 98435ce..cd2f764 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -139,7 +139,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () else () @@ -164,7 +164,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () else () diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index e8b11bf..e93e7e7 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -85,7 +85,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () else () @@ -112,7 +112,7 @@ ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - if (${resultcode} EQUAL 1) + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () else () -- cgit v0.12 From 6880034536e3767601f270c876e7ae32416a6a1d Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 7 Jun 2021 18:08:09 -0500 Subject: Remove private H5_GCC_DIAG_OFF/ON from standalone program (#734) --- tools/test/perform/sio_engine.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index f67a7a6..1af2318 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -1264,13 +1264,6 @@ done: * Programmer: Albert Cheng 2001/12/12 * Modifications: Support for file drivers. Christian Chilan, April, 2008 */ -/* Disable warning for "format not a string literal" here -QAK */ -/* - * This pragma only needs to surround the snprintf() calls with - * '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") static void do_cleanupfile(iotype iot, char *filename) { @@ -1333,4 +1326,3 @@ do_cleanupfile(iotype iot, char *filename) } } } -H5_GCC_DIAG_ON("format-nonliteral") -- cgit v0.12 From 35d86906fa47dadcb4b9dfed462f1325c49be482 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 8 Jun 2021 10:43:21 -0500 Subject: Make sure MAX_PRECISION is always defined with a value (#736) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- config/cmake/H5pubconf.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index c4f0306..f793367 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -509,10 +509,10 @@ #define H5_PACKAGE_VERSION "@HDF5_PACKAGE_VERSION_STRING@" /* Determine the maximum decimal precision in C */ -#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ +#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ /* Define Fortran Maximum Real Decimal Precision */ -#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ +#define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ /* Width for printf() for type `long long' or `__int64', use `ll' */ #cmakedefine H5_PRINTF_LL_WIDTH @H5_PRINTF_LL_WIDTH@ -- cgit v0.12 From 311641642ef14d48176ae77a74927ac8536cf12c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 10 Jun 2021 10:26:41 -0700 Subject: Removed -fanalyzer from the gcc 10 developer options (#744) This is extremely slow and generates a LOT of false positives. It's also not really a warning flag, but an analysis feature and thus belongs in a separate configure option, not lumped in with the warnings. --- config/gnu-warnings/developer-10 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/gnu-warnings/developer-10 b/config/gnu-warnings/developer-10 index fcd460d..022c97f 100644 --- a/config/gnu-warnings/developer-10 +++ b/config/gnu-warnings/developer-10 @@ -1,6 +1,2 @@ # New warning -Warith-conversion - -# Enable static analysis of program flow --fanalyzer --fdiagnostics-path-format=none -- cgit v0.12 From 5173cce0a9ee76150ba28cb46cc5759b755b7150 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 10 Jun 2021 22:51:15 -0500 Subject: Organize and align compiler flags (#741) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- MANIFEST | 3 ++ config/clang-warnings/noerror-general | 6 ++- config/cmake/HDFCXXCompilerFlags.cmake | 76 +++++++++++++++++++-------------- config/cmake/HDFCompilerFlags.cmake | 11 +++-- config/gnu-cxxflags | 22 ++++++++-- config/gnu-flags | 6 +-- config/gnu-warnings/cxx-4.9 | 1 + config/gnu-warnings/cxx-9 | 2 + config/gnu-warnings/noerror-general | 6 ++- config/intel-cxxflags | 52 ++++++++++++++++++++-- config/intel-fflags | 62 +++++++++++++++++++-------- config/intel-flags | 63 ++++++++++++++++++--------- config/intel-warnings/15 | 19 +++++++++ config/intel-warnings/18 | 8 ++++ config/intel-warnings/developer-general | 4 ++ 15 files changed, 252 insertions(+), 89 deletions(-) create mode 100644 config/intel-warnings/15 create mode 100644 config/intel-warnings/18 create mode 100644 config/intel-warnings/developer-general diff --git a/MANIFEST b/MANIFEST index 09209d6..2defb86 100644 --- a/MANIFEST +++ b/MANIFEST @@ -198,6 +198,9 @@ ./config/gnu-warnings/noerror-5 ./config/gnu-warnings/noerror-8 ./config/gnu-warnings/noerror-general +./config/intel-warnings/15 +./config/intel-warnings/18 +./config/intel-warnings/developer-general ./config/intel-warnings/ifort-general ./config/intel-warnings/general diff --git a/config/clang-warnings/noerror-general b/config/clang-warnings/noerror-general index ad50dfc..4690ebd 100644 --- a/config/clang-warnings/noerror-general +++ b/config/clang-warnings/noerror-general @@ -1,6 +1,8 @@ # -# HDF5 code should not trigger the following warnings under any -# circumstances, so ask the compiler to treat them as errors: +# These warnings will be treated as errors, using the error-general file, +# when HDF5_ENABLE_WARNINGS_AS_ERRORS is set to true for CMake or +# the --enable-warnings-as-errors option is specified for configure. +# Otherwise this file will be used to treat them as warnings. # -Wbad-function-cast -Wimplicit-function-declaration diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index 260bbe0..bd14a0d 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -86,9 +86,11 @@ if (NOT MSVC AND NOT MINGW) # warnings that are emitted. If you need it, add it at configure time. if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0) + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/15") + endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) - list (APPEND H5_CXXFLAGS "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") - list (APPEND H5_CXXFLAGS "-Wsign-compare -Wtrigraphs -Wwrite-strings") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/18") endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED @@ -117,21 +119,20 @@ if (NOT MSVC AND NOT MINGW) #----------------------------------------------------------------------------- if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") - # if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - # list (APPEND H5_CXXFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") - # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # autotools always add the C flags with the CXX flags + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/developer-general") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") - # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () else () if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # autotools always add the C flags with the CXX flags + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") - # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () endif () @@ -139,14 +140,15 @@ if (NOT MSVC AND NOT MINGW) # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... Only needed for gcc 4.X if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - # autotools always add the C flags with the CXX flags + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") endif () # Append more extra warning flags that only gcc 4.8+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.8") if (HDF5_ENABLE_DEV_WARNINGS) + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") else () ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") @@ -155,8 +157,7 @@ if (NOT MSVC AND NOT MINGW) # Append more extra warning flags that only gcc 4.9+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) - # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9") endif () @@ -173,16 +174,16 @@ if (NOT MSVC AND NOT MINGW) # Append more extra warning flags that only gcc 6.x+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) - # autotools always add the C flags with the CXX flags + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () # Append more extra warning flags that only gcc 7.x+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) - # autotools always add the C flags with the CXX flags + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") if (HDF5_ENABLE_DEV_WARNINGS) - # autotools always add the C flags with the CXX flags + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") #else () # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") @@ -191,15 +192,15 @@ if (NOT MSVC AND NOT MINGW) # Append more extra warning flags that only gcc 8.x+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) - # autotools always add the C flags with the CXX flags + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") - #if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") - #else () - # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") - #endif () + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + else () + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") + endif () if (HDF5_ENABLE_DEV_WARNINGS) - # autotools always add the C flags with the CXX flags + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () # autotools always add the C flags with the CXX flags @@ -209,15 +210,26 @@ if (NOT MSVC AND NOT MINGW) # Append more extra warning flags that only gcc 9.x+ knows about if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) - # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-9") endif () - endif () -else () - if (NOT MINGW) - list (APPEND HDF5_CMAKE_CXX_FLAGS "/EHsc") + + # Append more extra warning flags that only gcc 9.3+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.3) + # do not use C warnings, gnu-warnings 9.3, no cxx warniings + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3") endif () + + # Append more extra warning flags that only gcc 10.x+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) + if (HDF5_ENABLE_DEV_WARNINGS) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10") + #else () + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") + endif () + endif () + endif () endif () #----------------------------------------------------------------------------- diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 0775f59..e38a92b 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -108,14 +108,13 @@ if (NOT MSVC AND NOT MINGW) # warnings that are emitted. If you need it, add it at configure time. if (CMAKE_C_COMPILER_ID STREQUAL "Intel") ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") - list (APPEND H5_CFLAGS "-Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") - list (APPEND H5_CFLAGS "-Wreturn-type -Wstrict-prototypes -Wuninitialized") - list (APPEND H5_CFLAGS "-Wunknown-pragmas -Wunused-function -Wunused-variable") + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/15") + endif() # this is just a failsafe list (APPEND H5_CFLAGS "-finline-functions") if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) - list (APPEND H5_CFLAGS "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") - list (APPEND H5_CFLAGS "-Wsign-compare -Wtrigraphs -Wwrite-strings") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/18") endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") # Add general CFlags for GCC versions 4.8 and above @@ -153,7 +152,7 @@ if (NOT MSVC AND NOT MINGW) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - list (APPEND H5_CFLAGS "-Winline -Wreorder -Wport -Wstrict-aliasing") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/developer-general") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 4fe5782..63cd952 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -183,7 +183,6 @@ if test "X-g++" = "X-$cxx_vendor"; then # Warnings # ############ -# First load the C warnings then add CXX warnings (if needed) ########### # General # @@ -199,6 +198,7 @@ if test "X-g++" = "X-$cxx_vendor"; then # Developer warnings # ###################### + # Use the C warnings as CXX warnings are the same NO_DEVELOPER_WARNING_CXXFLAGS=$(load_gnu_arguments no-developer-general) DEVELOPER_WARNING_CXXFLAGS=$(load_gnu_arguments developer-general) @@ -210,6 +210,7 @@ if test "X-g++" = "X-$cxx_vendor"; then # GCC 4.8 through the end of GCC 4 series if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 8; then + # Use the C warnings as CXX warnings are the same H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.8-4.last)" fi @@ -220,13 +221,13 @@ if test "X-g++" = "X-$cxx_vendor"; then # gcc >= 4.8 if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 8; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-4.8)" + # Use the C warnings as CXX warnings are the same DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-4.8)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-4.8)" fi # gcc >= 4.9 if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 9; then - H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.9)" H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-4.9)" fi @@ -239,30 +240,45 @@ if test "X-g++" = "X-$cxx_vendor"; then # gcc >= 6 if test $cxx_vers_major -ge 6; then + # Use the C warnings as CXX warnings are the same H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 6)" fi # gcc >= 7 if test $cxx_vers_major -ge 7; then + # Use the C warnings as CXX warnings are the same H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 7)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-7)" fi # gcc 8 if test $cxx_vers_major -ge 8; then + # Use the C warnings as CXX warnings are the same H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 8)" #H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-8)" #H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_gnu_arguments noerror-8)" + # Use the C warnings as CXX warnings are the same DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-8)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-8)" fi # gcc 9 if test $cxx_vers_major -ge 9; then - H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 9)" H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-9)" fi + # gcc >= 9.3 + if test $cc_vers_major -ge 10 -o $cc_vers_major -eq 9 -a $cc_vers_minor -ge 3; then + # do not use C warnings, $(load_gnu_arguments 9.3), no cxx warnings + # H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-9.3)" + fi + + # gcc >= 10 + if test $cc_vers_major -ge 10; then + # Use the C warnings as CXX warnings are the same + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-10)" + fi + ################# # Flags are set # ################# diff --git a/config/gnu-flags b/config/gnu-flags index 01533de..3e4ceb2 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -207,9 +207,9 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-general)" H5_NECFLAGS="$H5_NECFLAGS $(load_gnu_arguments noerror-general)" - ###################### - # Developer warnings # - ###################### + ###################### + # Developer warnings # + ###################### NO_DEVELOPER_WARNING_CFLAGS=$(load_gnu_arguments no-developer-general) DEVELOPER_WARNING_CFLAGS=$(load_gnu_arguments developer-general) diff --git a/config/gnu-warnings/cxx-4.9 b/config/gnu-warnings/cxx-4.9 index 046d6db..30553bd 100644 --- a/config/gnu-warnings/cxx-4.9 +++ b/config/gnu-warnings/cxx-4.9 @@ -1 +1,2 @@ +-Wdate-time -Wopenmp-simd diff --git a/config/gnu-warnings/cxx-9 b/config/gnu-warnings/cxx-9 index d897de2..8f843a4 100644 --- a/config/gnu-warnings/cxx-9 +++ b/config/gnu-warnings/cxx-9 @@ -1,2 +1,4 @@ +-Wattribute-alias=2 +-Wmissing-profile # Turn this on when the C++ wrappers obey the Rule of Five -Wno-deprecated-copy diff --git a/config/gnu-warnings/noerror-general b/config/gnu-warnings/noerror-general index 31194d3..f49d89a 100644 --- a/config/gnu-warnings/noerror-general +++ b/config/gnu-warnings/noerror-general @@ -1,6 +1,8 @@ # -# HDF5 code should not trigger the following warnings under any -# circumstances, so ask the compiler to treat them as errors: +# These warnings will be treated as errors, using the error-general file, +# when HDF5_ENABLE_WARNINGS_AS_ERRORS is set to true for CMake or +# the --enable-warnings-as-errors option is specified for configure. +# Otherwise this file will be used to treat them as warnings. # -Wbad-function-cast -Wimplicit-function-declaration diff --git a/config/intel-cxxflags b/config/intel-cxxflags index 3ef172f..900bcb9 100644 --- a/config/intel-cxxflags +++ b/config/intel-cxxflags @@ -16,6 +16,20 @@ # if the compiler is not Intel; otherwise `cxx_flags_set' is set to `yes' # +# +# Prepend `$srcdir/config/intel-warnings/` to the filename suffix(es) given as +# subroutine argument(s), remove comments starting with # and ending +# at EOL, replace spans of whitespace (including newlines) with spaces, +# and re-emit the file(s) thus filtered on the standard output stream. +# +load_intel_arguments() +{ + set -- $(for arg; do + sed 's,#.*$,,' $srcdir/config/intel-warnings/${arg} + done) + IFS=' ' echo "$*" +} + # Get the compiler version in a way that works for icpc # icpc unless a compiler version is already known # @@ -88,14 +102,13 @@ if test "X-icpc" = "X-$cxx_vendor"; then # Symbols # ########### - SYMBOLS_CXXFLAGS="-g" NO_SYMBOLS_CXXFLAGS="-Wl,-s" + SYMBOLS_CXXFLAGS="-g" ############# # Profiling # ############# - # Use this for profiling with gprof PROFILE_CXXFLAGS="-p" ################ @@ -110,18 +123,49 @@ if test "X-icpc" = "X-$cxx_vendor"; then # Warnings # ############ +# First load the C warnings then add CXX warnings (if needed) + + ########### + # General # + ########### + + # Add various general warning flags in intel-warnings. + H5_CXXFLAGS="$H5_CXXFLAGS $(load_intel_arguments general)" + + ###################### + # Developer warnings # + ###################### + + #NO_DEVELOPER_WARNING_CXXFLAGS=$(load_intel_arguments no-developer-general) + #DEVELOPER_WARNING_CXXFLAGS=$(load_intel_arguments developer-general) + ############################# # Version-specific warnings # ############################# + # intel == 8.0 + if test $cc_vers_major -eq 8 -a $cc_vers_minor -eq 0; then + # v8.0 -O3 infinite loops when compiling test/tselect.c. Use -O2. + HIGH_OPT_CFLAGS="-O2" + fi + + # intel == 10 + if test $cc_vers_major -eq 10; then + HIGH_OPT_CFLAGS="-O1" + fi + + # intel >= 15 + if test $cc_vers_major -ge 15; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_intel_arguments 15)" + fi + ################# # Flags are set # ################# cxx_flags_set=yes - fi -# Clear cc info if no flags set +# Clear cxx info if no flags set if test "X-$cxx_flags_set" = "X-"; then cxx_vendor= cxx_version= diff --git a/config/intel-fflags b/config/intel-fflags index b759dfa..2dcd901 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -58,11 +58,16 @@ fi # Common Intel flags for various situations if test "X-ifort" = "X-$f9x_vendor"; then - # Insert section about version specific problems from compiler flags here, - # if necessary. + + FC_BASENAME=ifort + F9XSUFFIXFLAG="" + FSEARCH_DIRS="" + + ############################### + # Architecture-specific flags # + ############################### arch= - # Architecture-specific flags # Nothing currently. (Uncomment code below and modify to add any) #case "$host_os-$host_cpu" in # *-i686) @@ -78,32 +83,56 @@ if test "X-ifort" = "X-$f9x_vendor"; then # ;; #esac - # General - FC_BASENAME=ifort - F9XSUFFIXFLAG="" - FSEARCH_DIRS="" - H5_FCFLAGS="$H5_FCFLAGS -stand:f03 -free" - H5_FCFLAGS="$H5_FCFLAGS $(load_intel_arguments ifort-general)" + ############## + # Production # + ############## - # Production PROD_FCFLAGS= - # Debug + ######### + # Debug # + ######### + DEBUG_FCFLAGS="-check all" - # Symbols - SYMBOLS_FCFLAGS="-g" + ########### + # Symbols # + ########### + NO_SYMBOLS_FCFLAGS= + SYMBOLS_FCFLAGS="-g" + + ############# + # Profiling # + ############# - # Profiling - # Use this for profiling with gprof PROFILE_FCFLAGS="-p" - # Optimization + ################ + # Optimization # + ################ + HIGH_OPT_FCFLAGS="-O3" DEBUG_OPT_FCFLAGS= NO_OPT_FCFLAGS= + + ############ + # Warnings # + ############ + + ########### + # General # + ########### + + H5_FCFLAGS="$H5_FCFLAGS -stand:f03 -free" + H5_FCFLAGS="$H5_FCFLAGS $(load_intel_arguments ifort-general)" + + ############################# + # Version-specific warnings # + ############################# + + ################# # Flags are set # ################# @@ -116,4 +145,3 @@ if test "X-$f9x_flags_set" = "X-"; then f9x_version= fi - diff --git a/config/intel-flags b/config/intel-flags index 409ffe9..fa317ab 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -82,22 +82,36 @@ if test "X-icc" = "X-$cc_vendor"; then # Default to C99 standard. H5_CFLAGS="$H5_CFLAGS $arch -std=c99" - # Production + ############## + # Production # + ############## + PROD_CFLAGS= - # Debug + ######### + # Debug # + ######### + # NDEBUG is handled explicitly in configure DEBUG_CFLAGS= - # Symbols - SYMBOLS_CFLAGS="-g" + ########### + # Symbols # + ########### + NO_SYMBOLS_CFLAGS="-Wl,-s" + SYMBOLS_CFLAGS="-g" + + ############# + # Profiling # + ############# - # Profiling - # Use this for profiling with gprof PROFILE_CFLAGS="-p" - # Optimization + ################ + # Optimization # + ################ + HIGH_OPT_CFLAGS="-O3" DEBUG_OPT_CFLAGS="-O0" NO_OPT_CFLAGS="-O0" @@ -110,32 +124,40 @@ if test "X-icc" = "X-$cc_vendor"; then # General # ########### + # Add various general warning flags in intel-warnings. H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments general)" + ###################### + # Developer warnings # + ###################### + + #NO_DEVELOPER_WARNING_CFLAGS=$(load_intel_arguments no-developer-general) + #DEVELOPER_WARNING_CFLAGS=$(load_intel_arguments developer-general) + ############################# # Version-specific warnings # ############################# -case "$cc_vendor-$cc_version" in - icc-1[5-6]*) - H5_CFLAGS="$H5_CFLAGS -Wcomment -Wdeprecated -Wextra-tokens -Wformat -Wformat-security -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith -Wreturn-type -Wshadow -Wstrict-prototypes -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-variable -Wwrite-strings" - ;; - icc-10*) - HIGH_OPT_CFLAGS="-O1" - ;; - icc-8.0*) + # intel == 8.0 + if test $cc_vers_major -eq 8 -a $cc_vers_minor -eq 0; then # v8.0 -O3 infinite loops when compiling test/tselect.c. Use -O2. HIGH_OPT_CFLAGS="-O2" - ;; - icc-*) - ;; -esac + fi + + # intel == 10 + if test $cc_vers_major -eq 10; then + HIGH_OPT_CFLAGS="-O1" + fi + + # intel >= 15 + if test $cc_vers_major -ge 15; then + H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments 15)" + fi ################# # Flags are set # ################# cc_flags_set=yes - fi # Clear cc info if no flags set @@ -143,3 +165,4 @@ if test "X-$cc_flags_set" = "X-"; then cc_vendor= cc_version= fi + diff --git a/config/intel-warnings/15 b/config/intel-warnings/15 new file mode 100644 index 0000000..6746f97 --- /dev/null +++ b/config/intel-warnings/15 @@ -0,0 +1,19 @@ +-Wcomment +-Wdeprecated +-Wextra-tokens +-Wformat +-Wformat-security +-Wmain +-Wmissing-declarations +-Wmissing-prototypes +-Wp64 +-Wpointer-arith +-Wreturn-type +-Wshadow +-Wstrict-prototypes +-Wtrigraphs +-Wuninitialized +-Wunknown-pragmas +-Wunused-function +-Wunused-variable +-Wwrite-strings diff --git a/config/intel-warnings/18 b/config/intel-warnings/18 new file mode 100644 index 0000000..565b47a --- /dev/null +++ b/config/intel-warnings/18 @@ -0,0 +1,8 @@ +-Wextra-tokens +-Wformat +-Wformat-security +-Wic-pointer +-Wshadow +-Wsign-compare +-Wtrigraphs +-Wwrite-strings diff --git a/config/intel-warnings/developer-general b/config/intel-warnings/developer-general new file mode 100644 index 0000000..fae56f0 --- /dev/null +++ b/config/intel-warnings/developer-general @@ -0,0 +1,4 @@ +-Winline +-Wreorder +-Wport +-Wstrict-aliasing -- cgit v0.12 From 42e485ea7d9e5361384bf6b1ea7a365b3c2fa42f Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Fri, 11 Jun 2021 07:52:04 -0500 Subject: Fix Direct VFD Testing in CMake (#742) --- c++/test/CMakeVFDTests.cmake | 2 +- test/CMakeVFDTests.cmake | 2 +- testpar/CMakeVFDTests.cmake | 2 +- tools/test/h5dump/CMakeVFDTests.cmake | 2 +- tools/test/h5repack/CMakeVFDTests.cmake | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index 3b555ed..360d14e 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -26,7 +26,7 @@ set (VFD_LIST family ) -if (DIRECT_VFD) +if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index dada9a9..892ccf3 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -26,7 +26,7 @@ set (VFD_LIST multi family ) -if (DIRECT_VFD) +if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 5fac4ea..f50ca16 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -30,7 +30,7 @@ set (H5P_VFD_TESTS t_pflush2 ) -if (DIRECT_VFD) +if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () diff --git a/tools/test/h5dump/CMakeVFDTests.cmake b/tools/test/h5dump/CMakeVFDTests.cmake index 014790f..01834b3 100644 --- a/tools/test/h5dump/CMakeVFDTests.cmake +++ b/tools/test/h5dump/CMakeVFDTests.cmake @@ -26,7 +26,7 @@ set (VFD_H5DUMP_LIST family ) -if (DIRECT_VFD) +if (H5_HAVE_DIRECT) set (VFD_H5DUMP_LIST ${VFD_H5DUMP_LIST} direct) endif () diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index 74471f8..e26941b 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -26,7 +26,7 @@ set (VFD_LIST family ) -if (DIRECT_VFD) +if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () -- cgit v0.12 From 03fb540c72fe49ca6240056c46e3b62d849204f4 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 11 Jun 2021 05:52:36 -0700 Subject: Fixes C++ warnings when passing hsize_t values to printf in test code (#745) --- c++/test/tarray.cpp | 31 ++++++++++++++++--------------- c++/test/tattr.cpp | 52 ++++++++++++++++++++++++++++++++-------------------- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index c7c0b65..8a976ce 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -179,9 +179,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, - rdims1[ii], ii, tdims1[ii]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + ii, rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -198,9 +198,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, - rdims1[ii], ii, tdims1[ii]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + ii, rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -249,9 +249,9 @@ test_array_compound_array() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, - rdims1[ii], ii, tdims1[ii]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + ii, rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -266,8 +266,9 @@ test_array_compound_array() for (idxi = 0; idxi < SPACE1_DIM1; idxi++) { for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) { - TestErrPrintf("Array data information doesn't match!, wdata[%lld][%lld].i=%d, " - "rdata[%lld][%lld].i=%d\n", + TestErrPrintf("Array data information doesn't match!, wdata[%" PRIuHSIZE "][%" PRIuHSIZE + "].i=%d, " + "rdata[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d\n", idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i); continue; } // end if @@ -459,11 +460,11 @@ test_array_info() // Check the array dimensions for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { - TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=z%llu\n", ii, - rdims1[ii], ii, tdims1[ii]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + ii, rdims1[ii], ii, tdims1[ii]); continue; - } // end if + } } // Close all diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 45ccc98..35db334 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -171,7 +171,8 @@ test_attr_basic_write() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE + "]=%d,read_data1[%" PRIuHSIZE "]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); // Create two more attributes for this dataset, but only write to one. @@ -187,7 +188,8 @@ test_attr_basic_write() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1a[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1a[%" PRIuHSIZE + "]=%d,read_data1[%" PRIuHSIZE "]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); // Close both attributes @@ -453,7 +455,8 @@ test_attr_rename() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu%d\n", + TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE + "]=%d,read_data1[%" PRIuHSIZE "]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); // Close attribute @@ -477,7 +480,8 @@ test_attr_rename() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1a[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1a[%" PRIuHSIZE + "]=%d,read_data1[%" PRIuHSIZE "]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); // Close attribute @@ -542,7 +546,8 @@ test_attr_basic_read() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d, read_data1[%llu]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE + "]=%d, read_data1[%" PRIuHSIZE "]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); /* @@ -573,8 +578,9 @@ test_attr_basic_read() for (i = 0; i < ATTR2_DIM1; i++) for (j = 0; j < ATTR2_DIM2; j++) if (attr_data2[i][j] != read_data2[i][j]) { - TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, " - "read_data2[%llu][%llu]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data2[%" PRIuHSIZE "][%" PRIuHSIZE + "]=%d, " + "read_data2[%" PRIuHSIZE "][%" PRIuHSIZE "]=%d\n", __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); } PASSED(); @@ -786,14 +792,17 @@ test_attr_compound_read() for (ii = 0; ii < ATTR4_DIM1; ii++) for (jj = 0; jj < ATTR4_DIM2; jj++) if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct)) != 0) { - TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].i=%d, " - "read_data4[%llu][%llu].i=%d\n", + TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE + "].i=%d, " + "read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d\n", __LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i); - TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].d=%f, " - "read_data4[%llu][%llu].d=%f\n", + TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE + "].d=%f, " + "read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].d=%f\n", __LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d); - TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].c=%c, " - "read_data4[%llu][%llu].c=%c\n", + TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE + "].c=%c, " + "read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].c=%c\n", __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c); } /* end if */ @@ -1061,8 +1070,8 @@ test_attr_mult_read() hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions (void)space.getSimpleExtentDims(dims); if (dims[0] != ATTR1_DIM1) - TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %llu\n", __LINE__, - static_cast(dims[0]), ATTR1_DIM1); + TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %" PRIuHSIZE "\n", + __LINE__, static_cast(dims[0]), ATTR1_DIM1); /* Verify Datatype */ @@ -1091,7 +1100,8 @@ test_attr_mult_read() // Verify values read in for (i = 0; i < ATTR1_DIM1; i++) if (attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE + "]=%d,read_data1[%" PRIuHSIZE "]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); // Verify Name @@ -1150,8 +1160,9 @@ test_attr_mult_read() for (i = 0; i < ATTR2_DIM1; i++) for (j = 0; j < ATTR2_DIM2; j++) if (attr_data2[i][j] != read_data2[i][j]) - TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, " - "read_data2[%llu][%llu]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data2[%" PRIuHSIZE "][%" PRIuHSIZE + "]=%d, " + "read_data2[%" PRIuHSIZE "][%" PRIuHSIZE "]=%d\n", __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); // Verify Name @@ -1210,8 +1221,9 @@ test_attr_mult_read() for (j = 0; j < ATTR3_DIM2; j++) for (k = 0; k < ATTR3_DIM3; k++) if (abs(attr_data3[i][j][k] - read_data3[i][j][k]) > DBL_EPSILON) - TestErrPrintf("%d: attribute data different: attr_data3[%llu][%llu][%llu]=%f, " - "read_data3[%llu][%llu][%llu]=%f\n", + TestErrPrintf("%d: attribute data different: attr_data3[%" PRIuHSIZE "][%" PRIuHSIZE + "][%" PRIuHSIZE "]=%f, " + "read_data3[%" PRIuHSIZE "][%" PRIuHSIZE "][%" PRIuHSIZE "]=%f\n", __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]); // Verify Name -- cgit v0.12 From 3c18cf7831facc924f0f88c55284d721c9999640 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 11 Jun 2021 15:02:43 -0700 Subject: Normalization of H5_nanosleep() with VFD SWMR branch (#746) * Normalization of H5_nanosleep() with VFD SWMR branch * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5system.c | 42 +++++++++++++++++++++++++++++------------- src/H5win32defs.h | 1 - 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/H5system.c b/src/H5system.c index 7dd0b74..9d87726 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -967,10 +967,7 @@ done: * Note that commodity hardware is probably going to have a * resolution of milliseconds, not nanoseconds. * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * October 01, 2016 + * Return: void *-------------------------------------------------------------------------- */ void @@ -979,21 +976,40 @@ H5_nanosleep(uint64_t nanosec) FUNC_ENTER_NOAPI_NOINIT_NOERR #ifdef H5_HAVE_WIN32_API + DWORD dwMilliseconds = (DWORD)HDceil(nanosec / 1.0e6); + DWORD ignore; - /* On Windows, Sleep() is in milliseconds. Passing 0 to Sleep() - * causes the thread to relinquish the rest of its time slice. + /* Windows can't sleep at a ns resolution. Best we can do is ~1 ms. We + * don't care about the return value since the second parameter + * (bAlertable) is FALSE, so it will always be zero. */ - Sleep(nanosec / (1000 * 1000)); + ignore = SleepEx(dwMilliseconds, FALSE); #else - { - struct timespec sleeptime; /* Struct to hold time to sleep */ - /* Set up time to sleep */ - sleeptime.tv_sec = 0; - sleeptime.tv_nsec = (long)nanosec; + const uint64_t nanosec_per_sec = 1000 * 1000 * 1000; + struct timespec sleeptime; /* Struct to hold time to sleep */ - HDnanosleep(&sleeptime, NULL); + /* Set up time to sleep + * + * Assuming ILP32 or LP64 or wider architecture, (long)operand + * satisfies 0 <= operand < nanosec_per_sec < LONG_MAX. + * + * It's harder to be sure that we don't overflow time_t. + */ + sleeptime.tv_sec = (time_t)(nanosec / nanosec_per_sec); + sleeptime.tv_nsec = (long)(nanosec % nanosec_per_sec); + + /* Sleep for up to `sleeptime` and, in the event of an interruption, + * save the unslept time back to `sleeptime`. + */ + while (HDnanosleep(&sleeptime, &sleeptime) == -1) { + /* If we were just interrupted, sleep for the remaining time. + * Otherwise, the error was essentially impossible, so just stop + * sleeping. + */ + if (errno != EINTR) + break; } #endif diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 3718121..26bca67 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -45,7 +45,6 @@ typedef __int64 h5_stat_size_t; #define HDlseek(F, O, W) _lseeki64(F, O, W) #define HDlstat(S, B) _lstati64(S, B) #define HDmkdir(S, M) _mkdir(S) -#define HDnanosleep(N, O) Wnanosleep(N, O) #define HDoff_t __int64 /* Note that the variadic HDopen macro is using a VC++ extension -- cgit v0.12 From 978b11c8a1f82c4a76713f49e08eb5d1bd0f54ed Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 11 Jun 2021 21:59:00 -0500 Subject: Fix problem in gnu-cxxflags; remove empty if block that throws away all (#748) C++ flags. --- config/gnu-cxxflags | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 63cd952..f63c1dc 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -268,10 +268,7 @@ if test "X-g++" = "X-$cxx_vendor"; then fi # gcc >= 9.3 - if test $cc_vers_major -ge 10 -o $cc_vers_major -eq 9 -a $cc_vers_minor -ge 3; then - # do not use C warnings, $(load_gnu_arguments 9.3), no cxx warnings - # H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-9.3)" - fi + # no cxx warnings, do NOT use C warnings # gcc >= 10 if test $cc_vers_major -ge 10; then -- cgit v0.12 From dfe4f2903b947eea31ed228279192609ca07f35e Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 15 Jun 2021 08:49:05 -0500 Subject: Fix warnings files (#753) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. * Flag cleanup and fix typos * Add comment Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- MANIFEST | 3 +- config/gnu-cxxflags | 2 +- config/intel-cxxflags | 25 ++++++++++++---- config/intel-fflags | 2 -- config/intel-flags | 19 ++++++++++-- config/intel-warnings/general | 1 - config/intel-warnings/general-19 | 2 ++ config/pgi-cxxflags | 23 +++++++++------ config/pgi-fflags | 64 ++++++++++++++++++++++++++++------------ config/pgi-flags | 22 +++++++++----- 10 files changed, 113 insertions(+), 50 deletions(-) create mode 100644 config/intel-warnings/general-19 diff --git a/MANIFEST b/MANIFEST index 2defb86..0615fd0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -201,8 +201,9 @@ ./config/intel-warnings/15 ./config/intel-warnings/18 ./config/intel-warnings/developer-general -./config/intel-warnings/ifort-general ./config/intel-warnings/general +./config/intel-warnings/general-19 +./config/intel-warnings/ifort-general ./config/site-specific/BlankForm diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index f63c1dc..9f11406 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -271,7 +271,7 @@ if test "X-g++" = "X-$cxx_vendor"; then # no cxx warnings, do NOT use C warnings # gcc >= 10 - if test $cc_vers_major -ge 10; then + if test $cxx_vers_major -ge 10; then # Use the C warnings as CXX warnings are the same DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-10)" fi diff --git a/config/intel-cxxflags b/config/intel-cxxflags index 900bcb9..107b087 100644 --- a/config/intel-cxxflags +++ b/config/intel-cxxflags @@ -94,7 +94,7 @@ if test "X-icpc" = "X-$cxx_vendor"; then # Debug # ######### - # NDEBUG is handled explicitly by the configure script + # NDEBUG is handled explicitly in configure # -g is handled by the symbols flags DEBUG_CXXFLAGS= @@ -123,19 +123,19 @@ if test "X-icpc" = "X-$cxx_vendor"; then # Warnings # ############ -# First load the C warnings then add CXX warnings (if needed) - ########### # General # ########### # Add various general warning flags in intel-warnings. + # Use the C warnings as CXX warnings are the same H5_CXXFLAGS="$H5_CXXFLAGS $(load_intel_arguments general)" ###################### # Developer warnings # ###################### + # Use the C warnings as CXX warnings are the same #NO_DEVELOPER_WARNING_CXXFLAGS=$(load_intel_arguments no-developer-general) #DEVELOPER_WARNING_CXXFLAGS=$(load_intel_arguments developer-general) @@ -144,21 +144,34 @@ if test "X-icpc" = "X-$cxx_vendor"; then ############################# # intel == 8.0 - if test $cc_vers_major -eq 8 -a $cc_vers_minor -eq 0; then + if test $cxx_vers_major -eq 8 -a $cxx_vers_minor -eq 0; then # v8.0 -O3 infinite loops when compiling test/tselect.c. Use -O2. HIGH_OPT_CFLAGS="-O2" fi # intel == 10 - if test $cc_vers_major -eq 10; then + if test $cxx_vers_major -eq 10; then HIGH_OPT_CFLAGS="-O1" fi # intel >= 15 - if test $cc_vers_major -ge 15; then + if test $cxx_vers_major -ge 15; then + # Use the C warnings as CXX warnings are the same H5_CXXFLAGS="$H5_CXXFLAGS $(load_intel_arguments 15)" fi + # intel >= 18 + if test $cxx_vers_major -ge 18; then + # Use the C warnings as CXX warnings are the same + H5_CXXFLAGS="$H5_CXXFLAGS $(load_intel_arguments 18)" + fi + + # intel <= 19 + if test $cxx_vers_major -le 19; then + # Use the C warnings as CXX warnings are the same + H5_CXXFLAGS="$H5_CXXFLAGS $(load_intel_arguments general-19)" + fi + ################# # Flags are set # ################# diff --git a/config/intel-fflags b/config/intel-fflags index 2dcd901..42c1781 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -56,7 +56,6 @@ if test X = "X$f9x_flags_set"; then fi fi -# Common Intel flags for various situations if test "X-ifort" = "X-$f9x_vendor"; then FC_BASENAME=ifort @@ -116,7 +115,6 @@ if test "X-ifort" = "X-$f9x_vendor"; then DEBUG_OPT_FCFLAGS= NO_OPT_FCFLAGS= - ############ # Warnings # ############ diff --git a/config/intel-flags b/config/intel-flags index fa317ab..f46da0a 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -78,14 +78,17 @@ if test "X-icc" = "X-$cc_vendor"; then # ;; #esac - # General + ########### + # General # + ########### + # Default to C99 standard. H5_CFLAGS="$H5_CFLAGS $arch -std=c99" ############## # Production # ############## - + PROD_CFLAGS= ######### @@ -154,6 +157,17 @@ if test "X-icc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments 15)" fi + # intel >= 18 + if test $cc_vers_major -ge 18; then + H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments 18)" + fi + + # intel <= 19 + # this file has warnings only available before oneapi versions + if test $cc_vers_major -le 19; then + H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments general-19)" + fi + ################# # Flags are set # ################# @@ -165,4 +179,3 @@ if test "X-$cc_flags_set" = "X-"; then cc_vendor= cc_version= fi - diff --git a/config/intel-warnings/general b/config/intel-warnings/general index d0b2e25..bd866b6 100644 --- a/config/intel-warnings/general +++ b/config/intel-warnings/general @@ -1,2 +1 @@ -Wall --Wcheck \ No newline at end of file diff --git a/config/intel-warnings/general-19 b/config/intel-warnings/general-19 new file mode 100644 index 0000000..e35af30 --- /dev/null +++ b/config/intel-warnings/general-19 @@ -0,0 +1,2 @@ +# this is only available before oneapi versions +-Wcheck diff --git a/config/pgi-cxxflags b/config/pgi-cxxflags index 3b87db2..7d8bdeb 100644 --- a/config/pgi-cxxflags +++ b/config/pgi-cxxflags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # All rights reserved. @@ -44,21 +44,24 @@ fi # Common PGI flags for various situations if test "X-pgc++" = "X-$cxx_vendor"; then - # C++-specific + ########### + # General # + ########### + + # Default to C++11 standard H5_CXXFLAGS="$H5_CXXFLAGS -std=c++11 -Minform=warn" ############## # Production # ############## - # NDEBUG is handled explicitly by the configure script - PROD_CXXFLAGS="-fast" + PROD_CXXFLAGS= ######### # Debug # ######### - # NDEBUG is handled explicitly by the configure script + # NDEBUG is handled explicitly in configure # -g is handled by the symbols flags DEBUG_CXXFLAGS="-Mbounds" @@ -66,8 +69,8 @@ if test "X-pgc++" = "X-$cxx_vendor"; then # Symbols # ########### - SYMBOLS_CXXFLAGS="-g" NO_SYMBOLS_CXXFLAGS="-s" + SYMBOLS_CXXFLAGS="-g" ############# # Profiling # @@ -85,12 +88,14 @@ if test "X-pgc++" = "X-$cxx_vendor"; then DEBUG_OPT_CXXFLAGS="-gopt -O2" NO_OPT_CXXFLAGS="-O0" - # Flags are set + ################# + # Flags are set # + ################# cxx_flags_set=yes fi # Clear cxx info if no flags set if test "X-$cxx_flags_set" = "X-"; then - cxx_vendor= - cxx_version= + cxx_vendor= + cxx_version= fi diff --git a/config/pgi-fflags b/config/pgi-fflags index 3171695..6401d8d 100644 --- a/config/pgi-fflags +++ b/config/pgi-fflags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -45,11 +45,12 @@ fi # Common PGI flags for various situations if test "X-pgf90" = "X-$f9x_vendor"; then - # Insert section about version specific problems from gnu-flags here, if - # necessary. + + ############################### + # Architecture-specific flags # + ############################### arch= - # Architecture-specific flags # Nothing currently. (Uncomment code below and modify to add any) #case "$host_os-$host_cpu" in # *-i686) @@ -65,15 +66,10 @@ if test "X-pgf90" = "X-$f9x_vendor"; then # ;; #esac - # General - FC_BASENAME=pgf90 - Fortran_COMPILER_ID=PGI - F9XSUFFIXFLAG="" - FSEARCH_DIRS="" - # Uncomment the following to add something specific for FCFLAGS. - #FCFLAGS="$FCFLAGS" + ############## + # Production # + ############## - # Production # Check for MPI wrapper being used and tweak down compiler options # Comment out the Tweaking since it caused problems to mpich1.2.6. # Need to investigate the reasons to tweak. @@ -84,24 +80,55 @@ if test "X-pgf90" = "X-$f9x_vendor"; then #fi PROD_FCFLAGS="-fast -Mnoframe" - # Debug + ######### + # Debug # + ######### + DEBUG_FCFLAGS="-Mbounds -Mchkptr -Mdclchk" - # Symbols - SYMBOLS_FCFLAGS="-g" + ########### + # Symbols # + ########### + NO_SYMBOLS_FCFLAGS="-s" + SYMBOLS_FCFLAGS="-g" + + ############# + # Profiling # + ############# - # Profiling PROFILE_FCFLAGS="-Mprof=func,line" # Use this for profiling with gprof #PROFILE_FCFLAGS="-pg" - # Optimization + ################ + # Optimization # + ################ + HIGH_OPT_FCFLAGS= DEBUG_OPT_FCFLAGS= NO_OPT_FCFLAGS= - # Flags are set + ############ + # Warnings # + ############ + + ########### + # General # + ########### + + FC_BASENAME=pgf90 + Fortran_COMPILER_ID=PGI + F9XSUFFIXFLAG="" + FSEARCH_DIRS="" + # Uncomment the following to add something specific for FCFLAGS. + #FCFLAGS="$FCFLAGS" + + + + ################# + # Flags are set # + ################# f9x_flags_set=yes fi @@ -111,4 +138,3 @@ if test "X-$f9x_flags_set" = "X-"; then f9x_version= fi - diff --git a/config/pgi-flags b/config/pgi-flags index 24c7174..b197a1c 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -45,8 +45,8 @@ fi # Common PGI flags for various situations if test "X-pgcc" = "X-$cc_vendor"; then - # Insert section about version specific problems from gnu-flags here, if - # necessary. + # Insert section about version specific problems from compiler flags here, + # if necessary. arch= # Architecture-specific flags @@ -65,7 +65,11 @@ if test "X-pgcc" = "X-$cc_vendor"; then # ;; #esac - # General + ########### + # General # + ########### + + # Default to C99 standard. H5_CFLAGS="$H5_CFLAGS $arch -c99 -Minform=warn" ############## @@ -87,8 +91,8 @@ if test "X-pgcc" = "X-$cc_vendor"; then # Symbols # ########### - SYMBOLS_CFLAGS="-g" NO_SYMBOLS_CFLAGS="-s" + SYMBOLS_CFLAGS="-g" ############# # Profiling # @@ -106,12 +110,14 @@ if test "X-pgcc" = "X-$cc_vendor"; then DEBUG_OPT_CFLAGS="-gopt -O2" NO_OPT_CFLAGS="-O0" - # Flags are set + ################# + # Flags are set # + ################# cc_flags_set=yes fi # Clear cc info if no flags set if test "X-$cc_flags_set" = "X-"; then - cc_vendor= - cc_version= + cc_vendor= + cc_version= fi -- cgit v0.12 From e4e9bb70db3ee275977caad4b494021af41619d7 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 16 Jun 2021 09:54:11 -0700 Subject: Fixes some H5SL include statements (#758) --- src/H5Gint.c | 1 + src/H5Gpkg.h | 1 - src/H5HFpkg.h | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/H5Gint.c b/src/H5Gint.c index dab7a54..90a2c6b 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -38,6 +38,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ +#include "H5SLprivate.h" /* Skip lists */ /****************/ /* Local Macros */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index da565af..d108b03 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -35,7 +35,6 @@ #include "H5HFprivate.h" /* Fractal heaps */ #include "H5HLprivate.h" /* Local Heaps */ #include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 893a65d..8d189e8 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -34,7 +34,6 @@ #include "H5B2private.h" /* v2 B-trees */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FSprivate.h" /* Free space manager */ -#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ -- cgit v0.12 From bb7dfbebdcaf3a838d03167a309b9934b997ce92 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Wed, 16 Jun 2021 15:45:26 -0500 Subject: Fix several warnings (#747) --- hl/src/H5LT.c | 59 +++++++++++++++++++++++++++++++------------ hl/test/test_ds.c | 33 ++++++++++++++---------- hl/test/test_file_image.c | 30 +++++++++++++++++----- src/H5.c | 9 +++---- src/H5CX.c | 24 +++++++++++++----- src/H5Dchunk.c | 5 ++-- src/H5FDhdfs.c | 2 ++ src/H5FDmirror.c | 4 +-- src/H5FDros3.c | 2 ++ test/cache_common.c | 2 +- test/chunk_info.c | 7 ++--- test/cmpd_dset.c | 4 +++ test/cross_read.c | 2 ++ test/direct_chunk.c | 6 +++++ test/dsets.c | 42 +++++++++++++++++------------- test/dtypes.c | 56 +++++++++++++++++++++++++++++++--------- test/file_image.c | 14 +++++++--- test/genall5.c | 20 +++++++-------- test/h5test.c | 10 +++++--- test/objcopy.c | 12 +++++++++ test/trefer_deprec.c | 6 +++++ test/use_common.c | 21 +++++++++++++++ testpar/t_file.c | 5 ++-- testpar/t_span_tree.c | 5 ++-- tools/src/h5dump/h5dump_xml.c | 39 +++++++++++++++++++++++----- 25 files changed, 303 insertions(+), 116 deletions(-) diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index fb507e7..1ef0f9d 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2146,19 +2146,28 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str size_t size_str_to_add, size_str; if (_no_user_buf) { + char *tmp_realloc; + + if (!buf) + goto out; + /* If the buffer isn't big enough, reallocate it. Otherwise, go to do strcat. */ if (str_to_add && ((ssize_t)(*len - (HDstrlen(buf) + HDstrlen(str_to_add) + 1)) < LIMIT)) { *len += ((HDstrlen(buf) + HDstrlen(str_to_add) + 1) / INCREMENT + 1) * INCREMENT; - buf = (char *)HDrealloc(buf, *len); } else if (!str_to_add && ((ssize_t)(*len - HDstrlen(buf) - 1) < LIMIT)) { *len += INCREMENT; - buf = (char *)HDrealloc(buf, *len); } - } - if (!buf) - goto out; + tmp_realloc = (char *)HDrealloc(buf, *len); + if (tmp_realloc == NULL) { + HDfree(buf); + buf = NULL; + goto out; + } + else + buf = tmp_realloc; + } if (str_to_add) { /* find the size of the buffer to add */ @@ -2374,9 +2383,9 @@ out: herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len) { - size_t str_len = INCREMENT; - char * text_str; - herr_t ret = SUCCEED; + size_t str_len = INCREMENT; + char * text_str = NULL; + herr_t ret = SUCCEED; if (lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) goto out; @@ -2400,6 +2409,8 @@ H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len) return ret; out: + HDfree(text_str); + return FAIL; } @@ -2779,10 +2790,14 @@ next: if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) goto out; stmp = (char *)HDcalloc(super_len, sizeof(char)); - if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) + if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { + HDfree(stmp); goto out; - if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) + } + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { + HDfree(stmp); goto out; + } if (stmp) HDfree(stmp); @@ -2822,10 +2837,14 @@ next: if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) goto out; stmp = (char *)HDcalloc(super_len, sizeof(char)); - if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) + if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { + HDfree(stmp); goto out; - if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) + } + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { + HDfree(stmp); goto out; + } if (stmp) HDfree(stmp); @@ -2879,10 +2898,14 @@ next: if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) goto out; stmp = (char *)HDcalloc(super_len, sizeof(char)); - if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) + if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { + HDfree(stmp); goto out; - if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) + } + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { + HDfree(stmp); goto out; + } if (stmp) HDfree(stmp); stmp = NULL; @@ -2933,10 +2956,14 @@ next: if (H5LTdtype_to_text(mtype, NULL, lang, &mlen) < 0) goto out; mtmp = (char *)HDcalloc(mlen, sizeof(char)); - if (H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0) + if (H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0) { + HDfree(mtmp); goto out; - if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp))) + } + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp))) { + HDfree(mtmp); goto out; + } if (mtmp) HDfree(mtmp); mtmp = NULL; diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index ead5c65..786aba8 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -406,10 +406,10 @@ create_int_dataset(hid_t fid, const char *dsidx, int fulldims) herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims) { - int rank = 4; - int rankds = 1; - hsize_t dims[4] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE, DIM4_SIZE}; - long * buf; + int rank = 4; + int rankds = 1; + hsize_t dims[4] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE, DIM4_SIZE}; + long * buf = NULL; hsize_t s1_dim[1] = {DIM1_SIZE}; hsize_t s2_dim[1] = {DIM2_SIZE}; hsize_t s3_dim[1] = {DIM3_SIZE}; @@ -431,49 +431,54 @@ create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldi /* Allocate buffer */ if (NULL == (buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE))) - return FAIL; + goto error; /* make a dataset */ if (H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) { if (fulldims == 0) { /* make a DS dataset for the first dimension */ if (create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0) - return FAIL; + goto error; /* make a DS dataset for the second dimension */ if (create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0) - return FAIL; + goto error; /* make a DS dataset for the third dimension */ if (create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0) - return FAIL; + goto error; /* make a DS dataset for the fourth dimension */ if (create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, NULL, NULL, NULL, NULL) < 0) - return FAIL; + goto error; } else { if (create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0) - return FAIL; + goto error; if (create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0) - return FAIL; + goto error; if (create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0) - return FAIL; + goto error; if (create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, s41_wbuf, s42_wbuf, s43_wbuf, s44_wbuf) < 0) - return FAIL; + goto error; } } else - return FAIL; + goto error; HDfree(buf); return SUCCEED; + +error: + HDfree(buf); + + return FAIL; } herr_t diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index b397a81..bde8adc 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -53,8 +53,8 @@ static int test_file_image(size_t open_images, size_t nflags, const unsigned *flags) { - hid_t * file_id, *dset_id, file_space, plist; /* HDF5 ids */ - hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */ + hid_t * file_id = NULL, *dset_id = NULL, file_space, plist; /* HDF5 ids */ + hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; int data1[6] = {1, 2, 3, 4, 5, 6}; /* original contents of dataset */ int data2[6] = {7, 8, 9, 10, 11, 12}; /* "wrong" contents of dataset */ @@ -63,10 +63,10 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) hsize_t dims4[RANK] = {3, 5}; /* extended dimensions of datasets */ int data4[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; /* extended contents of dataset */ - ssize_t * buf_size; /* pointer to array of buffer sizes */ - void ** buf_ptr; /* pointer to array of pointers to image buffers */ - char ** filename; /* pointer to array of pointers to filenames */ - unsigned * input_flags; /* pointer to array of flag combinations */ + ssize_t * buf_size = NULL; /* pointer to array of buffer sizes */ + void ** buf_ptr = NULL; /* pointer to array of pointers to image buffers */ + char ** filename = NULL; /* pointer to array of pointers to filenames */ + unsigned * input_flags = NULL; /* pointer to array of flag combinations */ size_t i, j, k, nrow, n_values; herr_t status1; void * handle_ptr = NULL; /* pointers to driver buffer */ @@ -85,7 +85,7 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array to store the name of each of the open images */ - if (NULL == (filename = (char **)HDmalloc(sizeof(char *) * open_images))) + if (NULL == (filename = (char **)HDcalloc(1, sizeof(char *) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array to store the size of each of the open images */ @@ -110,6 +110,8 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) /* allocate name buffer for image i */ filename[i] = (char *)HDmalloc(sizeof(char) * 32); + if (!filename[i]) + FAIL_PUTS_ERROR("HDmalloc() failed"); /* create file name */ HDsprintf(filename[i], "image_file%d.h5", (int)i); @@ -232,6 +234,9 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) if (input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW && !(input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY)) { void *tmp_ptr = HDmalloc((size_t)buf_size[i]); + if (!tmp_ptr) + FAIL_PUTS_ERROR("buffer allocation failed"); + /* Copy vfd buffer to a temporary buffer */ HDmemcpy(tmp_ptr, (void *)*core_buf_ptr_ptr, (size_t)buf_size[i]); /* Clear status_flags in the superblock for the vfd buffer: file locking is using status_flags @@ -525,6 +530,17 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) return 0; error: + if (filename) { + for (i = 0; i < open_images; i++) + HDfree(filename[i]); + HDfree(filename); + } + HDfree(file_id); + HDfree(dset_id); + HDfree(buf_ptr); + HDfree(buf_size); + HDfree(input_flags); + H5_FAILED(); return -1; } diff --git a/src/H5.c b/src/H5.c index ce4a001..71a8a30 100644 --- a/src/H5.c +++ b/src/H5.c @@ -960,12 +960,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 " diff --git a/src/H5CX.c b/src/H5CX.c index ca30bdd..01bf435 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -1768,7 +1768,8 @@ H5CX_get_ring(void) hbool_t H5CX_get_coll_metadata_read(void) { - H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + hbool_t coll_md_read = FALSE; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1776,7 +1777,10 @@ H5CX_get_coll_metadata_read(void) 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() */ /*------------------------------------------------------------------------- @@ -1830,7 +1834,8 @@ done: hbool_t H5CX_get_mpi_file_flushing(void) { - H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + hbool_t flushing = FALSE; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1838,7 +1843,10 @@ H5CX_get_mpi_file_flushing(void) 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() */ /*------------------------------------------------------------------------- @@ -1857,7 +1865,8 @@ H5CX_get_mpi_file_flushing(void) hbool_t H5CX_get_mpio_rank0_bcast(void) { - H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + hbool_t do_rank0_bcast = FALSE; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1865,7 +1874,10 @@ H5CX_get_mpio_rank0_bcast(void) 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 */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 67ac99b..ccae784 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4989,7 +4989,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, * order of offset in the file. */ if (need_addr_sort) - HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr); + HDqsort(chunk_disp_array, (size_t)blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr); /* MSC - should use this if MPI_type_create_hindexed block is working: * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, @@ -7478,14 +7478,13 @@ H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata) const H5D_chunk_iter_ud_t *data = (H5D_chunk_iter_ud_t *)udata; int ret_value = H5_ITER_CONT; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* 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"); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_iter_cb */ diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 5cd4a65..4712a8e 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -20,8 +20,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/H5FDmirror.c b/src/H5FDmirror.c index 00b5cd0..5711777 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/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/test/cache_common.c b/test/cache_common.c index e86724f..0ddcbb8 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -4492,7 +4492,7 @@ col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t int mile_stone = 1; int32_t type; int32_t idx; - int32_t local_max_index[NUMBER_OF_ENTRY_TYPES]; + int32_t local_max_index[NUMBER_OF_ENTRY_TYPES] = {0}; if (verbose) HDfprintf(stdout, "%s: entering.\n", FUNC); diff --git a/test/chunk_info.c b/test/chunk_info.c index 7440459..a1c4160 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -482,10 +482,10 @@ test_get_chunk_info_highest_v18(hid_t fapl) unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ int fillvalue = -1; /* Fill value */ - int aggression = 9; /* Compression aggression setting */ hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ #ifdef H5_HAVE_FILTER_DEFLATE - const Bytef *z_src = (const Bytef *)(direct_buf); + int aggression = 9; /* Compression aggression setting */ + const Bytef *z_src = (const Bytef *)(direct_buf); Bytef * z_dst; /* Destination buffer */ uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE); uLong z_src_nbytes = (uLong)CHK_SIZE; @@ -568,7 +568,8 @@ test_get_chunk_info_highest_v18(hid_t fapl) } #else /* Allocate input (non-compressed) buffer */ - inbuf = HDcalloc(1, CHK_SIZE); + if (NULL == (inbuf = HDcalloc(1, CHK_SIZE))) + TEST_ERROR HDmemcpy(inbuf, direct_buf, CHK_SIZE); #endif /* end H5_HAVE_FILTER_DEFLATE */ diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index e74b438..4c3233d 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -1466,6 +1466,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl) return 0; error: + HDfree(orig); + HDfree(rbuf); + HDfree(rew_buf); + HDputs("*** DATASET TESTS FAILED ***"); return 1; } diff --git a/test/cross_read.c b/test/cross_read.c index eef814f..cb71996 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -41,8 +41,10 @@ const char *FILENAME[] = {"vms_data", "le_data", "be_data", NULL}; #define DATASETNAME14 "Fletcher_float_data_le" #define DATASETNAME15 "Fletcher_float_data_be" +#ifdef H5_HAVE_FILTER_DEFLATE #define DATASETNAME16 "Deflate_float_data_le" #define DATASETNAME17 "Deflate_float_data_be" +#endif #ifdef H5_HAVE_FILTER_SZIP #define DATASETNAME18 "Szip_float_data_le" #define DATASETNAME19 "Szip_float_data_be" diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 0d270bd..8960784 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -23,7 +23,9 @@ #define FILE_NAME "direct_chunk.h5" /* Datasets for Direct Write tests */ +#ifdef H5_HAVE_FILTER_DEFLATE #define DATASETNAME1 "direct_write" +#endif #define DATASETNAME2 "skip_one_filter" #define DATASETNAME3 "skip_two_filters" #define DATASETNAME4 "data_conv" @@ -31,9 +33,11 @@ #define DATASETNAME6 "invalid_argue" #define DATASETNAME7 "overwrite_chunk" /* Datasets for Direct Read tests */ +#ifdef H5_HAVE_FILTER_DEFLATE #define DATASETNAME8 "disabled_chunk_cache" #define DATASETNAME9 "flush_chunk_cache" #define DATASETNAME10 "read_w_valid_cache" +#endif #define DATASETNAME11 "unallocated_chunk" #define DATASETNAME12 "unfiltered_data" @@ -43,7 +47,9 @@ #define CHUNK_NX 4 #define CHUNK_NY 4 +#ifdef H5_HAVE_FILTER_DEFLATE #define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12.0) +#endif /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS1 305 diff --git a/test/dsets.c b/test/dsets.c index cc35fe3..26322ad 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -95,25 +95,29 @@ const char *FILENAME[] = {"dataset", /* 0 */ #define FILE_DEFLATE_NAME "deflate.h5" /* Dataset names for testing filters */ -#define DSET_DEFAULT_NAME "default" -#define DSET_CHUNKED_NAME "chunked" -#define DSET_COMPACT_NAME "compact" -#define DSET_SIMPLE_IO_NAME "simple_io" -#define DSET_USERBLOCK_IO_NAME "userblock_io" -#define DSET_COMPACT_IO_NAME "compact_io" -#define DSET_COMPACT_MAX_NAME "max_compact" -#define DSET_COMPACT_MAX2_NAME "max_compact_2" -#define DSET_CONV_BUF_NAME "conv_buf" -#define DSET_TCONV_NAME "tconv" -#define DSET_DEFLATE_NAME "deflate" -#define DSET_SHUFFLE_NAME "shuffle" -#define DSET_FLETCHER32_NAME "fletcher32" -#define DSET_FLETCHER32_NAME_2 "fletcher32_2" -#define DSET_FLETCHER32_NAME_3 "fletcher32_3" +#define DSET_DEFAULT_NAME "default" +#define DSET_CHUNKED_NAME "chunked" +#define DSET_COMPACT_NAME "compact" +#define DSET_SIMPLE_IO_NAME "simple_io" +#define DSET_USERBLOCK_IO_NAME "userblock_io" +#define DSET_COMPACT_IO_NAME "compact_io" +#define DSET_COMPACT_MAX_NAME "max_compact" +#define DSET_COMPACT_MAX2_NAME "max_compact_2" +#define DSET_CONV_BUF_NAME "conv_buf" +#define DSET_TCONV_NAME "tconv" +#ifdef H5_HAVE_FILTER_DEFLATE +#define DSET_DEFLATE_NAME "deflate" +#endif +#define DSET_SHUFFLE_NAME "shuffle" +#define DSET_FLETCHER32_NAME "fletcher32" +#define DSET_FLETCHER32_NAME_2 "fletcher32_2" +#define DSET_FLETCHER32_NAME_3 "fletcher32_3" +#ifdef H5_HAVE_FILTER_DEFLATE #define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32" #define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2" -#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space" -#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type" +#endif +#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space" +#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type" #ifdef H5_HAVE_FILTER_SZIP #define DSET_SZIP_NAME "szip" #define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32" @@ -1504,6 +1508,9 @@ test_conv_buffer(hid_t fid) return SUCCEED; error: + HDfree(cfrR); + HDfree(cf); + H5E_BEGIN_TRY { H5Pclose(xfer_list); @@ -7162,6 +7169,7 @@ error: H5E_END_TRY; return FAIL; #else + (void)file; /* Silence compiler */ SKIPPED(); return SUCCEED; #endif diff --git a/test/dtypes.c b/test/dtypes.c index 52eb0ea..2a18302 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -783,9 +783,12 @@ test_compound_2(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)); + if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))))) + goto error; + if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)))) + goto error; + if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)))) + goto error; for (i = 0; i < (int)nelmts; i++) { s_ptr = ((struct st *)((void *)orig)) + i; s_ptr->a = i * 8 + 0; @@ -857,6 +860,10 @@ test_compound_2(void) return 0; error: + HDfree(buf); + HDfree(bkg); + HDfree(orig); + /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); @@ -903,9 +910,12 @@ test_compound_3(void) FAIL_STACK_ERROR /* Initialize */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)); + if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))))) + goto error; + if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)))) + goto error; + if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)))) + goto error; for (i = 0; i < (int)nelmts; i++) { s_ptr = ((struct st *)((void *)orig)) + i; s_ptr->a = i * 8 + 0; @@ -973,6 +983,10 @@ test_compound_3(void) return 0; error: + HDfree(buf); + HDfree(bkg); + HDfree(orig); + /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); @@ -1023,9 +1037,12 @@ test_compound_4(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)); + if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))))) + goto error; + if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)))) + goto error; + if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)))) + goto error; for (i = 0; i < (int)nelmts; i++) { s_ptr = ((struct st *)((void *)orig)) + i; s_ptr->a = i * 8 + 0; @@ -1096,6 +1113,10 @@ test_compound_4(void) return 0; error: + HDfree(buf); + HDfree(bkg); + HDfree(orig); + /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); @@ -1146,6 +1167,12 @@ test_compound_5(void) TESTING("optimized struct converter"); + if (!buf || !bkg) { + HDfree(buf); + HDfree(bkg); + return 1; + } + /* Build datatypes */ short_array = H5Tcreate(H5T_COMPOUND, 4 * sizeof(short)); array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims); @@ -1238,9 +1265,12 @@ test_compound_6(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)); + if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))))) + goto error; + if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)))) + goto error; + if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)))) + goto error; for (i = 0; i < (int)nelmts; i++) { s_ptr = ((struct st *)((void *)orig)) + i; s_ptr->b = (int16_t)((i * 8 + 1) & 0x7fff); @@ -2290,6 +2320,8 @@ test_compound_11(void) ((big_t *)buf)[u].i1 = (int)(u * 3); ((big_t *)buf)[u].i2 = (int)(u * 5); ((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32); + if (!((big_t *)buf)[u].s1) + TEST_ERROR HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u); } /* end for */ diff --git a/test/file_image.c b/test/file_image.c index f6075d5..0373468 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -102,8 +102,9 @@ test_properties(void) * property list functions. In the file driver tests further down, this will * not be the case. */ - size = (size_t)count * sizeof(char); - buffer = (char *)HDmalloc(size); + size = (size_t)count * sizeof(char); + if (NULL == (buffer = (char *)HDmalloc(size))) + TEST_ERROR for (i = 0; i < count - 1; i++) buffer[i] = (char)(65 + i); buffer[count - 1] = '\0'; @@ -338,8 +339,8 @@ test_callbacks(void) H5FD_file_image_callbacks_t callbacks; hid_t fapl_1; hid_t fapl_2; - udata_t * udata; - char * file_image; + udata_t * udata = NULL; + char * file_image = NULL; char * temp_file_image; int count = 10; int i; @@ -350,6 +351,7 @@ test_callbacks(void) /* Allocate and initialize udata */ udata = (udata_t *)HDmalloc(sizeof(udata_t)); + VERIFY(udata != NULL, "udata malloc failed"); reset_udata(udata); /* copy the address of the user data into read_callbacks */ @@ -358,6 +360,7 @@ test_callbacks(void) /* Allocate and initialize file image buffer */ size = (size_t)count * sizeof(char); file_image = (char *)HDmalloc(size); + VERIFY(file_image != NULL, "file_image malloc failed"); for (i = 0; i < count - 1; i++) file_image[i] = (char)(65 + i); file_image[count - 1] = '\0'; @@ -529,6 +532,9 @@ test_callbacks(void) return 0; error: + HDfree(file_image); + HDfree(udata); + return 1; } /* test_callbacks() */ diff --git a/test/genall5.c b/test/genall5.c index a6331f6..1da61f8 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -1673,10 +1673,10 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) failure_mssg = "ds_ctg_i: H5Dwrite() failed."; } HDassert(ret >= 0); - - HDfree(wdata); } + HDfree(wdata); + if (pass) { ret = H5Dclose(dsid); @@ -1891,10 +1891,10 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) } HDassert((int)u == rdata[u]); } - - HDfree(rdata); } /* end if */ + HDfree(rdata); + if (pass) { ret = H5Dclose(dsid); @@ -2250,10 +2250,10 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) } HDassert((int)u == rdata[u]); } - - HDfree(rdata); } /* end if */ + HDfree(rdata); + if (pass) { ret = H5Dclose(dsid); @@ -2590,10 +2590,10 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) } HDassert((int)u == rdata[u]); } - - HDfree(rdata); } /* end if */ + HDfree(rdata); + if (pass) { ret = H5Dclose(dsid); @@ -2982,10 +2982,10 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) failure_mssg = "vrfy_ds_ctg_v: H5Treclaim() failed."; } HDassert(ret >= 0); - - HDfree(rdata); } /* end if */ + HDfree(rdata); + if (pass) { ret = H5Sclose(sid); diff --git a/test/h5test.c b/test/h5test.c index 2a54982..4dff00d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1195,9 +1195,10 @@ h5_set_info_object(void) valp++; /* copy key/value pair into temporary buffer */ - len = strcspn(valp, ";"); - next = &valp[len]; - key_val = (char *)HDcalloc(1, len + 1); + len = strcspn(valp, ";"); + next = &valp[len]; + if (NULL == (key_val = (char *)HDcalloc(1, len + 1))) + return -1; /* increment the next pointer past the terminating semicolon */ if (*next == ';') @@ -1593,6 +1594,9 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name) void * buf = NULL; /* Buffer for copying data */ const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */ + if (!filename) + goto error; + /* Allocate copy buffer */ if (NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE))) goto error; diff --git a/test/objcopy.c b/test/objcopy.c index 43a5756..e01083d 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -4498,6 +4498,10 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid TESTING("H5Ocopy(): compressed dataset"); #ifndef H5_HAVE_FILTER_DEFLATE + (void)fcpl_src; + (void)fcpl_dst; + (void)src_fapl; + (void)dst_fapl; /* Silence compiler */ SKIPPED(); HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ @@ -4923,6 +4927,10 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h } #ifndef H5_HAVE_FILTER_DEFLATE + (void)fcpl_src; + (void)fcpl_dst; + (void)src_fapl; + (void)dst_fapl; /* Silence compiler */ SKIPPED(); HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ @@ -7277,6 +7285,10 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, TESTING("H5Ocopy(): compressed dataset with VLEN datatype"); #ifndef H5_HAVE_FILTER_DEFLATE + (void)fcpl_src; + (void)fcpl_dst; + (void)src_fapl; + (void)dst_fapl; /* Silence compiler */ SKIPPED(); HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 24371ef..755df68 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -87,8 +87,11 @@ test_reference_params(void) /* Allocate write & read buffers */ wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(rbuf, "HDmalloc"); tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(tbuf, "HDmalloc"); /* Create file */ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -269,8 +272,11 @@ test_reference_obj(void) /* Allocate write & read buffers */ wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(rbuf, "HDmalloc"); tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(tbuf, "HDmalloc"); /* Create file */ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/test/use_common.c b/test/use_common.c index 0ea2c83..8f78f3b 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -322,10 +322,12 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) rank = H5Sget_simple_extent_ndims(f_sid); if (rank != UC_RANK) { HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank); + HDfree(buffer); return -1; } if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) { HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + HDfree(buffer); return -1; } HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]), @@ -334,12 +336,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]) { HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]); + HDfree(buffer); return -1; } /* setup mem-space for buffer */ if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) { HDfprintf(stderr, "H5Screate_simple for memory failed\n"); + HDfree(buffer); return -1; } @@ -360,6 +364,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) if (opts->use_swmr) { if (H5Odisable_mdc_flushes(dsid) < 0) { HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n"); + HDfree(buffer); return -1; } } @@ -368,12 +373,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) dims[0] = i + 1; if (H5Dset_extent(dsid, dims) < 0) { HDfprintf(stderr, "H5Dset_extent failed\n"); + HDfree(buffer); return -1; } /* Get the dataset's dataspace */ if ((f_sid = H5Dget_space(dsid)) < 0) { HDfprintf(stderr, "H5Dset_extent failed\n"); + HDfree(buffer); return -1; } @@ -381,12 +388,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) /* Choose the next plane to write */ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) { HDfprintf(stderr, "Failed H5Sselect_hyperslab\n"); + HDfree(buffer); return -1; } /* Write plane to the dataset */ if (H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) { HDfprintf(stderr, "Failed H5Dwrite\n"); + HDfree(buffer); return -1; } @@ -394,6 +403,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) if (opts->use_swmr) { if (H5Oenable_mdc_flushes(dsid) < 0) { HDfprintf(stderr, "H5Oenable_mdc_flushes failed\n"); + HDfree(buffer); return -1; } } @@ -401,6 +411,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) /* flush file to make the just written plane available. */ if (H5Dflush(dsid) < 0) { HDfprintf(stderr, "Failed to H5Fflush file\n"); + HDfree(buffer); return -1; } } /* end for each plane to write */ @@ -488,10 +499,12 @@ read_uc_file(hbool_t towait, options_t *opts) rank = H5Sget_simple_extent_ndims(f_sid); if (rank != UC_RANK) { HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank); + HDfree(buffer); return -1; } if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) { HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + HDfree(buffer); return -1; } HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]), @@ -502,12 +515,14 @@ read_uc_file(hbool_t towait, options_t *opts) (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]); HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", (unsigned long long)memdims[0], (unsigned long long)memdims[1], (unsigned long long)memdims[2]); + HDfree(buffer); return -1; } /* Setup mem-space for buffer */ if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) { HDfprintf(stderr, "H5Screate_simple for memory failed\n"); + HDfree(buffer); return -1; } @@ -533,6 +548,7 @@ read_uc_file(hbool_t towait, options_t *opts) HDprintf("."); if (loops_waiting_for_plane >= 30) { HDfprintf(stderr, "waited too long for new plane, quit.\n"); + HDfree(buffer); return -1; } } @@ -550,6 +566,7 @@ read_uc_file(hbool_t towait, options_t *opts) /* Get the dataset's dataspace */ if ((f_sid = H5Dget_space(dsid)) < 0) { HDfprintf(stderr, "H5Dget_space failed\n"); + HDfree(buffer); return -1; } @@ -557,12 +574,14 @@ read_uc_file(hbool_t towait, options_t *opts) /* Choose the next plane to read */ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) { HDfprintf(stderr, "H5Sselect_hyperslab failed\n"); + HDfree(buffer); return -1; } /* Read the plane from the dataset */ if (H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) { HDfprintf(stderr, "H5Dread failed\n"); + HDfree(buffer); return -1; } @@ -594,12 +613,14 @@ read_uc_file(hbool_t towait, options_t *opts) f_sid = H5Dget_space(dsid); /* Get filespace handle first. */ if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) { HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + HDfree(buffer); return -1; } } /* end while (expecting more planes to read) */ if (H5Fclose(fid) < 0) { HDfprintf(stderr, "H5Fclose failed\n"); + HDfree(buffer); return -1; } diff --git a/testpar/t_file.c b/testpar/t_file.c index 8dea120..5348f4f 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -952,9 +952,8 @@ test_file_properties(void) void test_delete(void) { - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ - hbool_t is_coll; + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ const char *filename = NULL; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index 7c2763c..518741d 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -35,6 +35,8 @@ #include "H5private.h" #include "testphdf5.h" +#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0 + static void coll_write_test(int chunk_factor); static void coll_read_test(void); @@ -1431,8 +1433,7 @@ lower_dim_size_comp_test__verify_data(uint32_t *buf_ptr, *------------------------------------------------------------------------- */ -#define LDSCT_DS_RANK 5 -#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0 +#define LDSCT_DS_RANK 5 static void lower_dim_size_comp_test__run_test(const int chunk_edge_size, const hbool_t use_collective_io, diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 5507dcc..0e881df 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -2365,14 +2365,21 @@ xml_dump_named_datatype(hid_t type, const char *name) h5tools_context_t ctx; /* print context */ h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - char * tmp; - char * dtxid; - char * parentxid; - char * t_tmp; - char * t_prefix; - char * t_name; + char * tmp = NULL; + char * dtxid = NULL; + char * parentxid = NULL; + char * t_tmp = NULL; + char * t_prefix = NULL; + char * t_name = NULL; tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + if (tmp == NULL) { + indentation(dump_indent); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + HDstrcpy(tmp, prefix); HDstrcat(tmp, "/"); HDstrcat(tmp, name); @@ -2627,6 +2634,13 @@ xml_dump_group(hid_t gid, const char *name) } else { tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + if (tmp == NULL) { + indentation(dump_indent); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + return; + } + HDstrcpy(tmp, prefix); par = HDstrdup(tmp); cp = HDstrrchr(par, '/'); @@ -3146,8 +3160,11 @@ xml_print_strs(hid_t did, int source) } bp = (char *)buf; - if (!is_vlstr) + if (!is_vlstr) { onestring = (char *)HDcalloc(tsiz, sizeof(char)); + if (onestring == NULL) + goto error; + } /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -3768,6 +3785,14 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss char *pstr = (char *)HDmalloc((size_t)100); tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + if (tmp == NULL) { + error_msg("buffer allocation failed\n"); + h5tools_setstatus(EXIT_FAILURE); + HDfree(rstr); + HDfree(pstr); + return; + } + HDstrcpy(tmp, prefix); HDstrcat(tmp, "/"); HDstrcat(tmp, name); -- cgit v0.12 From f2fd72875629c629b48b88a996bd4036c33bbb00 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 16 Jun 2021 22:49:10 -0500 Subject: Fix cmake configure path (#760) * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. * Flag cleanup and fix typos * Add comment * Correct VAR used to find configure time file * Set the path correctly Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- config/cmake/ConfigureChecks.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 0717628..87b2006 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -233,6 +233,7 @@ endif () # The provided CMake C macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- +set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR}) macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Detecting C ${FUNCTION_NAME}") @@ -310,7 +311,7 @@ set (PROG_SRC ) C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES) -file (READ "${CMAKE_BINARY_DIR}/pac_Cconftest.out" PROG_OUTPUT4) +file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_Cconftest.out" PROG_OUTPUT4) message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}") # dnl The output from the above program will be: -- cgit v0.12 From 2e7750f837547ad9d6fa6b5565d24b1f313cc5a9 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 17 Jun 2021 18:37:01 -0700 Subject: Fixes non-C99 format strings in tarray test code (#766) --- test/tarray.c | 53 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/test/tarray.c b/test/tarray.c index 8b518cf..af167a7 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -157,8 +157,9 @@ test_array_atomic_1d(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -490,8 +491,9 @@ test_array_array_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims1; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -668,8 +670,9 @@ test_array_compound_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -889,8 +892,9 @@ test_array_compound_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -951,9 +955,9 @@ test_array_compound_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf( - "Nested array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Nested array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1210,8 +1214,9 @@ test_array_vlen_atomic(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1440,8 +1445,9 @@ test_array_vlen_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -1472,8 +1478,9 @@ test_array_vlen_array(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -2081,9 +2088,9 @@ test_compat(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ @@ -2129,9 +2136,9 @@ test_compat(void) /* Check the array dimensions */ for (i = 0; i < ndims; i++) if (rdims1[i] != tdims1[i]) { - TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=%llu\n", i, - rdims1[i], i, tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE + ", tdims1[%d]=%" PRIuHSIZE "\n", + i, rdims1[i], i, tdims1[i]); continue; } /* end if */ -- cgit v0.12 From a91c626c29dd18dbb23f0533a940b153dd4cad33 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 18 Jun 2021 09:23:01 -0700 Subject: Removes checks and work-arounds for strtoll and strtoull (#769) * Removes checks and work-arounds for strtoll and strtoull * Removes CMake checks for strtoll and strtoull --- config/cmake/H5pubconf.h.in | 6 -- config/cmake_ext_mod/ConfigureChecks.cmake | 2 - configure.ac | 1 - src/H5private.h | 6 +- src/H5system.c | 125 ----------------------------- 5 files changed, 1 insertion(+), 139 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index f793367..093c6f6 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -349,12 +349,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_STRING_H @H5_HAVE_STRING_H@ -/* Define to 1 if you have the `strtoll' function. */ -#cmakedefine H5_HAVE_STRTOLL @H5_HAVE_STRTOLL@ - -/* Define to 1 if you have the `strtoull' function. */ -#cmakedefine H5_HAVE_STRTOULL @H5_HAVE_STRTOULL@ - /* Define if struct text_info is defined */ #cmakedefine H5_HAVE_STRUCT_TEXT_INFO @H5_HAVE_STRUCT_TEXT_INFO@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 0c310e2..d9144ce 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -494,8 +494,6 @@ CHECK_FUNCTION_EXISTS (sigprocmask ${HDF_PREFIX}_HAVE_SIGPROCMASK) CHECK_FUNCTION_EXISTS (snprintf ${HDF_PREFIX}_HAVE_SNPRINTF) CHECK_FUNCTION_EXISTS (srandom ${HDF_PREFIX}_HAVE_SRANDOM) CHECK_FUNCTION_EXISTS (strdup ${HDF_PREFIX}_HAVE_STRDUP) -CHECK_FUNCTION_EXISTS (strtoll ${HDF_PREFIX}_HAVE_STRTOLL) -CHECK_FUNCTION_EXISTS (strtoull ${HDF_PREFIX}_HAVE_STRTOULL) CHECK_FUNCTION_EXISTS (symlink ${HDF_PREFIX}_HAVE_SYMLINK) CHECK_FUNCTION_EXISTS (system ${HDF_PREFIX}_HAVE_SYSTEM) diff --git a/configure.ac b/configure.ac index e369f61..6ad8344 100644 --- a/configure.ac +++ b/configure.ac @@ -2030,7 +2030,6 @@ AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([snprintf srandom strdup symlink system]) -AC_CHECK_FUNCS([strtoll strtoull]) AC_CHECK_FUNCS([tmpfile asprintf vasprintf vsnprintf waitpid]) ## ---------------------------------------------------------------------- diff --git a/src/H5private.h b/src/H5private.h index a1285ee..290d873 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1526,11 +1526,7 @@ H5_DLL void HDsrand(unsigned int seed); #define HDstrtol(S, R, N) strtol(S, R, N) #endif /* HDstrtol */ #ifndef HDstrtoll -#ifdef H5_HAVE_STRTOLL #define HDstrtoll(S, R, N) strtoll(S, R, N) -#else -H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); -#endif /* H5_HAVE_STRTOLL */ #endif /* HDstrtoll */ #ifndef HDstrtoul #define HDstrtoul(S, R, N) strtoul(S, R, N) @@ -1631,7 +1627,7 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #ifdef H5_HAVE_VASPRINTF #define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) #else -H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); +H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #endif /* H5_HAVE_VASPRINTF */ #endif /* HDvasprintf */ #ifndef HDva_arg diff --git a/src/H5system.c b/src/H5system.c index 9d87726..7a87a65 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -97,131 +97,6 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap) #endif /* H5_HAVE_VASPRINTF */ /*------------------------------------------------------------------------- - * Function: HDstrtoll - * - * Purpose: Converts the string S to an int64_t value according to the - * given BASE, which must be between 2 and 36 inclusive, or be - * the special value zero. - * - * The string must begin with an arbitrary amount of white space - * (as determined by isspace(3c)) followed by a single optional - * `+' or `-' sign. If BASE is zero or 16 the string may then - * include a `0x' or `0X' prefix, and the number will be read in - * base 16; otherwise a zero BASE is taken as 10 (decimal) - * unless the next character is a `0', in which case it is taken - * as 8 (octal). - * - * The remainder of the string is converted to an int64_t in the - * obvious manner, stopping at the first character which is not - * a valid digit in the given base. (In bases above 10, the - * letter `A' in either upper or lower case represetns 10, `B' - * represents 11, and so forth, with `Z' representing 35.) - * - * If REST is not null, the address of the first invalid - * character in S is stored in *REST. If there were no digits - * at all, the original value of S is stored in *REST. Thus, if - * *S is not `\0' but **REST is `\0' on return the entire string - * was valid. - * - * Return: Success: The result. - * - * Failure: If the input string does not contain any - * digits then zero is returned and REST points - * to the original value of S. If an overflow - * or underflow occurs then the maximum or - * minimum possible value is returned and the - * global `errno' is set to ERANGE. If BASE is - * incorrect then zero is returned. - * - * Programmer: Robb Matzke - * Thursday, April 9, 1998 - * - *------------------------------------------------------------------------- - */ -#ifndef HDstrtoll -int64_t -HDstrtoll(const char *s, const char **rest, int base) -{ - int64_t sign = 1, acc = 0; - hbool_t overflow = FALSE; - - errno = 0; - if (!s || (base && (base < 2 || base > 36))) { - if (rest) - *rest = s; - return 0; - } - - /* Skip white space */ - while (HDisspace(*s)) - s++; - - /* Optional minus or plus sign */ - if ('+' == *s) { - s++; - } - else if ('-' == *s) { - sign = -1; - s++; - } - - /* Zero base prefix */ - if (0 == base && '0' == *s && ('x' == s[1] || 'X' == s[1])) { - base = 16; - s += 2; - } - else if (0 == base && '0' == *s) { - base = 8; - s++; - } - else if (0 == base) { - base = 10; - } - - /* Digits */ - while ((base <= 10 && *s >= '0' && *s < '0' + base) || - (base > 10 && ((*s >= '0' && *s <= '9') || (*s >= 'a' && *s < 'a' + base - 10) || - (*s >= 'A' && *s < 'A' + base - 10)))) { - if (!overflow) { - int64_t digit = 0; - - if (*s >= '0' && *s <= '9') - digit = *s - '0'; - else if (*s >= 'a' && *s <= 'z') - digit = (*s - 'a') + 10; - else - digit = (*s - 'A') + 10; - - if (acc * base + digit < acc) { - overflow = TRUE; - } - else { - acc = acc * base + digit; - } - } - s++; - } - - /* Overflow */ - if (overflow) { - if (sign > 0) { - acc = ((uint64_t)1 << (8 * sizeof(int64_t) - 1)) - 1; - } - else { - acc = (int64_t)((uint64_t)1 << (8 * sizeof(int64_t) - 1)); - } - errno = ERANGE; - } - - /* Return values */ - acc *= sign; - if (rest) - *rest = s; - return acc; -} /* end HDstrtoll() */ -#endif - -/*------------------------------------------------------------------------- * Function: HDrand/HDsrand * * Purpose: Wrapper function for rand. If rand_r exists on this system, -- cgit v0.12 From 22a49ec424cb7a232d03d062c4141903ed6937d0 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 21 Jun 2021 09:09:13 -0700 Subject: Removes checks for (v)snprintf, which are C99 (#772) --- config/cmake/H5pubconf.h.in | 6 ------ config/cmake_ext_mod/ConfigureChecks.cmake | 8 -------- config/cmake_ext_mod/HDFTests.c | 25 ------------------------- configure.ac | 4 ++-- 4 files changed, 2 insertions(+), 41 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 093c6f6..8201fc5 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -322,9 +322,6 @@ /* Define to 1 if you have the `sigsetjmp' function. */ #cmakedefine H5_HAVE_SIGSETJMP @H5_HAVE_SIGSETJMP@ -/* Define to 1 if you have the `snprintf' function. */ -#cmakedefine H5_HAVE_SNPRINTF @H5_HAVE_SNPRINTF@ - /* Define to 1 if you have the `srandom' function. */ #cmakedefine H5_HAVE_SRANDOM @H5_HAVE_SRANDOM@ @@ -414,9 +411,6 @@ /* Define to 1 if you have the `vasprintf' function. */ #cmakedefine H5_HAVE_VASPRINTF @H5_HAVE_VASPRINTF@ -/* Define to 1 if you have the `vsnprintf' function. */ -#cmakedefine H5_HAVE_VSNPRINTF @H5_HAVE_VSNPRINTF@ - /* Define to 1 if you have the `waitpid' function. */ #cmakedefine H5_HAVE_WAITPID @H5_HAVE_WAITPID@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index d9144ce..d713c7c 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -491,7 +491,6 @@ CHECK_FUNCTION_EXISTS (siglongjmp ${HDF_PREFIX}_HAVE_SIGLONGJMP) CHECK_FUNCTION_EXISTS (sigsetjmp ${HDF_PREFIX}_HAVE_SIGSETJMP) CHECK_FUNCTION_EXISTS (sigprocmask ${HDF_PREFIX}_HAVE_SIGPROCMASK) -CHECK_FUNCTION_EXISTS (snprintf ${HDF_PREFIX}_HAVE_SNPRINTF) CHECK_FUNCTION_EXISTS (srandom ${HDF_PREFIX}_HAVE_SRANDOM) CHECK_FUNCTION_EXISTS (strdup ${HDF_PREFIX}_HAVE_STRDUP) CHECK_FUNCTION_EXISTS (symlink ${HDF_PREFIX}_HAVE_SYMLINK) @@ -502,13 +501,6 @@ CHECK_FUNCTION_EXISTS (asprintf ${HDF_PREFIX}_HAVE_ASPRINTF) CHECK_FUNCTION_EXISTS (vasprintf ${HDF_PREFIX}_HAVE_VASPRINTF) CHECK_FUNCTION_EXISTS (waitpid ${HDF_PREFIX}_HAVE_WAITPID) -CHECK_FUNCTION_EXISTS (vsnprintf ${HDF_PREFIX}_HAVE_VSNPRINTF) -if (MINGW OR NOT WINDOWS) - if (${HDF_PREFIX}_HAVE_VSNPRINTF) - HDF_FUNCTION_TEST (VSNPRINTF_WORKS) - endif () -endif () - #----------------------------------------------------------------------------- # sigsetjmp is special; may actually be a macro #----------------------------------------------------------------------------- diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 0c3b7b7..b8a6af1 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -64,31 +64,6 @@ main () #endif -#ifdef VSNPRINTF_WORKS -#include -#include -#include - -int test_vsnprintf(const char *fmt,...) -{ - va_list ap; - char *s = malloc(16); - int ret; - - va_start(ap, fmt); - ret=vsnprintf(s,16,"%s",ap); - va_end(ap); - - return(ret!=42 ? 1 : 0); -} - -int main(void) -{ - return(test_vsnprintf("%s","A string that is longer than 16 characters")); -} -#endif - - #ifdef HAVE_ATTRIBUTE #if 0 diff --git a/configure.ac b/configure.ac index 6ad8344..cb8f97a 100644 --- a/configure.ac +++ b/configure.ac @@ -2029,8 +2029,8 @@ AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork frexpf]) AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) -AC_CHECK_FUNCS([snprintf srandom strdup symlink system]) -AC_CHECK_FUNCS([tmpfile asprintf vasprintf vsnprintf waitpid]) +AC_CHECK_FUNCS([srandom strdup symlink system]) +AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) ## ---------------------------------------------------------------------- ## Check compiler characteristics -- cgit v0.12 From 9f5b16bccb09be387187a806d01b582a6b20e991 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 22 Jun 2021 07:01:22 -0500 Subject: Update missing release note info. (#776) * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. * Flag cleanup and fix typos * Add comment * Correct VAR used to find configure time file * Set the path correctly * Update missing release note info. * Update code owners * Correct JIRA note Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- .github/CODEOWNERS | 4 ++-- release_docs/RELEASE.txt | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c807e75..29e5866 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -19,7 +19,7 @@ CMakeTests.* @byrnHDF @derobins /doc/ @gnuoyd @jrmainzer -/examples/ @lrknox @derobins @bljhdf +/examples/ @lrknox @derobins @bmribler /fortran/ @brtnfld @epourmal @@ -29,7 +29,7 @@ CMakeTests.* @byrnHDF @derobins /m4/ @lrknox @derobins -/release_docs/ @lrknox @bljhdf @byrnHDF +/release_docs/ @lrknox @bmribler @byrnHDF /src/ @jhendersonHDF @derobins @fortnern @qkoziol @soumagne @vchoi-hdfgroup @jrmainzer diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 3c1870e..e98a8c6 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -133,7 +133,7 @@ New Features To do so, set CMAKE_OSX_ARCHITECTURES="x86_64;arm64" - (SAM - 2021/02/07, https://github.com/HDFGroup/hdf5/issues/311) + (SAM - 2021/02/07, github-311) - Added a configure-time option to control certain compiler warnings diagnostics @@ -1076,6 +1076,13 @@ Bug Fixes since HDF5-1.12.0 release (ADB - 2021/06/03) + - Move emscripten flag to compile flags + + The emscripten flag, -O0, was removed from target_link_libraries command + to the correct target_compile_options command. + + (ADB - 2021/04/26 HDFFV-11083) + - Remove arbitrary warning flag groups from CMake builds The arbitrary groups were created to reduce the quantity of warnings being @@ -1112,6 +1119,14 @@ Bug Fixes since HDF5-1.12.0 release (DER - 2021/01/07, HDFFV-11201) + - Add missing ENV variable line to hdfoptions.cmake file + + Using the build options to use system SZIP/ZLIB libraries need to also + specify the library root directory. Setting the {library}_ROOT ENV + variable was added to the hdfoptions.cmake file. + + (ADB - 2020/10/19 HDFFV-11108) + Tools ----- @@ -1124,7 +1139,7 @@ Bug Fixes since HDF5-1.12.0 release also show the number of bits for precision. These files are also used in the java tests. - (ADB - 2021/03/24, HDFFV-11229) + (ADB - 2021/03/24, HDFFV-11229,HDFFV-11113) - Fixed tools argument parsing. @@ -1171,7 +1186,7 @@ Bug Fixes since HDF5-1.12.0 release 2 : All level 1 information plus extended attribute status report 3 : All level 2 information plus file names - (ADB - 2020/07/20, HDFFV-10005) + (ADB - 2020/07/20, HDFFV-1005) - h5repack was fixed to repack the reference attributes properly. -- cgit v0.12 From a1d128597ffc341d214b0f3e3c7e607d53475e88 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:25:51 -0700 Subject: Replaces the H5_OVERRIDE macro with override (#773) The macro is no longer necessary now that we require C++11. --- c++/src/H5ArrayType.h | 6 +++--- c++/src/H5AtomType.h | 4 ++-- c++/src/H5Attribute.h | 18 +++++++++--------- c++/src/H5CompType.h | 6 +++--- c++/src/H5DaccProp.h | 4 ++-- c++/src/H5DataSet.h | 18 +++++++++--------- c++/src/H5DataSpace.h | 10 +++++----- c++/src/H5DataType.h | 10 +++++----- c++/src/H5DcreatProp.h | 4 ++-- c++/src/H5DxferProp.h | 4 ++-- c++/src/H5EnumType.h | 6 +++--- c++/src/H5Exception.h | 24 ++++++++++++------------ c++/src/H5FaccProp.h | 4 ++-- c++/src/H5FcreatProp.h | 4 ++-- c++/src/H5File.h | 14 +++++++------- c++/src/H5FloatType.h | 6 +++--- c++/src/H5Group.h | 14 +++++++------- c++/src/H5Include.h | 7 ------- c++/src/H5IntType.h | 6 +++--- c++/src/H5LaccProp.h | 4 ++-- c++/src/H5LcreatProp.h | 4 ++-- c++/src/H5Object.h | 6 +++--- c++/src/H5OcreatProp.h | 4 ++-- c++/src/H5PredType.h | 4 ++-- c++/src/H5PropList.h | 10 +++++----- c++/src/H5StrType.h | 6 +++--- c++/src/H5VarLenType.h | 6 +++--- 27 files changed, 103 insertions(+), 110 deletions(-) diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index b93ae4a..29313c4 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -37,7 +37,7 @@ class H5_DLLCPP ArrayType : public DataType { // Returns an ArrayType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const H5_OVERRIDE; + virtual DataType *decode() const override; // Returns the number of dimensions of this array datatype. int getArrayNDims() const; @@ -49,7 +49,7 @@ class H5_DLLCPP ArrayType : public DataType { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("ArrayType"); } @@ -61,7 +61,7 @@ class H5_DLLCPP ArrayType : public DataType { ArrayType(const hid_t existing_id); // Noop destructor - virtual ~ArrayType() H5_OVERRIDE; + virtual ~ArrayType() override; // Default constructor ArrayType(); diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index e00a308..1b5153e 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -58,7 +58,7 @@ class H5_DLLCPP AtomType : public DataType { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("AtomType"); } @@ -68,7 +68,7 @@ class H5_DLLCPP AtomType : public DataType { AtomType(const AtomType &original); // Noop destructor - virtual ~AtomType() H5_OVERRIDE; + virtual ~AtomType() override; #endif // DOXYGEN_SHOULD_SKIP_THIS protected: diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index 71bfa14..47375a5 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -38,7 +38,7 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { Attribute(const hid_t attr_id); // Closes this attribute. - virtual void close() H5_OVERRIDE; + virtual void close() override; // Gets the name of this attribute. ssize_t getName(char *attr_name, size_t buf_size = 0) const; @@ -50,13 +50,13 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { ssize_t getName(size_t buf_size, H5std_string &attr_name) const; // Gets a copy of the dataspace for this attribute. - virtual DataSpace getSpace() const H5_OVERRIDE; + virtual DataSpace getSpace() const override; // Returns the amount of storage size required for this attribute. - virtual hsize_t getStorageSize() const H5_OVERRIDE; + virtual hsize_t getStorageSize() const override; // Returns the in memory size of this attribute's data. - virtual size_t getInMemDataSize() const H5_OVERRIDE; + virtual size_t getInMemDataSize() const override; // Reads data from this attribute. void read(const DataType &mem_type, void *buf) const; @@ -68,21 +68,21 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("Attribute"); } // Gets the attribute id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor: properly terminates access to this attribute. - virtual ~Attribute() H5_OVERRIDE; + virtual ~Attribute() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: // Sets the attribute id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; #endif // DOXYGEN_SHOULD_SKIP_THIS private: @@ -92,7 +92,7 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific // sub-types - virtual hid_t p_get_type() const H5_OVERRIDE; + virtual hid_t p_get_type() const override; // Reads variable or fixed len strings from this attribute. void p_read_variable_len(const DataType &mem_type, H5std_string &strg) const; diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 4424d89..59fd9cf 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -45,7 +45,7 @@ class H5_DLLCPP CompType : public DataType { // Returns a CompType object via DataType* by decoding the binary // object description of this type. - virtual DataType *decode() const H5_OVERRIDE; + virtual DataType *decode() const override; // Returns the type class of the specified member of this compound // datatype. It provides to the user a way of knowing what type @@ -108,13 +108,13 @@ class H5_DLLCPP CompType : public DataType { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("CompType"); } // Noop destructor. - virtual ~CompType() H5_OVERRIDE; + virtual ~CompType() override; private: // Contains common code that is used by the member functions diff --git a/c++/src/H5DaccProp.h b/c++/src/H5DaccProp.h index 398918d..1accbd6 100644 --- a/c++/src/H5DaccProp.h +++ b/c++/src/H5DaccProp.h @@ -38,7 +38,7 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("DSetAccPropList"); } @@ -51,7 +51,7 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList { DSetAccPropList(const hid_t plist_id); // Noop destructor. - virtual ~DSetAccPropList() H5_OVERRIDE; + virtual ~DSetAccPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index d50b2c5..8430f7a 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -28,7 +28,7 @@ namespace H5 { class H5_DLLCPP DataSet : public H5Object, public AbstractDs { public: // Close this dataset. - virtual void close() H5_OVERRIDE; + virtual void close() override; // Extends the dataset with unlimited dimension. void extend(const hsize_t *size) const; @@ -53,16 +53,16 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { haddr_t getOffset() const; // Gets the dataspace of this dataset. - virtual DataSpace getSpace() const H5_OVERRIDE; + virtual DataSpace getSpace() const override; // Determines whether space has been allocated for a dataset. void getSpaceStatus(H5D_space_status_t &status) const; // Returns the amount of storage size required for this dataset. - virtual hsize_t getStorageSize() const H5_OVERRIDE; + virtual hsize_t getStorageSize() const override; // Returns the in memory size of this attribute's data. - virtual size_t getInMemDataSize() const H5_OVERRIDE; + virtual size_t getInMemDataSize() const override; // Returns the number of bytes required to store VL data. hsize_t getVlenBufSize(const DataType &type, const DataSpace &space) const; @@ -100,7 +100,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("DataSet"); } @@ -124,15 +124,15 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { DataSet(const hid_t existing_id); // Gets the dataset id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor: properly terminates access to this dataset. - virtual ~DataSet() H5_OVERRIDE; + virtual ~DataSet() override; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the dataset id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; #endif // DOXYGEN_SHOULD_SKIP_THIS private: @@ -142,7 +142,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific // sub-types - virtual hid_t p_get_type() const H5_OVERRIDE; + virtual hid_t p_get_type() const override; // Reads variable or fixed len strings from this dataset. void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 5583baa..87852a2 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -43,7 +43,7 @@ class H5_DLLCPP DataSpace : public IdComponent { DataSpace &operator=(const DataSpace &rhs); // Closes this dataspace. - virtual void close() H5_OVERRIDE; + virtual void close() override; // Makes copy of an existing dataspace. void copy(const DataSpace &like_space); @@ -115,25 +115,25 @@ class H5_DLLCPP DataSpace : public IdComponent { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("DataSpace"); } // Gets the dataspace id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // Deletes the global constant static void deleteConstants(); // Destructor: properly terminates access to this dataspace. - virtual ~DataSpace() H5_OVERRIDE; + virtual ~DataSpace() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: // Sets the dataspace id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index d696455..7442edc 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -50,7 +50,7 @@ class H5_DLLCPP DataType : public H5Object { // PropList& plist = PropList::DEFAULT); // Closes this datatype. - virtual void close() H5_OVERRIDE; + virtual void close() override; // Copies an existing datatype to this datatype object. void copy(const DataType &like_type); @@ -136,7 +136,7 @@ class H5_DLLCPP DataType : public H5Object { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("DataType"); } @@ -151,10 +151,10 @@ class H5_DLLCPP DataType : public H5Object { bool hasBinaryDesc() const; // Gets the datatype id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor: properly terminates access to this datatype. - virtual ~DataType() H5_OVERRIDE; + virtual ~DataType() override; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -165,7 +165,7 @@ class H5_DLLCPP DataType : public H5Object { hid_t p_decode() const; // Sets the datatype id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; // Opens a datatype and returns the id. hid_t p_opentype(const H5Location &loc, const char *dtype_name) const; diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index b822c25..a2d5ff2 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -128,7 +128,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("DSetCreatPropList"); } @@ -141,7 +141,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { DSetCreatPropList(const hid_t plist_id); // Noop destructor. - virtual ~DSetCreatPropList() H5_OVERRIDE; + virtual ~DSetCreatPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 3925a57..24f8d70 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -100,7 +100,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("DSetMemXferPropList"); } @@ -113,7 +113,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { DSetMemXferPropList(const hid_t plist_id); // Noop destructor - virtual ~DSetMemXferPropList() H5_OVERRIDE; + virtual ~DSetMemXferPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 2501e4b..f9091ca 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -41,7 +41,7 @@ class H5_DLLCPP EnumType : public DataType { // Returns an EnumType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const H5_OVERRIDE; + virtual DataType *decode() const override; // Returns the number of members in this enumeration datatype. int getNmembers() const; @@ -68,7 +68,7 @@ class H5_DLLCPP EnumType : public DataType { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("EnumType"); } @@ -82,7 +82,7 @@ class H5_DLLCPP EnumType : public DataType { // Copy constructor: same as the original EnumType. EnumType(const EnumType &original); - virtual ~EnumType() H5_OVERRIDE; + virtual ~EnumType() override; }; // end of EnumType } // namespace H5 diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 9970d22..e22f74b 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -90,84 +90,84 @@ class H5_DLLCPP FileIException : public Exception { public: FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); FileIException(); - virtual ~FileIException() throw() H5_OVERRIDE; + virtual ~FileIException() throw() override; }; class H5_DLLCPP GroupIException : public Exception { public: GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); GroupIException(); - virtual ~GroupIException() throw() H5_OVERRIDE; + virtual ~GroupIException() throw() override; }; class H5_DLLCPP DataSpaceIException : public Exception { public: DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSpaceIException(); - virtual ~DataSpaceIException() throw() H5_OVERRIDE; + virtual ~DataSpaceIException() throw() override; }; class H5_DLLCPP DataTypeIException : public Exception { public: DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataTypeIException(); - virtual ~DataTypeIException() throw() H5_OVERRIDE; + virtual ~DataTypeIException() throw() override; }; class H5_DLLCPP ObjHeaderIException : public Exception { public: ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ObjHeaderIException(); - virtual ~ObjHeaderIException() throw() H5_OVERRIDE; + virtual ~ObjHeaderIException() throw() override; }; class H5_DLLCPP PropListIException : public Exception { public: PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); PropListIException(); - virtual ~PropListIException() throw() H5_OVERRIDE; + virtual ~PropListIException() throw() override; }; class H5_DLLCPP DataSetIException : public Exception { public: DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSetIException(); - virtual ~DataSetIException() throw() H5_OVERRIDE; + virtual ~DataSetIException() throw() override; }; class H5_DLLCPP AttributeIException : public Exception { public: AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); AttributeIException(); - virtual ~AttributeIException() throw() H5_OVERRIDE; + virtual ~AttributeIException() throw() override; }; class H5_DLLCPP ReferenceException : public Exception { public: ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ReferenceException(); - virtual ~ReferenceException() throw() H5_OVERRIDE; + virtual ~ReferenceException() throw() override; }; class H5_DLLCPP LibraryIException : public Exception { public: LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LibraryIException(); - virtual ~LibraryIException() throw() H5_OVERRIDE; + virtual ~LibraryIException() throw() override; }; class H5_DLLCPP LocationException : public Exception { public: LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LocationException(); - virtual ~LocationException() throw() H5_OVERRIDE; + virtual ~LocationException() throw() override; }; class H5_DLLCPP IdComponentException : public Exception { public: IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); IdComponentException(); - virtual ~IdComponentException() throw() H5_OVERRIDE; + virtual ~IdComponentException() throw() override; }; // end of IdComponentException } // namespace H5 diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 53c7799..7d998e2 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -137,7 +137,7 @@ class H5_DLLCPP FileAccPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("FileAccPropList"); } @@ -150,7 +150,7 @@ class H5_DLLCPP FileAccPropList : public PropList { FileAccPropList(const hid_t plist_id); // Noop destructor - virtual ~FileAccPropList() H5_OVERRIDE; + virtual ~FileAccPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 65daf8f..ba0c2e6 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -78,7 +78,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("FileCreatPropList"); } @@ -91,7 +91,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { FileCreatPropList(const hid_t plist_id); // Noop destructor - virtual ~FileCreatPropList() H5_OVERRIDE; + virtual ~FileCreatPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5File.h b/c++/src/H5File.h index bdd7b84..daed073 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -39,7 +39,7 @@ class H5_DLLCPP H5File : public Group { const FileAccPropList &access_plist = FileAccPropList::DEFAULT); // Close this file. - virtual void close() H5_OVERRIDE; + virtual void close() override; // Gets a copy of the access property list of this file. FileAccPropList getAccessPlist() const; @@ -96,16 +96,16 @@ class H5_DLLCPP H5File : public Group { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("H5File"); } // Throw file exception. - virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE; + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const override; // For CommonFG to get the file id. - virtual hid_t getLocId() const H5_OVERRIDE; + virtual hid_t getLocId() const override; // Default constructor H5File(); @@ -114,15 +114,15 @@ class H5_DLLCPP H5File : public Group { H5File(const H5File &original); // Gets the HDF5 file id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // H5File destructor. - virtual ~H5File() H5_OVERRIDE; + virtual ~H5File() override; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the HDF5 file id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; #endif // DOXYGEN_SHOULD_SKIP_THIS private: diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index e8df757..387520f 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -36,7 +36,7 @@ class H5_DLLCPP FloatType : public AtomType { // Returns an FloatType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const H5_OVERRIDE; + virtual DataType *decode() const override; // Retrieves the exponent bias of a floating-point type. size_t getEbias() const; @@ -64,7 +64,7 @@ class H5_DLLCPP FloatType : public AtomType { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("FloatType"); } @@ -79,7 +79,7 @@ class H5_DLLCPP FloatType : public AtomType { FloatType(const FloatType &original); // Noop destructor. - virtual ~FloatType() H5_OVERRIDE; + virtual ~FloatType() override; }; // end of FloatType } // namespace H5 diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index b5f7e51..e72d65c 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -24,20 +24,20 @@ namespace H5 { class H5_DLLCPP Group : public H5Object, public CommonFG { public: // Close this group. - virtual void close() H5_OVERRIDE; + virtual void close() override; ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("Group"); } // Throw group exception. - virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE; + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const override; // for CommonFG to get the file id. - virtual hid_t getLocId() const H5_OVERRIDE; + virtual hid_t getLocId() const override; // Creates a group by way of dereference. Group(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT, @@ -63,10 +63,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { Group(const Group &original); // Gets the group id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor - virtual ~Group() H5_OVERRIDE; + virtual ~Group() override; // Creates a copy of an existing group using its id. Group(const hid_t group_id); @@ -74,7 +74,7 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the group id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; #endif // DOXYGEN_SHOULD_SKIP_THIS private: diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index 0dc930d..e662d90 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -24,10 +24,3 @@ * magic number as prefix and checksum as suffix for all chunks. */ #define H5O_VERSION_2 2 - -// Define H5_OVERRIDE to override for C++11. -#if defined(__cplusplus) && (201103L <= __cplusplus) -#define H5_OVERRIDE override -#else -#define H5_OVERRIDE -#endif diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index f0f30ac..ec3dd19 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -36,7 +36,7 @@ class H5_DLLCPP IntType : public AtomType { // Returns an IntType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const H5_OVERRIDE; + virtual DataType *decode() const override; // Retrieves the sign type for an integer type H5T_sign_t getSign() const; @@ -46,7 +46,7 @@ class H5_DLLCPP IntType : public AtomType { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("IntType"); } @@ -61,7 +61,7 @@ class H5_DLLCPP IntType : public AtomType { IntType(const IntType &original); // Noop destructor. - virtual ~IntType() H5_OVERRIDE; + virtual ~IntType() override; }; // end of IntType } // namespace H5 diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h index 65a9673..accc7cd 100644 --- a/c++/src/H5LaccProp.h +++ b/c++/src/H5LaccProp.h @@ -32,7 +32,7 @@ class H5_DLLCPP LinkAccPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("LinkAccPropList"); } @@ -52,7 +52,7 @@ class H5_DLLCPP LinkAccPropList : public PropList { size_t getNumLinks() const; // Noop destructor - virtual ~LinkAccPropList() H5_OVERRIDE; + virtual ~LinkAccPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h index c0c66a4..5570dbc 100644 --- a/c++/src/H5LcreatProp.h +++ b/c++/src/H5LcreatProp.h @@ -32,7 +32,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("LinkCreatPropList"); } @@ -59,7 +59,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList { H5T_cset_t getCharEncoding() const; // Noop destructor - virtual ~LinkCreatPropList() H5_OVERRIDE; + virtual ~LinkCreatPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index bc2f14a..9e5a541 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -106,7 +106,7 @@ class H5_DLLCPP H5Object : public H5Location { void removeAttr(const H5std_string &name) const; // Returns an identifier. - virtual hid_t getId() const H5_OVERRIDE = 0; + virtual hid_t getId() const override = 0; // Gets the name of this HDF5 object, i.e., Group, DataSet, or // DataType. @@ -122,10 +122,10 @@ class H5_DLLCPP H5Object : public H5Location { // Sets the identifier of this object to a new value. - this one // doesn't increment reference count - virtual void p_setId(const hid_t new_id) H5_OVERRIDE = 0; + virtual void p_setId(const hid_t new_id) override = 0; // Noop destructor. - virtual ~H5Object() H5_OVERRIDE; + virtual ~H5Object() override; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h index 0aa825b..5e2bf49 100644 --- a/c++/src/H5OcreatProp.h +++ b/c++/src/H5OcreatProp.h @@ -44,7 +44,7 @@ class H5_DLLCPP ObjCreatPropList : public PropList { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("ObjCreatPropList"); } @@ -57,7 +57,7 @@ class H5_DLLCPP ObjCreatPropList : public PropList { ObjCreatPropList(const hid_t plist_id); // Noop destructor - virtual ~ObjCreatPropList() H5_OVERRIDE; + virtual ~ObjCreatPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index c4ac6b2..0ec5ddd 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -29,7 +29,7 @@ class H5_DLLCPP PredType : public AtomType { public: ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("PredType"); } @@ -42,7 +42,7 @@ class H5_DLLCPP PredType : public AtomType { PredType(const PredType &original); // Noop destructor - virtual ~PredType() H5_OVERRIDE; + virtual ~PredType() override; /*! \brief This dummy function do not inherit from DataType - it will throw a DataTypeIException if invoked. diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 2df326b..5320699 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -38,7 +38,7 @@ class H5_DLLCPP PropList : public IdComponent { bool operator==(const PropList &rhs) const; // Close this property list. - virtual void close() H5_OVERRIDE; + virtual void close() override; // Close a property list class. void closeClass() const; @@ -102,7 +102,7 @@ class H5_DLLCPP PropList : public IdComponent { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("PropList"); } @@ -114,10 +114,10 @@ class H5_DLLCPP PropList : public IdComponent { PropList(const PropList &original); // Gets the property list id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor: properly terminates access to this property list. - virtual ~PropList() H5_OVERRIDE; + virtual ~PropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -128,7 +128,7 @@ class H5_DLLCPP PropList : public IdComponent { hid_t id; // HDF5 property list id // Sets the property list id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; private: static PropList *DEFAULT_; diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index 3e4013a..2dc3bdc 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -42,7 +42,7 @@ class H5_DLLCPP StrType : public AtomType { // Returns an StrType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const H5_OVERRIDE; + virtual DataType *decode() const override; // Retrieves the character set type of this string datatype. H5T_cset_t getCset() const; @@ -58,7 +58,7 @@ class H5_DLLCPP StrType : public AtomType { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("StrType"); } @@ -73,7 +73,7 @@ class H5_DLLCPP StrType : public AtomType { StrType(const StrType &original); // Noop destructor. - virtual ~StrType() H5_OVERRIDE; + virtual ~StrType() override; }; // end of StrType } // namespace H5 diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index 583b9cd..a8d0504 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -33,11 +33,11 @@ class H5_DLLCPP VarLenType : public DataType { // Returns an VarLenType object via DataType* by decoding the // binary object description of this type. - virtual DataType *decode() const H5_OVERRIDE; + virtual DataType *decode() const override; ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("VarLenType"); } @@ -53,7 +53,7 @@ class H5_DLLCPP VarLenType : public DataType { VarLenType(const H5Location &loc, const H5std_string &name); // Noop destructor - virtual ~VarLenType() H5_OVERRIDE; + virtual ~VarLenType() override; // Default constructor VarLenType(); -- cgit v0.12 From e25fa1c619017814718a4ae7cae92fb418aa5445 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:28:40 -0700 Subject: Cleans up some POSIX header bits in H5private.h (#783) --- src/H5private.h | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index 290d873..ce6681a 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -26,21 +26,6 @@ #include "H5public.h" /* Include Public Definitions */ -/* include the pthread header */ -#ifdef H5_HAVE_THREADSAFE -#ifdef H5_HAVE_WIN32_API -#ifndef H5_HAVE_WIN_THREADS -#ifdef H5_HAVE_PTHREAD_H -#include -#endif /* H5_HAVE_PTHREAD_H */ -#endif /* H5_HAVE_WIN_THREADS */ -#else /* H5_HAVE_WIN32_API */ -#ifdef H5_HAVE_PTHREAD_H -#include -#endif /* H5_HAVE_PTHREAD_H */ -#endif /* H5_HAVE_WIN32_API */ -#endif /* H5_HAVE_THREADSAFE */ - #include #include #include @@ -49,29 +34,28 @@ #include #include #include +#include #include #include #include -/* - * If _POSIX_VERSION is defined in unistd.h then this system is Posix.1 - * compliant. Otherwise all bets are off. - */ +/* POSIX headers */ #ifdef H5_HAVE_UNISTD_H -#include +#include #include -#endif -#ifdef _POSIX_VERSION +#include #include -#include #endif -#include +/* Include the Pthreads header, if necessary */ +#if defined(H5_HAVE_THREADSAFE) && defined(H5_HAVE_PTHREAD_H) +#include +#endif /* - * The `struct stat' data type for stat() and fstat(). This is a Posix file - * but often apears on non-Posix systems also. The `struct stat' is required - * for hdf5 to compile, although only a few fields are actually used. + * The `struct stat' data type for stat() and fstat(). This is a POSIX file + * but often apears on non-POSIX systems also. The `struct stat' is required + * for HDF5 to compile, although only a few fields are actually used. */ #ifdef H5_HAVE_SYS_STAT_H #include -- cgit v0.12 From 82c8013a2db4d9a105b5079542526c0bb6c001bf Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:29:52 -0700 Subject: Removes outdated checks for ways inline might be defined (#781) These are obsolete now that we require C99. --- config/cmake/H5pubconf.h.in | 9 --------- config/cmake_ext_mod/ConfigureChecks.cmake | 8 -------- config/cmake_ext_mod/HDFTests.c | 17 ----------------- configure.ac | 21 --------------------- 4 files changed, 55 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 8201fc5..2e80023 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -188,9 +188,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_HDFS_H @H5_HAVE_HDFS_H@ -/* Define if the compiler understands inline */ -#cmakedefine H5_HAVE_INLINE @H5_HAVE_INLINE@ - /* Define if parallel library will contain instrumentation to detect correct optimization operation */ #cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@ @@ -432,12 +429,6 @@ /* Define to 1 if you have the `_scrsize' function. */ #cmakedefine H5_HAVE__SCRSIZE @H5_HAVE__SCRSIZE@ -/* Define if the compiler understands __inline */ -#cmakedefine H5_HAVE___INLINE @H5_HAVE___INLINE@ - -/* Define if the compiler understands __inline__ */ -#cmakedefine H5_HAVE___INLINE__ @H5_HAVE___INLINE__@ - /* Define if the library will ignore file locks when disabled */ #cmakedefine H5_IGNORE_DISABLED_FILE_LOCKS @H5_IGNORE_DISABLED_FILE_LOCKS@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index d713c7c..81dcb2d 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -592,14 +592,6 @@ if (WINDOWS) endif () #----------------------------------------------------------------------------- -# Determine how 'inline' is used -#----------------------------------------------------------------------------- -foreach (inline_test inline __inline__ __inline) - string (TOUPPER ${inline_test} INLINE_TEST_MACRO) - HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO}) -endforeach () - -#----------------------------------------------------------------------------- # Check how to print a Long Long integer #----------------------------------------------------------------------------- if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index b8a6af1..365931b 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -331,20 +331,3 @@ int main () } #endif /* HAVE_IOEO */ - -#if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) -#ifndef __cplusplus -#if defined( HAVE_INLINE ) -# define INLINE_KW inline -#elif defined ( HAVE___INLINE__ ) -# define INLINE_KW __inline__ -#elif defined ( HAVE___INLINE ) -# define INLINE_KW __inline -#endif /* HAVE_INLINE */ -typedef int foo_t; -static INLINE_KW foo_t static_foo () { return 0; } -INLINE_KW foo_t foo () {return 0; } -int main(void) { return 0; } -#endif /* __cplusplus */ -#endif /* defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) */ - diff --git a/configure.ac b/configure.ac index cb8f97a..f9b823a 100644 --- a/configure.ac +++ b/configure.ac @@ -2037,27 +2037,6 @@ AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) ## AC_C_CONST -AC_MSG_CHECKING([if the compiler understands __inline__]) -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([[static __inline__ void f(void){return;};]])], - [AC_DEFINE([HAVE___INLINE__], [1], [Define if the compiler understands __inline__]) AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])] -) - -AC_MSG_CHECKING([if the compiler understands __inline]) -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([[static __inline void f(void){return;};]])], - [AC_DEFINE([HAVE___INLINE], [1], [Define if the compiler understands __inline]) AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])] -) - -AC_MSG_CHECKING([if the compiler understands inline]) -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([[static inline void f(void){return;};]])], - [AC_DEFINE([HAVE_INLINE], [1], [Define if the compiler understands inline]) AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])] -) - AC_MSG_CHECKING([for __attribute__ extension]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int __attribute__((unused)) x]])], [AC_DEFINE([HAVE_ATTRIBUTE], [1], -- cgit v0.12 From 3d4481c2920b7b983a8d791a266cd2bc9c96e846 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:31:32 -0700 Subject: Removes checks for system(), which is C89/90 (#782) --- config/cmake/H5pubconf.h.in | 3 --- config/cmake_ext_mod/ConfigureChecks.cmake | 2 -- configure.ac | 2 +- tools/test/perform/iopipe.c | 2 -- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 2e80023..fd52c24 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -352,9 +352,6 @@ /* Define to 1 if you have the `symlink' function. */ #cmakedefine H5_HAVE_SYMLINK @H5_HAVE_SYMLINK@ -/* Define to 1 if you have the `system' function. */ -#cmakedefine H5_HAVE_SYSTEM @H5_HAVE_SYSTEM@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_SYS_FILE_H @H5_HAVE_SYS_FILE_H@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 81dcb2d..7e1385a 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -72,7 +72,6 @@ if (WINDOWS) set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (${HDF_PREFIX}_HAVE_LIBM 1) set (${HDF_PREFIX}_HAVE_STRDUP 1) - set (${HDF_PREFIX}_HAVE_SYSTEM 1) set (${HDF_PREFIX}_HAVE_LONGJMP 1) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) @@ -494,7 +493,6 @@ CHECK_FUNCTION_EXISTS (sigprocmask ${HDF_PREFIX}_HAVE_SIGPROCMASK) CHECK_FUNCTION_EXISTS (srandom ${HDF_PREFIX}_HAVE_SRANDOM) CHECK_FUNCTION_EXISTS (strdup ${HDF_PREFIX}_HAVE_STRDUP) CHECK_FUNCTION_EXISTS (symlink ${HDF_PREFIX}_HAVE_SYMLINK) -CHECK_FUNCTION_EXISTS (system ${HDF_PREFIX}_HAVE_SYSTEM) CHECK_FUNCTION_EXISTS (tmpfile ${HDF_PREFIX}_HAVE_TMPFILE) CHECK_FUNCTION_EXISTS (asprintf ${HDF_PREFIX}_HAVE_ASPRINTF) diff --git a/configure.ac b/configure.ac index f9b823a..b5f4fe1 100644 --- a/configure.ac +++ b/configure.ac @@ -2029,7 +2029,7 @@ AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork frexpf]) AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) -AC_CHECK_FUNCS([srandom strdup symlink system]) +AC_CHECK_FUNCS([srandom strdup symlink]) AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) ## ---------------------------------------------------------------------- diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index d0db06a..2aa9e25 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -95,7 +95,6 @@ print_stats(const char *prefix, static void synchronize(void) { -#ifdef H5_HAVE_SYSTEM #if defined(H5_HAVE_WIN32_API) && !defined(__CYGWIN__) _flushall(); #else @@ -107,7 +106,6 @@ synchronize(void) status = HDsystem("df >/dev/null"); HDassert(status >= 0); #endif -#endif } /*------------------------------------------------------------------------- -- cgit v0.12 From cc88fe8fafa0a522ba583bf75b2fe9a15688db9c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:42:02 -0700 Subject: Removes C++ dependency on H5private.h (#774) * Removes C++ dependency on H5private.h Most C API calls have been removed, aside from a few uses of free, where we just dropped the 'HD'. A couple of H5_ATTR_UNUSED macros were also replaced with (void) statements. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/src/H5Attribute.cpp | 14 +++++++------- c++/src/H5CommonFG.cpp | 1 - c++/src/H5DataSet.cpp | 7 +++---- c++/src/H5DataType.cpp | 8 ++++---- c++/src/H5DxferProp.cpp | 4 +--- c++/src/H5EnumType.cpp | 4 +--- c++/src/H5IdComponent.cpp | 4 +--- c++/src/H5Location.cpp | 17 +++++++---------- c++/src/H5Object.cpp | 24 ++++++++++++++---------- c++/src/H5PredType.cpp | 7 +++++-- c++/src/H5PropList.cpp | 4 +--- c++/src/H5StrType.cpp | 6 ++++-- 12 files changed, 48 insertions(+), 52 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 0e37c2b..954222c 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -14,7 +14,6 @@ #include #include -#include "H5private.h" // for HDfree #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -313,7 +312,7 @@ Attribute::getName() const H5std_string attr_name; // attribute name to return // Preliminary call to get the size of the attribute name - ssize_t name_size = H5Aget_name(id, static_cast(0), NULL); + ssize_t name_size = H5Aget_name(id, 0, NULL); // If H5Aget_name failed, throw exception if (name_size < 0) { @@ -324,8 +323,8 @@ Attribute::getName() const } // Attribute's name exists, retrieve it else if (name_size > 0) { - char *name_C = new char[name_size + 1]; // temporary C-string - HDmemset(name_C, 0, name_size + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[name_size + 1](); // Use overloaded function name_size = getName(name_C, name_size + 1); @@ -336,6 +335,7 @@ Attribute::getName() const // Clean up resource delete[] name_C; } + // Return attribute's name return (attr_name); } @@ -393,8 +393,8 @@ Attribute::getName(H5std_string &attr_name, size_t len) const } // If length is provided, get that number of characters in name else { - char *name_C = new char[len + 1]; // temporary C-string - HDmemset(name_C, 0, len + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[len + 1](); // Use overloaded function name_size = getName(name_C, len + 1); @@ -551,7 +551,7 @@ Attribute::p_read_variable_len(const DataType &mem_type, H5std_string &strg) con // Get string from the C char* and release resource allocated by C API strg = strg_C; - HDfree(strg_C); + free(strg_C); } #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index fb602d9..8401b9c 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -13,7 +13,6 @@ #include -#include "H5private.h" // for HDstrcpy #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 47031db..ce56e30 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -14,7 +14,6 @@ #include #include -#include "H5private.h" // for HDfree #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -717,8 +716,8 @@ DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, con // If there is data, allocate buffer and read it. if (data_size > 0) { - char *strg_C = new char[data_size + 1]; - HDmemset(strg_C, 0, data_size + 1); // clear buffer + // Create buffer for C string + char *strg_C = new char[data_size + 1](); herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C); @@ -759,7 +758,7 @@ DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, // Get string from the C char* and release resource allocated by C API strg = strg_C; - HDfree(strg_C); + free(strg_C); } #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index cdf28cf..b00a526 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -32,7 +32,6 @@ #include "H5DataType.h" #include "H5AtomType.h" #include "H5PredType.h" -#include "H5private.h" #include "H5AbstractDs.h" #include "H5DataSet.h" #include "H5Attribute.h" @@ -316,8 +315,9 @@ DataType::encode() // Allocate buffer and call C function again to encode if (buf_size > 0) { - encoded_buf = static_cast(HDcalloc(1, buf_size)); - ret_value = H5Tencode(id, encoded_buf, &buf_size); + encoded_buf = new unsigned char[buf_size](); + + ret_value = H5Tencode(id, encoded_buf, &buf_size); if (ret_value < 0) { throw DataTypeIException("DataType::encode", "H5Tencode failed"); } @@ -970,7 +970,7 @@ DataType::close() // Free and reset buffer of encoded object description if it's been used if (encoded_buf != NULL) { - HDfree(encoded_buf); + delete[] encoded_buf; buf_size = 0; } } diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 40faac2..1fd6878 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -13,7 +13,6 @@ #include -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -324,8 +323,7 @@ DSetMemXferPropList::getDataTransform() const // If expression exists, calls C routine again to get it else if (exp_len > 0) { // Temporary buffer for char* expression - char *exp_C = new char[exp_len + 1]; - HDmemset(exp_C, 0, exp_len + 1); // clear buffer + char *exp_C = new char[exp_len + 1](); // Used overloaded function exp_len = getDataTransform(exp_C, exp_len + 1); diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 6c7b533..2073365 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -13,7 +13,6 @@ #include -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -219,8 +218,7 @@ EnumType::insert(const H5std_string &name, void *value) const H5std_string EnumType::nameOf(void *value, size_t size) const { - char *name_C = new char[size + 1]; // temporary C-string for C API - HDmemset(name_C, 0, size + 1); // clear buffer + char *name_C = new char[size + 1](); // temporary C-string for C API // Calls C routine H5Tenum_nameof to get the name of the specified enum type herr_t ret_value = H5Tenum_nameof(id, value, name_C, size); diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 18bcbd3..d546d32 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -13,7 +13,6 @@ #include -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5Library.h" @@ -399,8 +398,7 @@ IdComponent::p_get_file_name() const } // Call H5Fget_name again to get the actual file name - char *name_C = new char[name_size + 1]; // temporary C-string for C API - HDmemset(name_C, 0, name_size + 1); // clear buffer + char *name_C = new char[name_size + 1](); name_size = H5Fget_name(temp_id, name_C, name_size + 1); diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index bb754a2..eb8dd4c 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -15,7 +15,6 @@ #include using namespace std; -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -367,8 +366,7 @@ H5Location::getComment(const char *name, size_t buf_size) const tmp_len = comment_len; // Temporary buffer for char* comment - char *comment_C = new char[tmp_len + 1]; - HDmemset(comment_C, 0, tmp_len + 1); // clear buffer + char *comment_C = new char[tmp_len + 1](); // Used overloaded function ssize_t temp_len = getComment(name, tmp_len + 1, comment_C); @@ -1835,8 +1833,8 @@ H5Location::getLinkval(const char *name, size_t size) const // if link has value, retrieve the value, otherwise, return null string if (val_size > 0) { - value_C = new char[val_size + 1]; // temporary C-string for C API - HDmemset(value_C, 0, val_size + 1); // clear buffer + // Create buffer for C string + value_C = new char[val_size + 1](); ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT); if (ret_value < 0) { @@ -2046,9 +2044,8 @@ H5Location::getObjnameByIdx(hsize_t idx) const if (name_len < 0) throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - // now, allocate C buffer to get the name - char *name_C = new char[name_len + 1]; - HDmemset(name_C, 0, name_len + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[name_len + 1](); name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len + 1, H5P_DEFAULT); @@ -2102,8 +2099,8 @@ H5Location::getObjnameByIdx(hsize_t idx, char *name, size_t size) const ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const { - char *name_C = new char[size + 1]; // temporary C-string for object name - HDmemset(name_C, 0, size + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[size + 1](); // call overloaded function to get the name ssize_t name_len = getObjnameByIdx(idx, name_C, size + 1); diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 71109d3..cb803af 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -13,7 +13,6 @@ #include -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -45,9 +44,12 @@ namespace H5 { extern "C" { static herr_t -userAttrOpWrpr(H5_ATTR_UNUSED hid_t loc_id, const char *attr_name, H5_ATTR_UNUSED const H5A_info_t *ainfo, - void *op_data) +userAttrOpWrpr(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data) { + // Unused + (void)loc_id; + (void)ainfo; + H5std_string s_attr_name = H5std_string(attr_name); UserData4Aiterate *myData = reinterpret_cast(op_data); myData->op(*myData->location, s_attr_name, myData->opData); @@ -57,9 +59,11 @@ userAttrOpWrpr(H5_ATTR_UNUSED hid_t loc_id, const char *attr_name, H5_ATTR_UNUSE // userVisitOpWrpr interfaces between the user's function and the // C library function H5Ovisit3 static herr_t -userVisitOpWrpr(H5_ATTR_UNUSED hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info, - void *op_data) +userVisitOpWrpr(hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info, void *op_data) { + // Unused + (void)obj_id; + H5std_string s_attr_name = H5std_string(attr_name); UserData4Visit *myData = reinterpret_cast(op_data); int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData); @@ -482,7 +486,7 @@ H5Object::getObjName() const H5std_string obj_name; // object name to return // Preliminary call to get the size of the object name - ssize_t name_size = H5Iget_name(getId(), NULL, static_cast(0)); + ssize_t name_size = H5Iget_name(getId(), NULL, 0); // If H5Iget_name failed, throw exception if (name_size < 0) { @@ -493,8 +497,8 @@ H5Object::getObjName() const } // Object's name exists, retrieve it else if (name_size > 0) { - char *name_C = new char[name_size + 1]; // temporary C-string - HDmemset(name_C, 0, name_size + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[name_size + 1](); // Use overloaded function name_size = getObjName(name_C, name_size + 1); @@ -534,8 +538,8 @@ H5Object::getObjName(H5std_string &obj_name, size_t len) const } // If length is provided, get that number of characters in name else { - char *name_C = new char[len + 1]; // temporary C-string - HDmemset(name_C, 0, len + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[len + 1](); // Use overloaded function name_size = getObjName(name_C, len + 1); diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 9e67968..a932f54 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -27,7 +27,6 @@ #include "H5DataType.h" #include "H5AtomType.h" #include "H5PredType.h" -#include "H5private.h" namespace H5 { @@ -90,8 +89,12 @@ PredType::operator=(const PredType &rhs) // These dummy functions do not inherit from DataType - they'll // throw an DataTypeIException if invoked. void -PredType::commit(H5_ATTR_UNUSED H5Location &loc, H5_ATTR_UNUSED const char *name) +PredType::commit(H5Location &loc, const char *name) { + // Unused + (void)loc; + (void)name; + throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!"); } diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 46e4931..7dca716 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -15,7 +15,6 @@ #include -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -458,8 +457,7 @@ PropList::getProperty(const char *name) const size_t size = getPropSize(name); // Allocate buffer then get the property - char *prop_strg_C = new char[size + 1]; // temporary C-string for C API - HDmemset(prop_strg_C, 0, size + 1); // clear buffer + char *prop_strg_C = new char[size + 1](); herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index 5df48f3..57bb2c9 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -32,7 +32,6 @@ #include "H5StrType.h" #include "H5DataSet.h" #include "H5PredType.h" -#include "H5private.h" namespace H5 { @@ -105,8 +104,11 @@ StrType::StrType(const PredType &pred_type, const size_t &size) : AtomType() // This constructor replaced the previous one. // Programmer Binh-Minh Ribler - Nov 28, 2005 //-------------------------------------------------------------------------- -StrType::StrType(H5_ATTR_UNUSED const int dummy, const size_t &size) : AtomType() +StrType::StrType(const int dummy, const size_t &size) : AtomType() { + // Unused + (void)dummy; + // use DataType::copy to make a copy of the string predefined type // then set its length copy(PredType::C_S1); -- cgit v0.12 From d79c650a5ed08c5b16203f7c6a40809eed830de7 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 23 Jun 2021 12:08:04 -0700 Subject: Further simplifies Autotools type size checks (#789) Also fixes an issue where clock_gettime and difftime are not detected due to earlier simplifications of this code. --- configure.ac | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index b5f4fe1..cfd9d0c 100644 --- a/configure.ac +++ b/configure.ac @@ -1351,16 +1351,6 @@ CFLAGS="$H5_CFLAGS $AM_CFLAGS $CFLAGS" ## Checkpoint the cache AC_CACHE_SAVE -## Write the confdefs.h header for checking sizes -cat >>confdefs.h <<\EOF -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include -EOF - AC_CHECK_SIZEOF( [int8_t]) AC_CHECK_SIZEOF( [uint8_t]) AC_CHECK_SIZEOF( [int_least8_t]) @@ -1389,12 +1379,12 @@ AC_CHECK_SIZEOF([uint_least64_t]) AC_CHECK_SIZEOF( [int_fast64_t]) AC_CHECK_SIZEOF( [uint_fast64_t]) -AC_CHECK_SIZEOF([bool]) +AC_CHECK_SIZEOF([bool], [], [#include ]) AC_CHECK_SIZEOF([off_t]) AC_CHECK_SIZEOF([ptrdiff_t]) AC_CHECK_SIZEOF([size_t]) AC_CHECK_SIZEOF([ssize_t]) -AC_CHECK_SIZEOF([time_t]) +AC_CHECK_SIZEOF([time_t], [], [#include ]) ## Checkpoint the cache AC_CACHE_SAVE -- cgit v0.12 From a9fb4a7ecd1037d17085d7e97eb9a7eab0384bc3 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 23 Jun 2021 14:11:07 -0500 Subject: Release Note (#784) * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. * Flag cleanup and fix typos * Add comment * Correct VAR used to find configure time file * Set the path correctly * Update missing release note info. * Update code owners * Correct JIRA note * add known problem. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- release_docs/RELEASE.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index e98a8c6..1e69f54 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1434,6 +1434,9 @@ Known Problems CPP ptable test fails on both VS2017 and VS2019 with Intel compiler, JIRA issue: HDFFV-10628. This test will pass with VS2015 with Intel compiler. + The subsetting option in ph5diff currently will fail and should be avoided. + The subsetting option works correctly in serial h5diff. + Known problems in previous releases can be found in the HISTORY*.txt files in the HDF5 source. Please report any new problems found to help@hdfgroup.org. -- cgit v0.12 From 9b28f3e5d5f38b34f685aab944283d82f8a4f1fe Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 23 Jun 2021 13:14:54 -0700 Subject: Normalization of CMake H5pubconf.h with Autotools (#791) Mostly just moving things around and changing the comments to keep the delta small. The only symbol change is that for curl/curl.h which I changed to H5_HAVE_CURL_CURL_H to match the Autotools. This symbol is not used in the library and is just an artifact of the checks. --- config/cmake/H5pubconf.h.in | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index fd52c24..107fe57 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -32,6 +32,10 @@ /* Define if dev_t is a scalar */ #cmakedefine H5_DEV_T_IS_SCALAR @H5_DEV_T_IS_SCALAR@ +/* Define if your system is IBM ppc64le and cannot convert some long double + values correctly. */ +#cmakedefine H5_DISABLE_SOME_LDOUBLE_CONV @H5_DISABLE_SOME_LDOUBLE_CONV@ + /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ #cmakedefine H5_FC_DUMMY_MAIN @H5_FC_DUMMY_MAIN@ @@ -108,7 +112,7 @@ #cmakedefine H5_HAVE_CODESTACK @H5_HAVE_CODESTACK@ /* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_CURL_H @H5_HAVE_CURL_H@ +#cmakedefine H5_HAVE_CURL_CURL_H @H5_HAVE_CURL_H@ /* Define if Darwin or Mac OS X */ #cmakedefine H5_HAVE_DARWIN @H5_HAVE_DARWIN@ @@ -325,7 +329,7 @@ /* Define to 1 if you have the `stat64' function. */ #cmakedefine H5_HAVE_STAT64 @H5_HAVE_STAT64@ -/* Define if `struct stat' has the `st_blocks' field */ +/* Define if struct stat has the st_blocks field */ #cmakedefine H5_HAVE_STAT_ST_BLOCKS @H5_HAVE_STAT_ST_BLOCKS@ /* Define to 1 if you have the header file. */ @@ -448,9 +452,6 @@ with special algorithm. */ #cmakedefine H5_LONG_TO_LDOUBLE_SPECIAL @H5_LONG_TO_LDOUBLE_SPECIAL@ -/* Define if your system is power6 and cannot convert some long double values. */ -#cmakedefine H5_DISABLE_SOME_LDOUBLE_CONV @H5_DISABLE_SOME_LDOUBLE_CONV@ - /* Define to the sub-directory where libtool stores uninstalled libraries. */ #cmakedefine H5_LT_OBJDIR @H5_LT_OBJDIR@ @@ -666,12 +667,6 @@ /* Define to 1 if you can safely include both and . */ #cmakedefine H5_TIME_WITH_SYS_TIME @H5_TIME_WITH_SYS_TIME@ -/* Define using v1.6 public API symbols by default */ -#cmakedefine H5_USE_16_API_DEFAULT @H5_USE_16_API_DEFAULT@ - -/* Define using v1.8 public API symbols by default */ -#cmakedefine H5_USE_18_API_DEFAULT @H5_USE_18_API_DEFAULT@ - /* Define using v1.10 public API symbols by default */ #cmakedefine H5_USE_110_API_DEFAULT @H5_USE_110_API_DEFAULT@ @@ -681,6 +676,12 @@ /* Define using v1.14 public API symbols by default */ #cmakedefine H5_USE_114_API_DEFAULT @H5_USE_114_API_DEFAULT@ +/* Define using v1.6 public API symbols by default */ +#cmakedefine H5_USE_16_API_DEFAULT @H5_USE_16_API_DEFAULT@ + +/* Define using v1.8 public API symbols by default */ +#cmakedefine H5_USE_18_API_DEFAULT @H5_USE_18_API_DEFAULT@ + /* Define if the library will use file locking */ #cmakedefine H5_USE_FILE_LOCKING @H5_USE_FILE_LOCKING@ -- cgit v0.12 From 782e8826b73309aeed5916751d6156570740a778 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 23 Jun 2021 17:08:55 -0500 Subject: Fix tools test (#794) * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. * Flag cleanup and fix typos * Add comment * Correct VAR used to find configure time file * Set the path correctly * Update missing release note info. * Update code owners * Correct JIRA note * add known problem. * Use only core library for testing dynamic plugins. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- tools/test/h5copy/CMakeLists.txt | 2 +- tools/test/h5diff/CMakeLists.txt | 2 +- tools/test/h5dump/CMakeLists.txt | 2 +- tools/test/h5ls/CMakeLists.txt | 2 +- tools/test/h5repack/CMakeLists.txt | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index f76a65e..f63eb84 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -32,7 +32,7 @@ if (BUILD_SHARED_LIBS) add_library (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5COPY_TOOL_PLUGIN_LIB_TARGET} ${H5COPY_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") #----------------------------------------------------------------------------- diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index 9349ace..f74db0f 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -32,7 +32,7 @@ if (BUILD_SHARED_LIBS) add_library (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") #----------------------------------------------------------------------------- diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 242465e..a7b4846 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -12,7 +12,7 @@ if (BUILD_SHARED_LIBS) add_library (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} ${H5DUMP_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") #----------------------------------------------------------------------------- diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index ee223b8..ba6e468 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -12,7 +12,7 @@ if (BUILD_SHARED_LIBS) add_library (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5LS_TOOL_PLUGIN_LIB_TARGET} ${H5LS_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") #----------------------------------------------------------------------------- diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 26db85a..0b90750 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -54,13 +54,13 @@ if (BUILD_SHARED_LIBS) add_library (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} ${H5REPACK_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") add_library (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED) - target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") #----------------------------------------------------------------------------- -- cgit v0.12 From 5c3f4b3cb26f92fa0cc60f750816e122e8a68f8d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 24 Jun 2021 12:21:46 -0700 Subject: Removes ancient Autotools cruft (#790) --- configure.ac | 10 ---------- src/H5private.h | 21 ++------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/configure.ac b/configure.ac index cfd9d0c..cf1223b 100644 --- a/configure.ac +++ b/configure.ac @@ -476,15 +476,9 @@ esac ## Data types and their sizes. ## AC_TYPE_OFF_T -AC_CHECK_TYPE([size_t], [], - [AC_DEFINE_UNQUOTED([size_t], [unsigned long], - [Define to `unsigned long' if does not define.])]) AC_CHECK_TYPE([ssize_t], [], [AC_DEFINE_UNQUOTED([ssize_t], [long], [Define to `long' if does not define.])]) -AC_CHECK_TYPE([ptrdiff_t], [], - [AC_DEFINE_UNQUOTED([ptrdiff_t], [long], - [Define to `long' if does not define.])]) AC_C_BIGENDIAN AC_CHECK_SIZEOF([char]) AC_CHECK_SIZEOF([short]) @@ -1229,8 +1223,6 @@ AC_CHECK_LIB([dl], [dlopen]) ## ---------------------------------------------------------------------- ## Check for system header files. ## -AC_HEADER_STDC -AC_HEADER_TIME ## Unix AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h]) @@ -2025,8 +2017,6 @@ AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) ## ---------------------------------------------------------------------- ## Check compiler characteristics ## -AC_C_CONST - AC_MSG_CHECKING([for __attribute__ extension]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int __attribute__((unused)) x]])], [AC_DEFINE([HAVE_ATTRIBUTE], [1], diff --git a/src/H5private.h b/src/H5private.h index ce6681a..327198d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -38,11 +38,13 @@ #include #include #include +#include /* POSIX headers */ #ifdef H5_HAVE_UNISTD_H #include #include +#include #include #include #endif @@ -62,25 +64,6 @@ #endif /* - * If a program may include both `time.h' and `sys/time.h' then - * TIME_WITH_SYS_TIME is defined (see AC_HEADER_TIME in configure.ac). - * On some older systems, `sys/time.h' includes `time.h' but `time.h' is not - * protected against multiple inclusion, so programs should not explicitly - * include both files. This macro is useful in programs that use, for example, - * `struct timeval' or `struct timezone' as well as `struct tm'. It is best - * used in conjunction with `HAVE_SYS_TIME_H', whose existence is checked - * by `AC_CHECK_HEADERS(sys/time.h)' in configure.ac. - */ -#if defined(H5_TIME_WITH_SYS_TIME) -#include -#include -#elif defined(H5_HAVE_SYS_TIME_H) -#include -#else -#include -#endif - -/* * Longjumps are used to detect alignment constrants */ #ifdef H5_HAVE_SETJMP_H -- cgit v0.12 From b16b7316c4afb7f59a4628ec5976659b8db3c497 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 24 Jun 2021 14:46:23 -0700 Subject: Reorganization of C and POSIX headers in H5public.h & H5private.h (#793) * Reorganization of C and POSIX headers in H5public.h & H5private.h Consolidated and removed duplicates * It turns out Windows has sys/types.h Co-authored-by: Larry Knox --- src/H5private.h | 7 +++---- src/H5public.h | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index 327198d..f90aa94 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -31,21 +31,20 @@ #include #include #include -#include #include #include -#include #include #include #include #include /* POSIX headers */ +#ifdef H5_HAVE_SYS_TIME_H +#include +#endif #ifdef H5_HAVE_UNISTD_H #include #include -#include -#include #include #endif diff --git a/src/H5public.h b/src/H5public.h index cef15d9..e192de0 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -35,22 +35,23 @@ #include /* For setting POSIX, BSD, etc. compatibility */ #endif -#ifdef H5_HAVE_SYS_TYPES_H -#include -#endif - -#include /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */ -#include /* For variadic functions in H5VLpublic.h */ - -#include /* For C9x types */ - +/* C library header files for things that appear in HDF5 public headers */ #ifdef __cplusplus #define __STDC_FORMAT_MACROS #endif -#include /* C99/POSIX.1 header for uint64_t, PRIu64 */ - -#ifdef H5_HAVE_STDDEF_H +#include +#include +#include +#include #include +#include + +/* Unlike most sys/ headers, which are POSIX-only, sys/types.h is avaible + * on Windows, though it doesn't necessarily contain all the POSIX types + * we need for HDF5 (e.g. ssize_t). + */ +#ifdef H5_HAVE_SYS_TYPES_H +#include #endif #ifdef H5_HAVE_PARALLEL @@ -192,7 +193,6 @@ typedef int herr_t; * } * \endcode */ -#include typedef bool hbool_t; typedef int htri_t; -- cgit v0.12 From 34f2df48b7e0ae2151462a9835fd7096ef8c2925 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 24 Jun 2021 22:07:36 -0700 Subject: Removes checks for signal and set/longjmp, which are C89 (#798) Also removes checks for setjmp.h and stddef.h --- config/cmake/H5pubconf.h.in | 15 ---------- config/cmake_ext_mod/ConfigureChecks.cmake | 14 ++------- configure.ac | 4 +-- src/H5detect.c | 48 ++---------------------------- src/H5private.h | 8 +---- 5 files changed, 9 insertions(+), 80 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 107fe57..8a4db30 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -235,9 +235,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #cmakedefine H5_HAVE_LIBZ @H5_HAVE_LIBZ@ -/* Define to 1 if you have the `longjmp' function. */ -#cmakedefine H5_HAVE_LONGJMP @H5_HAVE_LONGJMP@ - /* Define to 1 if you have the `lseek64' function. */ #cmakedefine H5_HAVE_LSEEK64 @H5_HAVE_LSEEK64@ @@ -302,21 +299,12 @@ compiled */ #cmakedefine H5_HAVE_ROS3_VFD @H5_HAVE_ROS3_VFD@ -/* Define to 1 if you have the `setjmp' function. */ -#cmakedefine H5_HAVE_SETJMP @H5_HAVE_SETJMP@ - -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_SETJMP_H @H5_HAVE_SETJMP_H@ - /* Define to 1 if you have the `setsysinfo' function. */ #cmakedefine H5_HAVE_SETSYSINFO @H5_HAVE_SETSYSINFO@ /* Define to 1 if you have the `siglongjmp' function. */ #cmakedefine H5_HAVE_SIGLONGJMP @H5_HAVE_SIGLONGJMP@ -/* Define to 1 if you have the `signal' function. */ -#cmakedefine H5_HAVE_SIGNAL @H5_HAVE_SIGNAL@ - /* Define to 1 if you have the `sigprocmask' function. */ #cmakedefine H5_HAVE_SIGPROCMASK @H5_HAVE_SIGPROCMASK@ @@ -332,9 +320,6 @@ /* Define if struct stat has the st_blocks field */ #cmakedefine H5_HAVE_STAT_ST_BLOCKS @H5_HAVE_STAT_ST_BLOCKS@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_STDDEF_H @H5_HAVE_STDDEF_H@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_STDLIB_H @H5_HAVE_STDLIB_H@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 7e1385a..f762a1f 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -72,7 +72,6 @@ if (WINDOWS) set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (${HDF_PREFIX}_HAVE_LIBM 1) set (${HDF_PREFIX}_HAVE_STRDUP 1) - set (${HDF_PREFIX}_HAVE_LONGJMP 1) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) set (${HDF_PREFIX}_HAVE_FUNCTION 1) @@ -117,8 +116,6 @@ CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H) CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H) CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) -CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H) -CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) # Windows @@ -483,9 +480,6 @@ CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R) CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM) CHECK_FUNCTION_EXISTS (setsysinfo ${HDF_PREFIX}_HAVE_SETSYSINFO) -CHECK_FUNCTION_EXISTS (signal ${HDF_PREFIX}_HAVE_SIGNAL) -CHECK_FUNCTION_EXISTS (longjmp ${HDF_PREFIX}_HAVE_LONGJMP) -CHECK_FUNCTION_EXISTS (setjmp ${HDF_PREFIX}_HAVE_SETJMP) CHECK_FUNCTION_EXISTS (siglongjmp ${HDF_PREFIX}_HAVE_SIGLONGJMP) CHECK_FUNCTION_EXISTS (sigsetjmp ${HDF_PREFIX}_HAVE_SIGSETJMP) CHECK_FUNCTION_EXISTS (sigprocmask ${HDF_PREFIX}_HAVE_SIGPROCMASK) @@ -503,11 +497,9 @@ CHECK_FUNCTION_EXISTS (waitpid ${HDF_PREFIX}_HAVE_WAITPID) # sigsetjmp is special; may actually be a macro #----------------------------------------------------------------------------- if (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP) - if (${HDF_PREFIX}_HAVE_SETJMP_H) - CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" ${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) - if (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) - set (${HDF_PREFIX}_HAVE_SIGSETJMP 1) - endif () + CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" ${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) + if (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) + set (${HDF_PREFIX}_HAVE_SIGSETJMP 1) endif () endif () diff --git a/configure.ac b/configure.ac index cf1223b..75016ae 100644 --- a/configure.ac +++ b/configure.ac @@ -1227,7 +1227,7 @@ AC_CHECK_LIB([dl], [dlopen]) ## Unix AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h]) AC_CHECK_HEADERS([sys/socket.h sys/types.h sys/file.h]) -AC_CHECK_HEADERS([stddef.h setjmp.h features.h]) +AC_CHECK_HEADERS([features.h]) AC_CHECK_HEADERS([dirent.h]) AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h]) @@ -2010,7 +2010,7 @@ AC_SEARCH_LIBS([clock_gettime], [rt posix4]) AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork frexpf]) AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) -AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) +AC_CHECK_FUNCS([siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([srandom strdup symlink]) AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) diff --git a/src/H5detect.c b/src/H5detect.c index d148301..b2c0924 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -80,7 +80,7 @@ H5_GCC_DIAG_OFF("cast-align") #define H5SETJMP(buf) HDsigsetjmp(buf, 1) #define H5LONGJMP(buf, val) HDsiglongjmp(buf, val) #define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */ -#elif defined(H5_HAVE_LONGJMP) +#else #define H5JMP_BUF jmp_buf #define H5SETJMP(buf) HDsetjmp(buf) #define H5LONGJMP(buf, val) HDlongjmp(buf, val) @@ -149,12 +149,8 @@ static int sigbus_handler_called_g = 0; /* how many times called */ static int sigsegv_handler_called_g = 0; /* how many times called */ static int sigill_handler_called_g = 0; /* how many times called */ static int signal_handler_tested_g = 0; /* how many times tested */ -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) -static int verify_signal_handlers(int signum, void (*handler)(int)); -#endif -#ifdef H5JMP_BUF -static H5JMP_BUF jbuf_g; -#endif +static int verify_signal_handlers(int signum, void (*handler)(int)); +static H5JMP_BUF jbuf_g; /*------------------------------------------------------------------------- * Function: precision @@ -388,7 +384,6 @@ precision(detected_t *d) COMP_ALIGN = (unsigned int)((char *)(&(s.x)) - (char *)(&s)); \ } -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) #define ALIGNMENT(TYPE, INFO) \ { \ char *volatile _buf = NULL; \ @@ -435,15 +430,6 @@ precision(detected_t *d) HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \ HDsignal(SIGILL, _handler3); /*restore original handler*/ \ } -#else -#define ALIGNMENT(TYPE, INFO) \ - { \ - align_status_g |= STA_NoALIGNMENT; \ - (INFO.align) = 0; \ - } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigsegv_handler @@ -473,9 +459,6 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGSEGV, sigsegv_handler); H5LONGJMP(jbuf_g, SIGSEGV); } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigbus_handler @@ -505,9 +488,6 @@ sigbus_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGBUS, sigbus_handler); H5LONGJMP(jbuf_g, SIGBUS); } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigill_handler @@ -537,7 +517,6 @@ sigill_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGILL, sigill_handler); H5LONGJMP(jbuf_g, SIGILL); } -#endif /*------------------------------------------------------------------------- * Function: print_results @@ -777,21 +756,6 @@ done:\n\ fprintf(rawoutstream, "/* Signal handlers verify test is not available */\n"); /* The following is available in H5pubconf.h. Printing them here for */ /* convenience. */ -#ifdef H5_HAVE_SIGNAL - fprintf(rawoutstream, "/* Signal() support: yes */\n"); -#else - fprintf(rawoutstream, "/* Signal() support: no */\n"); -#endif -#ifdef H5_HAVE_SETJMP - fprintf(rawoutstream, "/* setjmp() support: yes */\n"); -#else - fprintf(rawoutstream, "/* setjmp() support: no */\n"); -#endif -#ifdef H5_HAVE_LONGJMP - fprintf(rawoutstream, "/* longjmp() support: yes */\n"); -#else - fprintf(rawoutstream, "/* longjmp() support: no */\n"); -#endif #ifdef H5_HAVE_SIGSETJMP fprintf(rawoutstream, "/* sigsetjmp() support: yes */\n"); #else @@ -1568,7 +1532,6 @@ detect_alignments(void) na_g++; } -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* Verify the signal handler for signal signum works correctly multiple times. * One possible cause of failure is that the signal handling is blocked or * changed to SIG_DFL after H5LONGJMP. @@ -1625,7 +1588,6 @@ verify_signal_handlers(int signum, void (*handler)(int)) return 0; } } -#endif /*------------------------------------------------------------------------- * Function: main @@ -1655,7 +1617,6 @@ main(int argc, char *argv[]) if (!rawoutstream) rawoutstream = stdout; -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS); @@ -1666,9 +1627,6 @@ main(int argc, char *argv[]) if (verify_signal_handlers(SIGILL, sigill_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL); } -#else - align_status_g |= STA_NoHandlerVerify; -#endif print_header(); diff --git a/src/H5private.h b/src/H5private.h index f90aa94..2478c2e 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -63,13 +64,6 @@ #endif /* - * Longjumps are used to detect alignment constrants - */ -#ifdef H5_HAVE_SETJMP_H -#include -#endif - -/* * flock() in sys/file.h is used for the implementation of file locking. */ #if defined(H5_HAVE_FLOCK) && defined(H5_HAVE_SYS_FILE_H) -- cgit v0.12 From 6dd051101d94b14ff21469b8045c4c26e2a446bd Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 24 Jun 2021 22:08:01 -0700 Subject: Assume frexpl/f and fabsl/f, which are C99 (#799) --- config/cmake/H5pubconf.h.in | 6 ------ config/cmake_ext_mod/ConfigureChecks.cmake | 2 -- configure.ac | 4 ++-- src/H5private.h | 14 ++------------ tools/test/perform/pio_standalone.h | 20 +++++--------------- tools/test/perform/sio_standalone.h | 20 +++++--------------- 6 files changed, 14 insertions(+), 52 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 8a4db30..e14e212 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -156,12 +156,6 @@ /* Define to 1 if you have the `fork' function. */ #cmakedefine H5_HAVE_FORK @H5_HAVE_FORK@ -/* Define to 1 if you have the `frexpf' function. */ -#cmakedefine H5_HAVE_FREXPF @H5_HAVE_FREXPF@ - -/* Define to 1 if you have the `frexpl' function. */ -#cmakedefine H5_HAVE_FREXPL @H5_HAVE_FREXPL@ - /* Define to 1 if you have the `fseeko' function. */ #cmakedefine H5_HAVE_FSEEKO @H5_HAVE_FSEEKO@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index f762a1f..ad8496a 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -467,8 +467,6 @@ CHECK_FUNCTION_EXISTS (alarm ${HDF_PREFIX}_HAVE_ALARM) CHECK_FUNCTION_EXISTS (fcntl ${HDF_PREFIX}_HAVE_FCNTL) CHECK_FUNCTION_EXISTS (flock ${HDF_PREFIX}_HAVE_FLOCK) CHECK_FUNCTION_EXISTS (fork ${HDF_PREFIX}_HAVE_FORK) -CHECK_FUNCTION_EXISTS (frexpf ${HDF_PREFIX}_HAVE_FREXPF) -CHECK_FUNCTION_EXISTS (frexpl ${HDF_PREFIX}_HAVE_FREXPL) CHECK_FUNCTION_EXISTS (gethostname ${HDF_PREFIX}_HAVE_GETHOSTNAME) CHECK_FUNCTION_EXISTS (getrusage ${HDF_PREFIX}_HAVE_GETRUSAGE) diff --git a/configure.ac b/configure.ac index 75016ae..d9a6a5e 100644 --- a/configure.ac +++ b/configure.ac @@ -2007,8 +2007,8 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ## NOTE: clock_gettime may require linking to the rt or posix4 library ## so we'll search for it before calling AC_CHECK_FUNCS. AC_SEARCH_LIBS([clock_gettime], [rt posix4]) -AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork frexpf]) -AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday]) +AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork]) +AC_CHECK_FUNCS([gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([srandom strdup symlink]) diff --git a/src/H5private.h b/src/H5private.h index 2478c2e..ed17d4c 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -766,12 +766,11 @@ typedef struct { #ifndef HDfabs #define HDfabs(X) fabs(X) #endif /* HDfabs */ -/* use ABS() because fabsf() fabsl() are not common yet. */ #ifndef HDfabsf -#define HDfabsf(X) ABS(X) +#define HDfabsf(X) fabsf(X) #endif /* HDfabsf */ #ifndef HDfabsl -#define HDfabsl(X) ABS(X) +#define HDfabsl(X) fabsl(X) #endif /* HDfabsl */ #ifndef HDfclose #define HDfclose(F) fclose(F) @@ -863,20 +862,11 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfrexp #define HDfrexp(X, N) frexp(X, N) #endif /* HDfrexp */ -/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */ #ifndef HDfrexpf -#ifdef H5_HAVE_FREXPF #define HDfrexpf(X, N) frexpf(X, N) -#else /* H5_HAVE_FREXPF */ -#define HDfrexpf(X, N) frexp(X, N) -#endif /* H5_HAVE_FREXPF */ #endif /* HDfrexpf */ #ifndef HDfrexpl -#ifdef H5_HAVE_FREXPL #define HDfrexpl(X, N) frexpl(X, N) -#else /* H5_HAVE_FREXPL */ -#define HDfrexpl(X, N) frexp(X, N) -#endif /* H5_HAVE_FREXPL */ #endif /* HDfrexpl */ /* fscanf() variable arguments */ #ifndef HDfseek diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 82fabdc..2d89d30 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -108,10 +108,9 @@ #define HD_exit(N) _exit(N) #define HDexp(X) exp(X) #define HDfabs(X) fabs(X) -/* use ABS() because fabsf() fabsl() are not common yet. */ -#define HDfabsf(X) ABS(X) -#define HDfabsl(X) ABS(X) -#define HDfclose(F) fclose(F) +#define HDfabsf(X) fabsf(X) +#define HDfabsl(X) fabsl(X) +#define HDfclose(F) fclose(F) /* fcntl() variable arguments */ #define HDfdopen(N, S) fdopen(N, S) #define HDfeof(F) feof(F) @@ -137,17 +136,8 @@ #define HDfree(M) free(M) #define HDfreopen(S, M, F) freopen(S, M, F) #define HDfrexp(X, N) frexp(X, N) -/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */ -#ifdef H5_HAVE_FREXPF -#define HDfrexpf(X, N) frexpf(X, N) -#else /* H5_HAVE_FREXPF */ -#define HDfrexpf(X, N) frexp(X, N) -#endif /* H5_HAVE_FREXPF */ -#ifdef H5_HAVE_FREXPL -#define HDfrexpl(X, N) frexpl(X, N) -#else /* H5_HAVE_FREXPL */ -#define HDfrexpl(X, N) frexp(X, N) -#endif /* H5_HAVE_FREXPL */ +#define HDfrexpf(X, N) frexpf(X, N) +#define HDfrexpl(X, N) frexpl(X, N) /* fscanf() variable arguments */ #ifdef H5_HAVE_FSEEKO #define HDfseek(F, O, W) fseeko(F, O, W) diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 54e82fa..9bdac29 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -123,10 +123,9 @@ #define HD_exit(N) _exit(N) #define HDexp(X) exp(X) #define HDfabs(X) fabs(X) -/* use ABS() because fabsf() fabsl() are not common yet. */ -#define HDfabsf(X) ABS(X) -#define HDfabsl(X) ABS(X) -#define HDfclose(F) fclose(F) +#define HDfabsf(X) fabsf(X) +#define HDfabsl(X) fabsl(X) +#define HDfclose(F) fclose(F) /* fcntl() variable arguments */ #define HDfdopen(N, S) fdopen(N, S) #define HDfeof(F) feof(F) @@ -152,17 +151,8 @@ #define HDfree(M) free(M) #define HDfreopen(S, M, F) freopen(S, M, F) #define HDfrexp(X, N) frexp(X, N) -/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */ -#ifdef H5_HAVE_FREXPF -#define HDfrexpf(X, N) frexpf(X, N) -#else /* H5_HAVE_FREXPF */ -#define HDfrexpf(X, N) frexp(X, N) -#endif /* H5_HAVE_FREXPF */ -#ifdef H5_HAVE_FREXPL -#define HDfrexpl(X, N) frexpl(X, N) -#else /* H5_HAVE_FREXPL */ -#define HDfrexpl(X, N) frexp(X, N) -#endif /* H5_HAVE_FREXPL */ +#define HDfrexpf(X, N) frexpf(X, N) +#define HDfrexpl(X, N) frexpl(X, N) /* fscanf() variable arguments */ #ifdef H5_HAVE_FSEEKO #define HDfseek(F, O, W) fseeko(F, O, W) -- cgit v0.12 From 5ddfbc2a736f7f4cc8b109ee3f3e53c4655dbec1 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 28 Jun 2021 16:31:00 -0700 Subject: Assume the library has C99 types in C++ type code (#806) * Assume the library has C99 types in C++ type code * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/src/H5PredType.cpp | 169 ++++++------------------------------------------- c++/src/H5PredType.h | 73 ++------------------- 2 files changed, 25 insertions(+), 217 deletions(-) diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index a932f54..72d560d 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -249,63 +249,32 @@ PredType *PredType::NATIVE_INT32_; PredType *PredType::NATIVE_UINT32_; PredType *PredType::NATIVE_INT64_; PredType *PredType::NATIVE_UINT64_; + // LEAST types -#if H5_SIZEOF_INT_LEAST8_T != 0 PredType *PredType::NATIVE_INT_LEAST8_; -#endif /* H5_SIZEOF_INT_LEAST8_T */ -#if H5_SIZEOF_UINT_LEAST8_T != 0 PredType *PredType::NATIVE_UINT_LEAST8_; -#endif /* H5_SIZEOF_UINT_LEAST8_T */ -#if H5_SIZEOF_INT_LEAST16_T != 0 PredType *PredType::NATIVE_INT_LEAST16_; -#endif /* H5_SIZEOF_INT_LEAST16_T */ -#if H5_SIZEOF_UINT_LEAST16_T != 0 PredType *PredType::NATIVE_UINT_LEAST16_; -#endif /* H5_SIZEOF_UINT_LEAST16_T */ -#if H5_SIZEOF_INT_LEAST32_T != 0 PredType *PredType::NATIVE_INT_LEAST32_; -#endif /* H5_SIZEOF_INT_LEAST32_T */ -#if H5_SIZEOF_UINT_LEAST32_T != 0 PredType *PredType::NATIVE_UINT_LEAST32_; -#endif /* H5_SIZEOF_UINT_LEAST32_T */ -#if H5_SIZEOF_INT_LEAST64_T != 0 PredType *PredType::NATIVE_INT_LEAST64_; -#endif /* H5_SIZEOF_INT_LEAST64_T */ -#if H5_SIZEOF_UINT_LEAST64_T != 0 PredType *PredType::NATIVE_UINT_LEAST64_; -#endif /* H5_SIZEOF_UINT_LEAST64_T */ // FAST types -#if H5_SIZEOF_INT_FAST8_T != 0 PredType *PredType::NATIVE_INT_FAST8_; -#endif /* H5_SIZEOF_INT_FAST8_T */ -#if H5_SIZEOF_UINT_FAST8_T != 0 PredType *PredType::NATIVE_UINT_FAST8_; -#endif /* H5_SIZEOF_UINT_FAST8_T */ -#if H5_SIZEOF_INT_FAST16_T != 0 PredType *PredType::NATIVE_INT_FAST16_; -#endif /* H5_SIZEOF_INT_FAST16_T */ -#if H5_SIZEOF_UINT_FAST16_T != 0 PredType *PredType::NATIVE_UINT_FAST16_; -#endif /* H5_SIZEOF_UINT_FAST16_T */ -#if H5_SIZEOF_INT_FAST32_T != 0 PredType *PredType::NATIVE_INT_FAST32_; -#endif /* H5_SIZEOF_INT_FAST32_T */ -#if H5_SIZEOF_UINT_FAST32_T != 0 PredType *PredType::NATIVE_UINT_FAST32_; -#endif /* H5_SIZEOF_UINT_FAST32_T */ -#if H5_SIZEOF_INT_FAST64_T != 0 PredType *PredType::NATIVE_INT_FAST64_; -#endif /* H5_SIZEOF_INT_FAST64_T */ -#if H5_SIZEOF_UINT_FAST64_T != 0 PredType *PredType::NATIVE_UINT_FAST64_; -#endif /* H5_SIZEOF_UINT_FAST64_T */ //-------------------------------------------------------------------------- // Function: PredType::getPredTypes @@ -472,63 +441,31 @@ PredType::makePredTypes() NATIVE_INT64_ = new PredType(H5T_NATIVE_INT64); NATIVE_UINT64_ = new PredType(H5T_NATIVE_UINT64); -// LEAST types -#if H5_SIZEOF_INT_LEAST8_T != 0 - NATIVE_INT_LEAST8_ = new PredType(H5T_NATIVE_INT_LEAST8); -#endif /* H5_SIZEOF_INT_LEAST8_T */ -#if H5_SIZEOF_UINT_LEAST8_T != 0 + // LEAST types + NATIVE_INT_LEAST8_ = new PredType(H5T_NATIVE_INT_LEAST8); NATIVE_UINT_LEAST8_ = new PredType(H5T_NATIVE_UINT_LEAST8); -#endif /* H5_SIZEOF_UINT_LEAST8_T */ -#if H5_SIZEOF_INT_LEAST16_T != 0 - NATIVE_INT_LEAST16_ = new PredType(H5T_NATIVE_INT_LEAST16); -#endif /* H5_SIZEOF_INT_LEAST16_T */ -#if H5_SIZEOF_UINT_LEAST16_T != 0 + NATIVE_INT_LEAST16_ = new PredType(H5T_NATIVE_INT_LEAST16); NATIVE_UINT_LEAST16_ = new PredType(H5T_NATIVE_UINT_LEAST16); -#endif /* H5_SIZEOF_UINT_LEAST16_T */ -#if H5_SIZEOF_INT_LEAST32_T != 0 - NATIVE_INT_LEAST32_ = new PredType(H5T_NATIVE_INT_LEAST32); -#endif /* H5_SIZEOF_INT_LEAST32_T */ -#if H5_SIZEOF_UINT_LEAST32_T != 0 + NATIVE_INT_LEAST32_ = new PredType(H5T_NATIVE_INT_LEAST32); NATIVE_UINT_LEAST32_ = new PredType(H5T_NATIVE_UINT_LEAST32); -#endif /* H5_SIZEOF_UINT_LEAST32_T */ -#if H5_SIZEOF_INT_LEAST64_T != 0 - NATIVE_INT_LEAST64_ = new PredType(H5T_NATIVE_INT_LEAST64); -#endif /* H5_SIZEOF_INT_LEAST64_T */ -#if H5_SIZEOF_UINT_LEAST64_T != 0 + NATIVE_INT_LEAST64_ = new PredType(H5T_NATIVE_INT_LEAST64); NATIVE_UINT_LEAST64_ = new PredType(H5T_NATIVE_UINT_LEAST64); -#endif /* H5_SIZEOF_UINT_LEAST64_T */ -// FAST types -#if H5_SIZEOF_INT_FAST8_T != 0 - NATIVE_INT_FAST8_ = new PredType(H5T_NATIVE_INT_FAST8); -#endif /* H5_SIZEOF_INT_FAST8_T */ -#if H5_SIZEOF_UINT_FAST8_T != 0 + // FAST types + NATIVE_INT_FAST8_ = new PredType(H5T_NATIVE_INT_FAST8); NATIVE_UINT_FAST8_ = new PredType(H5T_NATIVE_UINT_FAST8); -#endif /* H5_SIZEOF_UINT_FAST8_T */ -#if H5_SIZEOF_INT_FAST16_T != 0 - NATIVE_INT_FAST16_ = new PredType(H5T_NATIVE_INT_FAST16); -#endif /* H5_SIZEOF_INT_FAST16_T */ -#if H5_SIZEOF_UINT_FAST16_T != 0 + NATIVE_INT_FAST16_ = new PredType(H5T_NATIVE_INT_FAST16); NATIVE_UINT_FAST16_ = new PredType(H5T_NATIVE_UINT_FAST16); -#endif /* H5_SIZEOF_UINT_FAST16_T */ -#if H5_SIZEOF_INT_FAST32_T != 0 - NATIVE_INT_FAST32_ = new PredType(H5T_NATIVE_INT_FAST32); -#endif /* H5_SIZEOF_INT_FAST32_T */ -#if H5_SIZEOF_UINT_FAST32_T != 0 + NATIVE_INT_FAST32_ = new PredType(H5T_NATIVE_INT_FAST32); NATIVE_UINT_FAST32_ = new PredType(H5T_NATIVE_UINT_FAST32); -#endif /* H5_SIZEOF_UINT_FAST32_T */ -#if H5_SIZEOF_INT_FAST64_T != 0 - NATIVE_INT_FAST64_ = new PredType(H5T_NATIVE_INT_FAST64); -#endif /* H5_SIZEOF_INT_FAST64_T */ -#if H5_SIZEOF_UINT_FAST64_T != 0 + NATIVE_INT_FAST64_ = new PredType(H5T_NATIVE_INT_FAST64); NATIVE_UINT_FAST64_ = new PredType(H5T_NATIVE_UINT_FAST64); -#endif /* H5_SIZEOF_UINT_FAST64_T */ } // makePredTypes @@ -658,63 +595,31 @@ PredType::deleteConstants() delete NATIVE_INT64_; delete NATIVE_UINT64_; -// LEAST types -#if H5_SIZEOF_INT_LEAST8_T != 0 + // LEAST types delete NATIVE_INT_LEAST8_; -#endif /* H5_SIZEOF_INT_LEAST8_T */ -#if H5_SIZEOF_UINT_LEAST8_T != 0 delete NATIVE_UINT_LEAST8_; -#endif /* H5_SIZEOF_UINT_LEAST8_T */ -#if H5_SIZEOF_INT_LEAST16_T != 0 delete NATIVE_INT_LEAST16_; -#endif /* H5_SIZEOF_INT_LEAST16_T */ -#if H5_SIZEOF_UINT_LEAST16_T != 0 delete NATIVE_UINT_LEAST16_; -#endif /* H5_SIZEOF_UINT_LEAST16_T */ -#if H5_SIZEOF_INT_LEAST32_T != 0 delete NATIVE_INT_LEAST32_; -#endif /* H5_SIZEOF_INT_LEAST32_T */ -#if H5_SIZEOF_UINT_LEAST32_T != 0 delete NATIVE_UINT_LEAST32_; -#endif /* H5_SIZEOF_UINT_LEAST32_T */ -#if H5_SIZEOF_INT_LEAST64_T != 0 delete NATIVE_INT_LEAST64_; -#endif /* H5_SIZEOF_INT_LEAST64_T */ -#if H5_SIZEOF_UINT_LEAST64_T != 0 delete NATIVE_UINT_LEAST64_; -#endif /* H5_SIZEOF_UINT_LEAST64_T */ -// FAST types -#if H5_SIZEOF_INT_FAST8_T != 0 + // FAST types delete NATIVE_INT_FAST8_; -#endif /* H5_SIZEOF_INT_FAST8_T */ -#if H5_SIZEOF_UINT_FAST8_T != 0 delete NATIVE_UINT_FAST8_; -#endif /* H5_SIZEOF_UINT_FAST8_T */ -#if H5_SIZEOF_INT_FAST16_T != 0 delete NATIVE_INT_FAST16_; -#endif /* H5_SIZEOF_INT_FAST16_T */ -#if H5_SIZEOF_UINT_FAST16_T != 0 delete NATIVE_UINT_FAST16_; -#endif /* H5_SIZEOF_UINT_FAST16_T */ -#if H5_SIZEOF_INT_FAST32_T != 0 delete NATIVE_INT_FAST32_; -#endif /* H5_SIZEOF_INT_FAST32_T */ -#if H5_SIZEOF_UINT_FAST32_T != 0 delete NATIVE_UINT_FAST32_; -#endif /* H5_SIZEOF_UINT_FAST32_T */ -#if H5_SIZEOF_INT_FAST64_T != 0 delete NATIVE_INT_FAST64_; -#endif /* H5_SIZEOF_INT_FAST64_T */ -#if H5_SIZEOF_UINT_FAST64_T != 0 delete NATIVE_UINT_FAST64_; -#endif /* H5_SIZEOF_UINT_FAST64_T */ delete PREDTYPE_CONST_; PREDTYPE_CONST_ = 0; @@ -848,62 +753,30 @@ const PredType &PredType::NATIVE_INT64 = *NATIVE_INT64_; const PredType &PredType::NATIVE_UINT64 = *NATIVE_UINT64_; // LEAST types -#if H5_SIZEOF_INT_LEAST8_T != 0 -const PredType &PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_; -#endif /* H5_SIZEOF_INT_LEAST8_T */ -#if H5_SIZEOF_UINT_LEAST8_T != 0 +const PredType &PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_; const PredType &PredType::NATIVE_UINT_LEAST8 = *NATIVE_UINT_LEAST8_; -#endif /* H5_SIZEOF_UINT_LEAST8_T */ -#if H5_SIZEOF_INT_LEAST16_T != 0 -const PredType &PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_; -#endif /* H5_SIZEOF_INT_LEAST16_T */ -#if H5_SIZEOF_UINT_LEAST16_T != 0 +const PredType &PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_; const PredType &PredType::NATIVE_UINT_LEAST16 = *NATIVE_UINT_LEAST16_; -#endif /* H5_SIZEOF_UINT_LEAST16_T */ -#if H5_SIZEOF_INT_LEAST32_T != 0 -const PredType &PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_; -#endif /* H5_SIZEOF_INT_LEAST32_T */ -#if H5_SIZEOF_UINT_LEAST32_T != 0 +const PredType &PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_; const PredType &PredType::NATIVE_UINT_LEAST32 = *NATIVE_UINT_LEAST32_; -#endif /* H5_SIZEOF_UINT_LEAST32_T */ -#if H5_SIZEOF_INT_LEAST64_T != 0 -const PredType &PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_; -#endif /* H5_SIZEOF_INT_LEAST64_T */ -#if H5_SIZEOF_UINT_LEAST64_T != 0 +const PredType &PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_; const PredType &PredType::NATIVE_UINT_LEAST64 = *NATIVE_UINT_LEAST64_; -#endif /* H5_SIZEOF_UINT_LEAST64_T */ // FAST types -#if H5_SIZEOF_INT_FAST8_T != 0 -const PredType &PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_; -#endif /* H5_SIZEOF_INT_FAST8_T */ -#if H5_SIZEOF_UINT_FAST8_T != 0 +const PredType &PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_; const PredType &PredType::NATIVE_UINT_FAST8 = *NATIVE_UINT_FAST8_; -#endif /* H5_SIZEOF_UINT_FAST8_T */ -#if H5_SIZEOF_INT_FAST16_T != 0 -const PredType &PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_; -#endif /* H5_SIZEOF_INT_FAST16_T */ -#if H5_SIZEOF_UINT_FAST16_T != 0 +const PredType &PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_; const PredType &PredType::NATIVE_UINT_FAST16 = *NATIVE_UINT_FAST16_; -#endif /* H5_SIZEOF_UINT_FAST16_T */ -#if H5_SIZEOF_INT_FAST32_T != 0 -const PredType &PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_; -#endif /* H5_SIZEOF_INT_FAST32_T */ -#if H5_SIZEOF_UINT_FAST32_T != 0 +const PredType &PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_; const PredType &PredType::NATIVE_UINT_FAST32 = *NATIVE_UINT_FAST32_; -#endif /* H5_SIZEOF_UINT_FAST32_T */ -#if H5_SIZEOF_INT_FAST64_T != 0 -const PredType &PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_; -#endif /* H5_SIZEOF_INT_FAST64_T */ -#if H5_SIZEOF_UINT_FAST64_T != 0 +const PredType &PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_; const PredType &PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_; -#endif /* H5_SIZEOF_UINT_FAST64_T */ #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 0ec5ddd..45f20ab 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -176,63 +176,31 @@ class H5_DLLCPP PredType : public AtomType { static const PredType &NATIVE_INT64; static const PredType &NATIVE_UINT64; -// LEAST types -#if H5_SIZEOF_INT_LEAST8_T != 0 + // LEAST types static const PredType &NATIVE_INT_LEAST8; -#endif /* H5_SIZEOF_INT_LEAST8_T */ -#if H5_SIZEOF_UINT_LEAST8_T != 0 static const PredType &NATIVE_UINT_LEAST8; -#endif /* H5_SIZEOF_UINT_LEAST8_T */ -#if H5_SIZEOF_INT_LEAST16_T != 0 static const PredType &NATIVE_INT_LEAST16; -#endif /* H5_SIZEOF_INT_LEAST16_T */ -#if H5_SIZEOF_UINT_LEAST16_T != 0 static const PredType &NATIVE_UINT_LEAST16; -#endif /* H5_SIZEOF_UINT_LEAST16_T */ -#if H5_SIZEOF_INT_LEAST32_T != 0 static const PredType &NATIVE_INT_LEAST32; -#endif /* H5_SIZEOF_INT_LEAST32_T */ -#if H5_SIZEOF_UINT_LEAST32_T != 0 static const PredType &NATIVE_UINT_LEAST32; -#endif /* H5_SIZEOF_UINT_LEAST32_T */ -#if H5_SIZEOF_INT_LEAST64_T != 0 static const PredType &NATIVE_INT_LEAST64; -#endif /* H5_SIZEOF_INT_LEAST64_T */ -#if H5_SIZEOF_UINT_LEAST64_T != 0 static const PredType &NATIVE_UINT_LEAST64; -#endif /* H5_SIZEOF_UINT_LEAST64_T */ -// FAST types -#if H5_SIZEOF_INT_FAST8_T != 0 + // FAST types static const PredType &NATIVE_INT_FAST8; -#endif /* H5_SIZEOF_INT_FAST8_T */ -#if H5_SIZEOF_UINT_FAST8_T != 0 static const PredType &NATIVE_UINT_FAST8; -#endif /* H5_SIZEOF_UINT_FAST8_T */ -#if H5_SIZEOF_INT_FAST16_T != 0 static const PredType &NATIVE_INT_FAST16; -#endif /* H5_SIZEOF_INT_FAST16_T */ -#if H5_SIZEOF_UINT_FAST16_T != 0 static const PredType &NATIVE_UINT_FAST16; -#endif /* H5_SIZEOF_UINT_FAST16_T */ -#if H5_SIZEOF_INT_FAST32_T != 0 static const PredType &NATIVE_INT_FAST32; -#endif /* H5_SIZEOF_INT_FAST32_T */ -#if H5_SIZEOF_UINT_FAST32_T != 0 static const PredType &NATIVE_UINT_FAST32; -#endif /* H5_SIZEOF_UINT_FAST32_T */ -#if H5_SIZEOF_INT_FAST64_T != 0 static const PredType &NATIVE_INT_FAST64; -#endif /* H5_SIZEOF_INT_FAST64_T */ -#if H5_SIZEOF_UINT_FAST64_T != 0 static const PredType &NATIVE_UINT_FAST64; -#endif /* H5_SIZEOF_UINT_FAST64_T */ #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -378,64 +346,31 @@ class H5_DLLCPP PredType : public AtomType { static PredType *NATIVE_INT64_; static PredType *NATIVE_UINT64_; -// LEAST types -#if H5_SIZEOF_INT_LEAST8_T != 0 + // LEAST types static PredType *NATIVE_INT_LEAST8_; -#endif /* H5_SIZEOF_INT_LEAST8_T */ -#if H5_SIZEOF_UINT_LEAST8_T != 0 static PredType *NATIVE_UINT_LEAST8_; -#endif /* H5_SIZEOF_UINT_LEAST8_T */ -#if H5_SIZEOF_INT_LEAST16_T != 0 static PredType *NATIVE_INT_LEAST16_; -#endif /* H5_SIZEOF_INT_LEAST16_T */ -#if H5_SIZEOF_UINT_LEAST16_T != 0 static PredType *NATIVE_UINT_LEAST16_; -#endif /* H5_SIZEOF_UINT_LEAST16_T */ -#if H5_SIZEOF_INT_LEAST32_T != 0 static PredType *NATIVE_INT_LEAST32_; -#endif /* H5_SIZEOF_INT_LEAST32_T */ -#if H5_SIZEOF_UINT_LEAST32_T != 0 static PredType *NATIVE_UINT_LEAST32_; -#endif /* H5_SIZEOF_UINT_LEAST32_T */ -#if H5_SIZEOF_INT_LEAST64_T != 0 static PredType *NATIVE_INT_LEAST64_; -#endif /* H5_SIZEOF_INT_LEAST64_T */ -#if H5_SIZEOF_UINT_LEAST64_T != 0 static PredType *NATIVE_UINT_LEAST64_; -#endif /* H5_SIZEOF_UINT_LEAST64_T */ -// FAST types -#if H5_SIZEOF_INT_FAST8_T != 0 + // FAST types static PredType *NATIVE_INT_FAST8_; -#endif /* H5_SIZEOF_INT_FAST8_T */ -#if H5_SIZEOF_UINT_FAST8_T != 0 static PredType *NATIVE_UINT_FAST8_; -#endif /* H5_SIZEOF_UINT_FAST8_T */ -#if H5_SIZEOF_INT_FAST16_T != 0 static PredType *NATIVE_INT_FAST16_; -#endif /* H5_SIZEOF_INT_FAST16_T */ -#if H5_SIZEOF_UINT_FAST16_T != 0 static PredType *NATIVE_UINT_FAST16_; -#endif /* H5_SIZEOF_UINT_FAST16_T */ -#if H5_SIZEOF_INT_FAST32_T != 0 static PredType *NATIVE_INT_FAST32_; -#endif /* H5_SIZEOF_INT_FAST32_T */ -#if H5_SIZEOF_UINT_FAST32_T != 0 static PredType *NATIVE_UINT_FAST32_; -#endif /* H5_SIZEOF_UINT_FAST32_T */ -#if H5_SIZEOF_INT_FAST64_T != 0 static PredType *NATIVE_INT_FAST64_; -#endif /* H5_SIZEOF_INT_FAST64_T */ -#if H5_SIZEOF_UINT_FAST64_T != 0 static PredType *NATIVE_UINT_FAST64_; -#endif /* H5_SIZEOF_UINT_FAST64_T */ - // End of Declaration of pointers #endif // DOXYGEN_SHOULD_SKIP_THIS -- cgit v0.12 From 734d317da9c759799c92ff47e05e3be7e3e969a9 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 28 Jun 2021 21:58:38 -0700 Subject: Removes obsolete equivalents of C99's __func__ (#800) --- bin/trace | 2 +- config/cmake/H5pubconf.h.in | 6 - config/cmake_ext_mod/ConfigureChecks.cmake | 3 - config/cmake_ext_mod/HDFTests.c | 40 --- configure.ac | 12 - src/H5A.c | 24 +- src/H5D.c | 14 +- src/H5Eprivate.h | 2 +- src/H5F.c | 16 +- src/H5FDsplitter.c | 80 ++--- src/H5G.c | 12 +- src/H5HF.c | 12 +- src/H5HFdbg.c | 2 +- src/H5HFdblock.c | 2 +- src/H5L.c | 12 +- src/H5M.c | 10 +- src/H5O.c | 14 +- src/H5R.c | 6 +- src/H5T.c | 2 +- src/H5Tcommit.c | 4 +- src/H5VLcallback.c | 14 +- src/H5private.h | 90 +++--- test/cache.c | 499 +++++++++++++++-------------- test/cache_api.c | 48 +-- test/cache_common.c | 24 +- test/cache_image.c | 36 +-- test/h5test.h | 2 +- tools/lib/h5tools_error.h | 18 +- tools/test/h5copy/h5copygentest.c | 54 ++-- tools/test/h5diff/h5diffgentest.c | 2 +- tools/test/h5repack/h5repacktst.c | 108 +++---- tools/test/misc/vds/UC_common.h | 11 +- 32 files changed, 556 insertions(+), 625 deletions(-) diff --git a/bin/trace b/bin/trace index d51b8cb..cc26f86 100755 --- a/bin/trace +++ b/bin/trace @@ -351,7 +351,7 @@ sub rewrite_func ($$$$$) { # Compose the trace macro $trace = "H5TRACE" . scalar(@arg_str) . "(\"$rettype\", \""; - $argtrace = "H5ARG_TRACE" . scalar(@arg_str) . "(FUNC, \""; + $argtrace = "H5ARG_TRACE" . scalar(@arg_str) . "(__func__, \""; $trace .= join("", @arg_str) . "\""; $argtrace .= join("", @arg_str) . "\""; diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index e14e212..be366a8 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -102,9 +102,6 @@ and unions */ #cmakedefine H5_HAVE_C99_DESIGNATED_INITIALIZER @H5_HAVE_C99_DESIGNATED_INITIALIZER@ -/* Define if the compiler understands the __func__ keyword */ -#cmakedefine H5_HAVE_C99_FUNC @H5_HAVE_C99_FUNC@ - /* Define to 1 if you have the `clock_gettime' function. */ #cmakedefine H5_HAVE_CLOCK_GETTIME @H5_HAVE_CLOCK_GETTIME@ @@ -159,9 +156,6 @@ /* Define to 1 if you have the `fseeko' function. */ #cmakedefine H5_HAVE_FSEEKO @H5_HAVE_FSEEKO@ -/* Define if the compiler understands the __FUNCTION__ keyword */ -#cmakedefine H5_HAVE_FUNCTION @H5_HAVE_FUNCTION@ - /* Determine if INTEGER*16 is available */ #cmakedefine H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index ad8496a..ccf7c85 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -74,7 +74,6 @@ if (WINDOWS) set (${HDF_PREFIX}_HAVE_STRDUP 1) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) - set (${HDF_PREFIX}_HAVE_FUNCTION 1) endif () if (NOT UNIX AND NOT CYGWIN) set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) @@ -507,8 +506,6 @@ endif () if (MINGW OR NOT WINDOWS) foreach (other_test HAVE_ATTRIBUTE - HAVE_C99_FUNC - HAVE_FUNCTION HAVE_C99_DESIGNATED_INITIALIZER SYSTEM_SCOPE_THREADS HAVE_SOCKLEN_T diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 365931b..c434be5 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -44,26 +44,6 @@ main () #endif -#ifdef HAVE_C99_FUNC - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ - const char *fname = __func__; - ; - return 0; -} - -#endif - #ifdef HAVE_ATTRIBUTE #if 0 @@ -90,26 +70,6 @@ int __attribute__((unused)) x #endif /* HAVE_ATTRIBUTE */ -#ifdef HAVE_FUNCTION - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -(void)__FUNCTION__ - ; - return 0; -} - -#endif /* HAVE_FUNCTION */ - #ifdef HAVE_TIMEZONE #ifdef HAVE_SYS_TIME_H diff --git a/configure.ac b/configure.ac index d9a6a5e..dbeb968 100644 --- a/configure.ac +++ b/configure.ac @@ -2024,18 +2024,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int __attribute__((unused)) x]])], AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) -AC_MSG_CHECKING([for __func__ extension]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[ const char *fname = __func__; ]])], - [AC_DEFINE([HAVE_C99_FUNC], [1], - [Define if the compiler understands the __func__ keyword]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) -AC_MSG_CHECKING([for __FUNCTION__ extension]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],,[[ const char *fname = __FUNCTION__; ]])], - [AC_DEFINE([HAVE_FUNCTION], [1], - [Define if the compiler understands the __FUNCTION__ keyword]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for C99 designated initialization support]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ typedef struct { diff --git a/src/H5A.c b/src/H5A.c index 5d8737f..c986d1f 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -276,7 +276,7 @@ H5Acreate_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, es_id)) < 0) { + H5ARG_TRACE10(__func__, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -425,7 +425,7 @@ H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE12(FUNC, "*s*sIui*s*siiiiii", app_file, app_func, app_line, loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, es_id)) < 0) { + H5ARG_TRACE12(__func__, "*s*sIui*s*siiiiii", app_file, app_func, app_line, loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -588,7 +588,7 @@ H5Aopen_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*sIui*sii", app_file, app_func, app_line, loc_id, attr_name, aapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, attr_name, aapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -719,7 +719,7 @@ H5Aopen_by_name_async(const char *app_file, const char *app_func, unsigned app_l if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*s*siii", app_file, app_func, app_line, loc_id, obj_name, attr_name, aapl_id, lapl_id, es_id)) < 0) { + H5ARG_TRACE9(__func__, "*s*sIui*s*siii", app_file, app_func, app_line, loc_id, obj_name, attr_name, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -859,7 +859,7 @@ H5Aopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(FUNC, "*s*sIui*sIiIohiii", app_file, app_func, app_line, loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, es_id)) < 0) { + H5ARG_TRACE11(__func__, "*s*sIui*sIiIohiii", app_file, app_func, app_line, loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -971,7 +971,7 @@ H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hi 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*sIuii*xi", 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") @@ -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*sIuiixi", 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") @@ -1719,7 +1719,7 @@ H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*s*si", app_file, app_func, app_line, loc_id, old_name, new_name, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIui*s*si", app_file, app_func, app_line, loc_id, old_name, new_name, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1839,7 +1839,7 @@ H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*s*s*sii", app_file, app_func, app_line, loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIui*s*s*sii", app_file, app_func, app_line, loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -2304,7 +2304,7 @@ H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, attr_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, attr_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -2460,7 +2460,7 @@ H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*s*bi", app_file, app_func, app_line, obj_id, attr_name, attr_exists, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIui*s*bi", app_file, app_func, app_line, obj_id, attr_name, attr_exists, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -2579,7 +2579,7 @@ H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*s*s*bii", app_file, app_func, app_line, loc_id, obj_name, attr_name, attr_exists, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIui*s*s*bii", app_file, app_func, app_line, loc_id, obj_name, attr_name, attr_exists, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5D.c b/src/H5D.c index 7d0e934..7153c7d 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -228,7 +228,7 @@ H5Dcreate_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(FUNC, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, es_id)) < 0) { + H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID") @@ -437,7 +437,7 @@ H5Dopen_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*sIui*sii", app_file, app_func, app_line, loc_id, name, dapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, dapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID") @@ -531,7 +531,7 @@ H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -647,7 +647,7 @@ H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) { + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, @@ -1065,7 +1065,7 @@ H5Dread_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_TRACE10(FUNC, "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1267,7 +1267,7 @@ H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1846,7 +1846,7 @@ H5Dset_extent_async(const char *app_file, const char *app_func, unsigned app_lin if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE6(FUNC, "*s*sIui*hi", app_file, app_func, app_line, dset_id, size, es_id)) < 0) + H5ARG_TRACE6(__func__, "*s*sIui*hi", app_file, app_func, app_line, dset_id, size, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index cd567aa..a30cb6a 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -31,7 +31,7 @@ typedef struct H5E_t H5E_t; * error number, the minor error number, and a description of the error. */ #define HERROR(maj_id, min_id, ...) \ - H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__) + H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__) /* * HCOMMON_ERROR macro, used by HDONE_ERROR and HGOTO_ERROR diff --git a/src/H5F.c b/src/H5F.c index 5950d9e..8a28b00 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -711,7 +711,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(FUNC, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) { + H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") @@ -730,7 +730,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(FUNC, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) + H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") @@ -888,7 +888,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") @@ -907,7 +907,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") @@ -1020,7 +1020,7 @@ H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE6(FUNC, "*s*sIuiFsi", app_file, app_func, app_line, object_id, scope, es_id)) < 0) + H5ARG_TRACE6(__func__, "*s*sIuiFsi", app_file, app_func, app_line, object_id, scope, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1114,7 +1114,7 @@ H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1524,7 +1524,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) { + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") @@ -1543,7 +1543,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 298edfb..c27cd1b 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -187,7 +187,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (H5FD_splitter_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize splitter VFD") @@ -213,7 +213,7 @@ H5FD_splitter_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) H5FD_SPLITTER_g = H5FDregister(&H5FD_splitter_g); @@ -237,7 +237,7 @@ H5FD__splitter_term(void) { FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Reset VFL ID */ H5FD_SPLITTER_g = 0; @@ -262,7 +262,7 @@ H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(id_out_ptr != NULL); @@ -300,7 +300,7 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*#", fapl_id, vfd_config); - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (H5FD_SPLITTER_MAGIC != vfd_config->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)") @@ -388,7 +388,7 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", fapl_id, config); - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) @@ -442,13 +442,13 @@ H5FD__splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closin FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Public API for dxpl "context" */ if (H5FDflush(file->rw_file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file") if (H5FDflush(file->wo_file, dxpl_id, closing) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -477,7 +477,7 @@ H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(file && file->pub.cls); HDassert(buf); @@ -517,7 +517,7 @@ H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") @@ -527,7 +527,7 @@ H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed") if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -553,7 +553,7 @@ H5FD__splitter_fapl_get(H5FD_t *_file) FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); ret_value = H5FD__splitter_fapl_copy(&(file->fa)); @@ -578,7 +578,7 @@ H5FD__splitter_fapl_copy(const void *_old_fa) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(old_fa_ptr); @@ -622,7 +622,7 @@ H5FD__splitter_fapl_free(void *_fapl) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(fapl); @@ -660,7 +660,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ if (!name || !*name) @@ -716,7 +716,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF); if (!file_ptr->wo_file) - H5FD_SPLITTER_WO_ERROR(file_ptr, FUNC, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") + H5FD_SPLITTER_WO_ERROR(file_ptr, __func__, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") ret_value = (H5FD_t *)file_ptr; @@ -757,7 +757,7 @@ H5FD__splitter_close(H5FD_t *_file) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -772,7 +772,8 @@ H5FD__splitter_close(H5FD_t *_file) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file") if (file->wo_file) if (H5FD_close(file->wo_file) == FAIL) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "unable to close W/O file") if (file->logfp) { HDfclose(file->logfp); @@ -807,7 +808,7 @@ H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -838,7 +839,7 @@ H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t ad FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC) + H5FD_SPLITTER_LOG_CALL(__func__) /* Sanity check */ HDassert(file); @@ -849,7 +850,7 @@ H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t ad HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file") if (H5FD_set_eoa(file->wo_file, type, addr) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -875,7 +876,7 @@ H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -904,7 +905,7 @@ H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(file); HDassert(file->rw_file); @@ -914,7 +915,7 @@ H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file") if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -942,7 +943,7 @@ H5FD__splitter_sb_size(H5FD_t *_file) FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -970,7 +971,7 @@ H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf / FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -1001,7 +1002,7 @@ H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *b FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -1032,7 +1033,7 @@ H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(f1); HDassert(f2); @@ -1059,7 +1060,7 @@ H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_ FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1090,7 +1091,7 @@ H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(file); HDassert(file->rw_file); @@ -1101,7 +1102,7 @@ H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) if (file->wo_file != NULL) if (H5FD_lock(file->wo_file, rw) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1123,7 +1124,7 @@ H5FD__splitter_unlock(H5FD_t *_file) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1158,7 +1159,7 @@ H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (file) { HDassert(file); @@ -1195,7 +1196,7 @@ H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1206,7 +1207,8 @@ H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file") if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, + "unable to alloc for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1228,7 +1230,7 @@ H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1258,7 +1260,7 @@ H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1268,7 +1270,7 @@ H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file") if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1289,7 +1291,7 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); diff --git a/src/H5G.c b/src/H5G.c index d7e4da9..deaf792 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -271,7 +271,7 @@ H5Gcreate_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*siiii", app_file, app_func, app_line, loc_id, name, lcpl_id, gcpl_id, gapl_id, es_id)) < 0) { + H5ARG_TRACE9(__func__, "*s*sIui*siiii", app_file, app_func, app_line, loc_id, name, lcpl_id, gcpl_id, gapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID") @@ -475,7 +475,7 @@ H5Gopen_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*sIui*sii", app_file, app_func, app_line, loc_id, name, gapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, gapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID") @@ -630,7 +630,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE6(FUNC, "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) + H5ARG_TRACE6(__func__, "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -738,7 +738,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(FUNC, "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) + H5ARG_TRACE8(__func__, "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -852,7 +852,7 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(FUNC, "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) + H5ARG_TRACE11(__func__, "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -942,7 +942,7 @@ H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, group_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, group_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5HF.c b/src/H5HF.c index 73281a4..1f4cc26 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -429,7 +429,7 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -489,7 +489,7 @@ H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p) *obj_off_p = (hsize_t)0; } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -552,7 +552,7 @@ H5HF_read(H5HF_t *fh, const void *_id, void *obj /*out*/) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'tiny' object from fractal heap") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -628,7 +628,7 @@ H5HF_write(H5HF_t *fh, void *_id, hbool_t H5_ATTR_UNUSED *id_changed, const void HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "modifying 'tiny' object not supported yet") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -696,7 +696,7 @@ H5HF_op(H5HF_t *fh, const void *_id, H5HF_operator_t op, void *op_data) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'tiny' object from fractal heap") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -759,7 +759,7 @@ H5HF_remove(H5HF_t *fh, const void *_id) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'tiny' object from fractal heap") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index a244035..8dbb3f4 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -140,7 +140,7 @@ H5HF_id_print(H5HF_t *fh, const void *_id, FILE *stream, int indent, int fwidth) id_type = 'T'; } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 628dcc4..4adb47a 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -397,7 +397,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_ HDfprintf( stderr, "%s: Skipping direct block sizes not supported, min_dblock_size = %zu, next_size = %zu\n", - FUNC, min_dblock_size, next_size); + __func__, min_dblock_size, next_size); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not supported yet") } /* end if */ diff --git a/src/H5L.c b/src/H5L.c index 487599b..065cc5c 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -415,7 +415,7 @@ H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIu*si*siii", app_file, app_func, app_line, link_target, link_loc_id, link_name, lcpl_id, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIu*si*siii", app_file, app_func, app_line, link_target, link_loc_id, link_name, lcpl_id, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -608,7 +608,7 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj_ptr->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -903,7 +903,7 @@ H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1031,7 +1031,7 @@ H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_ if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1276,7 +1276,7 @@ H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) if (H5ES_insert(es_id, vol_obj->connector, token, /* clang-format off */ - H5ARG_TRACE8(FUNC, "*s*sIui*s*bii", app_file, app_func, app_line, loc_id, name, exists, lapl_id, es_id)) < 0) + H5ARG_TRACE8(__func__, "*s*sIui*s*bii", app_file, app_func, app_line, loc_id, name, exists, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1742,7 +1742,7 @@ H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIuiIiIo*hLI*xi", app_file, app_func, app_line, group_id, idx_type, order, idx_p, op, op_data, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuiIiIo*hLI*xi", app_file, app_func, app_line, group_id, idx_type, order, idx_p, op, op_data, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5M.c b/src/H5M.c index c7d1bc9..b890a5c 100644 --- a/src/H5M.c +++ b/src/H5M.c @@ -390,7 +390,7 @@ H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(FUNC, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, es_id)) < 0) { + H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID") @@ -619,7 +619,7 @@ H5Mopen_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*sIui*sii", app_file, app_func, app_line, loc_id, name, mapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, mapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID") @@ -713,7 +713,7 @@ H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, map_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, map_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1088,7 +1088,7 @@ H5Mput_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_TRACE10(FUNC, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1226,7 +1226,7 @@ H5Mget_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_TRACE10(FUNC, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5O.c b/src/H5O.c index 3ad14dd..db3ff31 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -201,7 +201,7 @@ H5Oopen_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*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") @@ -334,7 +334,7 @@ H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) { + H5ARG_TRACE10(__func__, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") @@ -594,7 +594,7 @@ H5Ocopy_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_TRACE10(FUNC, "*s*sIui*si*siii", app_file, app_func, app_line, src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIui*si*siii", app_file, app_func, app_line, src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -700,7 +700,7 @@ H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, obj_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, obj_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -806,7 +806,7 @@ H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, oid, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, oid, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1250,7 +1250,7 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -2063,7 +2063,7 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, object_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, object_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5R.c b/src/H5R.c index 5fa2a8b..102af7f 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -610,7 +610,7 @@ H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") @@ -777,7 +777,7 @@ H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on region ID") @@ -946,7 +946,7 @@ H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, aapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, aapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, diff --git a/src/H5T.c b/src/H5T.c index 74b7655..1b0e8c9 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2045,7 +2045,7 @@ H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* If a token was created, add the token to the event set */ if (NULL != token) if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, type_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, type_id, es_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set") done: diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 451a1a8..d079e71 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -218,7 +218,7 @@ H5Tcommit_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -726,7 +726,7 @@ H5Topen_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*sIui*sii", app_file, app_func, app_line, loc_id, name, tapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, tapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index baedbf1..a61b003 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -1712,7 +1712,7 @@ H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_li 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) + 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") @@ -2556,7 +2556,7 @@ H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app 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) + 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") @@ -3259,7 +3259,7 @@ H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned ap 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) + 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") @@ -4078,7 +4078,7 @@ H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_li 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) + 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") @@ -4725,7 +4725,7 @@ H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_l 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) + 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") @@ -5514,7 +5514,7 @@ H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_li /* 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) + 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") @@ -6093,7 +6093,7 @@ H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_ /* 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) + 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") diff --git a/src/H5private.h b/src/H5private.h index ed17d4c..13570db 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1747,15 +1747,6 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #define H5_COLON_SEPC ':' -/* Use FUNC to safely handle variations of C99 __func__ keyword handling */ -#ifdef H5_HAVE_C99_FUNC -#define FUNC __func__ -#elif defined(H5_HAVE_FUNCTION) -#define FUNC __FUNCTION__ -#else -#error "We need __func__ or __FUNCTION__ to test function names!" -#endif - /* * These macros check whether debugging has been requested for a certain * package at run-time. Code for debugging is conditionally compiled by @@ -1836,51 +1827,52 @@ extern char H5libhdf5_settings[]; /* embedded library information */ #define H5TRACE0(R, T) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T) + CALLTIME = H5_trace(NULL, __func__, T) #define H5TRACE1(R, T, A0) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0) #define H5TRACE2(R, T, A0, A1) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1) #define H5TRACE3(R, T, A0, A1, A2) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2) #define H5TRACE4(R, T, A0, A1, A2, A3) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3) #define H5TRACE5(R, T, A0, A1, A2, A3, A4) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4) #define H5TRACE6(R, T, A0, A1, A2, A3, A4, A5) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5) #define H5TRACE7(R, T, A0, A1, A2, A3, A4, A5, A6) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6) #define H5TRACE8(R, T, A0, A1, A2, A3, A4, A5, A6, A7) \ - RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7) + RTYPE = R; \ + CALLTIME = \ + H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7) #define H5TRACE9(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8) #define H5TRACE10(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9) #define H5TRACE11(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9, #A10, A10) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9, #A10, A10) #define H5TRACE12(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11) #define H5TRACE_RETURN(V) \ if (RTYPE) { \ - H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \ + H5_trace(&CALLTIME, __func__, RTYPE, NULL, V); \ RTYPE = NULL; \ } #else @@ -2136,7 +2128,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; #define FUNC_ENTER_API_INIT(err) \ @@ -2211,7 +2203,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ { \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; \ BEGIN_MPE_LOG \ { @@ -2228,7 +2220,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ { \ { \ - FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; \ FUNC_ENTER_API_INIT(err); \ { @@ -2247,7 +2239,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ { \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \ { /* Note: this macro only works when there's _no_ interface initialization routine for the module */ @@ -2261,14 +2253,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Use this macro for all "normal" non-API functions */ #define FUNC_ENTER_NOAPI(err) \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ FUNC_ENTER_NOAPI_INIT(err) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for all non-API functions, which propagate errors, but don't issue them */ #define FUNC_ENTER_NOAPI_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ FUNC_ENTER_NOAPI_INIT(-) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2282,7 +2274,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NOINIT \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2297,7 +2289,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NOINIT_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2309,7 +2301,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NOFS \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ \ /* Initialize the package, if appropriate */ \ H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ @@ -2326,7 +2318,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NOERR_NOFS \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* @@ -2338,7 +2330,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NAMECHECK_ONLY \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); /* Use the following two macros as replacements for the FUNC_ENTER_NOAPI * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set @@ -2347,7 +2339,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5AC_tag(tag, &prev_tag); \ FUNC_ENTER_NOAPI_INIT(err) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2356,7 +2348,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2364,14 +2356,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Use this macro for all "normal" package-level functions */ #define FUNC_ENTER_PACKAGE \ { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for package-level functions which propgate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2381,7 +2373,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2389,14 +2381,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Use this macro for all "normal" staticly-scoped functions */ #define FUNC_ENTER_STATIC \ { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2404,7 +2396,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* And that shouldn't push their name on the function stack */ #define FUNC_ENTER_STATIC_NOERR_NOFS \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* @@ -2416,7 +2408,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_STATIC_NAMECHECK_ONLY \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); /* Use the following macro as replacement for the FUNC_ENTER_STATIC * macro when the function needs to set up a metadata tag. */ @@ -2424,7 +2416,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { diff --git a/test/cache.c b/test/cache.c index 78e902c..6ded559 100644 --- a/test/cache.c +++ b/test/cache.c @@ -280,17 +280,17 @@ smoke_check_1(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged); if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -308,7 +308,7 @@ smoke_check_1(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -326,7 +326,7 @@ smoke_check_1(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -344,7 +344,7 @@ smoke_check_1(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -354,7 +354,7 @@ smoke_check_1(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -367,7 +367,7 @@ smoke_check_1(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -377,7 +377,7 @@ smoke_check_1(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -390,12 +390,12 @@ smoke_check_1(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -409,7 +409,7 @@ smoke_check_1(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -478,17 +478,17 @@ smoke_check_2(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged); if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -506,7 +506,7 @@ smoke_check_2(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -524,7 +524,7 @@ smoke_check_2(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -542,7 +542,7 @@ smoke_check_2(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -552,7 +552,7 @@ smoke_check_2(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -565,7 +565,7 @@ smoke_check_2(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -575,7 +575,7 @@ smoke_check_2(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -588,12 +588,12 @@ smoke_check_2(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -607,7 +607,7 @@ smoke_check_2(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -675,17 +675,17 @@ smoke_check_3(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -703,7 +703,7 @@ smoke_check_3(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -721,7 +721,7 @@ smoke_check_3(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -739,7 +739,7 @@ smoke_check_3(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -749,7 +749,7 @@ smoke_check_3(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -762,7 +762,7 @@ smoke_check_3(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -772,7 +772,7 @@ smoke_check_3(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -785,12 +785,12 @@ smoke_check_3(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -804,7 +804,7 @@ smoke_check_3(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -873,17 +873,17 @@ smoke_check_4(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -901,7 +901,7 @@ smoke_check_4(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -919,7 +919,7 @@ smoke_check_4(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -937,7 +937,7 @@ smoke_check_4(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -947,7 +947,7 @@ smoke_check_4(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -960,7 +960,7 @@ smoke_check_4(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -970,7 +970,7 @@ smoke_check_4(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -983,12 +983,12 @@ smoke_check_4(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -1002,7 +1002,7 @@ smoke_check_4(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -1116,12 +1116,12 @@ smoke_check_5(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); cache_ptr = file_ptr->shared->cache; @@ -1138,7 +1138,7 @@ smoke_check_5(int express_test, unsigned paged) } if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1149,7 +1149,7 @@ smoke_check_5(int express_test, unsigned paged) /* do_inserts */ FALSE); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1160,7 +1160,7 @@ smoke_check_5(int express_test, unsigned paged) /* do_inserts */ FALSE); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1171,7 +1171,7 @@ smoke_check_5(int express_test, unsigned paged) /* do_inserts */ TRUE); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -1181,7 +1181,7 @@ smoke_check_5(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1193,7 +1193,7 @@ smoke_check_5(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -1203,7 +1203,7 @@ smoke_check_5(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1215,12 +1215,12 @@ smoke_check_5(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -1234,7 +1234,7 @@ smoke_check_5(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -1348,12 +1348,12 @@ smoke_check_6(int express_test, unsigned paged) } if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); cache_ptr = file_ptr->shared->cache; @@ -1370,7 +1370,7 @@ smoke_check_6(int express_test, unsigned paged) } if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1381,7 +1381,7 @@ smoke_check_6(int express_test, unsigned paged) /* do_inserts */ FALSE); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1392,7 +1392,7 @@ smoke_check_6(int express_test, unsigned paged) /* do_inserts */ FALSE); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1403,7 +1403,7 @@ smoke_check_6(int express_test, unsigned paged) /* do_inserts */ TRUE); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -1413,7 +1413,7 @@ smoke_check_6(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1425,7 +1425,7 @@ smoke_check_6(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -1435,7 +1435,7 @@ smoke_check_6(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1447,12 +1447,12 @@ smoke_check_6(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -1466,7 +1466,7 @@ smoke_check_6(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -1581,12 +1581,12 @@ smoke_check_7(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); cache_ptr = file_ptr->shared->cache; @@ -1603,7 +1603,7 @@ smoke_check_7(int express_test, unsigned paged) } if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1614,7 +1614,7 @@ smoke_check_7(int express_test, unsigned paged) /* do_inserts */ FALSE); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1625,7 +1625,7 @@ smoke_check_7(int express_test, unsigned paged) /* do_inserts */ FALSE); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1636,7 +1636,7 @@ smoke_check_7(int express_test, unsigned paged) /* do_inserts */ TRUE); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -1646,7 +1646,7 @@ smoke_check_7(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1658,7 +1658,7 @@ smoke_check_7(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -1668,7 +1668,7 @@ smoke_check_7(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1680,12 +1680,12 @@ smoke_check_7(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -1699,7 +1699,7 @@ smoke_check_7(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -1814,12 +1814,12 @@ smoke_check_8(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); cache_ptr = file_ptr->shared->cache; @@ -1836,7 +1836,7 @@ smoke_check_8(int express_test, unsigned paged) } if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1847,7 +1847,7 @@ smoke_check_8(int express_test, unsigned paged) /* do_inserts */ FALSE); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1858,7 +1858,7 @@ smoke_check_8(int express_test, unsigned paged) /* do_inserts */ FALSE); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1869,7 +1869,7 @@ smoke_check_8(int express_test, unsigned paged) /* do_inserts */ TRUE); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -1879,7 +1879,7 @@ smoke_check_8(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1891,7 +1891,7 @@ smoke_check_8(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -1901,7 +1901,7 @@ smoke_check_8(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); hl_col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -1913,12 +1913,12 @@ smoke_check_8(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -1932,7 +1932,7 @@ smoke_check_8(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -2011,12 +2011,12 @@ smoke_check_9(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged); cache_ptr = file_ptr->shared->cache; @@ -2024,7 +2024,7 @@ smoke_check_9(int express_test, unsigned paged) /* disable evictions */ if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2038,7 +2038,8 @@ smoke_check_9(int express_test, unsigned paged) } if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", __func__, mile_stone++, + (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2058,7 +2059,7 @@ smoke_check_9(int express_test, unsigned paged) /* enable evictions */ if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2072,7 +2073,8 @@ smoke_check_9(int express_test, unsigned paged) } if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", __func__, mile_stone++, + (int)pass); row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2090,7 +2092,7 @@ smoke_check_9(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2104,7 +2106,8 @@ smoke_check_9(int express_test, unsigned paged) } if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled \n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled \n", __func__, mile_stone++, + (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2122,7 +2125,7 @@ smoke_check_9(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2136,7 +2139,8 @@ smoke_check_9(int express_test, unsigned paged) } if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", __func__, mile_stone++, + (int)pass); /* flush and destroy all entries in the cache: */ @@ -2146,7 +2150,7 @@ smoke_check_9(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2160,7 +2164,8 @@ smoke_check_9(int express_test, unsigned paged) } if (show_progress) /* 12 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", __func__, mile_stone++, + (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2173,7 +2178,7 @@ smoke_check_9(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 13 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush all entries in the cache: */ @@ -2183,7 +2188,7 @@ smoke_check_9(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 14 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2197,7 +2202,8 @@ smoke_check_9(int express_test, unsigned paged) } if (show_progress) /* 15 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", __func__, mile_stone++, + (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2210,7 +2216,7 @@ smoke_check_9(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 16 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2224,12 +2230,13 @@ smoke_check_9(int express_test, unsigned paged) } if (show_progress) /* 17 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", __func__, mile_stone++, + (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 18 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -2243,7 +2250,7 @@ smoke_check_9(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -2322,18 +2329,19 @@ smoke_check_10(int express_test, unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged); cache_ptr = file_ptr->shared->cache; if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", __func__, mile_stone++, + (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2351,7 +2359,7 @@ smoke_check_10(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2365,7 +2373,8 @@ smoke_check_10(int express_test, unsigned paged) } if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", __func__, mile_stone++, + (int)pass); row_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2383,7 +2392,7 @@ smoke_check_10(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2397,7 +2406,8 @@ smoke_check_10(int express_test, unsigned paged) } if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", __func__, mile_stone++, + (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2415,7 +2425,7 @@ smoke_check_10(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2429,7 +2439,8 @@ smoke_check_10(int express_test, unsigned paged) } if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", __func__, mile_stone++, + (int)pass); /* flush and destroy all entries in the cache: */ @@ -2439,7 +2450,7 @@ smoke_check_10(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2453,7 +2464,8 @@ smoke_check_10(int express_test, unsigned paged) } if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", __func__, mile_stone++, + (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2466,7 +2478,7 @@ smoke_check_10(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 12 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2480,7 +2492,8 @@ smoke_check_10(int express_test, unsigned paged) } if (show_progress) /* 13 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", __func__, mile_stone++, + (int)pass); /* flush all entries in the cache: */ @@ -2490,7 +2503,7 @@ smoke_check_10(int express_test, unsigned paged) /* dump_detailed_stats */ FALSE); if (show_progress) /* 14 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2504,7 +2517,8 @@ smoke_check_10(int express_test, unsigned paged) } if (show_progress) /* 15 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", __func__, mile_stone++, + (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2517,7 +2531,7 @@ smoke_check_10(int express_test, unsigned paged) /* dirty_unprotects */ dirty_unprotects); if (show_progress) /* 16 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -2531,12 +2545,13 @@ smoke_check_10(int express_test, unsigned paged) } if (show_progress) /* 17 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", __func__, mile_stone++, + (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 18 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -2550,7 +2565,7 @@ smoke_check_10(int express_test, unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -2625,17 +2640,17 @@ write_permitted_check(int pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); reset_entries(); if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)0, paged); if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2653,7 +2668,7 @@ write_permitted_check(int /* dirty_unprotects */ TRUE); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); write_permitted = FALSE; @@ -2673,7 +2688,7 @@ write_permitted_check(int /* dirty_unprotects */ NO_CHANGE); if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); write_permitted = TRUE; @@ -2693,7 +2708,7 @@ write_permitted_check(int /* dirty_unprotects */ TRUE); if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* flush and destroy all entries in the cache: */ @@ -2703,7 +2718,7 @@ write_permitted_check(int /* dump_detailed_stats */ FALSE); if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, /* max_index */ max_index, @@ -2716,7 +2731,7 @@ write_permitted_check(int /* dirty_unprotects */ TRUE); if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); write_permitted = FALSE; @@ -2733,12 +2748,12 @@ write_permitted_check(int write_permitted = TRUE; if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); takedown_cache(file_ptr, display_stats, TRUE); if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); verify_clean(); verify_unprotected(); @@ -2752,7 +2767,7 @@ write_permitted_check(int if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } #else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ @@ -3046,7 +3061,7 @@ check_insert_entry(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -3135,7 +3150,7 @@ check_flush_cache(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -12673,7 +12688,7 @@ check_get_entry_status(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -12954,7 +12969,7 @@ check_expunge_entry(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -13345,7 +13360,7 @@ check_multiple_read_protect(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -13445,7 +13460,7 @@ check_move_entry(unsigned paged) H5_FAILED() if (!pass) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); return (unsigned)!pass; } /* check_move_entry() */ @@ -13703,7 +13718,7 @@ check_pin_protected_entry(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -14571,7 +14586,7 @@ check_resize_entry(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -14656,7 +14671,7 @@ check_evictions_enabled(unsigned paged) pass = TRUE; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* create the cache */ if (pass) { @@ -14678,7 +14693,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that it is empty */ if (pass) { @@ -14694,7 +14709,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that H5C_get_evictions_enabled() returns the expected value */ if (pass) { @@ -14710,7 +14725,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14722,7 +14737,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that the cache is full */ if (pass) { @@ -14738,7 +14753,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14748,7 +14763,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that an entry has been evicted */ if (pass) { @@ -14764,7 +14779,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14794,7 +14809,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14803,7 +14818,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that another entry has been evicted */ if (pass) { @@ -14820,7 +14835,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14850,7 +14865,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 12 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* disable evictions */ if (pass) { @@ -14866,7 +14881,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 13 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that evictions are disabled */ if (pass) { @@ -14883,7 +14898,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 14 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14893,7 +14908,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 15 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that no entry has been evicted */ if (pass) { @@ -14910,7 +14925,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 16 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14919,7 +14934,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 17 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that no entry has been evicted */ if (pass) { @@ -14936,7 +14951,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 18 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* re-enable evictions */ if (pass) { @@ -14952,7 +14967,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 19 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14962,7 +14977,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 20 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that no entries have been evicted */ if (pass) { @@ -14979,7 +14994,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 21 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -14989,7 +15004,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 22 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that the entries have been evicted to bring the * cache back down to its normal size. @@ -15009,7 +15024,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 23 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -15039,7 +15054,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 24 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -15069,7 +15084,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 25 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* disable evictions again */ if (pass) { @@ -15085,7 +15100,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 26 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -15097,7 +15112,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 27 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that the cache has grown */ if (pass) { @@ -15114,7 +15129,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 28 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* re-enable evictions again */ if (pass) { @@ -15130,7 +15145,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 29 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -15139,7 +15154,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 30 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* verify that the cache has returned to its maximum size */ if (pass) { @@ -15156,7 +15171,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 31 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -15186,7 +15201,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 32 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* disable evictions one last time before we shut down */ if (pass) { @@ -15202,7 +15217,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 33 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -15210,7 +15225,7 @@ check_evictions_enabled(unsigned paged) } if (show_progress) /* 34 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { PASSED(); @@ -15221,7 +15236,7 @@ check_evictions_enabled(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -15319,7 +15334,7 @@ check_flush_protected_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -15408,7 +15423,7 @@ check_destroy_pinned_err(unsigned paged) } if (!pass) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); return (unsigned)!pass; @@ -15504,7 +15519,7 @@ check_destroy_protected_err(unsigned paged) } if (!pass) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); return (unsigned)!pass; @@ -15585,7 +15600,7 @@ check_duplicate_insert_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -15674,7 +15689,7 @@ check_double_pin_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -15772,7 +15787,7 @@ check_double_unpin_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -15884,7 +15899,7 @@ check_pin_entry_errs(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -15966,7 +15981,7 @@ check_double_protect_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -16044,7 +16059,7 @@ check_double_unprotect_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -16126,7 +16141,7 @@ check_mark_entry_dirty_errs(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -16243,7 +16258,7 @@ check_expunge_entry_errs(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -16360,7 +16375,7 @@ check_move_entry_errs(unsigned paged) else { H5_FAILED() - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } /* end else */ return (unsigned)!pass; @@ -16460,7 +16475,7 @@ check_resize_entry_errs(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -16581,7 +16596,7 @@ check_unprotect_ro_dirty_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -16668,7 +16683,7 @@ check_protect_ro_rw_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -16797,7 +16812,7 @@ check_protect_retries(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_msg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_msg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -16937,7 +16952,7 @@ check_check_evictions_enabled_err(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -20803,7 +20818,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) } /* end else */ if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return (unsigned)!pass; } /* check_auto_cache_resize() */ @@ -23403,7 +23418,7 @@ check_auto_cache_resize_disable(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -24090,7 +24105,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -26322,7 +26337,7 @@ check_auto_cache_resize_input_errs(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -26818,7 +26833,7 @@ check_auto_cache_resize_aux_fcns(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -27048,7 +27063,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } /* end else */ if (show_progress) /* 0 */ - HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (pass) { @@ -27069,7 +27084,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 1 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); /* ======================================================================== * ======================================================================== @@ -27132,7 +27147,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 2 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); /* ======================================================================== * ======================================================================== @@ -27202,7 +27217,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 3 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (pass) { @@ -27256,7 +27271,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 4 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (pass) { @@ -27309,7 +27324,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 5 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); /* ======================================================================== * ======================================================================== @@ -27384,7 +27399,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 6 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (pass) { @@ -27455,7 +27470,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 7 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); /* ======================================================================== * ======================================================================== @@ -27514,7 +27529,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 8 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (pass) { @@ -27562,7 +27577,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 9 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (pass) { @@ -27613,7 +27628,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 10 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (pass) { @@ -27659,7 +27674,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 11 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (cache_ptr) { @@ -27669,7 +27684,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } if (show_progress) /* 12 */ - HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); + HDfprintf(stdout, "%s: check point %d -- pass %d\n", __func__, checkpoint++, pass); if (pass) { PASSED(); @@ -33629,7 +33644,7 @@ check_entry_deletions_during_scans(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } return (unsigned)!pass; @@ -35040,7 +35055,7 @@ check_stats(unsigned paged) if (!pass) { - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", __func__, failure_mssg); } #else /* H5C_COLLECT_CACHE_STATS */ @@ -35520,7 +35535,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) hid_t fcpl_id = H5P_DEFAULT; if (show_progress) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); saved_fid = -1; @@ -35563,7 +35578,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) } if (show_progress) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass && try_core_file_driver) { if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL) { @@ -35580,7 +35595,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) core_file_driver_failed = TRUE; if (verbose) - HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", FUNC); + HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", __func__); } else { saved_fapl_id = fapl_id; @@ -35588,7 +35603,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) } if (show_progress) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); /* if we either aren't using the core file driver, or a create * with the core file driver failed, try again with a regular file. @@ -35603,7 +35618,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) failure_mssg = "H5Fcreate() failed."; if (verbose) - HDfprintf(stdout, "%s: H5Fcreate() failed.\n", FUNC); + HDfprintf(stdout, "%s: H5Fcreate() failed.\n", __func__); } /* end if */ } /* end if */ @@ -35611,7 +35626,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) H5CX_push(); if (show_progress) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { HDassert(fid >= 0); @@ -35621,7 +35636,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) failure_mssg = "H5Fflush() failed."; if (verbose) - HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); + HDfprintf(stdout, "%s: H5Fflush() failed.\n", __func__); } else { file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE); @@ -35630,13 +35645,13 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) failure_mssg = "Can't get file_ptr."; if (verbose) - HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); + HDfprintf(stdout, "%s: H5Fflush() failed.\n", __func__); } } } if (show_progress) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { @@ -35679,7 +35694,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) } if (show_progress) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { if (cache_ptr == NULL) { @@ -35687,19 +35702,19 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) failure_mssg = "H5C_create() failed."; if (verbose) - HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC); + HDfprintf(stdout, "%s: H5C_create() failed.\n", __func__); } else if (cache_ptr->magic != H5C__H5C_T_MAGIC) { pass = FALSE; failure_mssg = "Bad cache_ptr magic."; if (verbose) - HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC); + HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", __func__); } } if (show_progress) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { /* allocate space for test entries */ actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); @@ -35709,7 +35724,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) failure_mssg = "H5MF_alloc() failed."; if (verbose) - HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", FUNC); + HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", __func__); } else if (actual_base_addr > BASE_ADDR) { /* If this happens, must increase BASE_ADDR so that the @@ -35720,14 +35735,14 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) failure_mssg = "actual_base_addr > BASE_ADDR"; if (verbose) - HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", FUNC); + HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", __func__); } saved_actual_base_addr = actual_base_addr; } if (show_progress) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); if (pass) { /* Need to set this else all cache tests will fail */ @@ -35738,7 +35753,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged) } if (show_progress) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", __func__, mile_stone++, (int)pass); return (ret_val); } /* setup_cache() */ diff --git a/test/cache_api.c b/test/cache_api.c index 5d0f395..7858c65 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -478,7 +478,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return pass; @@ -821,7 +821,7 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return pass; @@ -1463,7 +1463,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return pass; @@ -1841,7 +1841,7 @@ check_fapl_mdc_api_errs(void) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return pass; @@ -1894,7 +1894,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: calling h5_fixname().\n", FUNC); + HDfprintf(stdout, "%s: calling h5_fixname().\n", __func__); } if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) { @@ -1908,7 +1908,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: calling H5Fcreate().\n", FUNC); + HDfprintf(stdout, "%s: calling H5Fcreate().\n", __func__); } file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); @@ -1929,7 +1929,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", __func__); } H5E_BEGIN_TRY @@ -1949,7 +1949,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", __func__); } H5E_BEGIN_TRY @@ -1970,7 +1970,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", __func__); } H5E_BEGIN_TRY @@ -1993,7 +1993,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", __func__); } H5E_BEGIN_TRY @@ -2013,7 +2013,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", __func__); } H5E_BEGIN_TRY @@ -2033,7 +2033,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) while ((pass) && (i < NUM_INVALID_CONFIGS)) { if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fset_mdc_config() with invalid config %d.\n", FUNC, i); + HDfprintf(stdout, "%s: testing H5Fset_mdc_config() with invalid config %d.\n", __func__, i); } H5E_BEGIN_TRY @@ -2061,7 +2061,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", __func__); } H5E_BEGIN_TRY @@ -2081,7 +2081,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", __func__); } H5E_BEGIN_TRY @@ -2102,7 +2102,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", FUNC); + HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", __func__); } H5E_BEGIN_TRY @@ -2123,7 +2123,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", __func__); } H5E_BEGIN_TRY @@ -2143,7 +2143,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", FUNC); + HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", __func__); } if ((H5Fget_mdc_size(file_id, &max_size, NULL, NULL, NULL) < 0) || @@ -2162,7 +2162,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (show_progress) { - HDfprintf(stdout, "%s: cleaning up from tests.\n", FUNC); + HDfprintf(stdout, "%s: cleaning up from tests.\n", __func__); } if (H5Fclose(file_id) < 0) { @@ -2188,7 +2188,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) if (!pass) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); } return pass; @@ -2230,26 +2230,26 @@ main(void) invalid_configs = init_invalid_configs(); if (NULL == invalid_configs) { failure_mssg = "Unable to allocate memory for invalid configs."; - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return EXIT_FAILURE; } /* end if */ if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) { failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n"; - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return EXIT_FAILURE; } /* end if */ /* Set file space strategy to default or paged aggregation strategy */ if ((fcpl2_id = H5Pcopy(fcpl_id)) < 0) { failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n"; - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return EXIT_FAILURE; } /* end if */ if (H5Pset_file_space_strategy(fcpl2_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0) { failure_mssg = "H5Pset_file_space_strategy() failed.\n"; - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return EXIT_FAILURE; } /* end if */ @@ -2282,7 +2282,7 @@ main(void) if (H5Pclose(fcpl_id) < 0) { failure_mssg = "H5Pclose() failed.\n"; - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return EXIT_FAILURE; } /* end if */ diff --git a/test/cache_common.c b/test/cache_common.c index 0ddcbb8..07c70f0 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -2770,7 +2770,7 @@ flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_ if (verbose) { - HDfprintf(stdout, "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", FUNC, + HDfprintf(stdout, "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", __func__, (long long)(cache_ptr->index_len), (long long)(cache_ptr->index_size), (long long)(cache_ptr->clean_index_size), (long long)(cache_ptr->dirty_index_size)); } @@ -3524,7 +3524,7 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t int32_t local_max_index; if (verbose) - HDfprintf(stdout, "%s(): entering.\n", FUNC); + HDfprintf(stdout, "%s(): entering.\n", __func__); if (pass) { cache_ptr = file_ptr->shared->cache; @@ -3856,7 +3856,7 @@ hl_row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, h int32_t local_max_index; if (verbose) - HDfprintf(stdout, "%s(): entering.\n", FUNC); + HDfprintf(stdout, "%s(): entering.\n", __func__); if (pass) { @@ -3948,7 +3948,7 @@ row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t int32_t local_max_index; if (verbose) - HDfprintf(stdout, "%s(): Entering.\n", FUNC); + HDfprintf(stdout, "%s(): Entering.\n", __func__); if (pass) { @@ -4208,7 +4208,7 @@ hl_row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, int32_t local_max_index; if (verbose) - HDfprintf(stdout, "%s(): entering.\n", FUNC); + HDfprintf(stdout, "%s(): entering.\n", __func__); if (pass) { @@ -4299,7 +4299,7 @@ col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t int32_t local_max_index[NUMBER_OF_ENTRY_TYPES]; if (verbose) - HDfprintf(stdout, "%s: entering.\n", FUNC); + HDfprintf(stdout, "%s: entering.\n", __func__); if (pass) { int i; @@ -4393,7 +4393,7 @@ hl_col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, h int32_t local_max_index; if (verbose) - HDfprintf(stdout, "%s: entering.\n", FUNC); + HDfprintf(stdout, "%s: entering.\n", __func__); if (pass) { @@ -4495,7 +4495,7 @@ col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t int32_t local_max_index[NUMBER_OF_ENTRY_TYPES] = {0}; if (verbose) - HDfprintf(stdout, "%s: entering.\n", FUNC); + HDfprintf(stdout, "%s: entering.\n", __func__); if (pass) { int i; @@ -4518,7 +4518,7 @@ col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t idx = local_max_index[NUMBER_OF_ENTRY_TYPES - 1] + lag; if (verbose) /* 1 */ - HDfprintf(stdout, "%s: point %d.\n", FUNC, mile_stone++); + HDfprintf(stdout, "%s: point %d.\n", __func__, mile_stone++); while ((pass) && ((idx + lag) >= 0)) { type = NUMBER_OF_ENTRY_TYPES - 1; @@ -4560,7 +4560,7 @@ col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t } if (verbose) /* 2 */ - HDfprintf(stdout, "%s: point %d.\n", FUNC, mile_stone++); + HDfprintf(stdout, "%s: point %d.\n", __func__, mile_stone++); if ((pass) && (display_stats)) { @@ -4568,7 +4568,7 @@ col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t } if (verbose) - HDfprintf(stdout, "%s: exiting.\n", FUNC); + HDfprintf(stdout, "%s: exiting.\n", __func__); } /* col_major_scan_backward() */ @@ -4600,7 +4600,7 @@ hl_col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, int32_t local_max_index = -1; if (verbose) - HDfprintf(stdout, "%s: entering.\n", FUNC); + HDfprintf(stdout, "%s: entering.\n", __func__); if (pass) { diff --git a/test/cache_image.c b/test/cache_image.c index 40d6f05..4967066 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -1473,7 +1473,7 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -1719,7 +1719,7 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -2093,7 +2093,7 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -2429,7 +2429,7 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -2718,7 +2718,7 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -2969,7 +2969,7 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -3418,7 +3418,7 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -3694,7 +3694,7 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -4082,7 +4082,7 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -4461,7 +4461,7 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; } /* cache_image_smoke_check_4() */ @@ -4965,7 +4965,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -5382,7 +5382,7 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -5738,7 +5738,7 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -6166,7 +6166,7 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -6421,7 +6421,7 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -6978,7 +6978,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -7436,7 +7436,7 @@ get_free_sections_test(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; @@ -7809,7 +7809,7 @@ evict_on_close_test(hbool_t single_file_vfd) } if (!pass) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", __func__, failure_mssg); return !pass; #endif /* H5_HAVE_PARALLEL */ diff --git a/test/h5test.h b/test/h5test.h index 89e30da..16fb33c 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -89,7 +89,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ /* * Print the current location on the standard output stream. */ -#define AT() HDprintf(" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define AT() HDprintf(" at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); /* * The name of the test is printed by saying TESTING("something") which will diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index 5840a98..b1ca00f 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -29,15 +29,6 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g; H5TOOLS_DLLVAR hid_t H5E_tools_min_info_id_g; H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; -/* Use FUNC to safely handle variations of C99 __func__ keyword handling */ -#ifdef H5_HAVE_C99_FUNC -#define FUNC __func__ -#elif defined(H5_HAVE_FUNCTION) -#define FUNC __FUNCTION__ -#else -#error "We need __func__ or __FUNCTION__ to test function names!" -#endif - /* * H5TOOLS_INIT_ERROR macro, used to initialize error reporting. */ @@ -105,7 +96,8 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; do { \ if (enable_error_stack > 0) { \ if (estack_id >= 0 && err_cls >= 0) \ - H5Epush2(estack_id, __FILE__, FUNC, __LINE__, err_cls, maj_err_id, min_err_id, __VA_ARGS__); \ + H5Epush2(estack_id, __FILE__, __func__, __LINE__, err_cls, maj_err_id, min_err_id, \ + __VA_ARGS__); \ else { \ HDfprintf(stderr, __VA_ARGS__); \ HDfprintf(stderr, "\n"); \ @@ -175,7 +167,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; #define H5TOOLS_START_DEBUG(...) \ do { \ H5tools_INDENT_g += 2; \ - HDfprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \ + HDfprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, __func__); \ HDfprintf(stderr, __VA_ARGS__); \ HDfprintf(stderr, "\n"); \ HDfflush(stderr); \ @@ -183,7 +175,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; #define H5TOOLS_DEBUG(...) \ do { \ - HDfprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \ + HDfprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, __func__); \ HDfprintf(stderr, __VA_ARGS__); \ HDfprintf(stderr, "\n"); \ HDfflush(stderr); \ @@ -191,7 +183,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; #define H5TOOLS_ENDDEBUG(...) \ do { \ - HDfprintf(stderr, "%*sEXIT %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \ + HDfprintf(stderr, "%*sEXIT %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, __func__); \ HDfprintf(stderr, __VA_ARGS__); \ HDfprintf(stderr, "\n"); \ H5tools_INDENT_g -= 2; \ diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c index 429ad42..6898839 100644 --- a/tools/test/h5copy/h5copygentest.c +++ b/tools/test/h5copy/h5copygentest.c @@ -513,21 +513,21 @@ gen_obj_ref(hid_t loc_id) * add dataset */ sid = H5Screate_simple(1, dims1, NULL); if (sid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } oid = H5Dcreate2(loc_id, OBJ_REF_DS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } status = H5Dwrite(oid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -539,7 +539,7 @@ gen_obj_ref(hid_t loc_id) * add group */ oid = H5Gcreate2(loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -547,34 +547,34 @@ gen_obj_ref(hid_t loc_id) status = H5Rcreate(&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } status = H5Rcreate(&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } sid = H5Screate_simple(1, dims2, NULL); if (sid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } oid = H5Dcreate2(loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, or_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -613,7 +613,7 @@ gen_region_ref(hid_t loc_id) sid = H5Screate_simple(2, dims2, NULL); if (sid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -621,7 +621,7 @@ gen_region_ref(hid_t loc_id) /* create normal dataset which is refered */ oid2 = H5Dcreate2(loc_id, REG_REF_DS2, H5T_STD_I8LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid2 < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -629,7 +629,7 @@ gen_region_ref(hid_t loc_id) /* write values to dataset */ status = H5Dwrite(oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -637,7 +637,7 @@ gen_region_ref(hid_t loc_id) /* select elements space for reference */ status = H5Sselect_elements(sid, H5S_SELECT_SET, 4, coords[0]); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -645,7 +645,7 @@ gen_region_ref(hid_t loc_id) /* create region reference from elements space */ status = H5Rcreate(&rr_data[0], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -653,7 +653,7 @@ gen_region_ref(hid_t loc_id) /* select hyperslab space for reference */ status = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -661,7 +661,7 @@ gen_region_ref(hid_t loc_id) /* create region reference from hyperslab space */ status = H5Rcreate(&rr_data[1], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -671,7 +671,7 @@ gen_region_ref(hid_t loc_id) /* Create dataspace. */ sid = H5Screate_simple(1, dims1, NULL); if (sid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -679,7 +679,7 @@ gen_region_ref(hid_t loc_id) /* create region reference dataset */ oid1 = H5Dcreate2(loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid1 < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -687,7 +687,7 @@ gen_region_ref(hid_t loc_id) /* write data as region references */ status = H5Dwrite(oid1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -816,7 +816,7 @@ gen_extlink_trg(hid_t loc_id) * target file */ gid = H5Gcreate2(loc_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -831,7 +831,7 @@ gen_extlink_trg(hid_t loc_id) tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(loc_id, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -864,7 +864,7 @@ gen_extlink_src(hid_t loc_id) *------------------------------------------------------------------------*/ gid = H5Gcreate2(loc_id, "/group_ext", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -875,7 +875,7 @@ gen_extlink_src(hid_t loc_id) /* link to dataset */ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/simple", gid, "extlink_dset", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -883,7 +883,7 @@ gen_extlink_src(hid_t loc_id) /* link to group */ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/group", gid, "extlink_grp", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -892,7 +892,7 @@ gen_extlink_src(hid_t loc_id) status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/datatype", gid, "extlink_datatype", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -900,7 +900,7 @@ gen_extlink_src(hid_t loc_id) /* dangling link - no obj*/ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "notyet", gid, "extlink_notyet1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -908,7 +908,7 @@ gen_extlink_src(hid_t loc_id) /* dangling link - no file */ status = H5Lcreate_external("notyet_file.h5", "notyet", gid, "extlink_notyet2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __func__, __LINE__); ret = FAIL; goto out; } diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index f03254e..118a3a7 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -112,7 +112,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define SPACE1_DIM2 0 /* Error macros */ -#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); #define PROGRAM_ERROR \ do { \ AT(); \ diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 3396217..acad74e 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -6058,7 +6058,7 @@ add_attr_with_objref(hid_t file_id, hid_t obj_id) /* ref to dset */ status = H5Rcreate(&data_attr_objref[0], file_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6066,7 +6066,7 @@ add_attr_with_objref(hid_t file_id, hid_t obj_id) /* ref to group */ status = H5Rcreate(&data_attr_objref[1], file_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6074,7 +6074,7 @@ add_attr_with_objref(hid_t file_id, hid_t obj_id) /* ref to datatype */ status = H5Rcreate(&data_attr_objref[2], file_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6082,7 +6082,7 @@ add_attr_with_objref(hid_t file_id, hid_t obj_id) /* create attr with obj ref type */ status = make_attr(obj_id, 1, dim_attr_objref, "Attr_OBJREF", H5T_STD_REF_OBJ, data_attr_objref); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6122,7 +6122,7 @@ add_attr_with_regref(hid_t file_id, hid_t obj_id) */ sid_regrefed_dset = H5Screate_simple(2, dim_regrefed_dset, NULL); if (sid_regrefed_dset < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6130,7 +6130,7 @@ add_attr_with_regref(hid_t file_id, hid_t obj_id) /* select elements space for reference */ status = H5Sselect_elements(sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6138,7 +6138,7 @@ add_attr_with_regref(hid_t file_id, hid_t obj_id) /* create region reference from elements space */ status = H5Rcreate(&data_attr_regref[0], file_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_regrefed_dset); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6146,7 +6146,7 @@ add_attr_with_regref(hid_t file_id, hid_t obj_id) /* create attr with region ref type */ status = make_attr(obj_id, 1, dim_attr_regref, "Attr_REGREF", H5T_STD_REF_DSETREG, data_attr_regref); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6191,21 +6191,21 @@ gen_refered_objs(hid_t loc_id) */ sid = H5Screate_simple(1, dims1, NULL); if (sid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } did1 = H5Dcreate2(loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (did1 < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6216,7 +6216,7 @@ gen_refered_objs(hid_t loc_id) */ gid = H5Gcreate2(loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6228,7 +6228,7 @@ gen_refered_objs(hid_t loc_id) tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6239,7 +6239,7 @@ gen_refered_objs(hid_t loc_id) */ sid2 = H5Screate_simple(2, dims2, NULL); if (sid2 < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6247,7 +6247,7 @@ gen_refered_objs(hid_t loc_id) /* create normal dataset which is refered */ did2 = H5Dcreate2(loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (did2 < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6255,7 +6255,7 @@ gen_refered_objs(hid_t loc_id) /* write values to dataset */ status = H5Dwrite(did2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6311,7 +6311,7 @@ gen_obj_ref(hid_t loc_id) /* obj ref to dataset */ status = H5Rcreate(&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6319,7 +6319,7 @@ gen_obj_ref(hid_t loc_id) /* obj ref to group */ status = H5Rcreate(&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6327,7 +6327,7 @@ gen_obj_ref(hid_t loc_id) /* obj ref to named-datatype */ status = H5Rcreate(&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6337,21 +6337,21 @@ gen_obj_ref(hid_t loc_id) */ sid = H5Screate_simple(1, dims_dset_objref, NULL); if (sid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } oid = H5Dcreate2(loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, objref_buf); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6363,7 +6363,7 @@ gen_obj_ref(hid_t loc_id) /* add attribute with obj ref */ status = add_attr_with_objref(loc_id, oid); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6371,7 +6371,7 @@ gen_obj_ref(hid_t loc_id) /* add attribute with region ref */ status = add_attr_with_regref(loc_id, oid); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6423,7 +6423,7 @@ gen_region_ref(hid_t loc_id) sid_trg = H5Screate_simple(2, dims_trg, NULL); if (sid_trg < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6431,7 +6431,7 @@ gen_region_ref(hid_t loc_id) /* select elements space for reference */ status = H5Sselect_elements(sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6439,7 +6439,7 @@ gen_region_ref(hid_t loc_id) /* create region reference from elements space */ status = H5Rcreate(&rr_data[0], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6447,7 +6447,7 @@ gen_region_ref(hid_t loc_id) /* select hyperslab space for reference */ status = H5Sselect_hyperslab(sid_trg, H5S_SELECT_SET, start, stride, count, block); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6455,7 +6455,7 @@ gen_region_ref(hid_t loc_id) /* create region reference from hyperslab space */ status = H5Rcreate(&rr_data[1], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6463,7 +6463,7 @@ gen_region_ref(hid_t loc_id) /* Create dataspace. */ sid_ref = H5Screate_simple(1, dims1, NULL); if (sid_ref < 0) { - HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6472,7 +6472,7 @@ gen_region_ref(hid_t loc_id) oid_ref = H5Dcreate2(loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid_ref, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid_ref < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6480,7 +6480,7 @@ gen_region_ref(hid_t loc_id) /* write data as region references */ status = H5Dwrite(oid_ref, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6492,7 +6492,7 @@ gen_region_ref(hid_t loc_id) /* add attribute with obj ref */ status = add_attr_with_objref(loc_id, oid_ref); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6500,7 +6500,7 @@ gen_region_ref(hid_t loc_id) /* add attribute with region ref */ status = add_attr_with_regref(loc_id, oid_ref); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6667,7 +6667,7 @@ make_complex_attr_references(hid_t loc_id) objdid = H5Dcreate2(loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, objsid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(objdid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6676,7 +6676,7 @@ make_complex_attr_references(hid_t loc_id) objtid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, objtid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6687,7 +6687,7 @@ make_complex_attr_references(hid_t loc_id) * compound type which contain obj and region reference */ main_gid = H5Gcreate2(loc_id, "group_main", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (main_gid < 0) { - HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6702,7 +6702,7 @@ make_complex_attr_references(hid_t loc_id) status = H5Dwrite(main_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6725,7 +6725,7 @@ make_complex_attr_references(hid_t loc_id) /* references to dataset */ status = H5Rcreate(&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6734,7 +6734,7 @@ make_complex_attr_references(hid_t loc_id) /* references to group */ status = H5Rcreate(&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6743,7 +6743,7 @@ make_complex_attr_references(hid_t loc_id) /* references to datatype */ status = H5Rcreate(&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6757,7 +6757,7 @@ make_complex_attr_references(hid_t loc_id) H5Acreate2(main_did, "Comp_OBJREF", comp_objref_tid, comp_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(comp_objref_aid, comp_objref_tid, comp_objref_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6778,13 +6778,13 @@ make_complex_attr_references(hid_t loc_id) */ status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__); ret = FAIL; goto out; } status = H5Rcreate(&(comp_regref_data[0].val_regref), loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6798,7 +6798,7 @@ make_complex_attr_references(hid_t loc_id) H5Acreate2(main_did, "Comp_REGREF", comp_regref_tid, comp_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(comp_regref_aid, comp_regref_tid, comp_regref_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6823,7 +6823,7 @@ make_complex_attr_references(hid_t loc_id) status = H5Rcreate(&((hobj_ref_t *)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6831,7 +6831,7 @@ make_complex_attr_references(hid_t loc_id) status = H5Rcreate(&((hobj_ref_t *)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6839,7 +6839,7 @@ make_complex_attr_references(hid_t loc_id) status = H5Rcreate(&((hobj_ref_t *)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6857,7 +6857,7 @@ make_complex_attr_references(hid_t loc_id) H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6865,7 +6865,7 @@ make_complex_attr_references(hid_t loc_id) /* close resource for vlen data */ status = H5Treclaim(vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, vlen_objref_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Treclaim failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Treclaim failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6885,14 +6885,14 @@ make_complex_attr_references(hid_t loc_id) */ status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__); ret = FAIL; goto out; } status = H5Rcreate(&((hdset_reg_ref_t *)vlen_regref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6910,7 +6910,7 @@ make_complex_attr_references(hid_t loc_id) H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", __func__, __LINE__); ret = FAIL; goto out; } @@ -6918,7 +6918,7 @@ make_complex_attr_references(hid_t loc_id) /* close resource for vlen data */ status = H5Treclaim(vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data); if (status < 0) { - HDfprintf(stderr, "Error: %s %d> H5Treclaim failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Treclaim failed.\n", __func__, __LINE__); ret = FAIL; goto out; } diff --git a/tools/test/misc/vds/UC_common.h b/tools/test/misc/vds/UC_common.h index bfa1ed9..d84d545 100644 --- a/tools/test/misc/vds/UC_common.h +++ b/tools/test/misc/vds/UC_common.h @@ -14,15 +14,6 @@ #ifndef USE_CASE_COMMON_H #define USE_CASE_COMMON_H -/* Use FUNC to safely handle variations of C99 __func__ keyword handling */ -#ifdef H5_HAVE_C99_FUNC -#define FUNC __func__ -#elif defined(H5_HAVE_FUNCTION) -#define FUNC __FUNCTION__ -#else -#error "We need __func__ or __FUNCTION__ to test function names!" -#endif - /****************************************** * Symbols used across multiple use cases * ******************************************/ @@ -41,7 +32,7 @@ #define FALSE 0 /* Testing macros */ -#define AT() printf(" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define AT() printf(" at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); #define UC_ERROR \ { \ puts("*ERROR*"); \ -- cgit v0.12 From 4ff544f9977da3bd54eac03cc124961eea7c4daf Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 28 Jun 2021 21:59:25 -0700 Subject: Cleans up POSIX/C bits in H5private.h (#804) * Cleans up POSIX/C bits in H5private.h * Assume difftime exists (C89) * Reorg AC_CHECK_HEADERS so headers are in alphabetical order * Split off networking-related AC_CHECK_HEADERS * Remove unused UNAME_CYGWIN from configure.ac * Remove checks for unused sys/timeb.h * Tidying pass over H5private.h HD prefix macros * Tidy H5win32defs.h * Add HD prefix to various scanf calls * Committing clang-format changes * Fixes to the alarm(2) code used in the tests to make Windows happy Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- config/cmake/ConfigureChecks.cmake | 2 - config/cmake/H5pubconf.h.in | 3 - configure.ac | 25 +- hl/test/test_ds.c | 6 +- hl/test/test_image.c | 24 +- java/src/jni/h5util.c | 26 +- src/H5private.h | 823 ++++++++++++++++++------------------ src/H5win32defs.h | 77 ++-- test/h5test.h | 6 +- test/testframe.c | 22 +- tools/src/h5import/h5import.c | 162 +++---- tools/src/h5repack/h5repack_main.c | 6 +- tools/test/h5jam/getub.c | 2 +- tools/test/perform/pio_standalone.h | 35 +- tools/test/perform/sio_standalone.h | 35 +- 15 files changed, 618 insertions(+), 636 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 87b2006..7baf77b 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -117,8 +117,6 @@ endif () # END of WINDOWS Hard code Values # ---------------------------------------------------------------------- -CHECK_FUNCTION_EXISTS (difftime ${HDF_PREFIX}_HAVE_DIFFTIME) - # Find the library containing clock_gettime() if (MINGW OR NOT WINDOWS) CHECK_FUNCTION_EXISTS (clock_gettime CLOCK_GETTIME_IN_LIBC) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index be366a8..051272b 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -114,9 +114,6 @@ /* Define if Darwin or Mac OS X */ #cmakedefine H5_HAVE_DARWIN @H5_HAVE_DARWIN@ -/* Define to 1 if you have the `difftime' function. */ -#cmakedefine H5_HAVE_DIFFTIME @H5_HAVE_DIFFTIME@ - /* Define if the direct I/O virtual file driver (VFD) should be compiled */ #cmakedefine H5_HAVE_DIRECT @H5_HAVE_DIRECT@ diff --git a/configure.ac b/configure.ac index dbeb968..3dd7328 100644 --- a/configure.ac +++ b/configure.ac @@ -1225,11 +1225,9 @@ AC_CHECK_LIB([dl], [dlopen]) ## ## Unix -AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h]) -AC_CHECK_HEADERS([sys/socket.h sys/types.h sys/file.h]) -AC_CHECK_HEADERS([features.h]) -AC_CHECK_HEADERS([dirent.h]) -AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h]) +AC_CHECK_HEADERS([dirent.h features.h unistd.h]) +AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/resource.h]) +AC_CHECK_HEADERS([sys/stat.h sys/time.h sys/types.h]) ## Darwin AC_SUBST([H5_IS_DARWIN]) @@ -1242,20 +1240,17 @@ case $host_os in esac ## Windows +## The winsock header is needed for gethostname +AC_CHECK_HEADERS([winsock2.h]) case "`uname`" in - CYGWIN*) - AC_CHECK_HEADERS([sys/timeb.h]) - UNAME_CYGWIN="yes" - ;; MINGW*) - AC_CHECK_HEADERS([winsock2.h sys/timeb.h]) AC_HAVE_LIBRARY([ws2_32]) ;; - *) - AC_CHECK_HEADERS([winsock2.h sys/timeb.h]) - ;; esac +# Mirror VFD networking +AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h]) + ## ---------------------------------------------------------------------- ## Some platforms require that all symbols are resolved when a library ## is linked. We can use the -no-undefined flag to tell libtool that @@ -2007,12 +2002,12 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ## NOTE: clock_gettime may require linking to the rt or posix4 library ## so we'll search for it before calling AC_CHECK_FUNCS. AC_SEARCH_LIBS([clock_gettime], [rt posix4]) -AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork]) +AC_CHECK_FUNCS([alarm asprintf clock_gettime fcntl flock fork]) AC_CHECK_FUNCS([gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([srandom strdup symlink]) -AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) +AC_CHECK_FUNCS([tmpfile vasprintf waitpid]) ## ---------------------------------------------------------------------- ## Check compiler characteristics diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 786aba8..8c6ef91 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -4964,12 +4964,12 @@ read_data(const char *fname, int ndims, hsize_t *dims, float **buf) } for (i = 0, nelms = 1; i < ndims; i++) { - if (fscanf(f, "%s %u", str, &j) && HDferror(f)) { + if (HDfscanf(f, "%s %u", str, &j) && HDferror(f)) { HDprintf("fscanf error in file %s\n", data_file); HDfclose(f); return -1; } /* end if */ - if (fscanf(f, "%d", &n) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &n) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s\n", data_file); HDfclose(f); return -1; @@ -4987,7 +4987,7 @@ read_data(const char *fname, int ndims, hsize_t *dims, float **buf) } for (j = 0; j < nelms; j++) { - if (fscanf(f, "%f", &val) < 0 && HDferror(f)) { + if (HDfscanf(f, "%f", &val) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s\n", data_file); HDfclose(f); return -1; diff --git a/hl/test/test_image.c b/hl/test/test_image.c index dc1be96..81340c1 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -580,11 +580,11 @@ test_generate(void) ! */ - if (fscanf(f, "%d %d %d", &imax, &jmax, &kmax) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d %d %d", &imax, &jmax, &kmax) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%f %f %f", &valex, &xmin, &xmax) < 0 && HDferror(f)) { + if (HDfscanf(f, "%f %f %f", &valex, &xmin, &xmax) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ @@ -615,7 +615,7 @@ test_generate(void) goto out; for (i = 0; i < n_elements; i++) { - if (fscanf(f, "%f ", &value) < 0 && HDferror(f)) { + if (HDfscanf(f, "%f ", &value) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ @@ -779,32 +779,32 @@ read_data(const char *fname, /*IN*/ goto out; } - if (fscanf(f, "%s", str) < 0 && HDferror(f)) { + if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &color_planes) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%s", str) < 0 && HDferror(f)) { + if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%d", &h) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &h) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%s", str) < 0 && HDferror(f)) { + if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%d", &w) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &w) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ @@ -838,7 +838,7 @@ read_data(const char *fname, /*IN*/ /* Read data elements */ for (i = 0; i < n_elements; i++) { - if (fscanf(f, "%d", &n) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &n) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ @@ -936,7 +936,7 @@ read_palette(const char *fname, rgb_t *palette, size_t palette_size) return -1; } - if (sscanf(buffer, "%u", &nentries) != 1) { + if (HDsscanf(buffer, "%u", &nentries) != 1) { HDfclose(file); return -1; } @@ -950,7 +950,7 @@ read_palette(const char *fname, rgb_t *palette, size_t palette_size) /* read the palette entries */ for (u = 0; u < nentries; u++) { /* extract the red, green and blue color components. */ - if (fscanf(file, "%u %u %u", &red, &green, &blue) != 3) { + if (HDfscanf(file, "%u %u %u", &red, &green, &blue) != 3) { HDfclose(file); return -1; } diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 6281481..8021438 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -225,7 +225,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(float): { float tmp_float = 0.0f; - sscanf(token, "%f", &tmp_float); + HDsscanf(token, "%f", &tmp_float); HDmemcpy(cptr, &tmp_float, sizeof(float)); break; } @@ -233,7 +233,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(double): { double tmp_double = 0.0; - sscanf(token, "%lf", &tmp_double); + HDsscanf(token, "%lf", &tmp_double); HDmemcpy(cptr, &tmp_double, sizeof(double)); break; } @@ -241,7 +241,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(long double): { long double tmp_ldouble = 0.0; - sscanf(token, "%Lg", &tmp_ldouble); + HDsscanf(token, "%Lg", &tmp_ldouble); HDmemcpy(cptr, &tmp_ldouble, sizeof(long double)); break; } @@ -289,11 +289,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ signed char tmp_char = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, "%hhu", &tmp_uchar); + HDsscanf(token, "%hhu", &tmp_uchar); HDmemcpy(cptr, &tmp_uchar, sizeof(unsigned char)); } else { - sscanf(token, "%hhd", &tmp_char); + HDsscanf(token, "%hhd", &tmp_char); HDmemcpy(cptr, &tmp_char, sizeof(char)); } @@ -305,11 +305,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ short tmp_short = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, "%hu", &tmp_ushort); + HDsscanf(token, "%hu", &tmp_ushort); HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short)); } else { - sscanf(token, "%hd", &tmp_short); + HDsscanf(token, "%hd", &tmp_short); HDmemcpy(&tmp_short, cptr, sizeof(short)); } @@ -321,11 +321,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ int tmp_int = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, "%u", &tmp_uint); + HDsscanf(token, "%u", &tmp_uint); HDmemcpy(cptr, &tmp_uint, sizeof(unsigned int)); } else { - sscanf(token, "%d", &tmp_int); + HDsscanf(token, "%d", &tmp_int); HDmemcpy(cptr, &tmp_int, sizeof(int)); } @@ -338,11 +338,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ long tmp_long = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, "%lu", &tmp_ulong); + HDsscanf(token, "%lu", &tmp_ulong); HDmemcpy(cptr, &tmp_ulong, sizeof(unsigned long)); } else { - sscanf(token, "%ld", &tmp_long); + HDsscanf(token, "%ld", &tmp_long); HDmemcpy(cptr, &tmp_long, sizeof(long)); } @@ -355,11 +355,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ long long tmp_llong = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, fmt_ullong, &tmp_ullong); + HDsscanf(token, fmt_ullong, &tmp_ullong); HDmemcpy(cptr, &tmp_ullong, sizeof(unsigned long long)); } else { - sscanf(token, fmt_llong, &tmp_llong); + HDsscanf(token, fmt_llong, &tmp_llong); HDmemcpy(cptr, &tmp_llong, sizeof(long long)); } diff --git a/src/H5private.h b/src/H5private.h index 13570db..4bd0685 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -590,227 +590,231 @@ typedef struct { haddr_t addr; /* The unique address of the object's header in that file */ } H5_obj_t; -/* - * Redefine all the POSIX functions. We should never see a POSIX - * function (or any other non-HDF5 function) in the source! +#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T + +/* Put all Windows-specific definitions in H5win32defs.h so we + * can (mostly) assume a POSIX platform. Not all of the POSIX calls + * will have a Windows equivalent so some #ifdef protection is still + * necessary (e.g., fork()). */ +#include "H5win32defs.h" -/* Put all platform-specific definitions in the following file */ -/* so that the following definitions are platform free. */ -#include "H5win32defs.h" /* For Windows-specific definitions */ +/* Platform-independent definitions for struct stat and off_t */ +#ifndef H5_HAVE_WIN32_API +/* These definitions differ in Windows and are defined in + * H5win32defs for that platform. + */ +typedef struct stat h5_stat_t; +typedef off_t h5_stat_size_t; +#define HDoff_t off_t +#endif + +#/* Redefine all the POSIX and C functions. We should never see an + * undecorated POSIX or C function (or any other non-HDF5 function) + * in the source. + */ #ifndef HDabort #define HDabort() abort() -#endif /* HDabort */ +#endif #ifndef HDabs #define HDabs(X) abs(X) -#endif /* HDabs */ +#endif #ifndef HDaccept -#define HDaccept(A, B, C) accept((A), (B), (C)) /* mirror VFD */ -#endif /* HDaccept */ +#define HDaccept(A, B, C) accept((A), (B), (C)) +#endif #ifndef HDaccess #define HDaccess(F, M) access(F, M) -#endif /* HDaccess */ +#endif #ifndef HDacos #define HDacos(X) acos(X) -#endif /* HDacos */ +#endif #ifndef HDalarm -#ifdef H5_HAVE_ALARM #define HDalarm(N) alarm(N) -#else /* H5_HAVE_ALARM */ -#define HDalarm(N) (0) -#endif /* H5_HAVE_ALARM */ -#endif /* HDalarm */ +#endif #ifndef HDasctime #define HDasctime(T) asctime(T) -#endif /* HDasctime */ +#endif #ifndef HDasin #define HDasin(X) asin(X) -#endif /* HDasin */ +#endif #ifndef HDasprintf #define HDasprintf asprintf /*varargs*/ -#endif /* HDasprintf */ +#endif #ifndef HDassert #define HDassert(X) assert(X) -#endif /* HDassert */ +#endif #ifndef HDatan #define HDatan(X) atan(X) -#endif /* HDatan */ +#endif #ifndef HDatan2 #define HDatan2(X, Y) atan2(X, Y) -#endif /* HDatan2 */ +#endif #ifndef HDatexit #define HDatexit(F) atexit(F) -#endif /* HDatexit */ +#endif #ifndef HDatof #define HDatof(S) atof(S) -#endif /* HDatof */ +#endif #ifndef HDatoi #define HDatoi(S) atoi(S) -#endif /* HDatoi */ +#endif #ifndef HDatol #define HDatol(S) atol(S) -#endif /* HDatol */ +#endif #ifndef HDatoll #define HDatoll(S) atoll(S) -#endif /* HDatol */ +#endif #ifndef HDbind -#define HDbind(A, B, C) bind((A), (B), (C)) /* mirror VFD */ -#endif /* HDbind */ +#define HDbind(A, B, C) bind((A), (B), (C)) +#endif #ifndef HDbsearch #define HDbsearch(K, B, N, Z, F) bsearch(K, B, N, Z, F) -#endif /* HDbsearch */ +#endif #ifndef HDcalloc #define HDcalloc(N, Z) calloc(N, Z) -#endif /* HDcalloc */ +#endif #ifndef HDceil #define HDceil(X) ceil(X) -#endif /* HDceil */ +#endif #ifndef HDcfgetispeed #define HDcfgetispeed(T) cfgetispeed(T) -#endif /* HDcfgetispeed */ +#endif #ifndef HDcfgetospeed #define HDcfgetospeed(T) cfgetospeed(T) -#endif /* HDcfgetospeed */ +#endif #ifndef HDcfsetispeed #define HDcfsetispeed(T, S) cfsetispeed(T, S) -#endif /* HDcfsetispeed */ +#endif #ifndef HDcfsetospeed #define HDcfsetospeed(T, S) cfsetospeed(T, S) -#endif /* HDcfsetospeed */ +#endif #ifndef HDchdir #define HDchdir(S) chdir(S) -#endif /* HDchdir */ +#endif #ifndef HDchmod #define HDchmod(S, M) chmod(S, M) -#endif /* HDchmod */ +#endif #ifndef HDchown #define HDchown(S, O, G) chown(S, O, G) -#endif /* HDchown */ +#endif #ifndef HDclearerr #define HDclearerr(F) clearerr(F) -#endif /* HDclearerr */ +#endif #ifndef HDclock #define HDclock() clock() -#endif /* HDclock */ +#endif #ifndef HDclock_gettime #define HDclock_gettime(CID, TS) clock_gettime(CID, TS) -#endif /* HDclock_gettime */ +#endif #ifndef HDclose #define HDclose(F) close(F) -#endif /* HDclose */ +#endif #ifndef HDclosedir #define HDclosedir(D) closedir(D) -#endif /* HDclosedir */ +#endif #ifndef HDconnect -#define HDconnect(A, B, C) connect((A), (B), (C)) /* mirror VFD */ -#endif /* HDconnect */ +#define HDconnect(A, B, C) connect((A), (B), (C)) +#endif #ifndef HDcos #define HDcos(X) cos(X) -#endif /* HDcos */ +#endif #ifndef HDcosh #define HDcosh(X) cosh(X) -#endif /* HDcosh */ +#endif #ifndef HDcreat #define HDcreat(S, M) creat(S, M) -#endif /* HDcreat */ +#endif #ifndef HDctermid #define HDctermid(S) ctermid(S) -#endif /* HDctermid */ +#endif #ifndef HDctime #define HDctime(T) ctime(T) -#endif /* HDctime */ +#endif #ifndef HDcuserid #define HDcuserid(S) cuserid(S) -#endif /* HDcuserid */ +#endif #ifndef HDdifftime -#ifdef H5_HAVE_DIFFTIME #define HDdifftime(X, Y) difftime(X, Y) -#else /* H5_HAVE_DIFFTIME */ -#define HDdifftime(X, Y) ((double)(X) - (double)(Y)) -#endif /* H5_HAVE_DIFFTIME */ -#endif /* HDdifftime */ +#endif #ifndef HDdiv #define HDdiv(X, Y) div(X, Y) -#endif /* HDdiv */ +#endif #ifndef HDdup #define HDdup(F) dup(F) -#endif /* HDdup */ +#endif #ifndef HDdup2 #define HDdup2(F, I) dup2(F, I) -#endif /* HDdup2 */ -/* execl() variable arguments */ -/* execle() variable arguments */ -/* execlp() variable arguments */ +#endif #ifndef HDexecv #define HDexecv(S, AV) execv(S, AV) -#endif /* HDexecv */ +#endif #ifndef HDexecve #define HDexecve(S, AV, E) execve(S, AV, E) -#endif /* HDexecve */ +#endif #ifndef HDexecvp #define HDexecvp(S, AV) execvp(S, AV) -#endif /* HDexecvp */ +#endif #ifndef HDexit #define HDexit(N) exit(N) -#endif /* HDexit */ +#endif #ifndef HD_exit #define HD_exit(N) _exit(N) -#endif /* HD_exit */ +#endif #ifndef HDexp #define HDexp(X) exp(X) -#endif /* HDexp */ +#endif #ifndef HDexp2 #define HDexp2(X) exp2(X) -#endif /* HDexp2 */ +#endif #ifndef HDfabs #define HDfabs(X) fabs(X) -#endif /* HDfabs */ +#endif #ifndef HDfabsf #define HDfabsf(X) fabsf(X) -#endif /* HDfabsf */ +#endif #ifndef HDfabsl #define HDfabsl(X) fabsl(X) -#endif /* HDfabsl */ +#endif #ifndef HDfclose #define HDfclose(F) fclose(F) -#endif /* HDfclose */ -#ifdef H5_HAVE_FCNTL +#endif #ifndef HDfcntl #define HDfcntl(F, C, ...) fcntl(F, C, __VA_ARGS__) -#endif /* HDfcntl */ -#endif /* H5_HAVE_FCNTL */ +#endif #ifndef HDfdopen #define HDfdopen(N, S) fdopen(N, S) -#endif /* HDfdopen */ +#endif #ifndef HDfeof #define HDfeof(F) feof(F) -#endif /* HDfeof */ +#endif #ifndef HDferror #define HDferror(F) ferror(F) -#endif /* HDferror */ +#endif #ifndef HDfflush #define HDfflush(F) fflush(F) -#endif /* HDfflush */ +#endif #ifndef HDfgetc #define HDfgetc(F) fgetc(F) -#endif /* HDfgetc */ +#endif #ifndef HDfgetpos #define HDfgetpos(F, P) fgetpos(F, P) -#endif /* HDfgetpos */ +#endif #ifndef HDfgets #define HDfgets(S, N, F) fgets(S, N, F) -#endif /* HDfgets */ +#endif #ifndef HDfileno #define HDfileno(F) fileno(F) -#endif /* HDfileno */ +#endif + /* Since flock is so prevalent, always build these functions * when possible to avoid them becoming dead code. */ #ifdef H5_HAVE_FCNTL H5_DLL int Pflock(int fd, int operation); -#endif /* H5_HAVE_FCNTL */ +#endif H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); + #ifndef HDflock /* NOTE: flock(2) is not present on all POSIX systems. * If it is not present, we try a flock() equivalent based on @@ -824,801 +828,800 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #define HDflock(F, L) Pflock(F, L) #else #define HDflock(F, L) Nflock(F, L) -#endif /* H5_HAVE_FLOCK */ +#endif + #endif /* HDflock */ + #ifndef HDfloor #define HDfloor(X) floor(X) -#endif /* HDfloor */ +#endif #ifndef HDfmod #define HDfmod(X, Y) fmod(X, Y) -#endif /* HDfmod */ +#endif #ifndef HDfopen #define HDfopen(S, M) fopen(S, M) -#endif /* HDfopen */ +#endif #ifndef HDfork #define HDfork() fork() -#endif /* HDfork */ +#endif #ifndef HDfprintf #define HDfprintf fprintf #endif #ifndef HDfpathconf #define HDfpathconf(F, N) fpathconf(F, N) -#endif /* HDfpathconf */ +#endif #ifndef HDfputc #define HDfputc(C, F) fputc(C, F) -#endif /* HDfputc */ +#endif #ifndef HDfputs #define HDfputs(S, F) fputs(S, F) -#endif /* HDfputs */ +#endif #ifndef HDfread #define HDfread(M, Z, N, F) fread(M, Z, N, F) -#endif /* HDfread */ +#endif #ifndef HDfree #define HDfree(M) free(M) -#endif /* HDfree */ +#endif #ifndef HDfreopen #define HDfreopen(S, M, F) freopen(S, M, F) -#endif /* HDfreopen */ +#endif #ifndef HDfrexp #define HDfrexp(X, N) frexp(X, N) -#endif /* HDfrexp */ +#endif #ifndef HDfrexpf #define HDfrexpf(X, N) frexpf(X, N) -#endif /* HDfrexpf */ +#endif #ifndef HDfrexpl #define HDfrexpl(X, N) frexpl(X, N) -#endif /* HDfrexpl */ -/* fscanf() variable arguments */ +#endif +#ifndef HDfscanf +#define HDfscanf fscanf +#endif #ifndef HDfseek #define HDfseek(F, O, W) fseeko(F, O, W) -#endif /* HDfseek */ +#endif #ifndef HDfsetpos #define HDfsetpos(F, P) fsetpos(F, P) -#endif /* HDfsetpos */ +#endif #ifndef HDfstat #define HDfstat(F, B) fstat(F, B) -#endif /* HDfstat */ -#ifndef HDlstat -#define HDlstat(S, B) lstat(S, B) -#endif /* HDlstat */ -#ifndef HDstat -#define HDstat(S, B) stat(S, B) -#endif /* HDstat */ - -#ifndef H5_HAVE_WIN32_API -/* These definitions differ in Windows and are defined in - * H5win32defs for that platform. - */ -typedef struct stat h5_stat_t; -typedef off_t h5_stat_size_t; -#define HDoff_t off_t -#endif /* H5_HAVE_WIN32_API */ - -#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T - +#endif #ifndef HDftell #define HDftell(F) ftell(F) -#endif /* HDftell */ +#endif #ifndef HDftruncate #define HDftruncate(F, L) ftruncate(F, L) -#endif /* HDftruncate */ +#endif #ifndef HDfwrite #define HDfwrite(M, Z, N, F) fwrite(M, Z, N, F) -#endif /* HDfwrite */ +#endif #ifndef HDgetc #define HDgetc(F) getc(F) -#endif /* HDgetc */ +#endif #ifndef HDgetchar #define HDgetchar() getchar() -#endif /* HDgetchar */ +#endif #ifndef HDgetcwd #define HDgetcwd(S, Z) getcwd(S, Z) -#endif /* HDgetcwd */ +#endif #ifndef HDgetdcwd #define HDgetdcwd(D, S, Z) getcwd(S, Z) -#endif /* HDgetdcwd */ +#endif + +/* Windows only - set to zero on other systems */ #ifndef HDgetdrive #define HDgetdrive() 0 -#endif /* HDgetdrive */ +#endif + #ifndef HDgetegid #define HDgetegid() getegid() -#endif /* HDgetegid() */ +#endif #ifndef HDgetenv #define HDgetenv(S) getenv(S) -#endif /* HDgetenv */ +#endif #ifndef HDgeteuid #define HDgeteuid() geteuid() -#endif /* HDgeteuid */ +#endif #ifndef HDgetgid #define HDgetgid() getgid() -#endif /* HDgetgid */ +#endif #ifndef HDgetgrgid #define HDgetgrgid(G) getgrgid(G) -#endif /* HDgetgrgid */ +#endif #ifndef HDgetgrnam #define HDgetgrnam(S) getgrnam(S) -#endif /* HDgetgrnam */ +#endif #ifndef HDgetgroups #define HDgetgroups(Z, G) getgroups(Z, G) -#endif /* HDgetgroups */ +#endif #ifndef HDgethostbyaddr -#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) /* mirror VFD */ -#endif /* HDgethostbyaddr */ +#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) +#endif #ifndef HDgethostname #define HDgethostname(N, L) gethostname(N, L) -#endif /* HDgethostname */ +#endif #ifndef HDgetlogin #define HDgetlogin() getlogin() -#endif /* HDgetlogin */ +#endif #ifndef HDgetpgrp #define HDgetpgrp() getpgrp() -#endif /* HDgetpgrp */ +#endif #ifndef HDgetpid #define HDgetpid() getpid() -#endif /* HDgetpid */ +#endif #ifndef HDgetppid #define HDgetppid() getppid() -#endif /* HDgetppid */ +#endif #ifndef HDgetpwnam #define HDgetpwnam(S) getpwnam(S) -#endif /* HDgetpwnam */ +#endif #ifndef HDgetpwuid #define HDgetpwuid(U) getpwuid(U) -#endif /* HDgetpwuid */ +#endif #ifndef HDgetrusage #define HDgetrusage(X, S) getrusage(X, S) -#endif /* HDgetrusage */ +#endif /* Don't define HDgets - gets() was deprecated in C99 and removed in C11 */ #ifdef HDgets #undef HDgets -#endif /* HDgets */ +#endif #ifndef HDgettimeofday #define HDgettimeofday(S, P) gettimeofday(S, P) -#endif /* HDgettimeofday */ +#endif #ifndef HDgetuid #define HDgetuid() getuid() -#endif /* HDgetuid */ +#endif #ifndef HDgmtime #define HDgmtime(T) gmtime(T) -#endif /* HDgmtime */ +#endif #ifndef HDhtonl -#define HDhtonl(X) htonl((X)) /* mirror VFD */ -#endif /* HDhtonl */ +#define HDhtonl(X) htonl((X)) +#endif #ifndef HDhtons -#define HDhtons(X) htons((X)) /* mirror VFD */ -#endif /* HDhtons */ +#define HDhtons(X) htons((X)) +#endif #ifndef HDinet_addr -#define HDinet_addr(C) inet_addr((C)) /* mirror VFD */ -#endif /* HDinet_addr */ +#define HDinet_addr(C) inet_addr((C)) +#endif #ifndef HDinet_ntoa -#define HDinet_ntoa(C) inet_ntoa((C)) /* mirror VFD */ -#endif /* HDinet_ntoa */ +#define HDinet_ntoa(C) inet_ntoa((C)) +#endif #ifndef HDisalnum -#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ -#endif /* HDisalnum */ +#define HDisalnum(C) isalnum((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisalpha -#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/ -#endif /* HDisalpha */ +#define HDisalpha(C) isalpha((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisatty #define HDisatty(F) isatty(F) -#endif /* HDisatty */ +#endif #ifndef HDiscntrl -#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/ -#endif /* HDiscntrl */ +#define HDiscntrl(C) iscntrl((int)(C)) /* Cast for solaris warning */ +#endif #ifndef HDisdigit -#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/ -#endif /* HDisdigit */ +#define HDisdigit(C) isdigit((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisgraph -#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/ -#endif /* HDisgraph */ +#define HDisgraph(C) isgraph((int)(C)) /* Cast for Solaris warning*/ +#endif #ifndef HDislower -#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/ -#endif /* HDislower */ +#define HDislower(C) islower((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisnan #define HDisnan(X) isnan(X) -#endif /* HDisnan */ +#endif #ifndef HDisprint -#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/ -#endif /* HDisprint */ +#define HDisprint(C) isprint((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDispunct -#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/ -#endif /* HDispunct */ +#define HDispunct(C) ispunct((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisspace -#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/ -#endif /* HDisspace */ +#define HDisspace(C) isspace((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisupper -#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/ -#endif /* HDisupper */ +#define HDisupper(C) isupper((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisxdigit -#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/ -#endif /* HDisxdigit */ +#define HDisxdigit(C) isxdigit((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDkill #define HDkill(P, S) kill(P, S) -#endif /* HDkill */ +#endif #ifndef HDlabs #define HDlabs(X) labs(X) -#endif /* HDlabs */ +#endif #ifndef HDldexp #define HDldexp(X, N) ldexp(X, N) -#endif /* HDldexp */ +#endif #ifndef HDldiv #define HDldiv(X, Y) ldiv(X, Y) -#endif /* HDldiv */ +#endif #ifndef HDlink #define HDlink(OLD, NEW) link(OLD, NEW) -#endif /* HDlink */ +#endif #ifndef HDlisten -#define HDlisten(A, B) listen((A), (B)) /* mirror VFD */ -#endif /* HDlisten */ +#define HDlisten(A, B) listen((A), (B)) +#endif #ifndef HDllround #define HDllround(V) llround(V) -#endif /* HDround */ +#endif #ifndef HDllroundf #define HDllroundf(V) llroundf(V) -#endif /* HDllroundf */ +#endif #ifndef HDllroundl #define HDllroundl(V) llroundl(V) -#endif /* HDllroundl */ +#endif #ifndef HDlocaleconv #define HDlocaleconv() localeconv() -#endif /* HDlocaleconv */ +#endif #ifndef HDlocaltime #define HDlocaltime(T) localtime(T) -#endif /* HDlocaltime */ +#endif #ifndef HDlog #define HDlog(X) log(X) -#endif /* HDlog */ +#endif #ifndef HDlog10 #define HDlog10(X) log10(X) -#endif /* HDlog10 */ +#endif #ifndef HDlongjmp #define HDlongjmp(J, N) longjmp(J, N) -#endif /* HDlongjmp */ +#endif #ifndef HDlround #define HDlround(V) lround(V) -#endif /* HDround */ +#endif #ifndef HDlroundf #define HDlroundf(V) lroundf(V) -#endif /* HDlroundf */ +#endif #ifndef HDlroundl #define HDlroundl(V) lroundl(V) -#endif /* HDroundl */ +#endif #ifndef HDlseek #define HDlseek(F, O, W) lseek(F, O, W) -#endif /* HDlseek */ +#endif +#ifndef HDlstat +#define HDlstat(S, B) lstat(S, B) +#endif #ifndef HDmalloc #define HDmalloc(Z) malloc(Z) -#endif /* HDmalloc */ +#endif #ifndef HDposix_memalign #define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z) -#endif /* HDposix_memalign */ +#endif #ifndef HDmblen #define HDmblen(S, N) mblen(S, N) -#endif /* HDmblen */ +#endif #ifndef HDmbstowcs #define HDmbstowcs(P, S, Z) mbstowcs(P, S, Z) -#endif /* HDmbstowcs */ +#endif #ifndef HDmbtowc #define HDmbtowc(P, S, Z) mbtowc(P, S, Z) -#endif /* HDmbtowc */ +#endif #ifndef HDmemchr #define HDmemchr(S, C, Z) memchr(S, C, Z) -#endif /* HDmemchr */ +#endif #ifndef HDmemcmp #define HDmemcmp(X, Y, Z) memcmp(X, Y, Z) -#endif /* HDmemcmp */ +#endif #ifndef HDmemcpy #define HDmemcpy(X, Y, Z) memcpy(X, Y, Z) -#endif /* HDmemcpy */ +#endif #ifndef HDmemmove #define HDmemmove(X, Y, Z) memmove((char *)(X), (const char *)(Y), Z) -#endif /* HDmemmove */ +#endif #ifndef HDmemset #define HDmemset(X, C, Z) memset(X, C, Z) -#endif /* HDmemset */ +#endif #ifndef HDmkdir #define HDmkdir(S, M) mkdir(S, M) -#endif /* HDmkdir */ +#endif #ifndef HDmkfifo #define HDmkfifo(S, M) mkfifo(S, M) -#endif /* HDmkfifo */ +#endif #ifndef HDmktime #define HDmktime(T) mktime(T) -#endif /* HDmktime */ +#endif #ifndef HDmodf #define HDmodf(X, Y) modf(X, Y) -#endif /* HDmodf */ +#endif #ifndef HDnanosleep #define HDnanosleep(N, O) nanosleep(N, O) -#endif /* HDnanosleep */ +#endif #ifndef HDntohl -#define HDntohl(A) ntohl((A)) /* mirror VFD */ -#endif /* HDntohl */ +#define HDntohl(A) ntohl((A)) +#endif #ifndef HDntohs -#define HDntohs(A) ntohs((A)) /* mirror VFD */ -#endif /* HDntohs */ +#define HDntohs(A) ntohs((A)) +#endif #ifndef HDopen #define HDopen(F, ...) open(F, __VA_ARGS__) -#endif /* HDopen */ +#endif #ifndef HDopendir #define HDopendir(S) opendir(S) -#endif /* HDopendir */ +#endif #ifndef HDpathconf #define HDpathconf(S, N) pathconf(S, N) -#endif /* HDpathconf */ +#endif #ifndef HDpause #define HDpause() pause() -#endif /* HDpause */ +#endif #ifndef HDperror #define HDperror(S) perror(S) -#endif /* HDperror */ +#endif #ifndef HDpipe #define HDpipe(F) pipe(F) -#endif /* HDpipe */ +#endif #ifndef HDpow #define HDpow(X, Y) pow(X, Y) -#endif /* HDpow */ +#endif #ifndef HDpowf #define HDpowf(X, Y) powf(X, Y) -#endif /* HDpowf */ +#endif #ifndef HDpread #define HDpread(F, B, C, O) pread(F, B, C, O) -#endif /* HDpread */ +#endif #ifndef HDprintf -#define HDprintf printf -#endif /* HDprintf */ +#define HDprintf printf /*varargs*/ +#endif #ifndef HDpthread_attr_destroy #define HDpthread_attr_destroy(A) pthread_attr_destroy(A) -#endif /* HDpthread_attr_destroy */ +#endif #ifndef HDpthread_attr_init #define HDpthread_attr_init(A) pthread_attr_init(A) -#endif /* HDpthread_attr_init */ +#endif #ifndef HDpthread_attr_setscope #define HDpthread_attr_setscope(A, S) pthread_attr_setscope(A, S) -#endif /* HDpthread_attr_setscope */ +#endif #ifndef HDpthread_cond_init #define HDpthread_cond_init(C, A) pthread_cond_init(C, A) -#endif /* HDpthread_cond_init */ +#endif #ifndef HDpthread_cond_signal #define HDpthread_cond_signal(C) pthread_cond_signal(C) -#endif /* HDpthread_cond_signal */ +#endif #ifndef HDpthread_cond_wait #define HDpthread_cond_wait(C, M) pthread_cond_wait(C, M) -#endif /* HDpthread_cond_wait */ +#endif #ifndef HDpthread_create #define HDpthread_create(R, A, F, U) pthread_create(R, A, F, U) -#endif /* HDpthread_create */ +#endif #ifndef HDpthread_equal #define HDpthread_equal(T1, T2) pthread_equal(T1, T2) -#endif /* HDpthread_equal */ +#endif #ifndef HDpthread_getspecific #define HDpthread_getspecific(K) pthread_getspecific(K) -#endif /* HDpthread_getspecific */ +#endif #ifndef HDpthread_join #define HDpthread_join(T, V) pthread_join(T, V) -#endif /* HDpthread_join */ +#endif #ifndef HDpthread_key_create #define HDpthread_key_create(K, D) pthread_key_create(K, D) -#endif /* HDpthread_key_create */ +#endif #ifndef HDpthread_mutex_init #define HDpthread_mutex_init(M, A) pthread_mutex_init(M, A) -#endif /* HDpthread_mutex_init */ +#endif #ifndef HDpthread_mutex_lock #define HDpthread_mutex_lock(M) pthread_mutex_lock(M) -#endif /* HDpthread_mutex_lock */ +#endif #ifndef HDpthread_mutex_unlock #define HDpthread_mutex_unlock(M) pthread_mutex_unlock(M) -#endif /* HDpthread_mutex_unlock */ +#endif #ifndef HDpthread_self #define HDpthread_self() pthread_self() -#endif /* HDpthread_self */ +#endif #ifndef HDpthread_setcancelstate #define HDpthread_setcancelstate(N, O) pthread_setcancelstate(N, O) -#endif /* HDpthread_setcancelstate */ +#endif #ifndef HDpthread_setspecific #define HDpthread_setspecific(K, V) pthread_setspecific(K, V) -#endif /* HDpthread_setspecific */ +#endif #ifndef HDputc #define HDputc(C, F) putc(C, F) -#endif /* HDputc*/ +#endif #ifndef HDputchar #define HDputchar(C) putchar(C) -#endif /* HDputchar */ +#endif #ifndef HDputs #define HDputs(S) puts(S) -#endif /* HDputs */ +#endif #ifndef HDpwrite #define HDpwrite(F, B, C, O) pwrite(F, B, C, O) -#endif /* HDpwrite */ +#endif #ifndef HDqsort #define HDqsort(M, N, Z, F) qsort(M, N, Z, F) -#endif /* HDqsort*/ +#endif #ifndef HDraise #define HDraise(N) raise(N) -#endif /* HDraise */ +#endif +/* clang-format off */ #ifdef H5_HAVE_RAND_R -#ifndef HDrandom -#define HDrandom() HDrand() -#endif /* HDrandom */ -H5_DLL int HDrand(void); -#ifndef HDsrandom -#define HDsrandom(S) HDsrand(S) -#endif /* HDsrandom */ -H5_DLL void HDsrand(unsigned int seed); +# ifndef HDrandom +# define HDrandom() HDrand() +# endif + H5_DLL int HDrand(void); +# ifndef HDsrandom +# define HDsrandom(S) HDsrand(S) +# endif + H5_DLL void HDsrand(unsigned int seed); #elif defined(H5_HAVE_RANDOM) -#ifndef HDrand -#define HDrand() random() -#endif /* HDrand */ -#ifndef HDrandom -#define HDrandom() random() -#endif /* HDrandom */ -#ifndef HDsrand -#define HDsrand(S) srandom(S) -#endif /* HDsrand */ -#ifndef HDsrandom -#define HDsrandom(S) srandom(S) -#endif /* HDsrandom */ -#else /* H5_HAVE_RANDOM */ -#ifndef HDrand -#define HDrand() rand() -#endif /* HDrand */ -#ifndef HDrandom -#define HDrandom() rand() -#endif /* HDrandom */ -#ifndef HDsrand -#define HDsrand(S) srand(S) -#endif /* HDsrand */ -#ifndef HDsrandom -#define HDsrandom(S) srand(S) -#endif /* HDsrandom */ -#endif /* H5_HAVE_RANDOM */ +# ifndef HDrand +# define HDrand() random() +# endif +# ifndef HDrandom +# define HDrandom() random() +# endif +# ifndef HDsrand +# define HDsrand(S) srandom(S) +# endif +# ifndef HDsrandom +# define HDsrandom(S) srandom(S) +# endif +#else +# ifndef HDrand +# define HDrand() rand() +# endif +# ifndef HDrandom +# define HDrandom() rand() +# endif +# ifndef HDsrand +# define HDsrand(S) srand(S) +# endif +# ifndef HDsrandom +# define HDsrandom(S) srand(S) +# endif +#endif +/* clang-format on */ #ifndef HDread #define HDread(F, M, Z) read(F, M, Z) -#endif /* HDread */ +#endif #ifndef HDreaddir #define HDreaddir(D) readdir(D) -#endif /* HDreaddir */ +#endif #ifndef HDrealloc #define HDrealloc(M, Z) realloc(M, Z) -#endif /* HDrealloc */ +#endif #ifndef HDrealpath #define HDrealpath(F1, F2) realpath(F1, F2) -#endif /* HDrealloc */ +#endif #ifndef HDremove #define HDremove(S) remove(S) -#endif /* HDremove */ +#endif #ifndef HDrename #define HDrename(OLD, NEW) rename(OLD, NEW) -#endif /* HDrename */ +#endif #ifndef HDrewind #define HDrewind(F) rewind(F) -#endif /* HDrewind */ +#endif #ifndef HDrewinddir #define HDrewinddir(D) rewinddir(D) -#endif /* HDrewinddir */ +#endif #ifndef HDround #define HDround(V) round(V) -#endif /* HDround */ +#endif #ifndef HDroundf #define HDroundf(V) roundf(V) -#endif /* HDroundf */ +#endif #ifndef HDroundl #define HDroundl(V) roundl(V) -#endif /* HDroundl */ +#endif #ifndef HDrmdir #define HDrmdir(S) rmdir(S) -#endif /* HDrmdir */ -/* scanf() variable arguments */ +#endif +#ifndef HDscanf +#define HDscanf scanf /*varargs*/ +#endif #ifndef HDselect #define HDselect(N, RD, WR, ER, T) select(N, RD, WR, ER, T) -#endif /* HDsetbuf */ +#endif #ifndef HDsetbuf #define HDsetbuf(F, S) setbuf(F, S) -#endif /* HDsetbuf */ +#endif #ifndef HDsetenv #define HDsetenv(N, V, O) setenv(N, V, O) -#endif /* HDsetenv */ +#endif #ifndef HDsetgid #define HDsetgid(G) setgid(G) -#endif /* HDsetgid */ +#endif #ifndef HDsetjmp #define HDsetjmp(J) setjmp(J) -#endif /* HDsetjmp */ +#endif #ifndef HDsetlocale #define HDsetlocale(N, S) setlocale(N, S) -#endif /* HDsetlocale */ +#endif #ifndef HDsetpgid #define HDsetpgid(P, PG) setpgid(P, PG) -#endif /* HDsetpgid */ +#endif #ifndef HDsetsid #define HDsetsid() setsid() -#endif /* HDsetsid */ +#endif #ifndef HDsetsockopt -#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) /* mirror VFD */ -#endif /* HDsetsockopt */ +#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) +#endif #ifndef HDsetuid #define HDsetuid(U) setuid(U) -#endif /* HDsetuid */ +#endif #ifndef HDsetvbuf #define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, Z) -#endif /* HDsetvbuf */ +#endif #ifndef HDshutdown -#define HDshutdown(A, B) shutdown((A), (B)) /* mirror VFD */ -#endif /* HDshutdown */ +#define HDshutdown(A, B) shutdown((A), (B)) +#endif #ifndef HDsigaction #define HDsigaction(S, A, O) sigaction((S), (A), (O)) -#endif /* HDsigaction */ +#endif #ifndef HDsigaddset #define HDsigaddset(S, N) sigaddset(S, N) -#endif /* HDsigaddset */ +#endif #ifndef HDsigdelset #define HDsigdelset(S, N) sigdelset(S, N) -#endif /* HDsigdelset */ +#endif #ifndef HDsigemptyset #define HDsigemptyset(S) sigemptyset(S) -#endif /* HDsigemptyset */ +#endif #ifndef HDsigfillset #define HDsigfillset(S) sigfillset(S) -#endif /* HDsigfillset */ +#endif #ifndef HDsigismember #define HDsigismember(S, N) sigismember(S, N) -#endif /* HDsigismember */ +#endif #ifndef HDsiglongjmp #define HDsiglongjmp(J, N) siglongjmp(J, N) -#endif /* HDsiglongjmp */ +#endif #ifndef HDsignal #define HDsignal(N, F) signal(N, F) -#endif /* HDsignal */ +#endif #ifndef HDsigpending #define HDsigpending(S) sigpending(S) -#endif /* HDsigpending */ +#endif #ifndef HDsigprocmask #define HDsigprocmask(H, S, O) sigprocmask(H, S, O) -#endif /* HDsigprocmask */ +#endif #ifndef HDsigsetjmp #define HDsigsetjmp(J, N) sigsetjmp(J, N) -#endif /* HDsigsetjmp */ +#endif #ifndef HDsigsuspend #define HDsigsuspend(S) sigsuspend(S) -#endif /* HDsigsuspend */ +#endif #ifndef HDsin #define HDsin(X) sin(X) -#endif /* HDsin */ +#endif #ifndef HDsinh #define HDsinh(X) sinh(X) -#endif /* HDsinh */ +#endif #ifndef HDsleep #define HDsleep(N) sleep(N) -#endif /* HDsleep */ +#endif #ifndef HDsnprintf #define HDsnprintf snprintf /*varargs*/ -#endif /* HDsnprintf */ +#endif #ifndef HDsocket -#define HDsocket(A, B, C) socket((A), (B), (C)) /* mirror VFD */ -#endif /* HDsocket */ +#define HDsocket(A, B, C) socket((A), (B), (C)) +#endif #ifndef HDsprintf #define HDsprintf sprintf /*varargs*/ -#endif /* HDsprintf */ +#endif #ifndef HDsqrt #define HDsqrt(X) sqrt(X) -#endif /* HDsqrt */ +#endif #ifndef HDsscanf -#define HDsscanf(S, FMT, ...) sscanf(S, FMT, __VA_ARGS__) -#endif /* HDsscanf */ +#define HDsscanf sscanf /*varargs*/ +#endif +#ifndef HDstat +#define HDstat(S, B) stat(S, B) +#endif #ifndef HDstrcat #define HDstrcat(X, Y) strcat(X, Y) -#endif /* HDstrcat */ +#endif #ifndef HDstrchr #define HDstrchr(S, C) strchr(S, C) -#endif /* HDstrchr */ +#endif #ifndef HDstrcmp #define HDstrcmp(X, Y) strcmp(X, Y) -#endif /* HDstrcmp */ +#endif #ifndef HDstrcasecmp #define HDstrcasecmp(X, Y) strcasecmp(X, Y) -#endif /* HDstrcasecmp */ +#endif #ifndef HDstrcoll #define HDstrcoll(X, Y) strcoll(X, Y) -#endif /* HDstrcoll */ +#endif #ifndef HDstrcpy #define HDstrcpy(X, Y) strcpy(X, Y) -#endif /* HDstrcpy */ +#endif #ifndef HDstrcspn #define HDstrcspn(X, Y) strcspn(X, Y) -#endif /* HDstrcspn */ +#endif #ifndef HDstrdup #define HDstrdup(S) strdup(S) -#endif /* HDstrdup */ +#endif #ifndef HDstrerror #define HDstrerror(N) strerror(N) -#endif /* HDstrerror */ +#endif #ifndef HDstrftime #define HDstrftime(S, Z, F, T) strftime(S, Z, F, T) -#endif /* HDstrftime */ +#endif #ifndef HDstrlen #define HDstrlen(S) strlen(S) -#endif /* HDstrlen */ +#endif #ifndef HDstrncat #define HDstrncat(X, Y, Z) strncat(X, Y, Z) -#endif /* HDstrncat */ +#endif #ifndef HDstrncmp #define HDstrncmp(X, Y, Z) strncmp(X, Y, Z) -#endif /* HDstrncmp */ +#endif #ifndef HDstrncpy #define HDstrncpy(X, Y, Z) strncpy(X, Y, Z) -#endif /* HDstrncpy */ +#endif #ifndef HDstrpbrk #define HDstrpbrk(X, Y) strpbrk(X, Y) -#endif /* HDstrpbrk */ +#endif #ifndef HDstrrchr #define HDstrrchr(S, C) strrchr(S, C) -#endif /* HDstrrchr */ +#endif #ifndef HDstrspn #define HDstrspn(X, Y) strspn(X, Y) -#endif /* HDstrspn */ +#endif #ifndef HDstrstr #define HDstrstr(X, Y) strstr(X, Y) -#endif /* HDstrstr */ +#endif #ifndef HDstrtod #define HDstrtod(S, R) strtod(S, R) -#endif /* HDstrtod */ +#endif #ifndef HDstrtok #define HDstrtok(X, Y) strtok(X, Y) -#endif /* HDstrtok */ +#endif #ifndef HDstrtok_r #define HDstrtok_r(X, Y, Z) strtok_r(X, Y, Z) -#endif /* HDstrtok */ +#endif #ifndef HDstrtol #define HDstrtol(S, R, N) strtol(S, R, N) -#endif /* HDstrtol */ +#endif #ifndef HDstrtoll #define HDstrtoll(S, R, N) strtoll(S, R, N) -#endif /* HDstrtoll */ +#endif #ifndef HDstrtoul #define HDstrtoul(S, R, N) strtoul(S, R, N) -#endif /* HDstrtoul */ +#endif #ifndef HDstrtoull #define HDstrtoull(S, R, N) strtoull(S, R, N) -#endif /* HDstrtoul */ +#endif #ifndef HDstrtoumax #define HDstrtoumax(S, R, N) strtoumax(S, R, N) -#endif /* HDstrtoumax */ +#endif #ifndef HDstrxfrm #define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z) -#endif /* HDstrxfrm */ -#ifdef H5_HAVE_SYMLINK +#endif #ifndef HDsymlink #define HDsymlink(F1, F2) symlink(F1, F2) -#endif /* HDsymlink */ -#endif /* H5_HAVE_SYMLINK */ +#endif #ifndef HDsysconf #define HDsysconf(N) sysconf(N) -#endif /* HDsysconf */ +#endif #ifndef HDsystem #define HDsystem(S) system(S) -#endif /* HDsystem */ +#endif #ifndef HDtan #define HDtan(X) tan(X) -#endif /* HDtan */ +#endif #ifndef HDtanh #define HDtanh(X) tanh(X) -#endif /* HDtanh */ +#endif #ifndef HDtcdrain #define HDtcdrain(F) tcdrain(F) -#endif /* HDtcdrain */ +#endif #ifndef HDtcflow #define HDtcflow(F, A) tcflow(F, A) -#endif /* HDtcflow */ +#endif #ifndef HDtcflush #define HDtcflush(F, N) tcflush(F, N) -#endif /* HDtcflush */ +#endif #ifndef HDtcgetattr #define HDtcgetattr(F, T) tcgetattr(F, T) -#endif /* HDtcgetattr */ +#endif #ifndef HDtcgetpgrp #define HDtcgetpgrp(F) tcgetpgrp(F) -#endif /* HDtcgetpgrp */ +#endif #ifndef HDtcsendbreak #define HDtcsendbreak(F, N) tcsendbreak(F, N) -#endif /* HDtcsendbreak */ +#endif #ifndef HDtcsetattr #define HDtcsetattr(F, O, T) tcsetattr(F, O, T) -#endif /* HDtcsetattr */ +#endif #ifndef HDtcsetpgrp #define HDtcsetpgrp(F, N) tcsetpgrp(F, N) -#endif /* HDtcsetpgrp */ +#endif #ifndef HDtime #define HDtime(T) time(T) -#endif /* HDtime */ +#endif #ifndef HDtimes #define HDtimes(T) times(T) -#endif /* HDtimes*/ +#endif #ifndef HDtmpfile #define HDtmpfile() tmpfile() -#endif /* HDtmpfile */ +#endif #ifndef HDtmpnam #define HDtmpnam(S) tmpnam(S) -#endif /* HDtmpnam */ +#endif #ifndef HDtolower #define HDtolower(C) tolower(C) -#endif /* HDtolower */ +#endif #ifndef HDtoupper #define HDtoupper(C) toupper(C) -#endif /* HDtoupper */ +#endif #ifndef HDttyname #define HDttyname(F) ttyname(F) -#endif /* HDttyname */ +#endif #ifndef HDtzset #define HDtzset() tzset() -#endif /* HDtzset */ +#endif #ifndef HDumask #define HDumask(N) umask(N) -#endif /* HDumask */ +#endif #ifndef HDuname #define HDuname(S) uname(S) -#endif /* HDuname */ +#endif #ifndef HDungetc #define HDungetc(C, F) ungetc(C, F) -#endif /* HDungetc */ +#endif #ifndef HDunlink #define HDunlink(S) unlink(S) -#endif /* HDunlink */ +#endif #ifndef HDunsetenv #define HDunsetenv(S) unsetenv(S) -#endif /* HDsetenv */ +#endif #ifndef HDutime #define HDutime(S, T) utime(S, T) -#endif /* HDutime */ +#endif + #ifndef HDvasprintf #ifdef H5_HAVE_VASPRINTF #define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) #else H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); -#endif /* H5_HAVE_VASPRINTF */ -#endif /* HDvasprintf */ +#endif +#endif + #ifndef HDva_arg #define HDva_arg(A, T) va_arg(A, T) -#endif /* HDva_arg */ +#endif #ifndef HDva_copy #define HDva_copy(D, S) va_copy(D, S) -#endif /* HDva_copy */ +#endif #ifndef HDva_end #define HDva_end(A) va_end(A) -#endif /* HDva_end */ +#endif #ifndef HDva_start #define HDva_start(A, P) va_start(A, P) -#endif /* HDva_start */ +#endif #ifndef HDvfprintf #define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) -#endif /* HDvfprintf */ +#endif #ifndef HDvprintf #define HDvprintf(FMT, A) vprintf(FMT, A) -#endif /* HDvprintf */ +#endif #ifndef HDvsprintf #define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A) -#endif /* HDvsprintf */ +#endif #ifndef HDvsnprintf #define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A) -#endif /* HDvsnprintf */ +#endif #ifndef HDwait #define HDwait(W) wait(W) -#endif /* HDwait */ +#endif #ifndef HDwaitpid #define HDwaitpid(P, W, O) waitpid(P, W, O) -#endif /* HDwaitpid */ +#endif #ifndef HDwcstombs #define HDwcstombs(S, P, Z) wcstombs(S, P, Z) -#endif /* HDwcstombs */ +#endif #ifndef HDwctomb #define HDwctomb(S, C) wctomb(S, C) -#endif /* HDwctomb */ +#endif #ifndef HDwrite #define HDwrite(F, M, Z) write(F, M, Z) -#endif /* HDwrite */ +#endif /* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ /* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 26bca67..030b65b 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -29,23 +29,35 @@ typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; -#define HDaccess(F, M) _access(F, M) -#define HDchdir(S) _chdir(S) -#define HDclose(F) _close(F) -#define HDcreat(S, M) Wopen_utf8(S, O_CREAT | O_TRUNC | O_RDWR, M) -#define HDdup(F) _dup(F) -#define HDfdopen(N, S) _fdopen(N, S) -#define HDfileno(F) _fileno(F) -#define HDfstat(F, B) _fstati64(F, B) -#define HDisatty(F) _isatty(F) +#ifdef H5_HAVE_VISUAL_STUDIO -#define HDgetcwd(S, Z) _getcwd(S, Z) -#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z) -#define HDgetdrive() _getdrive() -#define HDlseek(F, O, W) _lseeki64(F, O, W) -#define HDlstat(S, B) _lstati64(S, B) -#define HDmkdir(S, M) _mkdir(S) -#define HDoff_t __int64 +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#endif /* H5_HAVE_VISUAL_STUDIO */ + +#define HDaccess(F, M) _access(F, M) +#define HDchdir(S) _chdir(S) +#define HDclose(F) _close(F) +#define HDcreat(S, M) Wopen_utf8(S, O_CREAT | O_TRUNC | O_RDWR, M) +#define HDdup(F) _dup(F) +#define HDfdopen(N, S) _fdopen(N, S) +#define HDfileno(F) _fileno(F) +#define HDflock(F, L) Wflock(F, L) +#define HDfstat(F, B) _fstati64(F, B) +#define HDgetcwd(S, Z) _getcwd(S, Z) +#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z) +#define HDgetdrive() _getdrive() +#define HDgetlogin() Wgetlogin() +#define HDgettimeofday(V, Z) Wgettimeofday(V, Z) +#define HDisatty(F) _isatty(F) +#define HDlseek(F, O, W) _lseeki64(F, O, W) +#define HDlstat(S, B) _lstati64(S, B) +#define HDmemset(X, C, Z) memset((void *)(X), C, Z) /* Cast avoids MSVC warning */ +#define HDmkdir(S, M) _mkdir(S) +#define HDoff_t __int64 /* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. @@ -55,9 +67,11 @@ typedef __int64 h5_stat_size_t; #else #define HDopen(S, F, ...) Wopen_utf8(S, F, ##__VA_ARGS__) #endif + #define HDread(F, M, Z) _read(F, M, Z) #define HDremove(S) Wremove_utf8(S) #define HDrmdir(S) _rmdir(S) +#define HDsetenv(N, V, O) Wsetenv(N, V, O) #define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, (Z > 1 ? Z : 2)) #define HDsleep(S) Sleep(S * 1000) #define HDstat(S, B) _stati64(S, B) @@ -66,21 +80,13 @@ typedef __int64 h5_stat_size_t; #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 HDwrite(F, M, Z) _write(F, M, Z) -#ifdef H5_HAVE_VISUAL_STUDIO - -/* - * The (void*) cast just avoids a compiler warning in MSVC - */ -#define HDmemset(X, C, Z) memset((void *)(X), C, Z) - -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; - -#endif /* H5_HAVE_VISUAL_STUDIO */ +#ifndef H5_HAVE_MINGW +#define HDftruncate(F, L) _chsize_s(F, L) +#define HDfseek(F, O, W) _fseeki64(F, O, W) +#endif /* H5_HAVE_MINGW */ #ifdef __cplusplus extern "C" { @@ -98,17 +104,4 @@ H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); } #endif /* __cplusplus */ -#define HDgettimeofday(V, Z) Wgettimeofday(V, Z) -#define HDsetenv(N, V, O) Wsetenv(N, V, O) -#define HDunsetenv(N, V, O) Wsetenv(N, "", 1) -#define HDflock(F, L) Wflock(F, L) -#define HDgetlogin() Wgetlogin() - -/* Non-POSIX functions */ - -#ifndef H5_HAVE_MINGW -#define HDftruncate(F, L) _chsize_s(F, L) -#define HDfseek(F, O, W) _fseeki64(F, O, W) -#endif /* H5_HAVE_MINGW */ - #endif /* H5_HAVE_WIN32_API */ diff --git a/test/h5test.h b/test/h5test.h index 16fb33c..db1a887 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -162,12 +162,8 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ goto error; \ } -/* - * Alarm definitions to wait up (terminate) a test that runs too long. - */ +/* Number of seconds to wait before killing a test (requires alarm(2)) */ #define H5_ALARM_SEC 1200 /* default is 20 minutes */ -#define ALARM_ON TestAlarmOn() -#define ALARM_OFF HDalarm(0) /* Flags for h5_fileaccess_flags() */ #define H5_FILEACCESS_VFD 0x01 diff --git a/test/testframe.c b/test/testframe.c index f805997..d3f0211 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -320,9 +320,9 @@ PerformTests(void) MESSAGE(5, ("===============================================\n")); Test[Loop].NumErrors = num_errs; Test_parameters = Test[Loop].Parameters; - ALARM_ON; + TestAlarmOn(); Test[Loop].Call(); - ALARM_OFF; + TestAlarmOff(); Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; MESSAGE(5, ("===============================================\n")); MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors)); @@ -620,12 +620,15 @@ SetTest(const char *testname, int action) } } -/* - * Enable alarm on test execution, configurable by environment variable +/* Enable a test timer that will kill long-running tests, the time is configurable + * via an environment variable. + * + * Only useful on POSIX systems where alarm(2) is present. */ void TestAlarmOn(void) { +#ifdef H5_HAVE_ALARM char * env_val = HDgetenv("HDF5_ALARM_SECONDS"); /* Alarm environment */ unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */ @@ -635,4 +638,15 @@ TestAlarmOn(void) /* Set the number of seconds before alarm goes off */ HDalarm((unsigned)alarm_sec); +#endif +} + +/* Disable the test timer */ +void +TestAlarmOff(void) +{ +#ifdef H5_HAVE_ALARM + /* Set the number of seconds to zero */ + HDalarm(0); +#endif } diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 2a65591..04e1c35 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -489,7 +489,7 @@ readIntegerData(FILE *strm, struct Input *in) case 0: /* TEXTIN */ in08 = (H5DT_INT8 *)in->data; for (i = 0; i < len; i++, in08++) { - if (fscanf(strm, "%hd", &temp16) != 1) { + if (HDfscanf(strm, "%hd", &temp16) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -521,7 +521,7 @@ readIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 0: /* TEXTIN */ for (i = 0; i < len; i++, in16++) { - if (fscanf(strm, "%hd", in16) != 1) { + if (HDfscanf(strm, "%hd", in16) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -558,7 +558,7 @@ readIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 0: /* TEXTIN */ for (i = 0; i < len; i++, in32++) { - if (fscanf(strm, "%d", in32) != 1) { + if (HDfscanf(strm, "%d", in32) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -595,7 +595,7 @@ readIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 0: /* TEXTIN */ for (i = 0; i < len; i++, in64++) { - if (fscanf(strm, "%s", buffer) < 1) { + if (HDfscanf(strm, "%s", buffer) < 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -664,7 +664,7 @@ readUIntegerData(FILE *strm, struct Input *in) case 6: /* TEXTUIN */ in08 = (H5DT_UINT8 *)in->data; for (i = 0; i < len; i++, in08++) { - if (fscanf(strm, "%hu", &temp16) != 1) { + if (HDfscanf(strm, "%hu", &temp16) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -693,7 +693,7 @@ readUIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in16++) { - if (fscanf(strm, "%hu", in16) != 1) { + if (HDfscanf(strm, "%hu", in16) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -729,7 +729,7 @@ readUIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in32++) { - if (fscanf(strm, "%u", in32) != 1) { + if (HDfscanf(strm, "%u", in32) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -766,7 +766,7 @@ readUIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in64++) { - if (fscanf(strm, "%s", buffer) < 1) { + if (HDfscanf(strm, "%s", buffer) < 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -832,7 +832,7 @@ readFloatData(FILE *strm, struct Input *in) switch (in->inputClass) { case 1: /* TEXTFP */ for (i = 0; i < len; i++, fp32++) { - if (fscanf(strm, "%f", fp32) != 1) { + if (HDfscanf(strm, "%f", fp32) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -845,7 +845,7 @@ readFloatData(FILE *strm, struct Input *in) case 2: /*TEXTFPE */ for (i = 0; i < len; i++, fp32++) { - if (fscanf(strm, "%f", fp32) != 1) { + if (HDfscanf(strm, "%f", fp32) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -884,7 +884,7 @@ readFloatData(FILE *strm, struct Input *in) switch (in->inputClass) { case 1: /* TEXTFP */ for (i = 0; i < len; i++, fp64++) { - if (fscanf(strm, "%lf", fp64) != 1) { + if (HDfscanf(strm, "%lf", fp64) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -897,7 +897,7 @@ readFloatData(FILE *strm, struct Input *in) case 2: /*TEXTFPE */ for (i = 0; i < len; i++, fp64++) { - if (fscanf(strm, "%lf", fp64) != 1) { + if (HDfscanf(strm, "%lf", fp64) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -1469,16 +1469,16 @@ processConfigurationFile(char *infile, struct Input *in) goto error; } - scanret = fscanf(strm, "%254s", key); + scanret = HDfscanf(strm, "%254s", key); if ((scanret == 1) && !HDstrcmp("HDF5", key)) { #ifdef H5DEBUGIMPORT int pndx; HDprintf("\nh5dump file\n"); #endif in->h5dumpInput = 1; - scanret = fscanf(strm, "%254s", temp); /* filename */ - scanret = fscanf(strm, "%254s", temp); /* start bracket */ - scanret = fscanf(strm, "%254s", key); /* DATASET */ + scanret = HDfscanf(strm, "%254s", temp); /* filename */ + scanret = HDfscanf(strm, "%254s", temp); /* start bracket */ + scanret = HDfscanf(strm, "%254s", key); /* DATASET */ while (scanret == 1) { if (!HDstrcmp("DATASET", key)) { /* PATH */ #ifdef H5DEBUGIMPORT @@ -1488,7 +1488,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1500,7 +1500,7 @@ processConfigurationFile(char *infile, struct Input *in) goto error; } in->configOptionVector[PATH] = 1; - scanret = fscanf(strm, "%254s", temp); /* start bracket */ + scanret = HDfscanf(strm, "%254s", temp); /* start bracket */ #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASET %s found\n", temp); #endif @@ -1514,7 +1514,7 @@ processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1550,20 +1550,20 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING found\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* string properties */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* string properties */ (void)HDfprintf(stderr, "%s", err18); goto error; } while (get_next_prop) { if (!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */ - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err19); goto error; } @@ -1582,8 +1582,8 @@ processConfigurationFile(char *infile, struct Input *in) #endif } } - else if (!HDstrcmp("STRPAD", temp)) { /* STRPAD */ - if (fscanf(strm, "%254s", temp) != 1) { /* STRPAD type */ + else if (!HDstrcmp("STRPAD", temp)) { /* STRPAD */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* STRPAD type */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1591,8 +1591,8 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump DATATYPE STRING STRPAD %s found\n", temp); #endif } - else if (!HDstrcmp("CSET", key)) { /* CSET */ - if (fscanf(strm, "%254s", temp) != 1) { /* CSET type */ + else if (!HDstrcmp("CSET", key)) { /* CSET */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* CSET type */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1600,8 +1600,8 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump DATATYPE STRING CSET %s found\n", temp); #endif } - else if (!HDstrcmp("CTYPE", temp)) { /* CTYPE */ - if (fscanf(strm, "%254s", temp) != 1) { /* CTYPE type */ + else if (!HDstrcmp("CTYPE", temp)) { /* CTYPE */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* CTYPE type */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1609,7 +1609,7 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump DATATYPE STRING CTYPE %s found\n", temp); #endif } /* if(!HDstrcmp("CSET", key)) */ - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1628,7 +1628,7 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE key\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1644,14 +1644,14 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE found\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1662,7 +1662,7 @@ processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -1672,7 +1672,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1716,7 +1716,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1728,7 +1728,7 @@ processConfigurationFile(char *infile, struct Input *in) (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { goto error; } - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1742,7 +1742,7 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE process max dim values\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -1762,7 +1762,7 @@ processConfigurationFile(char *infile, struct Input *in) char *more = temp; in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10); } - if (fscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -1793,7 +1793,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err16c, infile); goto error; } - scanret = fscanf(strm, "%254s", temp); /* end bracket */ + scanret = HDfscanf(strm, "%254s", temp); /* end bracket */ #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif @@ -1808,14 +1808,14 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump STORAGE_LAYOUT key\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* CHUNKED */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* CHUNKED */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1827,7 +1827,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, "Unable to allocate dynamic memory.\n"); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1838,7 +1838,7 @@ processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int icount = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -1848,7 +1848,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1880,7 +1880,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { /* SIZE */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* SIZE */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1888,7 +1888,7 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif if (!HDstrcmp("SIZE", temp)) { /* SIZE */ - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err19); goto error; } @@ -1897,7 +1897,7 @@ processConfigurationFile(char *infile, struct Input *in) #endif } while (HDstrcmp("}", temp) != 0) { - if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1912,14 +1912,14 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS key\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1930,28 +1930,28 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION found\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* DEFLATE */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* DEFLATE */ (void)HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* bgin bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* bgin bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* LEVEL */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* LEVEL */ (void)HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err19); goto error; } @@ -1959,7 +1959,7 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); #endif in->compressionParam = ival; - if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1981,7 +1981,7 @@ processConfigurationFile(char *infile, struct Input *in) #endif in->configOptionVector[COMPRESS] = 0; } - if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1995,14 +1995,14 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump SUBSET key\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, err20, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump SUBSET %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -2012,7 +2012,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_prop) { if (!HDstrcmp("COUNT", temp)) { /* COUNT */ int icount = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -2023,7 +2023,7 @@ processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -2033,7 +2033,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -2068,7 +2068,7 @@ processConfigurationFile(char *infile, struct Input *in) } /* if(!HDstrcmp("COUNT", temp)) COUNT */ if (!HDstrcmp("BLOCK", temp)) { /* BLOCK */ int icount = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -2079,7 +2079,7 @@ processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -2089,7 +2089,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -2122,7 +2122,7 @@ processConfigurationFile(char *infile, struct Input *in) in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */ - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -2141,7 +2141,7 @@ processConfigurationFile(char *infile, struct Input *in) scanret = 0; break; } - scanret = fscanf(strm, "%254s", key); + scanret = HDfscanf(strm, "%254s", key); } #ifdef H5DEBUGIMPORT HDprintf("h5dump path"); @@ -2182,7 +2182,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -2199,7 +2199,7 @@ processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -2226,7 +2226,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err5a, infile); goto error; } - if (fscanf(strm, "%254d", (&ival)) != 1) { + if (HDfscanf(strm, "%254d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err19); goto error; } @@ -2423,7 +2423,7 @@ processConfigurationFile(char *infile, struct Input *in) default: break; } - scanret = fscanf(strm, "%254s", key); + scanret = HDfscanf(strm, "%254s", key); } /* @@ -2602,7 +2602,7 @@ getOutputClass(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output class.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -2637,7 +2637,7 @@ getOutputSize(struct Input *in, FILE *strm) const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for output size.\n"; - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3502,7 +3502,7 @@ getInputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for input byte-order.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3524,7 +3524,7 @@ getRank(struct Input *in, FILE *strm) const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for rank.\n"; - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3553,7 +3553,7 @@ getDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%llu", (&ullval)) == 1) + while (HDfscanf(strm, "%llu", (&ullval)) == 1) in->sizeOfDimension[i++] = ullval; if (in->rank != i) { @@ -3579,7 +3579,7 @@ getChunkedDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%llu", (&ullval)) == 1) + while (HDfscanf(strm, "%llu", (&ullval)) == 1) in->sizeOfChunk[i++] = ullval; if (in->rank != i) { @@ -3612,7 +3612,7 @@ getMaximumDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%lld", (&llval)) == 1) { + while (HDfscanf(strm, "%lld", (&llval)) == 1) { if (llval == -1) in->maxsizeOfDimension[i++] = H5S_UNLIMITED; else @@ -3642,7 +3642,7 @@ getOutputArchitecture(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output architecture.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3675,7 +3675,7 @@ getOutputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output byte-order.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3708,7 +3708,7 @@ getCompressionType(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for compression.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3750,7 +3750,7 @@ getCompressionParameter(struct Input *in, FILE *strm) switch (in->compressionType) { case 0: /* GZIP */ - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3774,7 +3774,7 @@ getExternalFilename(struct Input *in, FILE *strm) char temp[255]; const char *err1 = "Unable to get 'string' value.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 1f1b821..474a56f 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -363,7 +363,7 @@ read_info(const char *filename, pack_opt_t *options) /* cycle until end of file reached */ while (1) { - if (EOF == fscanf(fp, "%9s", stype)) + if (EOF == HDfscanf(fp, "%9s", stype)) break; /* Info indicator must be for layout or filter */ @@ -378,7 +378,7 @@ read_info(const char *filename, pack_opt_t *options) i = 0; c = '0'; while (c != ' ') { - if (fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (HDfscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; @@ -390,7 +390,7 @@ read_info(const char *filename, pack_opt_t *options) c = '0'; /* go until end */ while (c != ' ') { - if (fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (HDfscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index a9b4437..4925708 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -109,7 +109,7 @@ main(int argc, const char *argv[]) filename = HDstrdup(argv[opt_ind]); size = 0; - if (EOF == (res = sscanf(nbytes, "%u", &size))) { + if (EOF == (res = HDsscanf(nbytes, "%u", &size))) { /* fail */ error_msg("missing file name\n"); usage(h5tools_getprogname()); diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 2d89d30..276fa0f 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -90,27 +90,20 @@ #define HDctermid(S) ctermid(S) #define HDctime(T) ctime(T) #define HDcuserid(S) cuserid(S) -#ifdef H5_HAVE_DIFFTIME -#define HDdifftime(X, Y) difftime(X, Y) -#else -#define HDdifftime(X, Y) ((double)(X) - (double)(Y)) -#endif -#define HDdiv(X, Y) div(X, Y) -#define HDdup(F) dup(F) -#define HDdup2(F, I) dup2(F, I) -/* execl() variable arguments */ -/* execle() variable arguments */ -/* execlp() variable arguments */ -#define HDexecv(S, AV) execv(S, AV) -#define HDexecve(S, AV, E) execve(S, AV, E) -#define HDexecvp(S, AV) execvp(S, AV) -#define HDexit(N) exit(N) -#define HD_exit(N) _exit(N) -#define HDexp(X) exp(X) -#define HDfabs(X) fabs(X) -#define HDfabsf(X) fabsf(X) -#define HDfabsl(X) fabsl(X) -#define HDfclose(F) fclose(F) +#define HDdifftime(X, Y) difftime(X, Y) +#define HDdiv(X, Y) div(X, Y) +#define HDdup(F) dup(F) +#define HDdup2(F, I) dup2(F, I) +#define HDexecv(S, AV) execv(S, AV) +#define HDexecve(S, AV, E) execve(S, AV, E) +#define HDexecvp(S, AV) execvp(S, AV) +#define HDexit(N) exit(N) +#define HD_exit(N) _exit(N) +#define HDexp(X) exp(X) +#define HDfabs(X) fabs(X) +#define HDfabsf(X) fabsf(X) +#define HDfabsl(X) fabsl(X) +#define HDfclose(F) fclose(F) /* fcntl() variable arguments */ #define HDfdopen(N, S) fdopen(N, S) #define HDfeof(F) feof(F) diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 9bdac29..ea1a2a1 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -105,27 +105,20 @@ #define HDctermid(S) ctermid(S) #define HDctime(T) ctime(T) #define HDcuserid(S) cuserid(S) -#ifdef H5_HAVE_DIFFTIME -#define HDdifftime(X, Y) difftime(X, Y) -#else -#define HDdifftime(X, Y) ((double)(X) - (double)(Y)) -#endif -#define HDdiv(X, Y) div(X, Y) -#define HDdup(F) dup(F) -#define HDdup2(F, I) dup2(F, I) -/* execl() variable arguments */ -/* execle() variable arguments */ -/* execlp() variable arguments */ -#define HDexecv(S, AV) execv(S, AV) -#define HDexecve(S, AV, E) execve(S, AV, E) -#define HDexecvp(S, AV) execvp(S, AV) -#define HDexit(N) exit(N) -#define HD_exit(N) _exit(N) -#define HDexp(X) exp(X) -#define HDfabs(X) fabs(X) -#define HDfabsf(X) fabsf(X) -#define HDfabsl(X) fabsl(X) -#define HDfclose(F) fclose(F) +#define HDdifftime(X, Y) difftime(X, Y) +#define HDdiv(X, Y) div(X, Y) +#define HDdup(F) dup(F) +#define HDdup2(F, I) dup2(F, I) +#define HDexecv(S, AV) execv(S, AV) +#define HDexecve(S, AV, E) execve(S, AV, E) +#define HDexecvp(S, AV) execvp(S, AV) +#define HDexit(N) exit(N) +#define HD_exit(N) _exit(N) +#define HDexp(X) exp(X) +#define HDfabs(X) fabs(X) +#define HDfabsf(X) fabsf(X) +#define HDfabsl(X) fabsl(X) +#define HDfclose(F) fclose(F) /* fcntl() variable arguments */ #define HDfdopen(N, S) fdopen(N, S) #define HDfeof(F) feof(F) -- cgit v0.12 From 2090a527c13a13c0ea5b59b319b3402d2ef8f578 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 29 Jun 2021 13:06:48 -0700 Subject: Brings the tools getopt(3) replacement into the main library (#803) * Moves get_option from the tools library to the C library * Adds H5 prefix to get_option call and variables * Renames the H5_get_option long options struct and enum --- hl/tools/h5watch/h5watch.c | 60 ++--- src/H5private.h | 51 ++++ src/H5system.c | 164 ++++++++++++ tools/lib/h5tools_utils.c | 169 +----------- tools/lib/h5tools_utils.h | 52 ---- tools/src/h5copy/h5copy.c | 48 ++-- tools/src/h5diff/h5diff_common.c | 108 ++++---- tools/src/h5dump/h5dump.c | 340 ++++++++++++------------ tools/src/h5format_convert/h5format_convert.c | 60 ++--- tools/src/h5jam/h5jam.c | 12 +- tools/src/h5jam/h5unjam.c | 12 +- tools/src/h5repack/h5repack_main.c | 156 +++++------ tools/src/h5stat/h5stat.c | 224 ++++++++-------- tools/src/misc/h5clear.c | 80 +++--- tools/src/misc/h5mkgrp.c | 28 +- tools/test/h5jam/getub.c | 16 +- tools/test/h5jam/tellub.c | 12 +- tools/test/perform/pio_perf.c | 296 ++++++++++----------- tools/test/perform/pio_standalone.c | 58 ++--- tools/test/perform/pio_standalone.h | 23 +- tools/test/perform/sio_perf.c | 356 +++++++++++++------------- tools/test/perform/sio_standalone.c | 58 ++--- tools/test/perform/sio_standalone.h | 23 +- tools/test/perform/zip_perf.c | 132 +++++----- 24 files changed, 1269 insertions(+), 1269 deletions(-) diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c index a5e82ca..afbc31d 100644 --- a/hl/tools/h5watch/h5watch.c +++ b/hl/tools/h5watch/h5watch.c @@ -58,27 +58,27 @@ static void parse_command_line(int argc, const char *argv[]); * The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "?"; -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, - {"dim", no_arg, 'd'}, {"di", no_arg, 'd'}, - {"label", no_arg, 'l'}, {"labe", no_arg, 'l'}, - {"lab", no_arg, 'l'}, {"la", no_arg, 'l'}, - {"simple", no_arg, 'S'}, {"simpl", no_arg, 'S'}, - {"simp", no_arg, 'S'}, {"sim", no_arg, 'S'}, - {"si", no_arg, 'S'}, {"hexdump", no_arg, 'x'}, - {"hexdum", no_arg, 'x'}, {"hexdu", no_arg, 'x'}, - {"hexd", no_arg, 'x'}, {"hex", no_arg, 'x'}, - {"width", require_arg, 'w'}, {"widt", require_arg, 'w'}, - {"wid", require_arg, 'w'}, {"wi", require_arg, 'w'}, - {"polling", require_arg, 'p'}, {"pollin", require_arg, 'p'}, - {"polli", require_arg, 'p'}, {"poll", require_arg, 'p'}, - {"pol", require_arg, 'p'}, {"po", require_arg, 'p'}, - {"fields", require_arg, 'f'}, {"field", require_arg, 'f'}, - {"fiel", require_arg, 'f'}, {"fie", require_arg, 'f'}, - {"fi", require_arg, 'f'}, {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, {"ver", no_arg, 'V'}, - {"ve", no_arg, 'V'}, {NULL, 0, '\0'}}; +static const char * s_opts = "?"; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, + {"dim", no_arg, 'd'}, {"di", no_arg, 'd'}, + {"label", no_arg, 'l'}, {"labe", no_arg, 'l'}, + {"lab", no_arg, 'l'}, {"la", no_arg, 'l'}, + {"simple", no_arg, 'S'}, {"simpl", no_arg, 'S'}, + {"simp", no_arg, 'S'}, {"sim", no_arg, 'S'}, + {"si", no_arg, 'S'}, {"hexdump", no_arg, 'x'}, + {"hexdum", no_arg, 'x'}, {"hexdu", no_arg, 'x'}, + {"hexd", no_arg, 'x'}, {"hex", no_arg, 'x'}, + {"width", require_arg, 'w'}, {"widt", require_arg, 'w'}, + {"wid", require_arg, 'w'}, {"wi", require_arg, 'w'}, + {"polling", require_arg, 'p'}, {"pollin", require_arg, 'p'}, + {"polli", require_arg, 'p'}, {"poll", require_arg, 'p'}, + {"pol", require_arg, 'p'}, {"po", require_arg, 'p'}, + {"fields", require_arg, 'f'}, {"field", require_arg, 'f'}, + {"fiel", require_arg, 'f'}, {"fie", require_arg, 'f'}, + {"fi", require_arg, 'f'}, {"version", no_arg, 'V'}, + {"versio", no_arg, 'V'}, {"versi", no_arg, 'V'}, + {"vers", no_arg, 'V'}, {"ver", no_arg, 'V'}, + {"ve", no_arg, 'V'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: doprint() @@ -677,7 +677,7 @@ parse_command_line(int argc, const char *argv[]) } /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case '?': case 'h': /* --help */ @@ -691,7 +691,7 @@ parse_command_line(int argc, const char *argv[]) break; case 'w': /* --width=N */ - g_display_width = (int)HDstrtol(opt_arg, NULL, 0); + g_display_width = (int)HDstrtol(H5_optarg, NULL, 0); if (g_display_width < 0) { usage(h5tools_getprogname()); leave(EXIT_FAILURE); @@ -711,8 +711,8 @@ parse_command_line(int argc, const char *argv[]) break; case 'p': /* --polling=N */ - /* g_polling_interval = HDstrtod(opt_arg, NULL); */ - if ((tmp = (int)HDstrtol(opt_arg, NULL, 10)) <= 0) { + /* g_polling_interval = HDstrtod(H5_optarg, NULL); */ + if ((tmp = (int)HDstrtol(H5_optarg, NULL, 10)) <= 0) { usage(h5tools_getprogname()); leave(EXIT_FAILURE); } @@ -721,7 +721,7 @@ parse_command_line(int argc, const char *argv[]) case 'f': /* --fields= */ if (g_list_of_fields == NULL) { - if ((g_list_of_fields = HDstrdup(opt_arg)) == NULL) { + if ((g_list_of_fields = HDstrdup(H5_optarg)) == NULL) { error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__); leave(EXIT_FAILURE); } @@ -729,7 +729,7 @@ parse_command_line(int argc, const char *argv[]) else { char *str; - if ((str = HDstrdup(opt_arg)) == NULL) { + if ((str = HDstrdup(H5_optarg)) == NULL) { error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__); leave(EXIT_FAILURE); } @@ -751,7 +751,7 @@ parse_command_line(int argc, const char *argv[]) } /* check for object to be processed */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing dataset name\n"); usage(h5tools_getprogname()); leave(EXIT_FAILURE); @@ -821,7 +821,7 @@ main(int argc, const char *argv[]) /* parse command line options */ parse_command_line(argc, argv); - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing dataset name\n"); usage(h5tools_getprogname()); leave(EXIT_FAILURE); @@ -845,7 +845,7 @@ main(int argc, const char *argv[]) * then there must have been something wrong with the file (perhaps it * doesn't exist). */ - if ((fname = HDstrdup(argv[opt_ind])) == NULL) { + if ((fname = HDstrdup(argv[H5_optind])) == NULL) { error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; diff --git a/src/H5private.h b/src/H5private.h index 4bd0685..d11b15b 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2634,6 +2634,57 @@ H5_DLL double H5_get_time(void); H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/); H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/); +/* getopt(3) equivalent that papers over the lack of long options on BSD + * and lack of Windows support. + */ +H5_DLLVAR int H5_opterr; /* get_option prints errors if this is on */ +H5_DLLVAR int H5_optind; /* token pointer */ +H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */ + +enum h5_arg_level { + no_arg = 0, /* doesn't take an argument */ + require_arg, /* requires an argument */ + optional_arg /* argument is optional */ +}; + +/* + * get_option determines which options are specified on the command line and + * returns a pointer to any arguments possibly associated with the option in + * the ``H5_optarg'' variable. get_option returns the shortname equivalent of + * the option. The long options are specified in the following way: + * + * struct h5_long_options foo[] = { + * { "filename", require_arg, 'f' }, + * { "append", no_arg, 'a' }, + * { "width", require_arg, 'w' }, + * { NULL, 0, 0 } + * }; + * + * Long named options can have arguments specified as either: + * + * ``--param=arg'' or ``--param arg'' + * + * Short named options can have arguments specified as either: + * + * ``-w80'' or ``-w 80'' + * + * and can have more than one short named option specified at one time: + * + * -aw80 + * + * in which case those options which expect an argument need to come at the + * end. + */ +struct h5_long_options { + const char * name; /* Name of the long option */ + enum h5_arg_level has_arg; /* Whether we should look for an arg */ + char shortval; /* The shortname equivalent of long arg + * this gets returned from get_option + */ +}; + +H5_DLL int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt); + #ifdef H5_HAVE_PARALLEL /* Generic MPI functions */ H5_DLL hsize_t H5_mpi_set_bigio_count(hsize_t new_count); diff --git a/src/H5system.c b/src/H5system.c index 7a87a65..0849373 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -936,3 +936,167 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5_expand_windows_env_vars() */ #endif /* H5_HAVE_WIN32_API */ + +/* Global variables */ +int H5_opterr = 1; /* Get_option prints errors if this is on */ +int H5_optind = 1; /* Token pointer */ +const char *H5_optarg; /* Flag argument (or value) */ + +/*------------------------------------------------------------------------- + * Function: H5_get_option + * + * Purpose: Determine the command-line options a user specified. We can + * accept both short and long type command-lines. + * + * Return: Success: The short valued "name" of the command line + * parameter or EOF if there are no more + * parameters to process. + * + * Failure: A question mark. + *------------------------------------------------------------------------- + */ +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 */ + + if (sp == 1) { + /* check for more flag-like tokens */ + if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') { + return EOF; + } + else if (HDstrcmp(argv[H5_optind], "--") == 0) { + H5_optind++; + return EOF; + } + } + + if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') { + /* long command line option */ + int i; + const char ch = '='; + char * arg = HDstrdup(&argv[H5_optind][2]); + size_t arg_len = 0; + + H5_optarg = strchr(&argv[H5_optind][2], ch); + arg_len = HDstrlen(&argv[H5_optind][2]); + if (H5_optarg) { + arg_len -= HDstrlen(H5_optarg); + H5_optarg++; /* skip the equal sign */ + } + arg[arg_len] = 0; + + 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; + + if (l_opts[i].has_arg != no_arg) { + if (H5_optarg == NULL) { + if (l_opts[i].has_arg != optional_arg) { + if (H5_optind < (argc - 1)) + if (argv[H5_optind + 1][0] != '-') + H5_optarg = argv[++H5_optind]; + } + else if (l_opts[i].has_arg == require_arg) { + if (H5_opterr) + HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); + + optopt = '?'; + } + } + } + else { + if (H5_optarg) { + if (H5_opterr) + HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); + + optopt = '?'; + } + } + break; + } + } + + if (l_opts[i].name == NULL) { + /* exhausted all of the l_opts we have and still didn't match */ + if (H5_opterr) + HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); + + optopt = '?'; + } + + H5_optind++; + sp = 1; + + HDfree(arg); + } + else { + register char *cp; /* pointer into current token */ + + /* short command line option */ + optopt = argv[H5_optind][sp]; + + if (optopt == ':' || (cp = HDstrchr(opts, optopt)) == 0) { + if (H5_opterr) + HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optopt); + + /* if no chars left in this token, move to next token */ + if (argv[H5_optind][++sp] == '\0') { + H5_optind++; + sp = 1; + } + return '?'; + } + + if (*++cp == ':') { + /* if a value is expected, get it */ + if (argv[H5_optind][sp + 1] != '\0') { + /* flag value is rest of current token */ + H5_optarg = &argv[H5_optind++][sp + 1]; + } + else if (++H5_optind >= argc) { + if (H5_opterr) + HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optopt); + + optopt = '?'; + } + else { + /* flag value is next token */ + H5_optarg = argv[H5_optind++]; + } + + sp = 1; + } + /* wildcard argument */ + else if (*cp == '*') { + /* check the next argument */ + H5_optind++; + /* we do have an extra argument, check if not last */ + if ((H5_optind + 1) < argc) { + if (argv[H5_optind][0] != '-') { + H5_optarg = argv[H5_optind++]; + } + else { + H5_optarg = NULL; + } + } + else { + H5_optarg = NULL; + } + } + else { + /* set up to look at next char in token, next time */ + if (argv[H5_optind][++sp] == '\0') { + /* no more in current token, so setup next token */ + H5_optind++; + sp = 1; + } + H5_optarg = NULL; + } + } + + /* return the current flag character found */ + return optopt; +} diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 6aec6b8..f2407bf 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -25,12 +25,8 @@ #include "H5FDros3.h" #endif -/* global variables */ -unsigned h5tools_nCols = 80; -/* ``get_option'' variables */ -int opt_err = 1; /*get_option prints errors if this is on */ -int opt_ind = 1; /*token pointer */ -const char * opt_arg; /*flag argument (or value) */ +/* Global variables */ +unsigned h5tools_nCols = 80; static int h5tools_d_status = 0; static const char *h5tools_progname = "h5tools"; @@ -162,167 +158,6 @@ help_ref_msg(FILE *output) HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n", h5tools_getprogname()); } -/*------------------------------------------------------------------------- - * Function: get_option - * - * Purpose: Determine the command-line options a user specified. We can - * accept both short and long type command-lines. - * - * Return: Success: The short valued "name" of the command line - * parameter or EOF if there are no more - * parameters to process. - * - * Failure: A question mark. - *------------------------------------------------------------------------- - */ -int -get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts) -{ - static int sp = 1; /* character index in current token */ - int opt_opt = '?'; /* option character passed back to user */ - - if (sp == 1) { - /* check for more flag-like tokens */ - if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') { - return EOF; - } - else if (HDstrcmp(argv[opt_ind], "--") == 0) { - opt_ind++; - return EOF; - } - } - - if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') { - /* long command line option */ - int i; - const char ch = '='; - char * arg = HDstrdup(&argv[opt_ind][2]); - size_t arg_len = 0; - - opt_arg = strchr(&argv[opt_ind][2], ch); - arg_len = HDstrlen(&argv[opt_ind][2]); - if (opt_arg) { - arg_len -= HDstrlen(opt_arg); - opt_arg++; /* skip the equal sign */ - } - arg[arg_len] = 0; - - 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 */ - opt_opt = l_opts[i].shortval; - - if (l_opts[i].has_arg != no_arg) { - if (opt_arg == NULL) { - if (l_opts[i].has_arg != optional_arg) { - if (opt_ind < (argc - 1)) - if (argv[opt_ind + 1][0] != '-') - opt_arg = argv[++opt_ind]; - } - else if (l_opts[i].has_arg == require_arg) { - if (opt_err) - HDfprintf(rawerrorstream, "%s: option required for \"--%s\" flag\n", argv[0], - arg); - - opt_opt = '?'; - } - } - } - else { - if (opt_arg) { - if (opt_err) - HDfprintf(rawerrorstream, "%s: no option required for \"%s\" flag\n", argv[0], - arg); - - opt_opt = '?'; - } - } - break; - } - } - - if (l_opts[i].name == NULL) { - /* exhausted all of the l_opts we have and still didn't match */ - if (opt_err) - HDfprintf(rawerrorstream, "%s: unknown option \"%s\"\n", argv[0], arg); - - opt_opt = '?'; - } - - opt_ind++; - sp = 1; - - HDfree(arg); - } - else { - register char *cp; /* pointer into current token */ - - /* short command line option */ - opt_opt = argv[opt_ind][sp]; - - if (opt_opt == ':' || (cp = HDstrchr(opts, opt_opt)) == 0) { - if (opt_err) - HDfprintf(rawerrorstream, "%s: unknown option \"%c\"\n", argv[0], opt_opt); - - /* if no chars left in this token, move to next token */ - if (argv[opt_ind][++sp] == '\0') { - opt_ind++; - sp = 1; - } - return '?'; - } - - if (*++cp == ':') { - /* if a value is expected, get it */ - if (argv[opt_ind][sp + 1] != '\0') { - /* flag value is rest of current token */ - opt_arg = &argv[opt_ind++][sp + 1]; - } - else if (++opt_ind >= argc) { - if (opt_err) - HDfprintf(rawerrorstream, "%s: value expected for option \"%c\"\n", argv[0], opt_opt); - - opt_opt = '?'; - } - else { - /* flag value is next token */ - opt_arg = argv[opt_ind++]; - } - - sp = 1; - } - /* wildcard argument */ - else if (*cp == '*') { - /* check the next argument */ - opt_ind++; - /* we do have an extra argument, check if not last */ - if ((opt_ind + 1) < argc) { - if (argv[opt_ind][0] != '-') { - opt_arg = argv[opt_ind++]; - } - else { - opt_arg = NULL; - } - } - else { - opt_arg = NULL; - } - } - else { - /* set up to look at next char in token, next time */ - if (argv[opt_ind][++sp] == '\0') { - /* no more in current token, so setup next token */ - opt_ind++; - sp = 1; - } - opt_arg = NULL; - } - } - - /* return the current flag character found */ - return opt_opt; -} - /***************************************************************************** * * Function: parse_tuple() diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 307ce20..095ad6c 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -40,58 +40,6 @@ H5TOOLS_DLLVAR FILE *overflow_file; H5TOOLS_DLLVAR hsize_t H5TOOLS_MALLOCSIZE; /* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ H5TOOLS_DLLVAR hsize_t H5TOOLS_BUFSIZE; -/* - * begin get_option section - */ -H5TOOLS_DLLVAR int opt_err; /* getoption prints errors if this is on */ -H5TOOLS_DLLVAR int opt_ind; /* token pointer */ -H5TOOLS_DLLVAR const char *opt_arg; /* flag argument (or value) */ - -enum { - no_arg = 0, /* doesn't take an argument */ - require_arg, /* requires an argument */ - optional_arg /* argument is optional */ -}; - -/* - * get_option determines which options are specified on the command line and - * returns a pointer to any arguments possibly associated with the option in - * the ``opt_arg'' variable. get_option returns the shortname equivalent of - * the option. The long options are specified in the following way: - * - * struct long_options foo[] = { - * { "filename", require_arg, 'f' }, - * { "append", no_arg, 'a' }, - * { "width", require_arg, 'w' }, - * { NULL, 0, 0 } - * }; - * - * Long named options can have arguments specified as either: - * - * ``--param=arg'' or ``--param arg'' - * - * Short named options can have arguments specified as either: - * - * ``-w80'' or ``-w 80'' - * - * and can have more than one short named option specified at one time: - * - * -aw80 - * - * in which case those options which expect an argument need to come at the - * end. - */ -typedef struct long_options { - const char *name; /* name of the long option */ - int has_arg; /* whether we should look for an arg */ - char shortval; /* the shortname equivalent of long arg - * this gets returned from get_option */ -} long_options; - -H5TOOLS_DLL int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt); -/* - * end get_option section - */ /*struct taken from the dumper. needed in table struct*/ typedef struct obj_t { diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index f618914..4e9a25e 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -19,23 +19,23 @@ #define PROGRAMNAME "h5copy" /* command-line options: short and long-named parameters */ -static const char * s_opts = "d:f:hi:o:ps:vVE"; -static struct long_options l_opts[] = {{"destination", require_arg, 'd'}, - {"flag", require_arg, 'f'}, - {"help", no_arg, 'h'}, - {"input", require_arg, 'i'}, - {"output", require_arg, 'o'}, - {"parents", no_arg, 'p'}, - {"source", require_arg, 's'}, - {"verbose", no_arg, 'v'}, - {"version", no_arg, 'V'}, - {"enable-error-stack", no_arg, 'E'}, - {NULL, 0, '\0'}}; -char * fname_src = NULL; -char * fname_dst = NULL; -char * oname_src = NULL; -char * oname_dst = NULL; -char * str_flag = NULL; +static const char * s_opts = "d:f:hi:o:ps:vVE"; +static struct h5_long_options l_opts[] = {{"destination", require_arg, 'd'}, + {"flag", require_arg, 'f'}, + {"help", no_arg, 'h'}, + {"input", require_arg, 'i'}, + {"output", require_arg, 'o'}, + {"parents", no_arg, 'p'}, + {"source", require_arg, 's'}, + {"verbose", no_arg, 'v'}, + {"version", no_arg, 'V'}, + {"enable-error-stack", no_arg, 'E'}, + {NULL, 0, '\0'}}; +char * fname_src = NULL; +char * fname_dst = NULL; +char * oname_src = NULL; +char * oname_dst = NULL; +char * str_flag = NULL; /*------------------------------------------------------------------------- * Function: leave @@ -242,19 +242,19 @@ main(int argc, const char *argv[]) } /* end if */ /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'd': - oname_dst = HDstrdup(opt_arg); + oname_dst = HDstrdup(H5_optarg); break; case 'f': /* validate flag */ - if (parse_flag(opt_arg, &flag) < 0) { + if (parse_flag(H5_optarg, &flag) < 0) { usage(); leave(EXIT_FAILURE); } - str_flag = HDstrdup(opt_arg); + str_flag = HDstrdup(H5_optarg); break; case 'h': @@ -263,11 +263,11 @@ main(int argc, const char *argv[]) break; case 'i': - fname_src = HDstrdup(opt_arg); + fname_src = HDstrdup(H5_optarg); break; case 'o': - fname_dst = HDstrdup(opt_arg); + fname_dst = HDstrdup(H5_optarg); break; case 'p': @@ -275,7 +275,7 @@ main(int argc, const char *argv[]) break; case 's': - oname_src = HDstrdup(opt_arg); + oname_src = HDstrdup(H5_optarg); break; case 'V': diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 1b81824..b669087 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -25,30 +25,30 @@ static int check_d_input(const char *); * Command-line options: The user can specify short or long-named * parameters. */ -static const char * s_opts = "hVrv*qn:d:p:NcelxE:A:S"; -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, - {"version", no_arg, 'V'}, - {"report", no_arg, 'r'}, - {"verbose", optional_arg, 'v'}, - {"quiet", no_arg, 'q'}, - {"count", require_arg, 'n'}, - {"delta", require_arg, 'd'}, - {"relative", require_arg, 'p'}, - {"nan", no_arg, 'N'}, - {"compare", no_arg, 'c'}, - {"use-system-epsilon", no_arg, 'e'}, - {"follow-symlinks", no_arg, 'l'}, - {"no-dangling-links", no_arg, 'x'}, - {"exclude-path", require_arg, 'E'}, - {"exclude-attribute", require_arg, 'A'}, - {"enable-error-stack", no_arg, 'S'}, - {"vol-value-1", require_arg, '1'}, - {"vol-name-1", require_arg, '2'}, - {"vol-info-1", require_arg, '3'}, - {"vol-value-2", require_arg, '4'}, - {"vol-name-2", require_arg, '5'}, - {"vol-info-2", require_arg, '6'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "hVrv*qn:d:p:NcelxE:A:S"; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, + {"version", no_arg, 'V'}, + {"report", no_arg, 'r'}, + {"verbose", optional_arg, 'v'}, + {"quiet", no_arg, 'q'}, + {"count", require_arg, 'n'}, + {"delta", require_arg, 'd'}, + {"relative", require_arg, 'p'}, + {"nan", no_arg, 'N'}, + {"compare", no_arg, 'c'}, + {"use-system-epsilon", no_arg, 'e'}, + {"follow-symlinks", no_arg, 'l'}, + {"no-dangling-links", no_arg, 'x'}, + {"exclude-path", require_arg, 'E'}, + {"exclude-attribute", require_arg, 'A'}, + {"enable-error-stack", no_arg, 'S'}, + {"vol-value-1", require_arg, '1'}, + {"vol-name-1", require_arg, '2'}, + {"vol-info-1", require_arg, '3'}, + {"vol-value-2", require_arg, '4'}, + {"vol-name-2", require_arg, '5'}, + {"vol-info-2", require_arg, '6'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: check_options @@ -232,7 +232,7 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char exclude_attr_head = NULL; /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { default: usage(); @@ -256,20 +256,20 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char * special check for short opt */ if (!strcmp(argv[i], "-v")) { - if (opt_arg != NULL) - opt_ind--; + if (H5_optarg != NULL) + H5_optind--; opts->mode_verbose_level = 0; break; } else if (!strncmp(argv[i], "-v", (size_t)2)) { - if (opt_arg != NULL) - opt_ind--; + if (H5_optarg != NULL) + H5_optind--; opts->mode_verbose_level = atoi(&argv[i][2]); break; } else { - if (opt_arg != NULL) - opts->mode_verbose_level = HDatoi(opt_arg); + if (H5_optarg != NULL) + opts->mode_verbose_level = HDatoi(H5_optarg); else opts->mode_verbose_level = 0; } @@ -308,7 +308,7 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char } /* init */ - exclude_node->obj_path = opt_arg; + exclude_node->obj_path = H5_optarg; exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN; exclude_prev = exclude_head; @@ -336,7 +336,7 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char } /* init */ - exclude_attr_node->obj_path = opt_arg; + exclude_attr_node->obj_path = H5_optarg; exclude_attr_node->obj_type = H5TRAV_TYPE_UNKNOWN; exclude_attr_prev = exclude_attr_head; @@ -356,23 +356,23 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char case 'd': opts->delta_bool = 1; - if (check_d_input(opt_arg) == -1) { - HDprintf("<-d %s> is not a valid option\n", opt_arg); + if (check_d_input(H5_optarg) == -1) { + HDprintf("<-d %s> is not a valid option\n", H5_optarg); usage(); h5diff_exit(EXIT_FAILURE); } - opts->delta = HDatof(opt_arg); + opts->delta = HDatof(H5_optarg); /* do not check against default, the DBL_EPSILON is being replaced by user */ break; case 'p': opts->percent_bool = 1; - if (check_p_input(opt_arg) == -1) { - HDprintf("<-p %s> is not a valid option\n", opt_arg); + if (check_p_input(H5_optarg) == -1) { + HDprintf("<-p %s> is not a valid option\n", H5_optarg); usage(); h5diff_exit(EXIT_FAILURE); } - opts->percent = HDatof(opt_arg); + opts->percent = HDatof(H5_optarg); /* -p 0 is the same as default */ if (H5_DBL_ABS_EQUAL(opts->percent, 0.0)) @@ -381,12 +381,12 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char case 'n': opts->count_bool = 1; - if (check_n_input(opt_arg) == -1) { - HDprintf("<-n %s> is not a valid option\n", opt_arg); + if (check_n_input(H5_optarg) == -1) { + HDprintf("<-n %s> is not a valid option\n", H5_optarg); usage(); h5diff_exit(EXIT_FAILURE); } - opts->count = HDstrtoull(opt_arg, NULL, 0); + opts->count = HDstrtoull(H5_optarg, NULL, 0); break; case 'N': @@ -403,34 +403,34 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char case '1': opts->vol_info[0].type = VOL_BY_VALUE; - opts->vol_info[0].u.value = (H5VL_class_value_t)HDatoi(opt_arg); + opts->vol_info[0].u.value = (H5VL_class_value_t)HDatoi(H5_optarg); opts->custom_vol[0] = TRUE; break; case '2': opts->vol_info[0].type = VOL_BY_NAME; - opts->vol_info[0].u.name = opt_arg; + opts->vol_info[0].u.name = H5_optarg; opts->custom_vol[0] = TRUE; break; case '3': - opts->vol_info[0].info_string = opt_arg; + opts->vol_info[0].info_string = H5_optarg; break; case '4': opts->vol_info[1].type = VOL_BY_VALUE; - opts->vol_info[1].u.value = (H5VL_class_value_t)HDatoi(opt_arg); + opts->vol_info[1].u.value = (H5VL_class_value_t)HDatoi(H5_optarg); opts->custom_vol[1] = TRUE; break; case '5': opts->vol_info[1].type = VOL_BY_NAME; - opts->vol_info[1].u.name = opt_arg; + opts->vol_info[1].u.name = H5_optarg; opts->custom_vol[1] = TRUE; break; case '6': - opts->vol_info[1].info_string = opt_arg; + opts->vol_info[1].info_string = H5_optarg; break; } } @@ -447,15 +447,15 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char opts->exclude_attr = exclude_attr_head; /* check for file names to be processed */ - if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { + if (argc <= H5_optind || argv[H5_optind + 1] == NULL) { error_msg("missing file names\n"); usage(); h5diff_exit(EXIT_FAILURE); } - *fname1 = argv[opt_ind]; - *fname2 = argv[opt_ind + 1]; - *objname1 = argv[opt_ind + 2]; + *fname1 = argv[H5_optind]; + *fname2 = argv[H5_optind + 1]; + *objname1 = argv[H5_optind + 2]; H5TOOLS_DEBUG("file1 = %s", *fname1); H5TOOLS_DEBUG("file2 = %s", *fname2); @@ -466,8 +466,8 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char } H5TOOLS_DEBUG("objname1 = %s", *objname1); - if (argv[opt_ind + 3] != NULL) { - *objname2 = argv[opt_ind + 3]; + if (argv[H5_optind + 3] != NULL) { + *objname2 = argv[H5_optind + 3]; } else { *objname2 = *objname1; diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 9f526da..70f03df 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -80,132 +80,132 @@ struct handler_t { */ /* The following initialization makes use of C language concatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char * s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HM:N:O*RS:VX:"; -static struct long_options l_opts[] = {{"attribute", require_arg, 'a'}, - {"attribut", require_arg, 'a'}, - {"attribu", require_arg, 'a'}, - {"attrib", require_arg, 'a'}, - {"attri", require_arg, 'a'}, - {"attr", require_arg, 'a'}, - {"att", require_arg, 'a'}, - {"at", require_arg, 'a'}, - {"binary", optional_arg, 'b'}, - {"count", require_arg, 'c'}, - {"coun", require_arg, 'c'}, - {"cou", require_arg, 'c'}, - {"co", require_arg, 'c'}, - {"dataset", require_arg, 'd'}, - {"datase", require_arg, 'd'}, - {"datas", require_arg, 'd'}, - {"escape", no_arg, 'e'}, - {"filedriver", require_arg, 'f'}, - {"filedrive", require_arg, 'f'}, - {"filedriv", require_arg, 'f'}, - {"filedri", require_arg, 'f'}, - {"filedr", require_arg, 'f'}, - {"filed", require_arg, 'f'}, - {"file", require_arg, 'f'}, - {"fil", require_arg, 'f'}, - {"fi", require_arg, 'f'}, - {"group", require_arg, 'g'}, - {"grou", require_arg, 'g'}, - {"gro", require_arg, 'g'}, - {"gr", require_arg, 'g'}, - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"object-ids", no_arg, 'i'}, - {"object-id", no_arg, 'i'}, - {"object-i", no_arg, 'i'}, - {"object", no_arg, 'i'}, - {"objec", no_arg, 'i'}, - {"obje", no_arg, 'i'}, - {"obj", no_arg, 'i'}, - {"ob", no_arg, 'i'}, - {"block", require_arg, 'k'}, - {"bloc", require_arg, 'k'}, - {"blo", require_arg, 'k'}, - {"bl", require_arg, 'k'}, - {"soft-link", require_arg, 'l'}, - {"soft-lin", require_arg, 'l'}, - {"soft-li", require_arg, 'l'}, - {"soft-l", require_arg, 'l'}, - {"soft", require_arg, 'l'}, - {"sof", require_arg, 'l'}, - {"format", require_arg, 'm'}, - {"contents", optional_arg, 'n'}, - {"output", optional_arg, 'o'}, - {"outpu", optional_arg, 'o'}, - {"outp", optional_arg, 'o'}, - {"out", optional_arg, 'o'}, - {"ou", optional_arg, 'o'}, - {"properties", no_arg, 'p'}, - {"sort_by", require_arg, 'q'}, - {"string", no_arg, 'r'}, - {"strin", no_arg, 'r'}, - {"start", require_arg, 's'}, - {"star", require_arg, 's'}, - {"sta", require_arg, 's'}, - {"datatype", require_arg, 't'}, - {"datatyp", require_arg, 't'}, - {"dataty", require_arg, 't'}, - {"datat", require_arg, 't'}, - {"use-dtd", no_arg, 'u'}, - {"use-dt", no_arg, 'u'}, - {"use-d", no_arg, 'u'}, - {"use-", no_arg, 'u'}, - {"use", no_arg, 'u'}, - {"us", no_arg, 'u'}, - {"u", no_arg, 'u'}, - {"vds-view-first-missing", no_arg, 'v'}, - {"width", require_arg, 'w'}, - {"widt", require_arg, 'w'}, - {"wid", require_arg, 'w'}, - {"wi", require_arg, 'w'}, - {"xml", no_arg, 'x'}, - {"xm", no_arg, 'x'}, - {"noindex", no_arg, 'y'}, - {"sort_order", require_arg, 'z'}, - {"onlyattr", optional_arg, 'A'}, - {"superblock", no_arg, 'B'}, - {"boot-block", no_arg, 'B'}, - {"boot-bloc", no_arg, 'B'}, - {"boot-blo", no_arg, 'B'}, - {"boot-bl", no_arg, 'B'}, - {"boot-b", no_arg, 'B'}, - {"boot", no_arg, 'B'}, - {"boo", no_arg, 'B'}, - {"bo", no_arg, 'B'}, - {"no-compact-subset", no_arg, 'C'}, - {"xml-dtd", require_arg, 'D'}, - {"xml-dt", require_arg, 'D'}, - {"xml-d", require_arg, 'D'}, - {"enable-error-stack", optional_arg, 'E'}, - {"form", require_arg, 'F'}, - {"vds-gap-size", require_arg, 'G'}, - {"header", no_arg, 'H'}, - {"heade", no_arg, 'H'}, - {"head", no_arg, 'H'}, - {"hea", no_arg, 'H'}, - {"packed-bits", require_arg, 'M'}, - {"any_path", require_arg, 'N'}, - {"ddl", optional_arg, 'O'}, - {"region", no_arg, 'R'}, - {"stride", require_arg, 'S'}, - {"strid", require_arg, 'S'}, - {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"ver", no_arg, 'V'}, - {"ve", no_arg, 'V'}, - {"xml-ns", require_arg, 'X'}, - {"xml-n", require_arg, 'X'}, - {"s3-cred", require_arg, '$'}, - {"hdfs-attrs", require_arg, '#'}, - {"vol-value", require_arg, '1'}, - {"vol-name", require_arg, '2'}, - {"vol-info", require_arg, '3'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HM:N:O*RS:VX:"; +static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'}, + {"attribut", require_arg, 'a'}, + {"attribu", require_arg, 'a'}, + {"attrib", require_arg, 'a'}, + {"attri", require_arg, 'a'}, + {"attr", require_arg, 'a'}, + {"att", require_arg, 'a'}, + {"at", require_arg, 'a'}, + {"binary", optional_arg, 'b'}, + {"count", require_arg, 'c'}, + {"coun", require_arg, 'c'}, + {"cou", require_arg, 'c'}, + {"co", require_arg, 'c'}, + {"dataset", require_arg, 'd'}, + {"datase", require_arg, 'd'}, + {"datas", require_arg, 'd'}, + {"escape", no_arg, 'e'}, + {"filedriver", require_arg, 'f'}, + {"filedrive", require_arg, 'f'}, + {"filedriv", require_arg, 'f'}, + {"filedri", require_arg, 'f'}, + {"filedr", require_arg, 'f'}, + {"filed", require_arg, 'f'}, + {"file", require_arg, 'f'}, + {"fil", require_arg, 'f'}, + {"fi", require_arg, 'f'}, + {"group", require_arg, 'g'}, + {"grou", require_arg, 'g'}, + {"gro", require_arg, 'g'}, + {"gr", require_arg, 'g'}, + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"object-ids", no_arg, 'i'}, + {"object-id", no_arg, 'i'}, + {"object-i", no_arg, 'i'}, + {"object", no_arg, 'i'}, + {"objec", no_arg, 'i'}, + {"obje", no_arg, 'i'}, + {"obj", no_arg, 'i'}, + {"ob", no_arg, 'i'}, + {"block", require_arg, 'k'}, + {"bloc", require_arg, 'k'}, + {"blo", require_arg, 'k'}, + {"bl", require_arg, 'k'}, + {"soft-link", require_arg, 'l'}, + {"soft-lin", require_arg, 'l'}, + {"soft-li", require_arg, 'l'}, + {"soft-l", require_arg, 'l'}, + {"soft", require_arg, 'l'}, + {"sof", require_arg, 'l'}, + {"format", require_arg, 'm'}, + {"contents", optional_arg, 'n'}, + {"output", optional_arg, 'o'}, + {"outpu", optional_arg, 'o'}, + {"outp", optional_arg, 'o'}, + {"out", optional_arg, 'o'}, + {"ou", optional_arg, 'o'}, + {"properties", no_arg, 'p'}, + {"sort_by", require_arg, 'q'}, + {"string", no_arg, 'r'}, + {"strin", no_arg, 'r'}, + {"start", require_arg, 's'}, + {"star", require_arg, 's'}, + {"sta", require_arg, 's'}, + {"datatype", require_arg, 't'}, + {"datatyp", require_arg, 't'}, + {"dataty", require_arg, 't'}, + {"datat", require_arg, 't'}, + {"use-dtd", no_arg, 'u'}, + {"use-dt", no_arg, 'u'}, + {"use-d", no_arg, 'u'}, + {"use-", no_arg, 'u'}, + {"use", no_arg, 'u'}, + {"us", no_arg, 'u'}, + {"u", no_arg, 'u'}, + {"vds-view-first-missing", no_arg, 'v'}, + {"width", require_arg, 'w'}, + {"widt", require_arg, 'w'}, + {"wid", require_arg, 'w'}, + {"wi", require_arg, 'w'}, + {"xml", no_arg, 'x'}, + {"xm", no_arg, 'x'}, + {"noindex", no_arg, 'y'}, + {"sort_order", require_arg, 'z'}, + {"onlyattr", optional_arg, 'A'}, + {"superblock", no_arg, 'B'}, + {"boot-block", no_arg, 'B'}, + {"boot-bloc", no_arg, 'B'}, + {"boot-blo", no_arg, 'B'}, + {"boot-bl", no_arg, 'B'}, + {"boot-b", no_arg, 'B'}, + {"boot", no_arg, 'B'}, + {"boo", no_arg, 'B'}, + {"bo", no_arg, 'B'}, + {"no-compact-subset", no_arg, 'C'}, + {"xml-dtd", require_arg, 'D'}, + {"xml-dt", require_arg, 'D'}, + {"xml-d", require_arg, 'D'}, + {"enable-error-stack", optional_arg, 'E'}, + {"form", require_arg, 'F'}, + {"vds-gap-size", require_arg, 'G'}, + {"header", no_arg, 'H'}, + {"heade", no_arg, 'H'}, + {"head", no_arg, 'H'}, + {"hea", no_arg, 'H'}, + {"packed-bits", require_arg, 'M'}, + {"any_path", require_arg, 'N'}, + {"ddl", optional_arg, 'O'}, + {"region", no_arg, 'R'}, + {"stride", require_arg, 'S'}, + {"strid", require_arg, 'S'}, + {"version", no_arg, 'V'}, + {"versio", no_arg, 'V'}, + {"versi", no_arg, 'V'}, + {"vers", no_arg, 'V'}, + {"ver", no_arg, 'V'}, + {"ve", no_arg, 'V'}, + {"xml-ns", require_arg, 'X'}, + {"xml-n", require_arg, 'X'}, + {"s3-cred", require_arg, '$'}, + {"hdfs-attrs", require_arg, '#'}, + {"vol-value", require_arg, '1'}, + {"vol-name", require_arg, '2'}, + {"vol-info", require_arg, '3'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: leave @@ -917,7 +917,7 @@ parse_command_line(int argc, const char *argv[]) } /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { parse_start: switch ((char)opt) { case 'R': @@ -931,8 +931,8 @@ parse_start: case 'n': dump_opts.display_fi = TRUE; last_was_dset = FALSE; - if (opt_arg != NULL) - h5trav_set_verbose(HDatoi(opt_arg)); + if (H5_optarg != NULL) + h5trav_set_verbose(HDatoi(H5_optarg)); break; case 'p': dump_opts.display_dcpl = TRUE; @@ -949,8 +949,8 @@ parse_start: last_was_dset = FALSE; break; case 'A': - if (opt_arg != NULL) { - if (0 == HDatoi(opt_arg)) + if (H5_optarg != NULL) { + if (0 == HDatoi(H5_optarg)) dump_opts.include_attrs = FALSE; } else { @@ -974,7 +974,7 @@ parse_start: goto done; break; case 'w': { - int sh5tools_nCols = HDatoi(opt_arg); + int sh5tools_nCols = HDatoi(H5_optarg); if (sh5tools_nCols <= 0) h5tools_nCols = 65535; @@ -988,7 +988,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_paths; - hand[i].obj = HDstrdup(opt_arg); + hand[i].obj = HDstrdup(H5_optarg); break; } @@ -1000,7 +1000,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_attributes; - hand[i].obj = HDstrdup(opt_arg); + hand[i].obj = HDstrdup(H5_optarg); break; } @@ -1012,7 +1012,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_datasets; - hand[i].obj = HDstrdup(opt_arg); + hand[i].obj = HDstrdup(H5_optarg); hand[i].subset_info = parse_subset_params(hand[i].obj); last_dset = &hand[i]; break; @@ -1021,7 +1021,7 @@ parse_start: last_was_dset = TRUE; break; case 'f': - driver_name_g = opt_arg; + driver_name_g = H5_optarg; break; case 'g': dump_opts.display_all = 0; @@ -1029,7 +1029,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_groups; - hand[i].obj = HDstrdup(opt_arg); + hand[i].obj = HDstrdup(H5_optarg); break; } @@ -1041,7 +1041,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_links; - hand[i].obj = HDstrdup(opt_arg); + hand[i].obj = HDstrdup(H5_optarg); break; } @@ -1053,7 +1053,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_datatypes; - hand[i].obj = HDstrdup(opt_arg); + hand[i].obj = HDstrdup(H5_optarg); break; } @@ -1061,7 +1061,7 @@ parse_start: break; case 'O': - if (h5tools_set_output_file(opt_arg, 0) < 0) { + if (h5tools_set_output_file(H5_optarg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -1069,20 +1069,20 @@ parse_start: case 'o': if (bin_output) { - if (h5tools_set_data_output_file(opt_arg, 1) < 0) { + if (h5tools_set_data_output_file(H5_optarg, 1) < 0) { usage(h5tools_getprogname()); goto error; } } else { if (dump_opts.display_attr_data && !dump_opts.display_data) { - if (h5tools_set_attr_output_file(opt_arg, 0) < 0) { + if (h5tools_set_attr_output_file(H5_optarg, 0) < 0) { usage(h5tools_getprogname()); goto error; } } if (dump_opts.display_data || dump_opts.display_all) { - if (h5tools_set_data_output_file(opt_arg, 0) < 0) { + if (h5tools_set_data_output_file(H5_optarg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -1091,12 +1091,12 @@ parse_start: dump_opts.usingdasho = TRUE; last_was_dset = FALSE; - outfname_g = opt_arg; + outfname_g = H5_optarg; break; case 'b': - if (opt_arg != NULL) { - if ((bin_form = set_binary_form(opt_arg)) < 0) { + if (H5_optarg != NULL) { + if ((bin_form = set_binary_form(H5_optarg)) < 0) { /* failed to set binary form */ usage(h5tools_getprogname()); goto error; @@ -1115,7 +1115,7 @@ parse_start: break; case 'q': - if ((sort_by = set_sort_by(opt_arg)) < 0) { + if ((sort_by = set_sort_by(H5_optarg)) < 0) { /* failed to set "sort by" form */ usage(h5tools_getprogname()); goto error; @@ -1123,7 +1123,7 @@ parse_start: break; case 'z': - if ((sort_order = set_sort_order(opt_arg)) < 0) { + if ((sort_order = set_sort_order(H5_optarg)) < 0) { /* failed to set "sort order" form */ usage(h5tools_getprogname()); goto error; @@ -1135,7 +1135,7 @@ parse_start: error_msg("option \"-%c\" can only be used after --dataset option\n", opt); goto error; } - if (parse_mask_list(opt_arg) != SUCCEED) { + if (parse_mask_list(H5_optarg) != SUCCEED) { usage(h5tools_getprogname()); goto error; } @@ -1145,7 +1145,7 @@ parse_start: dump_opts.display_vds_first = TRUE; break; case 'G': - dump_opts.vds_gap_size = HDatoi(opt_arg); + dump_opts.vds_gap_size = HDatoi(H5_optarg); if (dump_opts.vds_gap_size < 0) { usage(h5tools_getprogname()); goto error; @@ -1172,13 +1172,13 @@ parse_start: case 'D': /* specify alternative XML DTD or schema */ /* To Do: check format of this value? */ - xml_dtd_uri_g = opt_arg; + xml_dtd_uri_g = H5_optarg; h5tools_nCols = 0; break; case 'm': /* specify alternative floating point printing format */ - fp_format = opt_arg; + fp_format = H5_optarg; h5tools_nCols = 0; break; @@ -1189,10 +1189,10 @@ parse_start: usage(h5tools_getprogname()); goto error; } - if (HDstrcmp(opt_arg, ":") == 0) + if (HDstrcmp(H5_optarg, ":") == 0) xmlnsprefix = ""; else - xmlnsprefix = opt_arg; + xmlnsprefix = H5_optarg; h5tools_nCols = 0; break; /** end XML parameters **/ @@ -1238,33 +1238,33 @@ parse_start: HDfree(s->start.data); s->start.data = NULL; } - parse_hsize_list(opt_arg, &s->start); + parse_hsize_list(H5_optarg, &s->start); break; case 'S': if (s->stride.data) { HDfree(s->stride.data); s->stride.data = NULL; } - parse_hsize_list(opt_arg, &s->stride); + parse_hsize_list(H5_optarg, &s->stride); break; case 'c': if (s->count.data) { HDfree(s->count.data); s->count.data = NULL; } - parse_hsize_list(opt_arg, &s->count); + parse_hsize_list(H5_optarg, &s->count); break; case 'k': if (s->block.data) { HDfree(s->block.data); s->block.data = NULL; } - parse_hsize_list(opt_arg, &s->block); + parse_hsize_list(H5_optarg, &s->block); break; default: goto end_collect; } - } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF); + } while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF); end_collect: last_was_dset = FALSE; @@ -1277,8 +1277,8 @@ end_collect: /** end subsetting parameters **/ case 'E': - if (opt_arg != NULL) - enable_error_stack = HDatoi(opt_arg); + if (H5_optarg != NULL) + enable_error_stack = HDatoi(H5_optarg); else enable_error_stack = 1; break; @@ -1294,7 +1294,7 @@ end_collect: case '$': #ifdef H5_HAVE_ROS3_VFD - if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa_g) < 0) { + if (h5tools_parse_ros3_fapl_tuple(H5_optarg, ',', &ros3_fa_g) < 0) { error_msg("failed to parse S3 VFD credential info\n"); usage(h5tools_getprogname()); free_handler(hand, argc); @@ -1311,7 +1311,7 @@ end_collect: case '#': #ifdef H5_HAVE_LIBHDFS - if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa_g) < 0) { + if (h5tools_parse_hdfs_fapl_tuple(H5_optarg, ',', &hdfs_fa_g) < 0) { error_msg("failed to parse HDFS VFD configuration info\n"); usage(h5tools_getprogname()); free_handler(hand, argc); @@ -1328,18 +1328,18 @@ end_collect: case '1': vol_info_g.type = VOL_BY_VALUE; - vol_info_g.u.value = (H5VL_class_value_t)HDatoi(opt_arg); + vol_info_g.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); use_custom_vol_g = TRUE; break; case '2': vol_info_g.type = VOL_BY_NAME; - vol_info_g.u.name = opt_arg; + vol_info_g.u.name = H5_optarg; use_custom_vol_g = TRUE; break; case '3': - vol_info_g.info_string = opt_arg; + vol_info_g.info_string = H5_optarg; break; case '?': @@ -1351,7 +1351,7 @@ end_collect: parse_end: /* check for file name to be processed */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); goto error; @@ -1443,7 +1443,7 @@ main(int argc, const char *argv[]) } } - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); @@ -1496,8 +1496,8 @@ main(int argc, const char *argv[]) } } - while (opt_ind < argc) { - fname = HDstrdup(argv[opt_ind++]); + while (H5_optind < argc) { + fname = HDstrdup(argv[H5_optind++]); fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0); diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 321f274..3430c55 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -38,28 +38,28 @@ static int verbose_g = 0; * Command-line options: The user can specify short or long-named * parameters. */ -static const char * s_opts = "hVvd:n"; -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"version", no_arg, 'V'}, - {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"verbose", no_arg, 'v'}, - {"verbos", no_arg, 'v'}, - {"verbo", no_arg, 'v'}, - {"verb", no_arg, 'v'}, - {"dname", require_arg, 'd'}, - {"dnam", require_arg, 'd'}, - {"dna", require_arg, 'd'}, - {"dn", require_arg, 'd'}, - {"noop", no_arg, 'n'}, - {"noo", no_arg, 'n'}, - {"no", no_arg, 'n'}, - {"enable-error-stack", no_arg, 'E'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "hVvd:n"; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"version", no_arg, 'V'}, + {"version", no_arg, 'V'}, + {"versio", no_arg, 'V'}, + {"versi", no_arg, 'V'}, + {"vers", no_arg, 'V'}, + {"verbose", no_arg, 'v'}, + {"verbos", no_arg, 'v'}, + {"verbo", no_arg, 'v'}, + {"verb", no_arg, 'v'}, + {"dname", require_arg, 'd'}, + {"dnam", require_arg, 'd'}, + {"dna", require_arg, 'd'}, + {"dn", require_arg, 'd'}, + {"noop", no_arg, 'n'}, + {"noo", no_arg, 'n'}, + {"no", no_arg, 'n'}, + {"enable-error-stack", no_arg, 'E'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -123,7 +123,7 @@ parse_command_line(int argc, const char **argv) } /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'h': usage(h5tools_getprogname()); @@ -140,11 +140,11 @@ parse_command_line(int argc, const char **argv) break; case 'd': /* -d dname */ - if (opt_arg != NULL && *opt_arg) - dname_g = HDstrdup(opt_arg); + if (H5_optarg != NULL && *H5_optarg) + dname_g = HDstrdup(H5_optarg); if (dname_g == NULL) { h5tools_setstatus(EXIT_FAILURE); - error_msg("No dataset name\n", opt_arg); + error_msg("No dataset name\n", H5_optarg); usage(h5tools_getprogname()); goto error; } @@ -167,19 +167,19 @@ parse_command_line(int argc, const char **argv) } /* switch */ } /* while */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto error; } - fname_g = HDstrdup(argv[opt_ind]); + fname_g = HDstrdup(argv[H5_optind]); - return (0); + return 0; error: - return (-1); + return -1; ; } /* parse_command_line() */ diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 5bcbf45..0a2ea5d 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -34,8 +34,8 @@ char *ub_file = NULL; * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "hi:u:o:c:V"; /* add more later ? */ -static struct long_options l_opts[] = { +static const char * s_opts = "hi:u:o:c:V"; /* add more later ? */ +static struct h5_long_options l_opts[] = { {"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {"i", require_arg, 'i'}, /* input file */ {"u", require_arg, 'u'}, /* user block file */ {"o", require_arg, 'o'}, /* output file */ @@ -113,16 +113,16 @@ parse_command_line(int argc, const char *argv[]) int opt = FALSE; /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'o': - output_file = HDstrdup(opt_arg); + output_file = HDstrdup(H5_optarg); break; case 'i': - input_file = HDstrdup(opt_arg); + input_file = HDstrdup(H5_optarg); break; case 'u': - ub_file = HDstrdup(opt_arg); + ub_file = HDstrdup(H5_optarg); break; case 'c': do_clobber = TRUE; diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index cde7ec7..38d1a5e 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -35,8 +35,8 @@ char *ub_file = NULL; * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "hu:i:o:d:V"; -static struct long_options l_opts[] = { +static const char * s_opts = "hu:i:o:d:V"; +static struct h5_long_options l_opts[] = { {"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {"i", require_arg, 'i'}, /* input file */ {"u", require_arg, 'u'}, /* user block file */ {"o", require_arg, 'o'}, /* output file */ @@ -101,23 +101,23 @@ parse_command_line(int argc, const char *argv[]) int opt = FALSE; /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'o': - output_file = HDstrdup(opt_arg); + output_file = HDstrdup(H5_optarg); if (output_file) h5tools_set_data_output_file(output_file, 1); break; case 'i': - input_file = HDstrdup(opt_arg); + input_file = HDstrdup(H5_optarg); if (input_file) h5tools_set_input_file(input_file, 1); break; ; case 'u': - ub_file = HDstrdup(opt_arg); + ub_file = HDstrdup(H5_optarg); if (ub_file) h5tools_set_output_file(ub_file, 1); else diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 474a56f..3526268 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -31,44 +31,44 @@ const char *outfile = NULL; * Command-line options: The user can specify short or long-named * parameters. */ -static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW1:2:3:4:5:6:"; -static struct long_options l_opts[] = {{"alignment", require_arg, 'a'}, - {"block", require_arg, 'b'}, - {"compact", require_arg, 'c'}, - {"indexed", require_arg, 'd'}, - {"file", require_arg, 'e'}, - {"filter", require_arg, 'f'}, - {"help", no_arg, 'h'}, - {"infile", require_arg, 'i'}, /* for backward compability */ - {"low", require_arg, 'j'}, - {"high", require_arg, 'k'}, - {"layout", require_arg, 'l'}, - {"minimum", require_arg, 'm'}, - {"native", no_arg, 'n'}, - {"outfile", require_arg, 'o'}, /* for backward compability */ - {"sort_by", require_arg, 'q'}, - {"ssize", require_arg, 's'}, - {"threshold", require_arg, 't'}, - {"ublock", require_arg, 'u'}, - {"verbose", no_arg, 'v'}, - {"sort_order", require_arg, 'z'}, - {"enable-error-stack", no_arg, 'E'}, - {"fs_pagesize", require_arg, 'G'}, - {"latest", no_arg, 'L'}, - {"metadata_block_size", require_arg, 'M'}, - {"fs_persist", require_arg, 'P'}, - {"fs_strategy", require_arg, 'S'}, - {"fs_threshold", require_arg, 'T'}, - {"version", no_arg, 'V'}, - {"merge", no_arg, 'X'}, - {"prune", no_arg, 'W'}, - {"src-vol-value", require_arg, '1'}, - {"src-vol-name", require_arg, '2'}, - {"src-vol-info", require_arg, '3'}, - {"dst-vol-value", require_arg, '4'}, - {"dst-vol-name", require_arg, '5'}, - {"dst-vol-info", require_arg, '6'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW1:2:3:4:5:6:"; +static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'}, + {"block", require_arg, 'b'}, + {"compact", require_arg, 'c'}, + {"indexed", require_arg, 'd'}, + {"file", require_arg, 'e'}, + {"filter", require_arg, 'f'}, + {"help", no_arg, 'h'}, + {"infile", require_arg, 'i'}, /* for backward compability */ + {"low", require_arg, 'j'}, + {"high", require_arg, 'k'}, + {"layout", require_arg, 'l'}, + {"minimum", require_arg, 'm'}, + {"native", no_arg, 'n'}, + {"outfile", require_arg, 'o'}, /* for backward compability */ + {"sort_by", require_arg, 'q'}, + {"ssize", require_arg, 's'}, + {"threshold", require_arg, 't'}, + {"ublock", require_arg, 'u'}, + {"verbose", no_arg, 'v'}, + {"sort_order", require_arg, 'z'}, + {"enable-error-stack", no_arg, 'E'}, + {"fs_pagesize", require_arg, 'G'}, + {"latest", no_arg, 'L'}, + {"metadata_block_size", require_arg, 'M'}, + {"fs_persist", require_arg, 'P'}, + {"fs_strategy", require_arg, 'S'}, + {"fs_threshold", require_arg, 'T'}, + {"version", no_arg, 'V'}, + {"merge", no_arg, 'X'}, + {"prune", no_arg, 'W'}, + {"src-vol-value", require_arg, '1'}, + {"src-vol-name", require_arg, '2'}, + {"src-vol-info", require_arg, '3'}, + {"dst-vol-value", require_arg, '4'}, + {"dst-vol-name", require_arg, '5'}, + {"dst-vol-info", require_arg, '6'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -497,18 +497,18 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) HDmemset(&out_vol_info, 0, sizeof(h5tools_vol_info_t)); /* parse command line options */ - while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) { + while (EOF != (opt = H5_get_option(argc, argv, s_opts, l_opts))) { switch ((char)opt) { /* -i for backward compatibility */ case 'i': - infile = opt_arg; + infile = H5_optarg; has_i++; break; /* -o for backward compatibility */ case 'o': - outfile = opt_arg; + outfile = H5_optarg; has_o++; break; @@ -530,7 +530,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) case 'f': /* parse the -f filter option */ - if (h5repack_addfilter(opt_arg, options) < 0) { + if (h5repack_addfilter(H5_optarg, options) < 0) { error_msg("in parsing filter\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; @@ -540,7 +540,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) case 'l': /* parse the -l layout option */ - if (h5repack_addlayout(opt_arg, options) < 0) { + if (h5repack_addlayout(H5_optarg, options) < 0) { error_msg("in parsing layout\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; @@ -549,9 +549,9 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) break; case 'm': - options->min_comp = HDstrtoull(opt_arg, NULL, 0); + options->min_comp = HDstrtoull(H5_optarg, NULL, 0); if ((int)options->min_comp <= 0) { - error_msg("invalid minimum compress size <%s>\n", opt_arg); + error_msg("invalid minimum compress size <%s>\n", H5_optarg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; goto done; @@ -559,8 +559,8 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) break; case 'e': - if ((ret_value = read_info(opt_arg, options)) < 0) { - error_msg("failed to read from repack options file <%s>\n", opt_arg); + if ((ret_value = read_info(H5_optarg, options)) < 0) { + error_msg("failed to read from repack options file <%s>\n", H5_optarg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; goto done; @@ -576,7 +576,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) break; case 'j': - bound = HDatoi(opt_arg); + bound = HDatoi(H5_optarg); if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) { error_msg("in parsing low bound\n"); h5tools_setstatus(EXIT_FAILURE); @@ -587,7 +587,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) break; case 'k': - bound = HDatoi(opt_arg); + bound = HDatoi(H5_optarg); if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) { error_msg("in parsing high bound\n"); h5tools_setstatus(EXIT_FAILURE); @@ -606,13 +606,13 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) break; case 'c': - options->grp_compact = HDatoi(opt_arg); + options->grp_compact = HDatoi(H5_optarg); if (options->grp_compact > 0) options->latest = TRUE; /* must use latest format */ break; case 'd': - options->grp_indexed = HDatoi(opt_arg); + options->grp_indexed = HDatoi(H5_optarg); if (options->grp_indexed > 0) options->latest = TRUE; /* must use latest format */ break; @@ -620,10 +620,10 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) case 's': { int idx = 0; int ssize = 0; - char *msgPtr = HDstrchr(opt_arg, ':'); + char *msgPtr = HDstrchr(H5_optarg, ':'); options->latest = TRUE; /* must use latest format */ if (msgPtr == NULL) { - ssize = HDatoi(opt_arg); + ssize = HDatoi(H5_optarg); for (idx = 0; idx < 5; idx++) options->msg_size[idx] = ssize; } @@ -632,7 +632,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) HDstrcpy(msgType, msgPtr + 1); msgPtr[0] = '\0'; - ssize = HDatoi(opt_arg); + ssize = HDatoi(H5_optarg); if (!HDstrncmp(msgType, "dspace", 6)) options->msg_size[0] = ssize; else if (!HDstrncmp(msgType, "dtype", 5)) @@ -647,25 +647,25 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) } break; case 'u': - options->ublock_filename = opt_arg; + options->ublock_filename = H5_optarg; break; case 'b': - options->ublock_size = (hsize_t)HDatol(opt_arg); + options->ublock_size = (hsize_t)HDatol(H5_optarg); break; case 'M': - options->meta_block_size = (hsize_t)HDatol(opt_arg); + options->meta_block_size = (hsize_t)HDatol(H5_optarg); break; case 't': - options->threshold = (hsize_t)HDatol(opt_arg); + options->threshold = (hsize_t)HDatol(H5_optarg); break; case 'a': - options->alignment = HDstrtoull(opt_arg, NULL, 0); + options->alignment = HDstrtoull(H5_optarg, NULL, 0); if (options->alignment < 1) { - error_msg("invalid alignment size\n", opt_arg); + error_msg("invalid alignment size\n", H5_optarg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; goto done; @@ -675,7 +675,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) case 'S': { char strategy[MAX_NC_NAME]; - HDstrcpy(strategy, opt_arg); + HDstrcpy(strategy, H5_optarg); if (!HDstrcmp(strategy, "FSM_AGGR")) options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; else if (!HDstrcmp(strategy, "PAGE")) @@ -685,7 +685,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) else if (!HDstrcmp(strategy, "NONE")) options->fs_strategy = H5F_FSPACE_STRATEGY_NONE; else { - error_msg("invalid file space management strategy\n", opt_arg); + error_msg("invalid file space management strategy\n", H5_optarg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; goto done; @@ -696,29 +696,29 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) } break; case 'P': - options->fs_persist = HDatoi(opt_arg); + options->fs_persist = HDatoi(H5_optarg); if (options->fs_persist == 0) /* To distinguish the "specified" zero value */ options->fs_persist = -1; break; case 'T': - options->fs_threshold = HDatol(opt_arg); + options->fs_threshold = HDatol(H5_optarg); if (options->fs_threshold == 0) /* To distinguish the "specified" zero value */ options->fs_threshold = -1; break; case 'G': - options->fs_pagesize = HDstrtoll(opt_arg, NULL, 0); + options->fs_pagesize = HDstrtoll(H5_optarg, NULL, 0); if (options->fs_pagesize == 0) /* To distinguish the "specified" zero value */ options->fs_pagesize = -1; break; case 'q': - if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(opt_arg))) { - error_msg("failed to set sort by form <%s>\n", opt_arg); + if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(H5_optarg))) { + error_msg("failed to set sort by form <%s>\n", H5_optarg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; goto done; @@ -726,8 +726,8 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) break; case 'z': - if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(opt_arg))) { - error_msg("failed to set sort order form <%s>\n", opt_arg); + if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(H5_optarg))) { + error_msg("failed to set sort order form <%s>\n", H5_optarg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; goto done; @@ -740,34 +740,34 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) case '1': in_vol_info.type = VOL_BY_VALUE; - in_vol_info.u.value = (H5VL_class_value_t)HDatoi(opt_arg); + in_vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); custom_in_fapl = TRUE; break; case '2': in_vol_info.type = VOL_BY_NAME; - in_vol_info.u.name = opt_arg; + in_vol_info.u.name = H5_optarg; custom_in_fapl = TRUE; break; case '3': - in_vol_info.info_string = opt_arg; + in_vol_info.info_string = H5_optarg; break; case '4': out_vol_info.type = VOL_BY_VALUE; - out_vol_info.u.value = (H5VL_class_value_t)HDatoi(opt_arg); + out_vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); custom_out_fapl = TRUE; break; case '5': out_vol_info.type = VOL_BY_NAME; - out_vol_info.u.name = opt_arg; + out_vol_info.u.name = H5_optarg; custom_out_fapl = TRUE; break; case '6': - out_vol_info.info_string = opt_arg; + out_vol_info.info_string = H5_optarg; break; default: @@ -777,9 +777,9 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) /* If neither -i nor -o given, get in and out files positionally */ if (0 == (has_i + has_o)) { - if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) { - infile = argv[opt_ind]; - outfile = argv[opt_ind + 1]; + if (argv[H5_optind] != NULL && argv[H5_optind + 1] != NULL) { + infile = argv[H5_optind]; + outfile = argv[H5_optind + 1]; if (!HDstrcmp(infile, outfile)) { error_msg("file names cannot be the same\n"); diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index e091a8a..3bf641a 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -171,106 +171,106 @@ struct handler_t { static const char *s_opts = "Aa:Ddm:EFfhGgl:sSTO:Vw:H:"; /* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */ -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"filemetadata", no_arg, 'F'}, - {"filemetadat", no_arg, 'F'}, - {"filemetada", no_arg, 'F'}, - {"filemetad", no_arg, 'F'}, - {"filemeta", no_arg, 'F'}, - {"filemet", no_arg, 'F'}, - {"fileme", no_arg, 'F'}, - {"filem", no_arg, 'F'}, - {"file", no_arg, 'f'}, - {"fil", no_arg, 'f'}, - {"fi", no_arg, 'f'}, - {"groupmetadata", no_arg, 'G'}, - {"groupmetadat", no_arg, 'G'}, - {"groupmetada", no_arg, 'G'}, - {"groupmetad", no_arg, 'G'}, - {"groupmeta", no_arg, 'G'}, - {"groupmet", no_arg, 'G'}, - {"groupme", no_arg, 'G'}, - {"groupm", no_arg, 'G'}, - {"group", no_arg, 'g'}, - {"grou", no_arg, 'g'}, - {"gro", no_arg, 'g'}, - {"gr", no_arg, 'g'}, - {"links", require_arg, 'l'}, - {"link", require_arg, 'l'}, - {"lin", require_arg, 'l'}, - {"li", require_arg, 'l'}, - {"dsetmetadata", no_arg, 'D'}, - {"dsetmetadat", no_arg, 'D'}, - {"dsetmetada", no_arg, 'D'}, - {"dsetmetad", no_arg, 'D'}, - {"dsetmeta", no_arg, 'D'}, - {"dsetmet", no_arg, 'D'}, - {"dsetme", no_arg, 'D'}, - {"dsetm", no_arg, 'D'}, - {"dset", no_arg, 'd'}, - {"dse", no_arg, 'd'}, - {"ds", no_arg, 'd'}, - {"dims", require_arg, 'm'}, - {"dim", require_arg, 'm'}, - {"di", require_arg, 'm'}, - {"dtypemetadata", no_arg, 'T'}, - {"dtypemetadat", no_arg, 'T'}, - {"dtypemetada", no_arg, 'T'}, - {"dtypemetad", no_arg, 'T'}, - {"dtypemeta", no_arg, 'T'}, - {"dtypemet", no_arg, 'T'}, - {"dtypeme", no_arg, 'T'}, - {"dtypem", no_arg, 'T'}, - {"dtype", no_arg, 'T'}, - {"dtyp", no_arg, 'T'}, - {"dty", no_arg, 'T'}, - {"dt", no_arg, 'T'}, - {"object", require_arg, 'O'}, - {"objec", require_arg, 'O'}, - {"obje", require_arg, 'O'}, - {"obj", require_arg, 'O'}, - {"ob", require_arg, 'O'}, - {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"ver", no_arg, 'V'}, - {"ve", no_arg, 'V'}, - {"attribute", no_arg, 'A'}, - {"attribut", no_arg, 'A'}, - {"attribu", no_arg, 'A'}, - {"attrib", no_arg, 'A'}, - {"attri", no_arg, 'A'}, - {"attr", no_arg, 'A'}, - {"att", no_arg, 'A'}, - {"at", no_arg, 'A'}, - {"enable-error-stack", no_arg, 'E'}, - {"numattrs", require_arg, 'a'}, - {"numattr", require_arg, 'a'}, - {"numatt", require_arg, 'a'}, - {"numat", require_arg, 'a'}, - {"numa", require_arg, 'a'}, - {"num", require_arg, 'a'}, - {"nu", require_arg, 'a'}, - {"freespace", no_arg, 's'}, - {"freespac", no_arg, 's'}, - {"freespa", no_arg, 's'}, - {"freesp", no_arg, 's'}, - {"frees", no_arg, 's'}, - {"free", no_arg, 's'}, - {"fre", no_arg, 's'}, - {"fr", no_arg, 's'}, - {"summary", no_arg, 'S'}, - {"summar", no_arg, 'S'}, - {"summa", no_arg, 'S'}, - {"summ", no_arg, 'S'}, - {"sum", no_arg, 'S'}, - {"su", no_arg, 'S'}, - {"s3-cred", require_arg, 'w'}, - {"hdfs-attrs", require_arg, 'H'}, - {NULL, 0, '\0'}}; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"filemetadata", no_arg, 'F'}, + {"filemetadat", no_arg, 'F'}, + {"filemetada", no_arg, 'F'}, + {"filemetad", no_arg, 'F'}, + {"filemeta", no_arg, 'F'}, + {"filemet", no_arg, 'F'}, + {"fileme", no_arg, 'F'}, + {"filem", no_arg, 'F'}, + {"file", no_arg, 'f'}, + {"fil", no_arg, 'f'}, + {"fi", no_arg, 'f'}, + {"groupmetadata", no_arg, 'G'}, + {"groupmetadat", no_arg, 'G'}, + {"groupmetada", no_arg, 'G'}, + {"groupmetad", no_arg, 'G'}, + {"groupmeta", no_arg, 'G'}, + {"groupmet", no_arg, 'G'}, + {"groupme", no_arg, 'G'}, + {"groupm", no_arg, 'G'}, + {"group", no_arg, 'g'}, + {"grou", no_arg, 'g'}, + {"gro", no_arg, 'g'}, + {"gr", no_arg, 'g'}, + {"links", require_arg, 'l'}, + {"link", require_arg, 'l'}, + {"lin", require_arg, 'l'}, + {"li", require_arg, 'l'}, + {"dsetmetadata", no_arg, 'D'}, + {"dsetmetadat", no_arg, 'D'}, + {"dsetmetada", no_arg, 'D'}, + {"dsetmetad", no_arg, 'D'}, + {"dsetmeta", no_arg, 'D'}, + {"dsetmet", no_arg, 'D'}, + {"dsetme", no_arg, 'D'}, + {"dsetm", no_arg, 'D'}, + {"dset", no_arg, 'd'}, + {"dse", no_arg, 'd'}, + {"ds", no_arg, 'd'}, + {"dims", require_arg, 'm'}, + {"dim", require_arg, 'm'}, + {"di", require_arg, 'm'}, + {"dtypemetadata", no_arg, 'T'}, + {"dtypemetadat", no_arg, 'T'}, + {"dtypemetada", no_arg, 'T'}, + {"dtypemetad", no_arg, 'T'}, + {"dtypemeta", no_arg, 'T'}, + {"dtypemet", no_arg, 'T'}, + {"dtypeme", no_arg, 'T'}, + {"dtypem", no_arg, 'T'}, + {"dtype", no_arg, 'T'}, + {"dtyp", no_arg, 'T'}, + {"dty", no_arg, 'T'}, + {"dt", no_arg, 'T'}, + {"object", require_arg, 'O'}, + {"objec", require_arg, 'O'}, + {"obje", require_arg, 'O'}, + {"obj", require_arg, 'O'}, + {"ob", require_arg, 'O'}, + {"version", no_arg, 'V'}, + {"versio", no_arg, 'V'}, + {"versi", no_arg, 'V'}, + {"vers", no_arg, 'V'}, + {"ver", no_arg, 'V'}, + {"ve", no_arg, 'V'}, + {"attribute", no_arg, 'A'}, + {"attribut", no_arg, 'A'}, + {"attribu", no_arg, 'A'}, + {"attrib", no_arg, 'A'}, + {"attri", no_arg, 'A'}, + {"attr", no_arg, 'A'}, + {"att", no_arg, 'A'}, + {"at", no_arg, 'A'}, + {"enable-error-stack", no_arg, 'E'}, + {"numattrs", require_arg, 'a'}, + {"numattr", require_arg, 'a'}, + {"numatt", require_arg, 'a'}, + {"numat", require_arg, 'a'}, + {"numa", require_arg, 'a'}, + {"num", require_arg, 'a'}, + {"nu", require_arg, 'a'}, + {"freespace", no_arg, 's'}, + {"freespac", no_arg, 's'}, + {"freespa", no_arg, 's'}, + {"freesp", no_arg, 's'}, + {"frees", no_arg, 's'}, + {"free", no_arg, 's'}, + {"fre", no_arg, 's'}, + {"fr", no_arg, 's'}, + {"summary", no_arg, 'S'}, + {"summar", no_arg, 'S'}, + {"summa", no_arg, 'S'}, + {"summ", no_arg, 'S'}, + {"sum", no_arg, 'S'}, + {"su", no_arg, 'S'}, + {"s3-cred", require_arg, 'w'}, + {"hdfs-attrs", require_arg, 'H'}, + {NULL, 0, '\0'}}; static void leave(int ret) @@ -920,7 +920,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) struct handler_t *hand = NULL; /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'h': usage(h5tools_getprogname()); @@ -959,8 +959,8 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) break; case 'l': - if (opt_arg) { - sgroups_threshold = HDatoi(opt_arg); + if (H5_optarg) { + sgroups_threshold = HDatoi(H5_optarg); if (sgroups_threshold < 1) { error_msg("Invalid threshold for small groups\n"); goto error; @@ -982,8 +982,8 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) break; case 'm': - if (opt_arg) { - sdsets_threshold = HDatoi(opt_arg); + if (H5_optarg) { + sdsets_threshold = HDatoi(H5_optarg); if (sdsets_threshold < 1) { error_msg("Invalid threshold for small datasets\n"); goto error; @@ -1005,8 +1005,8 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) break; case 'a': - if (opt_arg) { - sattrs_threshold = HDatoi(opt_arg); + if (H5_optarg) { + sattrs_threshold = HDatoi(H5_optarg); if (sattrs_threshold < 1) { error_msg("Invalid threshold for small # of attributes\n"); goto error; @@ -1046,7 +1046,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) /* Store object names */ for (u = 0; u < hand->obj_count; u++) - if (NULL == (hand->obj[u] = HDstrdup(opt_arg))) { + if (NULL == (hand->obj[u] = HDstrdup(H5_optarg))) { error_msg("unable to allocate memory for object name\n"); goto error; } /* end if */ @@ -1054,7 +1054,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) case 'w': #ifdef H5_HAVE_ROS3_VFD - if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa) < 0) { + if (h5tools_parse_ros3_fapl_tuple(H5_optarg, ',', &ros3_fa) < 0) { error_msg("failed to parse S3 VFD credential info\n"); goto error; } @@ -1068,7 +1068,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) case 'H': #ifdef H5_HAVE_LIBHDFS - if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa) < 0) { + if (h5tools_parse_hdfs_fapl_tuple(H5_optarg, ',', &hdfs_fa) < 0) { error_msg("failed to parse HDFS VFD configuration info\n"); goto error; } @@ -1087,7 +1087,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) } /* end while */ /* check for file name to be processed */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); goto error; @@ -1811,7 +1811,7 @@ main(int argc, const char *argv[]) } } - fname = argv[opt_ind]; + fname = argv[H5_optind]; /* Check for filename given */ if (fname) { diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index ac7c0ca..524ad03 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -44,40 +44,40 @@ static hsize_t increment = DEFAULT_INCREMENT; /* * Command-line options: only publicize long options */ -static const char * s_opts = "hVsmzi*"; -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"version", no_arg, 'V'}, - {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"status", no_arg, 's'}, - {"statu", no_arg, 's'}, - {"stat", no_arg, 's'}, - {"sta", no_arg, 's'}, - {"st", no_arg, 's'}, - {"image", no_arg, 'm'}, - {"imag", no_arg, 'm'}, - {"ima", no_arg, 'm'}, - {"im", no_arg, 'm'}, - {"filesize", no_arg, 'z'}, - {"filesiz", no_arg, 'z'}, - {"filesi", no_arg, 'z'}, - {"files", no_arg, 'z'}, - {"file", no_arg, 'z'}, - {"fil", no_arg, 'z'}, - {"fi", no_arg, 'z'}, - {"increment", optional_arg, 'i'}, - {"incremen", optional_arg, 'i'}, - {"increme", optional_arg, 'i'}, - {"increm", optional_arg, 'i'}, - {"incre", optional_arg, 'i'}, - {"incr", optional_arg, 'i'}, - {"inc", optional_arg, 'i'}, - {"in", optional_arg, 'i'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "hVsmzi*"; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"version", no_arg, 'V'}, + {"version", no_arg, 'V'}, + {"versio", no_arg, 'V'}, + {"versi", no_arg, 'V'}, + {"vers", no_arg, 'V'}, + {"status", no_arg, 's'}, + {"statu", no_arg, 's'}, + {"stat", no_arg, 's'}, + {"sta", no_arg, 's'}, + {"st", no_arg, 's'}, + {"image", no_arg, 'm'}, + {"imag", no_arg, 'm'}, + {"ima", no_arg, 'm'}, + {"im", no_arg, 'm'}, + {"filesize", no_arg, 'z'}, + {"filesiz", no_arg, 'z'}, + {"filesi", no_arg, 'z'}, + {"files", no_arg, 'z'}, + {"file", no_arg, 'z'}, + {"fil", no_arg, 'z'}, + {"fi", no_arg, 'z'}, + {"increment", optional_arg, 'i'}, + {"incremen", optional_arg, 'i'}, + {"increme", optional_arg, 'i'}, + {"increm", optional_arg, 'i'}, + {"incre", optional_arg, 'i'}, + {"incr", optional_arg, 'i'}, + {"inc", optional_arg, 'i'}, + {"in", optional_arg, 'i'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -150,7 +150,7 @@ parse_command_line(int argc, const char **argv) } /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'h': usage(h5tools_getprogname()); @@ -176,12 +176,12 @@ parse_command_line(int argc, const char **argv) case 'i': increment_eoa_eof = TRUE; - if (opt_arg != NULL) { - if (HDatoi(opt_arg) < 0) { + if (H5_optarg != NULL) { + if (HDatoi(H5_optarg) < 0) { usage(h5tools_getprogname()); goto done; } - increment = (hsize_t)HDatoi(opt_arg); + increment = (hsize_t)HDatoi(H5_optarg); } break; @@ -193,14 +193,14 @@ parse_command_line(int argc, const char **argv) } /* end while */ /* check for file name to be processed */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto error; } /* end if */ - fname_g = HDstrdup(argv[opt_ind]); + fname_g = HDstrdup(argv[H5_optind]); done: return (0); diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index 516191c..a85ee4d 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -22,8 +22,8 @@ int d_status = EXIT_SUCCESS; /* command-line options: short and long-named parameters */ -static const char * s_opts = "hlpvV"; -static struct long_options l_opts[] = { +static const char * s_opts = "hlpvV"; +static struct h5_long_options l_opts[] = { {"help", no_arg, 'h'}, {"latest", no_arg, 'l'}, {"parents", no_arg, 'p'}, {"verbose", no_arg, 'v'}, {"version", no_arg, 'V'}, {"vol-value", require_arg, '1'}, {"vol-name", require_arg, '2'}, {"vol-info", require_arg, '3'}, {NULL, 0, '\0'}}; @@ -140,7 +140,7 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options) HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t)); /* Parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { /* Display 'help' */ case 'h': @@ -171,18 +171,18 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options) case '1': vol_info.type = VOL_BY_VALUE; - vol_info.u.value = (H5VL_class_value_t)HDatoi(opt_arg); + vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); custom_fapl = TRUE; break; case '2': vol_info.type = VOL_BY_NAME; - vol_info.u.name = opt_arg; + vol_info.u.name = H5_optarg; custom_fapl = TRUE; break; case '3': - vol_info.info_string = opt_arg; + vol_info.info_string = H5_optarg; break; /* Bad command line argument */ @@ -193,33 +193,33 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options) } /* end while */ /* Check for file name to be processed */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); leave(EXIT_FAILURE); } /* Retrieve file name */ - options->fname = HDstrdup(argv[opt_ind]); - opt_ind++; + options->fname = HDstrdup(argv[H5_optind]); + H5_optind++; /* Check for group(s) to be created */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing group name(s)\n"); usage(h5tools_getprogname()); leave(EXIT_FAILURE); } /* Allocate space for the group name pointers */ - options->ngroups = (size_t)(argc - opt_ind); + options->ngroups = (size_t)(argc - H5_optind); options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *)); /* Retrieve the group names */ curr_group = 0; - while (opt_ind < argc) { - options->groups[curr_group] = HDstrdup(argv[opt_ind]); + while (H5_optind < argc) { + options->groups[curr_group] = HDstrdup(argv[H5_optind]); curr_group++; - opt_ind++; + H5_optind++; } /* Setup a custom fapl for file accesses */ diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index 4925708..fd21d6c 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -21,9 +21,9 @@ void parse_command_line(int argc, const char *argv[]); #define PROGRAM_NAME "getub" char *nbytes = NULL; -static const char * s_opts = "c:"; /* add more later ? */ -static struct long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */ - {NULL, 0, '\0'}}; +static const char * s_opts = "c:"; /* add more later ? */ +static struct h5_long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */ + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -57,10 +57,10 @@ parse_command_line(int argc, const char *argv[]) int opt; /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'c': - nbytes = HDstrdup(opt_arg); + nbytes = HDstrdup(H5_optarg); break; case '?': default: @@ -69,7 +69,7 @@ parse_command_line(int argc, const char *argv[]) } /* end switch */ } /* end while */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); HDexit(EXIT_FAILURE); @@ -100,13 +100,13 @@ main(int argc, const char *argv[]) goto error; } /* end if */ - if (argc <= (opt_ind)) { + if (argc <= (H5_optind)) { error_msg("missing file name\n"); usage(h5tools_getprogname()); goto error; } /* end if */ - filename = HDstrdup(argv[opt_ind]); + filename = HDstrdup(argv[H5_optind]); size = 0; if (EOF == (res = HDsscanf(nbytes, "%u", &size))) { diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index 45d4af4..e6769ec 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -24,8 +24,8 @@ * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "h"; -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {NULL, 0, '\0'}}; +static const char * s_opts = "h"; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -61,7 +61,7 @@ parse_command_line(int argc, const char *argv[]) int opt; /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'h': usage(h5tools_getprogname()); @@ -75,7 +75,7 @@ parse_command_line(int argc, const char *argv[]) } /* check for file name to be processed */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); @@ -118,14 +118,14 @@ main(int argc, const char *argv[]) /* enable error reporting if command line option */ h5tools_error_report(); - if (argc <= (opt_ind)) { + if (argc <= (H5_optind)) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto done; } - ifname = HDstrdup(argv[opt_ind]); + ifname = HDstrdup(argv[H5_optind]); testval = H5Fis_accessible(ifname, H5P_DEFAULT); diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 6fb5043..d38c574 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -123,12 +123,12 @@ static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; #else static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; #endif /* 1 */ -static struct long_options l_opts[] = {{"align", require_arg, 'a'}, - {"alig", require_arg, 'a'}, - {"ali", require_arg, 'a'}, - {"al", require_arg, 'a'}, - {"api", require_arg, 'A'}, - {"ap", require_arg, 'A'}, +static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, + {"alig", require_arg, 'a'}, + {"ali", require_arg, 'a'}, + {"al", require_arg, 'a'}, + {"api", require_arg, 'A'}, + {"ap", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, @@ -137,133 +137,133 @@ static struct long_options l_opts[] = {{"align", require_arg, 'a'}, { "bin", no_arg, 'b' }, { "bi", no_arg, 'b' }, #endif /* 0 */ - {"block-size", require_arg, 'B'}, - {"block-siz", require_arg, 'B'}, - {"block-si", require_arg, 'B'}, - {"block-s", require_arg, 'B'}, - {"block-", require_arg, 'B'}, - {"block", require_arg, 'B'}, - {"bloc", require_arg, 'B'}, - {"blo", require_arg, 'B'}, - {"bl", require_arg, 'B'}, - {"chunk", no_arg, 'c'}, - {"chun", no_arg, 'c'}, - {"chu", no_arg, 'c'}, - {"ch", no_arg, 'c'}, - {"collective", no_arg, 'C'}, - {"collectiv", no_arg, 'C'}, - {"collecti", no_arg, 'C'}, - {"collect", no_arg, 'C'}, - {"collec", no_arg, 'C'}, - {"colle", no_arg, 'C'}, - {"coll", no_arg, 'C'}, - {"col", no_arg, 'C'}, - {"co", no_arg, 'C'}, - {"debug", require_arg, 'D'}, - {"debu", require_arg, 'D'}, - {"deb", require_arg, 'D'}, - {"de", require_arg, 'D'}, - {"geometry", no_arg, 'g'}, - {"geometr", no_arg, 'g'}, - {"geomet", no_arg, 'g'}, - {"geome", no_arg, 'g'}, - {"geom", no_arg, 'g'}, - {"geo", no_arg, 'g'}, - {"ge", no_arg, 'g'}, - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"interleaved", require_arg, 'I'}, - {"interleave", require_arg, 'I'}, - {"interleav", require_arg, 'I'}, - {"interlea", require_arg, 'I'}, - {"interle", require_arg, 'I'}, - {"interl", require_arg, 'I'}, - {"inter", require_arg, 'I'}, - {"inte", require_arg, 'I'}, - {"int", require_arg, 'I'}, - {"in", require_arg, 'I'}, - {"max-num-processes", require_arg, 'P'}, - {"max-num-processe", require_arg, 'P'}, - {"max-num-process", require_arg, 'P'}, - {"max-num-proces", require_arg, 'P'}, - {"max-num-proce", require_arg, 'P'}, - {"max-num-proc", require_arg, 'P'}, - {"max-num-pro", require_arg, 'P'}, - {"max-num-pr", require_arg, 'P'}, - {"max-num-p", require_arg, 'P'}, - {"min-num-processes", require_arg, 'p'}, - {"min-num-processe", require_arg, 'p'}, - {"min-num-process", require_arg, 'p'}, - {"min-num-proces", require_arg, 'p'}, - {"min-num-proce", require_arg, 'p'}, - {"min-num-proc", require_arg, 'p'}, - {"min-num-pro", require_arg, 'p'}, - {"min-num-pr", require_arg, 'p'}, - {"min-num-p", require_arg, 'p'}, - {"max-xfer-size", require_arg, 'X'}, - {"max-xfer-siz", require_arg, 'X'}, - {"max-xfer-si", require_arg, 'X'}, - {"max-xfer-s", require_arg, 'X'}, - {"max-xfer", require_arg, 'X'}, - {"max-xfe", require_arg, 'X'}, - {"max-xf", require_arg, 'X'}, - {"max-x", require_arg, 'X'}, - {"min-xfer-size", require_arg, 'x'}, - {"min-xfer-siz", require_arg, 'x'}, - {"min-xfer-si", require_arg, 'x'}, - {"min-xfer-s", require_arg, 'x'}, - {"min-xfer", require_arg, 'x'}, - {"min-xfe", require_arg, 'x'}, - {"min-xf", require_arg, 'x'}, - {"min-x", require_arg, 'x'}, - {"num-bytes", require_arg, 'e'}, - {"num-byte", require_arg, 'e'}, - {"num-byt", require_arg, 'e'}, - {"num-by", require_arg, 'e'}, - {"num-b", require_arg, 'e'}, - {"num-dsets", require_arg, 'd'}, - {"num-dset", require_arg, 'd'}, - {"num-dse", require_arg, 'd'}, - {"num-ds", require_arg, 'd'}, - {"num-d", require_arg, 'd'}, - {"num-files", require_arg, 'F'}, - {"num-file", require_arg, 'F'}, - {"num-fil", require_arg, 'F'}, - {"num-fi", require_arg, 'F'}, - {"num-f", require_arg, 'F'}, - {"num-iterations", require_arg, 'i'}, - {"num-iteration", require_arg, 'i'}, - {"num-iteratio", require_arg, 'i'}, - {"num-iterati", require_arg, 'i'}, - {"num-iterat", require_arg, 'i'}, - {"num-itera", require_arg, 'i'}, - {"num-iter", require_arg, 'i'}, - {"num-ite", require_arg, 'i'}, - {"num-it", require_arg, 'i'}, - {"num-i", require_arg, 'i'}, - {"output", require_arg, 'o'}, - {"outpu", require_arg, 'o'}, - {"outp", require_arg, 'o'}, - {"out", require_arg, 'o'}, - {"ou", require_arg, 'o'}, - {"threshold", require_arg, 'T'}, - {"threshol", require_arg, 'T'}, - {"thresho", require_arg, 'T'}, - {"thresh", require_arg, 'T'}, - {"thres", require_arg, 'T'}, - {"thre", require_arg, 'T'}, - {"thr", require_arg, 'T'}, - {"th", require_arg, 'T'}, - {"write-only", require_arg, 'w'}, - {"write-onl", require_arg, 'w'}, - {"write-on", require_arg, 'w'}, - {"write-o", require_arg, 'w'}, - {"write", require_arg, 'w'}, - {"writ", require_arg, 'w'}, - {"wri", require_arg, 'w'}, - {"wr", require_arg, 'w'}, - {NULL, 0, '\0'}}; + {"block-size", require_arg, 'B'}, + {"block-siz", require_arg, 'B'}, + {"block-si", require_arg, 'B'}, + {"block-s", require_arg, 'B'}, + {"block-", require_arg, 'B'}, + {"block", require_arg, 'B'}, + {"bloc", require_arg, 'B'}, + {"blo", require_arg, 'B'}, + {"bl", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"chun", no_arg, 'c'}, + {"chu", no_arg, 'c'}, + {"ch", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"collectiv", no_arg, 'C'}, + {"collecti", no_arg, 'C'}, + {"collect", no_arg, 'C'}, + {"collec", no_arg, 'C'}, + {"colle", no_arg, 'C'}, + {"coll", no_arg, 'C'}, + {"col", no_arg, 'C'}, + {"co", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"debu", require_arg, 'D'}, + {"deb", require_arg, 'D'}, + {"de", require_arg, 'D'}, + {"geometry", no_arg, 'g'}, + {"geometr", no_arg, 'g'}, + {"geomet", no_arg, 'g'}, + {"geome", no_arg, 'g'}, + {"geom", no_arg, 'g'}, + {"geo", no_arg, 'g'}, + {"ge", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"interleave", require_arg, 'I'}, + {"interleav", require_arg, 'I'}, + {"interlea", require_arg, 'I'}, + {"interle", require_arg, 'I'}, + {"interl", require_arg, 'I'}, + {"inter", require_arg, 'I'}, + {"inte", require_arg, 'I'}, + {"int", require_arg, 'I'}, + {"in", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"max-num-processe", require_arg, 'P'}, + {"max-num-process", require_arg, 'P'}, + {"max-num-proces", require_arg, 'P'}, + {"max-num-proce", require_arg, 'P'}, + {"max-num-proc", require_arg, 'P'}, + {"max-num-pro", require_arg, 'P'}, + {"max-num-pr", require_arg, 'P'}, + {"max-num-p", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"min-num-processe", require_arg, 'p'}, + {"min-num-process", require_arg, 'p'}, + {"min-num-proces", require_arg, 'p'}, + {"min-num-proce", require_arg, 'p'}, + {"min-num-proc", require_arg, 'p'}, + {"min-num-pro", require_arg, 'p'}, + {"min-num-pr", require_arg, 'p'}, + {"min-num-p", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"max-xfer-siz", require_arg, 'X'}, + {"max-xfer-si", require_arg, 'X'}, + {"max-xfer-s", require_arg, 'X'}, + {"max-xfer", require_arg, 'X'}, + {"max-xfe", require_arg, 'X'}, + {"max-xf", require_arg, 'X'}, + {"max-x", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"min-xfer-siz", require_arg, 'x'}, + {"min-xfer-si", require_arg, 'x'}, + {"min-xfer-s", require_arg, 'x'}, + {"min-xfer", require_arg, 'x'}, + {"min-xfe", require_arg, 'x'}, + {"min-xf", require_arg, 'x'}, + {"min-x", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-byte", require_arg, 'e'}, + {"num-byt", require_arg, 'e'}, + {"num-by", require_arg, 'e'}, + {"num-b", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-dset", require_arg, 'd'}, + {"num-dse", require_arg, 'd'}, + {"num-ds", require_arg, 'd'}, + {"num-d", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-file", require_arg, 'F'}, + {"num-fil", require_arg, 'F'}, + {"num-fi", require_arg, 'F'}, + {"num-f", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"num-iteration", require_arg, 'i'}, + {"num-iteratio", require_arg, 'i'}, + {"num-iterati", require_arg, 'i'}, + {"num-iterat", require_arg, 'i'}, + {"num-itera", require_arg, 'i'}, + {"num-iter", require_arg, 'i'}, + {"num-ite", require_arg, 'i'}, + {"num-it", require_arg, 'i'}, + {"num-i", require_arg, 'i'}, + {"output", require_arg, 'o'}, + {"outpu", require_arg, 'o'}, + {"outp", require_arg, 'o'}, + {"out", require_arg, 'o'}, + {"ou", require_arg, 'o'}, + {"threshold", require_arg, 'T'}, + {"threshol", require_arg, 'T'}, + {"thresho", require_arg, 'T'}, + {"thresh", require_arg, 'T'}, + {"thres", require_arg, 'T'}, + {"thre", require_arg, 'T'}, + {"thr", require_arg, 'T'}, + {"th", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {"write-onl", require_arg, 'w'}, + {"write-on", require_arg, 'w'}, + {"write-o", require_arg, 'w'}, + {"write", require_arg, 'w'}, + {"writ", require_arg, 'w'}, + {"wri", require_arg, 'w'}, + {"wr", require_arg, 'w'}, + {NULL, 0, '\0'}}; struct options { long io_types; /* bitmask of which I/O types to test */ @@ -1286,13 +1286,13 @@ parse_command_line(int argc, char *argv[]) cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ cl_opts->verify = FALSE; /* No Verify data correctness by default */ - while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'a': - cl_opts->h5_alignment = parse_size_directive(opt_arg); + cl_opts->h5_alignment = parse_size_directive(H5_optarg); break; case 'A': { - const char *end = opt_arg; + const char *end = H5_optarg; while (end && *end != '\0') { char buf[10]; @@ -1332,7 +1332,7 @@ parse_command_line(int argc, char *argv[]) break; #endif /* 0 */ case 'B': - cl_opts->blk_size = (size_t)parse_size_directive(opt_arg); + cl_opts->blk_size = (size_t)parse_size_directive(H5_optarg); break; case 'c': /* Turn on chunked HDF5 dataset creation */ @@ -1342,10 +1342,10 @@ parse_command_line(int argc, char *argv[]) cl_opts->collective = 1; break; case 'd': - cl_opts->num_dsets = atoi(opt_arg); + cl_opts->num_dsets = atoi(H5_optarg); break; case 'D': { - const char *end = opt_arg; + const char *end = H5_optarg; while (end && *end != '\0') { char buf[10]; @@ -1402,40 +1402,40 @@ parse_command_line(int argc, char *argv[]) break; case 'e': - cl_opts->num_bpp = parse_size_directive(opt_arg); + cl_opts->num_bpp = parse_size_directive(H5_optarg); break; case 'F': - cl_opts->num_files = HDatoi(opt_arg); + cl_opts->num_files = HDatoi(H5_optarg); break; case 'g': cl_opts->dim2d = 1; break; case 'i': - cl_opts->num_iters = HDatoi(opt_arg); + cl_opts->num_iters = HDatoi(H5_optarg); break; case 'I': cl_opts->interleaved = 1; break; case 'o': - cl_opts->output_file = opt_arg; + cl_opts->output_file = H5_optarg; break; case 'p': - cl_opts->min_num_procs = HDatoi(opt_arg); + cl_opts->min_num_procs = HDatoi(H5_optarg); break; case 'P': - cl_opts->max_num_procs = HDatoi(opt_arg); + cl_opts->max_num_procs = HDatoi(H5_optarg); break; case 'T': - cl_opts->h5_threshold = parse_size_directive(opt_arg); + cl_opts->h5_threshold = parse_size_directive(H5_optarg); break; case 'w': cl_opts->h5_write_only = TRUE; break; case 'x': - cl_opts->min_xfer_size = (size_t)parse_size_directive(opt_arg); + cl_opts->min_xfer_size = (size_t)parse_size_directive(H5_optarg); break; case 'X': - cl_opts->max_xfer_size = (size_t)parse_size_directive(opt_arg); + cl_opts->max_xfer_size = (size_t)parse_size_directive(H5_optarg); break; case 'h': case '?': diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index 0a9bfc0..db8633e 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -27,30 +27,30 @@ MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */ int nCols = 80; /* ``get_option'' variables */ -int opt_err = 1; /*get_option prints errors if this is on */ -int opt_ind = 1; /*token pointer */ -const char *opt_arg; /*flag argument (or value) */ +int H5_opterr = 1; /*get_option prints errors if this is on */ +int H5_optind = 1; /*token pointer */ +const char *H5_optarg; /*flag argument (or value) */ int -get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts) +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 opt_opt = '?'; /* option character passed back to user */ if (sp == 1) { /* check for more flag-like tokens */ - if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') { + if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') { return EOF; } - else if (HDstrcmp(argv[opt_ind], "--") == 0) { - opt_ind++; + else if (HDstrcmp(argv[H5_optind], "--") == 0) { + H5_optind++; return EOF; } } - if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') { + if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') { /* long command line option */ - const char *arg = &argv[opt_ind][2]; + const char *arg = &argv[H5_optind][2]; int i; for (i = 0; l_opts && l_opts[i].name; i++) { @@ -62,13 +62,13 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (l_opts[i].has_arg != no_arg) { if (arg[len] == '=') { - opt_arg = &arg[len + 1]; + H5_optarg = &arg[len + 1]; } - else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') { - opt_arg = argv[++opt_ind]; + else if (H5_optind < (argc - 1) && argv[H5_optind + 1][0] != '-') { + H5_optarg = argv[++H5_optind]; } else if (l_opts[i].has_arg == require_arg) { - if (opt_err) + if (H5_opterr) HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); opt_opt = '?'; @@ -76,13 +76,13 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti } else { if (arg[len] == '=') { - if (opt_err) + if (H5_opterr) HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); opt_opt = '?'; } - opt_arg = NULL; + H5_optarg = NULL; } break; @@ -91,29 +91,29 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (l_opts[i].name == NULL) { /* exhausted all of the l_opts we have and still didn't match */ - if (opt_err) + if (H5_opterr) HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); opt_opt = '?'; } - opt_ind++; + H5_optind++; sp = 1; } else { register char *cp; /* pointer into current token */ /* short command line option */ - opt_opt = argv[opt_ind][sp]; + opt_opt = argv[H5_optind][sp]; if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) { - if (opt_err) + if (H5_opterr) HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt); /* if no chars left in this token, move to next token */ - if (argv[opt_ind][++sp] == '\0') { - opt_ind++; + if (argv[H5_optind][++sp] == '\0') { + H5_optind++; sp = 1; } @@ -122,32 +122,32 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (*++cp == ':') { /* if a value is expected, get it */ - if (argv[opt_ind][sp + 1] != '\0') { + if (argv[H5_optind][sp + 1] != '\0') { /* flag value is rest of current token */ - opt_arg = &argv[opt_ind++][sp + 1]; + H5_optarg = &argv[H5_optind++][sp + 1]; } - else if (++opt_ind >= argc) { - if (opt_err) + else if (++H5_optind >= argc) { + if (H5_opterr) HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt); opt_opt = '?'; } else { /* flag value is next token */ - opt_arg = argv[opt_ind++]; + H5_optarg = argv[H5_optind++]; } sp = 1; } else { /* set up to look at next char in token, next time */ - if (argv[opt_ind][++sp] == '\0') { + if (argv[H5_optind][++sp] == '\0') { /* no more in current token, so setup next token */ - opt_ind++; + H5_optind++; sp = 1; } - opt_arg = NULL; + H5_optarg = NULL; } } diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 276fa0f..4b5c7b2 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -454,24 +454,25 @@ void h5_dump_info_object(MPI_Info info); /** From h5tools_utils.h **/ -extern int opt_err; /* getoption prints errors if this is on */ -extern int opt_ind; /* token pointer */ -extern const char *opt_arg; /* flag argument (or value) */ +extern int H5_opterr; /* getoption prints errors if this is on */ +extern int H5_optind; /* token pointer */ +extern const char *H5_optarg; /* flag argument (or value) */ -enum { +enum h5_arg_level { no_arg = 0, /* doesn't take an argument */ require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; -typedef struct long_options { - const char *name; /* name of the long option */ - int has_arg; /* whether we should look for an arg */ - char shortval; /* the shortname equivalent of long arg - * this gets returned from get_option */ -} long_options; +struct h5_long_options { + const char * name; /* Name of the long option */ + enum h5_arg_level has_arg; /* Whether we should look for an arg */ + char shortval; /* The shortname equivalent of long arg + * this gets returned from get_option + */ +}; -extern int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt); +extern int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt); extern int nCols; /*max number of columns for outputting */ diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index fe4e7e7..51a7825 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -97,13 +97,13 @@ static const char *progname = "h5perf_serial"; * It seems that only the options that accept additional information * such as dataset size (-e) require the colon next to it. */ -static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; -static struct long_options l_opts[] = {{"align", require_arg, 'a'}, - {"alig", require_arg, 'a'}, - {"ali", require_arg, 'a'}, - {"al", require_arg, 'a'}, - {"api", require_arg, 'A'}, - {"ap", require_arg, 'A'}, +static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; +static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, + {"alig", require_arg, 'a'}, + {"ali", require_arg, 'a'}, + {"al", require_arg, 'a'}, + {"api", require_arg, 'A'}, + {"ap", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, @@ -112,156 +112,156 @@ static struct long_options l_opts[] = {{"align", require_arg, 'a'}, { "bin", no_arg, 'b' }, { "bi", no_arg, 'b' }, #endif /* 0 */ - {"block-size", require_arg, 'B'}, - {"block-siz", require_arg, 'B'}, - {"block-si", require_arg, 'B'}, - {"block-s", require_arg, 'B'}, - {"block-", require_arg, 'B'}, - {"block", require_arg, 'B'}, - {"bloc", require_arg, 'B'}, - {"blo", require_arg, 'B'}, - {"bl", require_arg, 'B'}, - {"chunk", no_arg, 'c'}, - {"chun", no_arg, 'c'}, - {"chu", no_arg, 'c'}, - {"ch", no_arg, 'c'}, - {"collective", no_arg, 'C'}, - {"collectiv", no_arg, 'C'}, - {"collecti", no_arg, 'C'}, - {"collect", no_arg, 'C'}, - {"collec", no_arg, 'C'}, - {"colle", no_arg, 'C'}, - {"coll", no_arg, 'C'}, - {"col", no_arg, 'C'}, - {"co", no_arg, 'C'}, - {"debug", require_arg, 'D'}, - {"debu", require_arg, 'D'}, - {"deb", require_arg, 'D'}, - {"de", require_arg, 'D'}, - {"file-driver", require_arg, 'v'}, - {"file-drive", require_arg, 'v'}, - {"file-driv", require_arg, 'v'}, - {"file-dri", require_arg, 'v'}, - {"file-dr", require_arg, 'v'}, - {"file-d", require_arg, 'v'}, - {"file-", require_arg, 'v'}, - {"file", require_arg, 'v'}, - {"fil", require_arg, 'v'}, - {"fi", require_arg, 'v'}, - {"geometry", no_arg, 'g'}, - {"geometr", no_arg, 'g'}, - {"geomet", no_arg, 'g'}, - {"geome", no_arg, 'g'}, - {"geom", no_arg, 'g'}, - {"geo", no_arg, 'g'}, - {"ge", no_arg, 'g'}, - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"interleaved", require_arg, 'I'}, - {"interleave", require_arg, 'I'}, - {"interleav", require_arg, 'I'}, - {"interlea", require_arg, 'I'}, - {"interle", require_arg, 'I'}, - {"interl", require_arg, 'I'}, - {"inter", require_arg, 'I'}, - {"inte", require_arg, 'I'}, - {"int", require_arg, 'I'}, - {"in", require_arg, 'I'}, - {"max-num-processes", require_arg, 'P'}, - {"max-num-processe", require_arg, 'P'}, - {"max-num-process", require_arg, 'P'}, - {"max-num-proces", require_arg, 'P'}, - {"max-num-proce", require_arg, 'P'}, - {"max-num-proc", require_arg, 'P'}, - {"max-num-pro", require_arg, 'P'}, - {"max-num-pr", require_arg, 'P'}, - {"max-num-p", require_arg, 'P'}, - {"min-num-processes", require_arg, 'p'}, - {"min-num-processe", require_arg, 'p'}, - {"min-num-process", require_arg, 'p'}, - {"min-num-proces", require_arg, 'p'}, - {"min-num-proce", require_arg, 'p'}, - {"min-num-proc", require_arg, 'p'}, - {"min-num-pro", require_arg, 'p'}, - {"min-num-pr", require_arg, 'p'}, - {"min-num-p", require_arg, 'p'}, - {"max-xfer-size", require_arg, 'X'}, - {"max-xfer-siz", require_arg, 'X'}, - {"max-xfer-si", require_arg, 'X'}, - {"max-xfer-s", require_arg, 'X'}, - {"max-xfer", require_arg, 'X'}, - {"max-xfe", require_arg, 'X'}, - {"max-xf", require_arg, 'X'}, - {"max-x", require_arg, 'X'}, - {"min-xfer-size", require_arg, 'x'}, - {"min-xfer-siz", require_arg, 'x'}, - {"min-xfer-si", require_arg, 'x'}, - {"min-xfer-s", require_arg, 'x'}, - {"min-xfer", require_arg, 'x'}, - {"min-xfe", require_arg, 'x'}, - {"min-xf", require_arg, 'x'}, - {"min-x", require_arg, 'x'}, - {"num-bytes", require_arg, 'e'}, - {"num-byte", require_arg, 'e'}, - {"num-byt", require_arg, 'e'}, - {"num-by", require_arg, 'e'}, - {"num-b", require_arg, 'e'}, - {"num-dsets", require_arg, 'd'}, - {"num-dset", require_arg, 'd'}, - {"num-dse", require_arg, 'd'}, - {"num-ds", require_arg, 'd'}, - {"num-d", require_arg, 'd'}, - {"num-files", require_arg, 'F'}, - {"num-file", require_arg, 'F'}, - {"num-fil", require_arg, 'F'}, - {"num-fi", require_arg, 'F'}, - {"num-f", require_arg, 'F'}, - {"num-iterations", require_arg, 'i'}, - {"num-iteration", require_arg, 'i'}, - {"num-iteratio", require_arg, 'i'}, - {"num-iterati", require_arg, 'i'}, - {"num-iterat", require_arg, 'i'}, - {"num-itera", require_arg, 'i'}, - {"num-iter", require_arg, 'i'}, - {"num-ite", require_arg, 'i'}, - {"num-it", require_arg, 'i'}, - {"num-i", require_arg, 'i'}, - {"order", require_arg, 'r'}, - {"orde", require_arg, 'r'}, - {"ord", require_arg, 'r'}, - {"or", require_arg, 'r'}, - {"output", require_arg, 'o'}, - {"outpu", require_arg, 'o'}, - {"outp", require_arg, 'o'}, - {"out", require_arg, 'o'}, - {"ou", require_arg, 'o'}, - {"extendable", no_arg, 't'}, - {"extendabl", no_arg, 't'}, - {"extendab", no_arg, 't'}, - {"extenda", no_arg, 't'}, - {"extend", no_arg, 't'}, - {"exten", no_arg, 't'}, - {"exte", no_arg, 't'}, - {"ext", no_arg, 't'}, - {"ex", no_arg, 't'}, - {"threshold", require_arg, 'T'}, - {"threshol", require_arg, 'T'}, - {"thresho", require_arg, 'T'}, - {"thresh", require_arg, 'T'}, - {"thres", require_arg, 'T'}, - {"thre", require_arg, 'T'}, - {"thr", require_arg, 'T'}, - {"th", require_arg, 'T'}, - {"write-only", require_arg, 'w'}, - {"write-onl", require_arg, 'w'}, - {"write-on", require_arg, 'w'}, - {"write-o", require_arg, 'w'}, - {"write", require_arg, 'w'}, - {"writ", require_arg, 'w'}, - {"wri", require_arg, 'w'}, - {"wr", require_arg, 'w'}, - {NULL, 0, '\0'}}; + {"block-size", require_arg, 'B'}, + {"block-siz", require_arg, 'B'}, + {"block-si", require_arg, 'B'}, + {"block-s", require_arg, 'B'}, + {"block-", require_arg, 'B'}, + {"block", require_arg, 'B'}, + {"bloc", require_arg, 'B'}, + {"blo", require_arg, 'B'}, + {"bl", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"chun", no_arg, 'c'}, + {"chu", no_arg, 'c'}, + {"ch", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"collectiv", no_arg, 'C'}, + {"collecti", no_arg, 'C'}, + {"collect", no_arg, 'C'}, + {"collec", no_arg, 'C'}, + {"colle", no_arg, 'C'}, + {"coll", no_arg, 'C'}, + {"col", no_arg, 'C'}, + {"co", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"debu", require_arg, 'D'}, + {"deb", require_arg, 'D'}, + {"de", require_arg, 'D'}, + {"file-driver", require_arg, 'v'}, + {"file-drive", require_arg, 'v'}, + {"file-driv", require_arg, 'v'}, + {"file-dri", require_arg, 'v'}, + {"file-dr", require_arg, 'v'}, + {"file-d", require_arg, 'v'}, + {"file-", require_arg, 'v'}, + {"file", require_arg, 'v'}, + {"fil", require_arg, 'v'}, + {"fi", require_arg, 'v'}, + {"geometry", no_arg, 'g'}, + {"geometr", no_arg, 'g'}, + {"geomet", no_arg, 'g'}, + {"geome", no_arg, 'g'}, + {"geom", no_arg, 'g'}, + {"geo", no_arg, 'g'}, + {"ge", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"interleave", require_arg, 'I'}, + {"interleav", require_arg, 'I'}, + {"interlea", require_arg, 'I'}, + {"interle", require_arg, 'I'}, + {"interl", require_arg, 'I'}, + {"inter", require_arg, 'I'}, + {"inte", require_arg, 'I'}, + {"int", require_arg, 'I'}, + {"in", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"max-num-processe", require_arg, 'P'}, + {"max-num-process", require_arg, 'P'}, + {"max-num-proces", require_arg, 'P'}, + {"max-num-proce", require_arg, 'P'}, + {"max-num-proc", require_arg, 'P'}, + {"max-num-pro", require_arg, 'P'}, + {"max-num-pr", require_arg, 'P'}, + {"max-num-p", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"min-num-processe", require_arg, 'p'}, + {"min-num-process", require_arg, 'p'}, + {"min-num-proces", require_arg, 'p'}, + {"min-num-proce", require_arg, 'p'}, + {"min-num-proc", require_arg, 'p'}, + {"min-num-pro", require_arg, 'p'}, + {"min-num-pr", require_arg, 'p'}, + {"min-num-p", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"max-xfer-siz", require_arg, 'X'}, + {"max-xfer-si", require_arg, 'X'}, + {"max-xfer-s", require_arg, 'X'}, + {"max-xfer", require_arg, 'X'}, + {"max-xfe", require_arg, 'X'}, + {"max-xf", require_arg, 'X'}, + {"max-x", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"min-xfer-siz", require_arg, 'x'}, + {"min-xfer-si", require_arg, 'x'}, + {"min-xfer-s", require_arg, 'x'}, + {"min-xfer", require_arg, 'x'}, + {"min-xfe", require_arg, 'x'}, + {"min-xf", require_arg, 'x'}, + {"min-x", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-byte", require_arg, 'e'}, + {"num-byt", require_arg, 'e'}, + {"num-by", require_arg, 'e'}, + {"num-b", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-dset", require_arg, 'd'}, + {"num-dse", require_arg, 'd'}, + {"num-ds", require_arg, 'd'}, + {"num-d", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-file", require_arg, 'F'}, + {"num-fil", require_arg, 'F'}, + {"num-fi", require_arg, 'F'}, + {"num-f", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"num-iteration", require_arg, 'i'}, + {"num-iteratio", require_arg, 'i'}, + {"num-iterati", require_arg, 'i'}, + {"num-iterat", require_arg, 'i'}, + {"num-itera", require_arg, 'i'}, + {"num-iter", require_arg, 'i'}, + {"num-ite", require_arg, 'i'}, + {"num-it", require_arg, 'i'}, + {"num-i", require_arg, 'i'}, + {"order", require_arg, 'r'}, + {"orde", require_arg, 'r'}, + {"ord", require_arg, 'r'}, + {"or", require_arg, 'r'}, + {"output", require_arg, 'o'}, + {"outpu", require_arg, 'o'}, + {"outp", require_arg, 'o'}, + {"out", require_arg, 'o'}, + {"ou", require_arg, 'o'}, + {"extendable", no_arg, 't'}, + {"extendabl", no_arg, 't'}, + {"extendab", no_arg, 't'}, + {"extenda", no_arg, 't'}, + {"extend", no_arg, 't'}, + {"exten", no_arg, 't'}, + {"exte", no_arg, 't'}, + {"ext", no_arg, 't'}, + {"ex", no_arg, 't'}, + {"threshold", require_arg, 'T'}, + {"threshol", require_arg, 'T'}, + {"thresho", require_arg, 'T'}, + {"thresh", require_arg, 'T'}, + {"thres", require_arg, 'T'}, + {"thre", require_arg, 'T'}, + {"thr", require_arg, 'T'}, + {"th", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {"write-onl", require_arg, 'w'}, + {"write-on", require_arg, 'w'}, + {"write-o", require_arg, 'w'}, + {"write", require_arg, 'w'}, + {"writ", require_arg, 'w'}, + {"wri", require_arg, 'w'}, + {"wr", require_arg, 'w'}, + {NULL, 0, '\0'}}; struct options { long io_types; /* bitmask of which I/O types to test */ @@ -993,19 +993,19 @@ parse_command_line(int argc, const char *argv[]) cl_opts->h5_extendable = FALSE; /* Use extendable dataset */ cl_opts->verify = FALSE; /* No Verify data correctness by default */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'a': - cl_opts->h5_alignment = parse_size_directive(opt_arg); + cl_opts->h5_alignment = parse_size_directive(H5_optarg); break; case 'G': - cl_opts->page_size = parse_size_directive(opt_arg); + cl_opts->page_size = parse_size_directive(H5_optarg); break; case 'b': - cl_opts->page_buffer_size = parse_size_directive(opt_arg); + cl_opts->page_buffer_size = parse_size_directive(H5_optarg); break; case 'A': { - const char *end = opt_arg; + const char *end = H5_optarg; while (end && *end != '\0') { char buf[10]; @@ -1043,7 +1043,7 @@ parse_command_line(int argc, const char *argv[]) /* Turn on chunked HDF5 dataset creation */ cl_opts->h5_use_chunks = 1; { - const char *end = opt_arg; + const char *end = H5_optarg; int j = 0; while (end && *end != '\0') { @@ -1070,7 +1070,7 @@ parse_command_line(int argc, const char *argv[]) break; case 'D': { - const char *end = opt_arg; + const char *end = H5_optarg; while (end && *end != '\0') { char buf[10]; @@ -1126,7 +1126,7 @@ parse_command_line(int argc, const char *argv[]) break; case 'e': { - const char *end = opt_arg; + const char *end = H5_optarg; int j = 0; while (end && *end != '\0') { @@ -1153,38 +1153,38 @@ parse_command_line(int argc, const char *argv[]) break; case 'i': - cl_opts->num_iters = HDatoi(opt_arg); + cl_opts->num_iters = HDatoi(H5_optarg); break; case 'o': - cl_opts->output_file = opt_arg; + cl_opts->output_file = H5_optarg; break; case 'T': - cl_opts->h5_threshold = parse_size_directive(opt_arg); + cl_opts->h5_threshold = parse_size_directive(H5_optarg); break; case 'v': - if (!HDstrcasecmp(opt_arg, "sec2")) { + if (!HDstrcasecmp(H5_optarg, "sec2")) { cl_opts->vfd = sec2; } - else if (!HDstrcasecmp(opt_arg, "stdio")) { + else if (!HDstrcasecmp(H5_optarg, "stdio")) { cl_opts->vfd = stdio; } - else if (!HDstrcasecmp(opt_arg, "core")) { + else if (!HDstrcasecmp(H5_optarg, "core")) { cl_opts->vfd = core; } - else if (!HDstrcasecmp(opt_arg, "split")) { + else if (!HDstrcasecmp(H5_optarg, "split")) { cl_opts->vfd = split; } - else if (!HDstrcasecmp(opt_arg, "multi")) { + else if (!HDstrcasecmp(H5_optarg, "multi")) { cl_opts->vfd = multi; } - else if (!HDstrcasecmp(opt_arg, "family")) { + else if (!HDstrcasecmp(H5_optarg, "family")) { cl_opts->vfd = family; } - else if (!HDstrcasecmp(opt_arg, "direct")) { + else if (!HDstrcasecmp(H5_optarg, "direct")) { cl_opts->vfd = direct; } else { - HDfprintf(stderr, "sio_perf: invalid --api option %s\n", opt_arg); + HDfprintf(stderr, "sio_perf: invalid --api option %s\n", H5_optarg); HDexit(EXIT_FAILURE); } break; @@ -1195,7 +1195,7 @@ parse_command_line(int argc, const char *argv[]) cl_opts->h5_extendable = TRUE; break; case 'x': { - const char *end = opt_arg; + const char *end = H5_optarg; int j = 0; while (end && *end != '\0') { @@ -1222,7 +1222,7 @@ parse_command_line(int argc, const char *argv[]) break; case 'r': { - const char *end = opt_arg; + const char *end = H5_optarg; int j = 0; while (end && *end != '\0') { diff --git a/tools/test/perform/sio_standalone.c b/tools/test/perform/sio_standalone.c index abc0777..2e793fb 100644 --- a/tools/test/perform/sio_standalone.c +++ b/tools/test/perform/sio_standalone.c @@ -23,30 +23,30 @@ int nCols = 80; /* ``get_option'' variables */ -int opt_err = 1; /*get_option prints errors if this is on */ -int opt_ind = 1; /*token pointer */ -const char *opt_arg; /*flag argument (or value) */ +int H5_opterr = 1; /*get_option prints errors if this is on */ +int H5_optind = 1; /*token pointer */ +const char *H5_optarg; /*flag argument (or value) */ int -get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts) +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 opt_opt = '?'; /* option character passed back to user */ if (sp == 1) { /* check for more flag-like tokens */ - if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') { + if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') { return EOF; } - else if (HDstrcmp(argv[opt_ind], "--") == 0) { - opt_ind++; + else if (HDstrcmp(argv[H5_optind], "--") == 0) { + H5_optind++; return EOF; } } - if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') { + if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') { /* long command line option */ - const char *arg = &argv[opt_ind][2]; + const char *arg = &argv[H5_optind][2]; int i; for (i = 0; l_opts && l_opts[i].name; i++) { @@ -58,13 +58,13 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (l_opts[i].has_arg != no_arg) { if (arg[len] == '=') { - opt_arg = &arg[len + 1]; + H5_optarg = &arg[len + 1]; } - else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') { - opt_arg = argv[++opt_ind]; + else if (H5_optind < (argc - 1) && argv[H5_optind + 1][0] != '-') { + H5_optarg = argv[++H5_optind]; } else if (l_opts[i].has_arg == require_arg) { - if (opt_err) + if (H5_opterr) HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); opt_opt = '?'; @@ -72,13 +72,13 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti } else { if (arg[len] == '=') { - if (opt_err) + if (H5_opterr) HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); opt_opt = '?'; } - opt_arg = NULL; + H5_optarg = NULL; } break; @@ -87,29 +87,29 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (l_opts[i].name == NULL) { /* exhausted all of the l_opts we have and still didn't match */ - if (opt_err) + if (H5_opterr) HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); opt_opt = '?'; } - opt_ind++; + H5_optind++; sp = 1; } else { register char *cp; /* pointer into current token */ /* short command line option */ - opt_opt = argv[opt_ind][sp]; + opt_opt = argv[H5_optind][sp]; if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) { - if (opt_err) + if (H5_opterr) HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt); /* if no chars left in this token, move to next token */ - if (argv[opt_ind][++sp] == '\0') { - opt_ind++; + if (argv[H5_optind][++sp] == '\0') { + H5_optind++; sp = 1; } @@ -118,32 +118,32 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (*++cp == ':') { /* if a value is expected, get it */ - if (argv[opt_ind][sp + 1] != '\0') { + if (argv[H5_optind][sp + 1] != '\0') { /* flag value is rest of current token */ - opt_arg = &argv[opt_ind++][sp + 1]; + H5_optarg = &argv[H5_optind++][sp + 1]; } - else if (++opt_ind >= argc) { - if (opt_err) + else if (++H5_optind >= argc) { + if (H5_opterr) HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt); opt_opt = '?'; } else { /* flag value is next token */ - opt_arg = argv[opt_ind++]; + H5_optarg = argv[H5_optind++]; } sp = 1; } else { /* set up to look at next char in token, next time */ - if (argv[opt_ind][++sp] == '\0') { + if (argv[H5_optind][++sp] == '\0') { /* no more in current token, so setup next token */ - opt_ind++; + H5_optind++; sp = 1; } - opt_arg = NULL; + H5_optarg = NULL; } } diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index ea1a2a1..098b98a 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -469,24 +469,25 @@ void h5_dump_info_object(MPI_Info info); /** From h5tools_utils.h **/ -extern int opt_err; /* getoption prints errors if this is on */ -extern int opt_ind; /* token pointer */ -extern const char *opt_arg; /* flag argument (or value) */ +extern int H5_opterr; /* getoption prints errors if this is on */ +extern int H5_optind; /* token pointer */ +extern const char *H5_optarg; /* flag argument (or value) */ -enum { +enum h5_arg_level { no_arg = 0, /* doesn't take an argument */ require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; -typedef struct long_options { - const char *name; /* name of the long option */ - int has_arg; /* whether we should look for an arg */ - char shortval; /* the shortname equivalent of long arg - * this gets returned from get_option */ -} long_options; +struct h5_long_options { + const char * name; /* Name of the long option */ + enum h5_arg_level has_arg; /* Whether we should look for an arg */ + char shortval; /* The shortname equivalent of long arg + * this gets returned from get_option + */ +}; -extern int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt); +extern int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt); extern int nCols; /*max number of columns for outputting */ diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 517866b..6231587 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -64,66 +64,66 @@ static void error(const char *fmt, ...); static void compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); /* commandline options : long and short form */ -static const char * s_opts = "hB:b:c:p:rs:0123456789"; -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, - {"compressability", require_arg, 'c'}, - {"compressabilit", require_arg, 'c'}, - {"compressabili", require_arg, 'c'}, - {"compressabil", require_arg, 'c'}, - {"compressabi", require_arg, 'c'}, - {"compressab", require_arg, 'c'}, - {"compressa", require_arg, 'c'}, - {"compress", require_arg, 'c'}, - {"compres", require_arg, 'c'}, - {"compre", require_arg, 'c'}, - {"compr", require_arg, 'c'}, - {"comp", require_arg, 'c'}, - {"com", require_arg, 'c'}, - {"co", require_arg, 'c'}, - {"file-size", require_arg, 's'}, - {"file-siz", require_arg, 's'}, - {"file-si", require_arg, 's'}, - {"file-s", require_arg, 's'}, - {"file", require_arg, 's'}, - {"fil", require_arg, 's'}, - {"fi", require_arg, 's'}, - {"max-buffer-size", require_arg, 'B'}, - {"max-buffer-siz", require_arg, 'B'}, - {"max-buffer-si", require_arg, 'B'}, - {"max-buffer-s", require_arg, 'B'}, - {"max-buffer", require_arg, 'B'}, - {"max-buffe", require_arg, 'B'}, - {"max-buff", require_arg, 'B'}, - {"max-buf", require_arg, 'B'}, - {"max-bu", require_arg, 'B'}, - {"max-b", require_arg, 'B'}, - {"max", require_arg, 'B'}, - {"min-buffer-size", require_arg, 'b'}, - {"min-buffer-siz", require_arg, 'b'}, - {"min-buffer-si", require_arg, 'b'}, - {"min-buffer-s", require_arg, 'b'}, - {"min-buffer", require_arg, 'b'}, - {"min-buffe", require_arg, 'b'}, - {"min-buff", require_arg, 'b'}, - {"min-buf", require_arg, 'b'}, - {"min-bu", require_arg, 'b'}, - {"min-b", require_arg, 'b'}, - {"min", require_arg, 'b'}, - {"prefix", require_arg, 'p'}, - {"prefi", require_arg, 'p'}, - {"pref", require_arg, 'p'}, - {"pre", require_arg, 'p'}, - {"pr", require_arg, 'p'}, - {"random-test", no_arg, 'r'}, - {"random-tes", no_arg, 'r'}, - {"random-te", no_arg, 'r'}, - {"random-t", no_arg, 'r'}, - {"random", no_arg, 'r'}, - {"rando", no_arg, 'r'}, - {"rand", no_arg, 'r'}, - {"ran", no_arg, 'r'}, - {"ra", no_arg, 'r'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "hB:b:c:p:rs:0123456789"; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, + {"compressability", require_arg, 'c'}, + {"compressabilit", require_arg, 'c'}, + {"compressabili", require_arg, 'c'}, + {"compressabil", require_arg, 'c'}, + {"compressabi", require_arg, 'c'}, + {"compressab", require_arg, 'c'}, + {"compressa", require_arg, 'c'}, + {"compress", require_arg, 'c'}, + {"compres", require_arg, 'c'}, + {"compre", require_arg, 'c'}, + {"compr", require_arg, 'c'}, + {"comp", require_arg, 'c'}, + {"com", require_arg, 'c'}, + {"co", require_arg, 'c'}, + {"file-size", require_arg, 's'}, + {"file-siz", require_arg, 's'}, + {"file-si", require_arg, 's'}, + {"file-s", require_arg, 's'}, + {"file", require_arg, 's'}, + {"fil", require_arg, 's'}, + {"fi", require_arg, 's'}, + {"max-buffer-size", require_arg, 'B'}, + {"max-buffer-siz", require_arg, 'B'}, + {"max-buffer-si", require_arg, 'B'}, + {"max-buffer-s", require_arg, 'B'}, + {"max-buffer", require_arg, 'B'}, + {"max-buffe", require_arg, 'B'}, + {"max-buff", require_arg, 'B'}, + {"max-buf", require_arg, 'B'}, + {"max-bu", require_arg, 'B'}, + {"max-b", require_arg, 'B'}, + {"max", require_arg, 'B'}, + {"min-buffer-size", require_arg, 'b'}, + {"min-buffer-siz", require_arg, 'b'}, + {"min-buffer-si", require_arg, 'b'}, + {"min-buffer-s", require_arg, 'b'}, + {"min-buffer", require_arg, 'b'}, + {"min-buffe", require_arg, 'b'}, + {"min-buff", require_arg, 'b'}, + {"min-buf", require_arg, 'b'}, + {"min-bu", require_arg, 'b'}, + {"min-b", require_arg, 'b'}, + {"min", require_arg, 'b'}, + {"prefix", require_arg, 'p'}, + {"prefi", require_arg, 'p'}, + {"pref", require_arg, 'p'}, + {"pre", require_arg, 'p'}, + {"pr", require_arg, 'p'}, + {"random-test", no_arg, 'r'}, + {"random-tes", no_arg, 'r'}, + {"random-te", no_arg, 'r'}, + {"random-t", no_arg, 'r'}, + {"random", no_arg, 'r'}, + {"rando", no_arg, 'r'}, + {"rand", no_arg, 'r'}, + {"ran", no_arg, 'r'}, + {"ra", no_arg, 'r'}, + {NULL, 0, '\0'}}; /* * Function: error @@ -551,7 +551,7 @@ main(int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - while ((opt = get_option(argc, argv, s_opts, l_opts)) > 0) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) > 0) { switch ((char)opt) { case '0': case '1': @@ -566,13 +566,13 @@ main(int argc, const char *argv[]) compress_level = opt - '0'; break; case 'B': - max_buf_size = parse_size_directive(opt_arg); + max_buf_size = parse_size_directive(H5_optarg); break; case 'b': - min_buf_size = parse_size_directive(opt_arg); + min_buf_size = parse_size_directive(H5_optarg); break; case 'c': - compress_percent = (int)HDstrtol(opt_arg, NULL, 10); + compress_percent = (int)HDstrtol(H5_optarg, NULL, 10); if (compress_percent < 0) compress_percent = 0; @@ -581,13 +581,13 @@ main(int argc, const char *argv[]) break; case 'p': - option_prefix = opt_arg; + option_prefix = H5_optarg; break; case 'r': random_test = TRUE; break; case 's': - file_size = parse_size_directive(opt_arg); + file_size = parse_size_directive(H5_optarg); break; case '?': usage(); -- cgit v0.12 From 9ac96e5a21de2be00aa22300c9d21f3293e9eedc Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 29 Jun 2021 13:07:19 -0700 Subject: Removes type guesses when C99 types are missing (#807) --- src/H5private.h | 68 --------------------------------------------------------- 1 file changed, 68 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index d11b15b..71b913a 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -356,74 +356,6 @@ #endif /* - * Numeric data types. Some of these might be defined in Posix.1g, otherwise - * we define them with the closest available type which is at least as large - * as the number of bits indicated in the type name. The `int8' types *must* - * be exactly one byte wide because we use it for pointer calculations to - * void* memory. - */ -#if H5_SIZEOF_INT8_T == 0 -typedef signed char int8_t; -#undef H5_SIZEOF_INT8_T -#define H5_SIZEOF_INT8_T H5_SIZEOF_CHAR -#elif H5_SIZEOF_INT8_T == 1 -#else -#error "the int8_t type must be 1 byte wide" -#endif - -#if H5_SIZEOF_UINT8_T == 0 -typedef unsigned char uint8_t; -#undef H5_SIZEOF_UINT8_T -#define H5_SIZEOF_UINT8_T H5_SIZEOF_CHAR -#elif H5_SIZEOF_UINT8_T == 1 -#else -#error "the uint8_t type must be 1 byte wide" -#endif - -#if H5_SIZEOF_INT16_T >= 2 -#elif H5_SIZEOF_SHORT >= 2 -typedef short int16_t; -#undef H5_SIZEOF_INT16_T -#define H5_SIZEOF_INT16_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 2 -typedef int int16_t; -#undef H5_SIZEOF_INT16_T -#define H5_SIZEOF_INT16_T H5_SIZEOF_INT -#else -#error "nothing appropriate for int16_t" -#endif - -#if H5_SIZEOF_UINT16_T >= 2 -#elif H5_SIZEOF_SHORT >= 2 -typedef unsigned short uint16_t; -#undef H5_SIZEOF_UINT16_T -#define H5_SIZEOF_UINT16_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 2 -typedef unsigned uint16_t; -#undef H5_SIZEOF_UINT16_T -#define H5_SIZEOF_UINT16_T H5_SIZEOF_INT -#else -#error "nothing appropriate for uint16_t" -#endif - -#if H5_SIZEOF_INT32_T >= 4 -#elif H5_SIZEOF_SHORT >= 4 -typedef short int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 4 -typedef int int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG >= 4 -typedef long int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_LONG -#else -#error "nothing appropriate for int32_t" -#endif - -/* * Maximum and minimum values. These should be defined in for the * most part. */ -- cgit v0.12 From 858a2b28662ba18596e668bf9719285acd645df7 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 29 Jun 2021 13:07:43 -0700 Subject: Assume C99 types exist in H5detect.c (#808) --- src/H5detect.c | 90 ---------------------------------------------------------- 1 file changed, 90 deletions(-) diff --git a/src/H5detect.c b/src/H5detect.c index b2c0924..2e893cf 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -1278,60 +1278,18 @@ detect_C89_floats(void) static void HDF_NO_UBSAN detect_C99_integers8(void) { -#if H5_SIZEOF_INT8_T > 0 -#if H5_SIZEOF_INT8_T == 1 DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; -#else - DETECT_I(int8_t, INT8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_UINT8_T > 0 -#if H5_SIZEOF_UINT8_T == 1 DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; -#else - DETECT_I(uint8_t, UINT8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_INT_LEAST8_T > 0 -#if H5_SIZEOF_INT_LEAST8_T == 1 DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; -#else - DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_UINT_LEAST8_T > 0 -#if H5_SIZEOF_UINT_LEAST8_T == 1 DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; -#else - DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_INT_FAST8_T > 0 -#if H5_SIZEOF_INT_FAST8_T == 1 DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; -#else - DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_UINT_FAST8_T > 0 -#if H5_SIZEOF_UINT_FAST8_T == 1 DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; -#else - DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); - nd_g++; -#endif -#endif } /*------------------------------------------------------------------------- @@ -1345,30 +1303,18 @@ detect_C99_integers8(void) static void HDF_NO_UBSAN detect_C99_integers16(void) { -#if H5_SIZEOF_INT16_T > 0 DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT16_T > 0 DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_LEAST16_T > 0 DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_LEAST16_T > 0 DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_FAST16_T > 0 DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_FAST16_T > 0 DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; -#endif } /*------------------------------------------------------------------------- @@ -1382,30 +1328,18 @@ detect_C99_integers16(void) static void HDF_NO_UBSAN detect_C99_integers32(void) { -#if H5_SIZEOF_INT32_T > 0 DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT32_T > 0 DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_LEAST32_T > 0 DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_LEAST32_T > 0 DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_FAST32_T > 0 DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_FAST32_T > 0 DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; -#endif } /*------------------------------------------------------------------------- @@ -1420,47 +1354,23 @@ detect_C99_integers32(void) static void HDF_NO_UBSAN detect_C99_integers64(void) { -#if H5_SIZEOF_INT64_T > 0 DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT64_T > 0 DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_LEAST64_T > 0 DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_LEAST64_T > 0 DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_FAST64_T > 0 DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_FAST64_T > 0 DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_LONG_LONG > 0 DETECT_I(long long, LLONG, d_g[nd_g]); nd_g++; DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; -#else - /* - * This architecture doesn't support an integer type larger than `long' - * so we'll just make H5T_NATIVE_LLONG the same as H5T_NATIVE_LONG since - * `long long' is probably equivalent to `long' here anyway. - */ - DETECT_I(long, LLONG, d_g[nd_g]); - nd_g++; - DETECT_I(unsigned long, ULLONG, d_g[nd_g]); - nd_g++; -#endif } /*------------------------------------------------------------------------- -- cgit v0.12 From f0e0c7ed2a2df6d6dbe3728002c7fc9c518fea5f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 30 Jun 2021 08:17:35 -0700 Subject: Fixes parallel issues from recent C99 changes (#809) * Fixes parallel issues from recent C99 changes * Adds MPE FUNC --> __func__ changes missed in earlier PRs * Even more missed FUNC --> __func__ macros --- doxygen/examples/ThreadSafeLibrary.html | 8 +- src/H5Cmpio.c | 10 +- src/H5FAdblkpage.c | 8 +- src/H5FAstat.c | 2 +- src/H5FDhdfs.c | 36 +-- src/H5FDmirror.c | 40 +-- src/H5FDmpio.c | 56 ++--- src/H5FDspace.c | 14 +- src/H5FL.c | 12 +- src/H5FLprivate.h | 2 +- src/H5FS.c | 62 ++--- src/H5FSsection.c | 56 ++--- src/H5MF.c | 93 +++---- src/H5MFaggr.c | 15 +- src/H5MFdbg.c | 10 +- src/H5MFsection.c | 18 +- src/H5Shyper.c | 18 +- src/H5Smpio.c | 16 +- src/H5private.h | 20 +- test/hdfs.c | 2 +- test/ros3.c | 2 +- test/s3comms.c | 2 +- testpar/t_bigio.c | 4 +- testpar/t_cache.c | 425 ++++++++++++++++---------------- testpar/t_filters_parallel.c | 4 +- testpar/t_mpi.c | 4 +- tools/libtest/h5tools_test_utils.c | 2 +- tools/test/perform/direct_write_perf.c | 3 +- tools/test/perform/perf.c | 16 +- 29 files changed, 486 insertions(+), 474 deletions(-) diff --git a/doxygen/examples/ThreadSafeLibrary.html b/doxygen/examples/ThreadSafeLibrary.html index 8daf386..2ea42b4 100644 --- a/doxygen/examples/ThreadSafeLibrary.html +++ b/doxygen/examples/ThreadSafeLibrary.html @@ -709,7 +709,7 @@ created) or if the wrong values were read back.
       #define H5_API_UNSET_CANCEL                                 \
    -    if (H5_IS_API(FUNC)) {                                    \
    +    if (H5_IS_API(__func__)) {                                \
           H5_cancel_count_inc();                                  \
         }
       
    @@ -721,7 +721,7 @@ created) or if the wrong values were read back.
       #define H5_API_LOCK_BEGIN                                   \
    -     if (H5_IS_API(FUNC)) {                                   \
    +     if (H5_IS_API(__func__)) {                               \
            H5_mutex_lock(&H5_g.init_lock);
       
    @@ -755,7 +755,7 @@ created) or if the wrong values were read back.
       #define H5_API_UNLOCK_BEGIN                                 \
    -    if (H5_IS_API(FUNC)) {                                    \
    +    if (H5_IS_API(__func__)) {                                \
           H5_mutex_unlock(&H5_g.init_lock);
       
    @@ -774,7 +774,7 @@ created) or if the wrong values were read back.
       #define H5_API_SET_CANCEL                                   \
    -    if (H5_IS_API(FUNC)) {                                    \
    +    if (H5_IS_API(__func__)) {                                \
           H5_cancel_count_dec();                                  \
         }
       
    diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index d6da9b7..35d8dd0 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -195,7 +195,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha HDmemset(entries_to_clear, 0, sizeof(entries_to_clear)); #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", FUNC, mpi_rank); + HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", __func__, mpi_rank); HDmemset(tbl_buf, 0, sizeof(tbl_buf)); @@ -272,10 +272,10 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); HDfprintf(stdout, "%s", tbl_buf); - HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", FUNC, mpi_rank, first_entry_to_flush, + HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", __func__, mpi_rank, first_entry_to_flush, last_entry_to_flush); - HDfprintf(stdout, "%s:%d: marking entries.\n", FUNC, mpi_rank); + HDfprintf(stdout, "%s:%d: marking entries.\n", __func__, mpi_rank); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ for (u = 0; u < num_candidates; u++) { @@ -353,8 +353,8 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", FUNC, mpi_rank, num_candidates, - total_entries_to_clear, total_entries_to_flush); + HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", __func__, mpi_rank, + num_candidates, total_entries_to_clear, total_entries_to_flush); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ /* We have now marked all the entries on the candidate list for diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index 1dca0fb..713bd67 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -147,7 +147,7 @@ H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts) FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); + HDfprintf(stderr, "%s: Called, addr = %a\n", __func__, addr); #endif /* H5FA_DEBUG */ /* Sanity check */ @@ -162,7 +162,7 @@ H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts) dblk_page->addr = addr; dblk_page->size = H5FA_DBLK_PAGE_SIZE(hdr, nelmts); #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); + HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", __func__, dblk_page->size); #endif /* H5FA_DEBUG */ /* Clear any elements in data block page to fill value */ @@ -223,7 +223,7 @@ H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_pag FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Sanity check */ @@ -293,7 +293,7 @@ H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags) FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Sanity check */ diff --git a/src/H5FAstat.c b/src/H5FAstat.c index 98f7195..f7d1b90 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -84,7 +84,7 @@ H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats) FUNC_ENTER_NOAPI_NOERR #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Check arguments */ diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 4712a8e..9491e82 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -365,7 +365,7 @@ H5FD_hdfs_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (H5I_VFL != H5I_get_type(H5FD_HDFS_g)) @@ -406,7 +406,7 @@ H5FD__hdfs_term(void) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* Reset VFL ID */ @@ -440,7 +440,7 @@ H5FD__hdfs_handle_open(const char *path, const char *namenode_name, const int32_ FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (path == NULL || path[0] == '\0') @@ -525,7 +525,7 @@ H5FD__hdfs_handle_close(hdfs_t *handle) FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (handle == NULL) @@ -616,7 +616,7 @@ H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) HDassert(fa != NULL); #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); @@ -657,7 +657,7 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_dst /*out*/) H5TRACE2("e", "ix", fapl_id, fa_dst); #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (fa_dst == NULL) @@ -814,7 +814,7 @@ hdfs__reset_stats(H5FD_hdfs_t *file) FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (file == NULL) @@ -872,7 +872,7 @@ H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ /* Sanity check on file offsets */ @@ -1210,7 +1210,7 @@ H5FD__hdfs_close(H5FD_t *_file) FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* Sanity checks */ @@ -1266,7 +1266,7 @@ H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ HDassert(f1->hdfs_handle != NULL); @@ -1339,7 +1339,7 @@ H5FD__hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (flags) { @@ -1377,7 +1377,7 @@ H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif FUNC_LEAVE_NOAPI(file->eoa) @@ -1408,7 +1408,7 @@ H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif file->eoa = addr; @@ -1442,7 +1442,7 @@ H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif HDassert(file->hdfs_handle != NULL); @@ -1477,7 +1477,7 @@ H5FD__hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ if (!file_handle) @@ -1527,7 +1527,7 @@ H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ HDassert(file != NULL); @@ -1599,7 +1599,7 @@ H5FD__hdfs_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file") @@ -1637,7 +1637,7 @@ H5FD__hdfs_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file") diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index 5711777..8cbeff6 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -219,7 +219,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); if (H5FD_mirror_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mirror VFD"); @@ -245,7 +245,7 @@ H5FD_mirror_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), FALSE); @@ -272,7 +272,7 @@ H5FD__mirror_term(void) /* Reset VFL ID */ H5FD_MIRROR_g = 0; - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__mirror_term() */ @@ -1128,7 +1128,7 @@ H5FD__mirror_verify_reply(H5FD_mirror_t *file) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file && file->sock_fd); @@ -1183,7 +1183,7 @@ H5FD__mirror_fapl_get(H5FD_t *_file) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); fa = (H5FD_mirror_fapl_t *)H5MM_calloc(sizeof(H5FD_mirror_fapl_t)); if (NULL == fa) @@ -1219,7 +1219,7 @@ H5FD__mirror_fapl_copy(const void *_old_fa) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); new_fa = (H5FD_mirror_fapl_t *)H5MM_malloc(sizeof(H5FD_mirror_fapl_t)); if (new_fa == NULL) @@ -1251,7 +1251,7 @@ H5FD__mirror_fapl_free(void *_fa) FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); /* sanity check */ HDassert(fa != NULL); @@ -1282,7 +1282,7 @@ H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_dst /*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", fapl_id, fa_dst); - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); if (NULL == fa_dst) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst is NULL"); @@ -1323,7 +1323,7 @@ H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*#", fapl_id, fa); - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); if (NULL == plist) @@ -1369,7 +1369,7 @@ H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); /* --------------- */ /* Check arguments */ @@ -1494,7 +1494,7 @@ H5FD__mirror_close(H5FD_t *_file) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); /* Sanity check */ HDassert(file); @@ -1566,7 +1566,7 @@ H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { FUNC_ENTER_STATIC_NOERR; - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); /* Notice: the Mirror VFD Writer currently uses only the Sec2 driver as * the underying driver -- as such, the Mirror VFD implementation copies @@ -1603,7 +1603,7 @@ H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file); @@ -1630,7 +1630,7 @@ H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file); @@ -1685,7 +1685,7 @@ H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file); @@ -1706,7 +1706,7 @@ H5FD__mirror_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, { FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); FUNC_LEAVE_NOAPI(FAIL) } /* end H5FD__mirror_read() */ @@ -1739,7 +1739,7 @@ H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file); HDassert(buf); @@ -1802,7 +1802,7 @@ H5FD__mirror_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_AT FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_TRUNCATE; @@ -1850,7 +1850,7 @@ H5FD__mirror_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_LOCK; @@ -1897,7 +1897,7 @@ H5FD__mirror_unlock(H5FD_t *_file) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_UNLOCK; diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 7567376..dd40399 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -701,7 +701,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* set atomicity value */ @@ -711,7 +711,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -744,7 +744,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Get atomicity value */ @@ -759,7 +759,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -825,7 +825,7 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == mpi_rank)); if (H5FD_mpio_debug_t_flag) HDfprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", - FUNC, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr); + __func__, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr); #endif /* Convert HDF5 flags to MPI-IO flags */ @@ -905,7 +905,7 @@ done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -938,7 +938,7 @@ H5FD__mpio_close(H5FD_t *_file) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -957,7 +957,7 @@ H5FD__mpio_close(H5FD_t *_file) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1177,7 +1177,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -1239,7 +1239,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) @@ -1248,13 +1248,13 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); #endif /* Check whether we should read from rank 0 and broadcast to other ranks */ if (H5CX_get_mpio_rank0_bcast()) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", __func__, file->mpi_rank); #endif /* Indicate path we've taken */ rank0_bcast = TRUE; @@ -1276,7 +1276,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent read operation */ @@ -1295,7 +1295,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent read operation */ @@ -1345,8 +1345,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", FUNC, file->mpi_rank, (long)mpi_off, - bytes_read); + HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", __func__, file->mpi_rank, + (long)mpi_off, bytes_read); #endif /* @@ -1358,7 +1358,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1417,7 +1417,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -1489,7 +1489,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ @@ -1499,7 +1499,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); #endif /* Perform collective write operation */ if (MPI_SUCCESS != @@ -1513,7 +1513,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent write operation */ if (MPI_SUCCESS != @@ -1529,7 +1529,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent write operation */ @@ -1562,7 +1562,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", FUNC, file->mpi_rank, + HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", __func__, file->mpi_rank, (long)mpi_off, bytes_written); #endif @@ -1583,7 +1583,7 @@ done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", FUNC, file->mpi_rank, ret_value); + HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", __func__, file->mpi_rank, ret_value); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1615,7 +1615,7 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -1630,7 +1630,7 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1672,7 +1672,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -1741,7 +1741,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDspace.c b/src/H5FDspace.c index 339c413..de52dc3 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -148,7 +148,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr FUNC_ENTER_PACKAGE #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); + HDfprintf(stderr, "%s: type = %u, size = %Hu\n", __func__, (unsigned)type, size); #endif /* H5FD_ALLOC_DEBUG */ /* check args */ @@ -211,7 +211,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr done: #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value); + HDfprintf(stderr, "%s: ret_value = %a\n", __func__, ret_value); #endif /* H5FD_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__alloc_real() */ @@ -287,7 +287,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) HDassert(size > 0); #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type, addr, size); + HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", __func__, (unsigned)type, addr, size); #endif /* H5FD_ALLOC_DEBUG */ /* Sanity checking */ @@ -304,7 +304,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) /* Check for file driver 'free' callback and call it if available */ if (file->cls->free) { #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: Letting VFD free space\n", FUNC); + HDfprintf(stderr, "%s: Letting VFD free space\n", __func__); #endif /* H5FD_ALLOC_DEBUG */ if ((file->cls->free)(file, type, H5CX_get_dxpl(), addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") @@ -317,11 +317,11 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) eoa = file->cls->get_eoa(file, type); #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: eoa = %a\n", FUNC, eoa); + HDfprintf(stderr, "%s: eoa = %a\n", __func__, eoa); #endif /* H5FD_ALLOC_DEBUG */ if (eoa == (addr + size)) { #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: Reducing file size to = %a\n", FUNC, addr); + HDfprintf(stderr, "%s: Reducing file size to = %a\n", __func__, addr); #endif /* H5FD_ALLOC_DEBUG */ if (file->cls->set_eoa(file, type, addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "set end of space allocation request failed") @@ -330,7 +330,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) else { /* leak memory */ #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type, + HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", __func__, (unsigned)type, addr, size); #endif /* H5FD_ALLOC_DEBUG */ } /* end else */ diff --git a/src/H5FL.c b/src/H5FL.c index 0aca4b7..cb58868 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -207,7 +207,7 @@ H5FL_term_package(void) /* Dump information about all the outstanding allocations */ while (trk != NULL) { /* Print information about the outstanding block */ - HDfprintf(stderr, "%s: Outstanding allocation:\n", FUNC); + HDfprintf(stderr, "%s: Outstanding allocation:\n", __func__); HDfprintf(stderr, "\tPtr: %p, File: %s, Function: %s, Line: %d\n", (((unsigned char *)trk) + sizeof(H5FL_track_t)), trk->file, trk->func, trk->line); H5CS_print_stack(trk->stack, stderr); @@ -631,7 +631,7 @@ H5FL__reg_term(void) tmp = H5FL_reg_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, + HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ @@ -1321,7 +1321,7 @@ H5FL__blk_term(void) tmp = H5FL_blk_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, + HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated); #endif /* H5FL_DEBUG */ @@ -1781,7 +1781,7 @@ H5FL__arr_term(void) /* Check if the list has allocations outstanding */ #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, + HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ if (H5FL_arr_gc_head.first->list->allocated > 0) { @@ -2372,8 +2372,8 @@ H5FL__fac_term_all(void) tmp = H5FL_fac_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, - (int)H5FL_fac_gc_head.first->list->allocated); + HDprintf("%s: head->size = %d, head->allocated = %d\n", __func__, + (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* The list cannot have any allocations outstanding */ diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 42581ac..381f977 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -51,7 +51,7 @@ /* #define H5FL_TRACK */ #ifdef H5FL_TRACK /* Macro for inclusion in the free list allocation calls */ -#define H5FL_TRACK_INFO , __FILE__, FUNC, __LINE__ +#define H5FL_TRACK_INFO , __FILE__, __func__, __LINE__ /* Macro for inclusion in internal free list allocation calls */ #define H5FL_TRACK_INFO_INT , call_file, call_func, call_line diff --git a/src/H5FS.c b/src/H5FS.c index c85790c..cb18ab3 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -100,7 +100,7 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t FUNC_ENTER_NOAPI(NULL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, nclasses); + HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", __func__, nclasses); #endif /* H5FS_DEBUG */ /* Check arguments. */ @@ -146,7 +146,7 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t /* Set the return value */ ret_value = fspace; #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %a\n", FUNC, fspace, fspace->addr); + HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %a\n", __func__, fspace, fspace->addr); #endif /* H5FS_DEBUG */ done: @@ -155,7 +155,7 @@ done: HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header") #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5FS_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_create() */ @@ -183,7 +183,7 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class FUNC_ENTER_NOAPI(NULL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\n", FUNC, fs_addr, + HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\n", __func__, fs_addr, nclasses); #endif /* H5FS_DEBUG */ @@ -204,11 +204,11 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class (fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header") #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", FUNC, fspace->alloc_sect_size); - HDfprintf(stderr, "%s: fspace->sinfo = %p\n", FUNC, fspace->sinfo); - HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc); + HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", __func__, fspace->sect_addr); + HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", __func__, fspace->sect_size); + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", __func__, fspace->alloc_sect_size); + HDfprintf(stderr, "%s: fspace->sinfo = %p\n", __func__, fspace->sinfo); + HDfprintf(stderr, "%s: fspace->rc = %u\n", __func__, fspace->rc); #endif /* H5FS_DEBUG */ /* Increment the reference count on the free space manager header */ @@ -251,7 +251,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", FUNC, fs_addr); + HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", __func__, fs_addr); #endif /* H5FS_DEBUG */ /* Check arguments. */ @@ -278,7 +278,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for free space section info") - HDfprintf(stderr, "%s: fspace_status = %0x: ", FUNC, fspace_status); + HDfprintf(stderr, "%s: fspace_status = %0x: ", __func__, fspace_status); if (fspace_status) { hbool_t printed = FALSE; @@ -321,7 +321,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) /* Delete serialized section storage, if there are any */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); + HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", __func__, fspace->sect_addr); #endif /* H5FS_DEBUG */ if (fspace->serial_sect_count > 0) { unsigned sinfo_status = 0; /* Free space section info's status in the metadata cache */ @@ -342,7 +342,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) HDassert(!(sinfo_status & H5AC_ES__IS_PROTECTED)); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Expunging free space section info from cache\n", FUNC); + HDfprintf(stderr, "%s: Expunging free space section info from cache\n", __func__); #endif /* H5FS_DEBUG */ /* Evict the free space section info from the metadata cache */ /* (Free file space) */ @@ -361,12 +361,12 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) } /* end block */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUNC); + HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", __func__); #endif /* H5FS_DEBUG */ } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Deleting free space section info from file\n", FUNC); + HDfprintf(stderr, "%s: Deleting free space section info from file\n", __func__); #endif /* H5FS_DEBUG */ /* Release the space in the file */ if (!H5F_IS_TMP_ADDR(f, fspace->sect_addr)) @@ -407,7 +407,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) HDassert(f); HDassert(fspace); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %a, fspace->sinfo = %p\n", FUNC, fspace, + HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %a, fspace->sinfo = %p\n", __func__, fspace, fspace->addr, fspace->sinfo); #endif /* H5FS_DEBUG */ @@ -418,15 +418,15 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu, fspace->serial_sect_count = %Hu, fspace->sect_addr = " "%a, fspace->rc = %u\n", - FUNC, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, + __func__, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc); + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_DEBUG */ /* If there are sections to serialize, update them */ /* (if the free space manager is persistent) */ if (fspace->serial_sect_count > 0 && H5F_addr_defined(fspace->addr)) { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); + HDfprintf(stderr, "%s: Real sections to store in file\n", __func__); #endif /* H5FS_DEBUG */ if (fspace->sinfo->dirty) { /* Check if the section info is "floating" */ @@ -465,7 +465,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: NOT storing section info in file\n", FUNC); + HDfprintf(stderr, "%s: NOT storing section info in file\n", __func__); #endif /* H5FS_DEBUG */ /* Check if space for the section info is allocated */ if (H5F_addr_defined(fspace->sect_addr)) { @@ -474,7 +474,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) HDassert(H5F_addr_defined(fspace->addr)); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info allocated though\n", FUNC); + HDfprintf(stderr, "%s: Section info allocated though\n", __func__); #endif /* H5FS_DEBUG */ /* Check if the section info is for the free space in the file */ /* (NOTE: This is the "bootstrapping" special case for the @@ -486,12 +486,13 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) htri_t status; /* "can absorb" status for section into */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info is for file free space\n", FUNC); + HDfprintf(stderr, "%s: Section info is for file free space\n", __func__); #endif /* H5FS_DEBUG */ /* Try to shrink the file or absorb the section info into a block aggregator */ if (H5F_IS_TMP_ADDR(f, fspace->sect_addr)) { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", FUNC); + HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", + __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -512,12 +513,13 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) * header to record it */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", FUNC); + HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", + __func__); #endif /* H5FS_DEBUG */ } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC); + HDfprintf(stderr, "%s: Section info went 'go away'\n", __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -536,7 +538,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) fspace->alloc_sect_size; /* Previous size of section info in file */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); + HDfprintf(stderr, "%s: Section info is NOT for file free space\n", __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -576,7 +578,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) done: #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_value, fspace->rc); + HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", __func__, ret_value, fspace->rc); #endif /* H5FS_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_close() */ @@ -709,7 +711,8 @@ H5FS__incr(H5FS_t *fspace) FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); + HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", __func__, fspace->addr, + fspace->rc); #endif /* H5FS_DEBUG */ /* @@ -748,7 +751,8 @@ H5FS__decr(H5FS_t *fspace) FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); + HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", __func__, fspace->addr, + fspace->rc); #endif /* H5FS_DEBUG */ /* diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 6ba1bc3..c764932 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -123,7 +123,7 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) HDassert(f); HDassert(fspace); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); + HDfprintf(stderr, "%s: fspace->addr = %a\n", __func__, fspace->addr); #endif /* H5FS_SINFO_DEBUG */ /* Allocate the free space header */ @@ -136,10 +136,10 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8; sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", FUNC, fspace->max_sect_size); - HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", FUNC, fspace->max_sect_addr); - HDfprintf(stderr, "%s: sinfo->nbins = %u\n", FUNC, sinfo->nbins); - HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", FUNC, + HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", __func__, fspace->max_sect_size); + HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", __func__, fspace->max_sect_addr); + HDfprintf(stderr, "%s: sinfo->nbins = %u\n", __func__, sinfo->nbins); + HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", __func__, sinfo->sect_off_size, sinfo->sect_len_size); #endif /* H5FS_SINFO_DEBUG */ @@ -200,9 +200,9 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, + HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", __func__, fspace->addr, fspace->sinfo, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ @@ -251,7 +251,7 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) HDassert(H5F_addr_defined(fspace->addr)); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", FUNC, + HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", __func__, fspace->sect_addr); #endif /* H5FS_SINFO_DEBUG */ /* Protect the free space sections */ @@ -267,7 +267,7 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) } /* end if */ else { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Creating new section info\n", FUNC); + HDfprintf(stderr, "%s: Creating new section info\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Sanity check */ HDassert(fspace->tot_sect_count == 0); @@ -289,9 +289,9 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) done: #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, - fspace->addr, fspace->sinfo, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, + HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", + __func__, fspace->addr, fspace->sinfo, fspace->sect_addr); + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) @@ -331,13 +331,13 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", FUNC, + HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", __func__, modified, fspace->addr, fspace->sect_addr); HDfprintf( stderr, "%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %t, fspace->sinfo_protected = %t\n", - FUNC, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, + __func__, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ @@ -413,7 +413,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) /* (Possibly dirty) */ /* (Possibly taking ownership from the cache) */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Unprotecting section info, cache_flags = %u\n", FUNC, cache_flags); + HDfprintf(stderr, "%s: Unprotecting section info, cache_flags = %u\n", __func__, cache_flags); #endif /* H5FS_SINFO_DEBUG */ if (H5AC_unprotect(f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") @@ -424,14 +424,14 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) /* Check if header is taking ownership of section info */ if ((cache_flags & H5AC__TAKE_OWNERSHIP_FLAG)) { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Taking ownership of section info\n", FUNC); + HDfprintf(stderr, "%s: Taking ownership of section info\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Set flag to release section info space in file */ release_sinfo_space = TRUE; } /* end if */ else { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); + HDfprintf(stderr, "%s: Relinquishing section info ownership\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Free space header relinquished ownership of section info */ fspace->sinfo = NULL; @@ -491,7 +491,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Freeing section info on disk, old_sect_addr = %a, old_alloc_sect_size = %Hu\n", - FUNC, old_sect_addr, old_alloc_sect_size); + __func__, old_sect_addr, old_alloc_sect_size); #endif /* H5FS_SINFO_DEBUG */ /* Release space for section info in file */ if (!H5F_IS_TMP_ADDR(f, old_sect_addr)) @@ -502,7 +502,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) done: #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_unlock() */ @@ -1343,7 +1343,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->size, sect->type, + HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", __func__, sect->addr, sect->size, sect->type, (sect->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); #endif /* H5FS_SINFO_DEBUG */ @@ -1367,7 +1367,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag /* Check for merging returned space with existing section node */ if (flags & H5FS_ADD_RETURNED_SPACE) { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Returning space\n", FUNC); + HDfprintf(stderr, "%s: Returning space\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Attempt to merge returned section with existing sections */ @@ -1384,7 +1384,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); + HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", __func__, fspace->tot_space); #endif /* H5FS_SINFO_DEBUG */ /* Mark free space sections as changed */ /* (if adding sections while deserializing sections, don't set the flag) */ @@ -1401,7 +1401,7 @@ done: H5FS__assert(fspace); #endif /* H5FS_DEBUG_ASSERT */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_add() */ @@ -1429,7 +1429,7 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: addr = %a, size = %Hu, extra_requested = %hu\n", FUNC, addr, size, + HDfprintf(stderr, "%s: addr = %a, size = %Hu, extra_requested = %hu\n", __func__, addr, size, extra_requested); #endif /* H5FS_SINFO_DEBUG */ @@ -1442,9 +1442,9 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize /* Check for any sections on free space list */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); - HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count); - HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count); + HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", __func__, fspace->tot_sect_count); + HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", __func__, fspace->serial_sect_count); + HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", __func__, fspace->ghost_sect_count); #endif /* H5FS_SINFO_DEBUG */ if (fspace->tot_sect_count > 0) { H5FS_section_info_t *sect; /* Temporary free space section */ diff --git a/src/H5MF.c b/src/H5MF.c index d1809ca..66bf823 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -542,7 +542,7 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) H5AC_set_ring(fsm_ring, &orig_ring); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); + HDfprintf(stderr, "%s: Before deleting free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Delete free space manager for this type */ @@ -597,7 +597,7 @@ H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type) HDassert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC); + HDfprintf(stderr, "%s: Before closing free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Close an existing free space structure for the file */ @@ -653,7 +653,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio H5AC_set_ring(fsm_ring, &orig_ring); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: adding node, node->sect_info.addr = %a, node->sect_info.size = %Hu\n", FUNC, + HDfprintf(stderr, "%s: adding node, node->sect_info.addr = %a, node->sect_info.size = %Hu\n", __func__, node->sect_info.addr, node->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Add the section */ @@ -706,7 +706,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "error locating free space in file") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section found = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: section found = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Check for actually finding section */ @@ -721,7 +721,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h /* Check for eliminating the section */ if (node->sect_info.size == size) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: freeing node\n", FUNC); + HDfprintf(stderr, "%s: freeing node\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Free section node */ @@ -734,7 +734,8 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h node->sect_info.size -= size; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: re-adding node, node->sect_info.size = %Hu\n", FUNC, node->sect_info.size); + HDfprintf(stderr, "%s: re-adding node, node->sect_info.size = %Hu\n", __func__, + node->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Re-add the section to the free-space manager */ @@ -777,7 +778,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); + HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ @@ -789,7 +790,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 1.0\n", FUNC); + HDfprintf(stderr, "%s: Check 1.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Set the ring type in the API context */ @@ -826,7 +827,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) /* If no space is found from the free-space manager, continue further action */ if (!H5F_addr_defined(ret_value)) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 2.0\n", FUNC); + HDfprintf(stderr, "%s: Check 2.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ if (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) { HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); @@ -841,7 +842,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) } /* end if */ HDassert(H5F_addr_defined(ret_value)); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 3.0\n", FUNC); + HDfprintf(stderr, "%s: Check 3.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ done: @@ -850,7 +851,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); + HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -890,7 +891,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); + HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype); @@ -987,7 +988,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); + HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -1033,7 +1034,7 @@ H5MF_alloc_tmp(H5F_t *f, hsize_t size) FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: size = %Hu\n", FUNC, size); + HDfprintf(stderr, "%s: size = %Hu\n", __func__, size); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1085,8 +1086,8 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)alloc_type, - addr, size); + HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", __func__, + (unsigned)alloc_type, addr, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ @@ -1135,13 +1136,13 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) * space is at the end of the file */ #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: fs_addr = %a\n", FUNC, f->shared->fs_addr[fs_type]); + HDfprintf(stderr, "%s: fs_addr = %a\n", __func__, f->shared->fs_addr[fs_type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ if (!H5F_addr_defined(f->shared->fs_addr[fs_type])) { htri_t status; /* "can absorb" status for section into */ #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", FUNC); + HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Try to shrink the file or absorb the block into a block aggregator */ if ((status = H5MF_try_shrink(f, alloc_type, addr, size)) < 0) @@ -1151,7 +1152,8 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) HGOTO_DONE(SUCCEED) else if (size < f->shared->fs_threshold) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size); + HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", __func__, addr, + size); #endif /* H5MF_ALLOC_DEBUG_MORE */ HGOTO_DONE(SUCCEED) } /* end else-if */ @@ -1168,7 +1170,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) */ if (f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING || !H5F_HAVE_FREE_SPACE_MANAGER(f)) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size); + HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", __func__, addr, size); #endif /* H5MF_ALLOC_DEBUG_MORE */ HGOTO_DONE(SUCCEED) } /* end if */ @@ -1191,7 +1193,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) HDassert(f->shared->fs_man[fs_type]); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", FUNC); + HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Add to the free space for the file */ @@ -1200,7 +1202,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) node = NULL; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: After H5FS_sect_add()\n", FUNC); + HDfprintf(stderr, "%s: After H5FS_sect_add()\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ else { @@ -1233,7 +1235,7 @@ done: HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -1277,8 +1279,8 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n", FUNC, - (unsigned)alloc_type, addr, size, extra_requested); + HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n", + __func__, (unsigned)alloc_type, addr, size, extra_requested); #endif /* H5MF_ALLOC_DEBUG */ /* Sanity check */ @@ -1330,7 +1332,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi if ((ret_value = H5F__try_extend(f, map_type, end, extra_requested + frag_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: extended = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: extended = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* If extending at EOA succeeds: */ @@ -1368,7 +1370,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending aggregation block") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: H5MF__aggr_try_extend = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: H5MF__aggr_try_extend = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -1394,7 +1396,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending block in free space manager") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Try to H5FS_sect_try_extend = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Try to H5FS_sect_try_extend = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -1405,7 +1407,8 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi if (frag_size <= H5F_PGEND_META_THRES(f) && extra_requested <= frag_size) ret_value = TRUE; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Try to extend into the page end threshold = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Try to extend into the page end threshold = %t\n", __func__, + ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ } /* end if */ @@ -1417,7 +1420,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -1452,8 +1455,8 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)alloc_type, - addr, size); + HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", __func__, + (unsigned)alloc_type, addr, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ @@ -1509,7 +1512,7 @@ done: HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_try_shrink() */ @@ -1533,7 +1536,7 @@ H5MF_close(H5F_t *f) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1551,7 +1554,7 @@ H5MF_close(H5F_t *f) done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_close() */ @@ -1577,7 +1580,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1589,7 +1592,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, + HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", __func__, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -1599,7 +1602,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, + HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", __func__, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -1610,7 +1613,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5MF__close_delete() */ @@ -1639,7 +1642,7 @@ H5MF_try_close(H5F_t *f) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1718,7 +1721,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5MF_try_close() */ @@ -1746,7 +1749,7 @@ H5MF__close_aggrfs(H5F_t *f) FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1884,7 +1887,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__close_aggrfs() */ @@ -1912,7 +1915,7 @@ H5MF__close_pagefs(H5F_t *f) FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -2059,7 +2062,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__close_pagefs() */ diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 68cd263..77345c9 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -92,7 +92,7 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); + HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_AGGR_DEBUG */ /* check arguments */ @@ -120,7 +120,7 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) done: #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); + HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size); #endif /* H5MF_AGGR_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) @@ -150,7 +150,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_STATIC #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); + HDfprintf(stderr, "%s: type = %u, size = %Hu\n", __func__, (unsigned)type, size); #endif /* H5MF_AGGR_DEBUG */ /* check args */ @@ -199,7 +199,8 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F H5FD_mem_t alloc_type, other_alloc_type; /* Current aggregator & 'other' aggregator types */ #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_size, aggr->size); + HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", __func__, aggr->addr, aggr->tot_size, + aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Turn off alignment if allocation < threshold */ @@ -267,7 +268,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F /* Allocate another block */ #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: Allocating block\n", FUNC); + HDfprintf(stderr, "%s: Allocating block\n", __func__); #endif /* H5MF_AGGR_DEBUG */ if (aggr_frag_size > (ext_size - size)) @@ -387,7 +388,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F done: #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value); + HDfprintf(stderr, "%s: ret_value = %a\n", __func__, ret_value); #endif /* H5MF_AGGR_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__aggr_alloc() */ @@ -722,7 +723,7 @@ done: tmp_addr = aggr->addr; tmp_size = aggr->size; #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: tmp_addr = %a, tmp_size = %Hu\n", FUNC, tmp_addr, tmp_size); + HDfprintf(stderr, "%s: tmp_addr = %a, tmp_size = %Hu\n", __func__, tmp_addr, tmp_size); #endif /* H5MF_AGGR_DEBUG */ /* Reset aggregator block information */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 7b89fd8..6ccbe78 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -210,7 +210,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); + HDfprintf(stderr, "%s: Dumping file free space sections\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* @@ -223,7 +223,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", FUNC, eoa); + HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", __func__, eoa); #endif /* H5MF_ALLOC_DEBUG */ if (H5F_PAGED_AGGR(f)) { /* File space paging */ @@ -267,7 +267,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: ma_addr = %" PRIuHADDR ", ma_size = %" PRIuHSIZE ", end of ma = %" PRIuHADDR "\n", - FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); + __func__, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Retrieve 'small data' aggregator info, if available */ @@ -275,7 +275,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: sda_addr = %" PRIuHADDR ", sda_size = %" PRIuHSIZE ", end of sda = %" PRIuHADDR "\n", - FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); + __func__, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ @@ -318,7 +318,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) } /* end else */ done: - HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC); + HDfprintf(stderr, "%s: Done dumping file free space sections\n", __func__); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF__sects_dump() */ #endif /* H5MF_ALLOC_DEBUG_DUMP */ diff --git a/src/H5MFsection.c b/src/H5MFsection.c index bf5b888..69b2ca0 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -472,7 +472,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Set the shrinking type */ udata->shrink = H5MF_SHRINK_EOA; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, + HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", __func__, sect->sect_info.addr, sect->sect_info.size, eoa); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -496,7 +496,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Set the aggregator to operate on */ udata->aggr = &(udata->f->shared->meta_aggr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", FUNC, + HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", __func__, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -517,7 +517,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Set the aggregator to operate on */ udata->aggr = &(udata->f->shared->sdata_aggr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", FUNC, + HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", __func__, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -625,7 +625,7 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, + HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", __func__, (*sect)->sect_info.addr, (*sect)->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -646,14 +646,14 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) *flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE; *flags |= H5FS_PAGE_END_NO_ADD; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section is dropped\n", FUNC); + HDfprintf(stderr, "%s: section is dropped\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ /* Adjust the section if it is not at page end but its size + prem is at page end */ else if (prem <= H5F_PGEND_META_THRES(udata->f)) { (*sect)->sect_info.size += prem; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, + HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", __func__, (*sect)->sect_info.addr, (*sect)->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -702,7 +702,7 @@ H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section ret_value = FALSE; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ FUNC_LEAVE_NOAPI(ret_value) @@ -806,7 +806,7 @@ H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ FUNC_LEAVE_NOAPI(ret_value) @@ -894,7 +894,7 @@ H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Set the shrinking type */ udata->shrink = H5MF_SHRINK_EOA; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, + HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", __func__, sect->sect_info.addr, sect->sect_info.size, eoa); #endif /* H5MF_ALLOC_DEBUG_MORE */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index e12ff93..a5b9b6c 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -296,11 +296,11 @@ H5S__hyper_print_spans_helper(FILE *f, const H5S_hyper_span_t *span, unsigned de FUNC_ENTER_STATIC_NOERR while (span) { - HDfprintf(f, "%s: %*sdepth=%u, span=%p, (%Hu, %Hu), next=%p\n", FUNC, depth * 2, "", depth, span, + HDfprintf(f, "%s: %*sdepth=%u, span=%p, (%Hu, %Hu), next=%p\n", __func__, depth * 2, "", depth, span, span->low, span->high, span->next); if (span->down) { - HDfprintf(f, "%s: %*sspans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", FUNC, (depth + 1) * 2, - "", span->down, span->down->count, span->down->low_bounds[0], + HDfprintf(f, "%s: %*sspans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", __func__, + (depth + 1) * 2, "", span->down, span->down->count, span->down->low_bounds[0], span->down->high_bounds[0], span->down->head); H5S__hyper_print_spans_helper(f, span->down->head, depth + 1); } /* end if */ @@ -316,7 +316,7 @@ H5S__hyper_print_spans(FILE *f, const H5S_hyper_span_info_t *span_lst) FUNC_ENTER_STATIC_NOERR if (span_lst != NULL) { - HDfprintf(f, "%s: spans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", FUNC, span_lst, + HDfprintf(f, "%s: spans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", __func__, span_lst, span_lst->count, span_lst->low_bounds[0], span_lst->high_bounds[0], span_lst->head); H5S__hyper_print_spans_helper(f, span_lst->head, 0); } /* end if */ @@ -342,21 +342,21 @@ H5S__hyper_print_diminfo_helper(FILE *f, const char *field, unsigned ndims, cons FUNC_ENTER_STATIC_NOERR if (dinfo != NULL) { - HDfprintf(f, "%s: %s: start=[", FUNC, field); + HDfprintf(f, "%s: %s: start=[", __func__, field); for (u = 0; u < ndims; u++) HDfprintf(f, "%Hd%s", dinfo[u].start, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: stride=[", FUNC, field); + HDfprintf(f, "%s: %s: stride=[", __func__, field); for (u = 0; u < ndims; u++) HDfprintf(f, "%Hu%s", dinfo[u].stride, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: count=[", FUNC, field); + HDfprintf(f, "%s: %s: count=[", __func__, field); for (u = 0; u < ndims; u++) HDfprintf(f, "%Hu%s", dinfo[u].count, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: block=[", FUNC, field); + HDfprintf(f, "%s: %s: block=[", __func__, field); for (u = 0; u < ndims; u++) HDfprintf(f, "%Hu%s", dinfo[u].block, (u < (ndims - 1) ? ", " : "]\n")); } /* end if */ else - HDfprintf(f, "%s: %s==NULL\n", FUNC, field); + HDfprintf(f, "%s: %s==NULL\n", __func__, field); FUNC_LEAVE_NOAPI(SUCCEED) } diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 7b85209..b626b77 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -685,7 +685,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new rank = sel_iter.u.hyp.iter_rank; #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: Flattened selection\n", FUNC); + HDfprintf(H5DEBUG(S), "%s: Flattened selection\n", __func__); #endif for (u = 0; u < rank; ++u) { H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) @@ -700,7 +700,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new HDfprintf(H5DEBUG(S), "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, - FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + __func__, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); if (u == 0) HDfprintf(H5DEBUG(S), " rank=%u\n", rank); else @@ -719,7 +719,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new rank = space->extent.rank; #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: Non-flattened selection\n", FUNC); + HDfprintf(H5DEBUG(S), "%s: Non-flattened selection\n", __func__); #endif for (u = 0; u < rank; ++u) { H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) @@ -734,7 +734,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new HDfprintf(H5DEBUG(S), "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, - FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + __func__, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); if (u == 0) HDfprintf(H5DEBUG(S), " rank=%u\n", rank); else @@ -783,7 +783,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new *******************************************************/ #ifdef H5S_DEBUG if (H5DEBUG(S)) { - HDfprintf(H5DEBUG(S), "%s: Making contig type %zu MPI_BYTEs\n", FUNC, elmt_size); + HDfprintf(H5DEBUG(S), "%s: Making contig type %zu MPI_BYTEs\n", __func__, elmt_size); for (i = ((int)rank) - 1; i >= 0; --i) HDfprintf(H5DEBUG(S), "d[%d].xtent=%" PRIuHSIZE "\n", i, d[i].xtent); } @@ -817,12 +817,12 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new "%s: Dimension i=%d \n" "start=%" PRIdHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " stride=%" PRIuHSIZE ", xtent=%" PRIuHSIZE " max_xtent=%" PRIuHSIZE "\n", - FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); + __func__, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); #endif #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC, i); + HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", __func__, i); #endif /**************************************** * Build vector type of the selection. @@ -957,7 +957,7 @@ done: #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", FUNC, *count, + HDfprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", __func__, *count, (*is_derived_type) ? "TRUE" : "FALSE"); #endif FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5private.h b/src/H5private.h index 71b913a..a5c6efd 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -150,8 +150,8 @@ #define eventa(func_name) h5_mpe_eventa #define eventb(func_name) h5_mpe_eventb #define MPE_LOG_VARS \ - static int eventa(FUNC) = -1; \ - static int eventb(FUNC) = -1; \ + static int eventa(__func__) = -1; \ + static int eventb(__func__) = -1; \ char p_event_start[128]; /* Hardwire the color to "red", since that's what all the routines are using @@ -163,14 +163,14 @@ */ #define BEGIN_MPE_LOG \ if (H5_MPEinit_g) { \ - sprintf(p_event_start, "start %s", FUNC); \ - if (eventa(FUNC) == -1 && eventb(FUNC) == -1) { \ + sprintf(p_event_start, "start %s", __func__); \ + if (eventa(__func__) == -1 && eventb(__func__) == -1) { \ const char *p_color = "red"; \ - eventa(FUNC) = MPE_Log_get_event_number(); \ - eventb(FUNC) = MPE_Log_get_event_number(); \ - MPE_Describe_state(eventa(FUNC), eventb(FUNC), FUNC, p_color); \ + eventa(__func__) = MPE_Log_get_event_number(); \ + eventb(__func__) = MPE_Log_get_event_number(); \ + MPE_Describe_state(eventa(__func__), eventb(__func__), __func__, p_color); \ } \ - MPE_Log_event(eventa(FUNC), 0, p_event_start); \ + MPE_Log_event(eventa(__func__), 0, p_event_start); \ } /*------------------------------------------------------------------------ @@ -181,7 +181,7 @@ */ #define FINISH_MPE_LOG \ if (H5_MPEinit_g) { \ - MPE_Log_event(eventb(FUNC), 0, FUNC); \ + MPE_Log_event(eventb(__func__), 0, __func__); \ } #else /* H5_HAVE_MPE */ @@ -1978,7 +1978,7 @@ extern hbool_t H5_libterm_g; /* Is the library being shutdown? */ /* Include required function stack header */ #include "H5CSprivate.h" -#define H5_PUSH_FUNC H5CS_push(FUNC); +#define H5_PUSH_FUNC H5CS_push(__func__); #define H5_POP_FUNC H5CS_pop(); #else /* H5_HAVE_CODESTACK */ #define H5_PUSH_FUNC /* void */ diff --git a/test/hdfs.c b/test/hdfs.c index dfaa585..74fc2bd 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -102,7 +102,7 @@ */ #define JSFAILED_AT() \ { \ - HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); \ } /*---------------------------------------------------------------------------- diff --git a/test/ros3.c b/test/ros3.c index 54518f4..b7b27ed 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -106,7 +106,7 @@ */ #define JSFAILED_AT() \ { \ - HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); \ } /*---------------------------------------------------------------------------- diff --git a/test/s3comms.c b/test/s3comms.c index 6202af3..cec7a27 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -96,7 +96,7 @@ */ #define JSFAILED_AT() \ { \ - HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); \ } /*---------------------------------------------------------------------------- diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index ed99fc4..e5654f4 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -1861,7 +1861,7 @@ main(int argc, char **argv) HDprintf("Failed to turn off atexit processing. Continue.\n"); /* set alarm. */ - ALARM_ON; + TestAlarmOn(); dataset_big_write(); MPI_Barrier(MPI_COMM_WORLD); @@ -1878,7 +1878,7 @@ main(int argc, char **argv) single_rank_independent_io(); /* turn off alarm */ - ALARM_OFF; + TestAlarmOff(); if (mpi_rank_g == 0) HDremove(FILENAME[0]); diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 4cf1139..8696092 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -577,7 +577,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Comm_group() failed with error %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: MPI_Comm_group() failed with error %d.\n", world_mpi_rank, __func__, mpi_result); } } @@ -594,7 +594,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Group_excl() failed with error %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: MPI_Group_excl() failed with error %d.\n", world_mpi_rank, __func__, mpi_result); } } @@ -609,8 +609,8 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Comm_create() failed with error %d.\n", world_mpi_rank, FUNC, - mpi_result); + HDfprintf(stdout, "%d:%s: MPI_Comm_create() failed with error %d.\n", world_mpi_rank, + __func__, mpi_result); } } else { @@ -622,7 +622,8 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: file_mpi_comm == MPI_COMM_NULL.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: file_mpi_comm == MPI_COMM_NULL.\n", world_mpi_rank, + __func__); } } } @@ -635,7 +636,8 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: file_mpi_comm != MPI_COMM_NULL.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: file_mpi_comm != MPI_COMM_NULL.\n", world_mpi_rank, + __func__); } } } @@ -651,7 +653,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Comm_size() failed with error %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: MPI_Comm_size() failed with error %d.\n", world_mpi_rank, __func__, mpi_result); } } @@ -666,7 +668,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Comm_rank() failed with error %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: MPI_Comm_rank() failed with error %d.\n", world_mpi_rank, __func__, mpi_result); } } @@ -832,7 +834,7 @@ do_express_test(void) nerrors++; max_express_test = -1; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n", world_mpi_rank, __func__); } } @@ -880,7 +882,7 @@ do_sync(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -891,7 +893,7 @@ do_sync(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } else if ((mssg.req != SYNC_ACK_CODE) || (mssg.src != world_server_mpi_rank) || @@ -899,7 +901,7 @@ do_sync(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in sync ack.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in sync ack.\n", world_mpi_rank, __func__); } } } @@ -936,7 +938,7 @@ get_max_nerrors(void) nerrors++; max_nerrors = -1; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n", world_mpi_rank, __func__); } } @@ -983,7 +985,7 @@ recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: bad param(s) on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: bad param(s) on entry.\n", world_mpi_rank, __func__); } } else { @@ -1000,7 +1002,7 @@ recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Recv() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: MPI_Recv() failed.\n", world_mpi_rank, __func__); } } else if (mssg_ptr->magic != MSSG_MAGIC) { @@ -1008,7 +1010,7 @@ recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: invalid magic.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: invalid magic.\n", world_mpi_rank, __func__); } } else if (mssg_ptr->src != status.MPI_SOURCE) { @@ -1016,7 +1018,7 @@ recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: mssg_ptr->src != status.MPI_SOURCE.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: mssg_ptr->src != status.MPI_SOURCE.\n", world_mpi_rank, __func__); } } } @@ -1061,7 +1063,7 @@ send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Invalid mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Invalid mssg on entry.\n", world_mpi_rank, __func__); } } @@ -1081,7 +1083,7 @@ send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Send() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: MPI_Send() failed.\n", world_mpi_rank, __func__); } } } @@ -1130,7 +1132,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Get_address() call failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: MPI_Get_address() call failed.\n", world_mpi_rank, __func__); } } else { @@ -1150,7 +1152,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Type_create_struct() call failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: MPI_Type_create_struct() call failed.\n", world_mpi_rank, __func__); } } } @@ -1164,7 +1166,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Type_commit() call failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: MPI_Type_commit() call failed.\n", world_mpi_rank, __func__); } } } @@ -1200,7 +1202,7 @@ takedown_derived_types(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: MPI_Type_free() call failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: MPI_Type_free() call failed.\n", world_mpi_rank, __func__); } } @@ -1253,7 +1255,7 @@ reset_server_counters(void) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: actual/total reads mismatch (%ld/%d).\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: actual/total reads mismatch (%ld/%d).\n", world_mpi_rank, __func__, actual_total_reads, total_reads); } } @@ -1263,7 +1265,7 @@ reset_server_counters(void) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: actual/total writes mismatch (%ld/%d).\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: actual/total writes mismatch (%ld/%d).\n", world_mpi_rank, __func__, actual_total_writes, total_writes); } } @@ -1311,7 +1313,7 @@ server_main(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: This isn't the server process?!?!?\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: This isn't the server process?!?!?\n", world_mpi_rank, __func__); } } @@ -1328,7 +1330,7 @@ server_main(void) case WRITE_REQ_ACK_CODE: success = FALSE; if (verbose) - HDfprintf(stdout, "%s: Received write ack?!?.\n", FUNC); + HDfprintf(stdout, "%s: Received write ack?!?.\n", __func__); break; case READ_REQ_CODE: @@ -1338,7 +1340,7 @@ server_main(void) case READ_REQ_REPLY_CODE: success = FALSE; if (verbose) - HDfprintf(stdout, "%s: Received read req reply?!?.\n", FUNC); + HDfprintf(stdout, "%s: Received read req reply?!?.\n", __func__); break; case SYNC_REQ_CODE: @@ -1348,7 +1350,7 @@ server_main(void) case SYNC_ACK_CODE: success = FALSE; if (verbose) - HDfprintf(stdout, "%s: Received sync ack?!?.\n", FUNC); + HDfprintf(stdout, "%s: Received sync ack?!?.\n", __func__); break; case REQ_TTL_WRITES_CODE: @@ -1358,7 +1360,7 @@ server_main(void) case REQ_TTL_WRITES_RPLY_CODE: success = FALSE; if (verbose) - HDfprintf(stdout, "%s: Received total writes reply?!?.\n", FUNC); + HDfprintf(stdout, "%s: Received total writes reply?!?.\n", __func__); break; case REQ_TTL_READS_CODE: @@ -1368,7 +1370,7 @@ server_main(void) case REQ_TTL_READS_RPLY_CODE: success = FALSE; if (verbose) - HDfprintf(stdout, "%s: Received total reads reply?!?.\n", FUNC); + HDfprintf(stdout, "%s: Received total reads reply?!?.\n", __func__); break; case REQ_ENTRY_WRITES_CODE: @@ -1378,7 +1380,7 @@ server_main(void) case REQ_ENTRY_WRITES_RPLY_CODE: success = FALSE; if (verbose) - HDfprintf(stdout, "%s: Received entry writes reply?!?.\n", FUNC); + HDfprintf(stdout, "%s: Received entry writes reply?!?.\n", __func__); break; case REQ_ENTRY_READS_CODE: @@ -1388,7 +1390,7 @@ server_main(void) case REQ_ENTRY_READS_RPLY_CODE: success = FALSE; if (verbose) - HDfprintf(stdout, "%s: Received entry reads reply?!?.\n", FUNC); + HDfprintf(stdout, "%s: Received entry reads reply?!?.\n", __func__); break; case REQ_RW_COUNT_RESET_CODE: @@ -1398,7 +1400,7 @@ server_main(void) case REQ_RW_COUNT_RESET_RPLY_CODE: success = FALSE; if (verbose) - HDfprintf(stdout, "%s: Received RW count reset reply?!?.\n", FUNC); + HDfprintf(stdout, "%s: Received RW count reset reply?!?.\n", __func__); break; case DONE_REQ_CODE: @@ -1411,7 +1413,7 @@ server_main(void) nerrors++; success = FALSE; if (verbose) - HDfprintf(stdout, "%d:%s: Unknown request code.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Unknown request code.\n", world_mpi_rank, __func__); break; } } @@ -1453,7 +1455,7 @@ serve_read_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, __func__); } } @@ -1467,7 +1469,7 @@ serve_read_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, __func__, target_addr); } } @@ -1476,7 +1478,7 @@ serve_read_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: data[i].len = %zu != mssg->len = %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: data[i].len = %zu != mssg->len = %d.\n", world_mpi_rank, __func__, data[target_index].len, mssg_ptr->len); } } @@ -1488,7 +1490,8 @@ serve_read_request(struct mssg_t *mssg_ptr) HDfprintf(stdout, "%d:%s: proc %d read invalid entry. " "idx/base_addr = %d/%" PRIuHADDR ".\n", - world_mpi_rank, FUNC, mssg_ptr->src, target_index, data[target_index].base_addr); + world_mpi_rank, __func__, mssg_ptr->src, target_index, + data[target_index].base_addr); } } else { @@ -1568,7 +1571,7 @@ serve_sync_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, __func__); } } @@ -1642,7 +1645,7 @@ serve_write_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, __func__); } } @@ -1656,7 +1659,7 @@ serve_write_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, __func__, target_addr); } } @@ -1665,7 +1668,7 @@ serve_write_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: data[i].len = %zu != mssg->len = %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: data[i].len = %zu != mssg->len = %d.\n", world_mpi_rank, __func__, data[target_index].len, mssg_ptr->len); } } @@ -1681,8 +1684,8 @@ serve_write_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: new ver = %d <= old ver = %d.\n", world_mpi_rank, FUNC, new_ver_num, - data[target_index].ver); + HDfprintf(stdout, "%d:%s: new ver = %d <= old ver = %d.\n", world_mpi_rank, __func__, + new_ver_num, data[target_index].ver); } } } @@ -1767,7 +1770,7 @@ serve_total_writes_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, __func__); } } @@ -1837,7 +1840,7 @@ serve_total_reads_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, __func__); } } @@ -1909,7 +1912,7 @@ serve_entry_writes_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, __func__); } } @@ -1923,7 +1926,7 @@ serve_entry_writes_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, __func__, target_addr); } } @@ -1998,7 +2001,7 @@ serve_entry_reads_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, __func__); } } @@ -2012,7 +2015,7 @@ serve_entry_reads_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, __func__, target_addr); } } @@ -2084,7 +2087,7 @@ serve_rw_count_reset_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, __func__); } } @@ -2436,7 +2439,7 @@ datum_notify(H5C_notify_action_t action, void *thing) nerrors++; ret_value = FAIL; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, __func__); } } @@ -2447,7 +2450,7 @@ datum_notify(H5C_notify_action_t action, void *thing) nerrors++; ret_value = FAIL; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -2462,7 +2465,7 @@ datum_notify(H5C_notify_action_t action, void *thing) nerrors++; ret_value = FAIL; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in read req reply.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in read req reply.\n", world_mpi_rank, __func__); } #if 0 /* This has been useful debugging code -- keep it for now. */ @@ -2470,35 +2473,35 @@ datum_notify(H5C_notify_action_t action, void *thing) HDfprintf(stdout, "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); HDfprintf(stdout, "%d:%s: mssg.req = %d.\n", - world_mpi_rank, FUNC, (int)(mssg.req)); + world_mpi_rank, __func__, (int)(mssg.req)); } if ( mssg.src != world_server_mpi_rank ) { HDfprintf(stdout, "%d:%s: mssg.src != world_server_mpi_rank.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); } if ( mssg.dest != world_mpi_rank ) { HDfprintf(stdout, "%d:%s: mssg.dest != world_mpi_rank.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); } if ( mssg.base_addr != entry_ptr->base_addr ) { HDfprintf(stdout, "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); HDfprintf(stdout, "%d:%s: mssg.base_addr = %" PRIuHADDR ".\n", - world_mpi_rank, FUNC, mssg.base_addr); + world_mpi_rank, __func__, mssg.base_addr); HDfprintf(stdout, "%d:%s: entry_ptr->base_addr = %" PRIuHADDR ".\n", - world_mpi_rank, FUNC, + world_mpi_rank, __func__, entry_ptr->base_addr); } @@ -2506,22 +2509,22 @@ datum_notify(H5C_notify_action_t action, void *thing) HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); HDfprintf(stdout, "%d:%s: mssg.len = %" PRIuHADDR ".\n", - world_mpi_rank, FUNC, mssg.len); + world_mpi_rank, __func__, mssg.len); } if ( mssg.ver < entry_ptr->ver ) { HDfprintf(stdout, "%d:%s: mssg.ver < entry_ptr->ver.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); } if ( mssg.magic != MSSG_MAGIC ) { HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); } #endif /* JRM */ } @@ -2554,7 +2557,7 @@ datum_notify(H5C_notify_action_t action, void *thing) ret_value = FAIL; HDfprintf(stdout, "%d:%s: Flushed dirty entry from non-zero file process.", world_mpi_rank, - FUNC); + __func__); } if (ret_value == SUCCEED) { @@ -2581,7 +2584,7 @@ datum_notify(H5C_notify_action_t action, void *thing) nerrors++; ret_value = FAIL; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, __func__); } } else { @@ -2600,7 +2603,7 @@ datum_notify(H5C_notify_action_t action, void *thing) nerrors++; ret_value = FAIL; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } else if ((mssg.req != WRITE_REQ_ACK_CODE) || (mssg.src != world_server_mpi_rank) || @@ -2611,7 +2614,7 @@ datum_notify(H5C_notify_action_t action, void *thing) nerrors++; ret_value = FAIL; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", world_mpi_rank, __func__); } } } @@ -2717,7 +2720,7 @@ datum_notify(H5C_notify_action_t action, void *thing) nerrors++; ret_value = FAIL; if (verbose) { - HDfprintf(stdout, "%d:%s: Unknown notify action.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Unknown notify action.\n", world_mpi_rank, __func__); } break; } @@ -2824,7 +2827,7 @@ expunge_entry(H5F_t *file_ptr, int32_t idx) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Error in H5AC_expunge_entry().\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Error in H5AC_expunge_entry().\n", world_mpi_rank, __func__); } } @@ -2838,14 +2841,14 @@ expunge_entry(H5F_t *file_ptr, int32_t idx) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Error in H5C_get_entry_status().\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Error in H5C_get_entry_status().\n", world_mpi_rank, __func__); } } else if (in_cache) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Expunged entry still in cache?!?\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Expunged entry still in cache?!?\n", world_mpi_rank, __func__); } } } @@ -2906,7 +2909,7 @@ insert_entry(H5C_t *cache_ptr, H5F_t *file_ptr, int32_t idx, unsigned int flags) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Error in H5AC_insert_entry().\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Error in H5AC_insert_entry().\n", world_mpi_rank, __func__); } } @@ -2927,8 +2930,8 @@ insert_entry(H5C_t *cache_ptr, H5F_t *file_ptr, int32_t idx, unsigned int flags) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: data[%d].header.is_dirty = %d.\n", world_mpi_rank, FUNC, idx, - (int)(data[idx].header.is_dirty)); + HDfprintf(stdout, "%d:%s: data[%d].header.is_dirty = %d.\n", world_mpi_rank, __func__, + idx, (int)(data[idx].header.is_dirty)); } } } @@ -3268,7 +3271,7 @@ lock_entry(H5F_t *file_ptr, int32_t idx) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: error in H5AC_protect().\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: error in H5AC_protect().\n", world_mpi_rank, __func__); } } else { @@ -3321,7 +3324,7 @@ mark_entry_dirty(int32_t idx) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: error in H5AC_mark_entry_dirty().\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: error in H5AC_mark_entry_dirty().\n", world_mpi_rank, __func__); } } else if (!(entry_ptr->locked)) { @@ -3432,7 +3435,7 @@ pin_protected_entry(int32_t idx, hbool_t global) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Error in H5AC_pin_protected entry().\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Error in H5AC_pin_protected entry().\n", world_mpi_rank, __func__); } } @@ -3536,7 +3539,7 @@ move_entry(H5F_t *file_ptr, int32_t old_idx, int32_t new_idx) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5AC_move_entry() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5AC_move_entry() failed.\n", world_mpi_rank, __func__); } } else { @@ -3560,7 +3563,7 @@ move_entry(H5F_t *file_ptr, int32_t old_idx, int32_t new_idx) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: data[%d].header.is_dirty = %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: data[%d].header.is_dirty = %d.\n", world_mpi_rank, __func__, new_idx, (int)(data[new_idx].header.is_dirty)); } } @@ -3612,7 +3615,7 @@ reset_server_counts(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -3624,7 +3627,7 @@ reset_server_counts(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } else if ((mssg.req != REQ_RW_COUNT_RESET_RPLY_CODE) || (mssg.src != world_server_mpi_rank) || @@ -3634,7 +3637,8 @@ reset_server_counts(void) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in req r/w counter reset reply.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in req r/w counter reset reply.\n", world_mpi_rank, + __func__); } } } @@ -3685,7 +3689,7 @@ resize_entry(int32_t idx, size_t new_size) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5AC_resize_entry() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5AC_resize_entry() failed.\n", world_mpi_rank, __func__); } } else { @@ -3750,13 +3754,13 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr if (fid < 0) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Fcreate() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fcreate() failed.\n", world_mpi_rank, __func__); } } else if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, __func__); } } else { @@ -3766,7 +3770,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr if (file_ptr == NULL) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Can't get file_ptr.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Can't get file_ptr.\n", world_mpi_rank, __func__); } } else { @@ -3776,13 +3780,13 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr if (cache_ptr == NULL) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Can't get cache_ptr.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Can't get cache_ptr.\n", world_mpi_rank, __func__); } } else if (cache_ptr->magic != H5C__H5C_T_MAGIC) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad cache_ptr magic.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad cache_ptr magic.\n", world_mpi_rank, __func__); } } else { @@ -3800,7 +3804,8 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr if (H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { - HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config(1) failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config(1) failed.\n", world_mpi_rank, + __func__); } else { @@ -3810,11 +3815,11 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr if (H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank, - FUNC); + __func__); } else if (enable_rpt_fcn) { - HDfprintf(stdout, "%d:%s: rpt_fcn enabled.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: rpt_fcn enabled.\n", world_mpi_rank, __func__); } } } @@ -3830,7 +3835,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: cache_ptr->aux_ptr == NULL.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: cache_ptr->aux_ptr == NULL.\n", world_mpi_rank, __func__); } } else if (((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic != H5AC__H5AC_AUX_T_MAGIC) { @@ -3838,7 +3843,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: cache_ptr->aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); } } else if (((H5AC_aux_t *)(cache_ptr->aux_ptr))->metadata_write_strategy != metadata_write_strategy) { @@ -3846,7 +3851,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: bad cache_ptr->aux_ptr->metadata_write_strategy\n", world_mpi_rank, - FUNC); + __func__); } } } @@ -3861,7 +3866,8 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr if (H5AC_get_cache_auto_resize_config(cache_ptr, &test_config) != SUCCEED) { - HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config(2) failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config(2) failed.\n", world_mpi_rank, + __func__); } else if (test_config.metadata_write_strategy != metadata_write_strategy) { @@ -3869,7 +3875,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr if (verbose) { - HDfprintf(stdout, "%d:%s: unexpected metadata_write_strategy.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: unexpected metadata_write_strategy.\n", world_mpi_rank, __func__); } } } @@ -3889,7 +3895,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5MF_alloc() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5MF_alloc() failed.\n", world_mpi_rank, __func__); } } else if (actual_base_addr > BASE_ADDR) { @@ -3902,7 +3908,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: actual_base_addr > BASE_ADDR.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: actual_base_addr > BASE_ADDR.\n", world_mpi_rank, __func__); } } } @@ -3913,7 +3919,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: second H5Fflush() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: second H5Fflush() failed.\n", world_mpi_rank, __func__); } } } @@ -3926,7 +3932,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5C_set_write_done_callback failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5C_set_write_done_callback failed.\n", world_mpi_rank, __func__); } } } @@ -3940,7 +3946,7 @@ setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: H5AC__set_sync_point_done_callback failed.\n", world_mpi_rank, - FUNC); + __func__); } } } @@ -3996,7 +4002,7 @@ verify_writes(unsigned num_writes, haddr_t *written_entries_tbl) proceed = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 1 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 1 failed.\n", world_mpi_rank, __func__); } } } @@ -4019,7 +4025,7 @@ verify_writes(unsigned num_writes, haddr_t *written_entries_tbl) proceed = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 2 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 2 failed.\n", world_mpi_rank, __func__); } } } @@ -4034,11 +4040,11 @@ verify_writes(unsigned num_writes, haddr_t *written_entries_tbl) if (proceed) { - HDfprintf(stdout, "%d:%s: verified %u writes.\n", world_mpi_rank, FUNC, num_writes); + HDfprintf(stdout, "%d:%s: verified %u writes.\n", world_mpi_rank, __func__, num_writes); } else { - HDfprintf(stdout, "%d:%s: FAILED to verify %u writes.\n", world_mpi_rank, FUNC, num_writes); + HDfprintf(stdout, "%d:%s: FAILED to verify %u writes.\n", world_mpi_rank, __func__, num_writes); } } @@ -4055,7 +4061,7 @@ verify_writes(unsigned num_writes, haddr_t *written_entries_tbl) proceed = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 3 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 3 failed.\n", world_mpi_rank, __func__); } } } @@ -4098,7 +4104,7 @@ setup_rand(void) HDassert(world_mpi_rank < world_mpi_size); seed = predefined_seeds[world_mpi_rank]; - HDfprintf(stdout, "%d:%s: predefined_seed = %d.\n", world_mpi_rank, FUNC, seed); + HDfprintf(stdout, "%d:%s: predefined_seed = %d.\n", world_mpi_rank, __func__, seed); fflush(stdout); HDsrand(seed); } @@ -4108,13 +4114,13 @@ setup_rand(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: gettimeofday() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: gettimeofday() failed.\n", world_mpi_rank, __func__); } } else { seed = (unsigned)tv.tv_usec; if (verbose) { - HDfprintf(stdout, "%d:%s: seed = %d.\n", world_mpi_rank, FUNC, seed); + HDfprintf(stdout, "%d:%s: seed = %d.\n", world_mpi_rank, __func__, seed); fflush(stdout); } HDsrand(seed); @@ -4154,7 +4160,7 @@ take_down_cache(hid_t fid, H5C_t *cache_ptr) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, __func__); } } @@ -4171,7 +4177,7 @@ take_down_cache(hid_t fid, H5C_t *cache_ptr) nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: H5AC__set_sync_point_done_callback failed.\n", world_mpi_rank, - FUNC); + __func__); } } } @@ -4182,7 +4188,7 @@ take_down_cache(hid_t fid, H5C_t *cache_ptr) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Fclose() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fclose() failed.\n", world_mpi_rank, __func__); } } @@ -4198,7 +4204,7 @@ take_down_cache(hid_t fid, H5C_t *cache_ptr) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: HDremove() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: HDremove() failed.\n", world_mpi_rank, __func__); } } } @@ -4260,7 +4266,7 @@ verify_entry_reads(haddr_t addr, int expected_entry_reads) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -4272,7 +4278,7 @@ verify_entry_reads(haddr_t addr, int expected_entry_reads) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -4286,7 +4292,7 @@ verify_entry_reads(haddr_t addr, int expected_entry_reads) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in req entry reads reply.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in req entry reads reply.\n", world_mpi_rank, __func__); } } else { @@ -4303,7 +4309,7 @@ verify_entry_reads(haddr_t addr, int expected_entry_reads) success = FALSE; if (verbose) { HDfprintf(stdout, "%d:%s: rep/exp entry 0x%" PRIxHADDR " reads mismatch (%d/%d).\n", - world_mpi_rank, FUNC, addr, reported_entry_reads, expected_entry_reads); + world_mpi_rank, __func__, addr, reported_entry_reads, expected_entry_reads); } } } @@ -4357,7 +4363,7 @@ verify_entry_writes(haddr_t addr, int expected_entry_writes) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -4369,7 +4375,7 @@ verify_entry_writes(haddr_t addr, int expected_entry_writes) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -4383,7 +4389,7 @@ verify_entry_writes(haddr_t addr, int expected_entry_writes) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in req entry writes reply.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in req entry writes reply.\n", world_mpi_rank, __func__); } } else { @@ -4400,7 +4406,7 @@ verify_entry_writes(haddr_t addr, int expected_entry_writes) success = FALSE; if (verbose) { HDfprintf(stdout, "%d:%s: rep/exp entry 0x%llx writes mismatch (%d/%d).\n", world_mpi_rank, - FUNC, (long long)addr, reported_entry_writes, expected_entry_writes); + __func__, (long long)addr, reported_entry_writes, expected_entry_writes); } } } @@ -4453,7 +4459,7 @@ verify_total_reads(int expected_total_reads) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -4465,7 +4471,7 @@ verify_total_reads(int expected_total_reads) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } else if ((mssg.req != REQ_TTL_READS_RPLY_CODE) || (mssg.src != world_server_mpi_rank) || @@ -4475,7 +4481,7 @@ verify_total_reads(int expected_total_reads) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in req total reads reply.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in req total reads reply.\n", world_mpi_rank, __func__); } } else { @@ -4492,7 +4498,7 @@ verify_total_reads(int expected_total_reads) success = FALSE; if (verbose) { HDfprintf(stdout, "%d:%s: reported/expected total reads mismatch (%ld/%d).\n", world_mpi_rank, - FUNC, reported_total_reads, expected_total_reads); + __func__, reported_total_reads, expected_total_reads); } } } @@ -4545,7 +4551,7 @@ verify_total_writes(unsigned expected_total_writes) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -4557,7 +4563,7 @@ verify_total_writes(unsigned expected_total_writes) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } else if ((mssg.req != REQ_TTL_WRITES_RPLY_CODE) || (mssg.src != world_server_mpi_rank) || @@ -4567,7 +4573,7 @@ verify_total_writes(unsigned expected_total_writes) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in req total reads reply.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in req total reads reply.\n", world_mpi_rank, __func__); } } else { @@ -4584,7 +4590,7 @@ verify_total_writes(unsigned expected_total_writes) success = FALSE; if (verbose) { HDfprintf(stdout, "%d:%s: reported/expected total writes mismatch (%u/%u).\n", world_mpi_rank, - FUNC, reported_total_writes, expected_total_writes); + __func__, reported_total_writes, expected_total_writes); } } } @@ -4646,7 +4652,7 @@ unlock_entry(H5F_t *file_ptr, int32_t idx, unsigned int flags) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: error in H5AC_unprotect().\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: error in H5AC_unprotect().\n", world_mpi_rank, __func__); } } else { @@ -4730,7 +4736,7 @@ unpin_entry(H5F_t *file_ptr, int32_t idx, hbool_t global, hbool_t dirty, hbool_t nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: error in H5AC_unpin_entry().\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: error in H5AC_unpin_entry().\n", world_mpi_rank, __func__); } } } @@ -4791,7 +4797,7 @@ server_smoke_check(void) /* some error occured in the server -- report failure */ nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, __func__); } } } @@ -4812,7 +4818,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on write.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on write.\n", world_mpi_rank, __func__); } } @@ -4827,7 +4833,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -4843,7 +4849,7 @@ server_smoke_check(void) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", world_mpi_rank, __func__); } } } @@ -4858,7 +4864,7 @@ server_smoke_check(void) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 1 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 1 failed.\n", world_mpi_rank, __func__); } } @@ -4890,7 +4896,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 2 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 2 failed.\n", world_mpi_rank, __func__); } } @@ -4913,7 +4919,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on write.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on write.\n", world_mpi_rank, __func__); } } } @@ -4927,7 +4933,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, __func__); } } } @@ -4943,7 +4949,7 @@ server_smoke_check(void) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: Bad data in read req reply.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: Bad data in read req reply.\n", world_mpi_rank, __func__); } } } @@ -4954,7 +4960,7 @@ server_smoke_check(void) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 3 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 3 failed.\n", world_mpi_rank, __func__); } } @@ -4985,7 +4991,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 4 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 4 failed.\n", world_mpi_rank, __func__); } } @@ -5001,7 +5007,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 5 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 5 failed.\n", world_mpi_rank, __func__); } } @@ -5032,7 +5038,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: barrier 6 failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: barrier 6 failed.\n", world_mpi_rank, __func__); } } @@ -5055,7 +5061,7 @@ server_smoke_check(void) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, __func__); } } } @@ -5138,7 +5144,7 @@ smoke_check_1(int metadata_write_strategy) /* some error occured in the server -- report failure */ nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, __func__); } } } @@ -5150,7 +5156,7 @@ smoke_check_1(int metadata_write_strategy) fid = -1; cache_ptr = NULL; if (verbose) { - HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, __func__); } } @@ -5183,7 +5189,7 @@ smoke_check_1(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, __func__); } } } @@ -5216,7 +5222,7 @@ smoke_check_1(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, __func__); } } } @@ -5302,7 +5308,7 @@ smoke_check_2(int metadata_write_strategy) /* some error occured in the server -- report failure */ nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, __func__); } } } @@ -5314,7 +5320,7 @@ smoke_check_2(int metadata_write_strategy) fid = -1; cache_ptr = NULL; if (verbose) { - HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, __func__); } } @@ -5381,7 +5387,7 @@ smoke_check_2(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, __func__); } } } @@ -5414,7 +5420,7 @@ smoke_check_2(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, __func__); } } } @@ -5507,7 +5513,7 @@ smoke_check_3(int metadata_write_strategy) /* some error occured in the server -- report failure */ nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, __func__); } } } @@ -5519,7 +5525,7 @@ smoke_check_3(int metadata_write_strategy) fid = -1; cache_ptr = NULL; if (verbose) { - HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, __func__); } } @@ -5573,7 +5579,7 @@ smoke_check_3(int metadata_write_strategy) if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, __func__); } } @@ -5666,7 +5672,7 @@ smoke_check_3(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, __func__); } } } @@ -5699,7 +5705,7 @@ smoke_check_3(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, __func__); } } } @@ -5792,7 +5798,7 @@ smoke_check_4(int metadata_write_strategy) /* some error occured in the server -- report failure */ nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, __func__); } } } @@ -5804,7 +5810,7 @@ smoke_check_4(int metadata_write_strategy) fid = -1; cache_ptr = NULL; if (verbose) { - HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, __func__); } } @@ -5870,7 +5876,7 @@ smoke_check_4(int metadata_write_strategy) if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, __func__); } } @@ -5950,7 +5956,7 @@ smoke_check_4(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, __func__); } } } @@ -5983,7 +5989,7 @@ smoke_check_4(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, __func__); } } } @@ -6067,7 +6073,7 @@ smoke_check_5(int metadata_write_strategy) /* some error occured in the server -- report failure */ nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, __func__); } } } @@ -6080,7 +6086,7 @@ smoke_check_5(int metadata_write_strategy) fid = -1; cache_ptr = NULL; if (verbose) { - HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, __func__); } } @@ -6092,7 +6098,7 @@ smoke_check_5(int metadata_write_strategy) if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, __func__); } } @@ -6142,7 +6148,7 @@ smoke_check_5(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, __func__); } } } @@ -6175,7 +6181,7 @@ smoke_check_5(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, __func__); } } } @@ -6352,7 +6358,7 @@ trace_file_check(int metadata_write_strategy) /* some error occured in the server -- report failure */ nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, __func__); } } else { @@ -6364,7 +6370,7 @@ trace_file_check(int metadata_write_strategy) fid = -1; cache_ptr = NULL; if (verbose) - HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, __func__); } if (nerrors == 0) { @@ -6374,7 +6380,7 @@ trace_file_check(int metadata_write_strategy) if (H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { nerrors++; HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", world_mpi_rank, - FUNC); + __func__); } else { config.open_trace_file = TRUE; @@ -6383,7 +6389,7 @@ trace_file_check(int metadata_write_strategy) if (H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { nerrors++; HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank, - FUNC); + __func__); } } } /* end if */ @@ -6418,7 +6424,7 @@ trace_file_check(int metadata_write_strategy) if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, __func__); } if (nerrors == 0) { @@ -6427,7 +6433,7 @@ trace_file_check(int metadata_write_strategy) if (H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { nerrors++; HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", world_mpi_rank, - FUNC); + __func__); } else { config.open_trace_file = FALSE; @@ -6437,7 +6443,7 @@ trace_file_check(int metadata_write_strategy) if (H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { nerrors++; HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank, - FUNC); + __func__); } } } /* end if */ @@ -6447,7 +6453,7 @@ trace_file_check(int metadata_write_strategy) nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, __func__); } } /* end if */ @@ -6477,7 +6483,7 @@ trace_file_check(int metadata_write_strategy) if (!success) { nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, __func__); } } /* end if */ @@ -6488,7 +6494,7 @@ trace_file_check(int metadata_write_strategy) nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: HDfopen failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: HDfopen failed.\n", world_mpi_rank, __func__); } } /* end if */ @@ -6517,17 +6523,17 @@ trace_file_check(int metadata_write_strategy) nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, - FUNC, i); + __func__, i); if (expected_line_len == 0) { - HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, __func__, "", expected_line_len); - HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, FUNC, buffer, - actual_line_len); + HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, __func__, + buffer, actual_line_len); } if (actual_line_len == 0) { - HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, __func__, (*expected_output)[i], expected_line_len); - HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, __func__, "", actual_line_len); } } @@ -6542,10 +6548,10 @@ trace_file_check(int metadata_write_strategy) nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, - FUNC, i); - HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, FUNC, + __func__, i); + HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, __func__, (*expected_output)[i], expected_line_len); - HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, FUNC, buffer, + HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, __func__, buffer, actual_line_len); } } @@ -6563,10 +6569,10 @@ trace_file_check(int metadata_write_strategy) nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, - FUNC, i); - HDfprintf(stdout, "%d:%s: expected = \"%s\"\n", world_mpi_rank, FUNC, + __func__, i); + HDfprintf(stdout, "%d:%s: expected = \"%s\"\n", world_mpi_rank, __func__, (*expected_output)[i]); - HDfprintf(stdout, "%d:%s: actual = \"%s\"\n", world_mpi_rank, FUNC, tok); + HDfprintf(stdout, "%d:%s: actual = \"%s\"\n", world_mpi_rank, __func__, tok); } } } /* end else */ @@ -6657,7 +6663,7 @@ smoke_check_6(int metadata_write_strategy) /* some error occured in the server -- report failure */ nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, __func__); } } } @@ -6671,7 +6677,7 @@ smoke_check_6(int metadata_write_strategy) fid = -1; cache_ptr = NULL; if (verbose) { - HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, __func__); } } @@ -6690,7 +6696,7 @@ smoke_check_6(int metadata_write_strategy) nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: Entry inserted not marked as collective.\n", world_mpi_rank, - FUNC); + __func__); } } @@ -6711,7 +6717,7 @@ smoke_check_6(int metadata_write_strategy) nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: Entry inserted indepedently marked as collective.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); } } @@ -6723,7 +6729,7 @@ smoke_check_6(int metadata_write_strategy) if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, __func__); } } @@ -6739,7 +6745,7 @@ smoke_check_6(int metadata_write_strategy) nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: Entry protected not marked as collective.\n", world_mpi_rank, - FUNC); + __func__); } } @@ -6759,7 +6765,7 @@ smoke_check_6(int metadata_write_strategy) nerrors++; if (verbose) { HDfprintf(stdout, "%d:%s: Entry inserted indepedently marked as collective.\n", - world_mpi_rank, FUNC); + world_mpi_rank, __func__); } } @@ -6777,7 +6783,7 @@ smoke_check_6(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, __func__); } } } @@ -6810,7 +6816,7 @@ smoke_check_6(int metadata_write_strategy) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, __func__); } } } @@ -6920,13 +6926,13 @@ main(int argc, char **argv) if (FAIL == (fapl = H5Pcreate(H5P_FILE_ACCESS))) { nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: H5Pcreate() failed 1.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Pcreate() failed 1.\n", world_mpi_rank, __func__); } if (H5Pset_fapl_mpio(fapl, world_mpi_comm, MPI_INFO_NULL) < 0) { nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 1.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 1.\n", world_mpi_rank, __func__); } /* fix the file names */ @@ -6934,7 +6940,7 @@ main(int argc, char **argv) if (h5_fixname(FILENAME[u], fapl, filenames[u], sizeof(filenames[u])) == NULL) { nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: h5_fixname() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: h5_fixname() failed.\n", world_mpi_rank, __func__); break; } } @@ -6943,7 +6949,7 @@ main(int argc, char **argv) if (H5Pclose(fapl) < 0) { nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: H5Pclose() failed.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Pclose() failed.\n", world_mpi_rank, __func__); } /* now create the fapl again, excluding the server process. */ @@ -6953,13 +6959,13 @@ main(int argc, char **argv) if (FAIL == (fapl = H5Pcreate(H5P_FILE_ACCESS))) { nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: H5Pcreate() failed 2.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Pcreate() failed 2.\n", world_mpi_rank, __func__); } if (H5Pset_fapl_mpio(fapl, file_mpi_comm, MPI_INFO_NULL) < 0) { nerrors++; if (verbose) - HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 2.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 2.\n", world_mpi_rank, __func__); } } @@ -7004,7 +7010,8 @@ main(int argc, char **argv) nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: H5Pset_all_coll_metadata_ops() failed 1.\n", world_mpi_rank, FUNC); + HDfprintf(stdout, "%d:%s: H5Pset_all_coll_metadata_ops() failed 1.\n", world_mpi_rank, + __func__); } } } diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 50cd306..694992a 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -6093,7 +6093,7 @@ main(int argc, char **argv) if (VERBOSE_MED) h5_show_hostname(); - ALARM_ON; + TestAlarmOn(); /* Create test file */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -6172,7 +6172,7 @@ exit: if (MAINPROCESS) HDprintf("*** %d TEST ERROR%s OCCURRED ***\n", nerrors, nerrors > 1 ? "S" : ""); - ALARM_OFF; + TestAlarmOff(); h5_clean_files(FILENAME, fapl); diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index a883f55..a8a756c 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -1086,7 +1086,7 @@ main(int argc, char **argv) H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); /* set alarm. */ - ALARM_ON; + TestAlarmOn(); /*======================================= * MPIO 1 write Many read test @@ -1195,7 +1195,7 @@ finish: } /* turn off alarm */ - ALARM_OFF; + TestAlarmOff(); h5_clean_files(FILENAME, fapl); H5close(); diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 7d88c37..54f6f51 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -100,7 +100,7 @@ H5_GCC_DIAG_OFF("format") */ #define JSFAILED_AT() \ { \ - HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); \ } /*---------------------------------------------------------------------------- diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c index 6537215..df29fc9 100644 --- a/tools/test/perform/direct_write_perf.c +++ b/tools/test/perform/direct_write_perf.c @@ -52,8 +52,7 @@ const char *FILENAME[] = {"direct_write", "unix.raw", NULL}; /* * Print the current location on the standard output stream. */ -#define FUNC __func__ -#define AT() printf(" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define AT() printf(" at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); #define H5_FAILED() \ { \ puts("*FAILED*"); \ diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index a06fb77..a19e5d5 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -136,12 +136,11 @@ main(int argc, char **argv) if (mynod == 0) printf("# Using hdf5-io calls.\n"); - /* kindof a weird hack- if the location of the pvfstab file was - * specified on the command line, then spit out this location into - * the appropriate environment variable: */ - -#if H5_HAVE_SETENV - /* no setenv or unsetenv */ +#ifdef H5_HAVE_UNISTD_H + /* Kind of a weird hack- if the location of the pvfstab file was + * specified on the command line, then spit out this location into + * the appropriate environment variable. + */ if (opt_pvfstab_set) { if ((setenv("PVFSTAB_FILE", opt_pvfstab, 1)) < 0) { perror("setenv"); @@ -372,9 +371,8 @@ main(int argc, char **argv) die_jar_jar_die: -#if H5_HAVE_SETENV - /* no setenv or unsetenv */ - /* clear the environment variable if it was set earlier */ +#ifdef H5_HAVE_UNISTD + /* Clear the environment variable if it was set earlier */ if (opt_pvfstab_set) { unsetenv("PVFSTAB_FILE"); } -- cgit v0.12 From 257c8c745446ee614f92624b30cec41d8d771e05 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 30 Jun 2021 08:18:01 -0700 Subject: Removes remaining H5_TIME_WITH_SYS_TIME cruft (#810) Mostly from CMake --- config/cmake/H5pubconf.h.in | 3 --- config/cmake_ext_mod/ConfigureChecks.cmake | 1 - tools/lib/io_timer.h | 9 +++------ tools/test/perform/direct_write_perf.c | 21 ++++++++++----------- tools/test/perform/perf.c | 21 ++++++++++----------- 5 files changed, 23 insertions(+), 32 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 051272b..35ff8cf 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -634,9 +634,6 @@ PTHREAD_SCOPE_SYSTEM) call. */ #cmakedefine H5_SYSTEM_SCOPE_THREADS @H5_SYSTEM_SCOPE_THREADS@ -/* Define to 1 if you can safely include both and . */ -#cmakedefine H5_TIME_WITH_SYS_TIME @H5_TIME_WITH_SYS_TIME@ - /* Define using v1.10 public API symbols by default */ #cmakedefine H5_USE_110_API_DEFAULT @H5_USE_110_API_DEFAULT@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index ccf7c85..fca38a4 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -412,7 +412,6 @@ if (MINGW OR NOT WINDOWS) #----------------------------------------------------------------------------- CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE_TM_GMTOFF) CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE___TM_GMTOFF) - CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_TIME_WITH_SYS_TIME) if (${HDF_PREFIX}_HAVE_SYS_TIME_H) CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE) else () diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 0269b93..75db660 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -16,18 +16,15 @@ #include "hdf5.h" -#if defined(H5_TIME_WITH_SYS_TIME) -#include #include -#elif defined(H5_HAVE_SYS_TIME_H) + +#ifdef H5_HAVE_SYS_TIME_H #include -#else -#include #endif #ifdef H5_HAVE_WINSOCK2_H #include -#endif /* H5_HAVE_WINSOCK2_H */ +#endif /* The different types of timers we can have */ typedef enum timer_type_ { diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c index df29fc9..371c4f9 100644 --- a/tools/test/perform/direct_write_perf.c +++ b/tools/test/perform/direct_write_perf.c @@ -28,23 +28,22 @@ #include #include #include - -#ifdef H5_HAVE_UNISTD_H -#include -#include -#endif +#include #ifdef H5_HAVE_SYS_STAT_H #include #endif -#if defined(H5_TIME_WITH_SYS_TIME) -#include -#include -#elif defined(H5_HAVE_SYS_TIME_H) +#ifdef H5_HAVE_SYS_TIME_H #include -#else -#include +#endif + +#ifdef H5_HAVE_SYS_TYPES_H +#include +#endif + +#ifdef H5_HAVE_UNISTD_H +#include #endif const char *FILENAME[] = {"direct_write", "unix.raw", NULL}; diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index a19e5d5..875f932 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -31,23 +31,22 @@ #include #include #include - -#ifdef H5_HAVE_UNISTD_H -#include -#include -#endif +#include #ifdef H5_HAVE_SYS_STAT_H #include #endif -#if defined(H5_TIME_WITH_SYS_TIME) -#include -#include -#elif defined(H5_HAVE_SYS_TIME_H) +#ifdef H5_HAVE_SYS_TIME_H #include -#else -#include +#endif + +#ifdef H5_HAVE_SYS_TYPES_H +#include +#endif + +#ifdef H5_HAVE_UNISTD_H +#include #endif #include -- cgit v0.12 From 8e2fc4a2e2325a006d42b1df5c339549cdd2cb94 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 6 Jul 2021 10:39:15 -0700 Subject: Remove checks for winsock2.h (#813) This is only needed on Windows and always available, so there's no need to check for it. --- config/cmake/H5pubconf.h.in | 3 --- config/cmake_ext_mod/ConfigureChecks.cmake | 6 ------ configure.ac | 2 -- src/H5private.h | 13 ++++++------- src/H5system.c | 6 +++--- tools/lib/io_timer.h | 2 +- 6 files changed, 10 insertions(+), 22 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 35ff8cf..5a94be3 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -388,9 +388,6 @@ /* Define if your system has window style path name. */ #cmakedefine H5_HAVE_WINDOW_PATH @H5_HAVE_WINDOW_PATH@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_WINSOCK2_H @H5_HAVE_WINSOCK2_H@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_ZLIB_H @H5_HAVE_ZLIB_H@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index fca38a4..27c7045 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -53,7 +53,6 @@ if (MINGW) set (${HDF_PREFIX}_HAVE_MINGW 1) set (WINDOWS 1) # MinGW tries to imitate Windows set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") - set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) set (__USE_MINGW_ANSI_STDIO 1) endif () @@ -117,11 +116,6 @@ CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) -# Windows -if (NOT CYGWIN) - CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) -endif () - CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) diff --git a/configure.ac b/configure.ac index 3dd7328..55ea12c 100644 --- a/configure.ac +++ b/configure.ac @@ -1240,8 +1240,6 @@ case $host_os in esac ## Windows -## The winsock header is needed for gethostname -AC_CHECK_HEADERS([winsock2.h]) case "`uname`" in MINGW*) AC_HAVE_LIBRARY([ws2_32]) diff --git a/src/H5private.h b/src/H5private.h index a5c6efd..f29ec02 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -106,22 +106,21 @@ #define H5_DEFAULT_VOL H5VL_NATIVE #ifdef H5_HAVE_WIN32_API + /* The following two defines must be before any windows headers are included */ #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ #define NOGDI /* Exclude Graphic Display Interface macros */ -#ifdef H5_HAVE_WINSOCK2_H -#include -#endif +#include + +#include /* For _getcwd() */ +#include /* POSIX I/O */ +#include /* For GetUserName() */ #ifdef H5_HAVE_THREADSAFE #include /* For _beginthread() */ #endif -#include -#include /* For _getcwd() */ -#include /* POSIX I/O */ - #endif /*H5_HAVE_WIN32_API*/ #ifndef F_OK diff --git a/src/H5system.c b/src/H5system.c index 0849373..eba8341 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -365,7 +365,7 @@ Wsetenv(const char *name, const char *value, int overwrite) return (int)_putenv_s(name, value); } /* end Wsetenv() */ -#ifdef H5_HAVE_WINSOCK2_H +#ifdef H5_HAVE_WIN32_API #pragma comment(lib, "advapi32.lib") #endif @@ -450,12 +450,12 @@ char * Wgetlogin(void) { -#ifdef H5_HAVE_WINSOCK2_H +#ifdef H5_HAVE_WIN32_API DWORD bufferCount = WloginBuffer_count; if (GetUserName(Wlogin_buffer, &bufferCount) != 0) return (Wlogin_buffer); else -#endif /* H5_HAVE_WINSOCK2_H */ +#endif return NULL; } diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 75db660..0b0f0bb 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -22,7 +22,7 @@ #include #endif -#ifdef H5_HAVE_WINSOCK2_H +#ifdef H5_HAVE_WIN32_API #include #endif -- cgit v0.12 From 86e8238ad32e70b56cdc61c56551ca71bd7d46b9 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 9 Jul 2021 14:27:10 -0700 Subject: Removes develop header cruft (#828) --- c++/src/H5DataType.h | 3 --- fortran/src/H5Tf.c | 3 --- test/h5test.c | 2 +- test/h5test.h | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 7442edc..109dcbb 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -15,9 +15,6 @@ #ifndef H5DataType_H #define H5DataType_H -/* Include package's developer header */ -#include "H5Tdevelop.h" - namespace H5 { /*! \class DataType diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index 3da4a29..1516cc7 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -21,9 +21,6 @@ #include "H5f90.h" -/* Include package's developer header */ -#include "H5Tdevelop.h" - /****if* H5Tf/h5topen_c * NAME * h5topen_c diff --git a/test/h5test.c b/test/h5test.c index 4dff00d..755ae93 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1195,7 +1195,7 @@ h5_set_info_object(void) valp++; /* copy key/value pair into temporary buffer */ - len = strcspn(valp, ";"); + len = HDstrcspn(valp, ";"); next = &valp[len]; if (NULL == (key_val = (char *)HDcalloc(1, len + 1))) return -1; diff --git a/test/h5test.h b/test/h5test.h index db1a887..2855fb5 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -22,7 +22,7 @@ /* * Include required headers. This file tests internal library functions, - * so we include the private headers here, along with developer routines. + * so we include the private headers here. */ #include "hdf5.h" #include "H5private.h" -- cgit v0.12 From 6b94bf50a06a9e20c6893514bfa141b69dbca0d1 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Mon, 12 Jul 2021 09:00:48 -0500 Subject: OESS-168:Remove implicit conversion warnings. (#829) * OESS-168:Remove implicit conversion increases floating-point precision warnings. * OESS-168:Remove clang warnings. --- hl/test/test_table.c | 40 +- test/cache.c | 1118 +++++++++++++++++++++++++------------------------- 2 files changed, 579 insertions(+), 579 deletions(-) diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 0d4a72a..531f778 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -199,7 +199,7 @@ test_table(hid_t fid, int do_write) hsize_t chunk_size = 10; int compress = 0; int * fill = NULL; - particle_t fill1[1] = {{"no data", -1, -99.0f, -99.0f, -1}}; + particle_t fill1[1] = {{"no data", -1, -99.0, -99.0, -1}}; int fill1_new[1] = {-100}; hsize_t position; char tname[20]; @@ -227,23 +227,23 @@ test_table(hid_t fid, int do_write) particle2_t rbuf2[NRECORDS]; particle3_t rbuf3[NRECORDS]; particle_t rbufc[NRECORDS * 2]; - particle_t abuf[2] = {{"eight", 80, 8.0f, 80.0f, 80}, {"nine", 90, 9.0f, 90.0f, 90}}; - particle_t ibuf[2] = {{"zero", 0, 0.0f, 0.0f, 0}, {"zero", 0, 0.0f, 0.0f, 0}}; + particle_t abuf[2] = {{"eight", 80, 8.0, 80.0, 80}, {"nine", 90, 9.0, 90.0, 90}}; + particle_t ibuf[2] = {{"zero", 0, 0.0, 0.0, 0}, {"zero", 0, 0.0, 0.0, 0}}; particle_t wbufd[NRECORDS]; particle_t wbuf[NRECORDS] = {{ "zero", 0, - 0.0f, - 0.0f, + 0.0, + 0.0, 0, }, - {"one", 10, 1.0f, 10.0f, 10}, - {"two", 20, 2.0f, 20.0f, 20}, - {"three", 30, 3.0f, 30.0f, 30}, - {"four", 40, 4.0f, 40.0f, 40}, - {"five", 50, 5.0f, 50.0f, 50}, - {"six", 60, 6.0f, 60.0f, 60}, - {"seven", 70, 7.0f, 70.0f, 70}}; + {"one", 10, 1.0, 10.0, 10}, + {"two", 20, 2.0, 20.0, 20}, + {"three", 30, 3.0, 30.0, 30}, + {"four", 40, 4.0, 40.0, 40}, + {"five", 50, 5.0, 50.0, 50}, + {"six", 60, 6.0, 60.0, 60}, + {"seven", 70, 7.0, 70.0, 70}}; /* buffers for the field "Pressure" and "New_field" */ float pressure_in[NRECORDS] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f}; float pressure_out[NRECORDS]; @@ -332,14 +332,14 @@ test_table(hid_t fid, int do_write) HOFFSET(particle4_t, aty), HOFFSET(particle4_t, rro)}; /* Define an array of Particles */ - particle4_t p_data[NRECORDS] = {{12112, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}, - {12113, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}, - {12114, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}, - {12115, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}, - {12116, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}, - {12117, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}, - {12118, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}, - {12119, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}}; + particle4_t p_data[NRECORDS] = {{12112, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}, + {12113, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}, + {12114, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}, + {12115, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}, + {12116, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}, + {12117, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}, + {12118, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}, + {12119, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}}; /*------------------------------------------------------------------------- * initialize table parameters diff --git a/test/cache.c b/test/cache.c index 6ded559..6989564 100644 --- a/test/cache.c +++ b/test/cache.c @@ -1046,7 +1046,7 @@ smoke_check_5(int express_test, unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (2 * 1024 * 1024), - /* double min_clean_fraction = */ 0.1f, + /* double min_clean_fraction = */ 0.1, /* size_t max_size = */ (32 * 1024 * 1025), /* size_t min_size = */ (512 * 1024), @@ -1055,23 +1055,23 @@ smoke_check_5(int express_test, unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.9f, + /* double decrement = */ 0.9, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -1079,7 +1079,7 @@ smoke_check_5(int express_test, unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.5f + /* double empty_reserve = */ 0.5 }; if (paged) @@ -1278,7 +1278,7 @@ smoke_check_6(int express_test, unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (2 * 1024 * 1024), - /* double min_clean_fraction = */ 0.1f, + /* double min_clean_fraction = */ 0.1, /* size_t max_size = */ (32 * 1024 * 1025), /* size_t min_size = */ (512 * 1024), @@ -1287,23 +1287,23 @@ smoke_check_6(int express_test, unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.9f, + /* double decrement = */ 0.9, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -1311,7 +1311,7 @@ smoke_check_6(int express_test, unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f + /* double empty_reserve = */ 0.05 }; if (paged) @@ -1510,7 +1510,7 @@ smoke_check_7(int express_test, unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (2 * 1024 * 1024), - /* double min_clean_fraction = */ 0.1f, + /* double min_clean_fraction = */ 0.1, /* size_t max_size = */ (32 * 1024 * 1025), /* size_t min_size = */ (512 * 1024), @@ -1519,24 +1519,24 @@ smoke_check_7(int express_test, unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (8 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.9f, + /* double decrement = */ 0.9, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -1544,7 +1544,7 @@ smoke_check_7(int express_test, unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1f + /* double empty_reserve = */ 0.1 }; if (paged) @@ -1743,7 +1743,7 @@ smoke_check_8(int express_test, unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (2 * 1024 * 1024), - /* double min_clean_fraction = */ 0.1f, + /* double min_clean_fraction = */ 0.1, /* size_t max_size = */ (32 * 1024 * 1025), /* size_t min_size = */ (512 * 1024), @@ -1752,24 +1752,24 @@ smoke_check_8(int express_test, unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.9f, + /* double decrement = */ 0.9, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -1777,7 +1777,7 @@ smoke_check_8(int express_test, unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1f + /* double empty_reserve = */ 0.1 }; if (paged) @@ -17004,7 +17004,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (512 * 1024), - /* double min_clean_fraction = */ 0.5f, + /* double min_clean_fraction = */ 0.5, /* size_t max_size = */ (14 * 1024 * 1024), /* size_t min_size = */ (512 * 1024), @@ -17013,23 +17013,23 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.1f, + /* double decrement = */ 0.1, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -17037,7 +17037,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f}; + /* double empty_reserve = */ 0.05}; if (paged) TESTING("automatic cache resizing (paged aggregation)") @@ -17361,7 +17361,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1000 * 1000 + 10; - auto_size_ctl.min_clean_fraction = 0.1f; + auto_size_ctl.min_clean_fraction = 0.1; auto_size_ctl.max_size = 8 * 1000 * 1000; auto_size_ctl.min_size = 500 * 1000; @@ -17370,22 +17370,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1000 * 1000); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1000 * 1000); @@ -17393,7 +17393,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if (result != SUCCEED) { @@ -17676,7 +17676,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -17685,22 +17685,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 4.0f; + auto_size_ctl.increment = 4.0; auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.25f; + auto_size_ctl.decrement = 0.25; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -17708,7 +17708,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if (result != SUCCEED) { @@ -17852,7 +17852,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -17861,22 +17861,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -17884,7 +17884,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if (result != SUCCEED) { @@ -18220,7 +18220,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -18229,22 +18229,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -18252,7 +18252,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -18702,7 +18702,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -18711,22 +18711,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -18734,7 +18734,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */ + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -19079,7 +19079,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -19088,16 +19088,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -19106,7 +19106,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) */ auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -19114,7 +19114,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if (result != SUCCEED) { @@ -19326,7 +19326,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1000 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1000 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -19335,22 +19335,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */ + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1000 * 1024); @@ -19358,7 +19358,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */ + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if (result != SUCCEED) { @@ -19868,7 +19868,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 64 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 1024 * 1024; auto_size_ctl.min_size = 5 * 1024; @@ -19877,22 +19877,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (32 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; - auto_size_ctl.flash_multiple = 1.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 1.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */ + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1000 * 1024); @@ -19900,7 +19900,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */ + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if (result != SUCCEED) { @@ -20602,7 +20602,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 20 * 1024; auto_size_ctl.min_size = 4 * 1024; @@ -20611,22 +20611,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.4f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.4; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */ + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (2 * 1024); @@ -20634,7 +20634,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */ + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if (result != SUCCEED) { @@ -20859,7 +20859,7 @@ check_auto_cache_resize_disable(unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (512 * 1024), - /* double min_clean_fraction = */ 0.5f, + /* double min_clean_fraction = */ 0.5, /* size_t max_size = */ (14 * 1024 * 1024), /* size_t min_size = */ (512 * 1024), @@ -20868,23 +20868,23 @@ check_auto_cache_resize_disable(unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* 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__threshold, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.1f, + /* double decrement = */ 0.1, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -20892,7 +20892,7 @@ check_auto_cache_resize_disable(unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f}; + /* double empty_reserve = */ 0.05}; if (paged) TESTING("automatic cache resize disable (paged aggregation)") @@ -20964,7 +20964,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -20973,22 +20973,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 1.0f; /* disable size increases */ + auto_size_ctl.increment = 1.0; /* disable size increases */ auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -20996,7 +20996,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -21116,7 +21116,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -21125,21 +21125,21 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increases */ + auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increases */ - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -21147,7 +21147,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -21267,7 +21267,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -21276,22 +21276,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -21299,7 +21299,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -21418,7 +21418,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -21427,22 +21427,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 1.0f; /* disable size decreases */ + auto_size_ctl.decrement = 1.0; /* disable size decreases */ auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -21450,7 +21450,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -21572,7 +21572,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -21581,22 +21581,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decreases */ + auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decreases */ - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -21604,7 +21604,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -21722,7 +21722,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -21731,22 +21731,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__off; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -21754,7 +21754,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -21874,7 +21874,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -21883,22 +21883,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = 0; /* disable decrement */ @@ -21906,7 +21906,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 1; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -22091,7 +22091,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -22100,22 +22100,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -22123,7 +22123,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 1; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 1.0f; /* disable decrement */ + auto_size_ctl.empty_reserve = 1.0; /* disable decrement */ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -22315,7 +22315,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -22324,22 +22324,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 1.0f; + auto_size_ctl.upper_hr_threshold = 1.0; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -22347,7 +22347,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 1; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -22541,7 +22541,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 2 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -22550,22 +22550,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increases */ + auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increases */ - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decreases */ + auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decreases */ - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -22573,7 +22573,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -22661,7 +22661,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.25f; + auto_size_ctl.min_clean_fraction = 0.25; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -22670,22 +22670,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 1.0f; /* disable size increment */ + auto_size_ctl.increment = 1.0; /* disable size increment */ auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 1.0f; /* disable size decrement */ + auto_size_ctl.decrement = 1.0; /* disable size decrement */ auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -22693,7 +22693,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -22781,7 +22781,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = FALSE; auto_size_ctl.initial_size = 2 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 6 * 1024 * 1024; /* no resize */ auto_size_ctl.min_size = 6 * 1024 * 1024; /* no resize */ @@ -22790,22 +22790,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -22813,7 +22813,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -22901,7 +22901,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.25f; + auto_size_ctl.min_clean_fraction = 0.25; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -22910,22 +22910,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 1.0f; /* disable size increment */ + auto_size_ctl.increment = 1.0; /* disable size increment */ auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decrement */ + auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decrement */ - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -22933,7 +22933,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -23021,7 +23021,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -23030,22 +23030,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increment */ + auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increment */ - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 1.0f; /* disable size decrement */ + auto_size_ctl.decrement = 1.0; /* disable size decrement */ auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -23053,7 +23053,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -23141,7 +23141,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -23150,22 +23150,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__off; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -23173,7 +23173,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -23288,7 +23288,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 64 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 256 * 1024; auto_size_ctl.min_size = 32 * 1024; @@ -23297,22 +23297,22 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 1.0f; - auto_size_ctl.flash_threshold = 0.25f; + auto_size_ctl.flash_multiple = 1.0; + auto_size_ctl.flash_threshold = 0.25; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024); @@ -23320,7 +23320,7 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -23458,7 +23458,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (512 * 1024), - /* double min_clean_fraction = */ 0.5f, + /* double min_clean_fraction = */ 0.5, /* size_t max_size = */ (14 * 1024 * 1024), /* size_t min_size = */ (512 * 1024), @@ -23467,23 +23467,23 @@ check_auto_cache_resize_epoch_markers(unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.1f, + /* double decrement = */ 0.1, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -23491,7 +23491,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f}; + /* double empty_reserve = */ 0.05}; if (paged) TESTING("automatic cache resize epoch marker management (paged aggr)") @@ -23545,7 +23545,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -23554,22 +23554,22 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -23577,7 +23577,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.epochs_before_eviction = 10; auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -23709,7 +23709,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -23718,22 +23718,22 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -23741,7 +23741,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.epochs_before_eviction = 1; auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -23827,7 +23827,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -23836,22 +23836,22 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -23859,7 +23859,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.epochs_before_eviction = 1; auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -23905,7 +23905,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -23914,22 +23914,22 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -23937,7 +23937,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.epochs_before_eviction = 10; auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -24014,7 +24014,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 8 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.5f; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 8 * 1024 * 1024; auto_size_ctl.min_size = 512 * 1024; @@ -24023,22 +24023,22 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75f; + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0f; + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C_decr__off; - auto_size_ctl.upper_hr_threshold = 0.995f; + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5f; + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24046,7 +24046,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.epochs_before_eviction = 10; auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05f; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -24146,7 +24146,7 @@ check_auto_cache_resize_input_errs(unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (512 * 1024), - /* double min_clean_fraction = */ 0.5f, + /* double min_clean_fraction = */ 0.5, /* size_t max_size = */ (16 * 1024 * 1024), /* size_t min_size = */ (512 * 1024), @@ -24155,23 +24155,23 @@ check_auto_cache_resize_input_errs(unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.1f, + /* double decrement = */ 0.1, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -24179,7 +24179,7 @@ check_auto_cache_resize_input_errs(unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f}; + /* double empty_reserve = */ 0.05}; H5C_auto_size_ctl_t invalid_auto_size_ctl; H5C_auto_size_ctl_t test_auto_size_ctl; @@ -24249,7 +24249,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -24258,22 +24258,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.7f; + invalid_auto_size_ctl.lower_hr_threshold = 0.7; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24281,7 +24281,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(NULL, &invalid_auto_size_ctl); @@ -24318,7 +24318,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -24327,22 +24327,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.7f; + invalid_auto_size_ctl.lower_hr_threshold = 0.7; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24350,7 +24350,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24388,7 +24388,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.initial_size = 16 * 1024 * 1024 + 1; /* INVALID */ - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -24397,22 +24397,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24420,7 +24420,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24456,7 +24456,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.initial_size = 1 * 1024 * 1024 - 1; /* INVALID */ - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -24465,22 +24465,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24488,7 +24488,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24525,7 +24525,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 1.00001f; /* INVALID */ + invalid_auto_size_ctl.min_clean_fraction = 1.00001; /* INVALID */ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -24534,22 +24534,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24557,7 +24557,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24592,7 +24592,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = -0.00001f; /* INVALID */ + invalid_auto_size_ctl.min_clean_fraction = -0.00001; /* INVALID */ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -24601,22 +24601,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24624,7 +24624,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24661,7 +24661,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = H5C__MAX_MAX_CACHE_SIZE + 1; /* INVALID */ @@ -24671,22 +24671,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24694,7 +24694,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24729,7 +24729,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 1 * 1024 * 1024; /* INVALID */ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024 + 1; /*PAIR */ @@ -24738,22 +24738,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24761,7 +24761,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24796,7 +24796,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = H5C__MIN_MAX_CACHE_SIZE - 1; @@ -24805,22 +24805,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24828,7 +24828,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24865,7 +24865,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -24875,22 +24875,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24898,7 +24898,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -24933,7 +24933,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -24943,22 +24943,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24966,7 +24966,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25003,7 +25003,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25012,22 +25012,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = (enum H5C_cache_incr_mode) - 1; /* INVALID */ - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25035,7 +25035,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25070,7 +25070,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25079,22 +25079,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = (enum H5C_cache_incr_mode)2; /* INVALID */ - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25102,7 +25102,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25139,7 +25139,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25148,22 +25148,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.7f; + invalid_auto_size_ctl.lower_hr_threshold = 0.7; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 1.01f; /* INVALID */ + invalid_auto_size_ctl.upper_hr_threshold = 1.01; /* INVALID */ - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25171,7 +25171,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25206,7 +25206,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25215,22 +25215,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.8f; /* INVALID */ + invalid_auto_size_ctl.lower_hr_threshold = 0.8; /* INVALID */ - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.7f; /* INVALID */ + invalid_auto_size_ctl.upper_hr_threshold = 0.7; /* INVALID */ - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25238,7 +25238,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25273,7 +25273,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5f; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25282,22 +25282,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = -0.0001f; /* INVALID */ + invalid_auto_size_ctl.lower_hr_threshold = -0.0001; /* INVALID */ - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25305,7 +25305,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25342,7 +25342,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25351,22 +25351,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 0.99999f; /* INVALID */ + invalid_auto_size_ctl.increment = 0.99999; /* INVALID */ invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5f; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25374,7 +25374,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25411,7 +25411,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25420,22 +25420,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = (enum H5C_cache_flash_incr_mode) - 1; /* INVALID */ - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25443,7 +25443,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25480,7 +25480,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25489,22 +25489,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; - invalid_auto_size_ctl.flash_multiple = 0.09f; /* INVALID */ - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 0.09; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25512,7 +25512,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25547,7 +25547,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25556,22 +25556,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; - invalid_auto_size_ctl.flash_multiple = 10.01f; /* INVALID */ - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 10.01; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25579,7 +25579,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25616,7 +25616,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25625,22 +25625,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; - invalid_auto_size_ctl.flash_multiple = 1.0f; - invalid_auto_size_ctl.flash_threshold = 0.09f; /* INVALID */ + invalid_auto_size_ctl.flash_multiple = 1.0; + invalid_auto_size_ctl.flash_threshold = 0.09; /* INVALID */ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25648,7 +25648,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25683,7 +25683,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25692,22 +25692,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; - invalid_auto_size_ctl.flash_multiple = 1.0f; - invalid_auto_size_ctl.flash_threshold = 1.001f; /* INVALID */ + invalid_auto_size_ctl.flash_multiple = 1.0; + invalid_auto_size_ctl.flash_threshold = 1.001; /* INVALID */ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25715,7 +25715,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25752,7 +25752,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25761,22 +25761,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = (enum H5C_cache_decr_mode) - 1; /* INVALID */ - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25784,7 +25784,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25819,7 +25819,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25828,22 +25828,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = (enum H5C_cache_decr_mode)4; /* INVALID */ - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25851,7 +25851,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25888,7 +25888,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25897,22 +25897,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 1.000001f; /* INVALID */ + invalid_auto_size_ctl.decrement = 1.000001; /* INVALID */ invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25920,7 +25920,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -25955,7 +25955,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -25964,22 +25964,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = -0.000001f; /* INVALID */ + invalid_auto_size_ctl.decrement = -0.000001; /* INVALID */ invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25987,7 +25987,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -26024,7 +26024,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -26033,22 +26033,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -26056,7 +26056,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 0; /* INVALID */ invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -26091,7 +26091,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -26100,22 +26100,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -26123,7 +26123,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */ invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -26160,7 +26160,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -26169,22 +26169,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -26192,7 +26192,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = -0.0000001f; /* INVALID */ + invalid_auto_size_ctl.empty_reserve = -0.0000001; /* INVALID */ result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -26227,7 +26227,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1f; + invalid_auto_size_ctl.min_clean_fraction = 0.1; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -26236,22 +26236,22 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75f; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0f; + invalid_auto_size_ctl.increment = 2.0; invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999f; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9f; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -26259,7 +26259,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.epochs_before_eviction = H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */ invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05f; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -26387,7 +26387,7 @@ check_auto_cache_resize_aux_fcns(unsigned paged) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.5f, + /* double min_clean_fraction = */ 0.5, /* size_t max_size = */ (16 * 1024 * 1025), /* size_t min_size = */ (512 * 1024), @@ -26396,23 +26396,23 @@ check_auto_cache_resize_aux_fcns(unsigned paged) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.9f, + /* double decrement = */ 0.9, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -26420,7 +26420,7 @@ check_auto_cache_resize_aux_fcns(unsigned paged) /* int32_t epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.5f + /* double empty_reserve = */ 0.5 }; if (paged) @@ -34313,7 +34313,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr) /* hbool_t set_initial_size = */ TRUE, /* size_t initial_size = */ (2 * 1024 * 1024), - /* double min_clean_fraction = */ 0.5f, + /* double min_clean_fraction = */ 0.5, /* size_t max_size = */ (8 * 1024 * 1024), /* size_t min_size = */ (1 * 1024 * 1024), @@ -34322,23 +34322,23 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr) /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.75f, + /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0f, + /* 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__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, - /* double upper_hr_threshold = */ 0.995f, + /* double upper_hr_threshold = */ 0.995, - /* double decrement = */ 0.5f, + /* double decrement = */ 0.5, /* hbool_t apply_max_decrement = */ FALSE, /* size_t max_decrement = */ (1 * 1024 * 1024), @@ -34346,7 +34346,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr) /* int32_t epochs_before_eviction = */ 1, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f}; + /* double empty_reserve = */ 0.05}; if (pass) { -- cgit v0.12 From 31027a997c3cc5de9140930560d5155bef26289b Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Wed, 14 Jul 2021 10:38:21 -0500 Subject: Add support for parallel filters to h5repack (#832) --- tools/src/h5repack/h5repack_copy.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 536de69..934b4d1 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -626,6 +626,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */ hid_t ocpl_id = H5I_INVALID_HID; /* property to pass copy options */ hid_t lcpl_id = H5I_INVALID_HID; /* link creation property list */ + hid_t dxpl_id = H5I_INVALID_HID; /* dataset transfer property list */ named_dt_t * named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ size_t msize; /* size of type */ hsize_t nelmts; /* number of elements in dataset */ @@ -995,12 +996,27 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (need < H5TOOLS_MALLOCSIZE) buf = HDmalloc(need); + /* Set up collective write if using filters in parallel */ + { +#ifdef H5_HAVE_PARALLEL + hbool_t parallel = (H5FD_MPIO == H5Pget_driver(options->fout_fapl)); + + if (parallel && apply_s && apply_f) { + if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed"); + if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Pset_dxpl_mpio failed"); + } + else +#endif + dxpl_id = H5P_DEFAULT; + } + if (buf != NULL) { if (H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); - if (H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < - 0) + if (H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); /* Check if we have VL data in the dataset's @@ -1102,8 +1118,8 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); - if (H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, - H5P_DEFAULT, hslab_buf) < 0) + if (H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, dxpl_id, + hslab_buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); /* reclaim any VL memory, if necessary */ @@ -1382,6 +1398,7 @@ done: H5Pclose(dcpl_in); H5Pclose(gcpl_in); H5Pclose(gcpl_out); + H5Pclose(dxpl_id); H5Sclose(f_space_id); H5Dclose(dset_in); H5Dclose(dset_out); -- cgit v0.12 From 21c6bb38e6cf0776dbdc37841280dffd6ca79990 Mon Sep 17 00:00:00 2001 From: Jan-Willem Blokland Date: Wed, 14 Jul 2021 17:42:14 +0200 Subject: CMake: (feature) libaec (#703) * CMake: (feature) libaec Implemented better support for the compression library libaec. Especially, for the new version 1.0.5: - The CMake config files of this version 1.0.5 now set certain SZIP variables which can be used in the existing CMake structure. - Both static and shared SZIP compatible libaec library contains all required objects such it can be easily used when building HDF5 from scratch. - Introduced the USE_LIBAEC_STATIC option to make use of the static version of SZIP compatible libaec library. * CMake: (fix) libaec Implemented the fallback option for the case if version 1.0.5 of libaec could not be found. * Docs: Added description about libaec implementation. Added short description about the libaec improvement to the Bug Fixes section in the Configuration sub-section. --- CMakeFilters.cmake | 18 +++++++++++++++--- release_docs/RELEASE.txt | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index d5f801e..51ac61c 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -10,6 +10,7 @@ # help@hdfgroup.org. # option (USE_LIBAEC "Use AEC library as SZip Filter" OFF) +option (USE_LIBAEC_STATIC "Use static AEC library " OFF) include (ExternalProject) include (FetchContent) @@ -110,13 +111,24 @@ option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) if (HDF5_ENABLE_SZIP_SUPPORT) option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) if (NOT SZIP_USE_EXTERNAL) - find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) - if (NOT SZIP_FOUND) - find_package (SZIP) # Legacy find + set(SZIP_FOUND FALSE) + if (USE_LIBAEC) + set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC}) + find_package (libaec 1.0.5 CONFIG) if (SZIP_FOUND) set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) endif () endif () + + if (NOT SZIP_FOUND) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) + find_package (SZIP) # Legacy find + if (SZIP_FOUND) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) + endif () + endif () + endif () endif () if (SZIP_FOUND) set (H5_HAVE_FILTER_SZIP 1) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 1e69f54..bd186d8 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1060,6 +1060,21 @@ Bug Fixes since HDF5-1.12.0 release Configuration ------------- + - Better support for libaec (open-source Szip library) in CMake + + Implemented better support for libaec 1.0.5 (or later) library. This version + of libaec contains improvements for better integration with HDF5. Furthermore, + the variable USE_LIBAEC_STATIC has been introduced to allow to make use of + static version of libaec library. Use libaec_DIR or libaec_ROOT to set + the location in which libaec can be found. + + Be aware, the Szip library of libaec 1.0.4 depends on another library within + libaec library. This dependency is not specified in the current CMake + configuration which means that one can not use the static Szip library of + libaec 1.0.4 when building HDF5. This has been resolved in libaec 1.0.5. + + (JWSB - 2021/06/22) + - Refactor CMake configure for Fortran The Fortran configure tests for KINDs reused a single output file that was -- cgit v0.12 From 9ec773bb18b8e7ddce5e347577329fcc8f7a73a9 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 14 Jul 2021 11:12:01 -0500 Subject: Changes to docs for using plugins (#814) * Changes to docs for using plugins * VS2019 corrections * Fix typo --- bin/release | 11 ++++++++--- config/cmake/HDF5_Examples.cmake.in | 2 +- config/cmake/HDF5_Examples_options.cmake | 3 +++ config/cmake/scripts/HDF5config.cmake | 6 +++--- config/cmake/scripts/HDF5options.cmake | 2 +- release_docs/README_HDF5_CMake | 17 +++++++++-------- release_docs/USING_CMake_Examples.txt | 1 + release_docs/USING_HDF5_CMake.txt | 32 +++++++++++++++++++++++++------- 8 files changed, 51 insertions(+), 23 deletions(-) diff --git a/bin/release b/bin/release index 2570b38..16e6bd2 100755 --- a/bin/release +++ b/bin/release @@ -229,11 +229,14 @@ tar2cmakezip() (cd $cmziptmpsubdir; echo "ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201564 -C Release -V -O hdf5.log" > build-VS2015-64.bat; chmod 755 build-VS2015-64.bat) (cd $cmziptmpsubdir; echo "ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2017 -C Release -V -O hdf5.log" > build-VS2017-32.bat; chmod 755 build-VS2017-32.bat) (cd $cmziptmpsubdir; echo "ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -V -O hdf5.log" > build-VS2017-64.bat; chmod 755 build-VS2017-64.bat) + (cd $cmziptmpsubdir; echo "ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2019 -C Release -V -O hdf5.log" > build-VS2019-32.bat; chmod 755 build-VS2019-32.bat) + (cd $cmziptmpsubdir; echo "ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201964 -C Release -V -O hdf5.log" > build-VS2019-64.bat; chmod 755 build-VS2019-64.bat) # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.1-Source.zip $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.2-Source.zip $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.zip $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmziptmpsubdir @@ -328,7 +331,8 @@ tar2cmaketgz() # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.1-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.2-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmgztmpsubdir @@ -411,7 +415,8 @@ tar2hpccmaketgz() # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.1-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.2-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 3eea743..5911005 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -77,7 +77,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.1-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.2-Source") #endif() ############################################################################################################### diff --git a/config/cmake/HDF5_Examples_options.cmake b/config/cmake/HDF5_Examples_options.cmake index b639b19..236a814 100644 --- a/config/cmake/HDF5_Examples_options.cmake +++ b/config/cmake/HDF5_Examples_options.cmake @@ -42,8 +42,11 @@ ### enable JAVA builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") +############################################################################################# ### enable FILTERS builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FILTERS:BOOL=ON") +### default HDF5_PLUGIN_PATH to where the filter libraries are located +#set(ENV{HDF5_PLUGIN_PATH} "${INSTALLDIR}/lib/plugin") ############################################################################################# ### enable parallel program builds diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 08e38e8..8df7dd4 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -11,7 +11,7 @@ # ############################################################################################# ### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### -### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ### +### BUILD_GENERATOR required [Unix, VS2019, VS201964, VS2017, VS201764, VS2015, VS201564] ### ### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ### ############################################################################################# @@ -68,7 +68,7 @@ endif () # build generator must be defined if (NOT DEFINED BUILD_GENERATOR) - message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") + message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2019, VS201964, VS2017, or VS201764, VS2015, VS201564") endif () ################################################################### @@ -163,7 +163,7 @@ if (NOT DEFINED HPC) set (SITE_COMPILER_NAME "vs2012") set (SITE_COMPILER_VERSION "11") else () - message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") + message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2019, VS201964, VS2017, or VS201764, VS2015, VS201564") endif () ## Set the following to unique id your computer ## set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 7133e6c..e3c4c1a 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -69,7 +69,7 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### package examples #### -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.1-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.2-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# ### enable parallel builds diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake index cf0ab6f..1242695 100644 --- a/release_docs/README_HDF5_CMake +++ b/release_docs/README_HDF5_CMake @@ -1,15 +1,16 @@ This tar file contains - build-unix.sh script to build HDF5 with CMake on unix machines - build-unix-hpc.sh script to build HDF5 with CMake on unix machines and run - tests with batch scripts (sbatch). + build-unix.sh script to build HDF5 with CMake on unix machines + build-unix-hpc.sh script to build HDF5 with CMake on unix machines and run + tests with batch scripts (sbatch). CTestScript.cmake - HDF5config.cmake CMake scripts for building HDF5 + HDF5config.cmake CMake scripts for building HDF5 HDF5options.cmake - hdf5-1.13.0 HDF5 1.13.0 source - LIBAEC.tar.gz source for building SZIP replacement - ZLib.tar.gz source for building ZLIB - hdf5_plugins.tar.gz source for building compression plugins + hdf5-1.13.0 HDF5 1.13.0 source + LIBAEC.tar.gz source for building SZIP replacement + ZLib.tar.gz source for building ZLIB + hdf5_plugins.tar.gz source for building compression plugins + HDF5Examples-1.14.2-Source.tar.gz source for building examples For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in hdf5-1.13.0/release_docs, or diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index bd089a6..a12a952 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -83,6 +83,7 @@ III. Defaults in the HDF5_Examples_options.cmake file #### HDF_BUILD_CXX:BOOL=OFF ### #### HDF_BUILD_FORTRAN:BOOL=OFF ### #### HDF_BUILD_JAVA:BOOL=OFF ### +#### HDF_BUILD_FILTERS:BOOL=OFF ### #### BUILD_TESTING:BOOL=OFF ### #### HDF_ENABLE_PARALLEL:BOOL=OFF ### #### HDF_ENABLE_THREADSAFE:BOOL=OFF ### diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index f2d7754..792c719 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -41,13 +41,30 @@ I. Preconditions 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (the *.msi file in the binary package for - Windows). If you are using a Windows platform, you can obtain a - pre-built Windows binary from The HDF Group's website at + Windows). You can obtain pre-built binaries from The HDF Group's website at www.hdfgroup.org. 3. Set the environment variable HDF5_DIR to the installed location of - the config files for HDF5. On Windows: + the config files for HDF5. + On Windows: HDF5_DIR=C:/Program Files/HDF_Group/HDF5/1.13.x/cmake + On unix: + HDF5_DIR=/HDF_Group/HDF5/1.13.x/cmake + + If you are using shared libraries, you may need to add to the path + environment variable. Set the path environment variable to the + installed location of the library files for HDF5. + On Windows (*.dll): + PATH=%PATH%;C:/Program Files/HDF_Group/HDF5/1.13.x/bin + On unix (*.so): + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/HDF_Group/HDF5/1.13.x/lib + + If you are using filter plugin libraries, you will need to set the + HDF5_PLUGIN_PATH environment variable. + On Windows: + HDF5_PLUGIN_PATH=C:/Program Files/HDF_Group/HDF5/1.13.x/lib/plugin + On unix: + HDF5_PLUGIN_PATH=/HDF_Group/HDF5/1.13.x/lib/plugin (Note there are no quote characters used on Windows and all platforms use forward slashes) @@ -99,12 +116,13 @@ These steps are described in more detail below. * MinGW Makefiles * NMake Makefiles * Unix Makefiles - * Visual Studio 12 2013 - * Visual Studio 12 2013 Win64 * Visual Studio 14 2015 * Visual Studio 14 2015 Win64 * Visual Studio 15 2017 * Visual Studio 15 2017 Win64 + * Visual Studio 16 2019 + * ... in addition VS2019 will need to set the "-A" option, + * ... [Win32, x64, ARM, ARM64] is: * BUILD_TESTING:BOOL=ON @@ -114,7 +132,7 @@ These steps are described in more detail below. 2.1 Visual CMake users, click the Configure button. If this is the first time you are running cmake-gui in this directory, you will be prompted for the - generator you wish to use (for example on Windows, Visual Studio 12 2013). + generator you wish to use (for example on Windows, Visual Studio 14 2015 Win64). CMake will read in the CMakeLists.txt files from the source directory and display options for the HDF5 project. After the first configure you can adjust the cache settings and/or specify locations of other programs. @@ -132,7 +150,7 @@ These steps are described in more detail below. 2.2 Alternative command line example on Windows in c:\MyHDFstuff\hdf5\build directory: - cmake -G "Visual Studio 12 2013" -DBUILD_TESTING:BOOL=ON .. + cmake -G "Visual Studio 14 2015 Win64" -DBUILD_TESTING:BOOL=ON .. 3. Build HDF5 Applications -- cgit v0.12 From 436727dceab2df46ef688f31fa199254e64ec34a Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 14 Jul 2021 22:59:38 -0500 Subject: Perform option arg variables (#834) * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. * Flag cleanup and fix typos * Add comment * Correct VAR used to find configure time file * Set the path correctly * Update missing release note info. * Update code owners * Correct JIRA note * add known problem. * Use only core library for testing dynamic plugins. * Fix static perform tools compile for arg options Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- tools/test/perform/pio_standalone.c | 5 ----- tools/test/perform/pio_standalone.h | 6 +++--- tools/test/perform/sio_standalone.c | 5 ----- tools/test/perform/sio_standalone.h | 6 +++--- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index db8633e..ded15a4 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -26,11 +26,6 @@ MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */ /* global variables */ int nCols = 80; -/* ``get_option'' variables */ -int H5_opterr = 1; /*get_option prints errors if this is on */ -int H5_optind = 1; /*token pointer */ -const char *H5_optarg; /*flag argument (or value) */ - int get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts) { diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 4b5c7b2..ef6d97b 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -454,9 +454,9 @@ void h5_dump_info_object(MPI_Info info); /** From h5tools_utils.h **/ -extern int H5_opterr; /* getoption prints errors if this is on */ -extern int H5_optind; /* token pointer */ -extern const char *H5_optarg; /* flag argument (or value) */ +H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */ +H5_DLLVAR int H5_optind; /* token pointer */ +H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */ enum h5_arg_level { no_arg = 0, /* doesn't take an argument */ diff --git a/tools/test/perform/sio_standalone.c b/tools/test/perform/sio_standalone.c index 2e793fb..7c22b53 100644 --- a/tools/test/perform/sio_standalone.c +++ b/tools/test/perform/sio_standalone.c @@ -22,11 +22,6 @@ /* global variables */ int nCols = 80; -/* ``get_option'' variables */ -int H5_opterr = 1; /*get_option prints errors if this is on */ -int H5_optind = 1; /*token pointer */ -const char *H5_optarg; /*flag argument (or value) */ - int get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts) { diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 098b98a..3b699dc 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -469,9 +469,9 @@ void h5_dump_info_object(MPI_Info info); /** From h5tools_utils.h **/ -extern int H5_opterr; /* getoption prints errors if this is on */ -extern int H5_optind; /* token pointer */ -extern const char *H5_optarg; /* flag argument (or value) */ +H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */ +H5_DLLVAR int H5_optind; /* token pointer */ +H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */ enum h5_arg_level { no_arg = 0, /* doesn't take an argument */ -- cgit v0.12 From 50a37fde06457ee5e75ea65259c233cb6527bd91 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Mon, 19 Jul 2021 20:40:28 -0500 Subject: Allow parallel filters feature for comm size of 1 (#840) --- src/H5Dio.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/H5Dio.c b/src/H5Dio.c index 600f08a..d1861c4 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -810,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; -- cgit v0.12 From 20dd1cedb35d95ecc21decb29352d7779d49a908 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 21 Jul 2021 11:12:39 -0500 Subject: Issue #833 fix setting return result (#843) --- config/cmake/ConfigureChecks.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 7baf77b..4db3ad4 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -261,7 +261,7 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) if (${COMPILE_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 0) - set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") + set (${RETURN_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Testing C ${FUNCTION_NAME} - OK") endif () @@ -273,7 +273,7 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail") endif () - set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") + set (${RETURN_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n" "${OUTPUT_VAR}\n\n") -- cgit v0.12 From 96b6872a1e7deac7673d31697dafa1f44763ede4 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Thu, 22 Jul 2021 08:12:42 -0500 Subject: Avoid popping API context when one wasn't pushed (#848) --- src/H5private.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index f29ec02..7823bfc 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2082,6 +2082,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Push the API context */ \ if (H5CX_push() < 0) \ HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context") \ + else \ + api_ctx_pushed = TRUE; \ \ BEGIN_MPE_LOG @@ -2089,6 +2091,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #define FUNC_ENTER_API(err) \ { \ { \ + hbool_t api_ctx_pushed = FALSE; \ + \ FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_INIT(err); \ FUNC_ENTER_API_PUSH(err); \ @@ -2103,6 +2107,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #define FUNC_ENTER_API_NOCLEAR(err) \ { \ { \ + hbool_t api_ctx_pushed = FALSE; \ + \ FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_INIT(err); \ FUNC_ENTER_API_PUSH(err); \ @@ -2369,14 +2375,17 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); H5_API_SET_CANCEL #define FUNC_LEAVE_API_COMMON(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ FINISH_MPE_LOG \ H5TRACE_RETURN(ret_value); #define FUNC_LEAVE_API(ret_value) \ + ; \ + } /*end scope from end of FUNC_ENTER*/ \ FUNC_LEAVE_API_COMMON(ret_value); \ - (void)H5CX_pop(TRUE); \ + if (api_ctx_pushed) { \ + (void)H5CX_pop(TRUE); \ + api_ctx_pushed = FALSE; \ + } \ H5_POP_FUNC \ if (err_occurred) \ (void)H5E_dump_api_stack(TRUE); \ @@ -2387,6 +2396,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Use this macro to match the FUNC_ENTER_API_NOINIT macro */ #define FUNC_LEAVE_API_NOINIT(ret_value) \ + ; \ + } /*end scope from end of FUNC_ENTER*/ \ FUNC_LEAVE_API_COMMON(ret_value); \ H5_POP_FUNC \ if (err_occurred) \ @@ -2399,6 +2410,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ + ; \ + } /*end scope from end of FUNC_ENTER*/ \ FUNC_LEAVE_API_COMMON(ret_value); \ FUNC_LEAVE_API_THREADSAFE \ return (ret_value); \ -- cgit v0.12 From 06de43332d80229dbe5f5a1ac4addf3fbc8325f5 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 22 Jul 2021 06:13:14 -0700 Subject: Fixes a couple of warnings: (#849) - warn_unused_result warnings from h5jamgentest and j5stat_gentest that were triggered by write(2) calls where we didn't check the return value - A missing callback in the NULL VOL connector - A possibly uninitialized property list pointer --- src/H5Pdxpl.c | 4 +- test/null_vol_connector.c | 1 + tools/test/h5jam/h5jamgentest.c | 384 ++++++++++++++++++++++++------------- tools/test/h5stat/h5stat_gentest.c | 145 ++++++++++---- 4 files changed, 370 insertions(+), 164 deletions(-) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 046b046..5f83a1d 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -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/test/null_vol_connector.c b/test/null_vol_connector.c index 2b375d8..6555763 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -116,6 +116,7 @@ static const H5VL_class_t null_vol_g = { { /* introspect_cls */ NULL, /* get_conn_cls */ + NULL, /* get_cap_flags */ NULL, /* opt_query */ }, { diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index 1da6b63..ae6c594 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -83,7 +83,7 @@ UD_traverse(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED cur_group const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id) { - return -1; + return H5I_INVALID_HID; } #define MY_LINKCLASS 187 @@ -116,196 +116,311 @@ g2 : dset2.1 dset2.2 udlink */ -static void +static herr_t gent_ub(const char *filename, size_t ub_size, size_t ub_fill) { - hid_t fid, group, attr, dataset, space; - hid_t create_plist; + hid_t fid = H5I_INVALID_HID; + hid_t group = H5I_INVALID_HID; + hid_t attr = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t create_plist = H5I_INVALID_HID; hsize_t dims[2]; int data[2][2], dset1[10][10], dset2[20]; char buf[BUF_SIZE]; int i, j; size_t u; float dset2_1[10], dset2_2[3][5]; - int fd; - char * bp; + int fd = -1; if (ub_size > 0) { - create_plist = H5Pcreate(H5P_FILE_CREATE); - H5Pset_userblock(create_plist, (hsize_t)ub_size); - fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT); + if ((create_plist = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + if (H5Pset_userblock(create_plist, (hsize_t)ub_size) < 0) + goto error; + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT)) < 0) + goto error; } else { - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; } - /* create groups */ - group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(group); + /* Create groups */ + if ((group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (H5Gclose(group) < 0) + goto error; - group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(group); + if ((group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (H5Gclose(group) < 0) + goto error; - group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(group); + if ((group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (H5Gclose(group) < 0) + goto error; - group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(group); + if ((group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (H5Gclose(group) < 0) + goto error; - group = H5Gcreate2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(group); + if ((group = H5Gcreate2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (H5Gclose(group) < 0) + goto error; - /* root attributes */ - group = H5Gopen2(fid, "/", H5P_DEFAULT); + /* Root attributes */ + if ((group = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) + goto error; dims[0] = 10; - space = H5Screate_simple(1, dims, NULL); - attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(buf, "abcdefghi"); - H5Awrite(attr, H5T_NATIVE_SCHAR, buf); - H5Sclose(space); - H5Aclose(attr); - - dims[0] = 2; - dims[1] = 2; - space = H5Screate_simple(2, dims, NULL); - attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT); + if ((space = H5Screate_simple(1, dims, NULL)) < 0) + goto error; + if ((attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (HDsprintf(buf, "abcdefghi") < 0) + goto error; + if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Aclose(attr) < 0) + goto error; + + dims[0] = 2; + dims[1] = 2; + if ((space = H5Screate_simple(2, dims, NULL)) < 0) + goto error; + if ((attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3; - H5Awrite(attr, H5T_NATIVE_INT, data); - H5Sclose(space); - H5Aclose(attr); + if (H5Awrite(attr, H5T_NATIVE_INT, data) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Aclose(attr) < 0) + goto error; - H5Gclose(group); + if (H5Gclose(group) < 0) + goto error; - group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT); + if ((group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT)) < 0) + goto error; - /* dset1.1.1 */ + /* Dataset 1.1.1 */ dims[0] = 10; dims[1] = 10; - space = H5Screate_simple(2, dims, NULL); - dataset = H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if ((space = H5Screate_simple(2, dims, NULL)) < 0) + goto error; + if ((dataset = + H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; for (i = 0; i < 10; i++) for (j = 0; j < 10; j++) dset1[i][j] = j * i; - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); - H5Sclose(space); + if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; - /* attributes of dset1.1.1 */ + /* Attributes of dset1.1.1 */ dims[0] = 27; - space = H5Screate_simple(1, dims, NULL); - attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(buf, "1st attribute of dset1.1.1"); - H5Awrite(attr, H5T_NATIVE_SCHAR, buf); - H5Sclose(space); - H5Aclose(attr); + if ((space = H5Screate_simple(1, dims, NULL)) < 0) + goto error; + if ((attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (HDsprintf(buf, "1st attribute of dset1.1.1") < 0) + goto error; + if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Aclose(attr) < 0) + goto error; dims[0] = 27; - space = H5Screate_simple(1, dims, NULL); - attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(buf, "2nd attribute of dset1.1.1"); - H5Awrite(attr, H5T_NATIVE_SCHAR, buf); - H5Sclose(space); - H5Aclose(attr); - - H5Dclose(dataset); - - /* dset1.1.2 */ + if ((space = H5Screate_simple(1, dims, NULL)) < 0) + goto error; + if ((attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (HDsprintf(buf, "2nd attribute of dset1.1.1") < 0) + goto error; + if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Aclose(attr) < 0) + goto error; + + if (H5Dclose(dataset) < 0) + goto error; + + /* Dataset 1.1.2 */ dims[0] = 20; - space = H5Screate_simple(1, dims, NULL); - dataset = H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if ((space = H5Screate_simple(1, dims, NULL)) < 0) + goto error; + if ((dataset = + H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; for (i = 0; i < 20; i++) dset2[i] = i; - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); - H5Sclose(space); - H5Dclose(dataset); - - H5Gclose(group); - - /* external link */ - H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT); - - /* soft link */ - group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT); - H5Lcreate_soft("somevalue", group, "slink", H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(group); - - group = H5Gopen2(fid, "/g2", H5P_DEFAULT); - - /* dset2.1 */ + if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Dclose(dataset) < 0) + goto error; + + if (H5Gclose(group) < 0) + goto error; + + /* External link */ + if (H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + + /* Soft link */ + if ((group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT)) < 0) + goto error; + if (H5Lcreate_soft("somevalue", group, "slink", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + if (H5Gclose(group) < 0) + goto error; + + if ((group = H5Gopen2(fid, "/g2", H5P_DEFAULT)) < 0) + goto error; + + /* Dataset 2.1 */ dims[0] = 10; - space = H5Screate_simple(1, dims, NULL); - dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if ((space = H5Screate_simple(1, dims, NULL)) < 0) + goto error; + if ((dataset = + H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; for (i = 0; i < 10; i++) dset2_1[i] = (float)((float)i * 0.1F + 1.0F); - H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); - H5Sclose(space); - H5Dclose(dataset); - - /* dset2.2 */ + if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Dclose(dataset) < 0) + goto error; + + /* Dataset 2.2 */ dims[0] = 3; dims[1] = 5; - space = H5Screate_simple(2, dims, NULL); - dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if ((space = H5Screate_simple(2, dims, NULL)) < 0) + goto error; + if ((dataset = + H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; for (i = 0; i < 3; i++) for (j = 0; j < 5; j++) dset2_2[i][j] = (float)(((float)i + 1.0F) * (float)j * 0.1F); - H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2); - H5Sclose(space); - H5Dclose(dataset); - - H5Gclose(group); - - /* user-defined link */ - H5Lregister(UD_link_class); - H5Lcreate_ud(fid, "/g2/udlink", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT); - - H5Fclose(fid); + if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Dclose(dataset) < 0) + goto error; + + if (H5Gclose(group) < 0) + goto error; + + /* User-defined link */ + if (H5Lregister(UD_link_class) < 0) + goto error; + if (H5Lcreate_ud(fid, "/g2/udlink", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < + 0) + goto error; + + /* MUST close the file ID before the user block code or you risk tripping + * over file locking issues. + */ + if (H5Fclose(fid) < 0) + goto error; /* If a user block is being used, write to it here */ if (ub_size > 0) { - HDassert(ub_size <= BUF_SIZE); + char *bp; + + if (ub_size > BUF_SIZE) + goto error; - fd = HDopen(filename, O_RDWR); - HDassert(fd >= 0); + if ((fd = HDopen(filename, O_RDWR)) < 0) + goto error; - /* fill buf with pattern */ + /* Fill buf with pattern */ HDmemset(buf, '\0', ub_size); bp = buf; for (u = 0; u < ub_fill; u++) *bp++ = pattern[u % 10]; - (void)HDwrite(fd, buf, ub_size); + if (HDwrite(fd, buf, ub_size) < 0) + goto error; + + if (HDclose(fd) < 0) + goto error; + } + return SUCCEED; + +error: + if (fd >= 0) HDclose(fd); + + H5E_BEGIN_TRY + { + H5Fclose(fid); + H5Gclose(group); + H5Aclose(attr); + H5Dclose(dataset); + H5Sclose(space); + H5Pclose(create_plist); } + H5E_END_TRY; + + return FAIL; } -static void +/* Creates a simple (i.e., not HDF5) text file and fills it with a pattern */ +static herr_t create_textfile(const char *name, size_t size) { - char * buf; - int fd; + char * buf = NULL; + int fd = -1; size_t i; - char * bp; + char * bp = NULL; - fd = HDcreat(name, 0777); - HDassert(fd >= 0); - buf = (char *)HDcalloc(size, (size_t)1); - HDassert(buf); + if ((fd = HDcreat(name, 0777)) < 0) + goto error; + if (NULL == (buf = (char *)HDcalloc(size, 1))) + goto error; - /* fill buf with pattern */ + /* Fill buf with pattern */ bp = buf; for (i = 0; i < size; i++) *bp++ = pattern[i % 10]; - (void)HDwrite(fd, buf, size); + if (HDwrite(fd, buf, size) < 0) + goto error; HDfree(buf); - HDclose(fd); + + return SUCCEED; + +error: + HDfree(buf); + if (fd >= 0) + HDclose(fd); + + return FAIL; } #ifdef notdef @@ -318,19 +433,20 @@ create_binfile(char *name, off_t size) int i; char *bp; - fd = creat(name, 0777); + fd = HDcreat(name, 0777); HDassert(fd >= 0); buf = HDcalloc(size, 1); HDassert(buf); - /* fill buf with pattern */ + /* Fill buf with pattern */ bp = buf; for (i = 0; i < size; i++) *bp++ = (char)i & 0xff; (void)HDwrite(fd, buf, size); + HDfree(buf); HDclose(fd); } #endif @@ -344,14 +460,19 @@ create_binfile(char *name, off_t size) int main(void) { - /* create_textfile(UBTXT1, (size_t)0); */ - create_textfile(UBTXT2, (size_t)10); - create_textfile(UBTXT3, (size_t)511); - create_textfile(UBTXT4, (size_t)512); - create_textfile(UBTXT5, (size_t)513); + + if (create_textfile(UBTXT2, 10) < 0) + goto error; + if (create_textfile(UBTXT3, 511) < 0) + goto error; + if (create_textfile(UBTXT4, 512) < 0) + goto error; + if (create_textfile(UBTXT5, 513) < 0) + goto error; + /* create_textfile(UBTXT6, (size_t)1023); create_textfile(UBTXT7, (size_t)1024); @@ -365,11 +486,18 @@ main(void) create_binfile(UBBIN3, (off_t)511); create_binfile(UBBIN4, (off_t)512); create_binfile(UBBIN5, (off_t)513); - */ - gent_ub(FILE7, (size_t)0, (size_t)0); - gent_ub(FILE8, (size_t)512, HDstrlen(pattern)); - gent_ub(FILE9, (size_t)1024, (size_t)513); - return 0; + if (gent_ub(FILE7, 0, 0) < 0) + goto error; + if (gent_ub(FILE8, 512, HDstrlen(pattern)) < 0) + goto error; + if (gent_ub(FILE9, 1024, 513) < 0) + goto error; + + return EXIT_SUCCESS; + +error: + HDfprintf(stderr, "h5jam test generator FAILED\n"); + return EXIT_FAILURE; } diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c index a9813e7..c775d6a 100644 --- a/tools/test/h5stat/h5stat_gentest.c +++ b/tools/test/h5stat/h5stat_gentest.c @@ -51,7 +51,7 @@ * Generate HDF5 file with latest format with * NUM_GRPS groups and NUM_ATTRS attributes for the dataset */ -static void +static herr_t gen_newgrat_file(const char *fname) { hid_t fcpl = H5I_INVALID_HID; /* File creation property */ @@ -117,6 +117,21 @@ gen_newgrat_file(const char *fname) } /* end for */ /* Close dataset, dataspace, datatype, file */ + if (H5Pclose(fapl) < 0) + goto error; + if (H5Pclose(fcpl) < 0) + goto error; + if (H5Dclose(did) < 0) + goto error; + if (H5Tclose(tid) < 0) + goto error; + if (H5Sclose(sid) < 0) + goto error; + if (H5Fclose(fid) < 0) + goto error; + + return SUCCEED; + error: H5E_BEGIN_TRY { @@ -130,6 +145,8 @@ error: H5Fclose(fid); } H5E_END_TRY; + + return FAIL; } /* gen_newgrat_file() */ /* @@ -139,7 +156,7 @@ error: * datasets. -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for * small # of attributes. */ -static void +static herr_t gen_threshold_file(const char *fname) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -302,6 +319,23 @@ gen_threshold_file(const char *fname) goto error; } + if (H5Gclose(gid) < 0) + goto error; + if (H5Sclose(sid0) < 0) + goto error; + if (H5Sclose(sid1) < 0) + goto error; + if (H5Sclose(sid2) < 0) + goto error; + if (H5Sclose(sid3) < 0) + goto error; + if (H5Sclose(sid4) < 0) + goto error; + if (H5Fclose(fid) < 0) + goto error; + + return SUCCEED; + error: H5E_BEGIN_TRY { @@ -317,6 +351,8 @@ error: } H5E_END_TRY; + return FAIL; + } /* gen_threshold_file() */ /* @@ -327,18 +363,21 @@ error: * one dataset: fixed dimension, chunked layout, w/ filters * */ -static void +static herr_t gen_idx_file(const char *fname) { - hid_t fapl = H5I_INVALID_HID; /* file access property id */ - hid_t fid = H5I_INVALID_HID; /* file id */ - hid_t sid = H5I_INVALID_HID; /* space id */ - hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */ - hid_t did = -1, did2 = H5I_INVALID_HID; /* dataset id */ - hsize_t dims[1] = {10}; /* dataset dimension */ - hsize_t c_dims[1] = {2}; /* chunk dimension */ - int i; /* local index variable */ - int buf[10]; /* data buffer */ + hid_t fapl = H5I_INVALID_HID; /* file access property id */ + hid_t fid = H5I_INVALID_HID; /* file id */ + hid_t sid = H5I_INVALID_HID; /* space id */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */ + hid_t did = H5I_INVALID_HID; /* dataset id */ +#if defined(H5_HAVE_FILTER_DEFLATE) + hid_t did2 = H5I_INVALID_HID; /* dataset id (compressed) */ +#endif + hsize_t dims[1] = {10}; /* dataset dimension */ + hsize_t c_dims[1] = {2}; /* chunk dimension */ + int i; /* local index variable */ + int buf[10]; /* data buffer */ /* Get a copy of the file access property */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -390,6 +429,19 @@ gen_idx_file(const char *fname) #endif /* closing: dataspace, dataset, file */ + if (H5Pclose(fapl) < 0) + goto error; + if (H5Pclose(dcpl) < 0) + goto error; + if (H5Sclose(sid) < 0) + goto error; + if (H5Dclose(did) < 0) + goto error; + if (H5Fclose(fid) < 0) + goto error; + + return SUCCEED; + error: H5E_BEGIN_TRY { @@ -404,6 +456,8 @@ error: } H5E_END_TRY; + return FAIL; + } /* gen_idx_file() */ /* @@ -419,20 +473,21 @@ error: * H5O_refcount_decode in the jira issue. * */ -static void +static herr_t gen_err_refcount(const char *fname) { - hid_t fid = H5I_INVALID_HID; /* File identifier */ - hid_t sid = H5I_INVALID_HID; /* Dataspace message */ - hid_t did = H5I_INVALID_HID; /* Dataset identifier */ - hid_t gid = H5I_INVALID_HID; /* Group identifier */ - hid_t aid1 = -1, aid2 = H5I_INVALID_HID; /* Attribute identifier */ - hid_t tid = H5I_INVALID_HID; /* Datatype identifier */ - int i, n; /* Local index variables */ - int buf[10]; /* Data buffer */ - hsize_t dims[1]; /* Dimension size */ - int fd = -1; /* File descriptor */ - unsigned short val = 22; /* The refcount message ID */ + hid_t fid = H5I_INVALID_HID; /* File identifier */ + hid_t sid = H5I_INVALID_HID; /* Dataspace message */ + hid_t did = H5I_INVALID_HID; /* Dataset identifier */ + hid_t gid = H5I_INVALID_HID; /* Group identifier */ + hid_t aid1 = H5I_INVALID_HID; /* Attribute identifier */ + hid_t aid2 = H5I_INVALID_HID; /* Attribute identifier */ + hid_t tid = H5I_INVALID_HID; /* Datatype identifier */ + int i, n; /* Local index variables */ + int buf[10]; /* Data buffer */ + hsize_t dims[1]; /* Dimension size */ + int fd = -1; /* File descriptor */ + unsigned short val = 22; /* The refcount message ID */ /* Initialize data buffer */ n = 0; @@ -485,6 +540,10 @@ gen_err_refcount(const char *fname) goto error; if (H5Tclose(tid) < 0) goto error; + + /* Be sure to close this before opening the file again via open(), below, + * or you'll possibly trip over the file locking. + */ if (H5Fclose(fid) < 0) goto error; @@ -495,11 +554,16 @@ gen_err_refcount(const char *fname) with the committed datatype */ /* 24: the offset in the object header containing the version of the attribute message */ - if ((fd = HDopen(fname, O_RDWR, 0633)) >= 0) { - HDlseek(fd, 4520 + 24, SEEK_SET); - (void)HDwrite(fd, &val, 2); - HDclose(fd); - } + if ((fd = HDopen(fname, O_RDWR, 0633)) < 0) + goto error; + if (HDlseek(fd, 4520 + 24, SEEK_SET) < 0) + goto error; + if (HDwrite(fd, &val, 2) < 0) + goto error; + if (HDclose(fd) < 0) + goto error; + + return SUCCEED; error: H5E_BEGIN_TRY @@ -513,6 +577,11 @@ error: H5Fclose(fid); } H5E_END_TRY; + + if (fd >= 0) + HDclose(fd); + + return FAIL; } /* gen_err_refcount() */ /* @@ -542,14 +611,22 @@ error: int main(void) { - gen_newgrat_file(NEWGRAT_FILE); - gen_threshold_file(THRESHOLD_FILE); + if (gen_newgrat_file(NEWGRAT_FILE) < 0) + goto error; + if (gen_threshold_file(THRESHOLD_FILE) < 0) + goto error; /* Generate an HDF file to test for datasets with Fixed Array indexing */ - gen_idx_file(IDX_FILE); + if (gen_idx_file(IDX_FILE) < 0) + goto error; /* Generate a file with a refcount message ID */ - gen_err_refcount(ERR_REFCOUNT_FILE); + if (gen_err_refcount(ERR_REFCOUNT_FILE) < 0) + goto error; + + return EXIT_SUCCESS; - return 0; +error: + HDfprintf(stderr, "h5stat test generator FAILED\n"); + return EXIT_FAILURE; } -- cgit v0.12 From 725da3768b6537d0cfae59f6b220396ea9fa042d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 22 Jul 2021 11:42:06 -0700 Subject: Removes unused commented-out code from h5jamgentest.c (#851) --- tools/test/h5jam/h5jamgentest.c | 77 ----------------------------------------- 1 file changed, 77 deletions(-) diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index ae6c594..5632cc0 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -31,24 +31,7 @@ #define UBTXT3 "u511.txt" #define UBTXT4 "u512.txt" #define UBTXT5 "u513.txt" -/* not used yet -#define UBTXT6 "u1023.txt" -#define UBTXT7 "u1024.txt" -#define UBTXT8 "u1025.txt" -#define UBTXT9 "u2047.txt" -#define UBTXT10 "u2048.txt" -#define UBTXT11 "u2049.txt" -#define UBBIN1 "u0.dat" -#define UBBIN2 "u10.dat" -#define UBBIN3 "u511.dat" -#define UBBIN4 "u512.dat" -#define UBBIN5 "u513.dat" -*/ -/* not used yet -#define FILE1 "tnull.h5" -#define FILE2 "tnullwithub.h5" -*/ /* tall is same as dumper test */ #define FILE7 "tall.h5" #define FILE8 "twithub.h5" @@ -66,17 +49,6 @@ char pattern[11] = "abcdefghij"; #define BUF_SIZE 1024 -/* Element selection information */ - -typedef enum { RED, GREEN, BLUE, WHITE, BLACK } enumtype; - -/* Compound datatype */ -typedef struct s1_t { - unsigned int a; - unsigned int b; - float c; -} s1_t; - /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED cur_group, @@ -115,7 +87,6 @@ g1.2.1 : slink g2 : dset2.1 dset2.2 udlink */ - static herr_t gent_ub(const char *filename, size_t ub_size, size_t ub_fill) { @@ -423,47 +394,14 @@ error: return FAIL; } -#ifdef notdef -/* not used yet */ -void -create_binfile(char *name, off_t size) -{ - char *buf; - int fd; - int i; - char *bp; - - fd = HDcreat(name, 0777); - HDassert(fd >= 0); - - buf = HDcalloc(size, 1); - HDassert(buf); - - /* Fill buf with pattern */ - bp = buf; - for (i = 0; i < size; i++) - *bp++ = (char)i & 0xff; - - (void)HDwrite(fd, buf, size); - - HDfree(buf); - HDclose(fd); -} -#endif - /*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- */ - int main(void) { - /* - create_textfile(UBTXT1, (size_t)0); - */ - if (create_textfile(UBTXT2, 10) < 0) goto error; if (create_textfile(UBTXT3, 511) < 0) @@ -473,21 +411,6 @@ main(void) if (create_textfile(UBTXT5, 513) < 0) goto error; - /* - create_textfile(UBTXT6, (size_t)1023); - create_textfile(UBTXT7, (size_t)1024); - create_textfile(UBTXT8, (size_t)1025); - create_textfile(UBTXT9, (size_t)2047); - create_textfile(UBTXT10, (size_t)2048); - create_textfile(UBTXT11, (size_t)2049); - - create_binfile(UBBIN1, (off_t)0); - create_binfile(UBBIN2, (off_t)10); - create_binfile(UBBIN3, (off_t)511); - create_binfile(UBBIN4, (off_t)512); - create_binfile(UBBIN5, (off_t)513); - */ - if (gent_ub(FILE7, 0, 0) < 0) goto error; if (gent_ub(FILE8, 512, HDstrlen(pattern)) < 0) -- cgit v0.12 From f3441d54866d0736468b2697bbbee3ec81a83a5b Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Mon, 26 Jul 2021 15:18:15 -0500 Subject: OESS-168:Remove clang warnings. (#835) * OESS-168:Remove implicit conversion increases floating-point precision warnings. * OESS-168:Remove clang warnings. * OESS-168:Remove clang warnings. * Committing clang-format changes * OESS-168:Remove clang warnings. * Committing clang-format changes * OESS-168:Remove clang warning. * OESS-168:Remove clang warnings. * OESS-168:Address @byrnHDF review. * Remove line added to generated hl/src/H5LTanalyze.c file. Issue #854 created for creating a fix. * Remove extra whitespace from H5LTanalyze.c. * Remove extra blank line. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Larry Knox --- hl/test/test_ds.c | 2 ++ hl/test/test_packet.c | 8 ++++---- hl/tools/h5watch/h5watchgentest.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 8c6ef91..964e13f 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -5210,6 +5210,8 @@ test_attach_detach(void) HL_TESTING2("permutations of attaching and detaching"); + gid = var1_id = var2_id = var3_id = H5I_INVALID_HID; + if ((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 1d3a569..311f36a 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -45,10 +45,10 @@ typedef struct particle_t { * a static array of particles for writing and checking reads *------------------------------------------------------------------------- */ -static particle_t testPart[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0f}, {"one", 10, 10, 1.0f, 10.0f}, - {"two", 20, 20, 2.0f, 20.0f}, {"three", 30, 30, 3.0f, 30.0f}, - {"four", 40, 40, 4.0f, 40.0f}, {"five", 50, 50, 5.0f, 50.0f}, - {"six", 60, 60, 6.0f, 60.0f}, {"seven", 70, 70, 7.0f, 70.0f}}; +static particle_t testPart[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, + {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, + {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, + {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; /*------------------------------------------------------------------------- * function that compares one particle diff --git a/hl/tools/h5watch/h5watchgentest.c b/hl/tools/h5watch/h5watchgentest.c index c83e485..44cb0cb 100644 --- a/hl/tools/h5watch/h5watchgentest.c +++ b/hl/tools/h5watch/h5watchgentest.c @@ -224,7 +224,7 @@ main(void) one_cbuf[i].field2.b.a = 20; one_cbuf[i].field2.b.b = 40; one_cbuf[i].field2.b.c = 80; - one_cbuf[i].field3 = 3.0F; + one_cbuf[i].field3 = 3.0; one_cbuf[i].field4.a = 4; one_cbuf[i].field4.b = 8; } /* end for */ @@ -313,7 +313,7 @@ main(void) two_cbuf[i].field2.b.a = 20; two_cbuf[i].field2.b.b = 40; two_cbuf[i].field2.b.c = 80; - two_cbuf[i].field3 = 3.0F; + two_cbuf[i].field3 = 3.0; two_cbuf[i].field4.a = 4; two_cbuf[i].field4.b = 8; } /* end for */ -- cgit v0.12 From 74f1590d47acd41cd9aea8d9f6be52a5947ee5af Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 27 Jul 2021 13:59:05 -0500 Subject: Only test h5diff_830 in serial (#858) --- tools/test/h5diff/CMakeTests.cmake | 63 ++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 5ada730..4fcfa26 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -376,40 +376,44 @@ macro (ADD_H5_TEST resultfile resultcode) if (HDF5_TEST_SERIAL) - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (${resultcode}) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") - endif () - if (last_test) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - add_test ( - NAME H5DIFF-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}.txt" - -D "TEST_APPEND=EXIT CODE:" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - if (last_test) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - endif () + ADD_SH5_TEST (${resultfile} ${resultcode} ${ARGN}) endif () if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) endif () endmacro () + macro (ADD_SH5_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + if (${resultcode}) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (last_test) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else () + add_test ( + NAME H5DIFF-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_APPEND=EXIT CODE:" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + if (last_test) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + endif () + endmacro () + macro (ADD_PH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) @@ -1549,7 +1553,8 @@ ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array) # ############################################################################## # # dataset subsets # ############################################################################## -ADD_H5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;]) +#serial only +ADD_SH5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;]) # ############################################################################## # # VDS tests -- cgit v0.12 From cfcdf215187653703a21f1f99cc18e207138c39b Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 27 Jul 2021 15:44:05 -0500 Subject: Remove version-check for relnum in H5check. (#812) * Remove version-check for relnum in H5check. * Add in release exception code check * Fix typos * Fix more typos * Rework comments * format change * format whitespace * Library version must be less than or equal to headers * Need the NOT version of the compare * Enable release+1 check for PASS * Add release note * Update note --- release_docs/RELEASE.txt | 19 ++++ src/H5.c | 241 +++++++++++++++++++++++++++---------------- src/H5private.h | 6 +- test/CMakeTests.cmake | 2 +- test/testcheck_version.sh.in | 106 +++++++++---------- 5 files changed, 227 insertions(+), 147 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index bd186d8..314a713 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -463,6 +463,25 @@ New Features Library: -------- + - Change how the release part of version, in major.minor.release is checked + for compatibility + + The HDF5 library uses a function, H5check_version, to check that + the version defined in the header files, which is used to compile an + application is compatible with the version codified in the library, which + the application loads at runtime. This previously required an exact match + or the library would print a warning, dump the build settings and then + abort or continue. An environment variable controlled the logic. + + Now the function first checks that the library release version, in + major.minor.release, is not older than the version in the headers. + Secondly, if the release version is different, it checks if either + the library version or the header version is in the exception list, in + which case the release part of version, in major.minor.release, must + be exact. An environment variable still controls the logic. + + (ADB - 2021/07/27) + - gcc warning suppression macros were moved out of H5public.h The HDF5 library uses a set of macros to suppress warnings on gcc. diff --git a/src/H5.c b/src/H5.c index 71a8a30..12d226c 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 @@ -281,13 +285,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 * *------------------------------------------------------------------------- */ @@ -505,22 +509,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. * *------------------------------------------------------------------------- */ @@ -541,19 +545,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 * *------------------------------------------------------------------------- */ @@ -574,9 +578,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 @@ -594,9 +598,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 * *------------------------------------------------------------------------- */ @@ -620,11 +624,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: @@ -633,8 +637,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 @@ -659,23 +663,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 @@ -808,12 +812,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 * *------------------------------------------------------------------------- */ @@ -827,18 +831,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 * *------------------------------------------------------------------------- */ @@ -863,17 +867,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() * *------------------------------------------------------------------------- */ @@ -886,6 +893,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) @@ -914,7 +930,8 @@ 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 */ + if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > relnum) { switch (disable_version_check) { case 0: HDfprintf(stderr, "%s%s", version_mismatch_warning, @@ -949,7 +966,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; @@ -991,7 +1052,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 * *------------------------------------------------------------------------- */ @@ -1010,12 +1071,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 * *------------------------------------------------------------------------- */ @@ -1049,11 +1110,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 * *------------------------------------------------------------------------- */ @@ -1074,9 +1135,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 @@ -1114,9 +1175,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 @@ -1151,14 +1212,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 * *------------------------------------------------------------------------- */ @@ -1175,12 +1236,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 * *------------------------------------------------------------------------- */ @@ -1206,16 +1267,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/H5private.h b/src/H5private.h index 7823bfc..802dd90 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2169,7 +2169,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 \ @@ -2265,7 +2265,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 \ @@ -2343,7 +2343,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/test/CMakeTests.cmake b/test/CMakeTests.cmake index e840559..bb5356d 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -649,10 +649,10 @@ set_tests_properties (H5TEST-tcheck_version-minor PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST WILL_FAIL "true" ) +# release + 1 should pass add_test (NAME H5TEST-tcheck_version-release COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-tr") set_tests_properties (H5TEST-tcheck_version-release PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - WILL_FAIL "true" ) ############################################################################## diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in index 43d1b46..6378ee5 100644 --- a/test/testcheck_version.sh.in +++ b/test/testcheck_version.sh.in @@ -15,7 +15,7 @@ # Tests for the H5check_version function. # # Programmer: Albert Cheng -# Sep 28, 2009 +# Sep 28, 2009 srcdir=@srcdir@ @@ -24,7 +24,7 @@ srcdir=@srcdir@ Shared_Lib=@enable_shared@ Static_Lib=@enable_static@ Static_exec=@STATIC_EXEC@ -h5haveexitcode=yes # default is yes +h5haveexitcode=yes # default is yes CMP='cmp -s' DIFF='diff -c' @@ -103,10 +103,10 @@ WarnMesg2(){ # mismatch). # # Expected results: -# Value of $HDF5_DISABLE_VERSION_CHECK -# unset "" -1 0 1 2 3 -# Matched OK OK OK OK OK OK OK -# Mismatched W/A W/A W/A W/A W2/OK OK W2/OK +# Value of $HDF5_DISABLE_VERSION_CHECK +# unset "" -1 0 1 2 3 +# Matched OK OK OK OK OK OK OK +# Mismatched W/A W/A W/A W/A W2/OK OK W2/OK # Result codes: # OK: No warning, exit 0. # W/A: Warning, abort and exit non-0. @@ -130,42 +130,42 @@ TESTING() { xxh5versrelease=$h5versrelease if [ "$h5DisableVersion" = unset ]; then - envcmd="" # noop + envcmd="" # noop else - envcmd="env HDF5_DISABLE_VERSION_CHECK=$h5DisableVersion" + envcmd="env HDF5_DISABLE_VERSION_CHECK=$h5DisableVersion" fi if [ "$wrongversionnumbers" = none ]; then - # OK: No warning, exit 0 - cp /dev/null $expect - expect_code=0 + # OK: No warning, exit 0 + cp /dev/null $expect + expect_code=0 else - arguments=-t"$wrongversionnumbers" - # calculate mismatched version numbers by listing. - case $wrongversionnumbers in - "M") xxh5versmajor=`expr $h5versmajor + 1` - ;; - "m") xxh5versminor=`expr $h5versminor + 1` - ;; - "r") xxh5versrelease=`expr $h5versrelease + 1` - ;; - esac - case "$h5DisableVersion" in - 1) - # W2/OK: Different Warning, exit 0. - WarnMesg2 > $expect - expect_code=0 - ;; - [2-9]|[1-9][0-9]*) - # OK: No warning, exit 0 - cp /dev/null $expect - expect_code=0 - ;; - *) # W/A: Warning, abort and exit non-0. - WarnMesg > $expect - expect_code=6 # Signal Abort exit code (128+6) - ;; - esac + arguments=-t"$wrongversionnumbers" + # calculate mismatched version numbers by listing. + case $wrongversionnumbers in + "M") xxh5versmajor=`expr $h5versmajor + 1` + ;; + "m") xxh5versminor=`expr $h5versminor + 1` + ;; + "r") xxh5versrelease=`expr $h5versrelease + 1` + ;; + esac + case "$h5DisableVersion" in + 1) + # W2/OK: Different Warning, exit 0. + WarnMesg2 > $expect + expect_code=0 + ;; + [2-9]|[1-9][0-9]*) + # OK: No warning, exit 0 + cp /dev/null $expect + expect_code=0 + ;; + *) # W/A: Warning, abort and exit non-0. + WarnMesg > $expect + expect_code=6 # Signal Abort exit code (128+6) + ;; + esac fi # Run test. @@ -177,23 +177,23 @@ TESTING() { cat $actual_err >> $actual if [ $h5haveexitcode = 'yes' -a \( $expect_code -ne $ret_code \) ]; then - echo "*FAILED*" - echo " Expected exit code ($expect_code) differs from actual code ($ret_code)" - nerrors="`expr $nerrors + 1`" + echo "*FAILED*" + echo " Expected exit code ($expect_code) differs from actual code ($ret_code)" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file. # Also clean the core file generated by H5check_version's abort. if test -z "$HDF5_NOCLEANUP"; then - $RM $expect $actual $actual_err - $RM core + $RM $expect $actual $actual_err + $RM core fi } @@ -201,15 +201,15 @@ TESTING() { # Echo parameters for debugging if verbose mode is on. DEBUGPRINT() { if [ -n "$debugmode" ]; then - echo $* + echo $* fi } # MAIN Body nerrors=0 -verbose=yes # default on -debugmode= # default off +verbose=yes # default on +debugmode= # default off H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h` h5libsettings=../src/libhdf5.settings @@ -240,13 +240,13 @@ fi # Three Categories of tests: # Normal: where the version numbers all matched (wrong_version == none). # Mismatched version numbers (could be Major or minor version -# or release numbers or a combination of all three.) +# or release numbers or a combination of all three.) # Test all the above with different values of the environment variable, # HDF5_DISABLE_VERSION_CHECK, as unset, "", -1, 0, 1, 2, 3 for val_disable_version_check in unset "" -1 0 1 2 3; do - for wrong_version in none M m r; do - TESTING "$val_disable_version_check" "$wrong_version" + for wrong_version in none M m; do + TESTING "$val_disable_version_check" "$wrong_version" done done -- cgit v0.12 From 9bb1d6d78e305e73b5c882e8f5b3ef66a1acdf8d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 28 Jul 2021 14:29:10 -0700 Subject: Updates a comment in H5mpi.c (#863) MPI_Type_struct() is an MPI-1 call we no longer use. --- src/H5mpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v0.12 From 9fd356e2408b6f91bfbe6820cdb979b6fade3fb3 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 29 Jul 2021 20:18:37 -0500 Subject: Added int variable for comparison with H5_VERS_RELEASE in H5.c to avoid (#866) warning that unsigned comparison < 0 is always false, which is known, but for later versions the comparison can possibly be true. --- src/H5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/H5.c b/src/H5.c index 12d226c..2debc92 100644 --- a/src/H5.c +++ b/src/H5.c @@ -912,6 +912,8 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */ static const char * version_mismatch_warning = VERSION_MISMATCH_WARNING; herr_t ret_value = SUCCEED; /* Return value */ + int releasenum = relnum; /* To avoid warning for unsigned < 0 + comparison in first release versions */ FUNC_ENTER_API_NOINIT_NOERR_NOFS H5TRACE3("e", "IuIuIu", majnum, minnum, relnum); @@ -931,7 +933,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) } /* H5_VERS_MAJOR and H5_VERS_MINOR must match */ - if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > relnum) { + if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > releasenum) { switch (disable_version_check) { case 0: HDfprintf(stderr, "%s%s", version_mismatch_warning, -- cgit v0.12 From 48a05aa887ae7d18512756bf1eeb177e08d0feaf Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Sun, 1 Aug 2021 22:07:01 -0500 Subject: Unsigned comparison to 0 warning avoidance (#869) * Added int variable for comparison with H5_VERS_RELEASE in H5.c to avoid warning that unsigned comparison < 0 is always false, which is known, but for later versions the comparison can possibly be true. * Better solution for avoiding warning that unsigned comparison < 0. --- src/H5.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/H5.c b/src/H5.c index 2debc92..3ceaecd 100644 --- a/src/H5.c +++ b/src/H5.c @@ -912,8 +912,6 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */ static const char * version_mismatch_warning = VERSION_MISMATCH_WARNING; herr_t ret_value = SUCCEED; /* Return value */ - int releasenum = relnum; /* To avoid warning for unsigned < 0 - comparison in first release versions */ FUNC_ENTER_API_NOINIT_NOERR_NOFS H5TRACE3("e", "IuIuIu", majnum, minnum, relnum); @@ -933,7 +931,10 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) } /* H5_VERS_MAJOR and H5_VERS_MINOR must match */ - if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > releasenum) { + /* 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, -- cgit v0.12 From 04f1bff6757892df07cd72520af276f7691ff43b Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 3 Aug 2021 14:04:30 -0700 Subject: Updates the RELEASE.txt file with a note about the variable-length fill (#871) value issue. A fix is in progress, but it might be a while before we have time to finish it up. --- release_docs/RELEASE.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 314a713..20ee467 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1455,6 +1455,10 @@ The following platforms are not supported but have been tested for this release. Known Problems ============== + Setting a variable-length dataset fill value will leak the memory allocated + for the p field of the hvl_t struct. A fix is in progress for this. + HDFFV-10840 + CMake files do not behave correctly with paths containing spaces. Do not use spaces in paths because the required escaping for handling spaces results in very complex and fragile build files. -- cgit v0.12 From 5dabec4cf6b97793e3af6df3b6a3953394bbf27d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 3 Aug 2021 14:04:58 -0700 Subject: Removes partial long options from the tools (#872) Some of the command-line tools would allow partial long options (e.g., --datas instead of --dataset). These were inconsistently implemented, difficult to maintain, and occasionally blocked useful long options. They have been removed from all the tools. NOTE: This change should NOT be merged to 1.12 or earlier. --- release_docs/RELEASE.txt | 9 +++ tools/src/h5dump/h5dump.c | 78 ------------------------- tools/src/h5format_convert/h5format_convert.c | 23 +------- tools/src/h5jam/h5jam.c | 12 ++-- tools/src/h5jam/h5unjam.c | 10 +--- tools/src/h5stat/h5stat.c | 83 --------------------------- tools/src/misc/h5clear.c | 37 ++---------- tools/test/h5stat/CMakeTests.cmake | 2 +- tools/test/h5stat/testh5stat.sh.in | 2 +- tools/test/misc/CMakeTestsClear.cmake | 4 +- tools/test/misc/testh5clear.sh.in | 4 +- 11 files changed, 29 insertions(+), 235 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 20ee467..e12f652 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -820,6 +820,15 @@ New Features Tools: ------ + - Removed partial long exceptions + + Some of the tools accepted shortened versions of the long options + (ex: --datas instead of --dataset). These were implemented inconsistently, + are difficult to maintian, and occasionally block useful long option + names. These partial long options have been removed from all the tools. + + (DER - 2021/08/03) + - h5repack added help text for user-defined filters. Added help text line that states the valid values of the filter flag diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 70f03df..36114ba 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -82,124 +82,46 @@ struct handler_t { /* "xxx" "yyy" into "xxxyyy". */ static const char * s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HM:N:O*RS:VX:"; static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'}, - {"attribut", require_arg, 'a'}, - {"attribu", require_arg, 'a'}, - {"attrib", require_arg, 'a'}, - {"attri", require_arg, 'a'}, - {"attr", require_arg, 'a'}, - {"att", require_arg, 'a'}, - {"at", require_arg, 'a'}, {"binary", optional_arg, 'b'}, {"count", require_arg, 'c'}, - {"coun", require_arg, 'c'}, - {"cou", require_arg, 'c'}, - {"co", require_arg, 'c'}, {"dataset", require_arg, 'd'}, - {"datase", require_arg, 'd'}, - {"datas", require_arg, 'd'}, {"escape", no_arg, 'e'}, {"filedriver", require_arg, 'f'}, - {"filedrive", require_arg, 'f'}, - {"filedriv", require_arg, 'f'}, - {"filedri", require_arg, 'f'}, - {"filedr", require_arg, 'f'}, - {"filed", require_arg, 'f'}, - {"file", require_arg, 'f'}, - {"fil", require_arg, 'f'}, - {"fi", require_arg, 'f'}, {"group", require_arg, 'g'}, - {"grou", require_arg, 'g'}, - {"gro", require_arg, 'g'}, - {"gr", require_arg, 'g'}, {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, {"object-ids", no_arg, 'i'}, - {"object-id", no_arg, 'i'}, - {"object-i", no_arg, 'i'}, - {"object", no_arg, 'i'}, - {"objec", no_arg, 'i'}, - {"obje", no_arg, 'i'}, - {"obj", no_arg, 'i'}, - {"ob", no_arg, 'i'}, {"block", require_arg, 'k'}, - {"bloc", require_arg, 'k'}, - {"blo", require_arg, 'k'}, - {"bl", require_arg, 'k'}, {"soft-link", require_arg, 'l'}, - {"soft-lin", require_arg, 'l'}, - {"soft-li", require_arg, 'l'}, - {"soft-l", require_arg, 'l'}, - {"soft", require_arg, 'l'}, - {"sof", require_arg, 'l'}, {"format", require_arg, 'm'}, {"contents", optional_arg, 'n'}, {"output", optional_arg, 'o'}, - {"outpu", optional_arg, 'o'}, - {"outp", optional_arg, 'o'}, - {"out", optional_arg, 'o'}, - {"ou", optional_arg, 'o'}, {"properties", no_arg, 'p'}, {"sort_by", require_arg, 'q'}, {"string", no_arg, 'r'}, - {"strin", no_arg, 'r'}, {"start", require_arg, 's'}, - {"star", require_arg, 's'}, - {"sta", require_arg, 's'}, {"datatype", require_arg, 't'}, - {"datatyp", require_arg, 't'}, - {"dataty", require_arg, 't'}, - {"datat", require_arg, 't'}, {"use-dtd", no_arg, 'u'}, - {"use-dt", no_arg, 'u'}, - {"use-d", no_arg, 'u'}, - {"use-", no_arg, 'u'}, - {"use", no_arg, 'u'}, - {"us", no_arg, 'u'}, - {"u", no_arg, 'u'}, {"vds-view-first-missing", no_arg, 'v'}, {"width", require_arg, 'w'}, - {"widt", require_arg, 'w'}, - {"wid", require_arg, 'w'}, - {"wi", require_arg, 'w'}, {"xml", no_arg, 'x'}, - {"xm", no_arg, 'x'}, {"noindex", no_arg, 'y'}, {"sort_order", require_arg, 'z'}, {"onlyattr", optional_arg, 'A'}, {"superblock", no_arg, 'B'}, {"boot-block", no_arg, 'B'}, - {"boot-bloc", no_arg, 'B'}, - {"boot-blo", no_arg, 'B'}, - {"boot-bl", no_arg, 'B'}, - {"boot-b", no_arg, 'B'}, - {"boot", no_arg, 'B'}, - {"boo", no_arg, 'B'}, - {"bo", no_arg, 'B'}, {"no-compact-subset", no_arg, 'C'}, {"xml-dtd", require_arg, 'D'}, - {"xml-dt", require_arg, 'D'}, - {"xml-d", require_arg, 'D'}, {"enable-error-stack", optional_arg, 'E'}, {"form", require_arg, 'F'}, {"vds-gap-size", require_arg, 'G'}, {"header", no_arg, 'H'}, - {"heade", no_arg, 'H'}, - {"head", no_arg, 'H'}, - {"hea", no_arg, 'H'}, {"packed-bits", require_arg, 'M'}, {"any_path", require_arg, 'N'}, {"ddl", optional_arg, 'O'}, {"region", no_arg, 'R'}, {"stride", require_arg, 'S'}, - {"strid", require_arg, 'S'}, {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"ver", no_arg, 'V'}, - {"ve", no_arg, 'V'}, {"xml-ns", require_arg, 'X'}, - {"xml-n", require_arg, 'X'}, {"s3-cred", require_arg, '$'}, {"hdfs-attrs", require_arg, '#'}, {"vol-value", require_arg, '1'}, diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 3430c55..ddf129c 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -39,26 +39,9 @@ static int verbose_g = 0; * parameters. */ static const char * s_opts = "hVvd:n"; -static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"version", no_arg, 'V'}, - {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"verbose", no_arg, 'v'}, - {"verbos", no_arg, 'v'}, - {"verbo", no_arg, 'v'}, - {"verb", no_arg, 'v'}, - {"dname", require_arg, 'd'}, - {"dnam", require_arg, 'd'}, - {"dna", require_arg, 'd'}, - {"dn", require_arg, 'd'}, - {"noop", no_arg, 'n'}, - {"noo", no_arg, 'n'}, - {"no", no_arg, 'n'}, - {"enable-error-stack", no_arg, 'E'}, +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"version", no_arg, 'V'}, + {"verbose", no_arg, 'v'}, {"dname", require_arg, 'd'}, + {"noop", no_arg, 'n'}, {"enable-error-stack", no_arg, 'E'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 0a2ea5d..7f3385c 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -34,14 +34,10 @@ char *ub_file = NULL; * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "hi:u:o:c:V"; /* add more later ? */ -static struct h5_long_options l_opts[] = { - {"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {"i", require_arg, 'i'}, /* input file */ - {"u", require_arg, 'u'}, /* user block file */ - {"o", require_arg, 'o'}, /* output file */ - {"clobber", no_arg, 'c'}, /* clobber existing UB */ - {"clobbe", no_arg, 'c'}, {"clobb", no_arg, 'c'}, {"clob", no_arg, 'c'}, - {"clo", no_arg, 'c'}, {"cl", no_arg, 'c'}, {NULL, 0, '\0'}}; +static const char * s_opts = "hi:u:o:c:V"; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'}, + {"u", require_arg, 'u'}, {"o", require_arg, 'o'}, + {"clobber", no_arg, 'c'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index 38d1a5e..fa23b06 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -36,13 +36,9 @@ char *ub_file = NULL; * adding more, make sure that they don't clash with each other. */ static const char * s_opts = "hu:i:o:d:V"; -static struct h5_long_options l_opts[] = { - {"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {"i", require_arg, 'i'}, /* input file */ - {"u", require_arg, 'u'}, /* user block file */ - {"o", require_arg, 'o'}, /* output file */ - {"delete", no_arg, 'd'}, /* delete ub */ - {"delet", no_arg, 'd'}, {"dele", no_arg, 'd'}, {"del", no_arg, 'd'}, - {"de", no_arg, 'd'}, {NULL, 0, '\0'}}; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'}, + {"u", require_arg, 'u'}, {"o", require_arg, 'o'}, + {"delete", no_arg, 'd'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 3bf641a..efc80b6 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -172,102 +172,19 @@ struct handler_t { static const char *s_opts = "Aa:Ddm:EFfhGgl:sSTO:Vw:H:"; /* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, {"filemetadata", no_arg, 'F'}, - {"filemetadat", no_arg, 'F'}, - {"filemetada", no_arg, 'F'}, - {"filemetad", no_arg, 'F'}, - {"filemeta", no_arg, 'F'}, - {"filemet", no_arg, 'F'}, - {"fileme", no_arg, 'F'}, - {"filem", no_arg, 'F'}, - {"file", no_arg, 'f'}, - {"fil", no_arg, 'f'}, - {"fi", no_arg, 'f'}, {"groupmetadata", no_arg, 'G'}, - {"groupmetadat", no_arg, 'G'}, - {"groupmetada", no_arg, 'G'}, - {"groupmetad", no_arg, 'G'}, - {"groupmeta", no_arg, 'G'}, - {"groupmet", no_arg, 'G'}, - {"groupme", no_arg, 'G'}, - {"groupm", no_arg, 'G'}, - {"group", no_arg, 'g'}, - {"grou", no_arg, 'g'}, - {"gro", no_arg, 'g'}, - {"gr", no_arg, 'g'}, {"links", require_arg, 'l'}, - {"link", require_arg, 'l'}, - {"lin", require_arg, 'l'}, - {"li", require_arg, 'l'}, {"dsetmetadata", no_arg, 'D'}, - {"dsetmetadat", no_arg, 'D'}, - {"dsetmetada", no_arg, 'D'}, - {"dsetmetad", no_arg, 'D'}, - {"dsetmeta", no_arg, 'D'}, - {"dsetmet", no_arg, 'D'}, - {"dsetme", no_arg, 'D'}, - {"dsetm", no_arg, 'D'}, - {"dset", no_arg, 'd'}, - {"dse", no_arg, 'd'}, - {"ds", no_arg, 'd'}, {"dims", require_arg, 'm'}, - {"dim", require_arg, 'm'}, - {"di", require_arg, 'm'}, {"dtypemetadata", no_arg, 'T'}, - {"dtypemetadat", no_arg, 'T'}, - {"dtypemetada", no_arg, 'T'}, - {"dtypemetad", no_arg, 'T'}, - {"dtypemeta", no_arg, 'T'}, - {"dtypemet", no_arg, 'T'}, - {"dtypeme", no_arg, 'T'}, - {"dtypem", no_arg, 'T'}, - {"dtype", no_arg, 'T'}, - {"dtyp", no_arg, 'T'}, - {"dty", no_arg, 'T'}, - {"dt", no_arg, 'T'}, {"object", require_arg, 'O'}, - {"objec", require_arg, 'O'}, - {"obje", require_arg, 'O'}, - {"obj", require_arg, 'O'}, - {"ob", require_arg, 'O'}, {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"ver", no_arg, 'V'}, - {"ve", no_arg, 'V'}, {"attribute", no_arg, 'A'}, - {"attribut", no_arg, 'A'}, - {"attribu", no_arg, 'A'}, - {"attrib", no_arg, 'A'}, - {"attri", no_arg, 'A'}, - {"attr", no_arg, 'A'}, - {"att", no_arg, 'A'}, - {"at", no_arg, 'A'}, {"enable-error-stack", no_arg, 'E'}, {"numattrs", require_arg, 'a'}, - {"numattr", require_arg, 'a'}, - {"numatt", require_arg, 'a'}, - {"numat", require_arg, 'a'}, - {"numa", require_arg, 'a'}, - {"num", require_arg, 'a'}, - {"nu", require_arg, 'a'}, {"freespace", no_arg, 's'}, - {"freespac", no_arg, 's'}, - {"freespa", no_arg, 's'}, - {"freesp", no_arg, 's'}, - {"frees", no_arg, 's'}, - {"free", no_arg, 's'}, - {"fre", no_arg, 's'}, - {"fr", no_arg, 's'}, {"summary", no_arg, 'S'}, - {"summar", no_arg, 'S'}, - {"summa", no_arg, 'S'}, - {"summ", no_arg, 'S'}, - {"sum", no_arg, 'S'}, - {"su", no_arg, 'S'}, {"s3-cred", require_arg, 'w'}, {"hdfs-attrs", require_arg, 'H'}, {NULL, 0, '\0'}}; diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 524ad03..008dae3 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -45,39 +45,10 @@ static hsize_t increment = DEFAULT_INCREMENT; * Command-line options: only publicize long options */ static const char * s_opts = "hVsmzi*"; -static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"version", no_arg, 'V'}, - {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"status", no_arg, 's'}, - {"statu", no_arg, 's'}, - {"stat", no_arg, 's'}, - {"sta", no_arg, 's'}, - {"st", no_arg, 's'}, - {"image", no_arg, 'm'}, - {"imag", no_arg, 'm'}, - {"ima", no_arg, 'm'}, - {"im", no_arg, 'm'}, - {"filesize", no_arg, 'z'}, - {"filesiz", no_arg, 'z'}, - {"filesi", no_arg, 'z'}, - {"files", no_arg, 'z'}, - {"file", no_arg, 'z'}, - {"fil", no_arg, 'z'}, - {"fi", no_arg, 'z'}, - {"increment", optional_arg, 'i'}, - {"incremen", optional_arg, 'i'}, - {"increme", optional_arg, 'i'}, - {"increm", optional_arg, 'i'}, - {"incre", optional_arg, 'i'}, - {"incr", optional_arg, 'i'}, - {"inc", optional_arg, 'i'}, - {"in", optional_arg, 'i'}, - {NULL, 0, '\0'}}; +static struct h5_long_options l_opts[] = { + {"help", no_arg, 'h'}, {"version", no_arg, 'V'}, {"status", no_arg, 's'}, + {"image", no_arg, 'm'}, {"filesize", no_arg, 'z'}, {"increment", optional_arg, 'i'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 79de6b9..d4238b5 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -207,7 +207,7 @@ # -d --di=15 ADD_H5_ERR_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims1 0 -gd -m 5 h5stat_threshold.h5) - ADD_H5_TEST (h5stat_dims2 0 -d --di=15 h5stat_threshold.h5) + ADD_H5_TEST (h5stat_dims2 0 -d --dims=15 h5stat_threshold.h5) # # Tests for -a option on h5stat_threshold.h5 # -a -2 (incorrect threshold value) diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in index 470c381..647f06a 100644 --- a/tools/test/h5stat/testh5stat.sh.in +++ b/tools/test/h5stat/testh5stat.sh.in @@ -304,7 +304,7 @@ TOOLTEST h5stat_links5.ddl -g -l 40000 h5stat_newgrat.h5 # -d --di=15 TOOLTEST h5stat_err1_dims.ddl -d --dims=-1 h5stat_threshold.h5 TOOLTEST h5stat_dims1.ddl -gd -m 5 h5stat_threshold.h5 -TOOLTEST h5stat_dims2.ddl -d --di=15 h5stat_threshold.h5 +TOOLTEST h5stat_dims2.ddl -d --dims=15 h5stat_threshold.h5 # # Tests for -a option on h5stat_threshold.h5 # -a -2 (incorrect threshold value) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index ec24a61..198a363 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -397,7 +397,7 @@ # # The following are tests to verify the expected exit code from h5clear: # "h5clear -m h5clear_mdc_image.h5" (valid option, existing file, succeed exit code) -# "h5clear --vers" (valid option, version #, succeed exit code) +# "h5clear --version" (valid option, version #, succeed exit code) # "h5clear -k" (invalid 1 option, no file, fail exit code) # "h5clear -k junk.h5" (invalid 1 option, nonexisting file, fail exit code) # "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code) @@ -408,7 +408,7 @@ # "h5clear -m -l h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code) # "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code) ADD_H5_RETTEST (h5clr_mdc_image "false" "-m" h5clear_mdc_image.h5) - ADD_H5_RETTEST (h5clr_vers "false" "--vers") + ADD_H5_RETTEST (h5clr_vers "false" "--version") ADD_H5_RETTEST (h5clr_k "true" "-k") ADD_H5_RETTEST (h5clr_k_junk "true" "-k" junk.h5) ADD_H5_RETTEST (h5clr_l_sec2 "true" "-l" h5clear_sec2_v2.h5) diff --git a/tools/test/misc/testh5clear.sh.in b/tools/test/misc/testh5clear.sh.in index c05e43d..a01fa4a 100644 --- a/tools/test/misc/testh5clear.sh.in +++ b/tools/test/misc/testh5clear.sh.in @@ -315,7 +315,7 @@ TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err # # The following are tests to verify the expected exit code from h5clear: # "h5clear -m h5clear_mdc_image.h5" (valid option, existing file, succeed exit code) -# "h5clear --vers" (valid option, version #, succeed exit code) +# "h5clear --version" (valid option, version #, succeed exit code) # "h5clear -k" (invalid 1 option, no file, fail exit code) # "h5clear -k junk.h5" (invalid 1 option, nonexisting file, fail exit code) # "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code) @@ -326,7 +326,7 @@ TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err # "h5clear -m -l h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code) # "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code) TOOLTEST h5clear_mdc_image.h5 -m "" $SUCCEED -TOOLTEST "" --vers "" $SUCCEED +TOOLTEST "" --version "" $SUCCEED TOOLTEST "" -k "" $FAIL TOOLTEST junk.h5 -k "" $FAIL TOOLTEST h5clear_sec2_v2.h5 -l "" $FAIL -- cgit v0.12 From acb186f6e5f0ac3e5bfb9501e3381c1968489a59 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Sat, 7 Aug 2021 08:55:23 -0500 Subject: Add parallel version of h5pfc script (#881) --- fortran/src/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index e59a829..316d3c7 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -582,4 +582,17 @@ if (NOT WIN32 AND NOT MINGW) PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT fortlibraries ) + if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5pfc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pfc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT fortlibraries + ) + endif () endif () -- cgit v0.12 From 06a09a962acd30527aac7f8922ac7b6c6a571874 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 10 Aug 2021 08:57:36 -0500 Subject: Reorg tools perform to provide h5perf for installation (#884) * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. * Flag cleanup and fix typos * Add comment * Correct VAR used to find configure time file * Set the path correctly * Update missing release note info. * Update code owners * Correct JIRA note * add known problem. * Use only core library for testing dynamic plugins. * Reorg tools perform to provide h5perf for installation * Correct file paths * Correct path * Add new src folder to makefile list * Remove bin_PROGRAMS from TEST_PROG * Default h5perf executables to static build * Remove test lib dependency from h5perf * format adjustments * Remove test lib from autotools makefile * Add note * h5perf needs the math library Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> --- MANIFEST | 17 +- configure.ac | 1 + release_docs/RELEASE.txt | 17 +- tools/src/CMakeLists.txt | 5 +- tools/src/Makefile.am | 2 +- tools/src/h5perf/CMakeLists.txt | 103 ++ tools/src/h5perf/Makefile.am | 63 + tools/src/h5perf/perf.c | 796 ++++++++++ tools/src/h5perf/pio_engine.c | 2745 +++++++++++++++++++++++++++++++++++ tools/src/h5perf/pio_perf.c | 1834 +++++++++++++++++++++++ tools/src/h5perf/pio_perf.h | 109 ++ tools/src/h5perf/sio_engine.c | 1328 +++++++++++++++++ tools/src/h5perf/sio_perf.c | 1437 ++++++++++++++++++ tools/src/h5perf/sio_perf.h | 104 ++ tools/test/perform/CMakeLists.txt | 81 +- tools/test/perform/Makefile.am | 23 +- tools/test/perform/perf.c | 471 ------ tools/test/perform/pio_engine.c | 2745 ----------------------------------- tools/test/perform/pio_perf.c | 1699 ---------------------- tools/test/perform/pio_perf.h | 100 -- tools/test/perform/pio_standalone.c | 135 -- tools/test/perform/pio_standalone.h | 11 - tools/test/perform/sio_engine.c | 1328 ----------------- tools/test/perform/sio_perf.c | 1437 ------------------ tools/test/perform/sio_perf.h | 104 -- tools/test/perform/sio_standalone.h | 11 - 26 files changed, 8558 insertions(+), 8148 deletions(-) create mode 100644 tools/src/h5perf/CMakeLists.txt create mode 100644 tools/src/h5perf/Makefile.am create mode 100644 tools/src/h5perf/perf.c create mode 100644 tools/src/h5perf/pio_engine.c create mode 100644 tools/src/h5perf/pio_perf.c create mode 100644 tools/src/h5perf/pio_perf.h create mode 100644 tools/src/h5perf/sio_engine.c create mode 100644 tools/src/h5perf/sio_perf.c create mode 100644 tools/src/h5perf/sio_perf.h delete mode 100644 tools/test/perform/perf.c delete mode 100644 tools/test/perform/pio_engine.c delete mode 100644 tools/test/perform/pio_perf.c delete mode 100644 tools/test/perform/pio_perf.h delete mode 100644 tools/test/perform/sio_engine.c delete mode 100644 tools/test/perform/sio_perf.c delete mode 100644 tools/test/perform/sio_perf.h diff --git a/MANIFEST b/MANIFEST index 0615fd0..668ba0a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2947,6 +2947,15 @@ ./tools/testfiles/h5mkgrp_single_p.ls ./tools/testfiles/h5mkgrp_single_l.ls +./tools/src/h5perf/Makefile.am +./tools/src/h5perf/perf.c +./tools/src/h5perf/pio_engine.c +./tools/src/h5perf/pio_perf.c +./tools/src/h5perf/pio_perf.h +./tools/src/h5perf/sio_engine.c +./tools/src/h5perf/sio_perf.c +./tools/src/h5perf/sio_perf.h + ./tools/test/perform/Makefile.am ./tools/test/perform/build_h5perf_alone.sh ./tools/test/perform/build_h5perf_serial_alone.sh @@ -2956,16 +2965,9 @@ ./tools/test/perform/gen_report.pl ./tools/test/perform/iopipe.c ./tools/test/perform/overhead.c -./tools/test/perform/perf.c ./tools/test/perform/perf_meta.c -./tools/test/perform/pio_engine.c -./tools/test/perform/pio_perf.c -./tools/test/perform/pio_perf.h ./tools/test/perform/pio_standalone.c ./tools/test/perform/pio_standalone.h -./tools/test/perform/sio_engine.c -./tools/test/perform/sio_perf.c -./tools/test/perform/sio_perf.h ./tools/test/perform/sio_standalone.c ./tools/test/perform/sio_standalone.h ./tools/test/perform/zip_perf.c @@ -3708,6 +3710,7 @@ ./tools/test/h5stat/CMakeLists.txt ./tools/test/h5stat/CMakeTests.cmake ./tools/src/misc/CMakeLists.txt +./tools/src/h5perf/CMakeLists.txt ./tools/test/misc/CMakeLists.txt ./tools/test/misc/CMakeTestsClear.cmake ./tools/test/misc/CMakeTestsMkgrp.cmake diff --git a/configure.ac b/configure.ac index 55ea12c..cbb192d 100644 --- a/configure.ac +++ b/configure.ac @@ -4019,6 +4019,7 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/test/misc/vds/Makefile tools/test/h5stat/Makefile tools/test/h5stat/testh5stat.sh + tools/src/h5perf/Makefile tools/test/perform/Makefile examples/Makefile examples/run-c-ex.sh diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index e12f652..40b9175 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -820,6 +820,17 @@ New Features Tools: ------ + - Refactored the perform tools and removed depends on test library. + + Moved the perf and h5perf tools from tools/test/perform to + tools/src/h5perf so that they can be installed. This required + that the test library dependency be removed by copying the + needed functions from h5test.c. + The standalone scripts and other perform tools remain in the + tools/test/perform folder. + + (ADB - 2021/08/10) + - Removed partial long exceptions Some of the tools accepted shortened versions of the long options @@ -1089,10 +1100,10 @@ Bug Fixes since HDF5-1.12.0 release Configuration ------------- - Better support for libaec (open-source Szip library) in CMake - - Implemented better support for libaec 1.0.5 (or later) library. This version + + Implemented better support for libaec 1.0.5 (or later) library. This version of libaec contains improvements for better integration with HDF5. Furthermore, - the variable USE_LIBAEC_STATIC has been introduced to allow to make use of + the variable USE_LIBAEC_STATIC has been introduced to allow to make use of static version of libaec library. Use libaec_DIR or libaec_ROOT to set the location in which libaec can be found. diff --git a/tools/src/CMakeLists.txt b/tools/src/CMakeLists.txt index 8c3e361..e291f61 100644 --- a/tools/src/CMakeLists.txt +++ b/tools/src/CMakeLists.txt @@ -13,7 +13,7 @@ add_subdirectory (misc) #-- Add the h5import and test executables add_subdirectory (h5import) -#-- h5Repack executables +#-- h5repack executables add_subdirectory (h5repack) #-- Add the h5dump and test executables @@ -30,3 +30,6 @@ add_subdirectory (h5dump) #-- Add the h5format_convert and test executables add_subdirectory (h5format_convert) + +#-- h5perf executables +add_subdirectory (h5perf) diff --git a/tools/src/Makefile.am b/tools/src/Makefile.am index 397bd31..5af7d06 100644 --- a/tools/src/Makefile.am +++ b/tools/src/Makefile.am @@ -23,6 +23,6 @@ CONFIG=ordered # All subdirectories SUBDIRS=h5diff h5ls h5dump misc h5import h5repack h5jam h5copy \ - h5format_convert h5stat + h5format_convert h5stat h5perf include $(top_srcdir)/config/conclude.am diff --git a/tools/src/h5perf/CMakeLists.txt b/tools/src/h5perf/CMakeLists.txt new file mode 100644 index 0000000..644a5ad --- /dev/null +++ b/tools/src/h5perf/CMakeLists.txt @@ -0,0 +1,103 @@ +cmake_minimum_required (VERSION 3.12) +project (HDF5_TOOLS_SRC_H5PERF C) + +# -------------------------------------------------------------------- +# Add the executables +# -------------------------------------------------------------------- +#-- Adding test for h5perf_serial +set (h5perf_serial_SOURCES + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_perf.c + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_engine.c +) +add_executable (h5perf_serial ${h5perf_serial_SOURCES}) +target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf_serial STATIC) + target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5perf_serial SHARED) + target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () +set_target_properties (h5perf_serial PROPERTIES FOLDER perform) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf_serial") + +set (H5_DEP_EXECUTABLES h5perf_serial) + +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_serial_FORMAT h5perf_serial) +endif () + +if (H5_HAVE_PARALLEL) + if (UNIX) + #-- Adding test for perf - only on unix systems + set (perf_SOURCES + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/perf.c + ) + add_executable (perf ${perf_SOURCES}) + target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (perf STATIC) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (perf SHARED) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () + set_target_properties (perf PROPERTIES FOLDER perform) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};perf") + + set (H5_DEP_EXECUTABLES perf) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_SRC_H5PERF_perf_FORMAT perf) + endif () + endif () + + #-- Adding test for h5perf + set (h5perf_SOURCES + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_perf.c + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_engine.c + ) + add_executable (h5perf ${h5perf_SOURCES}) + target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf STATIC) + target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5perf SHARED) + target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () + set_target_properties (h5perf PROPERTIES FOLDER perform) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf") + + set (H5_DEP_EXECUTABLES h5perf) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_FORMAT h5perf) + endif () +endif () + +#----------------------------------------------------------------------------- +# Rules for Installation of tools using make Install target +#----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () + + install ( + TARGETS + ${H5_DEP_EXECUTABLES} + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/src/h5perf/Makefile.am b/tools/src/h5perf/Makefile.am new file mode 100644 index 0000000..e8a9fdd --- /dev/null +++ b/tools/src/h5perf/Makefile.am @@ -0,0 +1,63 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Library Performance Makefile(.in) +# + +include $(top_srcdir)/config/commence.am + +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib + +# bin_PROGRAMS will be installed. +if BUILD_PARALLEL_CONDITIONAL + bin_PROGRAMS=h5perf_serial perf h5perf +else + bin_PROGRAMS=h5perf_serial +endif + +# Add h5perf and h5perf_serial specific linker flags here +h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) +h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) + +# Some programs are not built or run by default, but can be built by hand or by +# specifying --enable-build-all at configure time. +# Also, some of these programs should only be built in parallel. +# Currently there is no such program. +if BUILD_PARALLEL_CONDITIONAL + PARA_BUILD_ALL= +endif +if BUILD_ALL_CONDITIONAL + BUILD_ALL_PROGS=$(PARA_BUILD_ALL) +endif + +# Define programs that will be run in 'make check' +# List them in the order they should be run. +# Parallel test programs. +if BUILD_PARALLEL_CONDITIONAL + TEST_PROG_PARA=h5perf perf +endif + +h5perf_SOURCES=pio_perf.c pio_engine.c +h5perf_serial_SOURCES=sio_perf.c sio_engine.c + +# All of the programs depend on the main hdf5 library, and some of them +# depend on test or tools library. +LDADD=$(LIBHDF5) +h5perf_LDADD=$(LIBH5TOOLS) $(LIBHDF5) +h5perf_serial_LDADD=$(LIBH5TOOLS) $(LIBHDF5) +perf_LDADD=$(LIBHDF5) + +include $(top_srcdir)/config/conclude.am diff --git a/tools/src/h5perf/perf.c b/tools/src/h5perf/perf.c new file mode 100644 index 0000000..83d4ab0 --- /dev/null +++ b/tools/src/h5perf/perf.c @@ -0,0 +1,796 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Author: Albert Cheng of NCSA, May 1, 2001. + * This is derived from code given to me by Robert Ross. + * + * NOTE: This code assumes that all command line arguments make it out to all + * the processes that make up the parallel job, which isn't always the case. + * So if it doesn't work on some platform, that might be why. + */ + +#include "hdf5.h" +#include "H5private.h" + +#ifdef H5_HAVE_PARALLEL + +#include +#include +#include +#include +#include +#include + +#ifdef H5_HAVE_SYS_STAT_H +#include +#endif + +#ifdef H5_HAVE_SYS_TIME_H +#include +#endif + +#ifdef H5_HAVE_SYS_TYPES_H +#include +#endif + +#ifdef H5_HAVE_UNISTD_H +#include +#endif + +#include +#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ +#include +#endif + +/* Macro definitions */ +/* Verify: + * if val is false (0), print mesg and if fatal is true (non-zero), die. + */ +#define H5FATAL 1 +#define VRFY(val, mesg, fatal) \ + do { \ + if (!val) { \ + printf("Proc %d: ", mynod); \ + printf("*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \ + if (fatal) { \ + fflush(stdout); \ + goto die_jar_jar_die; \ + } \ + } \ + } while (0) +#define RANK 1 +#define MAX_PATH 1024 + +hsize_t dims[RANK]; /* dataset dim sizes */ +hsize_t block[RANK], stride[RANK], count[RANK]; +hsize_t start[RANK]; +hid_t fid; /* HDF5 file ID */ +hid_t acc_tpl; /* File access templates */ +hid_t sid; /* Dataspace ID */ +hid_t file_dataspace; /* File dataspace ID */ +hid_t mem_dataspace; /* memory dataspace ID */ +hid_t dataset; /* Dataset ID */ +hsize_t opt_alignment = 1; +hsize_t opt_threshold = 1; +int opt_split_vfd = 0; +char * meta_ext, *raw_ext; /* holds the meta and raw file extension if */ + /* opt_split_vfd is set */ + +/* DEFAULT VALUES FOR OPTIONS */ +int64_t opt_block = 1048576 * 16; +int opt_iter = 1; +int opt_stripe = -1; +int opt_correct = 0; +int amode = O_RDWR | O_CREAT; +char opt_file[256] = "perftest.out"; +char opt_pvfstab[256] = "notset"; +int opt_pvfstab_set = 0; + +const char *FILENAME[] = {opt_file, NULL}; + +/* function prototypes */ +static int parse_args(int argc, char **argv); + +#ifndef H5_HAVE_UNISTD_H +/* globals needed for getopt */ +extern char *optarg; +#endif + +#ifndef HDF5_PARAPREFIX +#define HDF5_PARAPREFIX "" +#endif +char * paraprefix = NULL; /* for command line option para-prefix */ +MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */ + +static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, + size_t size, hbool_t nest_printf, hbool_t subst_for_superblock); + +int +main(int argc, char **argv) +{ + char * buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check; + int i, j, mynod = 0, nprocs = 1, my_correct = 1, correct, myerrno; + double stim, etim; + double write_tim = 0; + double read_tim = 0; + double read_bw, write_bw; + double max_read_tim, max_write_tim; + double min_read_tim, min_write_tim; + double ave_read_tim, ave_write_tim; + int64_t iter_jump = 0; + char filename[MAX_PATH]; + herr_t ret; /* Generic return value */ + + /* startup MPI and determine the rank of this process */ + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + + /* parse the command line arguments */ + parse_args(argc, argv); + + if (mynod == 0) + printf("# Using hdf5-io calls.\n"); + +#ifdef H5_HAVE_UNISTD_H + /* Kind of a weird hack- if the location of the pvfstab file was + * specified on the command line, then spit out this location into + * the appropriate environment variable. + */ + if (opt_pvfstab_set) { + if ((setenv("PVFSTAB_FILE", opt_pvfstab, 1)) < 0) { + perror("setenv"); + goto die_jar_jar_die; + } + } +#endif + + /* this is how much of the file data is covered on each iteration of + * the test. used to help determine the seek offset on each + * iteration */ + iter_jump = nprocs * opt_block; + + /* setup a buffer of data to write */ + if (!(tmp = (char *)malloc((size_t)opt_block + 256))) { + perror("malloc"); + goto die_jar_jar_die; + } + buf = tmp + 128 - (((long)tmp) % 128); /* align buffer */ + + if (opt_correct) { + /* do the same buffer setup for verifiable data */ + if (!(tmp2 = (char *)malloc((size_t)opt_block + 256))) { + perror("malloc2"); + goto die_jar_jar_die; + } + buf2 = tmp + 128 - (((long)tmp) % 128); + } + + /* setup file access template with parallel IO access. */ + if (opt_split_vfd) { + hid_t mpio_pl; + + mpio_pl = H5Pcreate(H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment * opt_threshold != 1) { + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } + + /* setup file access template */ + acc_tpl = H5Pcreate(H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); + ret = H5Pclose(mpio_pl); + VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); + } + else { + /* setup file access template */ + acc_tpl = H5Pcreate(H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment * opt_threshold != 1) { + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } + } + + h5_fixname_real(FILENAME[0], acc_tpl, NULL, filename, sizeof filename, FALSE, FALSE); + + /* create the parallel file */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); + VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL); + + /* define a contiquous dataset of opt_iter*nprocs*opt_block chars */ + dims[0] = (hsize_t)opt_iter * (hsize_t)nprocs * (hsize_t)opt_block; + sid = H5Screate_simple(RANK, dims, NULL); + VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL); + dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL); + + /* create the memory dataspace and the file dataspace */ + dims[0] = (hsize_t)opt_block; + mem_dataspace = H5Screate_simple(RANK, dims, NULL); + VRFY((mem_dataspace >= 0), "", H5FATAL); + file_dataspace = H5Dget_space(dataset); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded", H5FATAL); + + /* now each process writes a block of opt_block chars in round robbin + * fashion until the whole dataset is covered. + */ + for (j = 0; j < opt_iter; j++) { + /* setup a file dataspace selection */ + start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); + stride[0] = block[0] = (hsize_t)opt_block; + count[0] = 1; + ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); + + if (opt_correct) /* fill in buffer for iteration */ { + for (i = mynod + j, check = buf; i < opt_block; i++, check++) + *check = (char)i; + } + + /* discover the starting time of the operation */ + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + + /* write data */ + ret = H5Dwrite(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf); + VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); + + /* discover the ending time of the operation */ + etim = MPI_Wtime(); + + write_tim += (etim - stim); + + /* we are done with this "write" iteration */ + } + + /* close dataset and file */ + ret = H5Dclose(dataset); + VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL); + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL); + + /* wait for everyone to synchronize at this point */ + MPI_Barrier(MPI_COMM_WORLD); + + /* reopen the file for reading */ + fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl); + VRFY((fid >= 0), "", H5FATAL); + + /* open the dataset */ + dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT); + VRFY((dataset >= 0), "H5Dopen succeeded", H5FATAL); + + /* we can re-use the same mem_dataspace and file_dataspace + * the H5Dwrite used since the dimension size is the same. + */ + + /* we are going to repeat the read the same pattern the write used */ + for (j = 0; j < opt_iter; j++) { + /* setup a file dataspace selection */ + start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); + stride[0] = block[0] = (hsize_t)opt_block; + count[0] = 1; + ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); + /* seek to the appropriate spot give the current iteration and + * rank within the MPI processes */ + + /* discover the start time */ + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + + /* read in the file data */ + if (!opt_correct) { + ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf); + } + else { + ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf2); + } + myerrno = errno; + + /* discover the end time */ + etim = MPI_Wtime(); + read_tim += (etim - stim); + VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); + + if (ret < 0) + HDfprintf(stderr, "node %d, read error, loc = %" PRId64 ": %s\n", mynod, mynod * opt_block, + strerror(myerrno)); + + /* if the user wanted to check correctness, compare the write + * buffer to the read buffer */ + if (opt_correct && memcmp(buf, buf2, (size_t)opt_block)) { + HDfprintf(stderr, "node %d, correctness test failed\n", mynod); + my_correct = 0; + MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD); + } + + /* we are done with this read iteration */ + } + + /* close dataset and file */ + ret = H5Dclose(dataset); + VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL); + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL); + ret = H5Pclose(acc_tpl); + VRFY((ret >= 0), "H5Pclose succeeded", H5FATAL); + + /* compute the read and write times */ + MPI_Allreduce(&read_tim, &max_read_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + MPI_Allreduce(&read_tim, &min_read_tim, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + MPI_Allreduce(&read_tim, &ave_read_tim, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + + /* calculate the average from the sum */ + ave_read_tim = ave_read_tim / nprocs; + + MPI_Allreduce(&write_tim, &max_write_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + MPI_Allreduce(&write_tim, &min_write_tim, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + MPI_Allreduce(&write_tim, &ave_write_tim, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + + /* calculate the average from the sum */ + ave_write_tim = ave_write_tim / nprocs; + + /* print out the results on one node */ + if (mynod == 0) { + read_bw = (double)((int64_t)(opt_block * nprocs * opt_iter)) / (max_read_tim * 1000000.0); + write_bw = (double)((int64_t)(opt_block * nprocs * opt_iter)) / (max_write_tim * 1000000.0); + + printf("nr_procs = %d, nr_iter = %d, blk_sz = %ld\n", nprocs, opt_iter, (long)opt_block); + + printf("# total_size = %ld\n", (long)(opt_block * nprocs * opt_iter)); + + printf("# Write: min_time = %f, max_time = %f, mean_time = %f\n", min_write_tim, max_write_tim, + ave_write_tim); + printf("# Read: min_time = %f, max_time = %f, mean_time = %f\n", min_read_tim, max_read_tim, + ave_read_tim); + + printf("Write bandwidth = %f Mbytes/sec\n", write_bw); + printf("Read bandwidth = %f Mbytes/sec\n", read_bw); + + if (opt_correct) { + printf("Correctness test %s.\n", correct ? "passed" : "failed"); + } + } + +die_jar_jar_die: + +#ifdef H5_HAVE_UNISTD + /* Clear the environment variable if it was set earlier */ + if (opt_pvfstab_set) { + unsetenv("PVFSTAB_FILE"); + } +#endif + + free(tmp); + if (opt_correct) + free(tmp2); + + MPI_Finalize(); + + return (0); +} + +static int +parse_args(int argc, char **argv) +{ + int c; + + while ((c = getopt(argc, argv, "s:b:i:f:p:a:2:c")) != EOF) { + switch (c) { + case 's': /* stripe */ + opt_stripe = atoi(optarg); + break; + case 'b': /* block size */ + opt_block = atoi(optarg); + break; + case 'i': /* iterations */ + opt_iter = atoi(optarg); + break; + case 'f': /* filename */ + strncpy(opt_file, optarg, 255); + FILENAME[0] = opt_file; + break; + case 'p': /* pvfstab file */ + strncpy(opt_pvfstab, optarg, 255); + opt_pvfstab_set = 1; + break; + case 'a': /* aligned allocation. + * syntax: -a/ + * e.g., -a4096/512 allocate at 4096 bytes + * boundary if request size >= 512. + */ + { + char *p; + + opt_alignment = (hsize_t)HDatoi(optarg); + if (NULL != (p = (char *)HDstrchr(optarg, '/'))) + opt_threshold = (hsize_t)HDatoi(p + 1); + } + HDfprintf(stdout, "alignment/threshold=%" PRIuHSIZE "/%" PRIuHSIZE "\n", opt_alignment, + opt_threshold); + break; + case '2': /* use 2-files, i.e., split file driver */ + opt_split_vfd = 1; + /* get meta and raw file extension. */ + /* syntax is , */ + meta_ext = raw_ext = optarg; + while (*raw_ext != '\0') { + if (*raw_ext == ',') { + *raw_ext = '\0'; + raw_ext++; + break; + } + raw_ext++; + } + printf("split-file-vfd used: %s,%s\n", meta_ext, raw_ext); + break; + case 'c': /* correctness */ + opt_correct = 1; + break; + case '?': /* unknown */ + default: + break; + } + } + + return (0); +} +/*------------------------------------------------------------------------- + * Function: getenv_all + * + * Purpose: Used to get the environment that the root MPI task has. + * name specifies which environment variable to look for + * val is the string to which the value of that environment + * variable will be copied. + * + * NOTE: The pointer returned by this function is only + * valid until the next call to getenv_all and the data + * stored there must be copied somewhere else before any + * further calls to getenv_all take place. + * + * Return: pointer to a string containing the value of the environment variable + * NULL if the varialbe doesn't exist in task 'root's environment. + * + * Programmer: Leon Arber + * 4/4/05 + * + * Modifications: + * Use original getenv if MPI is not initialized. This happens + * one uses the PHDF5 library to build a serial nature code. + * Albert 2006/04/07 + * + *------------------------------------------------------------------------- + */ +char * +getenv_all(MPI_Comm comm, int root, const char *name) +{ + int mpi_size, mpi_rank, mpi_initialized, mpi_finalized; + int len; + static char *env = NULL; + + HDassert(name); + + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); + + if (mpi_initialized && !mpi_finalized) { + MPI_Comm_rank(comm, &mpi_rank); + MPI_Comm_size(comm, &mpi_size); + HDassert(root < mpi_size); + + /* The root task does the getenv call + * and sends the result to the other tasks */ + if (mpi_rank == root) { + env = HDgetenv(name); + if (env) { + len = (int)HDstrlen(env); + MPI_Bcast(&len, 1, MPI_INT, root, comm); + MPI_Bcast(env, len, MPI_CHAR, root, comm); + } + else { + /* len -1 indicates that the variable was not in the environment */ + len = -1; + MPI_Bcast(&len, 1, MPI_INT, root, comm); + } + } + else { + MPI_Bcast(&len, 1, MPI_INT, root, comm); + if (len >= 0) { + if (env == NULL) + env = (char *)HDmalloc((size_t)len + 1); + else if (HDstrlen(env) < (size_t)len) + env = (char *)HDrealloc(env, (size_t)len + 1); + + MPI_Bcast(env, len, MPI_CHAR, root, comm); + env[len] = '\0'; + } + else { + if (env) + HDfree(env); + env = NULL; + } + } +#ifndef NDEBUG + MPI_Barrier(comm); +#endif + } + else { + /* use original getenv */ + if (env) + HDfree(env); + env = HDgetenv(name); + } /* end if */ + + return env; +} + +/*------------------------------------------------------------------------- + * Function: h5_fixname_real + * + * Purpose: Create a file name from a file base name like `test' and + * return it through the FULLNAME (at most SIZE characters + * counting the null terminator). The full name is created by + * prepending the contents of HDF5_PREFIX (separated from the + * base name by a slash) and appending a file extension based on + * the driver supplied, resulting in something like + * `ufs:/u/matzke/test.h5'. + * + * Return: Success: The FULLNAME pointer. + * + * Failure: NULL if BASENAME or FULLNAME is the null + * pointer or if FULLNAME isn't large enough for + * the result. + * + * Programmer: Robb Matzke + * Thursday, November 19, 1998 + * + *------------------------------------------------------------------------- + */ +static char * +h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size, + hbool_t nest_printf, hbool_t subst_for_superblock) +{ + const char *prefix = NULL; + const char *env = NULL; /* HDF5_DRIVER environment variable */ + char * ptr, last = '\0'; + const char *suffix = _suffix; + size_t i, j; + hid_t driver = -1; + int isppdriver = 0; /* if the driver is MPI parallel */ + + if (!base_name || !fullname || size < 1) + return NULL; + + HDmemset(fullname, 0, size); + + /* figure out the suffix */ + if (H5P_DEFAULT != fapl) { + if ((driver = H5Pget_driver(fapl)) < 0) + return NULL; + + if (suffix) { + if (H5FD_FAMILY == driver) { + if (subst_for_superblock) + suffix = "00000.h5"; + else + suffix = nest_printf ? "%%05d.h5" : "%05d.h5"; + } + else if (H5FD_MULTI == driver) { + + /* Get the environment variable, if it exists, in case + * we are using the split driver since both of those + * use the multi VFD under the hood. + */ + env = HDgetenv("HDF5_DRIVER"); +#ifdef HDF5_DRIVER + /* Use the environment variable, then the compile-time constant */ + if (!env) + env = HDF5_DRIVER; +#endif + if (env && !HDstrcmp(env, "split")) { + /* split VFD */ + if (subst_for_superblock) + suffix = "-m.h5"; + else + suffix = NULL; + } + else { + /* multi VFD */ + if (subst_for_superblock) + suffix = "-s.h5"; + else + suffix = NULL; + } + } + } + } + + /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX + * could be of value -1 if it is not defined. + */ + isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver); + + /* Check what prefix to use for test files. Process HDF5_PARAPREFIX and + * HDF5_PREFIX. + * Use different ones depending on parallel or serial driver used. + * (The #ifdef is needed to prevent compile failure in case MPI is not + * configured.) + */ + if (isppdriver) { + /* + * For parallel: + * First use command line option, then the environment + * variable, then try the constant + */ + static int explained = 0; + + prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX")); + + if (!prefix && !explained) { + /* print hint by process 0 once. */ + int mpi_rank; + + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + if (mpi_rank == 0) + HDprintf("*** Hint ***\n" + "You can use environment variable HDF5_PARAPREFIX to " + "run parallel test files in a\n" + "different directory or to add file type prefix. e.g.,\n" + " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" + " export HDF5_PARAPREFIX\n" + "*** End of Hint ***\n"); + + explained = TRUE; +#ifdef HDF5_PARAPREFIX + prefix = HDF5_PARAPREFIX; +#endif /* HDF5_PARAPREFIX */ + } + } + else { + /* + * For serial: + * First use the environment variable, then try the constant + */ + prefix = HDgetenv("HDF5_PREFIX"); + +#ifdef HDF5_PREFIX + if (!prefix) + prefix = HDF5_PREFIX; +#endif /* HDF5_PREFIX */ + } + + /* Prepend the prefix value to the base name */ + if (prefix && *prefix) { + if (isppdriver) { + /* This is a parallel system */ + char *subdir; + + if (!HDstrcmp(prefix, HDF5_PARAPREFIX)) { + /* + * If the prefix specifies the HDF5_PARAPREFIX directory, then + * default to using the "/tmp/$USER" or "/tmp/$LOGIN" + * directory instead. + */ + char *user, *login; + + user = HDgetenv("USER"); + login = HDgetenv("LOGIN"); + subdir = (user ? user : login); + + if (subdir) { + for (i = 0; i < size && prefix[i]; i++) + fullname[i] = prefix[i]; + + fullname[i++] = '/'; + + for (j = 0; i < size && subdir[j]; ++i, ++j) + fullname[i] = subdir[j]; + } + } + + if (!fullname[0]) { + /* We didn't append the prefix yet */ + HDstrncpy(fullname, prefix, size); + fullname[size - 1] = '\0'; + } + + if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) { + /* + * Append the base_name with a slash first. Multiple + * slashes are handled below. + */ + h5_stat_t buf; + + if (HDstat(fullname, &buf) < 0) + /* The directory doesn't exist just yet */ + if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) + /* + * We couldn't make the "/tmp/${USER,LOGIN}" + * subdirectory. Default to PREFIX's original + * prefix value. + */ + HDstrcpy(fullname, prefix); + + HDstrcat(fullname, "/"); + HDstrcat(fullname, base_name); + } + else { + /* Buffer is too small */ + return NULL; + } + } + else { + if (HDsnprintf(fullname, size, "%s/%s", prefix, base_name) == (int)size) + /* Buffer is too small */ + return NULL; + } + } + else if (HDstrlen(base_name) >= size) { + /* Buffer is too small */ + return NULL; + } + else { + HDstrcpy(fullname, base_name); + } + + /* Append a suffix */ + if (suffix) { + if (HDstrlen(fullname) + HDstrlen(suffix) >= size) + return NULL; + + HDstrcat(fullname, suffix); + } + + /* Remove any double slashes in the filename */ + for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) { + if (*ptr != '/' || last != '/') + fullname[j++] = *ptr; + + last = *ptr; + } + + return fullname; +} + +/* + * Local variables: + * c-indent-level: 3 + * c-basic-offset: 3 + * tab-width: 3 + * End: + */ + +#else /* H5_HAVE_PARALLEL */ +/* dummy program since H5_HAVE_PARALLEL is not configured in */ +int +main(int H5_ATTR_UNUSED argc, char H5_ATTR_UNUSED **argv) +{ + printf("No parallel performance because parallel is not configured in\n"); + return (0); +} +#endif /* H5_HAVE_PARALLEL */ diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c new file mode 100644 index 0000000..cac36d7 --- /dev/null +++ b/tools/src/h5perf/pio_engine.c @@ -0,0 +1,2745 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Author: Albert Cheng of NCSA, Oct 24, 2001. + */ + +#include "hdf5.h" + +#include +#include +#include +#include + +#ifdef H5_HAVE_UNISTD_H +#include +#include +#endif + +#ifdef H5_HAVE_SYS_STAT_H +#include +#endif + +#ifdef H5_HAVE_PARALLEL + +#include + +#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ +#include +#endif /* !MPI_FILE_NULL */ + +#include "pio_perf.h" + +/* Macro definitions */ + +#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 6 +#define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate(fd, name, type, space, dcpl) +#define H5DOPEN(fd, name) H5Dopen(fd, name) +#else +#define H5DCREATE(fd, name, type, space, dcpl) \ + H5Dcreate2(fd, name, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT) +#define H5DOPEN(fd, name) H5Dopen2(fd, name, H5P_DEFAULT) +#endif + +/* sizes of various items. these sizes won't change during program execution */ +/* The following three must have the same type */ +#define ELMT_H5_TYPE H5T_NATIVE_UCHAR + +#define GOTOERROR(errcode) \ + { \ + ret_code = errcode; \ + goto done; \ + } +#define ERRMSG(mesg) \ + { \ + HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ + HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \ + } + +/* verify: if val is false (0), print mesg. */ +#define VRFY(val, mesg) \ + do { \ + if (!val) { \ + ERRMSG(mesg); \ + GOTOERROR(FAIL); \ + } \ + } while (0) + +/* POSIX I/O macros */ +#ifdef H5_HAVE_WIN32_API +/* Can't link against the library, so this test will use the older, non-Unicode + * _open() call on Windows. + */ +#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__) +#endif /* H5_HAVE_WIN32_API */ +#define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600) +#define POSIXOPEN(fn, F) HDopen(fn, F, 0600) +#define POSIXCLOSE(F) HDclose(F) +#define POSIXSEEK(F, L) HDlseek(F, L, SEEK_SET) +#define POSIXWRITE(F, B, S) HDwrite(F, B, S) +#define POSIXREAD(F, B, S) HDread(F, B, S) + +enum { PIO_CREATE = 1, PIO_WRITE = 2, PIO_READ = 4 }; + +/* Global variables */ +static int clean_file_g = -1; /*whether to cleanup temporary test */ +/*files. -1 is not defined; */ +/*0 is no cleanup; 1 is do cleanup */ + +/* + * In a parallel machine, the filesystem suitable for compiling is + * unlikely a parallel file system that is suitable for parallel I/O. + * There is no standard pathname for the parallel file system. /tmp + * is about the best guess. + */ +#ifndef HDF5_PARAPREFIX +#define HDF5_PARAPREFIX "" +#endif /* !HDF5_PARAPREFIX */ + +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif /* !MIN */ + +/* the different types of file descriptors we can expect */ +typedef union _file_descr { + int posixfd; /* POSIX file handle*/ + MPI_File mpifd; /* MPI file */ + hid_t h5fd; /* HDF5 file */ +} file_descr; + +/* local functions */ +static char * pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size); +static herr_t do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts, + size_t buf_size, void *buffer); +static herr_t do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts, + size_t buf_size, void *buffer /*out*/); +static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags); +static herr_t do_fclose(iotype iot, file_descr *fd); +static void do_cleanupfile(iotype iot, char *fname); +static off_t sqrto(off_t); + +/* + * Function: do_pio + * Purpose: PIO Engine where Parallel IO are executed. + * Return: results + * Programmer: Albert Cheng, Bill Wendling 2001/12/12 + * Modifications: + * Added 2D testing (Christian Chilan, 10. August 2005) + */ +results +do_pio(parameters param) +{ + /* return codes */ + herr_t ret_code = 0; /*return code */ + results res; + + file_descr fd; + iotype iot; + + char fname[FILENAME_MAX]; + long nf; + long ndsets; + off_t nbytes; /*number of bytes per dataset */ + off_t snbytes; /*general dataset size */ + /*for 1D, it is the actual dataset size */ + /*for 2D, it is the size of a side of the dataset square */ + char * buffer = NULL; /*data buffer pointer */ + size_t buf_size; /*general buffer size in bytes */ + /*for 1D, it is the actual buffer size */ + /*for 2D, it is the length of the buffer rectangle */ + size_t blk_size; /*data block size in bytes */ + size_t bsize; /*actual buffer size */ + + /* HDF5 variables */ + herr_t hrc; /*HDF5 return code */ + + /* Sanity check parameters */ + + /* IO type */ + iot = param.io_type; + + switch (iot) { + case MPIO: + fd.mpifd = MPI_FILE_NULL; + res.timers = io_time_new(MPI_CLOCK); + break; + case POSIXIO: + fd.posixfd = -1; + res.timers = io_time_new(MPI_CLOCK); + break; + case PHDF5: + fd.h5fd = -1; + res.timers = io_time_new(MPI_CLOCK); + break; + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", iot); + GOTOERROR(FAIL); + } + + ndsets = param.num_dsets; /* number of datasets per file */ + nbytes = param.num_bytes; /* number of bytes per dataset */ + buf_size = param.buf_size; + blk_size = param.blk_size; + + if (!param.dim2d) { + snbytes = nbytes; /* General dataset size */ + bsize = buf_size; /* Actual buffer size */ + } + else { + snbytes = sqrto(nbytes); /* General dataset size */ + bsize = buf_size * blk_size; /* Actual buffer size */ + } + + if (param.num_files < 0) { + HDfprintf(stderr, "number of files must be >= 0 (%ld)\n", param.num_files); + GOTOERROR(FAIL); + } + + if (ndsets < 0) { + HDfprintf(stderr, "number of datasets per file must be >= 0 (%ld)\n", ndsets); + GOTOERROR(FAIL); + } + + if (param.num_procs <= 0) { + HDfprintf(stderr, "maximum number of process to use must be > 0 (%d)\n", param.num_procs); + GOTOERROR(FAIL); + } + + /* Validate transfer buffer size & block size*/ + if (blk_size <= 0) { + HDfprintf(stderr, "Transfer block size (%zu) must be > 0\n", blk_size); + GOTOERROR(FAIL); + } + if (buf_size <= 0) { + HDfprintf(stderr, "Transfer buffer size (%zu) must be > 0\n", buf_size); + GOTOERROR(FAIL); + } + if ((buf_size % blk_size) != 0) { + HDfprintf(stderr, + "Transfer buffer size (%zu) must be a multiple of the " + "interleaved I/O block size (%zu)\n", + buf_size, blk_size); + GOTOERROR(FAIL); + } + if ((snbytes % pio_mpi_nprocs_g) != 0) { + HDfprintf(stderr, + "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "number of processes (%d)\n", + (long long)snbytes, pio_mpi_nprocs_g); + GOTOERROR(FAIL); + } + + if (!param.dim2d) { + if (((size_t)(snbytes / pio_mpi_nprocs_g) % buf_size) != 0) { + HDfprintf(stderr, + "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "trasfer buffer size (%zu)\n", + (long long)(snbytes / pio_mpi_nprocs_g), buf_size); + GOTOERROR(FAIL); + } + } + else { + if (((size_t)snbytes % buf_size) != 0) { + HDfprintf(stderr, + "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "trasfer buffer size (%zu)\n", + (long long)snbytes, buf_size); + GOTOERROR(FAIL); + } + } + + /* Allocate transfer buffer */ + if ((buffer = malloc(bsize)) == NULL) { + HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", bsize); + GOTOERROR(FAIL); + } + + if (pio_debug_level >= 4) { + int myrank; + + MPI_Comm_rank(pio_comm_g, &myrank); + + /* output all of the times for all iterations */ + if (myrank == 0) + HDfprintf(output, "Timer details:\n"); + } + + for (nf = 1; nf <= param.num_files; nf++) { + /* + * Write performance measurement + */ + /* Open file for write */ + char base_name[256]; + + HDsprintf(base_name, "#pio_tmp_%lu", nf); + pio_create_filename(iot, base_name, fname, sizeof(fname)); + if (pio_debug_level > 0) + HDfprintf(output, "rank %d: data filename=%s\n", pio_mpi_rank_g, fname); + + /* Need barrier to make sure everyone starts at the same time */ + MPI_Barrier(pio_comm_g); + + io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); + hrc = do_fopen(¶m, fname, &fd, PIO_CREATE | PIO_WRITE); + + VRFY((hrc == SUCCESS), "do_fopen failed"); + + io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); + hrc = do_write(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); + io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); + + VRFY((hrc == SUCCESS), "do_write failed"); + + /* Close file for write */ + hrc = do_fclose(iot, &fd); + + io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); + VRFY((hrc == SUCCESS), "do_fclose failed"); + + if (!param.h5_write_only) { + /* + * Read performance measurement + */ + /* Need barrier to make sure everyone is done writing and has + * closed the file. Also to make sure everyone starts reading + * at the same time. + */ + MPI_Barrier(pio_comm_g); + + /* Open file for read */ + io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); + hrc = do_fopen(¶m, fname, &fd, PIO_READ); + + VRFY((hrc == SUCCESS), "do_fopen failed"); + + io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); + hrc = do_read(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); + io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); + VRFY((hrc == SUCCESS), "do_read failed"); + + /* Close file for read */ + hrc = do_fclose(iot, &fd); + + io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); + VRFY((hrc == SUCCESS), "do_fclose failed"); + } + + /* Need barrier to make sure everyone is done with the file */ + /* before it may be removed by do_cleanupfile */ + MPI_Barrier(pio_comm_g); + do_cleanupfile(iot, fname); + } + +done: + /* clean up */ + /* release HDF5 objects */ + + /* close any opened files */ + /* no remove(fname) because that should have happened normally. */ + switch (iot) { + case POSIXIO: + if (fd.posixfd != -1) + hrc = do_fclose(iot, &fd); + break; + case MPIO: + if (fd.mpifd != MPI_FILE_NULL) + hrc = do_fclose(iot, &fd); + break; + case PHDF5: + if (fd.h5fd != -1) + hrc = do_fclose(iot, &fd); + break; + default: + break; + } + + /* release generic resources */ + if (buffer) + HDfree(buffer); + res.ret_code = ret_code; + return res; +} + +/* + * Function: pio_create_filename + * Purpose: Create a new filename to write to. Determine the correct + * suffix to append to the filename by the type of I/O we're + * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if + * USER or LOGIN are specified in the environment. + * Return: Pointer to filename or NULL + * Programmer: Bill Wendling, 21. November 2001 + * Modifications: + */ +static char * +pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size) +{ + const char *prefix, *suffix = ""; + char * ptr, last = '\0'; + size_t i, j; + + if (!base_name || !fullname || size < 1) + return NULL; + + HDmemset(fullname, 0, size); + + switch (iot) { + case POSIXIO: + suffix = ".posix"; + break; + case MPIO: + suffix = ".mpio"; + break; + case PHDF5: + suffix = ".h5"; + break; + default: + break; + } + + /* First use the environment variable and then try the constant */ + prefix = HDgetenv("HDF5_PARAPREFIX"); + +#ifdef HDF5_PARAPREFIX + if (!prefix) + prefix = HDF5_PARAPREFIX; +#endif /* HDF5_PARAPREFIX */ + + /* Prepend the prefix value to the base name */ + if (prefix && *prefix) { + /* If the prefix specifies the HDF5_PARAPREFIX directory, then + * default to using the "/tmp/$USER" or "/tmp/$LOGIN" + * directory instead. */ + register char *user, *login, *subdir; + + user = HDgetenv("USER"); + login = HDgetenv("LOGIN"); + subdir = (user ? user : login); + + if (subdir) { + for (i = 0; i < size - 1 && prefix[i]; i++) + fullname[i] = prefix[i]; + + fullname[i++] = '/'; + + for (j = 0; i < size && subdir[j]; i++, j++) + fullname[i] = subdir[j]; + } + else { + /* We didn't append the prefix yet */ + HDstrncpy(fullname, prefix, size); + fullname[size - 1] = '\0'; + } + + if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) { + /* Append the base_name with a slash first. Multiple slashes are + * handled below. */ + h5_stat_t buf; + + if (HDstat(fullname, &buf) < 0) + /* The directory doesn't exist just yet */ + if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) { + /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory. + * Default to PREFIX's original prefix value. */ + HDstrcpy(fullname, prefix); + } + + HDstrcat(fullname, "/"); + HDstrcat(fullname, base_name); + } + else { + /* Buffer is too small */ + return NULL; + } + } + else if (HDstrlen(base_name) >= size) { + /* Buffer is too small */ + return NULL; + } + else { + HDstrcpy(fullname, base_name); + } + + /* Append a suffix */ + if (suffix) { + if (HDstrlen(fullname) + HDstrlen(suffix) >= size) + return NULL; + + HDstrcat(fullname, suffix); + } + + /* Remove any double slashes in the filename */ + for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) { + if (*ptr != '/' || last != '/') + fullname[j++] = *ptr; + + last = *ptr; + } + + return fullname; +} + +/* + * Function: do_write + * Purpose: Write the required amount of data to the file. + * Return: SUCCESS or FAIL + * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 + * Modifications: + * Added 2D testing (Christian Chilan, 10. August 2005) + */ +static herr_t +do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbytes, size_t buf_size, + void *buffer) +{ + int ret_code = SUCCESS; + int rc; /*routine return code */ + long ndset; + size_t blk_size; /* The block size to subdivide the xfer buffer into */ + off_t nbytes_xfer; /* Total number of bytes transferred so far */ + size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */ + size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */ + char dname[64]; + off_t dset_offset = 0; /*dataset offset in a file */ + off_t bytes_begin[2]; /*first elmt this process transfer */ + off_t bytes_count; /*number of elmts this process transfer */ + off_t snbytes = 0; /*size of a side of the dataset square */ + unsigned char *buf_p; /* Current buffer pointer */ + + /* POSIX variables */ + off_t file_offset; /* File offset of the next transfer */ + off_t file_offset_advance; /* File offset advance after each I/O operation */ + off_t posix_file_offset; /* Base file offset of the next transfer */ + + /* MPI variables */ + MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/ + MPI_Offset mpi_offset; /* Offset in MPI file */ + MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */ + MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */ + MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */ + MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */ + MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */ + MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */ + MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */ + MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */ + MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */ + MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */ + MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */ + MPI_Status mpi_status; + int mrc; /* MPI return code */ + + /* HDF5 variables */ + herr_t hrc; /*HDF5 return code */ + hsize_t h5dims[2]; /*dataset dim sizes */ + hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ + hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ + hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ + hsize_t h5block[2]; /*dataspace selection */ + hsize_t h5stride[2]; + hsize_t h5count[2]; + hsize_t h5start[2]; + hssize_t h5offset[2]; /* Selection offset within dataspace */ + hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ + + /* Get the parameters from the parameter block */ + blk_size = parms->blk_size; + + /* There are two kinds of transfer patterns, contiguous and interleaved. + * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n + * where n is rank of the last process. + * In contiguous pattern, data are accessed as + * 000...111...222...nnn... + * In interleaved pattern, data are accessed as + * 012...n012...n... + * These are all in the scope of one dataset. + */ + + /* 1D dataspace */ + if (!parms->dim2d) { + /* Contiguous Pattern: */ + if (!parms->interleaved) { + bytes_begin[0] = (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g); + } /* end if */ + /* Interleaved Pattern: */ + else { + bytes_begin[0] = (off_t)(blk_size * (size_t)pio_mpi_rank_g); + } /* end else */ + + /* Prepare buffer for verifying data */ + if (parms->verify) + memset(buffer, pio_mpi_rank_g + 1, buf_size); + } /* end if */ + /* 2D dataspace */ + else { + /* nbytes is always the number of bytes per dataset (1D or 2D). If the + dataspace is 2D, snbytes is the size of a side of the dataset square. + */ + snbytes = sqrto(nbytes); + + /* Contiguous Pattern: */ + if (!parms->interleaved) { + bytes_begin[0] = (off_t)((double)snbytes * pio_mpi_rank_g / pio_mpi_nprocs_g); + bytes_begin[1] = 0; + } /* end if */ + /* Interleaved Pattern: */ + else { + bytes_begin[0] = 0; + + if (!parms->h5_use_chunks || parms->io_type == PHDF5) + bytes_begin[1] = (off_t)(blk_size * (size_t)pio_mpi_rank_g); + else + bytes_begin[1] = (off_t)(blk_size * blk_size * (size_t)pio_mpi_rank_g); + } /* end else */ + + /* Prepare buffer for verifying data */ + if (parms->verify) + HDmemset(buffer, pio_mpi_rank_g + 1, buf_size * blk_size); + } /* end else */ + + /* Calculate the total number of bytes (bytes_count) to be + * transferred by this process. It may be different for different + * transfer pattern due to rounding to integral values. + */ + /* + * Calculate the beginning bytes of this process and the next. + * bytes_count is the difference between these two beginnings. + * This way, it eliminates any rounding errors. + * (This is tricky, don't mess with the formula, rounding errors + * can easily get introduced) */ + bytes_count = (off_t)(((double)nbytes * (pio_mpi_rank_g + 1)) / pio_mpi_nprocs_g) - + (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g); + + /* debug */ + if (pio_debug_level >= 4) { + HDprint_rank(output); + if (!parms->dim2d) { + HDfprintf(output, + "Debug(do_write): " + "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH + "d\n", + buf_size, (long long)bytes_begin[0], (long long)bytes_count); + } + else { + HDfprintf(output, + "Debug(do_write): " + "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH + "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], + (long long)bytes_count); + } + } + + /* I/O Access specific setup */ + switch (parms->io_type) { + case POSIXIO: + /* No extra setup */ + break; + + case MPIO: /* MPI-I/O setup */ + /* 1D dataspace */ + if (!parms->dim2d) { + /* Build block's derived type */ + mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_blk_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Build file's derived type */ + mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)pio_mpi_nprocs_g, mpi_blk_type, + &mpi_file_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit file type */ + mrc = MPI_Type_commit(&mpi_file_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Commit buffer type */ + mrc = MPI_Type_commit(&mpi_blk_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + } /* end if */ + /* 2D dataspace */ + else { + /* Build partial buffer derived type for contiguous access */ + + mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE, &mpi_partial_buffer_cont); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit partial buffer derived type */ + mrc = MPI_Type_commit(&mpi_partial_buffer_cont); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build contiguous file's derived type */ + mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes / buf_size), + mpi_partial_buffer_cont, &mpi_cont_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit contiguous file type */ + mrc = MPI_Type_commit(&mpi_cont_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build partial buffer derived type for interleaved access */ + mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_partial_buffer_inter); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit partial buffer derived type */ + mrc = MPI_Type_commit(&mpi_partial_buffer_inter); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build interleaved file's derived type */ + mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes / blk_size), + mpi_partial_buffer_inter, &mpi_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit interleaved file type */ + mrc = MPI_Type_commit(&mpi_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build full buffer derived type */ + mrc = MPI_Type_contiguous((int)(blk_size * buf_size), MPI_BYTE, &mpi_full_buffer); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit full buffer derived type */ + mrc = MPI_Type_commit(&mpi_full_buffer); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build full chunk derived type */ + mrc = MPI_Type_contiguous((int)(blk_size * blk_size), MPI_BYTE, &mpi_full_chunk); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit full chunk derived type */ + mrc = MPI_Type_commit(&mpi_full_chunk); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build chunk interleaved file's derived type */ + mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)((size_t)snbytes / blk_size), + mpi_full_chunk, &mpi_chunk_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit chunk interleaved file type */ + mrc = MPI_Type_commit(&mpi_chunk_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + } /* end else */ + break; + + case PHDF5: /* HDF5 setup */ + /* 1D dataspace */ + if (!parms->dim2d) { + if (nbytes > 0) { + /* define a contiguous dataset of nbytes native bytes */ + h5dims[0] = (hsize_t)nbytes; + h5dset_space_id = H5Screate_simple(1, h5dims, NULL); + VRFY((h5dset_space_id >= 0), "H5Screate_simple"); + + /* Set up the file dset space id to select the pattern to access */ + if (!parms->interleaved) { + /* Contiguous pattern */ + h5start[0] = (hsize_t)bytes_begin[0]; + h5stride[0] = h5block[0] = blk_size; + h5count[0] = buf_size / blk_size; + } /* end if */ + else { + /* Interleaved access pattern */ + /* Skip offset over blocks of other processes */ + h5start[0] = (hsize_t)bytes_begin[0]; + h5stride[0] = blk_size * (size_t)pio_mpi_nprocs_g; + h5block[0] = blk_size; + h5count[0] = buf_size / blk_size; + } /* end else */ + hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, + h5block); + VRFY((hrc >= 0), "H5Sselect_hyperslab"); + } /* end if */ + else { + h5dset_space_id = H5Screate(H5S_SCALAR); + VRFY((h5dset_space_id >= 0), "H5Screate"); + } /* end else */ + + /* Create the memory dataspace that corresponds to the xfer buffer */ + if (buf_size > 0) { + h5dims[0] = buf_size; + h5mem_space_id = H5Screate_simple(1, h5dims, NULL); + VRFY((h5mem_space_id >= 0), "H5Screate_simple"); + } /* end if */ + else { + h5mem_space_id = H5Screate(H5S_SCALAR); + VRFY((h5mem_space_id >= 0), "H5Screate"); + } /* end else */ + } /* end if */ + /* 2D dataspace */ + else { + if (nbytes > 0) { + /* define a contiguous dataset of nbytes native bytes */ + h5dims[0] = (hsize_t)snbytes; + h5dims[1] = (hsize_t)snbytes; + h5dset_space_id = H5Screate_simple(2, h5dims, NULL); + VRFY((h5dset_space_id >= 0), "H5Screate_simple"); + + /* Set up the file dset space id to select the pattern to access */ + if (!parms->interleaved) { + /* Contiguous pattern */ + h5start[0] = (hsize_t)bytes_begin[0]; + h5start[1] = (hsize_t)bytes_begin[1]; + h5stride[0] = 1; + h5stride[1] = h5block[0] = h5block[1] = blk_size; + h5count[0] = 1; + h5count[1] = buf_size / blk_size; + } /* end if */ + else { + /* Interleaved access pattern */ + /* Skip offset over blocks of other processes */ + h5start[0] = (hsize_t)bytes_begin[0]; + h5start[1] = (hsize_t)bytes_begin[1]; + h5stride[0] = blk_size; + h5stride[1] = blk_size * (size_t)pio_mpi_nprocs_g; + h5block[0] = h5block[1] = blk_size; + h5count[0] = buf_size / blk_size; + h5count[1] = 1; + } /* end else */ + hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, + h5block); + VRFY((hrc >= 0), "H5Sselect_hyperslab"); + } /* end if */ + else { + h5dset_space_id = H5Screate(H5S_SCALAR); + VRFY((h5dset_space_id >= 0), "H5Screate"); + } /* end else */ + + /* Create the memory dataspace that corresponds to the xfer buffer */ + if (buf_size > 0) { + if (!parms->interleaved) { + h5dims[0] = blk_size; + h5dims[1] = buf_size; + } + else { + h5dims[0] = buf_size; + h5dims[1] = blk_size; + } + h5mem_space_id = H5Screate_simple(2, h5dims, NULL); + VRFY((h5mem_space_id >= 0), "H5Screate_simple"); + } /* end if */ + else { + h5mem_space_id = H5Screate(H5S_SCALAR); + VRFY((h5mem_space_id >= 0), "H5Screate"); + } /* end else */ + } /* end else */ + + /* Create the dataset transfer property list */ + h5dxpl = H5Pcreate(H5P_DATASET_XFER); + if (h5dxpl < 0) { + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); + } + + /* Change to collective I/O, if asked */ + if (parms->collective) { + hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Property List Set failed\n"); + GOTOERROR(FAIL); + } /* end if */ + } /* end if */ + break; + + default: + break; + } /* end switch */ + + for (ndset = 1; ndset <= ndsets; ++ndset) { + + /* Calculate dataset offset within a file */ + + /* create dataset */ + switch (parms->io_type) { + case POSIXIO: + case MPIO: + /* both posix and mpi io just need dataset offset in file*/ + dset_offset = (ndset - 1) * nbytes; + break; + + case PHDF5: + h5dcpl = H5Pcreate(H5P_DATASET_CREATE); + if (h5dcpl < 0) { + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); + } + /* 1D dataspace */ + if (!parms->dim2d) { + /* Make the dataset chunked if asked */ + if (parms->h5_use_chunks) { + /* Set the chunk size to be the same as the buffer size */ + h5dims[0] = blk_size; + hrc = H5Pset_chunk(h5dcpl, 1, h5dims); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Property List Set failed\n"); + GOTOERROR(FAIL); + } /* end if */ + } /* end if */ + } /* end if */ + else { + /* 2D dataspace */ + if (parms->h5_use_chunks) { + /* Set the chunk size to be the same as the block size */ + h5dims[0] = blk_size; + h5dims[1] = blk_size; + hrc = H5Pset_chunk(h5dcpl, 2, h5dims); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Property List Set failed\n"); + GOTOERROR(FAIL); + } /* end if */ + } /* end if */ + } /* end else */ + + HDsprintf(dname, "Dataset_%ld", ndset); + h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, h5dcpl); + + if (h5ds_id < 0) { + HDfprintf(stderr, "HDF5 Dataset Create failed\n"); + GOTOERROR(FAIL); + } + + hrc = H5Pclose(h5dcpl); + /* verifying the close of the dcpl */ + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Property List Close failed\n"); + GOTOERROR(FAIL); + } + break; + + default: + break; + } + + /* The task is to transfer bytes_count bytes, starting at + * bytes_begin position, using transfer buffer of buf_size bytes. + * If interleaved, select buf_size at a time, in round robin + * fashion, according to number of process. Otherwise, select + * all bytes_count in contiguous. + */ + nbytes_xfer = 0; + + /* 1D dataspace */ + if (!parms->dim2d) { + /* Set base file offset for all I/O patterns and POSIX access */ + posix_file_offset = dset_offset + bytes_begin[0]; + + /* Set base file offset for all I/O patterns and MPI access */ + mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]); + } /* end if */ + else { + /* Set base file offset for all I/O patterns and POSIX access */ + posix_file_offset = dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]; + + /* Set base file offset for all I/O patterns and MPI access */ + mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]); + } /* end else */ + + /* Start "raw data" write timer */ + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); + + while (nbytes_xfer < bytes_count) { + /* Write */ + /* Calculate offset of write within a dataset/file */ + switch (parms->io_type) { + case POSIXIO: + /* 1D dataspace */ + if (!parms->dim2d) { + /* Contiguous pattern */ + if (!parms->interleaved) { + /* Compute file offset */ + file_offset = posix_file_offset + (off_t)nbytes_xfer; + + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; + VRFY((rc == 0), "POSIXSEEK"); + + /* check if all bytes are written */ + rc = ((ssize_t)buf_size == POSIXWRITE(fd->posixfd, buffer, buf_size)); + VRFY((rc != 0), "POSIXWRITE"); + + /* Advance global offset in dataset */ + nbytes_xfer += (ssize_t)buf_size; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Set the base of user's buffer */ + buf_p = (unsigned char *)buffer; + + /* Set the number of bytes to transfer this time */ + nbytes_toxfer = buf_size; + + /* Loop over the buffers to write */ + while (nbytes_toxfer > 0) { + /* Skip offset over blocks of other processes */ + file_offset = posix_file_offset + (off_t)(nbytes_xfer * pio_mpi_nprocs_g); + + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; + VRFY((rc == 0), "POSIXSEEK"); + + /* check if all bytes are written */ + rc = ((ssize_t)blk_size == POSIXWRITE(fd->posixfd, buf_p, blk_size)); + VRFY((rc != 0), "POSIXWRITE"); + + /* Advance location in buffer */ + buf_p += blk_size; + + /* Advance global offset in dataset */ + nbytes_xfer += (ssize_t)blk_size; + + /* Decrement number of bytes left this time */ + nbytes_toxfer -= blk_size; + } /* end while */ + } /* end else */ + } /* end if */ + /* 2D dataspace */ + else { + /* Contiguous storage */ + if (!parms->h5_use_chunks) { + /* Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute file offset */ + file_offset = posix_file_offset + + (off_t)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) * + (blk_size * (size_t)snbytes) + + (((size_t)nbytes_xfer / blk_size) % (size_t)snbytes)); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = buf_size; + + /* Global offset advance after each I/O operation */ + file_offset_advance = (off_t)snbytes; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Compute file offset */ + file_offset = + posix_file_offset + + (off_t)(((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) / + (size_t)snbytes) * + (buf_size * (size_t)snbytes) + + (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) % + (size_t)snbytes); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size; + + /* Global offset advance after each I/O operation */ + file_offset_advance = (off_t)snbytes; + } /* end else */ + } /* end if */ + /* Chunked storage */ + else { + /*Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute file offset */ + file_offset = posix_file_offset + (off_t)nbytes_xfer; + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size * buf_size; + + /* Global offset advance after each I/O operation */ + file_offset_advance = 0; + } /* end if */ + /*Interleaved access pattern */ + else { + /* Compute file offset */ + /* Before simplification */ + /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size) + *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size + *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size)) + *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */ + + file_offset = posix_file_offset + + (off_t)((((size_t)nbytes_xfer / (buf_size / blk_size) * + (size_t)pio_mpi_nprocs_g) / + ((size_t)snbytes * blk_size)) * + (buf_size * (size_t)snbytes) + + (((size_t)nbytes_xfer / (buf_size / blk_size)) * + (size_t)pio_mpi_nprocs_g) % + ((size_t)snbytes * blk_size)); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size * blk_size; + + /* Global offset advance after each I/O operation */ + /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */ + file_offset_advance = (off_t)snbytes * (off_t)blk_size; + } /* end else */ + } /* end else */ + + /* Common code for file access */ + + /* Set the base of user's buffer */ + buf_p = (unsigned char *)buffer; + + /* Set the number of bytes to transfer this time */ + nbytes_toxfer = buf_size * blk_size; + + /* Loop over portions of the buffer to write */ + while (nbytes_toxfer > 0) { + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; + VRFY((rc == 0), "POSIXSEEK"); + + /* check if all bytes are written */ + rc = ((ssize_t)nbytes_xfer_advance == + POSIXWRITE(fd->posixfd, buf_p, nbytes_xfer_advance)); + VRFY((rc != 0), "POSIXWRITE"); + + /* Advance location in buffer */ + buf_p += nbytes_xfer_advance; + + /* Advance global offset in dataset */ + nbytes_xfer += (ssize_t)nbytes_xfer_advance; + + /* Decrement number of bytes left this time */ + nbytes_toxfer -= nbytes_xfer_advance; + + /* Partially advance file offset */ + file_offset += file_offset_advance; + } /* end while */ + + } /* end else */ + + break; + + case MPIO: + /* 1D dataspace */ + if (!parms->dim2d) { + /* Independent file access */ + if (!parms->collective) { + /* Contiguous pattern */ + if (!parms->interleaved) { + /* Compute offset in file */ + mpi_offset = mpi_file_offset + nbytes_xfer; + + /* Perform independent write */ + mrc = + MPI_File_write_at(fd->mpifd, mpi_offset, buffer, + (int)(buf_size / blk_size), mpi_blk_type, &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); + + /* Advance global offset in dataset */ + nbytes_xfer += (ssize_t)buf_size; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Set the base of user's buffer */ + buf_p = (unsigned char *)buffer; + + /* Set the number of bytes to transfer this time */ + nbytes_toxfer = buf_size; + + /* Loop over the buffers to write */ + while (nbytes_toxfer > 0) { + /* Skip offset over blocks of other processes */ + mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g); + + /* Perform independent write */ + mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p, (int)1, + mpi_blk_type, &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); + + /* Advance location in buffer */ + buf_p += blk_size; + + /* Advance global offset in dataset */ + nbytes_xfer += (ssize_t)blk_size; + + /* Decrement number of bytes left this time */ + nbytes_toxfer -= blk_size; + } /* end while */ + } /* end else */ + } /* end if */ + /* Collective file access */ + else { + /* Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute offset in file */ + mpi_offset = mpi_file_offset + nbytes_xfer; + + /* Perform independent write */ + mrc = MPI_File_write_at_all(fd->mpifd, mpi_offset, buffer, + (int)(buf_size / blk_size), mpi_blk_type, + &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); + + /* Advance global offset in dataset */ + nbytes_xfer += (ssize_t)buf_size; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Compute offset in file */ + mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g); + + /* Set the file view */ + mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type, + (char *)"native", h5_io_info_g); + VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); + + /* Perform write */ + mrc = MPI_File_write_at_all(fd->mpifd, 0, buffer, (int)(buf_size / blk_size), + mpi_blk_type, &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); + + /* Advance global offset in dataset */ + nbytes_xfer += (ssize_t)buf_size; + } /* end else */ + } /* end else */ + } /* end if */ + /* 2D dataspace */ + else { + /* Contiguous storage */ + if (!parms->h5_use_chunks) { + /* Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute offset in file */ + mpi_offset = + mpi_file_offset + + (MPI_Offset)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) * + (blk_size * (size_t)snbytes)) + + (MPI_Offset)(((size_t)nbytes_xfer / blk_size) % (size_t)snbytes); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = buf_size; + + /* Global offset advance after each I/O operation */ + mpi_offset_advance = snbytes; + + /* MPI type to be used for collective access */ + mpi_collective_type = mpi_cont_type; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Compute offset in file */ + mpi_offset = + mpi_file_offset + + (MPI_Offset)( + ((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) / + (size_t)snbytes) * + (buf_size * (size_t)snbytes)) + + (MPI_Offset)( + (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) % + (size_t)snbytes); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size; + + /* Global offset advance after each I/O operation */ + mpi_offset_advance = snbytes; + + /* MPI type to be used for collective access */ + mpi_collective_type = mpi_inter_type; + } /* end else */ + } /* end if */ + /* Chunked storage */ + else { + /*Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute offset in file */ + mpi_offset = mpi_file_offset + nbytes_xfer; + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size * buf_size; + + /* Global offset advance after each I/O operation */ + mpi_offset_advance = 0; + + /* MPI type to be used for collective access */ + mpi_collective_type = mpi_full_buffer; + } /* end if */ + /*Interleaved access pattern */ + else { + /* Compute offset in file */ + /* Before simplification */ + /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size) + *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))* + (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+ + ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes + /blk_size*(blk_size*blk_size)); */ + mpi_offset = mpi_file_offset + + (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size) * + (size_t)pio_mpi_nprocs_g) / + ((size_t)snbytes * blk_size)) * + (buf_size * (size_t)snbytes)) + + (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size)) * + (size_t)pio_mpi_nprocs_g) % + ((size_t)snbytes * blk_size)); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size * blk_size; + + /* Global offset advance after each I/O operation */ + /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */ + mpi_offset_advance = (MPI_Offset)((size_t)snbytes * blk_size); + + /* MPI type to be used for collective access */ + mpi_collective_type = mpi_chunk_inter_type; + } /* end else */ + } /* end else */ + + /* Common code for independent file access */ + if (!parms->collective) { + /* Set the base of user's buffer */ + buf_p = (unsigned char *)buffer; + + /* Set the number of bytes to transfer this time */ + nbytes_toxfer = buf_size * blk_size; + + /* Loop over portions of the buffer to write */ + while (nbytes_toxfer > 0) { + /* Perform independent write */ + mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p, + (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); + + /* Advance location in buffer */ + buf_p += nbytes_xfer_advance; + + /* Advance global offset in dataset */ + nbytes_xfer += (ssize_t)nbytes_xfer_advance; + + /* Decrement number of bytes left this time */ + nbytes_toxfer -= nbytes_xfer_advance; + + /* Partially advance global offset in dataset */ + mpi_offset += mpi_offset_advance; + } /* end while */ + } /* end if */ + + /* Common code for collective file access */ + else { + /* Set the file view */ + mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type, + (char *)"native", h5_io_info_g); + VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); + + /* Perform write */ + MPI_File_write_at_all(fd->mpifd, 0, buffer, (int)(buf_size * blk_size), MPI_BYTE, + &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)buf_size * (off_t)blk_size; + } /* end else */ + + } /* end else */ + + break; + + case PHDF5: + /* 1D dataspace */ + if (!parms->dim2d) { + /* Set up the file dset space id to move the selection to process */ + if (!parms->interleaved) { + /* Contiguous pattern */ + h5offset[0] = nbytes_xfer; + } /* end if */ + else { + /* Interleaved access pattern */ + /* Skip offset over blocks of other processes */ + h5offset[0] = (nbytes_xfer * pio_mpi_nprocs_g); + } /* end else */ + hrc = H5Soffset_simple(h5dset_space_id, h5offset); + VRFY((hrc >= 0), "H5Soffset_simple"); + + /* Write the buffer out */ + hrc = + H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); + VRFY((hrc >= 0), "H5Dwrite"); + + /* Increment number of bytes transferred */ + nbytes_xfer += (ssize_t)buf_size; + } /* end if */ + /* 2D dataspace */ + else { + /* Set up the file dset space id to move the selection to process */ + if (!parms->interleaved) { + /* Contiguous pattern */ + h5offset[0] = + (hssize_t)(((size_t)nbytes_xfer / ((size_t)snbytes * blk_size)) * blk_size); + h5offset[1] = + (hssize_t)(((size_t)nbytes_xfer % ((size_t)snbytes * blk_size)) / blk_size); + + } /* end if */ + else { + /* Interleaved access pattern */ + /* Skip offset over blocks of other processes */ + h5offset[0] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) / + ((size_t)snbytes * buf_size)) * + buf_size); + h5offset[1] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) % + ((size_t)snbytes * buf_size)) / + buf_size); + + } /* end else */ + hrc = H5Soffset_simple(h5dset_space_id, h5offset); + VRFY((hrc >= 0), "H5Soffset_simple"); + + /* Write the buffer out */ + hrc = + H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); + VRFY((hrc >= 0), "H5Dwrite"); + + /* Increment number of bytes transferred */ + nbytes_xfer += (off_t)buf_size * (off_t)blk_size; + + } /* end else */ + + break; + + default: + break; + } /* switch (parms->io_type) */ + } /* end while */ + + /* Stop "raw data" write timer */ + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); + + /* Calculate write time */ + + /* Close dataset. Only HDF5 needs to do an explicit close. */ + if (parms->io_type == PHDF5) { + hrc = H5Dclose(h5ds_id); + + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Close failed\n"); + GOTOERROR(FAIL); + } + + h5ds_id = H5I_INVALID_HID; + } /* end if */ + } /* end for */ + +done: + /* release MPI-I/O objects */ + if (parms->io_type == MPIO) { + /* 1D dataspace */ + if (!parms->dim2d) { + /* Free file type */ + mrc = MPI_Type_free(&mpi_file_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free buffer type */ + mrc = MPI_Type_free(&mpi_blk_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + } /* end if */ + /* 2D dataspace */ + else { + /* Free partial buffer type for contiguous access */ + mrc = MPI_Type_free(&mpi_partial_buffer_cont); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free contiguous file type */ + mrc = MPI_Type_free(&mpi_cont_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free partial buffer type for interleaved access */ + mrc = MPI_Type_free(&mpi_partial_buffer_inter); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free interleaved file type */ + mrc = MPI_Type_free(&mpi_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free full buffer type */ + mrc = MPI_Type_free(&mpi_full_buffer); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free full chunk type */ + mrc = MPI_Type_free(&mpi_full_chunk); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free chunk interleaved file type */ + mrc = MPI_Type_free(&mpi_chunk_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + } /* end else */ + } /* end if */ + + /* release HDF5 objects */ + if (h5dset_space_id != -1) { + hrc = H5Sclose(h5dset_space_id); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); + ret_code = FAIL; + } + else { + h5dset_space_id = H5I_INVALID_HID; + } + } + + if (h5mem_space_id != -1) { + hrc = H5Sclose(h5mem_space_id); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); + ret_code = FAIL; + } + else { + h5mem_space_id = H5I_INVALID_HID; + } + } + + if (h5dxpl != -1) { + hrc = H5Pclose(h5dxpl); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); + ret_code = FAIL; + } + else { + h5dxpl = H5I_INVALID_HID; + } + } + + return ret_code; +} + +static off_t +sqrto(off_t x) +{ + double root_x = sqrt((double)x); + return (off_t)root_x; +} + +/* + * Function: do_read + * Purpose: read the required amount of data from the file. + * Return: SUCCESS or FAIL + * Programmer: Albert Cheng 2001/12/13 + * Modifications: + * Added 2D testing (Christian Chilan, 10. August 2005) + */ +static herr_t +do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbytes, size_t buf_size, + void *buffer /*out*/) +{ + int ret_code = SUCCESS; + int rc; /*routine return code */ + long ndset; + size_t blk_size; /* The block size to subdivide the xfer buffer into */ + size_t bsize; /* Size of the actual buffer */ + off_t nbytes_xfer; /* Total number of bytes transferred so far */ + size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */ + size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */ + char dname[64]; + off_t dset_offset = 0; /*dataset offset in a file */ + off_t bytes_begin[2]; /*first elmt this process transfer */ + off_t bytes_count; /*number of elmts this process transfer */ + off_t snbytes = 0; /*size of a side of the dataset square */ + unsigned char *buf_p; /* Current buffer pointer */ + + /* POSIX variables */ + off_t file_offset; /* File offset of the next transfer */ + off_t file_offset_advance; /* File offset advance after each I/O operation */ + off_t posix_file_offset; /* Base file offset of the next transfer */ + + /* MPI variables */ + MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/ + MPI_Offset mpi_offset; /* Offset in MPI file */ + MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */ + MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */ + MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */ + MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */ + MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */ + MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */ + MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */ + MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */ + MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */ + MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */ + MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */ + MPI_Status mpi_status; + int mrc; /* MPI return code */ + + /* HDF5 variables */ + herr_t hrc; /*HDF5 return code */ + hsize_t h5dims[2]; /*dataset dim sizes */ + hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ + hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ + hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ + hsize_t h5block[2]; /*dataspace selection */ + hsize_t h5stride[2]; + hsize_t h5count[2]; + hsize_t h5start[2]; + hssize_t h5offset[2]; /* Selection offset within dataspace */ + hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ + + /* Get the parameters from the parameter block */ + blk_size = parms->blk_size; + + /* There are two kinds of transfer patterns, contiguous and interleaved. + * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n + * where n is rank of the last process. + * In contiguous pattern, data are accessed as + * 000...111...222...nnn... + * In interleaved pattern, data are accessed as + * 012...n012...n... + * These are all in the scope of one dataset. + */ + + /* 1D dataspace */ + if (!parms->dim2d) { + bsize = buf_size; + /* Contiguous Pattern: */ + if (!parms->interleaved) { + bytes_begin[0] = (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g); + } /* end if */ + /* Interleaved Pattern: */ + else { + bytes_begin[0] = (off_t)blk_size * (off_t)pio_mpi_rank_g; + } /* end else */ + } /* end if */ + /* 2D dataspace */ + else { + /* nbytes is always the number of bytes per dataset (1D or 2D). If the + dataspace is 2D, snbytes is the size of a side of the 'dataset square'. + */ + snbytes = sqrto(nbytes); + + bsize = buf_size * blk_size; + + /* Contiguous Pattern: */ + if (!parms->interleaved) { + bytes_begin[0] = (off_t)((double)snbytes * pio_mpi_rank_g / pio_mpi_nprocs_g); + bytes_begin[1] = 0; + } /* end if */ + /* Interleaved Pattern: */ + else { + bytes_begin[0] = 0; + + if (!parms->h5_use_chunks || parms->io_type == PHDF5) + bytes_begin[1] = (off_t)blk_size * (off_t)pio_mpi_rank_g; + else + bytes_begin[1] = (off_t)blk_size * (off_t)blk_size * (off_t)pio_mpi_rank_g; + } /* end else */ + } /* end else */ + + /* Calculate the total number of bytes (bytes_count) to be + * transferred by this process. It may be different for different + * transfer pattern due to rounding to integral values. + */ + /* + * Calculate the beginning bytes of this process and the next. + * bytes_count is the difference between these two beginnings. + * This way, it eliminates any rounding errors. + * (This is tricky, don't mess with the formula, rounding errors + * can easily get introduced) */ + bytes_count = (off_t)(((double)nbytes * (pio_mpi_rank_g + 1)) / pio_mpi_nprocs_g) - + (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g); + + /* debug */ + if (pio_debug_level >= 4) { + HDprint_rank(output); + if (!parms->dim2d) { + HDfprintf(output, + "Debug(do_write): " + "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH + "d\n", + buf_size, (long long)bytes_begin[0], (long long)bytes_count); + } + else { + HDfprintf(output, + "Debug(do_write): " + "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH + "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], + (long long)bytes_count); + } + } + + /* I/O Access specific setup */ + switch (parms->io_type) { + case POSIXIO: + /* No extra setup */ + break; + + case MPIO: /* MPI-I/O setup */ + /* 1D dataspace */ + if (!parms->dim2d) { + /* Build block's derived type */ + mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_blk_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Build file's derived type */ + mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)pio_mpi_nprocs_g, mpi_blk_type, + &mpi_file_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit file type */ + mrc = MPI_Type_commit(&mpi_file_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Commit buffer type */ + mrc = MPI_Type_commit(&mpi_blk_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + } /* end if */ + /* 2D dataspace */ + else { + /* Build partial buffer derived type for contiguous access */ + mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE, &mpi_partial_buffer_cont); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit partial buffer derived type */ + mrc = MPI_Type_commit(&mpi_partial_buffer_cont); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build contiguous file's derived type */ + mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes / buf_size), + mpi_partial_buffer_cont, &mpi_cont_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit contiguous file type */ + mrc = MPI_Type_commit(&mpi_cont_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build partial buffer derived type for interleaved access */ + mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_partial_buffer_inter); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit partial buffer derived type */ + mrc = MPI_Type_commit(&mpi_partial_buffer_inter); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build interleaved file's derived type */ + mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes / blk_size), + mpi_partial_buffer_inter, &mpi_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit interleaved file type */ + mrc = MPI_Type_commit(&mpi_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build full buffer derived type */ + mrc = MPI_Type_contiguous((int)(blk_size * buf_size), MPI_BYTE, &mpi_full_buffer); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit full buffer derived type */ + mrc = MPI_Type_commit(&mpi_full_buffer); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build full chunk derived type */ + mrc = MPI_Type_contiguous((int)(blk_size * blk_size), MPI_BYTE, &mpi_full_chunk); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit full chunk derived type */ + mrc = MPI_Type_commit(&mpi_full_chunk); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + + /* Build chunk interleaved file's derived type */ + mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)((size_t)snbytes / blk_size), + mpi_full_chunk, &mpi_chunk_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); + + /* Commit chunk interleaved file type */ + mrc = MPI_Type_commit(&mpi_chunk_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); + } /* end else */ + break; + + case PHDF5: /* HDF5 setup */ + /* 1D dataspace */ + if (!parms->dim2d) { + if (nbytes > 0) { + /* define a contiguous dataset of nbytes native bytes */ + h5dims[0] = (hsize_t)nbytes; + h5dset_space_id = H5Screate_simple(1, h5dims, NULL); + VRFY((h5dset_space_id >= 0), "H5Screate_simple"); + + /* Set up the file dset space id to select the pattern to access */ + if (!parms->interleaved) { + /* Contiguous pattern */ + h5start[0] = (hsize_t)bytes_begin[0]; + h5stride[0] = h5block[0] = blk_size; + h5count[0] = buf_size / blk_size; + } /* end if */ + else { + /* Interleaved access pattern */ + /* Skip offset over blocks of other processes */ + h5start[0] = (hsize_t)bytes_begin[0]; + h5stride[0] = blk_size * (size_t)pio_mpi_nprocs_g; + h5block[0] = blk_size; + h5count[0] = buf_size / blk_size; + } /* end else */ + hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, + h5block); + VRFY((hrc >= 0), "H5Sselect_hyperslab"); + } /* end if */ + else { + h5dset_space_id = H5Screate(H5S_SCALAR); + VRFY((h5dset_space_id >= 0), "H5Screate"); + } /* end else */ + + /* Create the memory dataspace that corresponds to the xfer buffer */ + if (buf_size > 0) { + h5dims[0] = buf_size; + h5mem_space_id = H5Screate_simple(1, h5dims, NULL); + VRFY((h5mem_space_id >= 0), "H5Screate_simple"); + } /* end if */ + else { + h5mem_space_id = H5Screate(H5S_SCALAR); + VRFY((h5mem_space_id >= 0), "H5Screate"); + } /* end else */ + } /* end if */ + /* 2D dataspace */ + else { + if (nbytes > 0) { + /* define a contiguous dataset of nbytes native bytes */ + h5dims[0] = (hsize_t)snbytes; + h5dims[1] = (hsize_t)snbytes; + h5dset_space_id = H5Screate_simple(2, h5dims, NULL); + VRFY((h5dset_space_id >= 0), "H5Screate_simple"); + + /* Set up the file dset space id to select the pattern to access */ + if (!parms->interleaved) { + /* Contiguous pattern */ + h5start[0] = (hsize_t)bytes_begin[0]; + h5start[1] = (hsize_t)bytes_begin[1]; + h5stride[0] = 1; + h5stride[1] = h5block[0] = h5block[1] = blk_size; + h5count[0] = 1; + h5count[1] = buf_size / blk_size; + } /* end if */ + else { + /* Interleaved access pattern */ + /* Skip offset over blocks of other processes */ + h5start[0] = (hsize_t)bytes_begin[0]; + h5start[1] = (hsize_t)bytes_begin[1]; + h5stride[0] = blk_size; + h5stride[1] = blk_size * (size_t)pio_mpi_nprocs_g; + h5block[0] = h5block[1] = blk_size; + h5count[0] = buf_size / blk_size; + h5count[1] = 1; + } /* end else */ + hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, + h5block); + VRFY((hrc >= 0), "H5Sselect_hyperslab"); + } /* end if */ + else { + h5dset_space_id = H5Screate(H5S_SCALAR); + VRFY((h5dset_space_id >= 0), "H5Screate"); + } /* end else */ + + /* Create the memory dataspace that corresponds to the xfer buffer */ + if (buf_size > 0) { + if (!parms->interleaved) { + h5dims[0] = blk_size; + h5dims[1] = buf_size; + } + else { + h5dims[0] = buf_size; + h5dims[1] = blk_size; + } + h5mem_space_id = H5Screate_simple(2, h5dims, NULL); + VRFY((h5mem_space_id >= 0), "H5Screate_simple"); + } /* end if */ + else { + h5mem_space_id = H5Screate(H5S_SCALAR); + VRFY((h5mem_space_id >= 0), "H5Screate"); + } /* end else */ + } /* end else */ + + /* Create the dataset transfer property list */ + h5dxpl = H5Pcreate(H5P_DATASET_XFER); + if (h5dxpl < 0) { + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); + } + + /* Change to collective I/O, if asked */ + if (parms->collective) { + hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Property List Set failed\n"); + GOTOERROR(FAIL); + } /* end if */ + } /* end if */ + break; + + default: + break; + } /* end switch */ + + for (ndset = 1; ndset <= ndsets; ++ndset) { + + /* Calculate dataset offset within a file */ + + /* create dataset */ + switch (parms->io_type) { + case POSIXIO: + case MPIO: + /* both posix and mpi io just need dataset offset in file*/ + dset_offset = (ndset - 1) * nbytes; + break; + + case PHDF5: + HDsprintf(dname, "Dataset_%ld", ndset); + h5ds_id = H5DOPEN(fd->h5fd, dname); + if (h5ds_id < 0) { + HDfprintf(stderr, "HDF5 Dataset open failed\n"); + GOTOERROR(FAIL); + } + break; + + default: + break; + } + + /* The task is to transfer bytes_count bytes, starting at + * bytes_begin position, using transfer buffer of buf_size bytes. + * If interleaved, select buf_size at a time, in round robin + * fashion, according to number of process. Otherwise, select + * all bytes_count in contiguous. + */ + nbytes_xfer = 0; + + /* 1D dataspace */ + if (!parms->dim2d) { + /* Set base file offset for all I/O patterns and POSIX access */ + posix_file_offset = dset_offset + bytes_begin[0]; + + /* Set base file offset for all I/O patterns and MPI access */ + mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]); + } /* end if */ + else { + /* Set base file offset for all I/O patterns and POSIX access */ + posix_file_offset = dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]; + + /* Set base file offset for all I/O patterns and MPI access */ + mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]); + } /* end else */ + + /* Start "raw data" read timer */ + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); + + while (nbytes_xfer < bytes_count) { + /* Read */ + /* Calculate offset of read within a dataset/file */ + switch (parms->io_type) { + case POSIXIO: + /* 1D dataspace */ + if (!parms->dim2d) { + /* Contiguous pattern */ + if (!parms->interleaved) { + /* Compute file offset */ + file_offset = posix_file_offset + (off_t)nbytes_xfer; + + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; + VRFY((rc == 0), "POSIXSEEK"); + + /* check if all bytes are read */ + rc = ((ssize_t)buf_size == POSIXREAD(fd->posixfd, buffer, buf_size)); + VRFY((rc != 0), "POSIXREAD"); + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)buf_size; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Set the base of user's buffer */ + buf_p = (unsigned char *)buffer; + + /* Set the number of bytes to transfer this time */ + nbytes_toxfer = buf_size; + + /* Loop over the buffers to read */ + while (nbytes_toxfer > 0) { + /* Skip offset over blocks of other processes */ + file_offset = posix_file_offset + (off_t)(nbytes_xfer * pio_mpi_nprocs_g); + + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; + VRFY((rc == 0), "POSIXSEEK"); + + /* check if all bytes are read */ + rc = ((ssize_t)blk_size == POSIXREAD(fd->posixfd, buf_p, blk_size)); + VRFY((rc != 0), "POSIXREAD"); + + /* Advance location in buffer */ + buf_p += blk_size; + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)blk_size; + + /* Decrement number of bytes left this time */ + nbytes_toxfer -= blk_size; + } /* end while */ + } /* end else */ + } /* end if */ + /* 2D dataspace */ + else { + /* Contiguous storage */ + if (!parms->h5_use_chunks) { + /* Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute file offset */ + file_offset = posix_file_offset + + (off_t)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) * + (blk_size * (size_t)snbytes) + + (((size_t)nbytes_xfer / blk_size) % (size_t)snbytes)); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = buf_size; + + /* Global offset advance after each I/O operation */ + file_offset_advance = (off_t)snbytes; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Compute file offset */ + file_offset = + posix_file_offset + + (off_t)(((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) / + (size_t)snbytes) * + (buf_size * (size_t)snbytes) + + (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) % + (size_t)snbytes); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size; + + /* Global offset advance after each I/O operation */ + file_offset_advance = (off_t)snbytes; + } /* end else */ + } /* end if */ + /* Chunked storage */ + else { + /*Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute file offset */ + file_offset = posix_file_offset + (off_t)nbytes_xfer; + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size * buf_size; + + /* Global offset advance after each I/O operation */ + file_offset_advance = 0; + } /* end if */ + /*Interleaved access pattern */ + else { + /* Compute file offset */ + /* Before simplification */ + /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size) + *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size + *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size)) + *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */ + + file_offset = posix_file_offset + + (off_t)((((size_t)nbytes_xfer / (buf_size / blk_size) * + (size_t)pio_mpi_nprocs_g) / + ((size_t)snbytes * blk_size)) * + (buf_size * (size_t)snbytes) + + (((size_t)nbytes_xfer / (buf_size / blk_size)) * + (size_t)pio_mpi_nprocs_g) % + ((size_t)snbytes * blk_size)); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size * blk_size; + + /* Global offset advance after each I/O operation */ + /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */ + file_offset_advance = (off_t)((size_t)snbytes * blk_size); + } /* end else */ + } /* end else */ + + /* Common code for file access */ + + /* Set the base of user's buffer */ + buf_p = (unsigned char *)buffer; + + /* Set the number of bytes to transfer this time */ + nbytes_toxfer = buf_size * blk_size; + + /* Loop over portions of the buffer to read */ + while (nbytes_toxfer > 0) { + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; + VRFY((rc == 0), "POSIXSEEK"); + + /* check if all bytes are read */ + rc = ((ssize_t)nbytes_xfer_advance == + POSIXREAD(fd->posixfd, buf_p, nbytes_xfer_advance)); + VRFY((rc != 0), "POSIXREAD"); + + /* Advance location in buffer */ + buf_p += nbytes_xfer_advance; + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)nbytes_xfer_advance; + + /* Decrement number of bytes left this time */ + nbytes_toxfer -= nbytes_xfer_advance; + + /* Partially advance file offset */ + file_offset += file_offset_advance; + } /* end while */ + + } /* end else */ + break; + + case MPIO: + /* 1D dataspace */ + if (!parms->dim2d) { + /* Independent file access */ + if (!parms->collective) { + /* Contiguous pattern */ + if (!parms->interleaved) { + /* Compute offset in file */ + mpi_offset = mpi_file_offset + nbytes_xfer; + + /* Perform independent read */ + mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer, + (int)(buf_size / blk_size), mpi_blk_type, &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)buf_size; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Set the base of user's buffer */ + buf_p = (unsigned char *)buffer; + + /* Set the number of bytes to transfer this time */ + nbytes_toxfer = buf_size; + + /* Loop over the buffers to read */ + while (nbytes_toxfer > 0) { + /* Skip offset over blocks of other processes */ + mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g); + + /* Perform independent read */ + mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p, (int)1, mpi_blk_type, + &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); + + /* Advance location in buffer */ + buf_p += blk_size; + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)blk_size; + + /* Decrement number of bytes left this time */ + nbytes_toxfer -= blk_size; + } /* end while */ + } /* end else */ + } /* end if */ + /* Collective file access */ + else { + /* Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute offset in file */ + mpi_offset = mpi_file_offset + nbytes_xfer; + + /* Perform collective read */ + mrc = MPI_File_read_at_all(fd->mpifd, mpi_offset, buffer, + (int)(buf_size / blk_size), mpi_blk_type, + &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)buf_size; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Compute offset in file */ + mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g); + + /* Set the file view */ + mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type, + (char *)"native", h5_io_info_g); + VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); + + /* Perform collective read */ + mrc = MPI_File_read_at_all(fd->mpifd, 0, buffer, (int)(buf_size / blk_size), + mpi_blk_type, &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)buf_size; + } /* end else */ + } /* end else */ + } /* end if */ + /* 2D dataspace */ + else { + /* Contiguous storage */ + if (!parms->h5_use_chunks) { + /* Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute offset in file */ + mpi_offset = + mpi_file_offset + + (MPI_Offset)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) * + (blk_size * (size_t)snbytes)) + + (MPI_Offset)(((size_t)nbytes_xfer / blk_size) % (size_t)snbytes); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = buf_size; + + /* Global offset advance after each I/O operation */ + mpi_offset_advance = snbytes; + + /* MPI type to be used for collective access */ + mpi_collective_type = mpi_cont_type; + } /* end if */ + /* Interleaved access pattern */ + else { + /* Compute offset in file */ + mpi_offset = + mpi_file_offset + + (MPI_Offset)( + ((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) / + (size_t)snbytes) * + (buf_size * (size_t)snbytes)) + + (MPI_Offset)( + (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) % + (size_t)snbytes); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size; + + /* Global offset advance after each I/O operation */ + mpi_offset_advance = snbytes; + + /* MPI type to be used for collective access */ + mpi_collective_type = mpi_inter_type; + } /* end else */ + } /* end if */ + /* Chunked storage */ + else { + /*Contiguous access pattern */ + if (!parms->interleaved) { + /* Compute offset in file */ + mpi_offset = mpi_file_offset + nbytes_xfer; + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size * buf_size; + + /* Global offset advance after each I/O operation */ + mpi_offset_advance = 0; + + /* MPI type to be used for collective access */ + mpi_collective_type = mpi_full_buffer; + } /* end if */ + /*Interleaved access pattern */ + else { + /* Compute offset in file */ + /* Before simplification */ + /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size) + *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))* + (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+ + ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes + /blk_size*(blk_size*blk_size)); */ + mpi_offset = mpi_file_offset + + (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size) * + (size_t)pio_mpi_nprocs_g) / + ((size_t)snbytes * blk_size)) * + (buf_size * (size_t)snbytes)) + + (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size)) * + (size_t)pio_mpi_nprocs_g) % + ((size_t)snbytes * blk_size)); + + /* Number of bytes to be transferred per I/O operation */ + nbytes_xfer_advance = blk_size * blk_size; + + /* Global offset advance after each I/O operation */ + /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */ + mpi_offset_advance = (MPI_Offset)((size_t)snbytes * blk_size); + + /* MPI type to be used for collective access */ + mpi_collective_type = mpi_chunk_inter_type; + } /* end else */ + } /* end else */ + + /* Common code for independent file access */ + if (!parms->collective) { + /* Set the base of user's buffer */ + buf_p = (unsigned char *)buffer; + + /* Set the number of bytes to transfer this time */ + nbytes_toxfer = buf_size * blk_size; + + /* Loop over portions of the buffer to read */ + while (nbytes_toxfer > 0) { + /* Perform independent read */ + mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p, (int)nbytes_xfer_advance, + MPI_BYTE, &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); + + /* Advance location in buffer */ + buf_p += nbytes_xfer_advance; + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)nbytes_xfer_advance; + + /* Decrement number of bytes left this time */ + nbytes_toxfer -= nbytes_xfer_advance; + + /* Partially advance global offset in dataset */ + mpi_offset += mpi_offset_advance; + } /* end while */ + } /* end if */ + + /* Common code for collective file access */ + else { + /* Set the file view */ + mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type, + (char *)"native", h5_io_info_g); + VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); + + /* Perform read */ + MPI_File_read_at_all(fd->mpifd, 0, buffer, (int)(buf_size * blk_size), MPI_BYTE, + &mpi_status); + VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); + + /* Advance global offset in dataset */ + nbytes_xfer += (off_t)buf_size * (off_t)blk_size; + } /* end else */ + + } /* end else */ + break; + + case PHDF5: + /* 1D dataspace */ + if (!parms->dim2d) { + /* Set up the file dset space id to move the selection to process */ + if (!parms->interleaved) { + /* Contiguous pattern */ + h5offset[0] = nbytes_xfer; + } /* end if */ + else { + /* Interleaved access pattern */ + /* Skip offset over blocks of other processes */ + h5offset[0] = (nbytes_xfer * pio_mpi_nprocs_g); + } /* end else */ + hrc = H5Soffset_simple(h5dset_space_id, h5offset); + VRFY((hrc >= 0), "H5Soffset_simple"); + + /* Read the buffer in */ + hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); + VRFY((hrc >= 0), "H5Dread"); + + /* Increment number of bytes transferred */ + nbytes_xfer += (off_t)buf_size; + } /* end if */ + /* 2D dataspace */ + else { + /* Set up the file dset space id to move the selection to process */ + if (!parms->interleaved) { + /* Contiguous pattern */ + h5offset[0] = + (hssize_t)(((size_t)nbytes_xfer / ((size_t)snbytes * blk_size)) * blk_size); + h5offset[1] = + (hssize_t)(((size_t)nbytes_xfer % ((size_t)snbytes * blk_size)) / blk_size); + } /* end if */ + else { + /* Interleaved access pattern */ + /* Skip offset over blocks of other processes */ + h5offset[0] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) / + ((size_t)snbytes * buf_size)) * + buf_size); + h5offset[1] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) % + ((size_t)snbytes * buf_size)) / + buf_size); + + } /* end else */ + hrc = H5Soffset_simple(h5dset_space_id, h5offset); + VRFY((hrc >= 0), "H5Soffset_simple"); + + /* Write the buffer out */ + hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); + VRFY((hrc >= 0), "H5Dread"); + + /* Increment number of bytes transferred */ + nbytes_xfer += (off_t)buf_size * (off_t)blk_size; + + } /* end else */ + break; + + default: + break; + } /* switch (parms->io_type) */ + + /* Verify raw data, if asked */ + if (parms->verify) { + /* Verify data read */ + unsigned char *ucharptr = (unsigned char *)buffer; + size_t i; + int nerror = 0; + + for (i = 0; i < bsize; ++i) { + if (*ucharptr++ != pio_mpi_rank_g + 1) { + if (++nerror < 20) { + /* report at most 20 errors */ + HDprint_rank(output); + HDfprintf(output, + "read data error, expected (%d), " + "got (%d)\n", + pio_mpi_rank_g + 1, (int)*(ucharptr - 1)); + } /* end if */ + } /* end if */ + } /* end for */ + if (nerror >= 20) { + HDprint_rank(output); + HDfprintf(output, "..."); + HDfprintf(output, "total read data errors=%d\n", nerror); + } /* end if */ + } /* if (parms->verify) */ + + } /* end while */ + + /* Stop "raw data" read timer */ + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); + + /* Calculate read time */ + + /* Close dataset. Only HDF5 needs to do an explicit close. */ + if (parms->io_type == PHDF5) { + hrc = H5Dclose(h5ds_id); + + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Close failed\n"); + GOTOERROR(FAIL); + } + + h5ds_id = H5I_INVALID_HID; + } /* end if */ + } /* end for */ + +done: + /* release MPI-I/O objects */ + if (parms->io_type == MPIO) { + /* 1D dataspace */ + if (!parms->dim2d) { + /* Free file type */ + mrc = MPI_Type_free(&mpi_file_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free buffer type */ + mrc = MPI_Type_free(&mpi_blk_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + } /* end if */ + /* 2D dataspace */ + else { + /* Free partial buffer type for contiguous access */ + mrc = MPI_Type_free(&mpi_partial_buffer_cont); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free contiguous file type */ + mrc = MPI_Type_free(&mpi_cont_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free partial buffer type for interleaved access */ + mrc = MPI_Type_free(&mpi_partial_buffer_inter); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free interleaved file type */ + mrc = MPI_Type_free(&mpi_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free full buffer type */ + mrc = MPI_Type_free(&mpi_full_buffer); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free full chunk type */ + mrc = MPI_Type_free(&mpi_full_chunk); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + + /* Free chunk interleaved file type */ + mrc = MPI_Type_free(&mpi_chunk_inter_type); + VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); + } /* end else */ + } /* end if */ + + /* release HDF5 objects */ + if (h5dset_space_id != -1) { + hrc = H5Sclose(h5dset_space_id); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); + ret_code = FAIL; + } + else { + h5dset_space_id = H5I_INVALID_HID; + } + } + + if (h5mem_space_id != -1) { + hrc = H5Sclose(h5mem_space_id); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); + ret_code = FAIL; + } + else { + h5mem_space_id = H5I_INVALID_HID; + } + } + + if (h5dxpl != -1) { + hrc = H5Pclose(h5dxpl); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); + ret_code = FAIL; + } + else { + h5dxpl = H5I_INVALID_HID; + } + } + + return ret_code; +} + +/* + * Function: do_fopen + * Purpose: Open the specified file. + * Return: SUCCESS or FAIL + * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 + * Modifications: + */ +static herr_t +do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) +{ + int ret_code = SUCCESS, mrc; + hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */ + + switch (param->io_type) { + case POSIXIO: + if (flags & (PIO_CREATE | PIO_WRITE)) + fd->posixfd = POSIXCREATE(fname); + else + fd->posixfd = POSIXOPEN(fname, O_RDONLY); + + if (fd->posixfd < 0) { + HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname); + GOTOERROR(FAIL); + } + + /* The perils of POSIX I/O in a parallel environment. The problem is: + * + * - Process n opens a file with truncation and then starts + * writing to the file. + * - Process m also opens the file with truncation, but after + * process n has already started to write to the file. Thus, + * all of the stuff process n wrote is now lost. + */ + MPI_Barrier(pio_comm_g); + + break; + + case MPIO: + if (flags & (PIO_CREATE | PIO_WRITE)) { + MPI_File_delete(fname, h5_io_info_g); + mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR, h5_io_info_g, + &fd->mpifd); + + if (mrc != MPI_SUCCESS) { + HDfprintf(stderr, "MPI File Open failed(%s)\n", fname); + GOTOERROR(FAIL); + } + + /*since MPI_File_open with MPI_MODE_CREATE does not truncate */ + /*filesize , set size to 0 explicitedly. */ + mrc = MPI_File_set_size(fd->mpifd, (MPI_Offset)0); + if (mrc != MPI_SUCCESS) { + HDfprintf(stderr, "MPI_File_set_size failed\n"); + GOTOERROR(FAIL); + } + } + else { + mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY, h5_io_info_g, &fd->mpifd); + if (mrc != MPI_SUCCESS) { + HDfprintf(stderr, "MPI File Open failed(%s)\n", fname); + GOTOERROR(FAIL); + } + } + + break; + + case PHDF5: + if ((acc_tpl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); + } + + /* Set the file driver to the MPI-IO driver */ + if (H5Pset_fapl_mpio(acc_tpl, pio_comm_g, h5_io_info_g) < 0) { + HDfprintf(stderr, "HDF5 Property List Set failed\n"); + GOTOERROR(FAIL); + } + + /* Set the alignment of objects in HDF5 file */ + if (H5Pset_alignment(acc_tpl, param->h5_thresh, param->h5_align) < 0) { + HDfprintf(stderr, "HDF5 Property List Set failed\n"); + GOTOERROR(FAIL); + } + + /* create the parallel file */ + if (flags & (PIO_CREATE | PIO_WRITE)) + fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); + else + fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, acc_tpl); + if (fd->h5fd < 0) { + HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname); + GOTOERROR(FAIL); + } + + /* verifying the close of the acc_tpl */ + if (H5Pclose(acc_tpl) < 0) { + HDfprintf(stderr, "HDF5 Property List Close failed\n"); + GOTOERROR(FAIL); + } + + break; + + default: + break; + } + +done: + return ret_code; +} + +/* + * Function: do_fclose + * Purpose: Close the specified file descriptor. + * Return: SUCCESS or FAIL + * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 + * Modifications: + */ +static herr_t +do_fclose(iotype iot, file_descr *fd /*out*/) +{ + herr_t ret_code = SUCCESS, hrc; + int mrc = 0, rc = 0; + + switch (iot) { + case POSIXIO: + rc = POSIXCLOSE(fd->posixfd); + + if (rc != 0) { + HDfprintf(stderr, "POSIX File Close failed\n"); + GOTOERROR(FAIL); + } + + fd->posixfd = -1; + break; + + case MPIO: + mrc = MPI_File_close(&fd->mpifd); + + if (mrc != MPI_SUCCESS) { + HDfprintf(stderr, "MPI File close failed\n"); + GOTOERROR(FAIL); + } + + fd->mpifd = MPI_FILE_NULL; + break; + + case PHDF5: + hrc = H5Fclose(fd->h5fd); + + if (hrc < 0) { + HDfprintf(stderr, "HDF5 File Close failed\n"); + GOTOERROR(FAIL); + } + + fd->h5fd = -1; + break; + + default: + break; + } + +done: + return ret_code; +} + +/* + * Function: do_fclose + * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set. + * Only Proc 0 of the PIO communicator will do the cleanup. + * Other processes just return. + * Return: void + * Programmer: Albert Cheng 2001/12/12 + * Modifications: + */ +static void +do_cleanupfile(iotype iot, char *fname) +{ + if (pio_mpi_rank_g != 0) + return; + + if (clean_file_g == -1) + clean_file_g = (getenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0; + + if (clean_file_g) { + switch (iot) { + case POSIXIO: + HDremove(fname); + break; + case MPIO: + case PHDF5: + MPI_File_delete(fname, h5_io_info_g); + break; + default: + break; + } + } +} + +#ifdef TIME_MPI +/* instrument the MPI_File_wrirte_xxx and read_xxx calls to measure + * pure time spent in MPI_File code. + */ +int +MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, + MPI_Status *status) +{ + int err; + io_time_set(timer_g, HDF5_MPI_READ, TSTART); + err = PMPI_File_read_at(fh, offset, buf, count, datatype, status); + io_time_set(timer_g, HDF5_MPI_READ, TSTOP); + return err; +} + +int +MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, + MPI_Status *status) +{ + int err; + io_time_set(timer_g, HDF5_MPI_READ, TSTART); + err = PMPI_File_read_at_all(fh, offset, buf, count, datatype, status); + io_time_set(timer_g, HDF5_MPI_READ, TSTOP); + return err; +} + +int +MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, + MPI_Status *status) +{ + int err; + io_time_set(timer_g, HDF5_MPI_WRITE, TSTART); + err = PMPI_File_write_at(fh, offset, buf, count, datatype, status); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP); + return err; +} + +int +MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, + MPI_Status *status) +{ + int err; + io_time_set(timer_g, HDF5_MPI_WRITE, TSTART); + err = PMPI_File_write_at_all(fh, offset, buf, count, datatype, status); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP); + return err; +} + +#endif /* TIME_MPI */ +#endif /* H5_HAVE_PARALLEL */ diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c new file mode 100644 index 0000000..96cba2d --- /dev/null +++ b/tools/src/h5perf/pio_perf.c @@ -0,0 +1,1834 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Parallel HDF5 Performance Testing Code + * -------------------------------------- + * + * Portable code to test performance on the different platforms we support. + * This is what the report should look like: + * + * nprocs = Max#Procs + * IO API = POSIXIO + * # Files = 1, # of dsets = 1000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * # Files = 1, # of dsets = 3000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * + * . . . + * + * IO API = MPIO + * # Files = 1, # of dsets = 1000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * # Files = 1, # of dsets = 3000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * + * . . . + * + * IO API = PHDF5 + * # Files = 1, # of dsets = 1000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * # Files = 1, # of dsets = 3000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * + * . . . + * + * nprocs = Max#Procs / 2 + * + * . . . + * + */ + +/* system header files */ +#include +#include +#include + +#include "hdf5.h" + +#ifdef H5_HAVE_PARALLEL + +/* library header files */ +#include + +/* our header files */ +#include "pio_perf.h" + +/* useful macros */ +#define TAB_SPACE 4 + +#define ONE_KB 1024 +#define ONE_MB (ONE_KB * ONE_KB) +#define ONE_GB (ONE_MB * ONE_KB) + +#define PIO_POSIX 0x1 +#define PIO_MPI 0x2 +#define PIO_HDF5 0x4 + +#ifdef STANDALONE +#define DBL_EPSILON 2.2204460492503131e-16 +#define H5_DBL_ABS_EQUAL(X, Y) (fabs((X) - (Y)) < DBL_EPSILON) +#endif + +/* report 0.0 in case t is zero too */ +#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) + +#ifndef TRUE +#define TRUE 1 +#endif /* TRUE */ +#ifndef FALSE +#define FALSE (!TRUE) +#endif /* FALSE */ + +/* global variables */ +FILE * output; /* output file */ +int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ +int comm_world_nprocs_g; /* num. of processes of MPI_COMM_WORLD */ +MPI_Comm pio_comm_g; /* Communicator to run the PIO */ +int pio_mpi_rank_g; /* MPI rank of pio_comm_g */ +int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */ +int pio_debug_level = 0; /* The debug level: + * 0 - Off + * 1 - Minimal + * 2 - Some more + * 3 - Maximal + * 4 - Maximal & then some + */ + +/* local variables */ +static const char *progname = "h5perf"; + +#ifndef HDF5_PARAPREFIX +#define HDF5_PARAPREFIX "" +#endif +char * paraprefix = NULL; /* for command line option para-prefix */ +MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */ + +/* + * Command-line options: The user can specify short or long-named + * parameters. The long-named ones can be partially spelled. When + * adding more, make sure that they don't clash with each other. + */ +#if 1 +static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; +#else +static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; +#endif /* 1 */ +static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, + {"alig", require_arg, 'a'}, + {"ali", require_arg, 'a'}, + {"al", require_arg, 'a'}, + {"api", require_arg, 'A'}, + {"ap", require_arg, 'A'}, +#if 0 + /* a sighting of the elusive binary option */ + { "binary", no_arg, 'b' }, + { "binar", no_arg, 'b' }, + { "bina", no_arg, 'b' }, + { "bin", no_arg, 'b' }, + { "bi", no_arg, 'b' }, +#endif /* 0 */ + {"block-size", require_arg, 'B'}, + {"block-siz", require_arg, 'B'}, + {"block-si", require_arg, 'B'}, + {"block-s", require_arg, 'B'}, + {"block-", require_arg, 'B'}, + {"block", require_arg, 'B'}, + {"bloc", require_arg, 'B'}, + {"blo", require_arg, 'B'}, + {"bl", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"chun", no_arg, 'c'}, + {"chu", no_arg, 'c'}, + {"ch", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"collectiv", no_arg, 'C'}, + {"collecti", no_arg, 'C'}, + {"collect", no_arg, 'C'}, + {"collec", no_arg, 'C'}, + {"colle", no_arg, 'C'}, + {"coll", no_arg, 'C'}, + {"col", no_arg, 'C'}, + {"co", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"debu", require_arg, 'D'}, + {"deb", require_arg, 'D'}, + {"de", require_arg, 'D'}, + {"geometry", no_arg, 'g'}, + {"geometr", no_arg, 'g'}, + {"geomet", no_arg, 'g'}, + {"geome", no_arg, 'g'}, + {"geom", no_arg, 'g'}, + {"geo", no_arg, 'g'}, + {"ge", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"interleave", require_arg, 'I'}, + {"interleav", require_arg, 'I'}, + {"interlea", require_arg, 'I'}, + {"interle", require_arg, 'I'}, + {"interl", require_arg, 'I'}, + {"inter", require_arg, 'I'}, + {"inte", require_arg, 'I'}, + {"int", require_arg, 'I'}, + {"in", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"max-num-processe", require_arg, 'P'}, + {"max-num-process", require_arg, 'P'}, + {"max-num-proces", require_arg, 'P'}, + {"max-num-proce", require_arg, 'P'}, + {"max-num-proc", require_arg, 'P'}, + {"max-num-pro", require_arg, 'P'}, + {"max-num-pr", require_arg, 'P'}, + {"max-num-p", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"min-num-processe", require_arg, 'p'}, + {"min-num-process", require_arg, 'p'}, + {"min-num-proces", require_arg, 'p'}, + {"min-num-proce", require_arg, 'p'}, + {"min-num-proc", require_arg, 'p'}, + {"min-num-pro", require_arg, 'p'}, + {"min-num-pr", require_arg, 'p'}, + {"min-num-p", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"max-xfer-siz", require_arg, 'X'}, + {"max-xfer-si", require_arg, 'X'}, + {"max-xfer-s", require_arg, 'X'}, + {"max-xfer", require_arg, 'X'}, + {"max-xfe", require_arg, 'X'}, + {"max-xf", require_arg, 'X'}, + {"max-x", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"min-xfer-siz", require_arg, 'x'}, + {"min-xfer-si", require_arg, 'x'}, + {"min-xfer-s", require_arg, 'x'}, + {"min-xfer", require_arg, 'x'}, + {"min-xfe", require_arg, 'x'}, + {"min-xf", require_arg, 'x'}, + {"min-x", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-byte", require_arg, 'e'}, + {"num-byt", require_arg, 'e'}, + {"num-by", require_arg, 'e'}, + {"num-b", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-dset", require_arg, 'd'}, + {"num-dse", require_arg, 'd'}, + {"num-ds", require_arg, 'd'}, + {"num-d", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-file", require_arg, 'F'}, + {"num-fil", require_arg, 'F'}, + {"num-fi", require_arg, 'F'}, + {"num-f", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"num-iteration", require_arg, 'i'}, + {"num-iteratio", require_arg, 'i'}, + {"num-iterati", require_arg, 'i'}, + {"num-iterat", require_arg, 'i'}, + {"num-itera", require_arg, 'i'}, + {"num-iter", require_arg, 'i'}, + {"num-ite", require_arg, 'i'}, + {"num-it", require_arg, 'i'}, + {"num-i", require_arg, 'i'}, + {"output", require_arg, 'o'}, + {"outpu", require_arg, 'o'}, + {"outp", require_arg, 'o'}, + {"out", require_arg, 'o'}, + {"ou", require_arg, 'o'}, + {"threshold", require_arg, 'T'}, + {"threshol", require_arg, 'T'}, + {"thresho", require_arg, 'T'}, + {"thresh", require_arg, 'T'}, + {"thres", require_arg, 'T'}, + {"thre", require_arg, 'T'}, + {"thr", require_arg, 'T'}, + {"th", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {"write-onl", require_arg, 'w'}, + {"write-on", require_arg, 'w'}, + {"write-o", require_arg, 'w'}, + {"write", require_arg, 'w'}, + {"writ", require_arg, 'w'}, + {"wri", require_arg, 'w'}, + {"wr", require_arg, 'w'}, + {NULL, 0, '\0'}}; + +struct options { + long io_types; /* bitmask of which I/O types to test */ + const char *output_file; /* file to print report to */ + long num_dsets; /* number of datasets */ + long num_files; /* number of files */ + off_t num_bpp; /* number of bytes per proc per dset */ + int num_iters; /* number of iterations */ + int max_num_procs; /* maximum number of processes to use */ + int min_num_procs; /* minimum number of processes to use */ + size_t max_xfer_size; /* maximum transfer buffer size */ + size_t min_xfer_size; /* minimum transfer buffer size */ + size_t blk_size; /* Block size */ + unsigned interleaved; /* Interleaved vs. contiguous blocks */ + unsigned collective; /* Collective vs. independent I/O */ + unsigned dim2d; /* 1D vs. 2D geometry */ + int print_times; /* print times as well as throughputs */ + int print_raw; /* print raw data throughput info */ + off_t h5_alignment; /* alignment in HDF5 file */ + off_t h5_threshold; /* threshold for alignment in HDF5 file */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ + int verify; /* Verify data correctness */ +}; + +typedef struct _minmax { + double min; + double max; + double sum; + int num; +} minmax; + +/* local functions */ +static off_t parse_size_directive(const char *size); +static struct options *parse_command_line(int argc, char *argv[]); +static void run_test_loop(struct options *options); +static int run_test(iotype iot, parameters parms, struct options *opts); +static void output_all_info(minmax *mm, int count, int indent_level); +static void get_minmax(minmax *mm, double val); +static minmax accumulate_minmax_stuff(minmax *mm, int count); +static int create_comm_world(int num_procs, int *doing_pio); +static int destroy_comm_world(void); +static void output_results(const struct options *options, const char *name, minmax *table, int table_size, + off_t data_size); +static void output_times(const struct options *options, const char *name, minmax *table, int table_size); +static void output_report(const char *fmt, ...); +static void print_indent(register int indent); +static void usage(const char *prog); +static void report_parameters(struct options *opts); +static off_t squareo(off_t); + +/* + * Function: main + * Purpose: Start things up. Initialize MPI and then call the test looping + * function. + * Return: EXIT_SUCCESS or EXIT_FAILURE + * Programmer: Bill Wendling, 30. October 2001 + * Modifications: + */ +int +main(int argc, char *argv[]) +{ + int ret; + int exit_value = EXIT_SUCCESS; + struct options *opts = NULL; + +#ifndef STANDALONE + /* Initialize h5tools lib */ + h5tools_init(); +#endif + + output = stdout; + + /* initialize MPI and get the maximum num of processors we started with */ + MPI_Init(&argc, &argv); + ret = MPI_Comm_size(MPI_COMM_WORLD, &comm_world_nprocs_g); + + if (ret != MPI_SUCCESS) { + HDfprintf(stderr, "%s: MPI_Comm_size call failed\n", progname); + + if (ret == MPI_ERR_COMM) + HDfprintf(stderr, "invalid MPI communicator\n"); + else + HDfprintf(stderr, "invalid argument\n"); + + exit_value = EXIT_FAILURE; + goto finish; + } + + ret = MPI_Comm_rank(MPI_COMM_WORLD, &comm_world_rank_g); + + if (ret != MPI_SUCCESS) { + HDfprintf(stderr, "%s: MPI_Comm_rank call failed\n", progname); + + if (ret == MPI_ERR_COMM) + HDfprintf(stderr, "invalid MPI communicator\n"); + else + HDfprintf(stderr, "invalid argument\n"); + + exit_value = EXIT_FAILURE; + goto finish; + } + + pio_comm_g = MPI_COMM_WORLD; + + h5_set_info_object(); + opts = parse_command_line(argc, argv); + + if (!opts) { + exit_value = EXIT_FAILURE; + goto finish; + } + + if (opts->output_file) { + if ((output = HDfopen(opts->output_file, "w")) == NULL) { + HDfprintf(stderr, "%s: cannot open output file\n", progname); + perror(opts->output_file); + goto finish; + } + } + + if ((pio_debug_level == 0 && comm_world_rank_g == 0) || pio_debug_level > 0) + report_parameters(opts); + + run_test_loop(opts); + +finish: + MPI_Finalize(); + free(opts); + return exit_value; +} + +off_t +squareo(off_t x) +{ + return x * x; +} + +/* + * Function: run_test_loop + * Purpose: Run the I/O tests. Write the results to OUTPUT. + * + * - The slowest changing part of the test is the number of + * processors to use. For each loop iteration, we divide that + * number by 2 and rerun the test. + * + * - The second slowest is what type of IO API to perform. We have + * three choices: POSIXIO, MPI-IO, and PHDF5. + * + * - Then we change the size of the buffer. This information is + * inferred from the number of datasets to create and the number + * of integers to put into each dataset. The backend code figures + * this out. + * + * Return: Nothing + * Programmer: Bill Wendling, 30. October 2001 + * Modifications: + * Added 2D testing (Christian Chilan, 10. August 2005) + */ +static void +run_test_loop(struct options *opts) +{ + parameters parms; + int num_procs; + int doing_pio; /* if this process is doing PIO */ + + parms.num_files = opts->num_files; + parms.num_dsets = opts->num_dsets; + parms.num_iters = opts->num_iters; + parms.blk_size = opts->blk_size; + parms.interleaved = opts->interleaved; + parms.collective = opts->collective; + parms.dim2d = opts->dim2d; + parms.h5_align = (hsize_t)opts->h5_alignment; + parms.h5_thresh = (hsize_t)opts->h5_threshold; + parms.h5_use_chunks = opts->h5_use_chunks; + parms.h5_write_only = opts->h5_write_only; + parms.verify = opts->verify; + + /* start with max_num_procs and decrement it by half for each loop. */ + /* if performance needs restart, fewer processes may be needed. */ + for (num_procs = opts->max_num_procs; num_procs >= opts->min_num_procs; num_procs >>= 1) { + register size_t buf_size; + + parms.num_procs = num_procs; + + if (create_comm_world(parms.num_procs, &doing_pio) != SUCCESS) { + /* do something harsh */ + } + + /* only processes doing PIO will run the tests */ + if (doing_pio) { + output_report("Number of processors = %ld\n", parms.num_procs); + + /* multiply the xfer buffer size by 2 for each loop iteration */ + for (buf_size = opts->min_xfer_size; buf_size <= opts->max_xfer_size; buf_size <<= 1) { + parms.buf_size = buf_size; + + if (parms.dim2d) { + parms.num_bytes = squareo(opts->num_bpp * parms.num_procs); + if (parms.interleaved) + output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", buf_size, + opts->blk_size, + ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); + else + output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", + opts->blk_size, buf_size, + ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); + + print_indent(1); + output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2fx%.2f KB\n", + parms.num_files, parms.num_dsets, + (double)(opts->num_bpp * parms.num_procs) / ONE_KB, + (double)(opts->num_bpp * parms.num_procs) / ONE_KB); + } + else { + parms.num_bytes = (off_t)opts->num_bpp * parms.num_procs; + output_report("Transfer Buffer Size: %ld bytes, File size: %.2f MB\n", buf_size, + ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); + + print_indent(1); + output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2f MB\n", + parms.num_files, parms.num_dsets, + (double)(opts->num_bpp * parms.num_procs) / ONE_MB); + } + + if (opts->io_types & PIO_POSIX) + run_test(POSIXIO, parms, opts); + + if (opts->io_types & PIO_MPI) + run_test(MPIO, parms, opts); + + if (opts->io_types & PIO_HDF5) + run_test(PHDF5, parms, opts); + + /* Run the tests once if buf_size==0, but then break out */ + if (buf_size == 0) + break; + } + + if (destroy_comm_world() != SUCCESS) { + /* do something harsh */ + } + } + } +} + +/* + * Function: run_test + * Purpose: Inner loop call to actually run the I/O test. + * Return: Nothing + * Programmer: Bill Wendling, 18. December 2001 + * Modifications: + */ +static int +run_test(iotype iot, parameters parms, struct options *opts) +{ + results res; + register int i, ret_value = SUCCESS; + int comm_size; + off_t raw_size; + minmax * write_mpi_mm_table = NULL; + minmax * write_mm_table = NULL; + minmax * write_gross_mm_table = NULL; + minmax * write_raw_mm_table = NULL; + minmax * read_mpi_mm_table = NULL; + minmax * read_mm_table = NULL; + minmax * read_gross_mm_table = NULL; + minmax * read_raw_mm_table = NULL; + minmax * read_open_mm_table = NULL; + minmax * read_close_mm_table = NULL; + minmax * write_open_mm_table = NULL; + minmax * write_close_mm_table = NULL; + minmax write_mpi_mm = {0.0, 0.0, 0.0, 0}; + minmax write_mm = {0.0, 0.0, 0.0, 0}; + minmax write_gross_mm = {0.0, 0.0, 0.0, 0}; + minmax write_raw_mm = {0.0, 0.0, 0.0, 0}; + minmax read_mpi_mm = {0.0, 0.0, 0.0, 0}; + minmax read_mm = {0.0, 0.0, 0.0, 0}; + minmax read_gross_mm = {0.0, 0.0, 0.0, 0}; + minmax read_raw_mm = {0.0, 0.0, 0.0, 0}; + minmax read_open_mm = {0.0, 0.0, 0.0, 0}; + minmax read_close_mm = {0.0, 0.0, 0.0, 0}; + minmax write_open_mm = {0.0, 0.0, 0.0, 0}; + minmax write_close_mm = {0.0, 0.0, 0.0, 0}; + + raw_size = parms.num_files * (off_t)parms.num_dsets * (off_t)parms.num_bytes; + parms.io_type = iot; + print_indent(2); + output_report("IO API = "); + + switch (iot) { + case POSIXIO: + output_report("POSIX\n"); + break; + case MPIO: + output_report("MPIO\n"); + break; + case PHDF5: + output_report("PHDF5 (w/MPI-IO driver)\n"); + break; + default: + break; + } + + MPI_Comm_size(pio_comm_g, &comm_size); + + /* allocate space for tables minmax and that it is sufficient */ + /* to initialize all elements to zeros by calloc. */ + write_mpi_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_gross_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_raw_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_open_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_close_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + if (!parms.h5_write_only) { + read_mpi_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_gross_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_raw_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_open_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_close_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + } + + /* Do IO iteration times, collecting statistics each time */ + for (i = 0; i < parms.num_iters; ++i) { + double t; + + MPI_Barrier(pio_comm_g); + res = do_pio(parms); + + /* gather all of the "mpi write" times */ + t = io_time_get(res.timers, HDF5_MPI_WRITE); + get_minmax(&write_mpi_mm, t); + + write_mpi_mm_table[i] = write_mpi_mm; + + /* gather all of the "write" times */ + t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); + get_minmax(&write_mm, t); + + write_mm_table[i] = write_mm; + + /* gather all of the "write" times from open to close */ + t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); + get_minmax(&write_gross_mm, t); + + write_gross_mm_table[i] = write_gross_mm; + + /* gather all of the raw "write" times */ + t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); + get_minmax(&write_raw_mm, t); + + write_raw_mm_table[i] = write_raw_mm; + + /* gather all of the file open times (time from open to first write) */ + t = io_time_get(res.timers, HDF5_FILE_WRITE_OPEN); + get_minmax(&write_open_mm, t); + + write_open_mm_table[i] = write_open_mm; + + /* gather all of the file close times (time from last write to close) */ + t = io_time_get(res.timers, HDF5_FILE_WRITE_CLOSE); + get_minmax(&write_close_mm, t); + + write_close_mm_table[i] = write_close_mm; + + if (!parms.h5_write_only) { + /* gather all of the "mpi read" times */ + t = io_time_get(res.timers, HDF5_MPI_READ); + get_minmax(&read_mpi_mm, t); + + read_mpi_mm_table[i] = read_mpi_mm; + + /* gather all of the "read" times */ + t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS); + get_minmax(&read_mm, t); + + read_mm_table[i] = read_mm; + + /* gather all of the "read" times from open to close */ + t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS); + get_minmax(&read_gross_mm, t); + + read_gross_mm_table[i] = read_gross_mm; + + /* gather all of the raw "read" times */ + t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS); + get_minmax(&read_raw_mm, t); + + read_raw_mm_table[i] = read_raw_mm; + + /* gather all of the file open times (time from open to first read) */ + t = io_time_get(res.timers, HDF5_FILE_READ_OPEN); + get_minmax(&read_open_mm, t); + + read_open_mm_table[i] = read_open_mm; + + /* gather all of the file close times (time from last read to close) */ + t = io_time_get(res.timers, HDF5_FILE_READ_CLOSE); + get_minmax(&read_close_mm, t); + + read_close_mm_table[i] = read_close_mm; + } + + io_time_destroy(res.timers); + } + + /* + * Show various statistics + */ + /* Write statistics */ + /* Print the raw data throughput if desired */ + if (opts->print_raw) { + /* accumulate and output the max, min, and average "raw write" times */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Raw Data Write details:\n"); + output_all_info(write_raw_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size); + } /* end if */ + + /* show mpi write statics */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("MPI Write details:\n"); + output_all_info(write_mpi_mm_table, parms.num_iters, 4); + } + + /* We don't currently output the MPI write results */ + + /* accumulate and output the max, min, and average "write" times */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Write details:\n"); + output_all_info(write_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Write", write_mm_table, parms.num_iters, raw_size); + + /* accumulate and output the max, min, and average "gross write" times */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Write Open-Close details:\n"); + output_all_info(write_gross_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Write Open-Close", write_gross_mm_table, parms.num_iters, raw_size); + + if (opts->print_times) { + output_times(opts, "Write File Open", write_open_mm_table, parms.num_iters); + output_times(opts, "Write File Close", write_close_mm_table, parms.num_iters); + } + + /* Print out time from open to first write */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Write file open details:\n"); + output_all_info(write_open_mm_table, parms.num_iters, 4); + } + + /* Print out time from last write to close */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Write file close details:\n"); + output_all_info(write_close_mm_table, parms.num_iters, 4); + } + + if (!parms.h5_write_only) { + /* Read statistics */ + /* Print the raw data throughput if desired */ + if (opts->print_raw) { + /* accumulate and output the max, min, and average "raw read" times */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Raw Data Read details:\n"); + output_all_info(read_raw_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size); + } /* end if */ + + /* show mpi read statics */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("MPI Read details:\n"); + output_all_info(read_mpi_mm_table, parms.num_iters, 4); + } + + /* We don't currently output the MPI read results */ + + /* accumulate and output the max, min, and average "read" times */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Read details:\n"); + output_all_info(read_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Read", read_mm_table, parms.num_iters, raw_size); + + /* accumulate and output the max, min, and average "gross read" times */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Read Open-Close details:\n"); + output_all_info(read_gross_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Read Open-Close", read_gross_mm_table, parms.num_iters, raw_size); + + if (opts->print_times) { + output_times(opts, "Read File Open", read_open_mm_table, parms.num_iters); + output_times(opts, "Read File Close", read_close_mm_table, parms.num_iters); + } + + /* Print out time from open to first read */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Read file open details:\n"); + output_all_info(read_open_mm_table, parms.num_iters, 4); + } + + /* Print out time from last read to close */ + if (pio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Read file close details:\n"); + output_all_info(read_close_mm_table, parms.num_iters, 4); + } + } + + /* clean up our mess */ + free(write_mpi_mm_table); + free(write_mm_table); + free(write_gross_mm_table); + free(write_raw_mm_table); + free(write_open_mm_table); + free(write_close_mm_table); + + if (!parms.h5_write_only) { + free(read_mpi_mm_table); + free(read_mm_table); + free(read_gross_mm_table); + free(read_raw_mm_table); + free(read_open_mm_table); + free(read_close_mm_table); + } + + return ret_value; +} + +/* + * Function: output_all_info + * Purpose: + * Return: Nothing + * Programmer: Bill Wendling, 29. January 2002 + * Modifications: + */ +static void +output_all_info(minmax *mm, int count, int indent_level) +{ + int i; + + for (i = 0; i < count; ++i) { + print_indent(indent_level); + output_report("Iteration %d:\n", i + 1); + print_indent(indent_level + 1); + output_report("Minimum Time: %.2fs\n", mm[i].min); + print_indent(indent_level + 1); + output_report("Maximum Time: %.2fs\n", mm[i].max); + } +} + +/* + * Function: h5_set_info_object + * Purpose: Process environment variables setting to set up MPI Info + * object. + * Return: 0 if all is fine; otherwise non-zero. + * Programmer: Albert Cheng, 2002/05/21. + * Modifications: + * Bill Wendling, 2002/05/31 + * Modified so that the HDF5_MPI_INFO environment variable can + * be a semicolon separated list of "key=value" pairings. Most + * of the code is to remove any whitespaces which might be + * surrounding the "key=value" pairs. + */ +int +h5_set_info_object(void) +{ + char *envp; /* environment pointer */ + int ret_value = 0; + + /* handle any MPI INFO hints via $HDF5_MPI_INFO */ + if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL) { + char *next, *valp; + + valp = envp = next = HDstrdup(envp); + + if (!valp) + return 0; + + /* create an INFO object if not created yet */ + if (h5_io_info_g == MPI_INFO_NULL) + MPI_Info_create(&h5_io_info_g); + + do { + size_t len; + char * key_val, *endp, *namep; + + if (*valp == ';') + valp++; + + /* copy key/value pair into temporary buffer */ + len = strcspn(valp, ";"); + next = &valp[len]; + key_val = (char *)HDcalloc(1, len + 1); + + /* increment the next pointer past the terminating semicolon */ + if (*next == ';') + ++next; + + namep = HDstrncpy(key_val, valp, len); + + /* pass up any beginning whitespaces */ + while (*namep && (*namep == ' ' || *namep == '\t')) + namep++; + + if (!*namep) + continue; /* was all white space, so move to next k/v pair */ + + /* eat up any ending white spaces */ + endp = &namep[HDstrlen(namep) - 1]; + + while (endp && (*endp == ' ' || *endp == '\t')) + *endp-- = '\0'; + + /* find the '=' */ + valp = HDstrchr(namep, '='); + + if (valp != NULL) { /* it's a valid key/value pairing */ + char *tmp_val = valp + 1; + + /* change '=' to \0, move valp down one */ + *valp-- = '\0'; + + /* eat up ending whitespace on the "key" part */ + while (*valp == ' ' || *valp == '\t') + *valp-- = '\0'; + + valp = tmp_val; + + /* eat up beginning whitespace on the "value" part */ + while (*valp == ' ' || *valp == '\t') + *valp++ = '\0'; + + /* actually set the darned thing */ + if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { + HDprintf("MPI_Info_set failed\n"); + ret_value = -1; + } + } + + valp = next; + HDfree(key_val); + } while (next && *next); + + HDfree(envp); + } + + return ret_value; +} + +/* + * Function: h5_dump_info_object + * Purpose: Display content of an MPI Info object + * Return: void + * Programmer: Albert Cheng 2002/05/21 + * Modifications: + */ +void +h5_dump_info_object(MPI_Info info) +{ + char key[MPI_MAX_INFO_KEY + 1]; + char value[MPI_MAX_INFO_VAL + 1]; + int flag; + int i, nkeys; + + HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL); + if (info == MPI_INFO_NULL) { + HDprintf("object is MPI_INFO_NULL\n"); + } + else { + MPI_Info_get_nkeys(info, &nkeys); + HDprintf("object has %d items\n", nkeys); + for (i = 0; i < nkeys; i++) { + MPI_Info_get_nthkey(info, i, key); + MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + HDprintf("%s=%s\n", key, value); + } + } +} + +/* + * Function: get_minmax + * Purpose: Gather all the min, max and total of val. + * Return: Nothing + * Programmer: Bill Wendling, 21. December 2001 + * Modifications: + * Use MPI_Allreduce to do it. -akc, 2002/01/11 + */ +static void +get_minmax(minmax *mm, double val) +{ + int myrank; + + MPI_Comm_rank(pio_comm_g, &myrank); + MPI_Comm_size(pio_comm_g, &mm->num); + + MPI_Allreduce(&val, &mm->max, 1, MPI_DOUBLE, MPI_MAX, pio_comm_g); + MPI_Allreduce(&val, &mm->min, 1, MPI_DOUBLE, MPI_MIN, pio_comm_g); + MPI_Allreduce(&val, &mm->sum, 1, MPI_DOUBLE, MPI_SUM, pio_comm_g); +} + +/* + * Function: accumulate_minmax_stuff + * Purpose: Accumulate the minimum, maximum, and average of the times + * across all processes. + * Return: TOTAL_MM - the total of all of these. + * Programmer: Bill Wendling, 21. December 2001 + * Modifications: + * Changed to use seconds instead of MB/s - QAK, 5/9/02 + */ +static minmax +accumulate_minmax_stuff(minmax *mm, int count) +{ + int i; + minmax total_mm; + + total_mm.sum = 0.0f; + total_mm.max = -DBL_MAX; + total_mm.min = DBL_MAX; + total_mm.num = count; + + for (i = 0; i < count; ++i) { + double m = mm[i].max; + + total_mm.sum += m; + + if (m < total_mm.min) + total_mm.min = m; + + if (m > total_mm.max) + total_mm.max = m; + } + + return total_mm; +} + +/* + * Function: create_comm_world + * Purpose: Create an MPI Comm world and store it in pio_comm_g, which + * is a global variable. + * Return: SUCCESS on success. + * FAIL otherwise. + * Programmer: Bill Wendling, 19. December 2001 + * Modifications: + */ +static int +create_comm_world(int num_procs, int *doing_pio) +{ + /* MPI variables */ + int mrc; /* return values */ + int color; /* for communicator creation */ + int myrank, nprocs; + + pio_comm_g = MPI_COMM_NULL; + + /* + * Create a sub communicator for this PIO run. Easier to use the first N + * processes. + */ + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + + if (num_procs > nprocs) { + HDfprintf(stderr, "number of process(%d) must be <= number of processes in MPI_COMM_WORLD(%d)\n", + num_procs, nprocs); + goto error_done; + } + + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); + color = (myrank < num_procs); + mrc = MPI_Comm_split(MPI_COMM_WORLD, color, myrank, &pio_comm_g); + + if (mrc != MPI_SUCCESS) { + HDfprintf(stderr, "MPI_Comm_split failed\n"); + goto error_done; + } + + if (!color) { + /* not involved in this run */ + mrc = destroy_comm_world(); + goto done; + } + + /* determine the MPI rank in the PIO communicator */ + MPI_Comm_size(pio_comm_g, &pio_mpi_nprocs_g); + MPI_Comm_rank(pio_comm_g, &pio_mpi_rank_g); + +done: + *doing_pio = color; + return SUCCESS; + +error_done: + destroy_comm_world(); + return FAIL; +} + +/* + * Function: destroy_comm_world + * Purpose: Destroy the created MPI Comm world which is stored in the + * pio_comm_g global variable. + * Return: SUCCESS on success. + * FAIL otherwise. + * Programmer: Bill Wendling, 19. December 2001 + * Modifications: + */ +static int +destroy_comm_world(void) +{ + int mrc = SUCCESS; /* return code */ + + /* release MPI resources */ + if (pio_comm_g != MPI_COMM_NULL) + mrc = (MPI_Comm_free(&pio_comm_g) == MPI_SUCCESS ? SUCCESS : FAIL); + + return mrc; +} + +/* + * Function: output_results + * Purpose: Print information about the time & bandwidth for a given + * minmax & # of iterations. + * Return: Nothing + * Programmer: Quincey Koziol, 9. May 2002 + * Modifications: + */ +static void +output_results(const struct options *opts, const char *name, minmax *table, int table_size, off_t data_size) +{ + minmax total_mm; + + total_mm = accumulate_minmax_stuff(table, table_size); + + print_indent(3); + output_report("%s (%d iteration(s)):\n", name, table_size); + + /* Note: The maximum throughput uses the minimum amount of time & vice versa */ + + print_indent(4); + output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.min)); + if (opts->print_times) + output_report(" (%7.3f s)\n", total_mm.min); + else + output_report("\n"); + + print_indent(4); + output_report("Average Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.sum / total_mm.num)); + if (opts->print_times) + output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num)); + else + output_report("\n"); + + print_indent(4); + output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.max)); + if (opts->print_times) + output_report(" (%7.3f s)\n", total_mm.max); + else + output_report("\n"); +} + +static void +output_times(const struct options *opts, const char *name, minmax *table, int table_size) +{ + minmax total_mm; + + total_mm = accumulate_minmax_stuff(table, table_size); + + print_indent(3); + output_report("%s (%d iteration(s)):\n", name, table_size); + + /* Note: The maximum throughput uses the minimum amount of time & vice versa */ + + print_indent(4); + output_report("Minimum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.min)); + + print_indent(4); + output_report("Average Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, + (total_mm.sum / total_mm.num)); + + print_indent(4); + output_report("Maximum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.max)); +} + +/* + * Function: output_report + * Purpose: Print a line of the report. Only do so if I'm the 0 process. + * Return: Nothing + * Programmer: Bill Wendling, 19. December 2001 + * Modifications: + */ +static void +output_report(const char *fmt, ...) +{ + int myrank; + + MPI_Comm_rank(pio_comm_g, &myrank); + + if (myrank == 0) { + va_list ap; + + HDva_start(ap, fmt); + HDvfprintf(output, fmt, ap); + HDva_end(ap); + } +} + +/* + * Function: print_indent + * Purpose: Print spaces to indent a new line of text for pretty printing + * things. + * Return: Nothing + * Programmer: Bill Wendling, 29. October 2001 + * Modifications: + */ +static void +print_indent(register int indent) +{ + int myrank; + + MPI_Comm_rank(pio_comm_g, &myrank); + + if (myrank == 0) { + indent *= TAB_SPACE; + + for (; indent > 0; --indent) + HDfputc(' ', output); + } +} + +static void +recover_size_and_print(long long val, const char *end) +{ + if (val >= ONE_KB && (val % ONE_KB) == 0) { + if (val >= ONE_MB && (val % ONE_MB) == 0) { + if (val >= ONE_GB && (val % ONE_GB) == 0) + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "GB%s", + val / ONE_GB, end); + else + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "MB%s", + val / ONE_MB, end); + } + else { + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "KB%s", + val / ONE_KB, end); + } + } + else { + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "%s", + val, end); + } +} + +static void +print_io_api(long io_types) +{ + if (io_types & PIO_POSIX) + HDfprintf(output, "posix "); + if (io_types & PIO_MPI) + HDfprintf(output, "mpiio "); + if (io_types & PIO_HDF5) + HDfprintf(output, "phdf5 "); + HDfprintf(output, "\n"); +} + +static void +report_parameters(struct options *opts) +{ + int rank = comm_world_rank_g; + + print_version("HDF5 Library"); /* print library version */ + HDfprintf(output, "rank %d: ==== Parameters ====\n", rank); + + HDfprintf(output, "rank %d: IO API=", rank); + print_io_api(opts->io_types); + + HDfprintf(output, "rank %d: Number of files=%ld\n", rank, opts->num_files); + HDfprintf(output, "rank %d: Number of datasets=%ld\n", rank, opts->num_dsets); + HDfprintf(output, "rank %d: Number of iterations=%d\n", rank, opts->num_iters); + HDfprintf(output, "rank %d: Number of processes=%d:%d\n", rank, opts->min_num_procs, opts->max_num_procs); + + if (opts->dim2d) { + HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank); + recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->min_num_procs), ":"); + recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->max_num_procs), "\n"); + + HDfprintf(output, "rank %d: Size of dataset(s)=", rank); + recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), "x"); + recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":"); + recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "x"); + recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); + + HDfprintf(output, "rank %d: File size=", rank); + recover_size_and_print((long long)(squareo(opts->num_bpp * opts->min_num_procs) * opts->num_dsets), + ":"); + recover_size_and_print((long long)(squareo(opts->num_bpp * opts->max_num_procs) * opts->num_dsets), + "\n"); + + HDfprintf(output, "rank %d: Transfer buffer size=", rank); + if (opts->interleaved) { + recover_size_and_print((long long)opts->min_xfer_size, "x"); + recover_size_and_print((long long)opts->blk_size, ":"); + recover_size_and_print((long long)opts->max_xfer_size, "x"); + recover_size_and_print((long long)opts->blk_size, "\n"); + } + else { + recover_size_and_print((long long)opts->blk_size, "x"); + recover_size_and_print((long long)opts->min_xfer_size, ":"); + recover_size_and_print((long long)opts->blk_size, "x"); + recover_size_and_print((long long)opts->max_xfer_size, "\n"); + } + HDfprintf(output, "rank %d: Block size=", rank); + recover_size_and_print((long long)opts->blk_size, "x"); + recover_size_and_print((long long)opts->blk_size, "\n"); + } + else { + HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank); + recover_size_and_print((long long)opts->num_bpp, "\n"); + + HDfprintf(output, "rank %d: Size of dataset(s)=", rank); + recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":"); + recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); + + HDfprintf(output, "rank %d: File size=", rank); + recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs * opts->num_dsets), ":"); + recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs * opts->num_dsets), "\n"); + + HDfprintf(output, "rank %d: Transfer buffer size=", rank); + recover_size_and_print((long long)opts->min_xfer_size, ":"); + recover_size_and_print((long long)opts->max_xfer_size, "\n"); + HDfprintf(output, "rank %d: Block size=", rank); + recover_size_and_print((long long)opts->blk_size, "\n"); + } + + HDfprintf(output, "rank %d: Block Pattern in Dataset=", rank); + if (opts->interleaved) + HDfprintf(output, "Interleaved\n"); + else + HDfprintf(output, "Contiguous\n"); + + HDfprintf(output, "rank %d: I/O Method for MPI and HDF5=", rank); + if (opts->collective) + HDfprintf(output, "Collective\n"); + else + HDfprintf(output, "Independent\n"); + + HDfprintf(output, "rank %d: Geometry=", rank); + if (opts->dim2d) + HDfprintf(output, "2D\n"); + else + HDfprintf(output, "1D\n"); + + HDfprintf(output, "rank %d: VFL used for HDF5 I/O=%s\n", rank, "MPI-IO driver"); + + HDfprintf(output, "rank %d: Data storage method in HDF5=", rank); + if (opts->h5_use_chunks) + HDfprintf(output, "Chunked\n"); + else + HDfprintf(output, "Contiguous\n"); + + { + char *prefix = HDgetenv("HDF5_PARAPREFIX"); + + HDfprintf(output, "rank %d: Env HDF5_PARAPREFIX=%s\n", rank, (prefix ? prefix : "not set")); + } + + HDfprintf(output, "rank %d: ", rank); + h5_dump_info_object(h5_io_info_g); + + HDfprintf(output, "rank %d: ==== End of Parameters ====\n", rank); + HDfprintf(output, "\n"); +} + +/* + * Function: parse_command_line + * Purpose: Parse the command line options and return a STRUCT OPTIONS + * structure which will need to be freed by the calling function. + * Return: Pointer to an OPTIONS structure + * Programmer: Bill Wendling, 31. October 2001 + * Modifications: + * Added 2D testing (Christian Chilan, 10. August 2005) + */ +static struct options * +parse_command_line(int argc, char *argv[]) +{ + register int opt; + struct options *cl_opts; + + cl_opts = (struct options *)malloc(sizeof(struct options)); + + cl_opts->output_file = NULL; + cl_opts->io_types = 0; /* will set default after parsing options */ + cl_opts->num_dsets = 1; + cl_opts->num_files = 1; + cl_opts->num_bpp = 0; + cl_opts->num_iters = 1; + cl_opts->max_num_procs = comm_world_nprocs_g; + cl_opts->min_num_procs = 1; + cl_opts->max_xfer_size = 0; + cl_opts->min_xfer_size = 0; + cl_opts->blk_size = 0; + cl_opts->interleaved = 0; /* Default to contiguous blocks in dataset */ + cl_opts->collective = 0; /* Default to independent I/O access */ + cl_opts->dim2d = 0; /* Default to 1D */ + cl_opts->print_times = FALSE; /* Printing times is off by default */ + cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */ + cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */ + cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */ + cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */ + cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ + cl_opts->verify = FALSE; /* No Verify data correctness by default */ + + while ((opt = H5_get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) { + switch ((char)opt) { + case 'a': + cl_opts->h5_alignment = parse_size_directive(H5_optarg); + break; + case 'A': { + const char *end = H5_optarg; + + while (end && *end != '\0') { + char buf[10]; + int i; + + HDmemset(buf, '\0', sizeof(buf)); + + for (i = 0; *end != '\0' && *end != ','; ++end) + if (isalnum(*end) && i < 10) + buf[i++] = *end; + + if (!HDstrcasecmp(buf, "phdf5")) { + cl_opts->io_types |= PIO_HDF5; + } + else if (!HDstrcasecmp(buf, "mpiio")) { + cl_opts->io_types |= PIO_MPI; + } + else if (!HDstrcasecmp(buf, "posix")) { + cl_opts->io_types |= PIO_POSIX; + } + else { + HDfprintf(stderr, "pio_perf: invalid --api option %s\n", buf); + HDexit(EXIT_FAILURE); + } + + if (*end == '\0') + break; + + end++; + } + } + + break; +#if 0 + case 'b': + /* the future "binary" option */ + break; +#endif /* 0 */ + case 'B': + cl_opts->blk_size = (size_t)parse_size_directive(H5_optarg); + break; + case 'c': + /* Turn on chunked HDF5 dataset creation */ + cl_opts->h5_use_chunks = TRUE; + break; + case 'C': + cl_opts->collective = 1; + break; + case 'd': + cl_opts->num_dsets = atoi(H5_optarg); + break; + case 'D': { + const char *end = H5_optarg; + + while (end && *end != '\0') { + char buf[10]; + int i; + + HDmemset(buf, '\0', sizeof(buf)); + + for (i = 0; *end != '\0' && *end != ','; ++end) + if (HDisalnum(*end) && i < 10) + buf[i++] = *end; + + if (HDstrlen(buf) > 1 || HDisdigit(buf[0])) { + size_t j; + + for (j = 0; j < 10 && buf[j] != '\0'; ++j) + if (!isdigit(buf[j])) { + HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); + HDexit(EXIT_FAILURE); + } + + pio_debug_level = atoi(buf); + + if (pio_debug_level > 4) + pio_debug_level = 4; + else if (pio_debug_level < 0) + pio_debug_level = 0; + } + else { + switch (*buf) { + case 'r': + /* Turn on raw data throughput info */ + cl_opts->print_raw = TRUE; + break; + case 't': + /* Turn on time printing */ + cl_opts->print_times = TRUE; + break; + case 'v': + /* Turn on verify data correctness*/ + cl_opts->verify = TRUE; + break; + default: + HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); + HDexit(EXIT_FAILURE); + } + } + + if (*end == '\0') + break; + + end++; + } + } + + break; + case 'e': + cl_opts->num_bpp = parse_size_directive(H5_optarg); + break; + case 'F': + cl_opts->num_files = HDatoi(H5_optarg); + break; + case 'g': + cl_opts->dim2d = 1; + break; + case 'i': + cl_opts->num_iters = HDatoi(H5_optarg); + break; + case 'I': + cl_opts->interleaved = 1; + break; + case 'o': + cl_opts->output_file = H5_optarg; + break; + case 'p': + cl_opts->min_num_procs = HDatoi(H5_optarg); + break; + case 'P': + cl_opts->max_num_procs = HDatoi(H5_optarg); + break; + case 'T': + cl_opts->h5_threshold = parse_size_directive(H5_optarg); + break; + case 'w': + cl_opts->h5_write_only = TRUE; + break; + case 'x': + cl_opts->min_xfer_size = (size_t)parse_size_directive(H5_optarg); + break; + case 'X': + cl_opts->max_xfer_size = (size_t)parse_size_directive(H5_optarg); + break; + case 'h': + case '?': + default: + usage(progname); + HDfree(cl_opts); + return NULL; + } + } + + if (cl_opts->num_bpp == 0) { + if (cl_opts->dim2d == 0) + cl_opts->num_bpp = 256 * ONE_KB; + else + cl_opts->num_bpp = 8 * ONE_KB; + } + + if (cl_opts->max_xfer_size == 0) + cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; + + if (cl_opts->min_xfer_size == 0) + cl_opts->min_xfer_size = (size_t)(cl_opts->num_bpp) / 2; + + if (cl_opts->blk_size == 0) + cl_opts->blk_size = (size_t)(cl_opts->num_bpp) / 2; + + /* set default if none specified yet */ + if (!cl_opts->io_types) + cl_opts->io_types = PIO_HDF5 | PIO_MPI | PIO_POSIX; /* run all API */ + + /* verify parameters sanity. Adjust if needed. */ + /* cap xfer_size with bytes per process */ + if (!cl_opts->dim2d) { + if (cl_opts->min_xfer_size > (size_t)cl_opts->num_bpp) + cl_opts->min_xfer_size = (size_t)cl_opts->num_bpp; + if (cl_opts->max_xfer_size > (size_t)cl_opts->num_bpp) + cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; + } + if (cl_opts->min_xfer_size > cl_opts->max_xfer_size) + cl_opts->min_xfer_size = cl_opts->max_xfer_size; + if (cl_opts->blk_size > (size_t)cl_opts->num_bpp) + cl_opts->blk_size = (size_t)cl_opts->num_bpp; + /* check range of number of processes */ + if (cl_opts->min_num_procs <= 0) + cl_opts->min_num_procs = 1; + if (cl_opts->max_num_procs <= 0) + cl_opts->max_num_procs = 1; + if (cl_opts->min_num_procs > cl_opts->max_num_procs) + cl_opts->min_num_procs = cl_opts->max_num_procs; + /* check iteration */ + if (cl_opts->num_iters <= 0) + cl_opts->num_iters = 1; + + return cl_opts; +} + +/* + * Function: parse_size_directive + * Purpose: Parse the size directive passed on the commandline. The size + * directive is an integer followed by a size indicator: + * + * K, k - Kilobyte + * M, m - Megabyte + * G, g - Gigabyte + * + * Return: The size as a off_t because this is related to file size. + * If an unknown size indicator is used, then the program will + * exit with EXIT_FAILURE as the return value. + * Programmer: Bill Wendling, 18. December 2001 + * Modifications: + */ +static off_t +parse_size_directive(const char *size) +{ + off_t s; + char *endptr; + + s = HDstrtol(size, &endptr, 10); + + if (endptr && *endptr) { + while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t')) + ++endptr; + + switch (*endptr) { + case 'K': + case 'k': + s *= ONE_KB; + break; + case 'M': + case 'm': + s *= ONE_MB; + break; + case 'G': + case 'g': + s *= ONE_GB; + break; + default: + HDfprintf(stderr, "Illegal size specifier '%c'\n", *endptr); + HDexit(EXIT_FAILURE); + } + } + + return s; +} + +/* + * Function: usage + * Purpose: Print a usage message and then exit. + * Return: Nothing + * Programmer: Bill Wendling, 31. October 2001 + * Modifications: + * Added 2D testing (Christian Chilan, 10. August 2005) + */ +static void +usage(const char *prog) +{ + int myrank; + + MPI_Comm_rank(pio_comm_g, &myrank); + + if (myrank == 0) { + print_version(prog); + HDprintf("usage: %s [OPTIONS]\n", prog); + HDprintf(" OPTIONS\n"); + HDprintf(" -h, --help Print a usage message and exit\n"); + HDprintf(" -a S, --align=S Alignment of objects in HDF5 file [default: 1]\n"); + HDprintf(" -A AL, --api=AL Which APIs to test [default: all of them]\n"); +#if 0 + HDprintf(" -b, --binary The elusive binary option\n"); +#endif /* 0 */ + HDprintf(" -B S, --block-size=S Block size within transfer buffer\n"); + HDprintf(" (see below for description)\n"); + HDprintf(" [default: half the number of bytes per process\n"); + HDprintf(" per dataset]\n"); + HDprintf(" -c, --chunk Create HDF5 datasets using chunked storage\n"); + HDprintf(" [default: contiguous storage]\n"); + HDprintf(" -C, --collective Use collective I/O for MPI and HDF5 APIs\n"); + HDprintf(" [default: independent I/O)\n"); + HDprintf(" -d N, --num-dsets=N Number of datasets per file [default: 1]\n"); + HDprintf(" -D DL, --debug=DL Indicate the debugging level\n"); + HDprintf(" [default: no debugging]\n"); + HDprintf(" -e S, --num-bytes=S Number of bytes per process per dataset\n"); + HDprintf(" (see below for description)\n"); + HDprintf(" [default: 256K for 1D, 8K for 2D]\n"); + HDprintf(" -F N, --num-files=N Number of files [default: 1]\n"); + HDprintf(" -g, --geometry Use 2D geometry [default: 1D geometry]\n"); + HDprintf(" -i N, --num-iterations=N Number of iterations to perform [default: 1]\n"); + HDprintf(" -I, --interleaved Interleaved access pattern\n"); + HDprintf(" (see below for example)\n"); + HDprintf(" [default: Contiguous access pattern]\n"); + HDprintf(" -o F, --output=F Output raw data into file F [default: none]\n"); + HDprintf(" -p N, --min-num-processes=N Minimum number of processes to use [default: 1]\n"); + HDprintf(" -P N, --max-num-processes=N Maximum number of processes to use\n"); + HDprintf(" [default: all MPI_COMM_WORLD processes ]\n"); + HDprintf(" -T S, --threshold=S Threshold for alignment of objects in HDF5 file\n"); + HDprintf(" [default: 1]\n"); + HDprintf(" -w, --write-only Perform write tests not the read tests\n"); + HDprintf(" -x S, --min-xfer-size=S Minimum transfer buffer size\n"); + HDprintf(" (see below for description)\n"); + HDprintf(" [default: half the number of bytes per process\n"); + HDprintf(" per dataset]\n"); + HDprintf(" -X S, --max-xfer-size=S Maximum transfer buffer size\n"); + HDprintf(" [default: the number of bytes per process per\n"); + HDprintf(" dataset]\n"); + HDprintf("\n"); + HDprintf(" F - is a filename.\n"); + HDprintf(" N - is an integer >=0.\n"); + HDprintf(" S - is a size specifier, an integer >=0 followed by a size indicator:\n"); + HDprintf(" K - Kilobyte (%d)\n", ONE_KB); + HDprintf(" M - Megabyte (%d)\n", ONE_MB); + HDprintf(" G - Gigabyte (%d)\n", ONE_GB); + HDprintf("\n"); + HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37 * ONE_MB); + HDprintf("\n"); + HDprintf(" AL - is an API list. Valid values are:\n"); + HDprintf(" phdf5 - Parallel HDF5\n"); + HDprintf(" mpiio - MPI-I/O\n"); + HDprintf(" posix - POSIX\n"); + HDprintf("\n"); + HDprintf(" Example: --api=mpiio,phdf5\n"); + HDprintf("\n"); + HDprintf(" Dataset size:\n"); + HDprintf(" Depending on the selected geometry, each test dataset is either a linear\n"); + HDprintf(" array of size bytes-per-process * num-processes, or a square array of size\n"); + HDprintf(" (bytes-per-process * num-processes) x (bytes-per-process * num-processes).\n"); + HDprintf("\n"); + HDprintf(" Block size vs. Transfer buffer size:\n"); + HDprintf(" buffer-size controls the size of the memory buffer, which is broken into\n"); + HDprintf(" blocks and written to the file. Depending on the selected geometry, each\n"); + HDprintf(" block can be a linear array of size block-size or a square array of size\n"); + HDprintf(" block-size x block-size. The arrangement in which blocks are written is\n"); + HDprintf(" determined by the access pattern.\n"); + HDprintf("\n"); + HDprintf(" In 1D geometry, the transfer buffer is a linear array of size buffer-size.\n"); + HDprintf(" In 2D geometry, it is a rectangular array of size block-size x buffer-size\n"); + HDprintf(" or buffer-size x block-size if interleaved pattern is selected.\n"); + HDprintf("\n"); + HDprintf(" Interleaved and Contiguous patterns in 1D geometry:\n"); + HDprintf(" When contiguous access pattern is chosen, the dataset is evenly divided\n"); + HDprintf(" into num-processes regions and each process writes data to its own region.\n"); + HDprintf(" When interleaved blocks are written to a dataset, space for the first\n"); + HDprintf(" block of the first process is allocated in the dataset, then space is\n"); + HDprintf(" allocated for the first block of the second process, etc. until space is\n"); + HDprintf(" allocated for the first block of each process, then space is allocated for\n"); + HDprintf(" the second block of the first process, the second block of the second\n"); + HDprintf(" process, etc.\n"); + HDprintf("\n"); + HDprintf(" For example, with a 3 process run, 512KB bytes-per-process, 256KB transfer\n"); + HDprintf(" buffer size, and 64KB block size, each process must issue 2 transfer\n"); + HDprintf(" requests to complete access to the dataset.\n"); + HDprintf(" Contiguous blocks of the first transfer request are written like so:\n"); + HDprintf(" 1111----2222----3333----\n"); + HDprintf(" Interleaved blocks of the first transfer request are written like so:\n"); + HDprintf(" 123123123123------------\n"); + HDprintf(" The actual number of I/O operations involved in a transfer request\n"); + HDprintf(" depends on the access pattern and communication mode.\n"); + HDprintf(" When using independent I/O with interleaved pattern, each process\n"); + HDprintf(" performs 4 small non-contiguous I/O operations per transfer request.\n"); + HDprintf(" If collective I/O is turned on, the combined content of the buffers of\n"); + HDprintf(" the 3 processes will be written using one collective I/O operation\n"); + HDprintf(" per transfer request.\n"); + HDprintf("\n"); + HDprintf(" For information about access patterns in 2D geometry, please refer to the\n"); + HDprintf(" HDF5 Reference Manual.\n"); + HDprintf("\n"); + HDprintf(" DL - is a list of debugging flags. Valid values are:\n"); + HDprintf(" 1 - Minimal\n"); + HDprintf(" 2 - Not quite everything\n"); + HDprintf(" 3 - Everything\n"); + HDprintf(" 4 - The kitchen sink\n"); + HDprintf(" r - Raw data I/O throughput information\n"); + HDprintf(" t - Times as well as throughputs\n"); + HDprintf(" v - Verify data correctness\n"); + HDprintf("\n"); + HDprintf(" Example: --debug=2,r,t\n"); + HDprintf("\n"); + HDprintf(" Environment variables:\n"); + HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); + HDprintf(" HDF5_MPI_INFO MPI INFO object key=value separated by ;\n"); + HDprintf(" HDF5_PARAPREFIX Paralllel data files prefix\n"); + fflush(stdout); + } /* end if */ +} /* end usage() */ + +#else /* H5_HAVE_PARALLEL */ + +/* + * Function: main + * Purpose: Dummy main() function for if HDF5 was configured without + * parallel stuff. + * Return: EXIT_SUCCESS + * Programmer: Bill Wendling, 14. November 2001 + */ +int +main(void) +{ + HDprintf("No parallel IO performance because parallel is not configured\n"); + return EXIT_SUCCESS; +} /* end main */ + +#endif /* !H5_HAVE_PARALLEL */ diff --git a/tools/src/h5perf/pio_perf.h b/tools/src/h5perf/pio_perf.h new file mode 100644 index 0000000..8924c20 --- /dev/null +++ b/tools/src/h5perf/pio_perf.h @@ -0,0 +1,109 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef PIO_PERF_H +#define PIO_PERF_H + +#ifndef STANDALONE +#include "io_timer.h" +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" +#else +#include "io_timer.h" +#include "pio_standalone.h" +#endif + +#ifdef H5_HAVE_PARALLEL +extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ +#endif + +#ifdef H5_HAVE_PARALLEL +int h5_set_info_object(void); +void h5_dump_info_object(MPI_Info info); +#endif + +/* setup the dataset no fill option if this is v1.5 or more */ +#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4 +#define H5_HAVE_NOFILL 1 +#endif + +typedef enum iotype_ { + POSIXIO, + MPIO, + PHDF5 + /*NUM_TYPES*/ +} iotype; + +typedef struct parameters_ { + iotype io_type; /* The type of IO test to perform */ + int num_procs; /* Maximum number of processes to use */ + long num_files; /* Number of files to create */ + long num_dsets; /* Number of datasets to create */ + off_t num_bytes; /* Number of bytes in each dset */ + int num_iters; /* Number of times to loop doing the IO */ + size_t buf_size; /* Buffer size */ + size_t blk_size; /* Block size */ + unsigned interleaved; /* Interleaved vs. contiguous blocks */ + unsigned collective; /* Collective vs. independent I/O */ + unsigned dim2d; /* 1D vs. 2D */ + hsize_t h5_align; /* HDF5 object alignment */ + hsize_t h5_thresh; /* HDF5 object alignment threshold */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ + int verify; /* Verify data correctness */ +} parameters; + +typedef struct results_ { + herr_t ret_code; + io_time_t *timers; +} results; + +#ifndef SUCCESS +#define SUCCESS 0 +#endif /* !SUCCESS */ + +#ifndef FAIL +#define FAIL -1 +#endif /* !FAIL */ + +extern FILE * output; /* output file */ +extern io_time_t *timer_g; /* timer: global for stub functions */ +extern int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ +extern int comm_world_nprocs_g; /* num. of processes of MPI_COMM_WORLD */ +extern MPI_Comm pio_comm_g; /* Communicator to run the PIO */ +extern int pio_mpi_rank_g; /* MPI rank of pio_comm_g */ +extern int pio_mpi_nprocs_g; /* number of processes of pio_comm_g */ +extern int pio_debug_level; /* The debug level: + * 0 - Off + * 1 - Minimal + * 2 - Some more + * 3 - Maximal + * 4 - Even More Debugging (timer stuff) + */ + +#define HDprint_rank(f) /* print rank in MPI_COMM_WORLD */ HDfprintf(f, "%d: ", comm_world_rank_g); +#define HDprint_size(f) /* print size of MPI_COMM_WORLD */ HDfprintf(f, "%d", comm_world_nprocs_g); +#define HDprint_rank_size(f) /* print rank/size of MPI_COMM_WORLD */ \ + HDfprintf(f, "%d/%d: ", comm_world_rank_g, comm_world_nprocs_g); + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +extern results do_pio(parameters param); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* PIO_PERF_H */ diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c new file mode 100644 index 0000000..1af2318 --- /dev/null +++ b/tools/src/h5perf/sio_engine.c @@ -0,0 +1,1328 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Author: Christian Chilan, April 2008 + */ + +#include "hdf5.h" + +#include +#include +#include +#include + +#ifdef H5_HAVE_UNISTD_H +#include +#include +#endif + +#ifdef H5_HAVE_SYS_STAT_H +#include +#endif + +#include "sio_perf.h" + +/* Macro definitions */ + +/* sizes of various items. these sizes won't change during program execution */ +#define ELMT_H5_TYPE H5T_NATIVE_UCHAR + +#define GOTOERROR(errcode) \ + { \ + ret_code = errcode; \ + goto done; \ + } +#define ERRMSG(mesg) \ + { \ + HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \ + } + +/* verify: if val is false (0), print mesg. */ +#define VRFY(val, mesg) \ + do { \ + if (!val) { \ + ERRMSG(mesg); \ + GOTOERROR(FAIL); \ + } \ + } while (0) + +/* POSIX I/O macros */ +#ifdef H5_HAVE_WIN32_API +/* Can't link against the library, so this test will use the older, non-Unicode + * _open() call on Windows. + */ +#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__) +#endif /* H5_HAVE_WIN32_API */ +#define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600) +#define POSIXOPEN(fn, F) HDopen(fn, F, 0600) +#define POSIXCLOSE(F) HDclose(F) +#define POSIXSEEK(F, L) HDlseek(F, L, SEEK_SET) +#define POSIXWRITE(F, B, S) HDwrite(F, B, S) +#define POSIXREAD(F, B, S) HDread(F, B, S) + +enum { SIO_CREATE = 1, SIO_WRITE = 2, SIO_READ = 4 }; + +/* Global variables */ +static int clean_file_g = -1; /*whether to cleanup temporary test */ +/*files. -1 is not defined; */ +/*0 is no cleanup; 1 is do cleanup */ + +/* the different types of file descriptors we can expect */ +typedef union { + int posixfd; /* POSIX file handle*/ + hid_t h5fd; /* HDF5 file */ +} file_descr; + +/* local functions */ +static char * sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size, + parameters *param); +static herr_t do_write(results *res, file_descr *fd, parameters *parms, void *buffer); +static herr_t do_read(results *res, file_descr *fd, parameters *parms, void *buffer); +static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer); +static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer); +static herr_t dset_read(int localrank, file_descr *fd, parameters *parms, void *buffer, const char *buffer2); +static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer); +static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags); +hid_t set_vfd(parameters *param); +static herr_t do_fclose(iotype iot, file_descr *fd); +static void do_cleanupfile(iotype iot, char *fname); + +/* global variables */ +static HDoff_t offset[MAX_DIMS]; /* dataset size in bytes */ +static size_t buf_offset[MAX_DIMS]; /* dataset size in bytes */ +static int order[MAX_DIMS]; /* dimension access order */ +static size_t linear_buf_size; /* linear buffer size */ +static int cont_dim; /* lowest dimension for contiguous POSIX + access */ +static size_t cont_size; /* size of contiguous POSIX access */ +static hid_t fapl; /* file access list */ +static unsigned char *buf_p; /* buffer pointer */ +static const char * multi_letters = "msbrglo"; /* string for multi driver */ + +/* HDF5 global variables */ +static hsize_t h5count[MAX_DIMS]; /*selection count */ +static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */ +static hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ +static hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ +static hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ +static hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */ +static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ + +/* + * Function: do_sio + * Purpose: SIO Engine where IO are executed. + * Return: results + * Programmer: Christian Chilan, April, 2008 + * Modifications: + */ +void +do_sio(parameters param, results *res) +{ + char * buffer = NULL; /*data buffer pointer */ + size_t buf_size[MAX_DIMS]; /* general buffer size in bytes */ + file_descr fd; /* file handles */ + iotype iot; /* API type */ + char base_name[256]; /* test file base name */ + /* return codes */ + herr_t ret_code = 0; /*return code */ + + char fname[FILENAME_MAX]; /* test file name */ + int i; + /* HDF5 variables */ + herr_t hrc; /*HDF5 return code */ + + /* Sanity check parameters */ + + /* IO type */ + iot = param.io_type; + + switch (iot) { + case POSIXIO: + fd.posixfd = -1; + res->timers = io_time_new(SYS_CLOCK); + break; + case HDF5: + fd.h5fd = -1; + res->timers = io_time_new(SYS_CLOCK); + break; + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); + GOTOERROR(FAIL); + } + + linear_buf_size = 1; + + for (i = 0; i < param.rank; i++) { + buf_size[i] = param.buf_size[i]; + order[i] = param.order[i]; + linear_buf_size *= buf_size[i]; + buf_offset[i] = 0; + offset[i] = 0; + + /* Validate transfer buffer size */ + if (param.buf_size[i] <= 0) { + HDfprintf(stderr, "Transfer buffer size[%d] (%zu) must be > 0\n", i, buf_size[i]); + GOTOERROR(FAIL); + } + + if ((param.dset_size[i] % param.buf_size[i]) != 0) { + HDfprintf(stderr, + "Dataset size[%d] (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "trasfer buffer size[%d] (%zu)\n", + param.rank, (long long)param.dset_size[i], param.rank, param.buf_size[i]); + GOTOERROR(FAIL); + } + } + + /* Allocate transfer buffer */ + if ((buffer = (char *)malloc(linear_buf_size)) == NULL) { + HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", linear_buf_size); + GOTOERROR(FAIL); + } + + if (sio_debug_level >= 4) + + /* output all of the times for all iterations */ + HDfprintf(output, "Timer details:\n"); + + /* + * Write performance measurement + */ + /* Open file for write */ + + HDstrcpy(base_name, "#sio_tmp"); + sio_create_filename(iot, base_name, fname, sizeof(fname), ¶m); + + if (sio_debug_level > 0) + HDfprintf(output, "data filename=%s\n", fname); + + io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); + hrc = do_fopen(¶m, fname, &fd, SIO_CREATE | SIO_WRITE); + VRFY((hrc == SUCCESS), "do_fopen failed"); + + io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); + hrc = do_write(res, &fd, ¶m, buffer); + io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); + VRFY((hrc == SUCCESS), "do_write failed"); + + /* Close file for write */ + hrc = do_fclose(iot, &fd); + io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); + VRFY((hrc == SUCCESS), "do_fclose failed"); + + if (!param.h5_write_only) { + /* + * Read performance measurement + */ + + /* Open file for read */ + io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); + hrc = do_fopen(¶m, fname, &fd, SIO_READ); + VRFY((hrc == SUCCESS), "do_fopen failed"); + + io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); + hrc = do_read(res, &fd, ¶m, buffer); + io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); + VRFY((hrc == SUCCESS), "do_read failed"); + + /* Close file for read */ + hrc = do_fclose(iot, &fd); + + io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); + VRFY((hrc == SUCCESS), "do_fclose failed"); + } + + do_cleanupfile(iot, fname); + +done: + /* clean up */ + /* release HDF5 objects */ + + /* close any opened files */ + /* no remove(fname) because that should have happened normally. */ + switch (iot) { + case POSIXIO: + if (fd.posixfd != -1) + hrc = do_fclose(iot, &fd); + break; + case HDF5: + if (fd.h5fd != -1) + hrc = do_fclose(iot, &fd); + break; + default: + /* unknown request */ + HDassert(0 && "Unknown IO type"); + break; + } + + /* release generic resources */ + if (buffer) + free(buffer); + + res->ret_code = ret_code; +} + +/* + * Function: sio_create_filename + * Purpose: Create a new filename to write to. Determine the correct + * suffix to append to the filename by the type of I/O we're + * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if + * USER or LOGIN are specified in the environment. + * Return: Pointer to filename or NULL + * Programmer: Bill Wendling, 21. November 2001 + * Modifications: Support for file drivers. Christian Chilan, April, 2008 + */ +static char * +sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size, parameters *param) +{ + const char *prefix, *suffix = ""; + char * ptr, last = '\0'; + size_t i, j; + vfdtype vfd; + vfd = param->vfd; + + if (!base_name || !fullname || size < 1) + return NULL; + + memset(fullname, 0, size); + + switch (iot) { + case POSIXIO: + suffix = ".posix"; + break; + case HDF5: + suffix = ".h5"; + if (vfd == family) + suffix = "%05d.h5"; + else if (vfd == multi) + suffix = NULL; + break; + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); + HDassert(0 && "Unknown IO type"); + break; + } + + /* First use the environment variable and then try the constant */ + prefix = HDgetenv("HDF5_PREFIX"); + +#ifdef HDF5_PREFIX + if (!prefix) + prefix = HDF5_PREFIX; +#endif /* HDF5_PREFIX */ + + /* Prepend the prefix value to the base name */ + if (prefix && *prefix) { + /* If the prefix specifies the HDF5_PREFIX directory, then + * default to using the "/tmp/$USER" or "/tmp/$LOGIN" + * directory instead. */ + register char *user, *login, *subdir; + + user = HDgetenv("USER"); + login = HDgetenv("LOGIN"); + subdir = (user ? user : login); + + if (subdir) { + for (i = 0; i < size - 1 && prefix[i]; i++) + fullname[i] = prefix[i]; + + fullname[i++] = '/'; + + for (j = 0; i < size && subdir[j]; i++, j++) + fullname[i] = subdir[j]; + } + else { + /* We didn't append the prefix yet */ + HDstrncpy(fullname, prefix, size); + fullname[size - 1] = '\0'; + } + + if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) { + /* Append the base_name with a slash first. Multiple slashes are + * handled below. */ + h5_stat_t buf; + + if (HDstat(fullname, &buf) < 0) + /* The directory doesn't exist just yet */ + if (HDmkdir(fullname, 0755) < 0 && errno != EEXIST) { + /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory. + * Default to PREFIX's original prefix value. */ + HDstrcpy(fullname, prefix); + } + + HDstrcat(fullname, "/"); + HDstrcat(fullname, base_name); + } + else { + /* Buffer is too small */ + return NULL; + } + } + else if (strlen(base_name) >= size) { + /* Buffer is too small */ + return NULL; + } + else { + HDstrcpy(fullname, base_name); + } + + /* Append a suffix */ + if (suffix) { + if (HDstrlen(fullname) + HDstrlen(suffix) >= size) + return NULL; + + HDstrcat(fullname, suffix); + } + + /* Remove any double slashes in the filename */ + for (ptr = fullname, i = j = 0; ptr && (i < size); i++, ptr++) { + if (*ptr != '/' || last != '/') + fullname[j++] = *ptr; + + last = *ptr; + } + + return fullname; +} + +/* + * Function: do_write + * Purpose: Write the required amount of data to the file. + * Return: SUCCESS or FAIL + * Programmer: Christian Chilan, April, 2008 + * Modifications: + */ +static herr_t +do_write(results *res, file_descr *fd, parameters *parms, void *buffer) +{ + int ret_code = SUCCESS; + char dname[64]; + int i; + size_t u; + /* HDF5 variables */ + herr_t hrc; /*HDF5 return code */ + hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */ + hsize_t h5chunk[MAX_DIMS]; /*dataset dim sizes */ + hsize_t h5block[MAX_DIMS]; /*dataspace selection */ + hsize_t h5stride[MAX_DIMS]; /*selection stride */ + hsize_t h5start[MAX_DIMS]; /*selection start */ + hsize_t h5maxdims[MAX_DIMS]; + int rank; /*rank of dataset */ + + /* Prepare buffer for verifying data */ + /* if (parms->verify) + memset(buffer,1,linear_buf_size); */ + + buf_p = (unsigned char *)buffer; + + for (u = 0; u < linear_buf_size; u++) + buf_p[u] = u % 128; + + rank = parms->rank; + + for (i = 0; i < rank; i++) + h5offset[i] = offset[i] = 0; + + /* I/O Access specific setup */ + switch (parms->io_type) { + case POSIXIO: + + /* determine lowest dimension for contiguous POSIX access */ + cont_dim = rank; + + for (i = rank - 1; i >= 0; i--) { + if (parms->buf_size[i] == parms->dset_size[i]) + cont_dim = i; + else + break; + } + + /* determine size of the contiguous POSIX access */ + cont_size = (!cont_dim) ? 1 : parms->buf_size[cont_dim - 1]; + for (i = cont_dim; i < rank; i++) + cont_size *= parms->buf_size[i]; + + break; + + case HDF5: /* HDF5 setup */ + + for (i = 0; i < rank; i++) { + h5dims[i] = parms->dset_size[i]; + h5start[i] = 0; + h5stride[i] = 1; + h5block[i] = 1; + h5count[i] = parms->buf_size[i]; + h5chunk[i] = parms->chk_size[i]; + h5maxdims[i] = H5S_UNLIMITED; + } + + if (parms->h5_use_chunks && parms->h5_extendable) { + h5dset_space_id = H5Screate_simple(rank, h5count, h5maxdims); + VRFY((h5dset_space_id >= 0), "H5Screate_simple"); + } + else { + h5dset_space_id = H5Screate_simple(rank, h5dims, NULL); + VRFY((h5dset_space_id >= 0), "H5Screate_simple"); + } + + hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, h5block); + VRFY((hrc >= 0), "H5Sselect_hyperslab"); + + /* Create the memory dataspace that corresponds to the xfer buffer */ + h5mem_space_id = H5Screate_simple(rank, h5count, NULL); + VRFY((h5mem_space_id >= 0), "H5Screate_simple"); + + /* Create the dataset transfer property list */ + h5dxpl = H5Pcreate(H5P_DATASET_XFER); + if (h5dxpl < 0) { + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); + } + + break; + + default: + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); + GOTOERROR(FAIL); + break; + } /* end switch */ + + /* create dataset */ + switch (parms->io_type) { + case POSIXIO: + break; + + case HDF5: + h5dcpl = H5Pcreate(H5P_DATASET_CREATE); + + if (h5dcpl < 0) { + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); + } + + if (parms->h5_use_chunks) { + /* Set the chunk size to be the same as the buffer size */ + hrc = H5Pset_chunk(h5dcpl, rank, h5chunk); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Property List Set failed\n"); + GOTOERROR(FAIL); + } /* end if */ + } /* end if */ + + HDsprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes); + h5ds_id = + H5Dcreate2(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, H5P_DEFAULT, h5dcpl, H5P_DEFAULT); + + if (h5ds_id < 0) { + HDfprintf(stderr, "HDF5 Dataset Create failed\n"); + GOTOERROR(FAIL); + } + + hrc = H5Pclose(h5dcpl); + /* verifying the close of the dcpl */ + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Property List Close failed\n"); + GOTOERROR(FAIL); + } + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); + GOTOERROR(FAIL); + break; + } + + /* Start "raw data" write timer */ + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); + + /* Perform write */ + hrc = dset_write(rank - 1, fd, parms, buffer); + + if (hrc < 0) { + HDfprintf(stderr, "Error in dataset write\n"); + GOTOERROR(FAIL); + } + + /* Stop "raw data" write timer */ + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); + + /* Calculate write time */ + + /* Close dataset. Only HDF5 needs to do an explicit close. */ + if (parms->io_type == HDF5) { + hrc = H5Dclose(h5ds_id); + + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Close failed\n"); + GOTOERROR(FAIL); + } + + h5ds_id = H5I_INVALID_HID; + } /* end if */ + +done: + + /* release HDF5 objects */ + if (h5dset_space_id != -1) { + hrc = H5Sclose(h5dset_space_id); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); + ret_code = FAIL; + } + else { + h5dset_space_id = H5I_INVALID_HID; + } + } + + if (h5mem_space_id != -1) { + hrc = H5Sclose(h5mem_space_id); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); + ret_code = FAIL; + } + else { + h5mem_space_id = H5I_INVALID_HID; + } + } + + if (h5dxpl != -1) { + hrc = H5Pclose(h5dxpl); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); + ret_code = FAIL; + } + else { + h5dxpl = H5I_INVALID_HID; + } + } + + return ret_code; +} + +/* + * Function: dset_write + * Purpose: Write buffer into the dataset. + * Return: SUCCESS or FAIL + * Programmer: Christian Chilan, April, 2008 + * Modifications: + */ +static herr_t +dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) +{ + int cur_dim = order[local_dim] - 1; + int ret_code = SUCCESS; + int k; + hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS]; + hsize_t i; + int j; + herr_t hrc; + + /* iterates according to the dimensions in order array */ + for (i = 0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]) { + + h5offset[cur_dim] = (hssize_t)i; + offset[cur_dim] = (HDoff_t)i; + + if (local_dim > 0) { + + dset_write(local_dim - 1, fd, parms, buffer); + } + else { + + switch (parms->io_type) { + + case POSIXIO: + /* initialize POSIX offset in the buffer */ + for (j = 0; j < parms->rank; j++) + buf_offset[j] = 0; + buf_p = (unsigned char *)buffer; + /* write POSIX buffer */ + posix_buffer_write(0, fd, parms, buffer); + break; + + case HDF5: + /* if dimensions are extendable, extend them as needed during access */ + if (parms->h5_use_chunks && parms->h5_extendable) { + + hrc = H5Sget_simple_extent_dims(h5dset_space_id, dims, maxdims); + VRFY((hrc >= 0), "H5Sget_simple_extent_dims"); + + for (k = 0; k < parms->rank; k++) { + + HDassert(h5offset[k] >= 0); + if (dims[k] <= (hsize_t)h5offset[k]) { + dims[k] = dims[k] + h5count[k]; + hrc = H5Sset_extent_simple(h5dset_space_id, parms->rank, dims, maxdims); + VRFY((hrc >= 0), "H5Sset_extent_simple"); + hrc = H5Dset_extent(h5ds_id, dims); + VRFY((hrc >= 0), "H5Dextend"); + } + } + } + /* applies offset */ + hrc = H5Soffset_simple(h5dset_space_id, h5offset); + VRFY((hrc >= 0), "H5Soffset_simple"); + + /* Write the buffer out */ + hrc = H5Sget_simple_extent_dims(h5dset_space_id, dims, maxdims); + hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); + VRFY((hrc >= 0), "H5Dwrite"); + + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); + HDassert(0 && "Unknown IO type"); + break; + } /* switch (parms->io_type) */ + } + } +done: + return ret_code; +} + +/* + * Function: posix_buffer_write + * Purpose: Write buffer into the POSIX file considering contiguity. + * Return: SUCCESS or FAIL + * Programmer: Christian Chilan, April, 2008 + * Modifications: + */ + +static herr_t +posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) +{ + int ret_code = SUCCESS; + + /* if dimension is not contiguous, call recursively */ + if (local_dim < parms->rank - 1 && local_dim != cont_dim) { + size_t u; + + for (u = 0; u < parms->buf_size[local_dim]; u++) { + buf_offset[local_dim] = u; + posix_buffer_write(local_dim + 1, fd, parms, buffer); + + /* if next dimension is cont_dim, it will fill out the buffer + traversing the entire dimension local_dim without the need + of performing iteration */ + if (local_dim + 1 == cont_dim) + break; + } + /* otherwise, perform contiguous POSIX access */ + } + else { + HDoff_t d_offset; + HDoff_t linear_dset_offset = 0; + int i, j, rc; + + buf_offset[local_dim] = 0; + + /* determine offset in the buffer */ + for (i = 0; i < parms->rank; i++) { + d_offset = 1; + + for (j = i + 1; j < parms->rank; j++) + d_offset *= (HDoff_t)parms->dset_size[j]; + + linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset; + } + + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0; + VRFY((rc == 0), "POSIXSEEK"); + /* check if all bytes are written */ + rc = ((ssize_t)cont_size == POSIXWRITE(fd->posixfd, buf_p, cont_size)); + VRFY((rc != 0), "POSIXWRITE"); + + /* Advance location in buffer */ + buf_p += cont_size; + } + +done: + return ret_code; +} + +/* + * Function: do_read + * Purpose: Read the required amount of data to the file. + * Return: SUCCESS or FAIL + * Programmer: Christian Chilan, April, 2008 + * Modifications: + */ +static herr_t +do_read(results *res, file_descr *fd, parameters *parms, void *buffer) +{ + char * buffer2 = NULL; /* Buffer for data verification */ + int ret_code = SUCCESS; + char dname[64]; + int i; + size_t u; + /* HDF5 variables */ + herr_t hrc; /*HDF5 return code */ + hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */ + hsize_t h5block[MAX_DIMS]; /*dataspace selection */ + hsize_t h5stride[MAX_DIMS]; /*selection stride */ + hsize_t h5start[MAX_DIMS]; /*selection start */ + int rank; + + /* Allocate data verification buffer */ + if (NULL == (buffer2 = (char *)malloc(linear_buf_size))) { + HDfprintf(stderr, "malloc for data verification buffer size (%zu) failed\n", linear_buf_size); + GOTOERROR(FAIL); + } /* end if */ + + /* Prepare buffer for verifying data */ + for (u = 0; u < linear_buf_size; u++) + buffer2[u] = (char)(u % 128); + + rank = parms->rank; + for (i = 0; i < rank; i++) + h5offset[i] = offset[i] = 0; + + /* I/O Access specific setup */ + switch (parms->io_type) { + case POSIXIO: + cont_dim = rank; + + for (i = rank - 1; i >= 0; i--) { + if (parms->buf_size[i] == parms->dset_size[i]) + cont_dim = i; + else + break; + } + cont_size = (!cont_dim) ? 1 : parms->buf_size[cont_dim - 1]; + for (i = cont_dim; i < rank; i++) + cont_size *= parms->buf_size[i]; + + break; + + case HDF5: /* HDF5 setup */ + for (i = 0; i < rank; i++) { + h5dims[i] = parms->dset_size[i]; + h5start[i] = 0; + h5stride[i] = 1; + h5block[i] = 1; + h5count[i] = parms->buf_size[i]; + } + + h5dset_space_id = H5Screate_simple(rank, h5dims, NULL); + VRFY((h5dset_space_id >= 0), "H5Screate_simple"); + + hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, h5block); + VRFY((hrc >= 0), "H5Sselect_hyperslab"); + + /* Create the memory dataspace that corresponds to the xfer buffer */ + h5mem_space_id = H5Screate_simple(rank, h5count, NULL); + VRFY((h5mem_space_id >= 0), "H5Screate_simple"); + + /* Create the dataset transfer property list */ + h5dxpl = H5Pcreate(H5P_DATASET_XFER); + if (h5dxpl < 0) { + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); + } + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); + GOTOERROR(FAIL); + break; + } /* end switch */ + + /* create dataset */ + switch (parms->io_type) { + case POSIXIO: + break; + + case HDF5: + HDsprintf(dname, "Dataset_%ld", (long)parms->num_bytes); + h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT); + if (h5ds_id < 0) { + HDfprintf(stderr, "HDF5 Dataset open failed\n"); + GOTOERROR(FAIL); + } + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); + GOTOERROR(FAIL); + break; + } /* end switch */ + + /* Start "raw data" read timer */ + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); + hrc = dset_read(rank - 1, fd, parms, buffer, buffer2); + + if (hrc < 0) { + HDfprintf(stderr, "Error in dataset read\n"); + GOTOERROR(FAIL); + } + + /* Stop "raw data" read timer */ + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); + + /* Calculate read time */ + + /* Close dataset. Only HDF5 needs to do an explicit close. */ + if (parms->io_type == HDF5) { + hrc = H5Dclose(h5ds_id); + + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Close failed\n"); + GOTOERROR(FAIL); + } + + h5ds_id = H5I_INVALID_HID; + } /* end if */ + +done: + + /* release HDF5 objects */ + if (h5dset_space_id != -1) { + hrc = H5Sclose(h5dset_space_id); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); + ret_code = FAIL; + } + else { + h5dset_space_id = H5I_INVALID_HID; + } + } + + if (h5mem_space_id != -1) { + hrc = H5Sclose(h5mem_space_id); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); + ret_code = FAIL; + } + else { + h5mem_space_id = H5I_INVALID_HID; + } + } + + if (h5dxpl != -1) { + hrc = H5Pclose(h5dxpl); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); + ret_code = FAIL; + } + else { + h5dxpl = H5I_INVALID_HID; + } + } + + /* release generic resources */ + if (buffer2) + free(buffer2); + + return ret_code; +} + +/* + * Function: dset_read + * Purpose: Read buffer into the dataset. + * Return: SUCCESS or FAIL + * Programmer: Christian Chilan, April, 2008 + * Modifications: + */ + +static herr_t +dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer, const char *buffer2) +{ + int cur_dim = order[local_dim] - 1; + hsize_t i; + int j; + herr_t hrc; + int ret_code = SUCCESS; + + /* iterate on the current dimension */ + for (i = 0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]) { + + h5offset[cur_dim] = (hssize_t)i; + offset[cur_dim] = (HDoff_t)i; + + /* if traverse in order array is incomplete, recurse */ + if (local_dim > 0) { + + ret_code = dset_read(local_dim - 1, fd, parms, buffer, buffer2); + + /* otherwise, write buffer into dataset */ + } + else { + + switch (parms->io_type) { + + case POSIXIO: + for (j = 0; j < parms->rank; j++) { + buf_offset[j] = 0; + } + buf_p = (unsigned char *)buffer; + posix_buffer_read(0, fd, parms, buffer); + break; + + case HDF5: + hrc = H5Soffset_simple(h5dset_space_id, h5offset); + VRFY((hrc >= 0), "H5Soffset_simple"); + /* Read the buffer out */ + hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); + VRFY((hrc >= 0), "H5Dread"); + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); + HDassert(0 && "Unknown IO type"); + break; + } /* switch (parms->io_type) */ + } + } +done: + return ret_code; +} + +/* + * Function: posix_buffer_read + * Purpose: Read buffer into the POSIX file considering contiguity. + * Return: SUCCESS or FAIL + * Programmer: Christian Chilan, April, 2008 + * Modifications: + */ + +static herr_t +posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer) +{ + int ret_code = SUCCESS; + + /* if local dimension is not contiguous, recurse */ + if (local_dim < parms->rank - 1 && local_dim != cont_dim) { + size_t u; + + for (u = 0; u < parms->buf_size[local_dim]; u++) { + buf_offset[local_dim] = u; + ret_code = posix_buffer_read(local_dim + 1, fd, parms, buffer); + if (local_dim + 1 == cont_dim) + break; + } + /* otherwise, perform contiguous POSIX access */ + } + else { + HDoff_t d_offset; + HDoff_t linear_dset_offset = 0; + int i, j, rc; + + buf_offset[local_dim] = 0; + /* determine offset in buffer */ + for (i = 0; i < parms->rank; i++) { + d_offset = 1; + + for (j = i + 1; j < parms->rank; j++) + d_offset *= (HDoff_t)parms->dset_size[j]; + + linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset; + } + + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0; + VRFY((rc == 0), "POSIXSEEK"); + /* check if all bytes are read */ + rc = ((ssize_t)cont_size == POSIXREAD(fd->posixfd, buf_p, cont_size)); + VRFY((rc != 0), "POSIXREAD"); + + /* Advance location in buffer */ + buf_p += cont_size; + } +done: + return ret_code; +} + +/* + * Function: do_fopen + * Purpose: Open the specified file. + * Return: SUCCESS or FAIL + * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 + * Modifications: Support for file drivers, Christian Chilan, April, 2008 + */ +static herr_t +do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) +{ + int ret_code = SUCCESS; + hid_t fcpl; + + switch (param->io_type) { + case POSIXIO: + if (flags & (SIO_CREATE | SIO_WRITE)) + fd->posixfd = POSIXCREATE(fname); + else + fd->posixfd = POSIXOPEN(fname, O_RDONLY); + + if (fd->posixfd < 0) { + HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname); + GOTOERROR(FAIL); + } + + break; + + case HDF5: + + fapl = set_vfd(param); + + if (fapl < 0) { + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); + } + + fcpl = H5Pcreate(H5P_FILE_CREATE); + if (param->page_size) { + H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1); + H5Pset_file_space_page_size(fcpl, param->page_size); + if (param->page_buffer_size) + H5Pset_page_buffer_size(fapl, param->page_buffer_size, 0, 0); + } + + /* create the parallel file */ + if (flags & (SIO_CREATE | SIO_WRITE)) { + fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl); + } + else { + fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, fapl); + } + + if (fd->h5fd < 0) { + HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname); + GOTOERROR(FAIL); + } + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type); + GOTOERROR(FAIL); + break; + } + +done: + return ret_code; +} + +/* + * Function: set_vfd + * Purpose: Sets file driver. + * Return: SUCCESS or FAIL + * Programmer: Christian Chilan, April, 2008 + * Modifications: + */ + +hid_t +set_vfd(parameters *param) +{ + hid_t my_fapl = H5I_INVALID_HID; + vfdtype vfd; + + vfd = param->vfd; + + if ((my_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return -1; + + if (vfd == sec2) { + /* Unix read() and write() system calls */ + if (H5Pset_fapl_sec2(my_fapl) < 0) + return -1; + } + else if (vfd == stdio) { + /* Standard C fread() and fwrite() system calls */ + if (H5Pset_fapl_stdio(my_fapl) < 0) + return -1; + } + else if (vfd == core) { + /* In-core temporary file with 1MB increment */ + if (H5Pset_fapl_core(my_fapl, (size_t)1024 * 1024, TRUE) < 0) + return -1; + } + else if (vfd == split) { + /* Split meta data and raw data each using default driver */ + if (H5Pset_fapl_split(my_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) + return -1; + } + else if (vfd == multi) { + /* Multi-file driver, general case of the split driver */ + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][1024]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; + H5FD_mem_t mt; + + HDmemset(memb_map, 0, sizeof memb_map); + HDmemset(memb_fapl, 0, sizeof memb_fapl); + HDmemset(memb_name, 0, sizeof memb_name); + HDmemset(memb_addr, 0, sizeof memb_addr); + + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + memb_fapl[mt] = H5P_DEFAULT; + HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + memb_name[mt] = sv[mt]; + memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); + } + + if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) { + return -1; + } + } + else if (vfd == family) { + hsize_t fam_size = 1 * 1024 * 1024; /*100 MB*/ + + /* Family of files, each 1MB and using the default driver */ + /* if ((val=HDstrtok(NULL, " \t\n\r"))) + fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); */ + if (H5Pset_fapl_family(my_fapl, fam_size, H5P_DEFAULT) < 0) + return -1; + } + else if (vfd == direct) { +#ifdef H5_HAVE_DIRECT + /* Linux direct read() and write() system calls. Set memory boundary, file block size, + * and copy buffer size to the default values. */ + if (H5Pset_fapl_direct(my_fapl, 1024, 4096, 8 * 4096) < 0) + return -1; +#endif + } + else { + /* Unknown driver */ + return -1; + } + + return my_fapl; +} + +/* + * Function: do_fclose + * Purpose: Close the specified file descriptor. + * Return: SUCCESS or FAIL + * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 + * Modifications: + */ +static herr_t +do_fclose(iotype iot, file_descr *fd /*out*/) +{ + herr_t ret_code = SUCCESS, hrc; + int rc = 0; + + switch (iot) { + case POSIXIO: + rc = POSIXCLOSE(fd->posixfd); + + if (rc != 0) { + HDfprintf(stderr, "POSIX File Close failed\n"); + GOTOERROR(FAIL); + } + + fd->posixfd = -1; + break; + + case HDF5: + hrc = H5Fclose(fd->h5fd); + + if (hrc < 0) { + HDfprintf(stderr, "HDF5 File Close failed\n"); + GOTOERROR(FAIL); + } + + fd->h5fd = -1; + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); + GOTOERROR(FAIL); + break; + } + +done: + return ret_code; +} + +/* + * Function: do_cleanupfile + * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set. + * Return: void + * Programmer: Albert Cheng 2001/12/12 + * Modifications: Support for file drivers. Christian Chilan, April, 2008 + */ +static void +do_cleanupfile(iotype iot, char *filename) +{ + char temp[2048]; + int j; + hid_t driver; + + if (clean_file_g == -1) + clean_file_g = (HDgetenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0; + + if (clean_file_g) { + + switch (iot) { + case POSIXIO: + HDremove(filename); + break; + + case HDF5: + driver = H5Pget_driver(fapl); + + if (driver == H5FD_FAMILY) { + for (j = 0; /*void*/; j++) { + HDsnprintf(temp, sizeof temp, filename, j); + + if (HDaccess(temp, F_OK) < 0) + break; + + HDremove(temp); + } + } + else if (driver == H5FD_CORE) { + hbool_t backing; /* Whether the core file has backing store */ + + H5Pget_fapl_core(fapl, NULL, &backing); + + /* If the file was stored to disk with bacing store, remove it */ + if (backing) + HDremove(filename); + } + else if (driver == H5FD_MULTI) { + H5FD_mem_t mt; + assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); + HDremove(temp); /*don't care if it fails*/ + } + } + else { + HDremove(filename); + } + H5Pclose(fapl); + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); + HDassert(0 && "Unknown IO type"); + break; + } + } +} diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c new file mode 100644 index 0000000..51a7825 --- /dev/null +++ b/tools/src/h5perf/sio_perf.c @@ -0,0 +1,1437 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Serial HDF5 Performance Testing Code + * -------------------------------------- + * + * Portable code to test performance on the different platforms we support. + * This is what the report should look like: + * + * nprocs = Max#Procs + * IO API = POSIXIO + * # Files = 1, # of dsets = 1000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * # Files = 1, # of dsets = 3000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * + * . . . + * + * + * IO API = HDF5 + * # Files = 1, # of dsets = 1000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * # Files = 1, # of dsets = 3000, Elements per dset = 37000 + * Write Results = x MB/s + * Read Results = x MB/s + * + * . . . + * + * + * . . . + * + */ + +/* system header files */ +#include +#include +#include + +#include "hdf5.h" + +/* our header files */ +#include "sio_perf.h" + +/* useful macros */ +#define TAB_SPACE 4 + +#define ONE_KB 1024 +#define ONE_MB (ONE_KB * ONE_KB) +#define ONE_GB (ONE_MB * ONE_KB) + +#define SIO_POSIX 0x1 +#define SIO_HDF5 0x4 + +/* report 0.0 in case t is zero too */ +#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL(t, 0.0) ? 0.0 : ((((double)bytes) / (double)ONE_MB) / (t))) + +#ifndef TRUE +#define TRUE 1 +#endif /* TRUE */ +#ifndef FALSE +#define FALSE (!TRUE) +#endif /* FALSE */ + +/* global variables */ +FILE *output; /* output file */ +int sio_debug_level = 0; /* The debug level: + * 0 - Off + * 1 - Minimal + * 2 - Some more + * 3 - Maximal + * 4 - Maximal & then some + */ + +/* local variables */ +static const char *progname = "h5perf_serial"; + +/* + * Command-line options: The user can specify short or long-named + * parameters. The long-named ones can be partially spelled. When + * adding more, make sure that they don't clash with each other. + */ + +/* + * It seems that only the options that accept additional information + * such as dataset size (-e) require the colon next to it. + */ +static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; +static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, + {"alig", require_arg, 'a'}, + {"ali", require_arg, 'a'}, + {"al", require_arg, 'a'}, + {"api", require_arg, 'A'}, + {"ap", require_arg, 'A'}, +#if 0 + /* a sighting of the elusive binary option */ + { "binary", no_arg, 'b' }, + { "binar", no_arg, 'b' }, + { "bina", no_arg, 'b' }, + { "bin", no_arg, 'b' }, + { "bi", no_arg, 'b' }, +#endif /* 0 */ + {"block-size", require_arg, 'B'}, + {"block-siz", require_arg, 'B'}, + {"block-si", require_arg, 'B'}, + {"block-s", require_arg, 'B'}, + {"block-", require_arg, 'B'}, + {"block", require_arg, 'B'}, + {"bloc", require_arg, 'B'}, + {"blo", require_arg, 'B'}, + {"bl", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"chun", no_arg, 'c'}, + {"chu", no_arg, 'c'}, + {"ch", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"collectiv", no_arg, 'C'}, + {"collecti", no_arg, 'C'}, + {"collect", no_arg, 'C'}, + {"collec", no_arg, 'C'}, + {"colle", no_arg, 'C'}, + {"coll", no_arg, 'C'}, + {"col", no_arg, 'C'}, + {"co", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"debu", require_arg, 'D'}, + {"deb", require_arg, 'D'}, + {"de", require_arg, 'D'}, + {"file-driver", require_arg, 'v'}, + {"file-drive", require_arg, 'v'}, + {"file-driv", require_arg, 'v'}, + {"file-dri", require_arg, 'v'}, + {"file-dr", require_arg, 'v'}, + {"file-d", require_arg, 'v'}, + {"file-", require_arg, 'v'}, + {"file", require_arg, 'v'}, + {"fil", require_arg, 'v'}, + {"fi", require_arg, 'v'}, + {"geometry", no_arg, 'g'}, + {"geometr", no_arg, 'g'}, + {"geomet", no_arg, 'g'}, + {"geome", no_arg, 'g'}, + {"geom", no_arg, 'g'}, + {"geo", no_arg, 'g'}, + {"ge", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"interleave", require_arg, 'I'}, + {"interleav", require_arg, 'I'}, + {"interlea", require_arg, 'I'}, + {"interle", require_arg, 'I'}, + {"interl", require_arg, 'I'}, + {"inter", require_arg, 'I'}, + {"inte", require_arg, 'I'}, + {"int", require_arg, 'I'}, + {"in", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"max-num-processe", require_arg, 'P'}, + {"max-num-process", require_arg, 'P'}, + {"max-num-proces", require_arg, 'P'}, + {"max-num-proce", require_arg, 'P'}, + {"max-num-proc", require_arg, 'P'}, + {"max-num-pro", require_arg, 'P'}, + {"max-num-pr", require_arg, 'P'}, + {"max-num-p", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"min-num-processe", require_arg, 'p'}, + {"min-num-process", require_arg, 'p'}, + {"min-num-proces", require_arg, 'p'}, + {"min-num-proce", require_arg, 'p'}, + {"min-num-proc", require_arg, 'p'}, + {"min-num-pro", require_arg, 'p'}, + {"min-num-pr", require_arg, 'p'}, + {"min-num-p", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"max-xfer-siz", require_arg, 'X'}, + {"max-xfer-si", require_arg, 'X'}, + {"max-xfer-s", require_arg, 'X'}, + {"max-xfer", require_arg, 'X'}, + {"max-xfe", require_arg, 'X'}, + {"max-xf", require_arg, 'X'}, + {"max-x", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"min-xfer-siz", require_arg, 'x'}, + {"min-xfer-si", require_arg, 'x'}, + {"min-xfer-s", require_arg, 'x'}, + {"min-xfer", require_arg, 'x'}, + {"min-xfe", require_arg, 'x'}, + {"min-xf", require_arg, 'x'}, + {"min-x", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-byte", require_arg, 'e'}, + {"num-byt", require_arg, 'e'}, + {"num-by", require_arg, 'e'}, + {"num-b", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-dset", require_arg, 'd'}, + {"num-dse", require_arg, 'd'}, + {"num-ds", require_arg, 'd'}, + {"num-d", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-file", require_arg, 'F'}, + {"num-fil", require_arg, 'F'}, + {"num-fi", require_arg, 'F'}, + {"num-f", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"num-iteration", require_arg, 'i'}, + {"num-iteratio", require_arg, 'i'}, + {"num-iterati", require_arg, 'i'}, + {"num-iterat", require_arg, 'i'}, + {"num-itera", require_arg, 'i'}, + {"num-iter", require_arg, 'i'}, + {"num-ite", require_arg, 'i'}, + {"num-it", require_arg, 'i'}, + {"num-i", require_arg, 'i'}, + {"order", require_arg, 'r'}, + {"orde", require_arg, 'r'}, + {"ord", require_arg, 'r'}, + {"or", require_arg, 'r'}, + {"output", require_arg, 'o'}, + {"outpu", require_arg, 'o'}, + {"outp", require_arg, 'o'}, + {"out", require_arg, 'o'}, + {"ou", require_arg, 'o'}, + {"extendable", no_arg, 't'}, + {"extendabl", no_arg, 't'}, + {"extendab", no_arg, 't'}, + {"extenda", no_arg, 't'}, + {"extend", no_arg, 't'}, + {"exten", no_arg, 't'}, + {"exte", no_arg, 't'}, + {"ext", no_arg, 't'}, + {"ex", no_arg, 't'}, + {"threshold", require_arg, 'T'}, + {"threshol", require_arg, 'T'}, + {"thresho", require_arg, 'T'}, + {"thresh", require_arg, 'T'}, + {"thres", require_arg, 'T'}, + {"thre", require_arg, 'T'}, + {"thr", require_arg, 'T'}, + {"th", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {"write-onl", require_arg, 'w'}, + {"write-on", require_arg, 'w'}, + {"write-o", require_arg, 'w'}, + {"write", require_arg, 'w'}, + {"writ", require_arg, 'w'}, + {"wri", require_arg, 'w'}, + {"wr", require_arg, 'w'}, + {NULL, 0, '\0'}}; + +struct options { + long io_types; /* bitmask of which I/O types to test */ + const char *output_file; /* file to print report to */ + long num_dsets; /* number of datasets */ + long num_files; /* number of files */ + off_t num_bpp; /* number of bytes per proc per dset */ + int num_iters; /* number of iterations */ + hsize_t dset_size[MAX_DIMS]; /* Dataset size */ + size_t buf_size[MAX_DIMS]; /* Buffer size */ + size_t chk_size[MAX_DIMS]; /* Chunk size */ + int order[MAX_DIMS]; /* Dimension access order */ + int dset_rank; /* Rank */ + int buf_rank; /* Rank */ + int order_rank; /* Rank */ + int chk_rank; /* Rank */ + int print_times; /* print times as well as throughputs */ + int print_raw; /* print raw data throughput info */ + hsize_t h5_alignment; /* alignment in HDF5 file */ + hsize_t h5_threshold; /* threshold for alignment in HDF5 file */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ + int h5_extendable; /* Perform the write tests only */ + int verify; /* Verify data correctness */ + vfdtype vfd; /* File driver */ + size_t page_buffer_size; + size_t page_size; +}; + +typedef struct { + double min; + double max; + double sum; + int num; +} minmax; + +/* local functions */ +static hsize_t parse_size_directive(const char *size); +static struct options *parse_command_line(int argc, const char *argv[]); +static void run_test_loop(struct options *options); +static int run_test(iotype iot, parameters parms, struct options *opts); +static void output_all_info(minmax *mm, int count, int indent_level); +static void get_minmax(minmax *mm, double val); +static void accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm); +static void output_results(const struct options *options, const char *name, minmax *table, int table_size, + off_t data_size); +static void output_report(const char *fmt, ...); +static void print_indent(register int indent); +static void usage(const char *prog); +static void report_parameters(struct options *opts); + +/* + * Function: main + * Purpose: Start things up. + * Return: EXIT_SUCCESS or EXIT_FAILURE + * Programmer: Bill Wendling, 30. October 2001 + * Modifications: + */ +int +main(int argc, const char *argv[]) +{ + int exit_value = EXIT_SUCCESS; + struct options *opts = NULL; + +#ifndef STANDALONE + /* Initialize h5tools lib */ + h5tools_init(); +#endif + + output = stdout; + + opts = parse_command_line(argc, argv); + + if (!opts) { + exit_value = EXIT_FAILURE; + goto finish; + } + + if (opts->output_file) { + if ((output = HDfopen(opts->output_file, "w")) == NULL) { + HDfprintf(stderr, "%s: cannot open output file\n", progname); + HDperror(opts->output_file); + goto finish; + } + } + + report_parameters(opts); + + run_test_loop(opts); + +finish: + HDfree(opts); + return exit_value; +} + +/* + * Function: run_test_loop + * Purpose: Run the I/O tests. Write the results to OUTPUT. + * + * - The slowest changing part of the test is the number of + * processors to use. For each loop iteration, we divide that + * number by 2 and rerun the test. + * + * - The second slowest is what type of IO API to perform. We have + * three choices: POSIXIO, and HDF5. + * + * - Then we change the size of the buffer. This information is + * inferred from the number of datasets to create and the number + * of integers to put into each dataset. The backend code figures + * this out. + * + * Return: Nothing + * Programmer: Bill Wendling, 30. October 2001 + * Modifications: + * Added multidimensional testing (Christian Chilan, April, 2008) + */ +static void +run_test_loop(struct options *opts) +{ + parameters parms; + int i; + size_t buf_bytes; + + /* load options into parameter structure */ + parms.num_files = opts->num_files; + parms.num_dsets = opts->num_dsets; + parms.num_iters = opts->num_iters; + parms.rank = opts->dset_rank; + parms.h5_align = opts->h5_alignment; + parms.h5_thresh = opts->h5_threshold; + parms.h5_use_chunks = opts->h5_use_chunks; + parms.h5_extendable = opts->h5_extendable; + parms.h5_write_only = opts->h5_write_only; + parms.verify = opts->verify; + parms.vfd = opts->vfd; + parms.page_buffer_size = opts->page_buffer_size; + parms.page_size = opts->page_size; + + /* load multidimensional options */ + parms.num_bytes = 1; + buf_bytes = 1; + for (i = 0; i < parms.rank; i++) { + parms.buf_size[i] = opts->buf_size[i]; + parms.dset_size[i] = opts->dset_size[i]; + parms.chk_size[i] = opts->chk_size[i]; + parms.order[i] = opts->order[i]; + parms.num_bytes *= opts->dset_size[i]; + buf_bytes *= opts->buf_size[i]; + } + + /* print size information */ + output_report("Transfer Buffer Size (bytes): %d\n", buf_bytes); + output_report("File Size(MB): %.2f\n", ((double)parms.num_bytes) / ONE_MB); + + print_indent(0); + if (opts->io_types & SIO_POSIX) + run_test(POSIXIO, parms, opts); + + print_indent(0); + if (opts->io_types & SIO_HDF5) + run_test(HDF5, parms, opts); +} + +/* + * Function: run_test + * Purpose: Inner loop call to actually run the I/O test. + * Return: Nothing + * Programmer: Bill Wendling, 18. December 2001 + * Modifications: + */ +static int +run_test(iotype iot, parameters parms, struct options *opts) +{ + results res; + register int i, ret_value = SUCCESS; + off_t raw_size; + minmax * write_sys_mm_table = NULL; + minmax * write_mm_table = NULL; + minmax * write_gross_mm_table = NULL; + minmax * write_raw_mm_table = NULL; + minmax * read_sys_mm_table = NULL; + minmax * read_mm_table = NULL; + minmax * read_gross_mm_table = NULL; + minmax * read_raw_mm_table = NULL; + minmax write_sys_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax write_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax write_gross_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax write_raw_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax read_sys_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax read_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax read_gross_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax read_raw_mm = {0.0F, 0.0F, 0.0F, 0}; + + raw_size = (off_t)parms.num_bytes; + parms.io_type = iot; + print_indent(2); + output_report("IO API = "); + + switch (iot) { + case POSIXIO: + output_report("POSIX\n"); + break; + case HDF5: + output_report("HDF5\n"); + break; + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); + HDassert(0 && "Unknown IO tpe"); + break; + } + + /* allocate space for tables minmax and that it is sufficient */ + /* to initialize all elements to zeros by calloc. */ + write_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); + write_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); + write_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); + write_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); + + if (!parms.h5_write_only) { + read_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); + read_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); + read_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); + read_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); + } + + /* Do IO iteration times, collecting statistics each time */ + for (i = 0; i < parms.num_iters; ++i) { + double t; + + do_sio(parms, &res); + + /* gather all of the "sys write" times */ + t = io_time_get(res.timers, HDF5_MPI_WRITE); + get_minmax(&write_sys_mm, t); + + write_sys_mm_table[i] = write_sys_mm; + + /* gather all of the "write" times */ + t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); + get_minmax(&write_mm, t); + + write_mm_table[i] = write_mm; + + /* gather all of the "write" times from open to close */ + t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); + get_minmax(&write_gross_mm, t); + + write_gross_mm_table[i] = write_gross_mm; + + /* gather all of the raw "write" times */ + t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); + get_minmax(&write_raw_mm, t); + + write_raw_mm_table[i] = write_raw_mm; + + if (!parms.h5_write_only) { + /* gather all of the "mpi read" times */ + t = io_time_get(res.timers, HDF5_MPI_READ); + get_minmax(&read_sys_mm, t); + + read_sys_mm_table[i] = read_sys_mm; + + /* gather all of the "read" times */ + t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS); + get_minmax(&read_mm, t); + + read_mm_table[i] = read_mm; + + /* gather all of the "read" times from open to close */ + t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS); + get_minmax(&read_gross_mm, t); + + read_gross_mm_table[i] = read_gross_mm; + + /* gather all of the raw "read" times */ + t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS); + get_minmax(&read_raw_mm, t); + + read_raw_mm_table[i] = read_gross_mm; + } + io_time_destroy(res.timers); + } + + /* + * Show various statistics + */ + /* Write statistics */ + /* Print the raw data throughput if desired */ + if (opts->print_raw) { + /* accumulate and output the max, min, and average "raw write" times */ + if (sio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Raw Data Write details:\n"); + output_all_info(write_raw_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size); + } /* end if */ + + /* show sys write statics */ +#if 0 + if (sio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("MPI Write details:\n"); + output_all_info(write_sys_mm_table, parms.num_iters, 4); + } +#endif + /* We don't currently output the MPI write results */ + + /* accumulate and output the max, min, and average "write" times */ + if (sio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Write details:\n"); + output_all_info(write_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Write", write_mm_table, parms.num_iters, raw_size); + + /* accumulate and output the max, min, and average "gross write" times */ + if (sio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Write Open-Close details:\n"); + output_all_info(write_gross_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Write Open-Close", write_gross_mm_table, parms.num_iters, raw_size); + + if (!parms.h5_write_only) { + /* Read statistics */ + /* Print the raw data throughput if desired */ + if (opts->print_raw) { + /* accumulate and output the max, min, and average "raw read" times */ + if (sio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Raw Data Read details:\n"); + output_all_info(read_raw_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size); + } /* end if */ + + /* show mpi read statics */ +#if 0 + if (sio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("MPI Read details:\n"); + output_all_info(read_sys_mm_table, parms.num_iters, 4); + } +#endif + /* We don't currently output the MPI read results */ + + /* accumulate and output the max, min, and average "read" times */ + if (sio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Read details:\n"); + output_all_info(read_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Read", read_mm_table, parms.num_iters, raw_size); + + /* accumulate and output the max, min, and average "gross read" times */ + if (sio_debug_level >= 3) { + /* output all of the times for all iterations */ + print_indent(3); + output_report("Read Open-Close details:\n"); + output_all_info(read_gross_mm_table, parms.num_iters, 4); + } + + output_results(opts, "Read Open-Close", read_gross_mm_table, parms.num_iters, raw_size); + } + + /* clean up our mess */ + HDfree(write_sys_mm_table); + HDfree(write_mm_table); + HDfree(write_gross_mm_table); + HDfree(write_raw_mm_table); + + if (!parms.h5_write_only) { + HDfree(read_sys_mm_table); + HDfree(read_mm_table); + HDfree(read_gross_mm_table); + HDfree(read_raw_mm_table); + } + + return ret_value; +} + +/* + * Function: output_all_info + * Purpose: + * Return: Nothing + * Programmer: Bill Wendling, 29. January 2002 + * Modifications: + */ +static void +output_all_info(minmax *mm, int count, int indent_level) +{ + int i; + + for (i = 0; i < count; ++i) { + print_indent(indent_level); + output_report("Iteration %d:\n", i + 1); + print_indent(indent_level + 1); + output_report("Minimum Time: %.2fs\n", mm[i].min); + print_indent(indent_level + 1); + output_report("Maximum Time: %.2fs\n", mm[i].max); + } +} + +/* + * Function: get_minmax + * Purpose: Gather all the min, max and total of val. + * Return: Nothing + * Programmer: Bill Wendling, 21. December 2001 + * Modifications: + * Use MPI_Allreduce to do it. -akc, 2002/01/11 + */ + +static void +get_minmax(minmax *mm, double val) +{ + mm->max = val; + mm->min = val; + mm->sum = val; +} + +/* + * Function: accumulate_minmax_stuff + * Purpose: Accumulate the minimum, maximum, and average of the times + * across all processes. + * Return: TOTAL_MM - the total of all of these. + * Programmer: Bill Wendling, 21. December 2001 + * Modifications: + * Changed to use seconds instead of MB/s - QAK, 5/9/02 + */ +static void +accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm) +{ + int i; + + total_mm->sum = 0.0F; + total_mm->max = -DBL_MAX; + total_mm->min = DBL_MAX; + total_mm->num = count; + + for (i = 0; i < count; ++i) { + double m = mm[i].max; + + total_mm->sum += m; + + if (m < total_mm->min) + total_mm->min = m; + + if (m > total_mm->max) + total_mm->max = m; + } +} + +/* + * Function: output_results + * Purpose: Print information about the time & bandwidth for a given + * minmax & # of iterations. + * Return: Nothing + * Programmer: Quincey Koziol, 9. May 2002 + * Modifications: + */ +static void +output_results(const struct options *opts, const char *name, minmax *table, int table_size, off_t data_size) +{ + minmax total_mm; + + accumulate_minmax_stuff(table, table_size, &total_mm); + + print_indent(3); + output_report("%s (%d iteration(s)):\n", name, table_size); + + /* Note: The maximum throughput uses the minimum amount of time & vice versa */ + + print_indent(4); + output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.min)); + if (opts->print_times) + output_report(" (%7.3f s)\n", total_mm.min); + else + output_report("\n"); + + print_indent(4); + output_report("Average Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.sum / total_mm.num)); + if (opts->print_times) + output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num)); + else + output_report("\n"); + + print_indent(4); + output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.max)); + if (opts->print_times) + output_report(" (%7.3f s)\n", total_mm.max); + else + output_report("\n"); +} + +/* + * Function: output_report + * Purpose: Print a line of the report. Only do so if I'm the 0 process. + * Return: Nothing + * Programmer: Bill Wendling, 19. December 2001 + * Modifications: + */ +static void +output_report(const char *fmt, ...) +{ + va_list ap; + + HDva_start(ap, fmt); + HDvfprintf(output, fmt, ap); + HDva_end(ap); +} + +/* + * Function: print_indent + * Purpose: Print spaces to indent a new line of text for pretty printing + * things. + * Return: Nothing + * Programmer: Bill Wendling, 29. October 2001 + * Modifications: + */ +static void +print_indent(register int indent) +{ + indent *= TAB_SPACE; + + for (; indent > 0; --indent) + HDfputc(' ', output); +} + +static void +recover_size_and_print(long long val, const char *end) +{ + if (val >= ONE_KB && (val % ONE_KB) == 0) { + if (val >= ONE_MB && (val % ONE_MB) == 0) { + if (val >= ONE_GB && (val % ONE_GB) == 0) + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "GB%s", + val / ONE_GB, end); + else + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "MB%s", + val / ONE_MB, end); + } + else { + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "KB%s", + val / ONE_KB, end); + } + } + else { + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "%s", + val, end); + } +} + +static void +print_io_api(long io_types) +{ + if (io_types & SIO_POSIX) + HDfprintf(output, "posix "); + if (io_types & SIO_HDF5) + HDfprintf(output, "hdf5 "); + HDfprintf(output, "\n"); +} + +static void +report_parameters(struct options *opts) +{ + int i, rank; + rank = opts->dset_rank; + + print_version("HDF5 Library"); /* print library version */ + HDfprintf(output, "==== Parameters ====\n"); + + HDfprintf(output, "IO API="); + print_io_api(opts->io_types); + + HDfprintf(output, "Number of iterations=%d\n", opts->num_iters); + + HDfprintf(output, "Dataset size="); + + for (i = 0; i < rank; i++) + recover_size_and_print((long long)opts->dset_size[i], " "); + HDfprintf(output, "\n"); + + HDfprintf(output, "Transfer buffer size="); + for (i = 0; i < rank; i++) + recover_size_and_print((long long)opts->buf_size[i], " "); + HDfprintf(output, "\n"); + + if (opts->page_size) { + HDfprintf(output, "Page Aggregation Enabled. Page size = %zu\n", opts->page_size); + if (opts->page_buffer_size) + HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %zu\n", opts->page_buffer_size); + else + HDfprintf(output, "Page Buffering Disabled\n"); + } + else + HDfprintf(output, "Page Aggregation Disabled\n"); + + HDfprintf(output, "Dimension access order="); + for (i = 0; i < rank; i++) + recover_size_and_print((long long)opts->order[i], " "); + HDfprintf(output, "\n"); + + if (opts->io_types & SIO_HDF5) { + + HDfprintf(output, "HDF5 data storage method="); + + if (opts->h5_use_chunks) { + + HDfprintf(output, "Chunked\n"); + HDfprintf(output, "HDF5 chunk size="); + for (i = 0; i < rank; i++) + recover_size_and_print((long long)opts->chk_size[i], " "); + HDfprintf(output, "\n"); + + HDfprintf(output, "HDF5 dataset dimensions="); + if (opts->h5_extendable) { + HDfprintf(output, "Extendable\n"); + } + else { + HDfprintf(output, "Fixed\n"); + } + } + else { + HDfprintf(output, "Contiguous\n"); + } + + HDfprintf(output, "HDF5 file driver="); + if (opts->vfd == sec2) { + HDfprintf(output, "sec2\n"); + } + else if (opts->vfd == stdio) { + HDfprintf(output, "stdio\n"); + } + else if (opts->vfd == core) { + HDfprintf(output, "core\n"); + } + else if (opts->vfd == split) { + HDfprintf(output, "split\n"); + } + else if (opts->vfd == multi) { + HDfprintf(output, "multi\n"); + } + else if (opts->vfd == family) { + HDfprintf(output, "family\n"); + } + else if (opts->vfd == direct) { + HDfprintf(output, "direct\n"); + } + } + + { + char *prefix = HDgetenv("HDF5_PREFIX"); + + HDfprintf(output, "Env HDF5_PREFIX=%s\n", (prefix ? prefix : "not set")); + } + + HDfprintf(output, "==== End of Parameters ====\n"); + HDfprintf(output, "\n"); +} + +/* + * Function: parse_command_line + * Purpose: Parse the command line options and return a STRUCT OPTIONS + * structure which will need to be freed by the calling function. + * Return: Pointer to an OPTIONS structure + * Programmer: Bill Wendling, 31. October 2001 + * Modifications: + * Added multidimensional testing (Christian Chilan, April, 2008) + */ +static struct options * +parse_command_line(int argc, const char *argv[]) +{ + int opt; + struct options *cl_opts; + int i, default_rank, actual_rank, ranks[4]; + + cl_opts = (struct options *)HDmalloc(sizeof(struct options)); + + cl_opts->page_buffer_size = 0; + cl_opts->page_size = 0; + + cl_opts->output_file = NULL; + cl_opts->io_types = 0; /* will set default after parsing options */ + cl_opts->num_iters = 1; + + default_rank = 2; + + cl_opts->dset_rank = 0; + cl_opts->buf_rank = 0; + cl_opts->chk_rank = 0; + cl_opts->order_rank = 0; + + for (i = 0; i < MAX_DIMS; i++) { + cl_opts->buf_size[i] = (size_t)((i + 1) * 10); + cl_opts->dset_size[i] = (hsize_t)((i + 1) * 100); + cl_opts->chk_size[i] = (size_t)((i + 1) * 10); + cl_opts->order[i] = i + 1; + } + + cl_opts->vfd = sec2; + + cl_opts->print_times = FALSE; /* Printing times is off by default */ + cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */ + cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */ + cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */ + cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */ + cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ + cl_opts->h5_extendable = FALSE; /* Use extendable dataset */ + cl_opts->verify = FALSE; /* No Verify data correctness by default */ + + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { + switch ((char)opt) { + case 'a': + cl_opts->h5_alignment = parse_size_directive(H5_optarg); + break; + case 'G': + cl_opts->page_size = parse_size_directive(H5_optarg); + break; + case 'b': + cl_opts->page_buffer_size = parse_size_directive(H5_optarg); + break; + case 'A': { + const char *end = H5_optarg; + while (end && *end != '\0') { + char buf[10]; + + HDmemset(buf, '\0', sizeof(buf)); + + for (i = 0; *end != '\0' && *end != ','; ++end) + if (HDisalnum(*end) && i < 10) + buf[i++] = *end; + + if (!HDstrcasecmp(buf, "hdf5")) { + cl_opts->io_types |= SIO_HDF5; + } + else if (!HDstrcasecmp(buf, "posix")) { + cl_opts->io_types |= SIO_POSIX; + } + else { + HDfprintf(stderr, "sio_perf: invalid --api option %s\n", buf); + HDexit(EXIT_FAILURE); + } + + if (*end == '\0') + break; + + end++; + } + } + + break; +#if 0 + case 'b': + /* the future "binary" option */ + break; +#endif /* 0 */ + case 'c': + /* Turn on chunked HDF5 dataset creation */ + cl_opts->h5_use_chunks = 1; + { + const char *end = H5_optarg; + int j = 0; + + while (end && *end != '\0') { + char buf[10]; + + HDmemset(buf, '\0', sizeof(buf)); + + for (i = 0; *end != '\0' && *end != ','; ++end) + if (HDisalnum(*end) && i < 10) + buf[i++] = *end; + + cl_opts->chk_size[j] = parse_size_directive(buf); + + j++; + + if (*end == '\0') + break; + + end++; + } + cl_opts->chk_rank = j; + } + + break; + + case 'D': { + const char *end = H5_optarg; + + while (end && *end != '\0') { + char buf[10]; + + HDmemset(buf, '\0', sizeof(buf)); + + for (i = 0; *end != '\0' && *end != ','; ++end) + if (HDisalnum(*end) && i < 10) + buf[i++] = *end; + + if (HDstrlen(buf) > 1 || HDisdigit(buf[0])) { + size_t j; + + for (j = 0; j < 10 && buf[j] != '\0'; ++j) + if (!HDisdigit(buf[j])) { + HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf); + HDexit(EXIT_FAILURE); + } + + sio_debug_level = atoi(buf); + + if (sio_debug_level > 4) + sio_debug_level = 4; + else if (sio_debug_level < 0) + sio_debug_level = 0; + } + else { + switch (*buf) { + case 'r': + /* Turn on raw data throughput info */ + cl_opts->print_raw = TRUE; + break; + case 't': + /* Turn on time printing */ + cl_opts->print_times = TRUE; + break; + case 'v': + /* Turn on verify data correctness*/ + cl_opts->verify = TRUE; + break; + default: + HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf); + HDexit(EXIT_FAILURE); + } + } + + if (*end == '\0') + break; + + end++; + } + } + + break; + case 'e': { + const char *end = H5_optarg; + int j = 0; + + while (end && *end != '\0') { + char buf[10]; + + HDmemset(buf, '\0', sizeof(buf)); + + for (i = 0; *end != '\0' && *end != ','; ++end) + if (HDisalnum(*end) && i < 10) + buf[i++] = *end; + + cl_opts->dset_size[j] = parse_size_directive(buf); + + j++; + + if (*end == '\0') + break; + + end++; + } + cl_opts->dset_rank = j; + } + + break; + + case 'i': + cl_opts->num_iters = HDatoi(H5_optarg); + break; + case 'o': + cl_opts->output_file = H5_optarg; + break; + case 'T': + cl_opts->h5_threshold = parse_size_directive(H5_optarg); + break; + case 'v': + if (!HDstrcasecmp(H5_optarg, "sec2")) { + cl_opts->vfd = sec2; + } + else if (!HDstrcasecmp(H5_optarg, "stdio")) { + cl_opts->vfd = stdio; + } + else if (!HDstrcasecmp(H5_optarg, "core")) { + cl_opts->vfd = core; + } + else if (!HDstrcasecmp(H5_optarg, "split")) { + cl_opts->vfd = split; + } + else if (!HDstrcasecmp(H5_optarg, "multi")) { + cl_opts->vfd = multi; + } + else if (!HDstrcasecmp(H5_optarg, "family")) { + cl_opts->vfd = family; + } + else if (!HDstrcasecmp(H5_optarg, "direct")) { + cl_opts->vfd = direct; + } + else { + HDfprintf(stderr, "sio_perf: invalid --api option %s\n", H5_optarg); + HDexit(EXIT_FAILURE); + } + break; + case 'w': + cl_opts->h5_write_only = TRUE; + break; + case 't': + cl_opts->h5_extendable = TRUE; + break; + case 'x': { + const char *end = H5_optarg; + int j = 0; + + while (end && *end != '\0') { + char buf[10]; + + HDmemset(buf, '\0', sizeof(buf)); + + for (i = 0; *end != '\0' && *end != ','; ++end) + if (HDisalnum(*end) && i < 10) + buf[i++] = *end; + + cl_opts->buf_size[j] = parse_size_directive(buf); + + j++; + + if (*end == '\0') + break; + + end++; + } + cl_opts->buf_rank = j; + } + + break; + + case 'r': { + const char *end = H5_optarg; + int j = 0; + + while (end && *end != '\0') { + char buf[10]; + + HDmemset(buf, '\0', sizeof(buf)); + + for (i = 0; *end != '\0' && *end != ','; ++end) + if (HDisalnum(*end) && i < 10) + buf[i++] = *end; + + cl_opts->order[j] = (int)parse_size_directive(buf); + + j++; + + if (*end == '\0') + break; + + end++; + } + + cl_opts->order_rank = j; + } + + break; + + case 'h': + case '?': + default: + usage(progname); + HDfree(cl_opts); + return NULL; + } + } + + /* perform rank consistency analysis */ + actual_rank = 0; + + ranks[0] = cl_opts->dset_rank; + ranks[1] = cl_opts->buf_rank; + ranks[2] = cl_opts->order_rank; + ranks[3] = cl_opts->chk_rank; + + for (i = 0; i < 4; i++) { + if (ranks[i] > 0) { + if (!actual_rank) { + actual_rank = ranks[i]; + } + else { + if (actual_rank != ranks[i]) + exit(EXIT_FAILURE); + } + } + } + + if (!actual_rank) + actual_rank = default_rank; + + cl_opts->dset_rank = actual_rank; + cl_opts->buf_rank = actual_rank; + cl_opts->order_rank = actual_rank; + cl_opts->chk_rank = actual_rank; + + for (i = 0; i < actual_rank; i++) { + if (cl_opts->order[i] > actual_rank) { + exit(EXIT_FAILURE); + } + } + + /* set default if none specified yet */ + if (!cl_opts->io_types) + cl_opts->io_types = SIO_HDF5 | SIO_POSIX; /* run all API */ + + /* verify parameters sanity. Adjust if needed. */ + /* cap xfer_size with bytes per process */ + if (cl_opts->num_iters <= 0) + cl_opts->num_iters = 1; + + return cl_opts; +} + +/* + * Function: parse_size_directive + * Purpose: Parse the size directive passed on the commandline. The size + * directive is an integer followed by a size indicator: + * + * K, k - Kilobyte + * M, m - Megabyte + * G, g - Gigabyte + * + * Return: The size as a off_t because this is related to file size. + * If an unknown size indicator is used, then the program will + * exit with EXIT_FAILURE as the return value. + * Programmer: Bill Wendling, 18. December 2001 + * Modifications: + */ + +static hsize_t +parse_size_directive(const char *size) +{ + hsize_t s; + char * endptr; + + s = HDstrtoull(size, &endptr, 10); + + if (endptr && *endptr) { + while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t')) + ++endptr; + + switch (*endptr) { + case 'K': + case 'k': + s *= ONE_KB; + break; + + case 'M': + case 'm': + s *= ONE_MB; + break; + + case 'G': + case 'g': + s *= ONE_GB; + break; + + default: + HDfprintf(stderr, "Illegal size specifier '%c'\n", *endptr); + HDexit(EXIT_FAILURE); + } + } + + return s; +} + +/* + * Function: usage + * Purpose: Print a usage message and then exit. + * Return: Nothing + * Programmer: Bill Wendling, 31. October 2001 + * Modifications: + */ +static void +usage(const char *prog) +{ + print_version(prog); + HDprintf("usage: %s [OPTIONS]\n", prog); + HDprintf(" OPTIONS\n"); + HDprintf(" -h Print an usage message and exit\n"); + HDprintf(" -A AL Which APIs to test\n"); + HDprintf(" [default: all of them]\n"); + HDprintf(" -c SL Selects chunked storage and defines chunks dimensions\n"); + HDprintf(" and sizes\n"); + HDprintf(" [default: Off]\n"); + HDprintf(" -e SL Dimensions and sizes of dataset\n"); + HDprintf(" [default: 100,200]\n"); + HDprintf(" -i N Number of iterations to perform\n"); + HDprintf(" [default: 1]\n"); + HDprintf(" -r NL Dimension access order (see below for description)\n"); + HDprintf(" [default: 1,2]\n"); + HDprintf(" -t Selects extendable dimensions for HDF5 dataset\n"); + HDprintf(" [default: Off]\n"); + HDprintf(" -v VFD Selects file driver for HDF5 access\n"); + HDprintf(" [default: sec2]\n"); + HDprintf(" -w Perform write tests, not the read tests\n"); + HDprintf(" [default: Off]\n"); + HDprintf(" -x SL Dimensions and sizes of the transfer buffer\n"); + HDprintf(" [default: 10,20]\n"); + HDprintf("\n"); + HDprintf(" N - is an integer > 0.\n"); + HDprintf("\n"); + HDprintf(" S - is a size specifier, an integer > 0 followed by a size indicator:\n"); + HDprintf(" K - Kilobyte (%d)\n", ONE_KB); + HDprintf(" M - Megabyte (%d)\n", ONE_MB); + HDprintf(" G - Gigabyte (%d)\n", ONE_GB); + HDprintf("\n"); + HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37 * ONE_MB); + HDprintf("\n"); + HDprintf(" AL - is an API list. Valid values are:\n"); + HDprintf(" hdf5 - HDF5\n"); + HDprintf(" posix - POSIX\n"); + HDprintf("\n"); + HDprintf(" Example: -A posix,hdf5\n"); + HDprintf("\n"); + HDprintf(" NL - is list of integers (N) separated by commas.\n"); + HDprintf("\n"); + HDprintf(" Example: 1,2,3\n"); + HDprintf("\n"); + HDprintf(" SL - is list of size specifiers (S) separated by commas.\n"); + HDprintf("\n"); + HDprintf(" Example: 2K,2K,3K\n"); + HDprintf("\n"); + HDprintf(" The example defines an object (dataset, tranfer buffer) with three\n"); + HDprintf(" dimensions. Be aware that as the number of dimensions increases, the\n"); + HDprintf(" the total size of the object increases exponentially.\n"); + HDprintf("\n"); + HDprintf(" VFD - is an HDF5 file driver specifier. Valid values are:\n"); + HDprintf(" sec2, stdio, core, split, multi, family, direct\n"); + HDprintf("\n"); + HDprintf(" Dimension access order:\n"); + HDprintf(" Data access starts at the cardinal origin of the dataset using the\n"); + HDprintf(" transfer buffer. The next access occurs on a dataset region next to\n"); + HDprintf(" the previous one. For a multidimensional dataset, there are several\n"); + HDprintf(" directions as to where to proceed. This can be specified in the dimension\n"); + HDprintf(" access order. For example, -r 1,2 states that the tool should traverse\n"); + HDprintf(" dimension 1 first, and then dimension 2.\n"); + HDprintf("\n"); + HDprintf(" Environment variables:\n"); + HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); + HDprintf(" HDF5_PREFIX Data file prefix\n"); + HDprintf("\n"); + HDfflush(stdout); +} /* end usage() */ diff --git a/tools/src/h5perf/sio_perf.h b/tools/src/h5perf/sio_perf.h new file mode 100644 index 0000000..d998377 --- /dev/null +++ b/tools/src/h5perf/sio_perf.h @@ -0,0 +1,104 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef SIO_PERF_H +#define SIO_PERF_H + +#ifndef STANDALONE +#include "io_timer.h" +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" +#else +#include "io_timer.h" +#include "sio_standalone.h" +#endif + +/* setup the dataset no fill option if this is v1.5 or more */ +#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4 +#define H5_HAVE_NOFILL 1 +#endif + +#define MAX_DIMS 32 + +typedef enum iotype_ { + POSIXIO, + HDF5 + /*NUM_TYPES*/ +} iotype; + +typedef enum vfdtype_ { + sec2, + stdio, + core, + split, + multi, + family, + direct + /*NUM_TYPES*/ +} vfdtype; + +typedef struct parameters_ { + iotype io_type; /* The type of IO test to perform */ + vfdtype vfd; + long num_files; /* Number of files to create */ + long num_dsets; /* Number of datasets to create */ + hsize_t num_bytes; /* Number of bytes in each dset */ + int num_iters; /* Number of times to loop doing the IO */ + int rank; /* Rank of dataset */ + hsize_t dset_size[MAX_DIMS]; /* Dataset size */ + size_t buf_size[MAX_DIMS]; /* Buffer size */ + size_t chk_size[MAX_DIMS]; /* Chunk size */ + int order[MAX_DIMS]; /* Buffer size */ + hsize_t h5_align; /* HDF5 object alignment */ + hsize_t h5_thresh; /* HDF5 object alignment threshold */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_extendable; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ + int verify; /* Verify data correctness */ + size_t page_size; + size_t page_buffer_size; +} parameters; + +typedef struct results_ { + herr_t ret_code; + io_time_t *timers; +} results; + +#ifndef SUCCESS +#define SUCCESS 0 +#endif /* !SUCCESS */ + +#ifndef FAIL +#define FAIL -1 +#endif /* !FAIL */ + +extern FILE * output; /* output file */ +extern io_time_t *timer_g; /* timer: global for stub functions */ +extern int sio_debug_level; /* The debug level: + * 0 - Off + * 1 - Minimal + * 2 - Some more + * 3 - Maximal + * 4 - Even More Debugging (timer stuff) + */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +extern void do_sio(parameters param, results *res); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SIO_PERF_H */ diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 7399723..7bf79c5 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -4,39 +4,17 @@ project (HDF5_TOOLS_TEST_PERFORM C) # -------------------------------------------------------------------- # Add the executables # -------------------------------------------------------------------- -#-- Adding test for h5perf_serial -set (h5perf_serial_SOURCES - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c -) -add_executable (h5perf_serial ${h5perf_serial_SOURCES}) -target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (h5perf_serial STATIC) - target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -else () - TARGET_C_PROPERTIES (h5perf_serial SHARED) - target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) -endif () -set_target_properties (h5perf_serial PROPERTIES FOLDER perform) - -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_serial_FORMAT h5perf_serial) -endif () if (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for h5perf_serial_alone - io_timer.c includes set (h5perf_serial_alone_SOURCES ${HDF5_TOOLS_DIR}/lib/io_timer.c - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_perf.c + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_engine.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c ) add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES}) - target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR};${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (h5perf_serial_alone STATIC) target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>") @@ -188,63 +166,16 @@ if (HDF5_ENABLE_FORMATTERS) endif () if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) - if (UNIX) - #-- Adding test for perf - only on unix systems - set (perf_SOURCES - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c - ) - add_executable (perf ${perf_SOURCES}) - target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (perf STATIC) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (perf SHARED) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - endif () - set_target_properties (perf PROPERTIES FOLDER perform) - - #----------------------------------------------------------------------------- - # Add Target to clang-format - #----------------------------------------------------------------------------- - if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TOOLS_TEST_PERFORM_perf_FORMAT perf) - endif () - endif () - - #-- Adding test for h5perf - set (h5perf_SOURCES - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c - ) - add_executable (h5perf ${h5perf_SOURCES}) - target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (h5perf STATIC) - target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (h5perf SHARED) - target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - endif () - set_target_properties (h5perf PROPERTIES FOLDER perform) - - #----------------------------------------------------------------------------- - # Add Target to clang-format - #----------------------------------------------------------------------------- - if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_FORMAT h5perf) - endif () - if (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for h5perf set (h5perf_alone_SOURCES ${HDF5_TOOLS_DIR}/lib/io_timer.c - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_perf.c + ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_engine.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c ) add_executable (h5perf_alone ${h5perf_alone_SOURCES}) - target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR};${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (h5perf_alone STATIC) target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${LINK_LIBS} "$<$:${MPI_C_LIBRARIES}>") diff --git a/tools/test/perform/Makefile.am b/tools/test/perform/Makefile.am index 244ef3a..10b13fe 100644 --- a/tools/test/perform/Makefile.am +++ b/tools/test/perform/Makefile.am @@ -21,17 +21,6 @@ include $(top_srcdir)/config/commence.am AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib -# bin_PROGRAMS will be installed. -if BUILD_PARALLEL_CONDITIONAL - bin_PROGRAMS=h5perf_serial h5perf -else - bin_PROGRAMS=h5perf_serial -endif - -# Add h5perf and h5perf_serial specific linker flags here -h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) -h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) - # Some programs are not built or run by default, but can be built by hand or by # specifying --enable-build-all at configure time. # Also, some of these programs should only be built in parallel. @@ -47,18 +36,15 @@ endif # List them in the order they should be run. # Parallel test programs. if BUILD_PARALLEL_CONDITIONAL - TEST_PROG_PARA=h5perf perf + TEST_PROG_PARA= endif # Serial test programs. -TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS) +TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS) # check_PROGRAMS will be built but not installed. Do not any executable # that is in bin_PROGRAMS already. Otherwise, it will be removed twice in # "make clean" and some systems, e.g., AIX, do not like it. -check_PROGRAMS= iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf - -h5perf_SOURCES=pio_perf.c pio_engine.c -h5perf_serial_SOURCES=sio_perf.c sio_engine.c +check_PROGRAMS= $(TEST_PROG) $(BUILD_ALL_PROGS) # These are the files that `make clean' (and derivatives) will remove from # this directory. @@ -67,9 +53,6 @@ CLEANFILES=*.h5 *.raw *.dat x-gnuplot perftest.out # All of the programs depend on the main hdf5 library, and some of them # depend on test or tools library. LDADD=$(LIBHDF5) -h5perf_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5) -h5perf_serial_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5) -perf_LDADD=$(LIBH5TEST) $(LIBHDF5) iopipe_LDADD=$(LIBH5TEST) $(LIBHDF5) zip_perf_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5) perf_meta_LDADD=$(LIBH5TEST) $(LIBHDF5) diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c deleted file mode 100644 index 875f932..0000000 --- a/tools/test/perform/perf.c +++ /dev/null @@ -1,471 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Author: Albert Cheng of NCSA, May 1, 2001. - * This is derived from code given to me by Robert Ross. - * - * NOTE: This code assumes that all command line arguments make it out to all - * the processes that make up the parallel job, which isn't always the case. - * So if it doesn't work on some platform, that might be why. - */ - -#include "hdf5.h" -#include "H5private.h" -#include "h5test.h" - -#ifdef H5_HAVE_PARALLEL - -#include -#include -#include -#include -#include -#include - -#ifdef H5_HAVE_SYS_STAT_H -#include -#endif - -#ifdef H5_HAVE_SYS_TIME_H -#include -#endif - -#ifdef H5_HAVE_SYS_TYPES_H -#include -#endif - -#ifdef H5_HAVE_UNISTD_H -#include -#endif - -#include -#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ -#include -#endif - -/* Macro definitions */ -/* Verify: - * if val is false (0), print mesg and if fatal is true (non-zero), die. - */ -#define H5FATAL 1 -#define VRFY(val, mesg, fatal) \ - do { \ - if (!val) { \ - printf("Proc %d: ", mynod); \ - printf("*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \ - if (fatal) { \ - fflush(stdout); \ - goto die_jar_jar_die; \ - } \ - } \ - } while (0) -#define RANK 1 -#define MAX_PATH 1024 - -hsize_t dims[RANK]; /* dataset dim sizes */ -hsize_t block[RANK], stride[RANK], count[RANK]; -hsize_t start[RANK]; -hid_t fid; /* HDF5 file ID */ -hid_t acc_tpl; /* File access templates */ -hid_t sid; /* Dataspace ID */ -hid_t file_dataspace; /* File dataspace ID */ -hid_t mem_dataspace; /* memory dataspace ID */ -hid_t dataset; /* Dataset ID */ -hsize_t opt_alignment = 1; -hsize_t opt_threshold = 1; -int opt_split_vfd = 0; -char * meta_ext, *raw_ext; /* holds the meta and raw file extension if */ - /* opt_split_vfd is set */ - -/* DEFAULT VALUES FOR OPTIONS */ -int64_t opt_block = 1048576 * 16; -int opt_iter = 1; -int opt_stripe = -1; -int opt_correct = 0; -int amode = O_RDWR | O_CREAT; -char opt_file[256] = "perftest.out"; -char opt_pvfstab[256] = "notset"; -int opt_pvfstab_set = 0; - -const char *FILENAME[] = {opt_file, NULL}; - -/* function prototypes */ -static int parse_args(int argc, char **argv); - -#ifndef H5_HAVE_UNISTD_H -/* globals needed for getopt */ -extern char *optarg; -#endif - -int -main(int argc, char **argv) -{ - char * buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check; - int i, j, mynod = 0, nprocs = 1, my_correct = 1, correct, myerrno; - double stim, etim; - double write_tim = 0; - double read_tim = 0; - double read_bw, write_bw; - double max_read_tim, max_write_tim; - double min_read_tim, min_write_tim; - double ave_read_tim, ave_write_tim; - int64_t iter_jump = 0; - char filename[MAX_PATH]; - herr_t ret; /* Generic return value */ - - /* startup MPI and determine the rank of this process */ - MPI_Init(&argc, &argv); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - - /* parse the command line arguments */ - parse_args(argc, argv); - - if (mynod == 0) - printf("# Using hdf5-io calls.\n"); - -#ifdef H5_HAVE_UNISTD_H - /* Kind of a weird hack- if the location of the pvfstab file was - * specified on the command line, then spit out this location into - * the appropriate environment variable. - */ - if (opt_pvfstab_set) { - if ((setenv("PVFSTAB_FILE", opt_pvfstab, 1)) < 0) { - perror("setenv"); - goto die_jar_jar_die; - } - } -#endif - - /* this is how much of the file data is covered on each iteration of - * the test. used to help determine the seek offset on each - * iteration */ - iter_jump = nprocs * opt_block; - - /* setup a buffer of data to write */ - if (!(tmp = (char *)malloc((size_t)opt_block + 256))) { - perror("malloc"); - goto die_jar_jar_die; - } - buf = tmp + 128 - (((long)tmp) % 128); /* align buffer */ - - if (opt_correct) { - /* do the same buffer setup for verifiable data */ - if (!(tmp2 = (char *)malloc((size_t)opt_block + 256))) { - perror("malloc2"); - goto die_jar_jar_die; - } - buf2 = tmp + 128 - (((long)tmp) % 128); - } - - /* setup file access template with parallel IO access. */ - if (opt_split_vfd) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment * opt_threshold != 1) { - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } - - /* setup file access template */ - acc_tpl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); - ret = H5Pclose(mpio_pl); - VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); - } - else { - /* setup file access template */ - acc_tpl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment * opt_threshold != 1) { - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } - } - - h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename); - - /* create the parallel file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); - VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL); - - /* define a contiquous dataset of opt_iter*nprocs*opt_block chars */ - dims[0] = (hsize_t)opt_iter * (hsize_t)nprocs * (hsize_t)opt_block; - sid = H5Screate_simple(RANK, dims, NULL); - VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL); - dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL); - - /* create the memory dataspace and the file dataspace */ - dims[0] = (hsize_t)opt_block; - mem_dataspace = H5Screate_simple(RANK, dims, NULL); - VRFY((mem_dataspace >= 0), "", H5FATAL); - file_dataspace = H5Dget_space(dataset); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded", H5FATAL); - - /* now each process writes a block of opt_block chars in round robbin - * fashion until the whole dataset is covered. - */ - for (j = 0; j < opt_iter; j++) { - /* setup a file dataspace selection */ - start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); - stride[0] = block[0] = (hsize_t)opt_block; - count[0] = 1; - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); - - if (opt_correct) /* fill in buffer for iteration */ { - for (i = mynod + j, check = buf; i < opt_block; i++, check++) - *check = (char)i; - } - - /* discover the starting time of the operation */ - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - - /* write data */ - ret = H5Dwrite(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf); - VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - - /* discover the ending time of the operation */ - etim = MPI_Wtime(); - - write_tim += (etim - stim); - - /* we are done with this "write" iteration */ - } - - /* close dataset and file */ - ret = H5Dclose(dataset); - VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL); - ret = H5Fclose(fid); - VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL); - - /* wait for everyone to synchronize at this point */ - MPI_Barrier(MPI_COMM_WORLD); - - /* reopen the file for reading */ - fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl); - VRFY((fid >= 0), "", H5FATAL); - - /* open the dataset */ - dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT); - VRFY((dataset >= 0), "H5Dopen succeeded", H5FATAL); - - /* we can re-use the same mem_dataspace and file_dataspace - * the H5Dwrite used since the dimension size is the same. - */ - - /* we are going to repeat the read the same pattern the write used */ - for (j = 0; j < opt_iter; j++) { - /* setup a file dataspace selection */ - start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); - stride[0] = block[0] = (hsize_t)opt_block; - count[0] = 1; - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); - /* seek to the appropriate spot give the current iteration and - * rank within the MPI processes */ - - /* discover the start time */ - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - - /* read in the file data */ - if (!opt_correct) { - ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf); - } - else { - ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf2); - } - myerrno = errno; - - /* discover the end time */ - etim = MPI_Wtime(); - read_tim += (etim - stim); - VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - - if (ret < 0) - HDfprintf(stderr, "node %d, read error, loc = %" PRId64 ": %s\n", mynod, mynod * opt_block, - strerror(myerrno)); - - /* if the user wanted to check correctness, compare the write - * buffer to the read buffer */ - if (opt_correct && memcmp(buf, buf2, (size_t)opt_block)) { - HDfprintf(stderr, "node %d, correctness test failed\n", mynod); - my_correct = 0; - MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD); - } - - /* we are done with this read iteration */ - } - - /* close dataset and file */ - ret = H5Dclose(dataset); - VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL); - ret = H5Fclose(fid); - VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL); - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), "H5Pclose succeeded", H5FATAL); - - /* compute the read and write times */ - MPI_Allreduce(&read_tim, &max_read_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - MPI_Allreduce(&read_tim, &min_read_tim, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - MPI_Allreduce(&read_tim, &ave_read_tim, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - - /* calculate the average from the sum */ - ave_read_tim = ave_read_tim / nprocs; - - MPI_Allreduce(&write_tim, &max_write_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - MPI_Allreduce(&write_tim, &min_write_tim, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - MPI_Allreduce(&write_tim, &ave_write_tim, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - - /* calculate the average from the sum */ - ave_write_tim = ave_write_tim / nprocs; - - /* print out the results on one node */ - if (mynod == 0) { - read_bw = (double)((int64_t)(opt_block * nprocs * opt_iter)) / (max_read_tim * 1000000.0); - write_bw = (double)((int64_t)(opt_block * nprocs * opt_iter)) / (max_write_tim * 1000000.0); - - printf("nr_procs = %d, nr_iter = %d, blk_sz = %ld\n", nprocs, opt_iter, (long)opt_block); - - printf("# total_size = %ld\n", (long)(opt_block * nprocs * opt_iter)); - - printf("# Write: min_time = %f, max_time = %f, mean_time = %f\n", min_write_tim, max_write_tim, - ave_write_tim); - printf("# Read: min_time = %f, max_time = %f, mean_time = %f\n", min_read_tim, max_read_tim, - ave_read_tim); - - printf("Write bandwidth = %f Mbytes/sec\n", write_bw); - printf("Read bandwidth = %f Mbytes/sec\n", read_bw); - - if (opt_correct) { - printf("Correctness test %s.\n", correct ? "passed" : "failed"); - } - } - -die_jar_jar_die: - -#ifdef H5_HAVE_UNISTD - /* Clear the environment variable if it was set earlier */ - if (opt_pvfstab_set) { - unsetenv("PVFSTAB_FILE"); - } -#endif - - free(tmp); - if (opt_correct) - free(tmp2); - - MPI_Finalize(); - - return (0); -} - -static int -parse_args(int argc, char **argv) -{ - int c; - - while ((c = getopt(argc, argv, "s:b:i:f:p:a:2:c")) != EOF) { - switch (c) { - case 's': /* stripe */ - opt_stripe = atoi(optarg); - break; - case 'b': /* block size */ - opt_block = atoi(optarg); - break; - case 'i': /* iterations */ - opt_iter = atoi(optarg); - break; - case 'f': /* filename */ - strncpy(opt_file, optarg, 255); - FILENAME[0] = opt_file; - break; - case 'p': /* pvfstab file */ - strncpy(opt_pvfstab, optarg, 255); - opt_pvfstab_set = 1; - break; - case 'a': /* aligned allocation. - * syntax: -a/ - * e.g., -a4096/512 allocate at 4096 bytes - * boundary if request size >= 512. - */ - { - char *p; - - opt_alignment = (hsize_t)HDatoi(optarg); - if (NULL != (p = (char *)HDstrchr(optarg, '/'))) - opt_threshold = (hsize_t)HDatoi(p + 1); - } - HDfprintf(stdout, "alignment/threshold=%" PRIuHSIZE "/%" PRIuHSIZE "\n", opt_alignment, - opt_threshold); - break; - case '2': /* use 2-files, i.e., split file driver */ - opt_split_vfd = 1; - /* get meta and raw file extension. */ - /* syntax is , */ - meta_ext = raw_ext = optarg; - while (*raw_ext != '\0') { - if (*raw_ext == ',') { - *raw_ext = '\0'; - raw_ext++; - break; - } - raw_ext++; - } - printf("split-file-vfd used: %s,%s\n", meta_ext, raw_ext); - break; - case 'c': /* correctness */ - opt_correct = 1; - break; - case '?': /* unknown */ - default: - break; - } - } - - return (0); -} - -/* - * Local variables: - * c-indent-level: 3 - * c-basic-offset: 3 - * tab-width: 3 - * End: - */ - -#else /* H5_HAVE_PARALLEL */ -/* dummy program since H5_HAVE_PARALLEL is not configured in */ -int -main(int H5_ATTR_UNUSED argc, char H5_ATTR_UNUSED **argv) -{ - printf("No parallel performance because parallel is not configured in\n"); - return (0); -} -#endif /* H5_HAVE_PARALLEL */ diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c deleted file mode 100644 index cac36d7..0000000 --- a/tools/test/perform/pio_engine.c +++ /dev/null @@ -1,2745 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Author: Albert Cheng of NCSA, Oct 24, 2001. - */ - -#include "hdf5.h" - -#include -#include -#include -#include - -#ifdef H5_HAVE_UNISTD_H -#include -#include -#endif - -#ifdef H5_HAVE_SYS_STAT_H -#include -#endif - -#ifdef H5_HAVE_PARALLEL - -#include - -#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ -#include -#endif /* !MPI_FILE_NULL */ - -#include "pio_perf.h" - -/* Macro definitions */ - -#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 6 -#define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate(fd, name, type, space, dcpl) -#define H5DOPEN(fd, name) H5Dopen(fd, name) -#else -#define H5DCREATE(fd, name, type, space, dcpl) \ - H5Dcreate2(fd, name, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT) -#define H5DOPEN(fd, name) H5Dopen2(fd, name, H5P_DEFAULT) -#endif - -/* sizes of various items. these sizes won't change during program execution */ -/* The following three must have the same type */ -#define ELMT_H5_TYPE H5T_NATIVE_UCHAR - -#define GOTOERROR(errcode) \ - { \ - ret_code = errcode; \ - goto done; \ - } -#define ERRMSG(mesg) \ - { \ - HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ - HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \ - } - -/* verify: if val is false (0), print mesg. */ -#define VRFY(val, mesg) \ - do { \ - if (!val) { \ - ERRMSG(mesg); \ - GOTOERROR(FAIL); \ - } \ - } while (0) - -/* POSIX I/O macros */ -#ifdef H5_HAVE_WIN32_API -/* Can't link against the library, so this test will use the older, non-Unicode - * _open() call on Windows. - */ -#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__) -#endif /* H5_HAVE_WIN32_API */ -#define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600) -#define POSIXOPEN(fn, F) HDopen(fn, F, 0600) -#define POSIXCLOSE(F) HDclose(F) -#define POSIXSEEK(F, L) HDlseek(F, L, SEEK_SET) -#define POSIXWRITE(F, B, S) HDwrite(F, B, S) -#define POSIXREAD(F, B, S) HDread(F, B, S) - -enum { PIO_CREATE = 1, PIO_WRITE = 2, PIO_READ = 4 }; - -/* Global variables */ -static int clean_file_g = -1; /*whether to cleanup temporary test */ -/*files. -1 is not defined; */ -/*0 is no cleanup; 1 is do cleanup */ - -/* - * In a parallel machine, the filesystem suitable for compiling is - * unlikely a parallel file system that is suitable for parallel I/O. - * There is no standard pathname for the parallel file system. /tmp - * is about the best guess. - */ -#ifndef HDF5_PARAPREFIX -#define HDF5_PARAPREFIX "" -#endif /* !HDF5_PARAPREFIX */ - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif /* !MIN */ - -/* the different types of file descriptors we can expect */ -typedef union _file_descr { - int posixfd; /* POSIX file handle*/ - MPI_File mpifd; /* MPI file */ - hid_t h5fd; /* HDF5 file */ -} file_descr; - -/* local functions */ -static char * pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size); -static herr_t do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts, - size_t buf_size, void *buffer); -static herr_t do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts, - size_t buf_size, void *buffer /*out*/); -static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags); -static herr_t do_fclose(iotype iot, file_descr *fd); -static void do_cleanupfile(iotype iot, char *fname); -static off_t sqrto(off_t); - -/* - * Function: do_pio - * Purpose: PIO Engine where Parallel IO are executed. - * Return: results - * Programmer: Albert Cheng, Bill Wendling 2001/12/12 - * Modifications: - * Added 2D testing (Christian Chilan, 10. August 2005) - */ -results -do_pio(parameters param) -{ - /* return codes */ - herr_t ret_code = 0; /*return code */ - results res; - - file_descr fd; - iotype iot; - - char fname[FILENAME_MAX]; - long nf; - long ndsets; - off_t nbytes; /*number of bytes per dataset */ - off_t snbytes; /*general dataset size */ - /*for 1D, it is the actual dataset size */ - /*for 2D, it is the size of a side of the dataset square */ - char * buffer = NULL; /*data buffer pointer */ - size_t buf_size; /*general buffer size in bytes */ - /*for 1D, it is the actual buffer size */ - /*for 2D, it is the length of the buffer rectangle */ - size_t blk_size; /*data block size in bytes */ - size_t bsize; /*actual buffer size */ - - /* HDF5 variables */ - herr_t hrc; /*HDF5 return code */ - - /* Sanity check parameters */ - - /* IO type */ - iot = param.io_type; - - switch (iot) { - case MPIO: - fd.mpifd = MPI_FILE_NULL; - res.timers = io_time_new(MPI_CLOCK); - break; - case POSIXIO: - fd.posixfd = -1; - res.timers = io_time_new(MPI_CLOCK); - break; - case PHDF5: - fd.h5fd = -1; - res.timers = io_time_new(MPI_CLOCK); - break; - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", iot); - GOTOERROR(FAIL); - } - - ndsets = param.num_dsets; /* number of datasets per file */ - nbytes = param.num_bytes; /* number of bytes per dataset */ - buf_size = param.buf_size; - blk_size = param.blk_size; - - if (!param.dim2d) { - snbytes = nbytes; /* General dataset size */ - bsize = buf_size; /* Actual buffer size */ - } - else { - snbytes = sqrto(nbytes); /* General dataset size */ - bsize = buf_size * blk_size; /* Actual buffer size */ - } - - if (param.num_files < 0) { - HDfprintf(stderr, "number of files must be >= 0 (%ld)\n", param.num_files); - GOTOERROR(FAIL); - } - - if (ndsets < 0) { - HDfprintf(stderr, "number of datasets per file must be >= 0 (%ld)\n", ndsets); - GOTOERROR(FAIL); - } - - if (param.num_procs <= 0) { - HDfprintf(stderr, "maximum number of process to use must be > 0 (%d)\n", param.num_procs); - GOTOERROR(FAIL); - } - - /* Validate transfer buffer size & block size*/ - if (blk_size <= 0) { - HDfprintf(stderr, "Transfer block size (%zu) must be > 0\n", blk_size); - GOTOERROR(FAIL); - } - if (buf_size <= 0) { - HDfprintf(stderr, "Transfer buffer size (%zu) must be > 0\n", buf_size); - GOTOERROR(FAIL); - } - if ((buf_size % blk_size) != 0) { - HDfprintf(stderr, - "Transfer buffer size (%zu) must be a multiple of the " - "interleaved I/O block size (%zu)\n", - buf_size, blk_size); - GOTOERROR(FAIL); - } - if ((snbytes % pio_mpi_nprocs_g) != 0) { - HDfprintf(stderr, - "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " - "number of processes (%d)\n", - (long long)snbytes, pio_mpi_nprocs_g); - GOTOERROR(FAIL); - } - - if (!param.dim2d) { - if (((size_t)(snbytes / pio_mpi_nprocs_g) % buf_size) != 0) { - HDfprintf(stderr, - "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " - "trasfer buffer size (%zu)\n", - (long long)(snbytes / pio_mpi_nprocs_g), buf_size); - GOTOERROR(FAIL); - } - } - else { - if (((size_t)snbytes % buf_size) != 0) { - HDfprintf(stderr, - "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " - "trasfer buffer size (%zu)\n", - (long long)snbytes, buf_size); - GOTOERROR(FAIL); - } - } - - /* Allocate transfer buffer */ - if ((buffer = malloc(bsize)) == NULL) { - HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", bsize); - GOTOERROR(FAIL); - } - - if (pio_debug_level >= 4) { - int myrank; - - MPI_Comm_rank(pio_comm_g, &myrank); - - /* output all of the times for all iterations */ - if (myrank == 0) - HDfprintf(output, "Timer details:\n"); - } - - for (nf = 1; nf <= param.num_files; nf++) { - /* - * Write performance measurement - */ - /* Open file for write */ - char base_name[256]; - - HDsprintf(base_name, "#pio_tmp_%lu", nf); - pio_create_filename(iot, base_name, fname, sizeof(fname)); - if (pio_debug_level > 0) - HDfprintf(output, "rank %d: data filename=%s\n", pio_mpi_rank_g, fname); - - /* Need barrier to make sure everyone starts at the same time */ - MPI_Barrier(pio_comm_g); - - io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); - hrc = do_fopen(¶m, fname, &fd, PIO_CREATE | PIO_WRITE); - - VRFY((hrc == SUCCESS), "do_fopen failed"); - - io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); - hrc = do_write(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); - - VRFY((hrc == SUCCESS), "do_write failed"); - - /* Close file for write */ - hrc = do_fclose(iot, &fd); - - io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); - VRFY((hrc == SUCCESS), "do_fclose failed"); - - if (!param.h5_write_only) { - /* - * Read performance measurement - */ - /* Need barrier to make sure everyone is done writing and has - * closed the file. Also to make sure everyone starts reading - * at the same time. - */ - MPI_Barrier(pio_comm_g); - - /* Open file for read */ - io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); - hrc = do_fopen(¶m, fname, &fd, PIO_READ); - - VRFY((hrc == SUCCESS), "do_fopen failed"); - - io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); - hrc = do_read(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); - VRFY((hrc == SUCCESS), "do_read failed"); - - /* Close file for read */ - hrc = do_fclose(iot, &fd); - - io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); - VRFY((hrc == SUCCESS), "do_fclose failed"); - } - - /* Need barrier to make sure everyone is done with the file */ - /* before it may be removed by do_cleanupfile */ - MPI_Barrier(pio_comm_g); - do_cleanupfile(iot, fname); - } - -done: - /* clean up */ - /* release HDF5 objects */ - - /* close any opened files */ - /* no remove(fname) because that should have happened normally. */ - switch (iot) { - case POSIXIO: - if (fd.posixfd != -1) - hrc = do_fclose(iot, &fd); - break; - case MPIO: - if (fd.mpifd != MPI_FILE_NULL) - hrc = do_fclose(iot, &fd); - break; - case PHDF5: - if (fd.h5fd != -1) - hrc = do_fclose(iot, &fd); - break; - default: - break; - } - - /* release generic resources */ - if (buffer) - HDfree(buffer); - res.ret_code = ret_code; - return res; -} - -/* - * Function: pio_create_filename - * Purpose: Create a new filename to write to. Determine the correct - * suffix to append to the filename by the type of I/O we're - * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if - * USER or LOGIN are specified in the environment. - * Return: Pointer to filename or NULL - * Programmer: Bill Wendling, 21. November 2001 - * Modifications: - */ -static char * -pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size) -{ - const char *prefix, *suffix = ""; - char * ptr, last = '\0'; - size_t i, j; - - if (!base_name || !fullname || size < 1) - return NULL; - - HDmemset(fullname, 0, size); - - switch (iot) { - case POSIXIO: - suffix = ".posix"; - break; - case MPIO: - suffix = ".mpio"; - break; - case PHDF5: - suffix = ".h5"; - break; - default: - break; - } - - /* First use the environment variable and then try the constant */ - prefix = HDgetenv("HDF5_PARAPREFIX"); - -#ifdef HDF5_PARAPREFIX - if (!prefix) - prefix = HDF5_PARAPREFIX; -#endif /* HDF5_PARAPREFIX */ - - /* Prepend the prefix value to the base name */ - if (prefix && *prefix) { - /* If the prefix specifies the HDF5_PARAPREFIX directory, then - * default to using the "/tmp/$USER" or "/tmp/$LOGIN" - * directory instead. */ - register char *user, *login, *subdir; - - user = HDgetenv("USER"); - login = HDgetenv("LOGIN"); - subdir = (user ? user : login); - - if (subdir) { - for (i = 0; i < size - 1 && prefix[i]; i++) - fullname[i] = prefix[i]; - - fullname[i++] = '/'; - - for (j = 0; i < size && subdir[j]; i++, j++) - fullname[i] = subdir[j]; - } - else { - /* We didn't append the prefix yet */ - HDstrncpy(fullname, prefix, size); - fullname[size - 1] = '\0'; - } - - if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) { - /* Append the base_name with a slash first. Multiple slashes are - * handled below. */ - h5_stat_t buf; - - if (HDstat(fullname, &buf) < 0) - /* The directory doesn't exist just yet */ - if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) { - /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory. - * Default to PREFIX's original prefix value. */ - HDstrcpy(fullname, prefix); - } - - HDstrcat(fullname, "/"); - HDstrcat(fullname, base_name); - } - else { - /* Buffer is too small */ - return NULL; - } - } - else if (HDstrlen(base_name) >= size) { - /* Buffer is too small */ - return NULL; - } - else { - HDstrcpy(fullname, base_name); - } - - /* Append a suffix */ - if (suffix) { - if (HDstrlen(fullname) + HDstrlen(suffix) >= size) - return NULL; - - HDstrcat(fullname, suffix); - } - - /* Remove any double slashes in the filename */ - for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) { - if (*ptr != '/' || last != '/') - fullname[j++] = *ptr; - - last = *ptr; - } - - return fullname; -} - -/* - * Function: do_write - * Purpose: Write the required amount of data to the file. - * Return: SUCCESS or FAIL - * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 - * Modifications: - * Added 2D testing (Christian Chilan, 10. August 2005) - */ -static herr_t -do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbytes, size_t buf_size, - void *buffer) -{ - int ret_code = SUCCESS; - int rc; /*routine return code */ - long ndset; - size_t blk_size; /* The block size to subdivide the xfer buffer into */ - off_t nbytes_xfer; /* Total number of bytes transferred so far */ - size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */ - size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */ - char dname[64]; - off_t dset_offset = 0; /*dataset offset in a file */ - off_t bytes_begin[2]; /*first elmt this process transfer */ - off_t bytes_count; /*number of elmts this process transfer */ - off_t snbytes = 0; /*size of a side of the dataset square */ - unsigned char *buf_p; /* Current buffer pointer */ - - /* POSIX variables */ - off_t file_offset; /* File offset of the next transfer */ - off_t file_offset_advance; /* File offset advance after each I/O operation */ - off_t posix_file_offset; /* Base file offset of the next transfer */ - - /* MPI variables */ - MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/ - MPI_Offset mpi_offset; /* Offset in MPI file */ - MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */ - MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */ - MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */ - MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */ - MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */ - MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */ - MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */ - MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */ - MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */ - MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */ - MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */ - MPI_Status mpi_status; - int mrc; /* MPI return code */ - - /* HDF5 variables */ - herr_t hrc; /*HDF5 return code */ - hsize_t h5dims[2]; /*dataset dim sizes */ - hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ - hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ - hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ - hsize_t h5block[2]; /*dataspace selection */ - hsize_t h5stride[2]; - hsize_t h5count[2]; - hsize_t h5start[2]; - hssize_t h5offset[2]; /* Selection offset within dataspace */ - hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */ - hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ - - /* Get the parameters from the parameter block */ - blk_size = parms->blk_size; - - /* There are two kinds of transfer patterns, contiguous and interleaved. - * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n - * where n is rank of the last process. - * In contiguous pattern, data are accessed as - * 000...111...222...nnn... - * In interleaved pattern, data are accessed as - * 012...n012...n... - * These are all in the scope of one dataset. - */ - - /* 1D dataspace */ - if (!parms->dim2d) { - /* Contiguous Pattern: */ - if (!parms->interleaved) { - bytes_begin[0] = (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g); - } /* end if */ - /* Interleaved Pattern: */ - else { - bytes_begin[0] = (off_t)(blk_size * (size_t)pio_mpi_rank_g); - } /* end else */ - - /* Prepare buffer for verifying data */ - if (parms->verify) - memset(buffer, pio_mpi_rank_g + 1, buf_size); - } /* end if */ - /* 2D dataspace */ - else { - /* nbytes is always the number of bytes per dataset (1D or 2D). If the - dataspace is 2D, snbytes is the size of a side of the dataset square. - */ - snbytes = sqrto(nbytes); - - /* Contiguous Pattern: */ - if (!parms->interleaved) { - bytes_begin[0] = (off_t)((double)snbytes * pio_mpi_rank_g / pio_mpi_nprocs_g); - bytes_begin[1] = 0; - } /* end if */ - /* Interleaved Pattern: */ - else { - bytes_begin[0] = 0; - - if (!parms->h5_use_chunks || parms->io_type == PHDF5) - bytes_begin[1] = (off_t)(blk_size * (size_t)pio_mpi_rank_g); - else - bytes_begin[1] = (off_t)(blk_size * blk_size * (size_t)pio_mpi_rank_g); - } /* end else */ - - /* Prepare buffer for verifying data */ - if (parms->verify) - HDmemset(buffer, pio_mpi_rank_g + 1, buf_size * blk_size); - } /* end else */ - - /* Calculate the total number of bytes (bytes_count) to be - * transferred by this process. It may be different for different - * transfer pattern due to rounding to integral values. - */ - /* - * Calculate the beginning bytes of this process and the next. - * bytes_count is the difference between these two beginnings. - * This way, it eliminates any rounding errors. - * (This is tricky, don't mess with the formula, rounding errors - * can easily get introduced) */ - bytes_count = (off_t)(((double)nbytes * (pio_mpi_rank_g + 1)) / pio_mpi_nprocs_g) - - (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g); - - /* debug */ - if (pio_debug_level >= 4) { - HDprint_rank(output); - if (!parms->dim2d) { - HDfprintf(output, - "Debug(do_write): " - "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH - "d\n", - buf_size, (long long)bytes_begin[0], (long long)bytes_count); - } - else { - HDfprintf(output, - "Debug(do_write): " - "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH - "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", - buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], - (long long)bytes_count); - } - } - - /* I/O Access specific setup */ - switch (parms->io_type) { - case POSIXIO: - /* No extra setup */ - break; - - case MPIO: /* MPI-I/O setup */ - /* 1D dataspace */ - if (!parms->dim2d) { - /* Build block's derived type */ - mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_blk_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Build file's derived type */ - mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)pio_mpi_nprocs_g, mpi_blk_type, - &mpi_file_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit file type */ - mrc = MPI_Type_commit(&mpi_file_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Commit buffer type */ - mrc = MPI_Type_commit(&mpi_blk_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - } /* end if */ - /* 2D dataspace */ - else { - /* Build partial buffer derived type for contiguous access */ - - mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE, &mpi_partial_buffer_cont); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit partial buffer derived type */ - mrc = MPI_Type_commit(&mpi_partial_buffer_cont); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build contiguous file's derived type */ - mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes / buf_size), - mpi_partial_buffer_cont, &mpi_cont_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit contiguous file type */ - mrc = MPI_Type_commit(&mpi_cont_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build partial buffer derived type for interleaved access */ - mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_partial_buffer_inter); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit partial buffer derived type */ - mrc = MPI_Type_commit(&mpi_partial_buffer_inter); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build interleaved file's derived type */ - mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes / blk_size), - mpi_partial_buffer_inter, &mpi_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit interleaved file type */ - mrc = MPI_Type_commit(&mpi_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build full buffer derived type */ - mrc = MPI_Type_contiguous((int)(blk_size * buf_size), MPI_BYTE, &mpi_full_buffer); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit full buffer derived type */ - mrc = MPI_Type_commit(&mpi_full_buffer); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build full chunk derived type */ - mrc = MPI_Type_contiguous((int)(blk_size * blk_size), MPI_BYTE, &mpi_full_chunk); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit full chunk derived type */ - mrc = MPI_Type_commit(&mpi_full_chunk); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build chunk interleaved file's derived type */ - mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)((size_t)snbytes / blk_size), - mpi_full_chunk, &mpi_chunk_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit chunk interleaved file type */ - mrc = MPI_Type_commit(&mpi_chunk_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - } /* end else */ - break; - - case PHDF5: /* HDF5 setup */ - /* 1D dataspace */ - if (!parms->dim2d) { - if (nbytes > 0) { - /* define a contiguous dataset of nbytes native bytes */ - h5dims[0] = (hsize_t)nbytes; - h5dset_space_id = H5Screate_simple(1, h5dims, NULL); - VRFY((h5dset_space_id >= 0), "H5Screate_simple"); - - /* Set up the file dset space id to select the pattern to access */ - if (!parms->interleaved) { - /* Contiguous pattern */ - h5start[0] = (hsize_t)bytes_begin[0]; - h5stride[0] = h5block[0] = blk_size; - h5count[0] = buf_size / blk_size; - } /* end if */ - else { - /* Interleaved access pattern */ - /* Skip offset over blocks of other processes */ - h5start[0] = (hsize_t)bytes_begin[0]; - h5stride[0] = blk_size * (size_t)pio_mpi_nprocs_g; - h5block[0] = blk_size; - h5count[0] = buf_size / blk_size; - } /* end else */ - hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, - h5block); - VRFY((hrc >= 0), "H5Sselect_hyperslab"); - } /* end if */ - else { - h5dset_space_id = H5Screate(H5S_SCALAR); - VRFY((h5dset_space_id >= 0), "H5Screate"); - } /* end else */ - - /* Create the memory dataspace that corresponds to the xfer buffer */ - if (buf_size > 0) { - h5dims[0] = buf_size; - h5mem_space_id = H5Screate_simple(1, h5dims, NULL); - VRFY((h5mem_space_id >= 0), "H5Screate_simple"); - } /* end if */ - else { - h5mem_space_id = H5Screate(H5S_SCALAR); - VRFY((h5mem_space_id >= 0), "H5Screate"); - } /* end else */ - } /* end if */ - /* 2D dataspace */ - else { - if (nbytes > 0) { - /* define a contiguous dataset of nbytes native bytes */ - h5dims[0] = (hsize_t)snbytes; - h5dims[1] = (hsize_t)snbytes; - h5dset_space_id = H5Screate_simple(2, h5dims, NULL); - VRFY((h5dset_space_id >= 0), "H5Screate_simple"); - - /* Set up the file dset space id to select the pattern to access */ - if (!parms->interleaved) { - /* Contiguous pattern */ - h5start[0] = (hsize_t)bytes_begin[0]; - h5start[1] = (hsize_t)bytes_begin[1]; - h5stride[0] = 1; - h5stride[1] = h5block[0] = h5block[1] = blk_size; - h5count[0] = 1; - h5count[1] = buf_size / blk_size; - } /* end if */ - else { - /* Interleaved access pattern */ - /* Skip offset over blocks of other processes */ - h5start[0] = (hsize_t)bytes_begin[0]; - h5start[1] = (hsize_t)bytes_begin[1]; - h5stride[0] = blk_size; - h5stride[1] = blk_size * (size_t)pio_mpi_nprocs_g; - h5block[0] = h5block[1] = blk_size; - h5count[0] = buf_size / blk_size; - h5count[1] = 1; - } /* end else */ - hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, - h5block); - VRFY((hrc >= 0), "H5Sselect_hyperslab"); - } /* end if */ - else { - h5dset_space_id = H5Screate(H5S_SCALAR); - VRFY((h5dset_space_id >= 0), "H5Screate"); - } /* end else */ - - /* Create the memory dataspace that corresponds to the xfer buffer */ - if (buf_size > 0) { - if (!parms->interleaved) { - h5dims[0] = blk_size; - h5dims[1] = buf_size; - } - else { - h5dims[0] = buf_size; - h5dims[1] = blk_size; - } - h5mem_space_id = H5Screate_simple(2, h5dims, NULL); - VRFY((h5mem_space_id >= 0), "H5Screate_simple"); - } /* end if */ - else { - h5mem_space_id = H5Screate(H5S_SCALAR); - VRFY((h5mem_space_id >= 0), "H5Screate"); - } /* end else */ - } /* end else */ - - /* Create the dataset transfer property list */ - h5dxpl = H5Pcreate(H5P_DATASET_XFER); - if (h5dxpl < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); - } - - /* Change to collective I/O, if asked */ - if (parms->collective) { - hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Property List Set failed\n"); - GOTOERROR(FAIL); - } /* end if */ - } /* end if */ - break; - - default: - break; - } /* end switch */ - - for (ndset = 1; ndset <= ndsets; ++ndset) { - - /* Calculate dataset offset within a file */ - - /* create dataset */ - switch (parms->io_type) { - case POSIXIO: - case MPIO: - /* both posix and mpi io just need dataset offset in file*/ - dset_offset = (ndset - 1) * nbytes; - break; - - case PHDF5: - h5dcpl = H5Pcreate(H5P_DATASET_CREATE); - if (h5dcpl < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); - } - /* 1D dataspace */ - if (!parms->dim2d) { - /* Make the dataset chunked if asked */ - if (parms->h5_use_chunks) { - /* Set the chunk size to be the same as the buffer size */ - h5dims[0] = blk_size; - hrc = H5Pset_chunk(h5dcpl, 1, h5dims); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Property List Set failed\n"); - GOTOERROR(FAIL); - } /* end if */ - } /* end if */ - } /* end if */ - else { - /* 2D dataspace */ - if (parms->h5_use_chunks) { - /* Set the chunk size to be the same as the block size */ - h5dims[0] = blk_size; - h5dims[1] = blk_size; - hrc = H5Pset_chunk(h5dcpl, 2, h5dims); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Property List Set failed\n"); - GOTOERROR(FAIL); - } /* end if */ - } /* end if */ - } /* end else */ - - HDsprintf(dname, "Dataset_%ld", ndset); - h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, h5dcpl); - - if (h5ds_id < 0) { - HDfprintf(stderr, "HDF5 Dataset Create failed\n"); - GOTOERROR(FAIL); - } - - hrc = H5Pclose(h5dcpl); - /* verifying the close of the dcpl */ - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Property List Close failed\n"); - GOTOERROR(FAIL); - } - break; - - default: - break; - } - - /* The task is to transfer bytes_count bytes, starting at - * bytes_begin position, using transfer buffer of buf_size bytes. - * If interleaved, select buf_size at a time, in round robin - * fashion, according to number of process. Otherwise, select - * all bytes_count in contiguous. - */ - nbytes_xfer = 0; - - /* 1D dataspace */ - if (!parms->dim2d) { - /* Set base file offset for all I/O patterns and POSIX access */ - posix_file_offset = dset_offset + bytes_begin[0]; - - /* Set base file offset for all I/O patterns and MPI access */ - mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]); - } /* end if */ - else { - /* Set base file offset for all I/O patterns and POSIX access */ - posix_file_offset = dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]; - - /* Set base file offset for all I/O patterns and MPI access */ - mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]); - } /* end else */ - - /* Start "raw data" write timer */ - io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); - - while (nbytes_xfer < bytes_count) { - /* Write */ - /* Calculate offset of write within a dataset/file */ - switch (parms->io_type) { - case POSIXIO: - /* 1D dataspace */ - if (!parms->dim2d) { - /* Contiguous pattern */ - if (!parms->interleaved) { - /* Compute file offset */ - file_offset = posix_file_offset + (off_t)nbytes_xfer; - - /* only care if seek returns error */ - rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; - VRFY((rc == 0), "POSIXSEEK"); - - /* check if all bytes are written */ - rc = ((ssize_t)buf_size == POSIXWRITE(fd->posixfd, buffer, buf_size)); - VRFY((rc != 0), "POSIXWRITE"); - - /* Advance global offset in dataset */ - nbytes_xfer += (ssize_t)buf_size; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Set the base of user's buffer */ - buf_p = (unsigned char *)buffer; - - /* Set the number of bytes to transfer this time */ - nbytes_toxfer = buf_size; - - /* Loop over the buffers to write */ - while (nbytes_toxfer > 0) { - /* Skip offset over blocks of other processes */ - file_offset = posix_file_offset + (off_t)(nbytes_xfer * pio_mpi_nprocs_g); - - /* only care if seek returns error */ - rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; - VRFY((rc == 0), "POSIXSEEK"); - - /* check if all bytes are written */ - rc = ((ssize_t)blk_size == POSIXWRITE(fd->posixfd, buf_p, blk_size)); - VRFY((rc != 0), "POSIXWRITE"); - - /* Advance location in buffer */ - buf_p += blk_size; - - /* Advance global offset in dataset */ - nbytes_xfer += (ssize_t)blk_size; - - /* Decrement number of bytes left this time */ - nbytes_toxfer -= blk_size; - } /* end while */ - } /* end else */ - } /* end if */ - /* 2D dataspace */ - else { - /* Contiguous storage */ - if (!parms->h5_use_chunks) { - /* Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute file offset */ - file_offset = posix_file_offset + - (off_t)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) * - (blk_size * (size_t)snbytes) + - (((size_t)nbytes_xfer / blk_size) % (size_t)snbytes)); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = buf_size; - - /* Global offset advance after each I/O operation */ - file_offset_advance = (off_t)snbytes; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Compute file offset */ - file_offset = - posix_file_offset + - (off_t)(((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) / - (size_t)snbytes) * - (buf_size * (size_t)snbytes) + - (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) % - (size_t)snbytes); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size; - - /* Global offset advance after each I/O operation */ - file_offset_advance = (off_t)snbytes; - } /* end else */ - } /* end if */ - /* Chunked storage */ - else { - /*Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute file offset */ - file_offset = posix_file_offset + (off_t)nbytes_xfer; - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size * buf_size; - - /* Global offset advance after each I/O operation */ - file_offset_advance = 0; - } /* end if */ - /*Interleaved access pattern */ - else { - /* Compute file offset */ - /* Before simplification */ - /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size) - *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size - *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size)) - *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */ - - file_offset = posix_file_offset + - (off_t)((((size_t)nbytes_xfer / (buf_size / blk_size) * - (size_t)pio_mpi_nprocs_g) / - ((size_t)snbytes * blk_size)) * - (buf_size * (size_t)snbytes) + - (((size_t)nbytes_xfer / (buf_size / blk_size)) * - (size_t)pio_mpi_nprocs_g) % - ((size_t)snbytes * blk_size)); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size * blk_size; - - /* Global offset advance after each I/O operation */ - /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */ - file_offset_advance = (off_t)snbytes * (off_t)blk_size; - } /* end else */ - } /* end else */ - - /* Common code for file access */ - - /* Set the base of user's buffer */ - buf_p = (unsigned char *)buffer; - - /* Set the number of bytes to transfer this time */ - nbytes_toxfer = buf_size * blk_size; - - /* Loop over portions of the buffer to write */ - while (nbytes_toxfer > 0) { - /* only care if seek returns error */ - rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; - VRFY((rc == 0), "POSIXSEEK"); - - /* check if all bytes are written */ - rc = ((ssize_t)nbytes_xfer_advance == - POSIXWRITE(fd->posixfd, buf_p, nbytes_xfer_advance)); - VRFY((rc != 0), "POSIXWRITE"); - - /* Advance location in buffer */ - buf_p += nbytes_xfer_advance; - - /* Advance global offset in dataset */ - nbytes_xfer += (ssize_t)nbytes_xfer_advance; - - /* Decrement number of bytes left this time */ - nbytes_toxfer -= nbytes_xfer_advance; - - /* Partially advance file offset */ - file_offset += file_offset_advance; - } /* end while */ - - } /* end else */ - - break; - - case MPIO: - /* 1D dataspace */ - if (!parms->dim2d) { - /* Independent file access */ - if (!parms->collective) { - /* Contiguous pattern */ - if (!parms->interleaved) { - /* Compute offset in file */ - mpi_offset = mpi_file_offset + nbytes_xfer; - - /* Perform independent write */ - mrc = - MPI_File_write_at(fd->mpifd, mpi_offset, buffer, - (int)(buf_size / blk_size), mpi_blk_type, &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); - - /* Advance global offset in dataset */ - nbytes_xfer += (ssize_t)buf_size; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Set the base of user's buffer */ - buf_p = (unsigned char *)buffer; - - /* Set the number of bytes to transfer this time */ - nbytes_toxfer = buf_size; - - /* Loop over the buffers to write */ - while (nbytes_toxfer > 0) { - /* Skip offset over blocks of other processes */ - mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g); - - /* Perform independent write */ - mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p, (int)1, - mpi_blk_type, &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); - - /* Advance location in buffer */ - buf_p += blk_size; - - /* Advance global offset in dataset */ - nbytes_xfer += (ssize_t)blk_size; - - /* Decrement number of bytes left this time */ - nbytes_toxfer -= blk_size; - } /* end while */ - } /* end else */ - } /* end if */ - /* Collective file access */ - else { - /* Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute offset in file */ - mpi_offset = mpi_file_offset + nbytes_xfer; - - /* Perform independent write */ - mrc = MPI_File_write_at_all(fd->mpifd, mpi_offset, buffer, - (int)(buf_size / blk_size), mpi_blk_type, - &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); - - /* Advance global offset in dataset */ - nbytes_xfer += (ssize_t)buf_size; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Compute offset in file */ - mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g); - - /* Set the file view */ - mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type, - (char *)"native", h5_io_info_g); - VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); - - /* Perform write */ - mrc = MPI_File_write_at_all(fd->mpifd, 0, buffer, (int)(buf_size / blk_size), - mpi_blk_type, &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); - - /* Advance global offset in dataset */ - nbytes_xfer += (ssize_t)buf_size; - } /* end else */ - } /* end else */ - } /* end if */ - /* 2D dataspace */ - else { - /* Contiguous storage */ - if (!parms->h5_use_chunks) { - /* Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute offset in file */ - mpi_offset = - mpi_file_offset + - (MPI_Offset)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) * - (blk_size * (size_t)snbytes)) + - (MPI_Offset)(((size_t)nbytes_xfer / blk_size) % (size_t)snbytes); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = buf_size; - - /* Global offset advance after each I/O operation */ - mpi_offset_advance = snbytes; - - /* MPI type to be used for collective access */ - mpi_collective_type = mpi_cont_type; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Compute offset in file */ - mpi_offset = - mpi_file_offset + - (MPI_Offset)( - ((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) / - (size_t)snbytes) * - (buf_size * (size_t)snbytes)) + - (MPI_Offset)( - (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) % - (size_t)snbytes); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size; - - /* Global offset advance after each I/O operation */ - mpi_offset_advance = snbytes; - - /* MPI type to be used for collective access */ - mpi_collective_type = mpi_inter_type; - } /* end else */ - } /* end if */ - /* Chunked storage */ - else { - /*Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute offset in file */ - mpi_offset = mpi_file_offset + nbytes_xfer; - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size * buf_size; - - /* Global offset advance after each I/O operation */ - mpi_offset_advance = 0; - - /* MPI type to be used for collective access */ - mpi_collective_type = mpi_full_buffer; - } /* end if */ - /*Interleaved access pattern */ - else { - /* Compute offset in file */ - /* Before simplification */ - /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size) - *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))* - (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+ - ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes - /blk_size*(blk_size*blk_size)); */ - mpi_offset = mpi_file_offset + - (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size) * - (size_t)pio_mpi_nprocs_g) / - ((size_t)snbytes * blk_size)) * - (buf_size * (size_t)snbytes)) + - (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size)) * - (size_t)pio_mpi_nprocs_g) % - ((size_t)snbytes * blk_size)); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size * blk_size; - - /* Global offset advance after each I/O operation */ - /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */ - mpi_offset_advance = (MPI_Offset)((size_t)snbytes * blk_size); - - /* MPI type to be used for collective access */ - mpi_collective_type = mpi_chunk_inter_type; - } /* end else */ - } /* end else */ - - /* Common code for independent file access */ - if (!parms->collective) { - /* Set the base of user's buffer */ - buf_p = (unsigned char *)buffer; - - /* Set the number of bytes to transfer this time */ - nbytes_toxfer = buf_size * blk_size; - - /* Loop over portions of the buffer to write */ - while (nbytes_toxfer > 0) { - /* Perform independent write */ - mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p, - (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); - - /* Advance location in buffer */ - buf_p += nbytes_xfer_advance; - - /* Advance global offset in dataset */ - nbytes_xfer += (ssize_t)nbytes_xfer_advance; - - /* Decrement number of bytes left this time */ - nbytes_toxfer -= nbytes_xfer_advance; - - /* Partially advance global offset in dataset */ - mpi_offset += mpi_offset_advance; - } /* end while */ - } /* end if */ - - /* Common code for collective file access */ - else { - /* Set the file view */ - mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type, - (char *)"native", h5_io_info_g); - VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); - - /* Perform write */ - MPI_File_write_at_all(fd->mpifd, 0, buffer, (int)(buf_size * blk_size), MPI_BYTE, - &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE"); - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)buf_size * (off_t)blk_size; - } /* end else */ - - } /* end else */ - - break; - - case PHDF5: - /* 1D dataspace */ - if (!parms->dim2d) { - /* Set up the file dset space id to move the selection to process */ - if (!parms->interleaved) { - /* Contiguous pattern */ - h5offset[0] = nbytes_xfer; - } /* end if */ - else { - /* Interleaved access pattern */ - /* Skip offset over blocks of other processes */ - h5offset[0] = (nbytes_xfer * pio_mpi_nprocs_g); - } /* end else */ - hrc = H5Soffset_simple(h5dset_space_id, h5offset); - VRFY((hrc >= 0), "H5Soffset_simple"); - - /* Write the buffer out */ - hrc = - H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); - VRFY((hrc >= 0), "H5Dwrite"); - - /* Increment number of bytes transferred */ - nbytes_xfer += (ssize_t)buf_size; - } /* end if */ - /* 2D dataspace */ - else { - /* Set up the file dset space id to move the selection to process */ - if (!parms->interleaved) { - /* Contiguous pattern */ - h5offset[0] = - (hssize_t)(((size_t)nbytes_xfer / ((size_t)snbytes * blk_size)) * blk_size); - h5offset[1] = - (hssize_t)(((size_t)nbytes_xfer % ((size_t)snbytes * blk_size)) / blk_size); - - } /* end if */ - else { - /* Interleaved access pattern */ - /* Skip offset over blocks of other processes */ - h5offset[0] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) / - ((size_t)snbytes * buf_size)) * - buf_size); - h5offset[1] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) % - ((size_t)snbytes * buf_size)) / - buf_size); - - } /* end else */ - hrc = H5Soffset_simple(h5dset_space_id, h5offset); - VRFY((hrc >= 0), "H5Soffset_simple"); - - /* Write the buffer out */ - hrc = - H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); - VRFY((hrc >= 0), "H5Dwrite"); - - /* Increment number of bytes transferred */ - nbytes_xfer += (off_t)buf_size * (off_t)blk_size; - - } /* end else */ - - break; - - default: - break; - } /* switch (parms->io_type) */ - } /* end while */ - - /* Stop "raw data" write timer */ - io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); - - /* Calculate write time */ - - /* Close dataset. Only HDF5 needs to do an explicit close. */ - if (parms->io_type == PHDF5) { - hrc = H5Dclose(h5ds_id); - - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Close failed\n"); - GOTOERROR(FAIL); - } - - h5ds_id = H5I_INVALID_HID; - } /* end if */ - } /* end for */ - -done: - /* release MPI-I/O objects */ - if (parms->io_type == MPIO) { - /* 1D dataspace */ - if (!parms->dim2d) { - /* Free file type */ - mrc = MPI_Type_free(&mpi_file_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free buffer type */ - mrc = MPI_Type_free(&mpi_blk_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - } /* end if */ - /* 2D dataspace */ - else { - /* Free partial buffer type for contiguous access */ - mrc = MPI_Type_free(&mpi_partial_buffer_cont); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free contiguous file type */ - mrc = MPI_Type_free(&mpi_cont_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free partial buffer type for interleaved access */ - mrc = MPI_Type_free(&mpi_partial_buffer_inter); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free interleaved file type */ - mrc = MPI_Type_free(&mpi_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free full buffer type */ - mrc = MPI_Type_free(&mpi_full_buffer); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free full chunk type */ - mrc = MPI_Type_free(&mpi_full_chunk); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free chunk interleaved file type */ - mrc = MPI_Type_free(&mpi_chunk_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - } /* end else */ - } /* end if */ - - /* release HDF5 objects */ - if (h5dset_space_id != -1) { - hrc = H5Sclose(h5dset_space_id); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); - ret_code = FAIL; - } - else { - h5dset_space_id = H5I_INVALID_HID; - } - } - - if (h5mem_space_id != -1) { - hrc = H5Sclose(h5mem_space_id); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); - ret_code = FAIL; - } - else { - h5mem_space_id = H5I_INVALID_HID; - } - } - - if (h5dxpl != -1) { - hrc = H5Pclose(h5dxpl); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); - ret_code = FAIL; - } - else { - h5dxpl = H5I_INVALID_HID; - } - } - - return ret_code; -} - -static off_t -sqrto(off_t x) -{ - double root_x = sqrt((double)x); - return (off_t)root_x; -} - -/* - * Function: do_read - * Purpose: read the required amount of data from the file. - * Return: SUCCESS or FAIL - * Programmer: Albert Cheng 2001/12/13 - * Modifications: - * Added 2D testing (Christian Chilan, 10. August 2005) - */ -static herr_t -do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbytes, size_t buf_size, - void *buffer /*out*/) -{ - int ret_code = SUCCESS; - int rc; /*routine return code */ - long ndset; - size_t blk_size; /* The block size to subdivide the xfer buffer into */ - size_t bsize; /* Size of the actual buffer */ - off_t nbytes_xfer; /* Total number of bytes transferred so far */ - size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */ - size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */ - char dname[64]; - off_t dset_offset = 0; /*dataset offset in a file */ - off_t bytes_begin[2]; /*first elmt this process transfer */ - off_t bytes_count; /*number of elmts this process transfer */ - off_t snbytes = 0; /*size of a side of the dataset square */ - unsigned char *buf_p; /* Current buffer pointer */ - - /* POSIX variables */ - off_t file_offset; /* File offset of the next transfer */ - off_t file_offset_advance; /* File offset advance after each I/O operation */ - off_t posix_file_offset; /* Base file offset of the next transfer */ - - /* MPI variables */ - MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/ - MPI_Offset mpi_offset; /* Offset in MPI file */ - MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */ - MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */ - MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */ - MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */ - MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */ - MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */ - MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */ - MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */ - MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */ - MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */ - MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */ - MPI_Status mpi_status; - int mrc; /* MPI return code */ - - /* HDF5 variables */ - herr_t hrc; /*HDF5 return code */ - hsize_t h5dims[2]; /*dataset dim sizes */ - hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ - hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ - hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ - hsize_t h5block[2]; /*dataspace selection */ - hsize_t h5stride[2]; - hsize_t h5count[2]; - hsize_t h5start[2]; - hssize_t h5offset[2]; /* Selection offset within dataspace */ - hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ - - /* Get the parameters from the parameter block */ - blk_size = parms->blk_size; - - /* There are two kinds of transfer patterns, contiguous and interleaved. - * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n - * where n is rank of the last process. - * In contiguous pattern, data are accessed as - * 000...111...222...nnn... - * In interleaved pattern, data are accessed as - * 012...n012...n... - * These are all in the scope of one dataset. - */ - - /* 1D dataspace */ - if (!parms->dim2d) { - bsize = buf_size; - /* Contiguous Pattern: */ - if (!parms->interleaved) { - bytes_begin[0] = (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g); - } /* end if */ - /* Interleaved Pattern: */ - else { - bytes_begin[0] = (off_t)blk_size * (off_t)pio_mpi_rank_g; - } /* end else */ - } /* end if */ - /* 2D dataspace */ - else { - /* nbytes is always the number of bytes per dataset (1D or 2D). If the - dataspace is 2D, snbytes is the size of a side of the 'dataset square'. - */ - snbytes = sqrto(nbytes); - - bsize = buf_size * blk_size; - - /* Contiguous Pattern: */ - if (!parms->interleaved) { - bytes_begin[0] = (off_t)((double)snbytes * pio_mpi_rank_g / pio_mpi_nprocs_g); - bytes_begin[1] = 0; - } /* end if */ - /* Interleaved Pattern: */ - else { - bytes_begin[0] = 0; - - if (!parms->h5_use_chunks || parms->io_type == PHDF5) - bytes_begin[1] = (off_t)blk_size * (off_t)pio_mpi_rank_g; - else - bytes_begin[1] = (off_t)blk_size * (off_t)blk_size * (off_t)pio_mpi_rank_g; - } /* end else */ - } /* end else */ - - /* Calculate the total number of bytes (bytes_count) to be - * transferred by this process. It may be different for different - * transfer pattern due to rounding to integral values. - */ - /* - * Calculate the beginning bytes of this process and the next. - * bytes_count is the difference between these two beginnings. - * This way, it eliminates any rounding errors. - * (This is tricky, don't mess with the formula, rounding errors - * can easily get introduced) */ - bytes_count = (off_t)(((double)nbytes * (pio_mpi_rank_g + 1)) / pio_mpi_nprocs_g) - - (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g); - - /* debug */ - if (pio_debug_level >= 4) { - HDprint_rank(output); - if (!parms->dim2d) { - HDfprintf(output, - "Debug(do_write): " - "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH - "d\n", - buf_size, (long long)bytes_begin[0], (long long)bytes_count); - } - else { - HDfprintf(output, - "Debug(do_write): " - "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH - "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", - buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], - (long long)bytes_count); - } - } - - /* I/O Access specific setup */ - switch (parms->io_type) { - case POSIXIO: - /* No extra setup */ - break; - - case MPIO: /* MPI-I/O setup */ - /* 1D dataspace */ - if (!parms->dim2d) { - /* Build block's derived type */ - mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_blk_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Build file's derived type */ - mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)pio_mpi_nprocs_g, mpi_blk_type, - &mpi_file_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit file type */ - mrc = MPI_Type_commit(&mpi_file_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Commit buffer type */ - mrc = MPI_Type_commit(&mpi_blk_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - } /* end if */ - /* 2D dataspace */ - else { - /* Build partial buffer derived type for contiguous access */ - mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE, &mpi_partial_buffer_cont); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit partial buffer derived type */ - mrc = MPI_Type_commit(&mpi_partial_buffer_cont); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build contiguous file's derived type */ - mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes / buf_size), - mpi_partial_buffer_cont, &mpi_cont_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit contiguous file type */ - mrc = MPI_Type_commit(&mpi_cont_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build partial buffer derived type for interleaved access */ - mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_partial_buffer_inter); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit partial buffer derived type */ - mrc = MPI_Type_commit(&mpi_partial_buffer_inter); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build interleaved file's derived type */ - mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes / blk_size), - mpi_partial_buffer_inter, &mpi_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit interleaved file type */ - mrc = MPI_Type_commit(&mpi_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build full buffer derived type */ - mrc = MPI_Type_contiguous((int)(blk_size * buf_size), MPI_BYTE, &mpi_full_buffer); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit full buffer derived type */ - mrc = MPI_Type_commit(&mpi_full_buffer); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build full chunk derived type */ - mrc = MPI_Type_contiguous((int)(blk_size * blk_size), MPI_BYTE, &mpi_full_chunk); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit full chunk derived type */ - mrc = MPI_Type_commit(&mpi_full_chunk); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - - /* Build chunk interleaved file's derived type */ - mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)((size_t)snbytes / blk_size), - mpi_full_chunk, &mpi_chunk_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE"); - - /* Commit chunk interleaved file type */ - mrc = MPI_Type_commit(&mpi_chunk_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT"); - } /* end else */ - break; - - case PHDF5: /* HDF5 setup */ - /* 1D dataspace */ - if (!parms->dim2d) { - if (nbytes > 0) { - /* define a contiguous dataset of nbytes native bytes */ - h5dims[0] = (hsize_t)nbytes; - h5dset_space_id = H5Screate_simple(1, h5dims, NULL); - VRFY((h5dset_space_id >= 0), "H5Screate_simple"); - - /* Set up the file dset space id to select the pattern to access */ - if (!parms->interleaved) { - /* Contiguous pattern */ - h5start[0] = (hsize_t)bytes_begin[0]; - h5stride[0] = h5block[0] = blk_size; - h5count[0] = buf_size / blk_size; - } /* end if */ - else { - /* Interleaved access pattern */ - /* Skip offset over blocks of other processes */ - h5start[0] = (hsize_t)bytes_begin[0]; - h5stride[0] = blk_size * (size_t)pio_mpi_nprocs_g; - h5block[0] = blk_size; - h5count[0] = buf_size / blk_size; - } /* end else */ - hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, - h5block); - VRFY((hrc >= 0), "H5Sselect_hyperslab"); - } /* end if */ - else { - h5dset_space_id = H5Screate(H5S_SCALAR); - VRFY((h5dset_space_id >= 0), "H5Screate"); - } /* end else */ - - /* Create the memory dataspace that corresponds to the xfer buffer */ - if (buf_size > 0) { - h5dims[0] = buf_size; - h5mem_space_id = H5Screate_simple(1, h5dims, NULL); - VRFY((h5mem_space_id >= 0), "H5Screate_simple"); - } /* end if */ - else { - h5mem_space_id = H5Screate(H5S_SCALAR); - VRFY((h5mem_space_id >= 0), "H5Screate"); - } /* end else */ - } /* end if */ - /* 2D dataspace */ - else { - if (nbytes > 0) { - /* define a contiguous dataset of nbytes native bytes */ - h5dims[0] = (hsize_t)snbytes; - h5dims[1] = (hsize_t)snbytes; - h5dset_space_id = H5Screate_simple(2, h5dims, NULL); - VRFY((h5dset_space_id >= 0), "H5Screate_simple"); - - /* Set up the file dset space id to select the pattern to access */ - if (!parms->interleaved) { - /* Contiguous pattern */ - h5start[0] = (hsize_t)bytes_begin[0]; - h5start[1] = (hsize_t)bytes_begin[1]; - h5stride[0] = 1; - h5stride[1] = h5block[0] = h5block[1] = blk_size; - h5count[0] = 1; - h5count[1] = buf_size / blk_size; - } /* end if */ - else { - /* Interleaved access pattern */ - /* Skip offset over blocks of other processes */ - h5start[0] = (hsize_t)bytes_begin[0]; - h5start[1] = (hsize_t)bytes_begin[1]; - h5stride[0] = blk_size; - h5stride[1] = blk_size * (size_t)pio_mpi_nprocs_g; - h5block[0] = h5block[1] = blk_size; - h5count[0] = buf_size / blk_size; - h5count[1] = 1; - } /* end else */ - hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, - h5block); - VRFY((hrc >= 0), "H5Sselect_hyperslab"); - } /* end if */ - else { - h5dset_space_id = H5Screate(H5S_SCALAR); - VRFY((h5dset_space_id >= 0), "H5Screate"); - } /* end else */ - - /* Create the memory dataspace that corresponds to the xfer buffer */ - if (buf_size > 0) { - if (!parms->interleaved) { - h5dims[0] = blk_size; - h5dims[1] = buf_size; - } - else { - h5dims[0] = buf_size; - h5dims[1] = blk_size; - } - h5mem_space_id = H5Screate_simple(2, h5dims, NULL); - VRFY((h5mem_space_id >= 0), "H5Screate_simple"); - } /* end if */ - else { - h5mem_space_id = H5Screate(H5S_SCALAR); - VRFY((h5mem_space_id >= 0), "H5Screate"); - } /* end else */ - } /* end else */ - - /* Create the dataset transfer property list */ - h5dxpl = H5Pcreate(H5P_DATASET_XFER); - if (h5dxpl < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); - } - - /* Change to collective I/O, if asked */ - if (parms->collective) { - hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Property List Set failed\n"); - GOTOERROR(FAIL); - } /* end if */ - } /* end if */ - break; - - default: - break; - } /* end switch */ - - for (ndset = 1; ndset <= ndsets; ++ndset) { - - /* Calculate dataset offset within a file */ - - /* create dataset */ - switch (parms->io_type) { - case POSIXIO: - case MPIO: - /* both posix and mpi io just need dataset offset in file*/ - dset_offset = (ndset - 1) * nbytes; - break; - - case PHDF5: - HDsprintf(dname, "Dataset_%ld", ndset); - h5ds_id = H5DOPEN(fd->h5fd, dname); - if (h5ds_id < 0) { - HDfprintf(stderr, "HDF5 Dataset open failed\n"); - GOTOERROR(FAIL); - } - break; - - default: - break; - } - - /* The task is to transfer bytes_count bytes, starting at - * bytes_begin position, using transfer buffer of buf_size bytes. - * If interleaved, select buf_size at a time, in round robin - * fashion, according to number of process. Otherwise, select - * all bytes_count in contiguous. - */ - nbytes_xfer = 0; - - /* 1D dataspace */ - if (!parms->dim2d) { - /* Set base file offset for all I/O patterns and POSIX access */ - posix_file_offset = dset_offset + bytes_begin[0]; - - /* Set base file offset for all I/O patterns and MPI access */ - mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]); - } /* end if */ - else { - /* Set base file offset for all I/O patterns and POSIX access */ - posix_file_offset = dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]; - - /* Set base file offset for all I/O patterns and MPI access */ - mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]); - } /* end else */ - - /* Start "raw data" read timer */ - io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); - - while (nbytes_xfer < bytes_count) { - /* Read */ - /* Calculate offset of read within a dataset/file */ - switch (parms->io_type) { - case POSIXIO: - /* 1D dataspace */ - if (!parms->dim2d) { - /* Contiguous pattern */ - if (!parms->interleaved) { - /* Compute file offset */ - file_offset = posix_file_offset + (off_t)nbytes_xfer; - - /* only care if seek returns error */ - rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; - VRFY((rc == 0), "POSIXSEEK"); - - /* check if all bytes are read */ - rc = ((ssize_t)buf_size == POSIXREAD(fd->posixfd, buffer, buf_size)); - VRFY((rc != 0), "POSIXREAD"); - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)buf_size; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Set the base of user's buffer */ - buf_p = (unsigned char *)buffer; - - /* Set the number of bytes to transfer this time */ - nbytes_toxfer = buf_size; - - /* Loop over the buffers to read */ - while (nbytes_toxfer > 0) { - /* Skip offset over blocks of other processes */ - file_offset = posix_file_offset + (off_t)(nbytes_xfer * pio_mpi_nprocs_g); - - /* only care if seek returns error */ - rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; - VRFY((rc == 0), "POSIXSEEK"); - - /* check if all bytes are read */ - rc = ((ssize_t)blk_size == POSIXREAD(fd->posixfd, buf_p, blk_size)); - VRFY((rc != 0), "POSIXREAD"); - - /* Advance location in buffer */ - buf_p += blk_size; - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)blk_size; - - /* Decrement number of bytes left this time */ - nbytes_toxfer -= blk_size; - } /* end while */ - } /* end else */ - } /* end if */ - /* 2D dataspace */ - else { - /* Contiguous storage */ - if (!parms->h5_use_chunks) { - /* Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute file offset */ - file_offset = posix_file_offset + - (off_t)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) * - (blk_size * (size_t)snbytes) + - (((size_t)nbytes_xfer / blk_size) % (size_t)snbytes)); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = buf_size; - - /* Global offset advance after each I/O operation */ - file_offset_advance = (off_t)snbytes; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Compute file offset */ - file_offset = - posix_file_offset + - (off_t)(((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) / - (size_t)snbytes) * - (buf_size * (size_t)snbytes) + - (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) % - (size_t)snbytes); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size; - - /* Global offset advance after each I/O operation */ - file_offset_advance = (off_t)snbytes; - } /* end else */ - } /* end if */ - /* Chunked storage */ - else { - /*Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute file offset */ - file_offset = posix_file_offset + (off_t)nbytes_xfer; - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size * buf_size; - - /* Global offset advance after each I/O operation */ - file_offset_advance = 0; - } /* end if */ - /*Interleaved access pattern */ - else { - /* Compute file offset */ - /* Before simplification */ - /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size) - *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size - *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size)) - *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */ - - file_offset = posix_file_offset + - (off_t)((((size_t)nbytes_xfer / (buf_size / blk_size) * - (size_t)pio_mpi_nprocs_g) / - ((size_t)snbytes * blk_size)) * - (buf_size * (size_t)snbytes) + - (((size_t)nbytes_xfer / (buf_size / blk_size)) * - (size_t)pio_mpi_nprocs_g) % - ((size_t)snbytes * blk_size)); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size * blk_size; - - /* Global offset advance after each I/O operation */ - /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */ - file_offset_advance = (off_t)((size_t)snbytes * blk_size); - } /* end else */ - } /* end else */ - - /* Common code for file access */ - - /* Set the base of user's buffer */ - buf_p = (unsigned char *)buffer; - - /* Set the number of bytes to transfer this time */ - nbytes_toxfer = buf_size * blk_size; - - /* Loop over portions of the buffer to read */ - while (nbytes_toxfer > 0) { - /* only care if seek returns error */ - rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; - VRFY((rc == 0), "POSIXSEEK"); - - /* check if all bytes are read */ - rc = ((ssize_t)nbytes_xfer_advance == - POSIXREAD(fd->posixfd, buf_p, nbytes_xfer_advance)); - VRFY((rc != 0), "POSIXREAD"); - - /* Advance location in buffer */ - buf_p += nbytes_xfer_advance; - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)nbytes_xfer_advance; - - /* Decrement number of bytes left this time */ - nbytes_toxfer -= nbytes_xfer_advance; - - /* Partially advance file offset */ - file_offset += file_offset_advance; - } /* end while */ - - } /* end else */ - break; - - case MPIO: - /* 1D dataspace */ - if (!parms->dim2d) { - /* Independent file access */ - if (!parms->collective) { - /* Contiguous pattern */ - if (!parms->interleaved) { - /* Compute offset in file */ - mpi_offset = mpi_file_offset + nbytes_xfer; - - /* Perform independent read */ - mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer, - (int)(buf_size / blk_size), mpi_blk_type, &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)buf_size; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Set the base of user's buffer */ - buf_p = (unsigned char *)buffer; - - /* Set the number of bytes to transfer this time */ - nbytes_toxfer = buf_size; - - /* Loop over the buffers to read */ - while (nbytes_toxfer > 0) { - /* Skip offset over blocks of other processes */ - mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g); - - /* Perform independent read */ - mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p, (int)1, mpi_blk_type, - &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); - - /* Advance location in buffer */ - buf_p += blk_size; - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)blk_size; - - /* Decrement number of bytes left this time */ - nbytes_toxfer -= blk_size; - } /* end while */ - } /* end else */ - } /* end if */ - /* Collective file access */ - else { - /* Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute offset in file */ - mpi_offset = mpi_file_offset + nbytes_xfer; - - /* Perform collective read */ - mrc = MPI_File_read_at_all(fd->mpifd, mpi_offset, buffer, - (int)(buf_size / blk_size), mpi_blk_type, - &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)buf_size; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Compute offset in file */ - mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g); - - /* Set the file view */ - mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type, - (char *)"native", h5_io_info_g); - VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); - - /* Perform collective read */ - mrc = MPI_File_read_at_all(fd->mpifd, 0, buffer, (int)(buf_size / blk_size), - mpi_blk_type, &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)buf_size; - } /* end else */ - } /* end else */ - } /* end if */ - /* 2D dataspace */ - else { - /* Contiguous storage */ - if (!parms->h5_use_chunks) { - /* Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute offset in file */ - mpi_offset = - mpi_file_offset + - (MPI_Offset)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) * - (blk_size * (size_t)snbytes)) + - (MPI_Offset)(((size_t)nbytes_xfer / blk_size) % (size_t)snbytes); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = buf_size; - - /* Global offset advance after each I/O operation */ - mpi_offset_advance = snbytes; - - /* MPI type to be used for collective access */ - mpi_collective_type = mpi_cont_type; - } /* end if */ - /* Interleaved access pattern */ - else { - /* Compute offset in file */ - mpi_offset = - mpi_file_offset + - (MPI_Offset)( - ((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) / - (size_t)snbytes) * - (buf_size * (size_t)snbytes)) + - (MPI_Offset)( - (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) % - (size_t)snbytes); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size; - - /* Global offset advance after each I/O operation */ - mpi_offset_advance = snbytes; - - /* MPI type to be used for collective access */ - mpi_collective_type = mpi_inter_type; - } /* end else */ - } /* end if */ - /* Chunked storage */ - else { - /*Contiguous access pattern */ - if (!parms->interleaved) { - /* Compute offset in file */ - mpi_offset = mpi_file_offset + nbytes_xfer; - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size * buf_size; - - /* Global offset advance after each I/O operation */ - mpi_offset_advance = 0; - - /* MPI type to be used for collective access */ - mpi_collective_type = mpi_full_buffer; - } /* end if */ - /*Interleaved access pattern */ - else { - /* Compute offset in file */ - /* Before simplification */ - /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size) - *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))* - (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+ - ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes - /blk_size*(blk_size*blk_size)); */ - mpi_offset = mpi_file_offset + - (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size) * - (size_t)pio_mpi_nprocs_g) / - ((size_t)snbytes * blk_size)) * - (buf_size * (size_t)snbytes)) + - (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size)) * - (size_t)pio_mpi_nprocs_g) % - ((size_t)snbytes * blk_size)); - - /* Number of bytes to be transferred per I/O operation */ - nbytes_xfer_advance = blk_size * blk_size; - - /* Global offset advance after each I/O operation */ - /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */ - mpi_offset_advance = (MPI_Offset)((size_t)snbytes * blk_size); - - /* MPI type to be used for collective access */ - mpi_collective_type = mpi_chunk_inter_type; - } /* end else */ - } /* end else */ - - /* Common code for independent file access */ - if (!parms->collective) { - /* Set the base of user's buffer */ - buf_p = (unsigned char *)buffer; - - /* Set the number of bytes to transfer this time */ - nbytes_toxfer = buf_size * blk_size; - - /* Loop over portions of the buffer to read */ - while (nbytes_toxfer > 0) { - /* Perform independent read */ - mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p, (int)nbytes_xfer_advance, - MPI_BYTE, &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); - - /* Advance location in buffer */ - buf_p += nbytes_xfer_advance; - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)nbytes_xfer_advance; - - /* Decrement number of bytes left this time */ - nbytes_toxfer -= nbytes_xfer_advance; - - /* Partially advance global offset in dataset */ - mpi_offset += mpi_offset_advance; - } /* end while */ - } /* end if */ - - /* Common code for collective file access */ - else { - /* Set the file view */ - mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type, - (char *)"native", h5_io_info_g); - VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); - - /* Perform read */ - MPI_File_read_at_all(fd->mpifd, 0, buffer, (int)(buf_size * blk_size), MPI_BYTE, - &mpi_status); - VRFY((mrc == MPI_SUCCESS), "MPIO_READ"); - - /* Advance global offset in dataset */ - nbytes_xfer += (off_t)buf_size * (off_t)blk_size; - } /* end else */ - - } /* end else */ - break; - - case PHDF5: - /* 1D dataspace */ - if (!parms->dim2d) { - /* Set up the file dset space id to move the selection to process */ - if (!parms->interleaved) { - /* Contiguous pattern */ - h5offset[0] = nbytes_xfer; - } /* end if */ - else { - /* Interleaved access pattern */ - /* Skip offset over blocks of other processes */ - h5offset[0] = (nbytes_xfer * pio_mpi_nprocs_g); - } /* end else */ - hrc = H5Soffset_simple(h5dset_space_id, h5offset); - VRFY((hrc >= 0), "H5Soffset_simple"); - - /* Read the buffer in */ - hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); - VRFY((hrc >= 0), "H5Dread"); - - /* Increment number of bytes transferred */ - nbytes_xfer += (off_t)buf_size; - } /* end if */ - /* 2D dataspace */ - else { - /* Set up the file dset space id to move the selection to process */ - if (!parms->interleaved) { - /* Contiguous pattern */ - h5offset[0] = - (hssize_t)(((size_t)nbytes_xfer / ((size_t)snbytes * blk_size)) * blk_size); - h5offset[1] = - (hssize_t)(((size_t)nbytes_xfer % ((size_t)snbytes * blk_size)) / blk_size); - } /* end if */ - else { - /* Interleaved access pattern */ - /* Skip offset over blocks of other processes */ - h5offset[0] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) / - ((size_t)snbytes * buf_size)) * - buf_size); - h5offset[1] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) % - ((size_t)snbytes * buf_size)) / - buf_size); - - } /* end else */ - hrc = H5Soffset_simple(h5dset_space_id, h5offset); - VRFY((hrc >= 0), "H5Soffset_simple"); - - /* Write the buffer out */ - hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); - VRFY((hrc >= 0), "H5Dread"); - - /* Increment number of bytes transferred */ - nbytes_xfer += (off_t)buf_size * (off_t)blk_size; - - } /* end else */ - break; - - default: - break; - } /* switch (parms->io_type) */ - - /* Verify raw data, if asked */ - if (parms->verify) { - /* Verify data read */ - unsigned char *ucharptr = (unsigned char *)buffer; - size_t i; - int nerror = 0; - - for (i = 0; i < bsize; ++i) { - if (*ucharptr++ != pio_mpi_rank_g + 1) { - if (++nerror < 20) { - /* report at most 20 errors */ - HDprint_rank(output); - HDfprintf(output, - "read data error, expected (%d), " - "got (%d)\n", - pio_mpi_rank_g + 1, (int)*(ucharptr - 1)); - } /* end if */ - } /* end if */ - } /* end for */ - if (nerror >= 20) { - HDprint_rank(output); - HDfprintf(output, "..."); - HDfprintf(output, "total read data errors=%d\n", nerror); - } /* end if */ - } /* if (parms->verify) */ - - } /* end while */ - - /* Stop "raw data" read timer */ - io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); - - /* Calculate read time */ - - /* Close dataset. Only HDF5 needs to do an explicit close. */ - if (parms->io_type == PHDF5) { - hrc = H5Dclose(h5ds_id); - - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Close failed\n"); - GOTOERROR(FAIL); - } - - h5ds_id = H5I_INVALID_HID; - } /* end if */ - } /* end for */ - -done: - /* release MPI-I/O objects */ - if (parms->io_type == MPIO) { - /* 1D dataspace */ - if (!parms->dim2d) { - /* Free file type */ - mrc = MPI_Type_free(&mpi_file_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free buffer type */ - mrc = MPI_Type_free(&mpi_blk_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - } /* end if */ - /* 2D dataspace */ - else { - /* Free partial buffer type for contiguous access */ - mrc = MPI_Type_free(&mpi_partial_buffer_cont); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free contiguous file type */ - mrc = MPI_Type_free(&mpi_cont_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free partial buffer type for interleaved access */ - mrc = MPI_Type_free(&mpi_partial_buffer_inter); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free interleaved file type */ - mrc = MPI_Type_free(&mpi_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free full buffer type */ - mrc = MPI_Type_free(&mpi_full_buffer); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free full chunk type */ - mrc = MPI_Type_free(&mpi_full_chunk); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - - /* Free chunk interleaved file type */ - mrc = MPI_Type_free(&mpi_chunk_inter_type); - VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE"); - } /* end else */ - } /* end if */ - - /* release HDF5 objects */ - if (h5dset_space_id != -1) { - hrc = H5Sclose(h5dset_space_id); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); - ret_code = FAIL; - } - else { - h5dset_space_id = H5I_INVALID_HID; - } - } - - if (h5mem_space_id != -1) { - hrc = H5Sclose(h5mem_space_id); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); - ret_code = FAIL; - } - else { - h5mem_space_id = H5I_INVALID_HID; - } - } - - if (h5dxpl != -1) { - hrc = H5Pclose(h5dxpl); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); - ret_code = FAIL; - } - else { - h5dxpl = H5I_INVALID_HID; - } - } - - return ret_code; -} - -/* - * Function: do_fopen - * Purpose: Open the specified file. - * Return: SUCCESS or FAIL - * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 - * Modifications: - */ -static herr_t -do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) -{ - int ret_code = SUCCESS, mrc; - hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */ - - switch (param->io_type) { - case POSIXIO: - if (flags & (PIO_CREATE | PIO_WRITE)) - fd->posixfd = POSIXCREATE(fname); - else - fd->posixfd = POSIXOPEN(fname, O_RDONLY); - - if (fd->posixfd < 0) { - HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname); - GOTOERROR(FAIL); - } - - /* The perils of POSIX I/O in a parallel environment. The problem is: - * - * - Process n opens a file with truncation and then starts - * writing to the file. - * - Process m also opens the file with truncation, but after - * process n has already started to write to the file. Thus, - * all of the stuff process n wrote is now lost. - */ - MPI_Barrier(pio_comm_g); - - break; - - case MPIO: - if (flags & (PIO_CREATE | PIO_WRITE)) { - MPI_File_delete(fname, h5_io_info_g); - mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR, h5_io_info_g, - &fd->mpifd); - - if (mrc != MPI_SUCCESS) { - HDfprintf(stderr, "MPI File Open failed(%s)\n", fname); - GOTOERROR(FAIL); - } - - /*since MPI_File_open with MPI_MODE_CREATE does not truncate */ - /*filesize , set size to 0 explicitedly. */ - mrc = MPI_File_set_size(fd->mpifd, (MPI_Offset)0); - if (mrc != MPI_SUCCESS) { - HDfprintf(stderr, "MPI_File_set_size failed\n"); - GOTOERROR(FAIL); - } - } - else { - mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY, h5_io_info_g, &fd->mpifd); - if (mrc != MPI_SUCCESS) { - HDfprintf(stderr, "MPI File Open failed(%s)\n", fname); - GOTOERROR(FAIL); - } - } - - break; - - case PHDF5: - if ((acc_tpl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); - } - - /* Set the file driver to the MPI-IO driver */ - if (H5Pset_fapl_mpio(acc_tpl, pio_comm_g, h5_io_info_g) < 0) { - HDfprintf(stderr, "HDF5 Property List Set failed\n"); - GOTOERROR(FAIL); - } - - /* Set the alignment of objects in HDF5 file */ - if (H5Pset_alignment(acc_tpl, param->h5_thresh, param->h5_align) < 0) { - HDfprintf(stderr, "HDF5 Property List Set failed\n"); - GOTOERROR(FAIL); - } - - /* create the parallel file */ - if (flags & (PIO_CREATE | PIO_WRITE)) - fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); - else - fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, acc_tpl); - if (fd->h5fd < 0) { - HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname); - GOTOERROR(FAIL); - } - - /* verifying the close of the acc_tpl */ - if (H5Pclose(acc_tpl) < 0) { - HDfprintf(stderr, "HDF5 Property List Close failed\n"); - GOTOERROR(FAIL); - } - - break; - - default: - break; - } - -done: - return ret_code; -} - -/* - * Function: do_fclose - * Purpose: Close the specified file descriptor. - * Return: SUCCESS or FAIL - * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 - * Modifications: - */ -static herr_t -do_fclose(iotype iot, file_descr *fd /*out*/) -{ - herr_t ret_code = SUCCESS, hrc; - int mrc = 0, rc = 0; - - switch (iot) { - case POSIXIO: - rc = POSIXCLOSE(fd->posixfd); - - if (rc != 0) { - HDfprintf(stderr, "POSIX File Close failed\n"); - GOTOERROR(FAIL); - } - - fd->posixfd = -1; - break; - - case MPIO: - mrc = MPI_File_close(&fd->mpifd); - - if (mrc != MPI_SUCCESS) { - HDfprintf(stderr, "MPI File close failed\n"); - GOTOERROR(FAIL); - } - - fd->mpifd = MPI_FILE_NULL; - break; - - case PHDF5: - hrc = H5Fclose(fd->h5fd); - - if (hrc < 0) { - HDfprintf(stderr, "HDF5 File Close failed\n"); - GOTOERROR(FAIL); - } - - fd->h5fd = -1; - break; - - default: - break; - } - -done: - return ret_code; -} - -/* - * Function: do_fclose - * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set. - * Only Proc 0 of the PIO communicator will do the cleanup. - * Other processes just return. - * Return: void - * Programmer: Albert Cheng 2001/12/12 - * Modifications: - */ -static void -do_cleanupfile(iotype iot, char *fname) -{ - if (pio_mpi_rank_g != 0) - return; - - if (clean_file_g == -1) - clean_file_g = (getenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0; - - if (clean_file_g) { - switch (iot) { - case POSIXIO: - HDremove(fname); - break; - case MPIO: - case PHDF5: - MPI_File_delete(fname, h5_io_info_g); - break; - default: - break; - } - } -} - -#ifdef TIME_MPI -/* instrument the MPI_File_wrirte_xxx and read_xxx calls to measure - * pure time spent in MPI_File code. - */ -int -MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) -{ - int err; - io_time_set(timer_g, HDF5_MPI_READ, TSTART); - err = PMPI_File_read_at(fh, offset, buf, count, datatype, status); - io_time_set(timer_g, HDF5_MPI_READ, TSTOP); - return err; -} - -int -MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) -{ - int err; - io_time_set(timer_g, HDF5_MPI_READ, TSTART); - err = PMPI_File_read_at_all(fh, offset, buf, count, datatype, status); - io_time_set(timer_g, HDF5_MPI_READ, TSTOP); - return err; -} - -int -MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) -{ - int err; - io_time_set(timer_g, HDF5_MPI_WRITE, TSTART); - err = PMPI_File_write_at(fh, offset, buf, count, datatype, status); - io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP); - return err; -} - -int -MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) -{ - int err; - io_time_set(timer_g, HDF5_MPI_WRITE, TSTART); - err = PMPI_File_write_at_all(fh, offset, buf, count, datatype, status); - io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP); - return err; -} - -#endif /* TIME_MPI */ -#endif /* H5_HAVE_PARALLEL */ diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c deleted file mode 100644 index d38c574..0000000 --- a/tools/test/perform/pio_perf.c +++ /dev/null @@ -1,1699 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Parallel HDF5 Performance Testing Code - * -------------------------------------- - * - * Portable code to test performance on the different platforms we support. - * This is what the report should look like: - * - * nprocs = Max#Procs - * IO API = POSIXIO - * # Files = 1, # of dsets = 1000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * # Files = 1, # of dsets = 3000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * - * . . . - * - * IO API = MPIO - * # Files = 1, # of dsets = 1000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * # Files = 1, # of dsets = 3000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * - * . . . - * - * IO API = PHDF5 - * # Files = 1, # of dsets = 1000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * # Files = 1, # of dsets = 3000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * - * . . . - * - * nprocs = Max#Procs / 2 - * - * . . . - * - */ - -/* system header files */ -#include -#include -#include - -#include "hdf5.h" - -#ifdef H5_HAVE_PARALLEL - -/* library header files */ -#include - -/* our header files */ -#include "pio_perf.h" - -/* useful macros */ -#define TAB_SPACE 4 - -#define ONE_KB 1024 -#define ONE_MB (ONE_KB * ONE_KB) -#define ONE_GB (ONE_MB * ONE_KB) - -#define PIO_POSIX 0x1 -#define PIO_MPI 0x2 -#define PIO_HDF5 0x4 - -#ifdef STANDALONE -#define DBL_EPSILON 2.2204460492503131e-16 -#define H5_DBL_ABS_EQUAL(X, Y) (fabs((X) - (Y)) < DBL_EPSILON) -#endif - -/* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) - -#ifndef TRUE -#define TRUE 1 -#endif /* TRUE */ -#ifndef FALSE -#define FALSE (!TRUE) -#endif /* FALSE */ - -/* global variables */ -FILE * output; /* output file */ -int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ -int comm_world_nprocs_g; /* num. of processes of MPI_COMM_WORLD */ -MPI_Comm pio_comm_g; /* Communicator to run the PIO */ -int pio_mpi_rank_g; /* MPI rank of pio_comm_g */ -int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */ -int pio_debug_level = 0; /* The debug level: - * 0 - Off - * 1 - Minimal - * 2 - Some more - * 3 - Maximal - * 4 - Maximal & then some - */ - -/* local variables */ -static const char *progname = "h5perf"; - -/* - * Command-line options: The user can specify short or long-named - * parameters. The long-named ones can be partially spelled. When - * adding more, make sure that they don't clash with each other. - */ -#if 1 -static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; -#else -static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; -#endif /* 1 */ -static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, - {"alig", require_arg, 'a'}, - {"ali", require_arg, 'a'}, - {"al", require_arg, 'a'}, - {"api", require_arg, 'A'}, - {"ap", require_arg, 'A'}, -#if 0 - /* a sighting of the elusive binary option */ - { "binary", no_arg, 'b' }, - { "binar", no_arg, 'b' }, - { "bina", no_arg, 'b' }, - { "bin", no_arg, 'b' }, - { "bi", no_arg, 'b' }, -#endif /* 0 */ - {"block-size", require_arg, 'B'}, - {"block-siz", require_arg, 'B'}, - {"block-si", require_arg, 'B'}, - {"block-s", require_arg, 'B'}, - {"block-", require_arg, 'B'}, - {"block", require_arg, 'B'}, - {"bloc", require_arg, 'B'}, - {"blo", require_arg, 'B'}, - {"bl", require_arg, 'B'}, - {"chunk", no_arg, 'c'}, - {"chun", no_arg, 'c'}, - {"chu", no_arg, 'c'}, - {"ch", no_arg, 'c'}, - {"collective", no_arg, 'C'}, - {"collectiv", no_arg, 'C'}, - {"collecti", no_arg, 'C'}, - {"collect", no_arg, 'C'}, - {"collec", no_arg, 'C'}, - {"colle", no_arg, 'C'}, - {"coll", no_arg, 'C'}, - {"col", no_arg, 'C'}, - {"co", no_arg, 'C'}, - {"debug", require_arg, 'D'}, - {"debu", require_arg, 'D'}, - {"deb", require_arg, 'D'}, - {"de", require_arg, 'D'}, - {"geometry", no_arg, 'g'}, - {"geometr", no_arg, 'g'}, - {"geomet", no_arg, 'g'}, - {"geome", no_arg, 'g'}, - {"geom", no_arg, 'g'}, - {"geo", no_arg, 'g'}, - {"ge", no_arg, 'g'}, - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"interleaved", require_arg, 'I'}, - {"interleave", require_arg, 'I'}, - {"interleav", require_arg, 'I'}, - {"interlea", require_arg, 'I'}, - {"interle", require_arg, 'I'}, - {"interl", require_arg, 'I'}, - {"inter", require_arg, 'I'}, - {"inte", require_arg, 'I'}, - {"int", require_arg, 'I'}, - {"in", require_arg, 'I'}, - {"max-num-processes", require_arg, 'P'}, - {"max-num-processe", require_arg, 'P'}, - {"max-num-process", require_arg, 'P'}, - {"max-num-proces", require_arg, 'P'}, - {"max-num-proce", require_arg, 'P'}, - {"max-num-proc", require_arg, 'P'}, - {"max-num-pro", require_arg, 'P'}, - {"max-num-pr", require_arg, 'P'}, - {"max-num-p", require_arg, 'P'}, - {"min-num-processes", require_arg, 'p'}, - {"min-num-processe", require_arg, 'p'}, - {"min-num-process", require_arg, 'p'}, - {"min-num-proces", require_arg, 'p'}, - {"min-num-proce", require_arg, 'p'}, - {"min-num-proc", require_arg, 'p'}, - {"min-num-pro", require_arg, 'p'}, - {"min-num-pr", require_arg, 'p'}, - {"min-num-p", require_arg, 'p'}, - {"max-xfer-size", require_arg, 'X'}, - {"max-xfer-siz", require_arg, 'X'}, - {"max-xfer-si", require_arg, 'X'}, - {"max-xfer-s", require_arg, 'X'}, - {"max-xfer", require_arg, 'X'}, - {"max-xfe", require_arg, 'X'}, - {"max-xf", require_arg, 'X'}, - {"max-x", require_arg, 'X'}, - {"min-xfer-size", require_arg, 'x'}, - {"min-xfer-siz", require_arg, 'x'}, - {"min-xfer-si", require_arg, 'x'}, - {"min-xfer-s", require_arg, 'x'}, - {"min-xfer", require_arg, 'x'}, - {"min-xfe", require_arg, 'x'}, - {"min-xf", require_arg, 'x'}, - {"min-x", require_arg, 'x'}, - {"num-bytes", require_arg, 'e'}, - {"num-byte", require_arg, 'e'}, - {"num-byt", require_arg, 'e'}, - {"num-by", require_arg, 'e'}, - {"num-b", require_arg, 'e'}, - {"num-dsets", require_arg, 'd'}, - {"num-dset", require_arg, 'd'}, - {"num-dse", require_arg, 'd'}, - {"num-ds", require_arg, 'd'}, - {"num-d", require_arg, 'd'}, - {"num-files", require_arg, 'F'}, - {"num-file", require_arg, 'F'}, - {"num-fil", require_arg, 'F'}, - {"num-fi", require_arg, 'F'}, - {"num-f", require_arg, 'F'}, - {"num-iterations", require_arg, 'i'}, - {"num-iteration", require_arg, 'i'}, - {"num-iteratio", require_arg, 'i'}, - {"num-iterati", require_arg, 'i'}, - {"num-iterat", require_arg, 'i'}, - {"num-itera", require_arg, 'i'}, - {"num-iter", require_arg, 'i'}, - {"num-ite", require_arg, 'i'}, - {"num-it", require_arg, 'i'}, - {"num-i", require_arg, 'i'}, - {"output", require_arg, 'o'}, - {"outpu", require_arg, 'o'}, - {"outp", require_arg, 'o'}, - {"out", require_arg, 'o'}, - {"ou", require_arg, 'o'}, - {"threshold", require_arg, 'T'}, - {"threshol", require_arg, 'T'}, - {"thresho", require_arg, 'T'}, - {"thresh", require_arg, 'T'}, - {"thres", require_arg, 'T'}, - {"thre", require_arg, 'T'}, - {"thr", require_arg, 'T'}, - {"th", require_arg, 'T'}, - {"write-only", require_arg, 'w'}, - {"write-onl", require_arg, 'w'}, - {"write-on", require_arg, 'w'}, - {"write-o", require_arg, 'w'}, - {"write", require_arg, 'w'}, - {"writ", require_arg, 'w'}, - {"wri", require_arg, 'w'}, - {"wr", require_arg, 'w'}, - {NULL, 0, '\0'}}; - -struct options { - long io_types; /* bitmask of which I/O types to test */ - const char *output_file; /* file to print report to */ - long num_dsets; /* number of datasets */ - long num_files; /* number of files */ - off_t num_bpp; /* number of bytes per proc per dset */ - int num_iters; /* number of iterations */ - int max_num_procs; /* maximum number of processes to use */ - int min_num_procs; /* minimum number of processes to use */ - size_t max_xfer_size; /* maximum transfer buffer size */ - size_t min_xfer_size; /* minimum transfer buffer size */ - size_t blk_size; /* Block size */ - unsigned interleaved; /* Interleaved vs. contiguous blocks */ - unsigned collective; /* Collective vs. independent I/O */ - unsigned dim2d; /* 1D vs. 2D geometry */ - int print_times; /* print times as well as throughputs */ - int print_raw; /* print raw data throughput info */ - off_t h5_alignment; /* alignment in HDF5 file */ - off_t h5_threshold; /* threshold for alignment in HDF5 file */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ - int verify; /* Verify data correctness */ -}; - -typedef struct _minmax { - double min; - double max; - double sum; - int num; -} minmax; - -/* local functions */ -static off_t parse_size_directive(const char *size); -static struct options *parse_command_line(int argc, char *argv[]); -static void run_test_loop(struct options *options); -static int run_test(iotype iot, parameters parms, struct options *opts); -static void output_all_info(minmax *mm, int count, int indent_level); -static void get_minmax(minmax *mm, double val); -static minmax accumulate_minmax_stuff(minmax *mm, int count); -static int create_comm_world(int num_procs, int *doing_pio); -static int destroy_comm_world(void); -static void output_results(const struct options *options, const char *name, minmax *table, int table_size, - off_t data_size); -static void output_times(const struct options *options, const char *name, minmax *table, int table_size); -static void output_report(const char *fmt, ...); -static void print_indent(register int indent); -static void usage(const char *prog); -static void report_parameters(struct options *opts); -static off_t squareo(off_t); - -/* - * Function: main - * Purpose: Start things up. Initialize MPI and then call the test looping - * function. - * Return: EXIT_SUCCESS or EXIT_FAILURE - * Programmer: Bill Wendling, 30. October 2001 - * Modifications: - */ -int -main(int argc, char *argv[]) -{ - int ret; - int exit_value = EXIT_SUCCESS; - struct options *opts = NULL; - -#ifndef STANDALONE - /* Initialize h5tools lib */ - h5tools_init(); -#endif - - output = stdout; - - /* initialize MPI and get the maximum num of processors we started with */ - MPI_Init(&argc, &argv); - ret = MPI_Comm_size(MPI_COMM_WORLD, &comm_world_nprocs_g); - - if (ret != MPI_SUCCESS) { - HDfprintf(stderr, "%s: MPI_Comm_size call failed\n", progname); - - if (ret == MPI_ERR_COMM) - HDfprintf(stderr, "invalid MPI communicator\n"); - else - HDfprintf(stderr, "invalid argument\n"); - - exit_value = EXIT_FAILURE; - goto finish; - } - - ret = MPI_Comm_rank(MPI_COMM_WORLD, &comm_world_rank_g); - - if (ret != MPI_SUCCESS) { - HDfprintf(stderr, "%s: MPI_Comm_rank call failed\n", progname); - - if (ret == MPI_ERR_COMM) - HDfprintf(stderr, "invalid MPI communicator\n"); - else - HDfprintf(stderr, "invalid argument\n"); - - exit_value = EXIT_FAILURE; - goto finish; - } - - pio_comm_g = MPI_COMM_WORLD; - - h5_set_info_object(); - opts = parse_command_line(argc, argv); - - if (!opts) { - exit_value = EXIT_FAILURE; - goto finish; - } - - if (opts->output_file) { - if ((output = HDfopen(opts->output_file, "w")) == NULL) { - HDfprintf(stderr, "%s: cannot open output file\n", progname); - perror(opts->output_file); - goto finish; - } - } - - if ((pio_debug_level == 0 && comm_world_rank_g == 0) || pio_debug_level > 0) - report_parameters(opts); - - run_test_loop(opts); - -finish: - MPI_Finalize(); - free(opts); - return exit_value; -} - -off_t -squareo(off_t x) -{ - return x * x; -} - -/* - * Function: run_test_loop - * Purpose: Run the I/O tests. Write the results to OUTPUT. - * - * - The slowest changing part of the test is the number of - * processors to use. For each loop iteration, we divide that - * number by 2 and rerun the test. - * - * - The second slowest is what type of IO API to perform. We have - * three choices: POSIXIO, MPI-IO, and PHDF5. - * - * - Then we change the size of the buffer. This information is - * inferred from the number of datasets to create and the number - * of integers to put into each dataset. The backend code figures - * this out. - * - * Return: Nothing - * Programmer: Bill Wendling, 30. October 2001 - * Modifications: - * Added 2D testing (Christian Chilan, 10. August 2005) - */ -static void -run_test_loop(struct options *opts) -{ - parameters parms; - int num_procs; - int doing_pio; /* if this process is doing PIO */ - - parms.num_files = opts->num_files; - parms.num_dsets = opts->num_dsets; - parms.num_iters = opts->num_iters; - parms.blk_size = opts->blk_size; - parms.interleaved = opts->interleaved; - parms.collective = opts->collective; - parms.dim2d = opts->dim2d; - parms.h5_align = (hsize_t)opts->h5_alignment; - parms.h5_thresh = (hsize_t)opts->h5_threshold; - parms.h5_use_chunks = opts->h5_use_chunks; - parms.h5_write_only = opts->h5_write_only; - parms.verify = opts->verify; - - /* start with max_num_procs and decrement it by half for each loop. */ - /* if performance needs restart, fewer processes may be needed. */ - for (num_procs = opts->max_num_procs; num_procs >= opts->min_num_procs; num_procs >>= 1) { - register size_t buf_size; - - parms.num_procs = num_procs; - - if (create_comm_world(parms.num_procs, &doing_pio) != SUCCESS) { - /* do something harsh */ - } - - /* only processes doing PIO will run the tests */ - if (doing_pio) { - output_report("Number of processors = %ld\n", parms.num_procs); - - /* multiply the xfer buffer size by 2 for each loop iteration */ - for (buf_size = opts->min_xfer_size; buf_size <= opts->max_xfer_size; buf_size <<= 1) { - parms.buf_size = buf_size; - - if (parms.dim2d) { - parms.num_bytes = squareo(opts->num_bpp * parms.num_procs); - if (parms.interleaved) - output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", buf_size, - opts->blk_size, - ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); - else - output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", - opts->blk_size, buf_size, - ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); - - print_indent(1); - output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2fx%.2f KB\n", - parms.num_files, parms.num_dsets, - (double)(opts->num_bpp * parms.num_procs) / ONE_KB, - (double)(opts->num_bpp * parms.num_procs) / ONE_KB); - } - else { - parms.num_bytes = (off_t)opts->num_bpp * parms.num_procs; - output_report("Transfer Buffer Size: %ld bytes, File size: %.2f MB\n", buf_size, - ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); - - print_indent(1); - output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2f MB\n", - parms.num_files, parms.num_dsets, - (double)(opts->num_bpp * parms.num_procs) / ONE_MB); - } - - if (opts->io_types & PIO_POSIX) - run_test(POSIXIO, parms, opts); - - if (opts->io_types & PIO_MPI) - run_test(MPIO, parms, opts); - - if (opts->io_types & PIO_HDF5) - run_test(PHDF5, parms, opts); - - /* Run the tests once if buf_size==0, but then break out */ - if (buf_size == 0) - break; - } - - if (destroy_comm_world() != SUCCESS) { - /* do something harsh */ - } - } - } -} - -/* - * Function: run_test - * Purpose: Inner loop call to actually run the I/O test. - * Return: Nothing - * Programmer: Bill Wendling, 18. December 2001 - * Modifications: - */ -static int -run_test(iotype iot, parameters parms, struct options *opts) -{ - results res; - register int i, ret_value = SUCCESS; - int comm_size; - off_t raw_size; - minmax * write_mpi_mm_table = NULL; - minmax * write_mm_table = NULL; - minmax * write_gross_mm_table = NULL; - minmax * write_raw_mm_table = NULL; - minmax * read_mpi_mm_table = NULL; - minmax * read_mm_table = NULL; - minmax * read_gross_mm_table = NULL; - minmax * read_raw_mm_table = NULL; - minmax * read_open_mm_table = NULL; - minmax * read_close_mm_table = NULL; - minmax * write_open_mm_table = NULL; - minmax * write_close_mm_table = NULL; - minmax write_mpi_mm = {0.0, 0.0, 0.0, 0}; - minmax write_mm = {0.0, 0.0, 0.0, 0}; - minmax write_gross_mm = {0.0, 0.0, 0.0, 0}; - minmax write_raw_mm = {0.0, 0.0, 0.0, 0}; - minmax read_mpi_mm = {0.0, 0.0, 0.0, 0}; - minmax read_mm = {0.0, 0.0, 0.0, 0}; - minmax read_gross_mm = {0.0, 0.0, 0.0, 0}; - minmax read_raw_mm = {0.0, 0.0, 0.0, 0}; - minmax read_open_mm = {0.0, 0.0, 0.0, 0}; - minmax read_close_mm = {0.0, 0.0, 0.0, 0}; - minmax write_open_mm = {0.0, 0.0, 0.0, 0}; - minmax write_close_mm = {0.0, 0.0, 0.0, 0}; - - raw_size = parms.num_files * (off_t)parms.num_dsets * (off_t)parms.num_bytes; - parms.io_type = iot; - print_indent(2); - output_report("IO API = "); - - switch (iot) { - case POSIXIO: - output_report("POSIX\n"); - break; - case MPIO: - output_report("MPIO\n"); - break; - case PHDF5: - output_report("PHDF5 (w/MPI-IO driver)\n"); - break; - default: - break; - } - - MPI_Comm_size(pio_comm_g, &comm_size); - - /* allocate space for tables minmax and that it is sufficient */ - /* to initialize all elements to zeros by calloc. */ - write_mpi_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - write_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - write_gross_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - write_raw_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - write_open_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - write_close_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - if (!parms.h5_write_only) { - read_mpi_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - read_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - read_gross_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - read_raw_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - read_open_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - read_close_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); - } - - /* Do IO iteration times, collecting statistics each time */ - for (i = 0; i < parms.num_iters; ++i) { - double t; - - MPI_Barrier(pio_comm_g); - res = do_pio(parms); - - /* gather all of the "mpi write" times */ - t = io_time_get(res.timers, HDF5_MPI_WRITE); - get_minmax(&write_mpi_mm, t); - - write_mpi_mm_table[i] = write_mpi_mm; - - /* gather all of the "write" times */ - t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); - get_minmax(&write_mm, t); - - write_mm_table[i] = write_mm; - - /* gather all of the "write" times from open to close */ - t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); - get_minmax(&write_gross_mm, t); - - write_gross_mm_table[i] = write_gross_mm; - - /* gather all of the raw "write" times */ - t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); - get_minmax(&write_raw_mm, t); - - write_raw_mm_table[i] = write_raw_mm; - - /* gather all of the file open times (time from open to first write) */ - t = io_time_get(res.timers, HDF5_FILE_WRITE_OPEN); - get_minmax(&write_open_mm, t); - - write_open_mm_table[i] = write_open_mm; - - /* gather all of the file close times (time from last write to close) */ - t = io_time_get(res.timers, HDF5_FILE_WRITE_CLOSE); - get_minmax(&write_close_mm, t); - - write_close_mm_table[i] = write_close_mm; - - if (!parms.h5_write_only) { - /* gather all of the "mpi read" times */ - t = io_time_get(res.timers, HDF5_MPI_READ); - get_minmax(&read_mpi_mm, t); - - read_mpi_mm_table[i] = read_mpi_mm; - - /* gather all of the "read" times */ - t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS); - get_minmax(&read_mm, t); - - read_mm_table[i] = read_mm; - - /* gather all of the "read" times from open to close */ - t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS); - get_minmax(&read_gross_mm, t); - - read_gross_mm_table[i] = read_gross_mm; - - /* gather all of the raw "read" times */ - t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS); - get_minmax(&read_raw_mm, t); - - read_raw_mm_table[i] = read_raw_mm; - - /* gather all of the file open times (time from open to first read) */ - t = io_time_get(res.timers, HDF5_FILE_READ_OPEN); - get_minmax(&read_open_mm, t); - - read_open_mm_table[i] = read_open_mm; - - /* gather all of the file close times (time from last read to close) */ - t = io_time_get(res.timers, HDF5_FILE_READ_CLOSE); - get_minmax(&read_close_mm, t); - - read_close_mm_table[i] = read_close_mm; - } - - io_time_destroy(res.timers); - } - - /* - * Show various statistics - */ - /* Write statistics */ - /* Print the raw data throughput if desired */ - if (opts->print_raw) { - /* accumulate and output the max, min, and average "raw write" times */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Raw Data Write details:\n"); - output_all_info(write_raw_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size); - } /* end if */ - - /* show mpi write statics */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("MPI Write details:\n"); - output_all_info(write_mpi_mm_table, parms.num_iters, 4); - } - - /* We don't currently output the MPI write results */ - - /* accumulate and output the max, min, and average "write" times */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Write details:\n"); - output_all_info(write_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Write", write_mm_table, parms.num_iters, raw_size); - - /* accumulate and output the max, min, and average "gross write" times */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Write Open-Close details:\n"); - output_all_info(write_gross_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Write Open-Close", write_gross_mm_table, parms.num_iters, raw_size); - - if (opts->print_times) { - output_times(opts, "Write File Open", write_open_mm_table, parms.num_iters); - output_times(opts, "Write File Close", write_close_mm_table, parms.num_iters); - } - - /* Print out time from open to first write */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Write file open details:\n"); - output_all_info(write_open_mm_table, parms.num_iters, 4); - } - - /* Print out time from last write to close */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Write file close details:\n"); - output_all_info(write_close_mm_table, parms.num_iters, 4); - } - - if (!parms.h5_write_only) { - /* Read statistics */ - /* Print the raw data throughput if desired */ - if (opts->print_raw) { - /* accumulate and output the max, min, and average "raw read" times */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Raw Data Read details:\n"); - output_all_info(read_raw_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size); - } /* end if */ - - /* show mpi read statics */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("MPI Read details:\n"); - output_all_info(read_mpi_mm_table, parms.num_iters, 4); - } - - /* We don't currently output the MPI read results */ - - /* accumulate and output the max, min, and average "read" times */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Read details:\n"); - output_all_info(read_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Read", read_mm_table, parms.num_iters, raw_size); - - /* accumulate and output the max, min, and average "gross read" times */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Read Open-Close details:\n"); - output_all_info(read_gross_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Read Open-Close", read_gross_mm_table, parms.num_iters, raw_size); - - if (opts->print_times) { - output_times(opts, "Read File Open", read_open_mm_table, parms.num_iters); - output_times(opts, "Read File Close", read_close_mm_table, parms.num_iters); - } - - /* Print out time from open to first read */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Read file open details:\n"); - output_all_info(read_open_mm_table, parms.num_iters, 4); - } - - /* Print out time from last read to close */ - if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Read file close details:\n"); - output_all_info(read_close_mm_table, parms.num_iters, 4); - } - } - - /* clean up our mess */ - free(write_mpi_mm_table); - free(write_mm_table); - free(write_gross_mm_table); - free(write_raw_mm_table); - free(write_open_mm_table); - free(write_close_mm_table); - - if (!parms.h5_write_only) { - free(read_mpi_mm_table); - free(read_mm_table); - free(read_gross_mm_table); - free(read_raw_mm_table); - free(read_open_mm_table); - free(read_close_mm_table); - } - - return ret_value; -} - -/* - * Function: output_all_info - * Purpose: - * Return: Nothing - * Programmer: Bill Wendling, 29. January 2002 - * Modifications: - */ -static void -output_all_info(minmax *mm, int count, int indent_level) -{ - int i; - - for (i = 0; i < count; ++i) { - print_indent(indent_level); - output_report("Iteration %d:\n", i + 1); - print_indent(indent_level + 1); - output_report("Minimum Time: %.2fs\n", mm[i].min); - print_indent(indent_level + 1); - output_report("Maximum Time: %.2fs\n", mm[i].max); - } -} - -/* - * Function: get_minmax - * Purpose: Gather all the min, max and total of val. - * Return: Nothing - * Programmer: Bill Wendling, 21. December 2001 - * Modifications: - * Use MPI_Allreduce to do it. -akc, 2002/01/11 - */ -static void -get_minmax(minmax *mm, double val) -{ - int myrank; - - MPI_Comm_rank(pio_comm_g, &myrank); - MPI_Comm_size(pio_comm_g, &mm->num); - - MPI_Allreduce(&val, &mm->max, 1, MPI_DOUBLE, MPI_MAX, pio_comm_g); - MPI_Allreduce(&val, &mm->min, 1, MPI_DOUBLE, MPI_MIN, pio_comm_g); - MPI_Allreduce(&val, &mm->sum, 1, MPI_DOUBLE, MPI_SUM, pio_comm_g); -} - -/* - * Function: accumulate_minmax_stuff - * Purpose: Accumulate the minimum, maximum, and average of the times - * across all processes. - * Return: TOTAL_MM - the total of all of these. - * Programmer: Bill Wendling, 21. December 2001 - * Modifications: - * Changed to use seconds instead of MB/s - QAK, 5/9/02 - */ -static minmax -accumulate_minmax_stuff(minmax *mm, int count) -{ - int i; - minmax total_mm; - - total_mm.sum = 0.0f; - total_mm.max = -DBL_MAX; - total_mm.min = DBL_MAX; - total_mm.num = count; - - for (i = 0; i < count; ++i) { - double m = mm[i].max; - - total_mm.sum += m; - - if (m < total_mm.min) - total_mm.min = m; - - if (m > total_mm.max) - total_mm.max = m; - } - - return total_mm; -} - -/* - * Function: create_comm_world - * Purpose: Create an MPI Comm world and store it in pio_comm_g, which - * is a global variable. - * Return: SUCCESS on success. - * FAIL otherwise. - * Programmer: Bill Wendling, 19. December 2001 - * Modifications: - */ -static int -create_comm_world(int num_procs, int *doing_pio) -{ - /* MPI variables */ - int mrc; /* return values */ - int color; /* for communicator creation */ - int myrank, nprocs; - - pio_comm_g = MPI_COMM_NULL; - - /* - * Create a sub communicator for this PIO run. Easier to use the first N - * processes. - */ - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - - if (num_procs > nprocs) { - HDfprintf(stderr, "number of process(%d) must be <= number of processes in MPI_COMM_WORLD(%d)\n", - num_procs, nprocs); - goto error_done; - } - - MPI_Comm_rank(MPI_COMM_WORLD, &myrank); - color = (myrank < num_procs); - mrc = MPI_Comm_split(MPI_COMM_WORLD, color, myrank, &pio_comm_g); - - if (mrc != MPI_SUCCESS) { - HDfprintf(stderr, "MPI_Comm_split failed\n"); - goto error_done; - } - - if (!color) { - /* not involved in this run */ - mrc = destroy_comm_world(); - goto done; - } - - /* determine the MPI rank in the PIO communicator */ - MPI_Comm_size(pio_comm_g, &pio_mpi_nprocs_g); - MPI_Comm_rank(pio_comm_g, &pio_mpi_rank_g); - -done: - *doing_pio = color; - return SUCCESS; - -error_done: - destroy_comm_world(); - return FAIL; -} - -/* - * Function: destroy_comm_world - * Purpose: Destroy the created MPI Comm world which is stored in the - * pio_comm_g global variable. - * Return: SUCCESS on success. - * FAIL otherwise. - * Programmer: Bill Wendling, 19. December 2001 - * Modifications: - */ -static int -destroy_comm_world(void) -{ - int mrc = SUCCESS; /* return code */ - - /* release MPI resources */ - if (pio_comm_g != MPI_COMM_NULL) - mrc = (MPI_Comm_free(&pio_comm_g) == MPI_SUCCESS ? SUCCESS : FAIL); - - return mrc; -} - -/* - * Function: output_results - * Purpose: Print information about the time & bandwidth for a given - * minmax & # of iterations. - * Return: Nothing - * Programmer: Quincey Koziol, 9. May 2002 - * Modifications: - */ -static void -output_results(const struct options *opts, const char *name, minmax *table, int table_size, off_t data_size) -{ - minmax total_mm; - - total_mm = accumulate_minmax_stuff(table, table_size); - - print_indent(3); - output_report("%s (%d iteration(s)):\n", name, table_size); - - /* Note: The maximum throughput uses the minimum amount of time & vice versa */ - - print_indent(4); - output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.min)); - if (opts->print_times) - output_report(" (%7.3f s)\n", total_mm.min); - else - output_report("\n"); - - print_indent(4); - output_report("Average Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.sum / total_mm.num)); - if (opts->print_times) - output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num)); - else - output_report("\n"); - - print_indent(4); - output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.max)); - if (opts->print_times) - output_report(" (%7.3f s)\n", total_mm.max); - else - output_report("\n"); -} - -static void -output_times(const struct options *opts, const char *name, minmax *table, int table_size) -{ - minmax total_mm; - - total_mm = accumulate_minmax_stuff(table, table_size); - - print_indent(3); - output_report("%s (%d iteration(s)):\n", name, table_size); - - /* Note: The maximum throughput uses the minimum amount of time & vice versa */ - - print_indent(4); - output_report("Minimum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.min)); - - print_indent(4); - output_report("Average Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, - (total_mm.sum / total_mm.num)); - - print_indent(4); - output_report("Maximum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.max)); -} - -/* - * Function: output_report - * Purpose: Print a line of the report. Only do so if I'm the 0 process. - * Return: Nothing - * Programmer: Bill Wendling, 19. December 2001 - * Modifications: - */ -static void -output_report(const char *fmt, ...) -{ - int myrank; - - MPI_Comm_rank(pio_comm_g, &myrank); - - if (myrank == 0) { - va_list ap; - - HDva_start(ap, fmt); - HDvfprintf(output, fmt, ap); - HDva_end(ap); - } -} - -/* - * Function: print_indent - * Purpose: Print spaces to indent a new line of text for pretty printing - * things. - * Return: Nothing - * Programmer: Bill Wendling, 29. October 2001 - * Modifications: - */ -static void -print_indent(register int indent) -{ - int myrank; - - MPI_Comm_rank(pio_comm_g, &myrank); - - if (myrank == 0) { - indent *= TAB_SPACE; - - for (; indent > 0; --indent) - HDfputc(' ', output); - } -} - -static void -recover_size_and_print(long long val, const char *end) -{ - if (val >= ONE_KB && (val % ONE_KB) == 0) { - if (val >= ONE_MB && (val % ONE_MB) == 0) { - if (val >= ONE_GB && (val % ONE_GB) == 0) - HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" - "GB%s", - val / ONE_GB, end); - else - HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" - "MB%s", - val / ONE_MB, end); - } - else { - HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" - "KB%s", - val / ONE_KB, end); - } - } - else { - HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" - "%s", - val, end); - } -} - -static void -print_io_api(long io_types) -{ - if (io_types & PIO_POSIX) - HDfprintf(output, "posix "); - if (io_types & PIO_MPI) - HDfprintf(output, "mpiio "); - if (io_types & PIO_HDF5) - HDfprintf(output, "phdf5 "); - HDfprintf(output, "\n"); -} - -static void -report_parameters(struct options *opts) -{ - int rank = comm_world_rank_g; - - print_version("HDF5 Library"); /* print library version */ - HDfprintf(output, "rank %d: ==== Parameters ====\n", rank); - - HDfprintf(output, "rank %d: IO API=", rank); - print_io_api(opts->io_types); - - HDfprintf(output, "rank %d: Number of files=%ld\n", rank, opts->num_files); - HDfprintf(output, "rank %d: Number of datasets=%ld\n", rank, opts->num_dsets); - HDfprintf(output, "rank %d: Number of iterations=%d\n", rank, opts->num_iters); - HDfprintf(output, "rank %d: Number of processes=%d:%d\n", rank, opts->min_num_procs, opts->max_num_procs); - - if (opts->dim2d) { - HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank); - recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->min_num_procs), ":"); - recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->max_num_procs), "\n"); - - HDfprintf(output, "rank %d: Size of dataset(s)=", rank); - recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), "x"); - recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":"); - recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "x"); - recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); - - HDfprintf(output, "rank %d: File size=", rank); - recover_size_and_print((long long)(squareo(opts->num_bpp * opts->min_num_procs) * opts->num_dsets), - ":"); - recover_size_and_print((long long)(squareo(opts->num_bpp * opts->max_num_procs) * opts->num_dsets), - "\n"); - - HDfprintf(output, "rank %d: Transfer buffer size=", rank); - if (opts->interleaved) { - recover_size_and_print((long long)opts->min_xfer_size, "x"); - recover_size_and_print((long long)opts->blk_size, ":"); - recover_size_and_print((long long)opts->max_xfer_size, "x"); - recover_size_and_print((long long)opts->blk_size, "\n"); - } - else { - recover_size_and_print((long long)opts->blk_size, "x"); - recover_size_and_print((long long)opts->min_xfer_size, ":"); - recover_size_and_print((long long)opts->blk_size, "x"); - recover_size_and_print((long long)opts->max_xfer_size, "\n"); - } - HDfprintf(output, "rank %d: Block size=", rank); - recover_size_and_print((long long)opts->blk_size, "x"); - recover_size_and_print((long long)opts->blk_size, "\n"); - } - else { - HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank); - recover_size_and_print((long long)opts->num_bpp, "\n"); - - HDfprintf(output, "rank %d: Size of dataset(s)=", rank); - recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":"); - recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); - - HDfprintf(output, "rank %d: File size=", rank); - recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs * opts->num_dsets), ":"); - recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs * opts->num_dsets), "\n"); - - HDfprintf(output, "rank %d: Transfer buffer size=", rank); - recover_size_and_print((long long)opts->min_xfer_size, ":"); - recover_size_and_print((long long)opts->max_xfer_size, "\n"); - HDfprintf(output, "rank %d: Block size=", rank); - recover_size_and_print((long long)opts->blk_size, "\n"); - } - - HDfprintf(output, "rank %d: Block Pattern in Dataset=", rank); - if (opts->interleaved) - HDfprintf(output, "Interleaved\n"); - else - HDfprintf(output, "Contiguous\n"); - - HDfprintf(output, "rank %d: I/O Method for MPI and HDF5=", rank); - if (opts->collective) - HDfprintf(output, "Collective\n"); - else - HDfprintf(output, "Independent\n"); - - HDfprintf(output, "rank %d: Geometry=", rank); - if (opts->dim2d) - HDfprintf(output, "2D\n"); - else - HDfprintf(output, "1D\n"); - - HDfprintf(output, "rank %d: VFL used for HDF5 I/O=%s\n", rank, "MPI-IO driver"); - - HDfprintf(output, "rank %d: Data storage method in HDF5=", rank); - if (opts->h5_use_chunks) - HDfprintf(output, "Chunked\n"); - else - HDfprintf(output, "Contiguous\n"); - - { - char *prefix = HDgetenv("HDF5_PARAPREFIX"); - - HDfprintf(output, "rank %d: Env HDF5_PARAPREFIX=%s\n", rank, (prefix ? prefix : "not set")); - } - - HDfprintf(output, "rank %d: ", rank); - h5_dump_info_object(h5_io_info_g); - - HDfprintf(output, "rank %d: ==== End of Parameters ====\n", rank); - HDfprintf(output, "\n"); -} - -/* - * Function: parse_command_line - * Purpose: Parse the command line options and return a STRUCT OPTIONS - * structure which will need to be freed by the calling function. - * Return: Pointer to an OPTIONS structure - * Programmer: Bill Wendling, 31. October 2001 - * Modifications: - * Added 2D testing (Christian Chilan, 10. August 2005) - */ -static struct options * -parse_command_line(int argc, char *argv[]) -{ - register int opt; - struct options *cl_opts; - - cl_opts = (struct options *)malloc(sizeof(struct options)); - - cl_opts->output_file = NULL; - cl_opts->io_types = 0; /* will set default after parsing options */ - cl_opts->num_dsets = 1; - cl_opts->num_files = 1; - cl_opts->num_bpp = 0; - cl_opts->num_iters = 1; - cl_opts->max_num_procs = comm_world_nprocs_g; - cl_opts->min_num_procs = 1; - cl_opts->max_xfer_size = 0; - cl_opts->min_xfer_size = 0; - cl_opts->blk_size = 0; - cl_opts->interleaved = 0; /* Default to contiguous blocks in dataset */ - cl_opts->collective = 0; /* Default to independent I/O access */ - cl_opts->dim2d = 0; /* Default to 1D */ - cl_opts->print_times = FALSE; /* Printing times is off by default */ - cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */ - cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */ - cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */ - cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */ - cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ - cl_opts->verify = FALSE; /* No Verify data correctness by default */ - - while ((opt = H5_get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) { - switch ((char)opt) { - case 'a': - cl_opts->h5_alignment = parse_size_directive(H5_optarg); - break; - case 'A': { - const char *end = H5_optarg; - - while (end && *end != '\0') { - char buf[10]; - int i; - - HDmemset(buf, '\0', sizeof(buf)); - - for (i = 0; *end != '\0' && *end != ','; ++end) - if (isalnum(*end) && i < 10) - buf[i++] = *end; - - if (!HDstrcasecmp(buf, "phdf5")) { - cl_opts->io_types |= PIO_HDF5; - } - else if (!HDstrcasecmp(buf, "mpiio")) { - cl_opts->io_types |= PIO_MPI; - } - else if (!HDstrcasecmp(buf, "posix")) { - cl_opts->io_types |= PIO_POSIX; - } - else { - HDfprintf(stderr, "pio_perf: invalid --api option %s\n", buf); - HDexit(EXIT_FAILURE); - } - - if (*end == '\0') - break; - - end++; - } - } - - break; -#if 0 - case 'b': - /* the future "binary" option */ - break; -#endif /* 0 */ - case 'B': - cl_opts->blk_size = (size_t)parse_size_directive(H5_optarg); - break; - case 'c': - /* Turn on chunked HDF5 dataset creation */ - cl_opts->h5_use_chunks = TRUE; - break; - case 'C': - cl_opts->collective = 1; - break; - case 'd': - cl_opts->num_dsets = atoi(H5_optarg); - break; - case 'D': { - const char *end = H5_optarg; - - while (end && *end != '\0') { - char buf[10]; - int i; - - HDmemset(buf, '\0', sizeof(buf)); - - for (i = 0; *end != '\0' && *end != ','; ++end) - if (HDisalnum(*end) && i < 10) - buf[i++] = *end; - - if (HDstrlen(buf) > 1 || HDisdigit(buf[0])) { - size_t j; - - for (j = 0; j < 10 && buf[j] != '\0'; ++j) - if (!isdigit(buf[j])) { - HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); - HDexit(EXIT_FAILURE); - } - - pio_debug_level = atoi(buf); - - if (pio_debug_level > 4) - pio_debug_level = 4; - else if (pio_debug_level < 0) - pio_debug_level = 0; - } - else { - switch (*buf) { - case 'r': - /* Turn on raw data throughput info */ - cl_opts->print_raw = TRUE; - break; - case 't': - /* Turn on time printing */ - cl_opts->print_times = TRUE; - break; - case 'v': - /* Turn on verify data correctness*/ - cl_opts->verify = TRUE; - break; - default: - HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); - HDexit(EXIT_FAILURE); - } - } - - if (*end == '\0') - break; - - end++; - } - } - - break; - case 'e': - cl_opts->num_bpp = parse_size_directive(H5_optarg); - break; - case 'F': - cl_opts->num_files = HDatoi(H5_optarg); - break; - case 'g': - cl_opts->dim2d = 1; - break; - case 'i': - cl_opts->num_iters = HDatoi(H5_optarg); - break; - case 'I': - cl_opts->interleaved = 1; - break; - case 'o': - cl_opts->output_file = H5_optarg; - break; - case 'p': - cl_opts->min_num_procs = HDatoi(H5_optarg); - break; - case 'P': - cl_opts->max_num_procs = HDatoi(H5_optarg); - break; - case 'T': - cl_opts->h5_threshold = parse_size_directive(H5_optarg); - break; - case 'w': - cl_opts->h5_write_only = TRUE; - break; - case 'x': - cl_opts->min_xfer_size = (size_t)parse_size_directive(H5_optarg); - break; - case 'X': - cl_opts->max_xfer_size = (size_t)parse_size_directive(H5_optarg); - break; - case 'h': - case '?': - default: - usage(progname); - HDfree(cl_opts); - return NULL; - } - } - - if (cl_opts->num_bpp == 0) { - if (cl_opts->dim2d == 0) - cl_opts->num_bpp = 256 * ONE_KB; - else - cl_opts->num_bpp = 8 * ONE_KB; - } - - if (cl_opts->max_xfer_size == 0) - cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; - - if (cl_opts->min_xfer_size == 0) - cl_opts->min_xfer_size = (size_t)(cl_opts->num_bpp) / 2; - - if (cl_opts->blk_size == 0) - cl_opts->blk_size = (size_t)(cl_opts->num_bpp) / 2; - - /* set default if none specified yet */ - if (!cl_opts->io_types) - cl_opts->io_types = PIO_HDF5 | PIO_MPI | PIO_POSIX; /* run all API */ - - /* verify parameters sanity. Adjust if needed. */ - /* cap xfer_size with bytes per process */ - if (!cl_opts->dim2d) { - if (cl_opts->min_xfer_size > (size_t)cl_opts->num_bpp) - cl_opts->min_xfer_size = (size_t)cl_opts->num_bpp; - if (cl_opts->max_xfer_size > (size_t)cl_opts->num_bpp) - cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; - } - if (cl_opts->min_xfer_size > cl_opts->max_xfer_size) - cl_opts->min_xfer_size = cl_opts->max_xfer_size; - if (cl_opts->blk_size > (size_t)cl_opts->num_bpp) - cl_opts->blk_size = (size_t)cl_opts->num_bpp; - /* check range of number of processes */ - if (cl_opts->min_num_procs <= 0) - cl_opts->min_num_procs = 1; - if (cl_opts->max_num_procs <= 0) - cl_opts->max_num_procs = 1; - if (cl_opts->min_num_procs > cl_opts->max_num_procs) - cl_opts->min_num_procs = cl_opts->max_num_procs; - /* check iteration */ - if (cl_opts->num_iters <= 0) - cl_opts->num_iters = 1; - - return cl_opts; -} - -/* - * Function: parse_size_directive - * Purpose: Parse the size directive passed on the commandline. The size - * directive is an integer followed by a size indicator: - * - * K, k - Kilobyte - * M, m - Megabyte - * G, g - Gigabyte - * - * Return: The size as a off_t because this is related to file size. - * If an unknown size indicator is used, then the program will - * exit with EXIT_FAILURE as the return value. - * Programmer: Bill Wendling, 18. December 2001 - * Modifications: - */ -static off_t -parse_size_directive(const char *size) -{ - off_t s; - char *endptr; - - s = HDstrtol(size, &endptr, 10); - - if (endptr && *endptr) { - while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t')) - ++endptr; - - switch (*endptr) { - case 'K': - case 'k': - s *= ONE_KB; - break; - case 'M': - case 'm': - s *= ONE_MB; - break; - case 'G': - case 'g': - s *= ONE_GB; - break; - default: - HDfprintf(stderr, "Illegal size specifier '%c'\n", *endptr); - HDexit(EXIT_FAILURE); - } - } - - return s; -} - -/* - * Function: usage - * Purpose: Print a usage message and then exit. - * Return: Nothing - * Programmer: Bill Wendling, 31. October 2001 - * Modifications: - * Added 2D testing (Christian Chilan, 10. August 2005) - */ -static void -usage(const char *prog) -{ - int myrank; - - MPI_Comm_rank(pio_comm_g, &myrank); - - if (myrank == 0) { - print_version(prog); - HDprintf("usage: %s [OPTIONS]\n", prog); - HDprintf(" OPTIONS\n"); - HDprintf(" -h, --help Print a usage message and exit\n"); - HDprintf(" -a S, --align=S Alignment of objects in HDF5 file [default: 1]\n"); - HDprintf(" -A AL, --api=AL Which APIs to test [default: all of them]\n"); -#if 0 - HDprintf(" -b, --binary The elusive binary option\n"); -#endif /* 0 */ - HDprintf(" -B S, --block-size=S Block size within transfer buffer\n"); - HDprintf(" (see below for description)\n"); - HDprintf(" [default: half the number of bytes per process\n"); - HDprintf(" per dataset]\n"); - HDprintf(" -c, --chunk Create HDF5 datasets using chunked storage\n"); - HDprintf(" [default: contiguous storage]\n"); - HDprintf(" -C, --collective Use collective I/O for MPI and HDF5 APIs\n"); - HDprintf(" [default: independent I/O)\n"); - HDprintf(" -d N, --num-dsets=N Number of datasets per file [default: 1]\n"); - HDprintf(" -D DL, --debug=DL Indicate the debugging level\n"); - HDprintf(" [default: no debugging]\n"); - HDprintf(" -e S, --num-bytes=S Number of bytes per process per dataset\n"); - HDprintf(" (see below for description)\n"); - HDprintf(" [default: 256K for 1D, 8K for 2D]\n"); - HDprintf(" -F N, --num-files=N Number of files [default: 1]\n"); - HDprintf(" -g, --geometry Use 2D geometry [default: 1D geometry]\n"); - HDprintf(" -i N, --num-iterations=N Number of iterations to perform [default: 1]\n"); - HDprintf(" -I, --interleaved Interleaved access pattern\n"); - HDprintf(" (see below for example)\n"); - HDprintf(" [default: Contiguous access pattern]\n"); - HDprintf(" -o F, --output=F Output raw data into file F [default: none]\n"); - HDprintf(" -p N, --min-num-processes=N Minimum number of processes to use [default: 1]\n"); - HDprintf(" -P N, --max-num-processes=N Maximum number of processes to use\n"); - HDprintf(" [default: all MPI_COMM_WORLD processes ]\n"); - HDprintf(" -T S, --threshold=S Threshold for alignment of objects in HDF5 file\n"); - HDprintf(" [default: 1]\n"); - HDprintf(" -w, --write-only Perform write tests not the read tests\n"); - HDprintf(" -x S, --min-xfer-size=S Minimum transfer buffer size\n"); - HDprintf(" (see below for description)\n"); - HDprintf(" [default: half the number of bytes per process\n"); - HDprintf(" per dataset]\n"); - HDprintf(" -X S, --max-xfer-size=S Maximum transfer buffer size\n"); - HDprintf(" [default: the number of bytes per process per\n"); - HDprintf(" dataset]\n"); - HDprintf("\n"); - HDprintf(" F - is a filename.\n"); - HDprintf(" N - is an integer >=0.\n"); - HDprintf(" S - is a size specifier, an integer >=0 followed by a size indicator:\n"); - HDprintf(" K - Kilobyte (%d)\n", ONE_KB); - HDprintf(" M - Megabyte (%d)\n", ONE_MB); - HDprintf(" G - Gigabyte (%d)\n", ONE_GB); - HDprintf("\n"); - HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37 * ONE_MB); - HDprintf("\n"); - HDprintf(" AL - is an API list. Valid values are:\n"); - HDprintf(" phdf5 - Parallel HDF5\n"); - HDprintf(" mpiio - MPI-I/O\n"); - HDprintf(" posix - POSIX\n"); - HDprintf("\n"); - HDprintf(" Example: --api=mpiio,phdf5\n"); - HDprintf("\n"); - HDprintf(" Dataset size:\n"); - HDprintf(" Depending on the selected geometry, each test dataset is either a linear\n"); - HDprintf(" array of size bytes-per-process * num-processes, or a square array of size\n"); - HDprintf(" (bytes-per-process * num-processes) x (bytes-per-process * num-processes).\n"); - HDprintf("\n"); - HDprintf(" Block size vs. Transfer buffer size:\n"); - HDprintf(" buffer-size controls the size of the memory buffer, which is broken into\n"); - HDprintf(" blocks and written to the file. Depending on the selected geometry, each\n"); - HDprintf(" block can be a linear array of size block-size or a square array of size\n"); - HDprintf(" block-size x block-size. The arrangement in which blocks are written is\n"); - HDprintf(" determined by the access pattern.\n"); - HDprintf("\n"); - HDprintf(" In 1D geometry, the transfer buffer is a linear array of size buffer-size.\n"); - HDprintf(" In 2D geometry, it is a rectangular array of size block-size x buffer-size\n"); - HDprintf(" or buffer-size x block-size if interleaved pattern is selected.\n"); - HDprintf("\n"); - HDprintf(" Interleaved and Contiguous patterns in 1D geometry:\n"); - HDprintf(" When contiguous access pattern is chosen, the dataset is evenly divided\n"); - HDprintf(" into num-processes regions and each process writes data to its own region.\n"); - HDprintf(" When interleaved blocks are written to a dataset, space for the first\n"); - HDprintf(" block of the first process is allocated in the dataset, then space is\n"); - HDprintf(" allocated for the first block of the second process, etc. until space is\n"); - HDprintf(" allocated for the first block of each process, then space is allocated for\n"); - HDprintf(" the second block of the first process, the second block of the second\n"); - HDprintf(" process, etc.\n"); - HDprintf("\n"); - HDprintf(" For example, with a 3 process run, 512KB bytes-per-process, 256KB transfer\n"); - HDprintf(" buffer size, and 64KB block size, each process must issue 2 transfer\n"); - HDprintf(" requests to complete access to the dataset.\n"); - HDprintf(" Contiguous blocks of the first transfer request are written like so:\n"); - HDprintf(" 1111----2222----3333----\n"); - HDprintf(" Interleaved blocks of the first transfer request are written like so:\n"); - HDprintf(" 123123123123------------\n"); - HDprintf(" The actual number of I/O operations involved in a transfer request\n"); - HDprintf(" depends on the access pattern and communication mode.\n"); - HDprintf(" When using independent I/O with interleaved pattern, each process\n"); - HDprintf(" performs 4 small non-contiguous I/O operations per transfer request.\n"); - HDprintf(" If collective I/O is turned on, the combined content of the buffers of\n"); - HDprintf(" the 3 processes will be written using one collective I/O operation\n"); - HDprintf(" per transfer request.\n"); - HDprintf("\n"); - HDprintf(" For information about access patterns in 2D geometry, please refer to the\n"); - HDprintf(" HDF5 Reference Manual.\n"); - HDprintf("\n"); - HDprintf(" DL - is a list of debugging flags. Valid values are:\n"); - HDprintf(" 1 - Minimal\n"); - HDprintf(" 2 - Not quite everything\n"); - HDprintf(" 3 - Everything\n"); - HDprintf(" 4 - The kitchen sink\n"); - HDprintf(" r - Raw data I/O throughput information\n"); - HDprintf(" t - Times as well as throughputs\n"); - HDprintf(" v - Verify data correctness\n"); - HDprintf("\n"); - HDprintf(" Example: --debug=2,r,t\n"); - HDprintf("\n"); - HDprintf(" Environment variables:\n"); - HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); - HDprintf(" HDF5_MPI_INFO MPI INFO object key=value separated by ;\n"); - HDprintf(" HDF5_PARAPREFIX Paralllel data files prefix\n"); - fflush(stdout); - } /* end if */ -} /* end usage() */ - -#else /* H5_HAVE_PARALLEL */ - -/* - * Function: main - * Purpose: Dummy main() function for if HDF5 was configured without - * parallel stuff. - * Return: EXIT_SUCCESS - * Programmer: Bill Wendling, 14. November 2001 - */ -int -main(void) -{ - HDprintf("No parallel IO performance because parallel is not configured\n"); - return EXIT_SUCCESS; -} /* end main */ - -#endif /* !H5_HAVE_PARALLEL */ diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h deleted file mode 100644 index 24621da..0000000 --- a/tools/test/perform/pio_perf.h +++ /dev/null @@ -1,100 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef PIO_PERF_H -#define PIO_PERF_H - -#ifndef STANDALONE -#include "io_timer.h" -#include "h5test.h" -#include "h5tools.h" -#include "h5tools_utils.h" -#else -#include "io_timer.h" -#include "pio_standalone.h" -#endif - -/* setup the dataset no fill option if this is v1.5 or more */ -#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4 -#define H5_HAVE_NOFILL 1 -#endif - -typedef enum iotype_ { - POSIXIO, - MPIO, - PHDF5 - /*NUM_TYPES*/ -} iotype; - -typedef struct parameters_ { - iotype io_type; /* The type of IO test to perform */ - int num_procs; /* Maximum number of processes to use */ - long num_files; /* Number of files to create */ - long num_dsets; /* Number of datasets to create */ - off_t num_bytes; /* Number of bytes in each dset */ - int num_iters; /* Number of times to loop doing the IO */ - size_t buf_size; /* Buffer size */ - size_t blk_size; /* Block size */ - unsigned interleaved; /* Interleaved vs. contiguous blocks */ - unsigned collective; /* Collective vs. independent I/O */ - unsigned dim2d; /* 1D vs. 2D */ - hsize_t h5_align; /* HDF5 object alignment */ - hsize_t h5_thresh; /* HDF5 object alignment threshold */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ - int verify; /* Verify data correctness */ -} parameters; - -typedef struct results_ { - herr_t ret_code; - io_time_t *timers; -} results; - -#ifndef SUCCESS -#define SUCCESS 0 -#endif /* !SUCCESS */ - -#ifndef FAIL -#define FAIL -1 -#endif /* !FAIL */ - -extern FILE * output; /* output file */ -extern io_time_t *timer_g; /* timer: global for stub functions */ -extern int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ -extern int comm_world_nprocs_g; /* num. of processes of MPI_COMM_WORLD */ -extern MPI_Comm pio_comm_g; /* Communicator to run the PIO */ -extern int pio_mpi_rank_g; /* MPI rank of pio_comm_g */ -extern int pio_mpi_nprocs_g; /* number of processes of pio_comm_g */ -extern int pio_debug_level; /* The debug level: - * 0 - Off - * 1 - Minimal - * 2 - Some more - * 3 - Maximal - * 4 - Even More Debugging (timer stuff) - */ - -#define HDprint_rank(f) /* print rank in MPI_COMM_WORLD */ HDfprintf(f, "%d: ", comm_world_rank_g); -#define HDprint_size(f) /* print size of MPI_COMM_WORLD */ HDfprintf(f, "%d", comm_world_nprocs_g); -#define HDprint_rank_size(f) /* print rank/size of MPI_COMM_WORLD */ \ - HDfprintf(f, "%d/%d: ", comm_world_rank_g, comm_world_nprocs_g); - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -extern results do_pio(parameters param); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* PIO_PERF_H */ diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index ded15a4..032bfba 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -17,10 +17,6 @@ #include "pio_perf.h" -#ifdef STANDALONE -MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */ -#endif - /** From h5tools_utils.c **/ /* global variables */ @@ -156,134 +152,3 @@ print_version(const char *progname) printf("%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE); } - -#ifdef STANDALONE -/* - * Function: h5_set_info_object - * Purpose: Process environment variables setting to set up MPI Info - * object. - * Return: 0 if all is fine; otherwise non-zero. - * Programmer: Albert Cheng, 2002/05/21. - * Modifications: - * Bill Wendling, 2002/05/31 - * Modified so that the HDF5_MPI_INFO environment variable can - * be a semicolon separated list of "key=value" pairings. Most - * of the code is to remove any whitespaces which might be - * surrounding the "key=value" pairs. - */ -int -h5_set_info_object(void) -{ - char *envp; /* environment pointer */ - int ret_value = 0; - - /* handle any MPI INFO hints via $HDF5_MPI_INFO */ - if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL) { - char *next, *valp; - - valp = envp = next = HDstrdup(envp); - - if (!valp) - return 0; - - /* create an INFO object if not created yet */ - if (h5_io_info_g == MPI_INFO_NULL) - MPI_Info_create(&h5_io_info_g); - - do { - size_t len; - char * key_val, *endp, *namep; - - if (*valp == ';') - valp++; - - /* copy key/value pair into temporary buffer */ - len = strcspn(valp, ";"); - next = &valp[len]; - key_val = (char *)HDcalloc(1, len + 1); - - /* increment the next pointer past the terminating semicolon */ - if (*next == ';') - ++next; - - namep = HDstrncpy(key_val, valp, len); - - /* pass up any beginning whitespaces */ - while (*namep && (*namep == ' ' || *namep == '\t')) - namep++; - - if (!*namep) - continue; /* was all white space, so move to next k/v pair */ - - /* eat up any ending white spaces */ - endp = &namep[HDstrlen(namep) - 1]; - - while (endp && (*endp == ' ' || *endp == '\t')) - *endp-- = '\0'; - - /* find the '=' */ - valp = HDstrchr(namep, '='); - - if (valp != NULL) { /* it's a valid key/value pairing */ - char *tmp_val = valp + 1; - - /* change '=' to \0, move valp down one */ - *valp-- = '\0'; - - /* eat up ending whitespace on the "key" part */ - while (*valp == ' ' || *valp == '\t') - *valp-- = '\0'; - - valp = tmp_val; - - /* eat up beginning whitespace on the "value" part */ - while (*valp == ' ' || *valp == '\t') - *valp++ = '\0'; - - /* actually set the darned thing */ - if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { - HDprintf("MPI_Info_set failed\n"); - ret_value = -1; - } - } - - valp = next; - HDfree(key_val); - } while (next && *next); - - HDfree(envp); - } - - return ret_value; -} - -/* - * Function: h5_dump_info_object - * Purpose: Display content of an MPI Info object - * Return: void - * Programmer: Albert Cheng 2002/05/21 - * Modifications: - */ -void -h5_dump_info_object(MPI_Info info) -{ - char key[MPI_MAX_INFO_KEY + 1]; - char value[MPI_MAX_INFO_VAL + 1]; - int flag; - int i, nkeys; - - HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL); - if (info == MPI_INFO_NULL) { - HDprintf("object is MPI_INFO_NULL\n"); - } - else { - MPI_Info_get_nkeys(info, &nkeys); - HDprintf("object has %d items\n", nkeys); - for (i = 0; i < nkeys; i++) { - MPI_Info_get_nthkey(info, i, key); - MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); - HDprintf("%s=%s\n", key, value); - } - } -} -#endif /* STANDALONE */ diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index ef6d97b..f1fb946 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -441,17 +441,6 @@ extern char * strdup(const char *s); #define TRUE true #endif -/** From h5test.h **/ - -#ifdef H5_HAVE_PARALLEL -extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ -#endif - -#ifdef H5_HAVE_PARALLEL -int h5_set_info_object(void); -void h5_dump_info_object(MPI_Info info); -#endif - /** From h5tools_utils.h **/ H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */ diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c deleted file mode 100644 index 1af2318..0000000 --- a/tools/test/perform/sio_engine.c +++ /dev/null @@ -1,1328 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Author: Christian Chilan, April 2008 - */ - -#include "hdf5.h" - -#include -#include -#include -#include - -#ifdef H5_HAVE_UNISTD_H -#include -#include -#endif - -#ifdef H5_HAVE_SYS_STAT_H -#include -#endif - -#include "sio_perf.h" - -/* Macro definitions */ - -/* sizes of various items. these sizes won't change during program execution */ -#define ELMT_H5_TYPE H5T_NATIVE_UCHAR - -#define GOTOERROR(errcode) \ - { \ - ret_code = errcode; \ - goto done; \ - } -#define ERRMSG(mesg) \ - { \ - HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \ - } - -/* verify: if val is false (0), print mesg. */ -#define VRFY(val, mesg) \ - do { \ - if (!val) { \ - ERRMSG(mesg); \ - GOTOERROR(FAIL); \ - } \ - } while (0) - -/* POSIX I/O macros */ -#ifdef H5_HAVE_WIN32_API -/* Can't link against the library, so this test will use the older, non-Unicode - * _open() call on Windows. - */ -#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__) -#endif /* H5_HAVE_WIN32_API */ -#define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600) -#define POSIXOPEN(fn, F) HDopen(fn, F, 0600) -#define POSIXCLOSE(F) HDclose(F) -#define POSIXSEEK(F, L) HDlseek(F, L, SEEK_SET) -#define POSIXWRITE(F, B, S) HDwrite(F, B, S) -#define POSIXREAD(F, B, S) HDread(F, B, S) - -enum { SIO_CREATE = 1, SIO_WRITE = 2, SIO_READ = 4 }; - -/* Global variables */ -static int clean_file_g = -1; /*whether to cleanup temporary test */ -/*files. -1 is not defined; */ -/*0 is no cleanup; 1 is do cleanup */ - -/* the different types of file descriptors we can expect */ -typedef union { - int posixfd; /* POSIX file handle*/ - hid_t h5fd; /* HDF5 file */ -} file_descr; - -/* local functions */ -static char * sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size, - parameters *param); -static herr_t do_write(results *res, file_descr *fd, parameters *parms, void *buffer); -static herr_t do_read(results *res, file_descr *fd, parameters *parms, void *buffer); -static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer); -static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer); -static herr_t dset_read(int localrank, file_descr *fd, parameters *parms, void *buffer, const char *buffer2); -static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer); -static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags); -hid_t set_vfd(parameters *param); -static herr_t do_fclose(iotype iot, file_descr *fd); -static void do_cleanupfile(iotype iot, char *fname); - -/* global variables */ -static HDoff_t offset[MAX_DIMS]; /* dataset size in bytes */ -static size_t buf_offset[MAX_DIMS]; /* dataset size in bytes */ -static int order[MAX_DIMS]; /* dimension access order */ -static size_t linear_buf_size; /* linear buffer size */ -static int cont_dim; /* lowest dimension for contiguous POSIX - access */ -static size_t cont_size; /* size of contiguous POSIX access */ -static hid_t fapl; /* file access list */ -static unsigned char *buf_p; /* buffer pointer */ -static const char * multi_letters = "msbrglo"; /* string for multi driver */ - -/* HDF5 global variables */ -static hsize_t h5count[MAX_DIMS]; /*selection count */ -static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */ -static hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ -static hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ -static hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ -static hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */ -static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ - -/* - * Function: do_sio - * Purpose: SIO Engine where IO are executed. - * Return: results - * Programmer: Christian Chilan, April, 2008 - * Modifications: - */ -void -do_sio(parameters param, results *res) -{ - char * buffer = NULL; /*data buffer pointer */ - size_t buf_size[MAX_DIMS]; /* general buffer size in bytes */ - file_descr fd; /* file handles */ - iotype iot; /* API type */ - char base_name[256]; /* test file base name */ - /* return codes */ - herr_t ret_code = 0; /*return code */ - - char fname[FILENAME_MAX]; /* test file name */ - int i; - /* HDF5 variables */ - herr_t hrc; /*HDF5 return code */ - - /* Sanity check parameters */ - - /* IO type */ - iot = param.io_type; - - switch (iot) { - case POSIXIO: - fd.posixfd = -1; - res->timers = io_time_new(SYS_CLOCK); - break; - case HDF5: - fd.h5fd = -1; - res->timers = io_time_new(SYS_CLOCK); - break; - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); - GOTOERROR(FAIL); - } - - linear_buf_size = 1; - - for (i = 0; i < param.rank; i++) { - buf_size[i] = param.buf_size[i]; - order[i] = param.order[i]; - linear_buf_size *= buf_size[i]; - buf_offset[i] = 0; - offset[i] = 0; - - /* Validate transfer buffer size */ - if (param.buf_size[i] <= 0) { - HDfprintf(stderr, "Transfer buffer size[%d] (%zu) must be > 0\n", i, buf_size[i]); - GOTOERROR(FAIL); - } - - if ((param.dset_size[i] % param.buf_size[i]) != 0) { - HDfprintf(stderr, - "Dataset size[%d] (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " - "trasfer buffer size[%d] (%zu)\n", - param.rank, (long long)param.dset_size[i], param.rank, param.buf_size[i]); - GOTOERROR(FAIL); - } - } - - /* Allocate transfer buffer */ - if ((buffer = (char *)malloc(linear_buf_size)) == NULL) { - HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", linear_buf_size); - GOTOERROR(FAIL); - } - - if (sio_debug_level >= 4) - - /* output all of the times for all iterations */ - HDfprintf(output, "Timer details:\n"); - - /* - * Write performance measurement - */ - /* Open file for write */ - - HDstrcpy(base_name, "#sio_tmp"); - sio_create_filename(iot, base_name, fname, sizeof(fname), ¶m); - - if (sio_debug_level > 0) - HDfprintf(output, "data filename=%s\n", fname); - - io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); - hrc = do_fopen(¶m, fname, &fd, SIO_CREATE | SIO_WRITE); - VRFY((hrc == SUCCESS), "do_fopen failed"); - - io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); - hrc = do_write(res, &fd, ¶m, buffer); - io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); - VRFY((hrc == SUCCESS), "do_write failed"); - - /* Close file for write */ - hrc = do_fclose(iot, &fd); - io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); - VRFY((hrc == SUCCESS), "do_fclose failed"); - - if (!param.h5_write_only) { - /* - * Read performance measurement - */ - - /* Open file for read */ - io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); - hrc = do_fopen(¶m, fname, &fd, SIO_READ); - VRFY((hrc == SUCCESS), "do_fopen failed"); - - io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); - hrc = do_read(res, &fd, ¶m, buffer); - io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); - VRFY((hrc == SUCCESS), "do_read failed"); - - /* Close file for read */ - hrc = do_fclose(iot, &fd); - - io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); - VRFY((hrc == SUCCESS), "do_fclose failed"); - } - - do_cleanupfile(iot, fname); - -done: - /* clean up */ - /* release HDF5 objects */ - - /* close any opened files */ - /* no remove(fname) because that should have happened normally. */ - switch (iot) { - case POSIXIO: - if (fd.posixfd != -1) - hrc = do_fclose(iot, &fd); - break; - case HDF5: - if (fd.h5fd != -1) - hrc = do_fclose(iot, &fd); - break; - default: - /* unknown request */ - HDassert(0 && "Unknown IO type"); - break; - } - - /* release generic resources */ - if (buffer) - free(buffer); - - res->ret_code = ret_code; -} - -/* - * Function: sio_create_filename - * Purpose: Create a new filename to write to. Determine the correct - * suffix to append to the filename by the type of I/O we're - * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if - * USER or LOGIN are specified in the environment. - * Return: Pointer to filename or NULL - * Programmer: Bill Wendling, 21. November 2001 - * Modifications: Support for file drivers. Christian Chilan, April, 2008 - */ -static char * -sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size, parameters *param) -{ - const char *prefix, *suffix = ""; - char * ptr, last = '\0'; - size_t i, j; - vfdtype vfd; - vfd = param->vfd; - - if (!base_name || !fullname || size < 1) - return NULL; - - memset(fullname, 0, size); - - switch (iot) { - case POSIXIO: - suffix = ".posix"; - break; - case HDF5: - suffix = ".h5"; - if (vfd == family) - suffix = "%05d.h5"; - else if (vfd == multi) - suffix = NULL; - break; - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); - HDassert(0 && "Unknown IO type"); - break; - } - - /* First use the environment variable and then try the constant */ - prefix = HDgetenv("HDF5_PREFIX"); - -#ifdef HDF5_PREFIX - if (!prefix) - prefix = HDF5_PREFIX; -#endif /* HDF5_PREFIX */ - - /* Prepend the prefix value to the base name */ - if (prefix && *prefix) { - /* If the prefix specifies the HDF5_PREFIX directory, then - * default to using the "/tmp/$USER" or "/tmp/$LOGIN" - * directory instead. */ - register char *user, *login, *subdir; - - user = HDgetenv("USER"); - login = HDgetenv("LOGIN"); - subdir = (user ? user : login); - - if (subdir) { - for (i = 0; i < size - 1 && prefix[i]; i++) - fullname[i] = prefix[i]; - - fullname[i++] = '/'; - - for (j = 0; i < size && subdir[j]; i++, j++) - fullname[i] = subdir[j]; - } - else { - /* We didn't append the prefix yet */ - HDstrncpy(fullname, prefix, size); - fullname[size - 1] = '\0'; - } - - if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) { - /* Append the base_name with a slash first. Multiple slashes are - * handled below. */ - h5_stat_t buf; - - if (HDstat(fullname, &buf) < 0) - /* The directory doesn't exist just yet */ - if (HDmkdir(fullname, 0755) < 0 && errno != EEXIST) { - /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory. - * Default to PREFIX's original prefix value. */ - HDstrcpy(fullname, prefix); - } - - HDstrcat(fullname, "/"); - HDstrcat(fullname, base_name); - } - else { - /* Buffer is too small */ - return NULL; - } - } - else if (strlen(base_name) >= size) { - /* Buffer is too small */ - return NULL; - } - else { - HDstrcpy(fullname, base_name); - } - - /* Append a suffix */ - if (suffix) { - if (HDstrlen(fullname) + HDstrlen(suffix) >= size) - return NULL; - - HDstrcat(fullname, suffix); - } - - /* Remove any double slashes in the filename */ - for (ptr = fullname, i = j = 0; ptr && (i < size); i++, ptr++) { - if (*ptr != '/' || last != '/') - fullname[j++] = *ptr; - - last = *ptr; - } - - return fullname; -} - -/* - * Function: do_write - * Purpose: Write the required amount of data to the file. - * Return: SUCCESS or FAIL - * Programmer: Christian Chilan, April, 2008 - * Modifications: - */ -static herr_t -do_write(results *res, file_descr *fd, parameters *parms, void *buffer) -{ - int ret_code = SUCCESS; - char dname[64]; - int i; - size_t u; - /* HDF5 variables */ - herr_t hrc; /*HDF5 return code */ - hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */ - hsize_t h5chunk[MAX_DIMS]; /*dataset dim sizes */ - hsize_t h5block[MAX_DIMS]; /*dataspace selection */ - hsize_t h5stride[MAX_DIMS]; /*selection stride */ - hsize_t h5start[MAX_DIMS]; /*selection start */ - hsize_t h5maxdims[MAX_DIMS]; - int rank; /*rank of dataset */ - - /* Prepare buffer for verifying data */ - /* if (parms->verify) - memset(buffer,1,linear_buf_size); */ - - buf_p = (unsigned char *)buffer; - - for (u = 0; u < linear_buf_size; u++) - buf_p[u] = u % 128; - - rank = parms->rank; - - for (i = 0; i < rank; i++) - h5offset[i] = offset[i] = 0; - - /* I/O Access specific setup */ - switch (parms->io_type) { - case POSIXIO: - - /* determine lowest dimension for contiguous POSIX access */ - cont_dim = rank; - - for (i = rank - 1; i >= 0; i--) { - if (parms->buf_size[i] == parms->dset_size[i]) - cont_dim = i; - else - break; - } - - /* determine size of the contiguous POSIX access */ - cont_size = (!cont_dim) ? 1 : parms->buf_size[cont_dim - 1]; - for (i = cont_dim; i < rank; i++) - cont_size *= parms->buf_size[i]; - - break; - - case HDF5: /* HDF5 setup */ - - for (i = 0; i < rank; i++) { - h5dims[i] = parms->dset_size[i]; - h5start[i] = 0; - h5stride[i] = 1; - h5block[i] = 1; - h5count[i] = parms->buf_size[i]; - h5chunk[i] = parms->chk_size[i]; - h5maxdims[i] = H5S_UNLIMITED; - } - - if (parms->h5_use_chunks && parms->h5_extendable) { - h5dset_space_id = H5Screate_simple(rank, h5count, h5maxdims); - VRFY((h5dset_space_id >= 0), "H5Screate_simple"); - } - else { - h5dset_space_id = H5Screate_simple(rank, h5dims, NULL); - VRFY((h5dset_space_id >= 0), "H5Screate_simple"); - } - - hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, h5block); - VRFY((hrc >= 0), "H5Sselect_hyperslab"); - - /* Create the memory dataspace that corresponds to the xfer buffer */ - h5mem_space_id = H5Screate_simple(rank, h5count, NULL); - VRFY((h5mem_space_id >= 0), "H5Screate_simple"); - - /* Create the dataset transfer property list */ - h5dxpl = H5Pcreate(H5P_DATASET_XFER); - if (h5dxpl < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); - } - - break; - - default: - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); - GOTOERROR(FAIL); - break; - } /* end switch */ - - /* create dataset */ - switch (parms->io_type) { - case POSIXIO: - break; - - case HDF5: - h5dcpl = H5Pcreate(H5P_DATASET_CREATE); - - if (h5dcpl < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); - } - - if (parms->h5_use_chunks) { - /* Set the chunk size to be the same as the buffer size */ - hrc = H5Pset_chunk(h5dcpl, rank, h5chunk); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Property List Set failed\n"); - GOTOERROR(FAIL); - } /* end if */ - } /* end if */ - - HDsprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes); - h5ds_id = - H5Dcreate2(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, H5P_DEFAULT, h5dcpl, H5P_DEFAULT); - - if (h5ds_id < 0) { - HDfprintf(stderr, "HDF5 Dataset Create failed\n"); - GOTOERROR(FAIL); - } - - hrc = H5Pclose(h5dcpl); - /* verifying the close of the dcpl */ - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Property List Close failed\n"); - GOTOERROR(FAIL); - } - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); - GOTOERROR(FAIL); - break; - } - - /* Start "raw data" write timer */ - io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); - - /* Perform write */ - hrc = dset_write(rank - 1, fd, parms, buffer); - - if (hrc < 0) { - HDfprintf(stderr, "Error in dataset write\n"); - GOTOERROR(FAIL); - } - - /* Stop "raw data" write timer */ - io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); - - /* Calculate write time */ - - /* Close dataset. Only HDF5 needs to do an explicit close. */ - if (parms->io_type == HDF5) { - hrc = H5Dclose(h5ds_id); - - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Close failed\n"); - GOTOERROR(FAIL); - } - - h5ds_id = H5I_INVALID_HID; - } /* end if */ - -done: - - /* release HDF5 objects */ - if (h5dset_space_id != -1) { - hrc = H5Sclose(h5dset_space_id); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); - ret_code = FAIL; - } - else { - h5dset_space_id = H5I_INVALID_HID; - } - } - - if (h5mem_space_id != -1) { - hrc = H5Sclose(h5mem_space_id); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); - ret_code = FAIL; - } - else { - h5mem_space_id = H5I_INVALID_HID; - } - } - - if (h5dxpl != -1) { - hrc = H5Pclose(h5dxpl); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); - ret_code = FAIL; - } - else { - h5dxpl = H5I_INVALID_HID; - } - } - - return ret_code; -} - -/* - * Function: dset_write - * Purpose: Write buffer into the dataset. - * Return: SUCCESS or FAIL - * Programmer: Christian Chilan, April, 2008 - * Modifications: - */ -static herr_t -dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) -{ - int cur_dim = order[local_dim] - 1; - int ret_code = SUCCESS; - int k; - hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS]; - hsize_t i; - int j; - herr_t hrc; - - /* iterates according to the dimensions in order array */ - for (i = 0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]) { - - h5offset[cur_dim] = (hssize_t)i; - offset[cur_dim] = (HDoff_t)i; - - if (local_dim > 0) { - - dset_write(local_dim - 1, fd, parms, buffer); - } - else { - - switch (parms->io_type) { - - case POSIXIO: - /* initialize POSIX offset in the buffer */ - for (j = 0; j < parms->rank; j++) - buf_offset[j] = 0; - buf_p = (unsigned char *)buffer; - /* write POSIX buffer */ - posix_buffer_write(0, fd, parms, buffer); - break; - - case HDF5: - /* if dimensions are extendable, extend them as needed during access */ - if (parms->h5_use_chunks && parms->h5_extendable) { - - hrc = H5Sget_simple_extent_dims(h5dset_space_id, dims, maxdims); - VRFY((hrc >= 0), "H5Sget_simple_extent_dims"); - - for (k = 0; k < parms->rank; k++) { - - HDassert(h5offset[k] >= 0); - if (dims[k] <= (hsize_t)h5offset[k]) { - dims[k] = dims[k] + h5count[k]; - hrc = H5Sset_extent_simple(h5dset_space_id, parms->rank, dims, maxdims); - VRFY((hrc >= 0), "H5Sset_extent_simple"); - hrc = H5Dset_extent(h5ds_id, dims); - VRFY((hrc >= 0), "H5Dextend"); - } - } - } - /* applies offset */ - hrc = H5Soffset_simple(h5dset_space_id, h5offset); - VRFY((hrc >= 0), "H5Soffset_simple"); - - /* Write the buffer out */ - hrc = H5Sget_simple_extent_dims(h5dset_space_id, dims, maxdims); - hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); - VRFY((hrc >= 0), "H5Dwrite"); - - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); - HDassert(0 && "Unknown IO type"); - break; - } /* switch (parms->io_type) */ - } - } -done: - return ret_code; -} - -/* - * Function: posix_buffer_write - * Purpose: Write buffer into the POSIX file considering contiguity. - * Return: SUCCESS or FAIL - * Programmer: Christian Chilan, April, 2008 - * Modifications: - */ - -static herr_t -posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) -{ - int ret_code = SUCCESS; - - /* if dimension is not contiguous, call recursively */ - if (local_dim < parms->rank - 1 && local_dim != cont_dim) { - size_t u; - - for (u = 0; u < parms->buf_size[local_dim]; u++) { - buf_offset[local_dim] = u; - posix_buffer_write(local_dim + 1, fd, parms, buffer); - - /* if next dimension is cont_dim, it will fill out the buffer - traversing the entire dimension local_dim without the need - of performing iteration */ - if (local_dim + 1 == cont_dim) - break; - } - /* otherwise, perform contiguous POSIX access */ - } - else { - HDoff_t d_offset; - HDoff_t linear_dset_offset = 0; - int i, j, rc; - - buf_offset[local_dim] = 0; - - /* determine offset in the buffer */ - for (i = 0; i < parms->rank; i++) { - d_offset = 1; - - for (j = i + 1; j < parms->rank; j++) - d_offset *= (HDoff_t)parms->dset_size[j]; - - linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset; - } - - /* only care if seek returns error */ - rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0; - VRFY((rc == 0), "POSIXSEEK"); - /* check if all bytes are written */ - rc = ((ssize_t)cont_size == POSIXWRITE(fd->posixfd, buf_p, cont_size)); - VRFY((rc != 0), "POSIXWRITE"); - - /* Advance location in buffer */ - buf_p += cont_size; - } - -done: - return ret_code; -} - -/* - * Function: do_read - * Purpose: Read the required amount of data to the file. - * Return: SUCCESS or FAIL - * Programmer: Christian Chilan, April, 2008 - * Modifications: - */ -static herr_t -do_read(results *res, file_descr *fd, parameters *parms, void *buffer) -{ - char * buffer2 = NULL; /* Buffer for data verification */ - int ret_code = SUCCESS; - char dname[64]; - int i; - size_t u; - /* HDF5 variables */ - herr_t hrc; /*HDF5 return code */ - hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */ - hsize_t h5block[MAX_DIMS]; /*dataspace selection */ - hsize_t h5stride[MAX_DIMS]; /*selection stride */ - hsize_t h5start[MAX_DIMS]; /*selection start */ - int rank; - - /* Allocate data verification buffer */ - if (NULL == (buffer2 = (char *)malloc(linear_buf_size))) { - HDfprintf(stderr, "malloc for data verification buffer size (%zu) failed\n", linear_buf_size); - GOTOERROR(FAIL); - } /* end if */ - - /* Prepare buffer for verifying data */ - for (u = 0; u < linear_buf_size; u++) - buffer2[u] = (char)(u % 128); - - rank = parms->rank; - for (i = 0; i < rank; i++) - h5offset[i] = offset[i] = 0; - - /* I/O Access specific setup */ - switch (parms->io_type) { - case POSIXIO: - cont_dim = rank; - - for (i = rank - 1; i >= 0; i--) { - if (parms->buf_size[i] == parms->dset_size[i]) - cont_dim = i; - else - break; - } - cont_size = (!cont_dim) ? 1 : parms->buf_size[cont_dim - 1]; - for (i = cont_dim; i < rank; i++) - cont_size *= parms->buf_size[i]; - - break; - - case HDF5: /* HDF5 setup */ - for (i = 0; i < rank; i++) { - h5dims[i] = parms->dset_size[i]; - h5start[i] = 0; - h5stride[i] = 1; - h5block[i] = 1; - h5count[i] = parms->buf_size[i]; - } - - h5dset_space_id = H5Screate_simple(rank, h5dims, NULL); - VRFY((h5dset_space_id >= 0), "H5Screate_simple"); - - hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, h5block); - VRFY((hrc >= 0), "H5Sselect_hyperslab"); - - /* Create the memory dataspace that corresponds to the xfer buffer */ - h5mem_space_id = H5Screate_simple(rank, h5count, NULL); - VRFY((h5mem_space_id >= 0), "H5Screate_simple"); - - /* Create the dataset transfer property list */ - h5dxpl = H5Pcreate(H5P_DATASET_XFER); - if (h5dxpl < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); - } - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); - GOTOERROR(FAIL); - break; - } /* end switch */ - - /* create dataset */ - switch (parms->io_type) { - case POSIXIO: - break; - - case HDF5: - HDsprintf(dname, "Dataset_%ld", (long)parms->num_bytes); - h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT); - if (h5ds_id < 0) { - HDfprintf(stderr, "HDF5 Dataset open failed\n"); - GOTOERROR(FAIL); - } - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); - GOTOERROR(FAIL); - break; - } /* end switch */ - - /* Start "raw data" read timer */ - io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); - hrc = dset_read(rank - 1, fd, parms, buffer, buffer2); - - if (hrc < 0) { - HDfprintf(stderr, "Error in dataset read\n"); - GOTOERROR(FAIL); - } - - /* Stop "raw data" read timer */ - io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); - - /* Calculate read time */ - - /* Close dataset. Only HDF5 needs to do an explicit close. */ - if (parms->io_type == HDF5) { - hrc = H5Dclose(h5ds_id); - - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Close failed\n"); - GOTOERROR(FAIL); - } - - h5ds_id = H5I_INVALID_HID; - } /* end if */ - -done: - - /* release HDF5 objects */ - if (h5dset_space_id != -1) { - hrc = H5Sclose(h5dset_space_id); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); - ret_code = FAIL; - } - else { - h5dset_space_id = H5I_INVALID_HID; - } - } - - if (h5mem_space_id != -1) { - hrc = H5Sclose(h5mem_space_id); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); - ret_code = FAIL; - } - else { - h5mem_space_id = H5I_INVALID_HID; - } - } - - if (h5dxpl != -1) { - hrc = H5Pclose(h5dxpl); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); - ret_code = FAIL; - } - else { - h5dxpl = H5I_INVALID_HID; - } - } - - /* release generic resources */ - if (buffer2) - free(buffer2); - - return ret_code; -} - -/* - * Function: dset_read - * Purpose: Read buffer into the dataset. - * Return: SUCCESS or FAIL - * Programmer: Christian Chilan, April, 2008 - * Modifications: - */ - -static herr_t -dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer, const char *buffer2) -{ - int cur_dim = order[local_dim] - 1; - hsize_t i; - int j; - herr_t hrc; - int ret_code = SUCCESS; - - /* iterate on the current dimension */ - for (i = 0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]) { - - h5offset[cur_dim] = (hssize_t)i; - offset[cur_dim] = (HDoff_t)i; - - /* if traverse in order array is incomplete, recurse */ - if (local_dim > 0) { - - ret_code = dset_read(local_dim - 1, fd, parms, buffer, buffer2); - - /* otherwise, write buffer into dataset */ - } - else { - - switch (parms->io_type) { - - case POSIXIO: - for (j = 0; j < parms->rank; j++) { - buf_offset[j] = 0; - } - buf_p = (unsigned char *)buffer; - posix_buffer_read(0, fd, parms, buffer); - break; - - case HDF5: - hrc = H5Soffset_simple(h5dset_space_id, h5offset); - VRFY((hrc >= 0), "H5Soffset_simple"); - /* Read the buffer out */ - hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); - VRFY((hrc >= 0), "H5Dread"); - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); - HDassert(0 && "Unknown IO type"); - break; - } /* switch (parms->io_type) */ - } - } -done: - return ret_code; -} - -/* - * Function: posix_buffer_read - * Purpose: Read buffer into the POSIX file considering contiguity. - * Return: SUCCESS or FAIL - * Programmer: Christian Chilan, April, 2008 - * Modifications: - */ - -static herr_t -posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer) -{ - int ret_code = SUCCESS; - - /* if local dimension is not contiguous, recurse */ - if (local_dim < parms->rank - 1 && local_dim != cont_dim) { - size_t u; - - for (u = 0; u < parms->buf_size[local_dim]; u++) { - buf_offset[local_dim] = u; - ret_code = posix_buffer_read(local_dim + 1, fd, parms, buffer); - if (local_dim + 1 == cont_dim) - break; - } - /* otherwise, perform contiguous POSIX access */ - } - else { - HDoff_t d_offset; - HDoff_t linear_dset_offset = 0; - int i, j, rc; - - buf_offset[local_dim] = 0; - /* determine offset in buffer */ - for (i = 0; i < parms->rank; i++) { - d_offset = 1; - - for (j = i + 1; j < parms->rank; j++) - d_offset *= (HDoff_t)parms->dset_size[j]; - - linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset; - } - - /* only care if seek returns error */ - rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0; - VRFY((rc == 0), "POSIXSEEK"); - /* check if all bytes are read */ - rc = ((ssize_t)cont_size == POSIXREAD(fd->posixfd, buf_p, cont_size)); - VRFY((rc != 0), "POSIXREAD"); - - /* Advance location in buffer */ - buf_p += cont_size; - } -done: - return ret_code; -} - -/* - * Function: do_fopen - * Purpose: Open the specified file. - * Return: SUCCESS or FAIL - * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 - * Modifications: Support for file drivers, Christian Chilan, April, 2008 - */ -static herr_t -do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) -{ - int ret_code = SUCCESS; - hid_t fcpl; - - switch (param->io_type) { - case POSIXIO: - if (flags & (SIO_CREATE | SIO_WRITE)) - fd->posixfd = POSIXCREATE(fname); - else - fd->posixfd = POSIXOPEN(fname, O_RDONLY); - - if (fd->posixfd < 0) { - HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname); - GOTOERROR(FAIL); - } - - break; - - case HDF5: - - fapl = set_vfd(param); - - if (fapl < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); - } - - fcpl = H5Pcreate(H5P_FILE_CREATE); - if (param->page_size) { - H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1); - H5Pset_file_space_page_size(fcpl, param->page_size); - if (param->page_buffer_size) - H5Pset_page_buffer_size(fapl, param->page_buffer_size, 0, 0); - } - - /* create the parallel file */ - if (flags & (SIO_CREATE | SIO_WRITE)) { - fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl); - } - else { - fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, fapl); - } - - if (fd->h5fd < 0) { - HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname); - GOTOERROR(FAIL); - } - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type); - GOTOERROR(FAIL); - break; - } - -done: - return ret_code; -} - -/* - * Function: set_vfd - * Purpose: Sets file driver. - * Return: SUCCESS or FAIL - * Programmer: Christian Chilan, April, 2008 - * Modifications: - */ - -hid_t -set_vfd(parameters *param) -{ - hid_t my_fapl = H5I_INVALID_HID; - vfdtype vfd; - - vfd = param->vfd; - - if ((my_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - return -1; - - if (vfd == sec2) { - /* Unix read() and write() system calls */ - if (H5Pset_fapl_sec2(my_fapl) < 0) - return -1; - } - else if (vfd == stdio) { - /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(my_fapl) < 0) - return -1; - } - else if (vfd == core) { - /* In-core temporary file with 1MB increment */ - if (H5Pset_fapl_core(my_fapl, (size_t)1024 * 1024, TRUE) < 0) - return -1; - } - else if (vfd == split) { - /* Split meta data and raw data each using default driver */ - if (H5Pset_fapl_split(my_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) - return -1; - } - else if (vfd == multi) { - /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - H5FD_mem_t mt; - - HDmemset(memb_map, 0, sizeof memb_map); - HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset(memb_name, 0, sizeof memb_name); - HDmemset(memb_addr, 0, sizeof memb_addr); - - HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - memb_fapl[mt] = H5P_DEFAULT; - HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); - memb_name[mt] = sv[mt]; - memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); - } - - if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) { - return -1; - } - } - else if (vfd == family) { - hsize_t fam_size = 1 * 1024 * 1024; /*100 MB*/ - - /* Family of files, each 1MB and using the default driver */ - /* if ((val=HDstrtok(NULL, " \t\n\r"))) - fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); */ - if (H5Pset_fapl_family(my_fapl, fam_size, H5P_DEFAULT) < 0) - return -1; - } - else if (vfd == direct) { -#ifdef H5_HAVE_DIRECT - /* Linux direct read() and write() system calls. Set memory boundary, file block size, - * and copy buffer size to the default values. */ - if (H5Pset_fapl_direct(my_fapl, 1024, 4096, 8 * 4096) < 0) - return -1; -#endif - } - else { - /* Unknown driver */ - return -1; - } - - return my_fapl; -} - -/* - * Function: do_fclose - * Purpose: Close the specified file descriptor. - * Return: SUCCESS or FAIL - * Programmer: Albert Cheng, Bill Wendling, 2001/12/13 - * Modifications: - */ -static herr_t -do_fclose(iotype iot, file_descr *fd /*out*/) -{ - herr_t ret_code = SUCCESS, hrc; - int rc = 0; - - switch (iot) { - case POSIXIO: - rc = POSIXCLOSE(fd->posixfd); - - if (rc != 0) { - HDfprintf(stderr, "POSIX File Close failed\n"); - GOTOERROR(FAIL); - } - - fd->posixfd = -1; - break; - - case HDF5: - hrc = H5Fclose(fd->h5fd); - - if (hrc < 0) { - HDfprintf(stderr, "HDF5 File Close failed\n"); - GOTOERROR(FAIL); - } - - fd->h5fd = -1; - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); - GOTOERROR(FAIL); - break; - } - -done: - return ret_code; -} - -/* - * Function: do_cleanupfile - * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set. - * Return: void - * Programmer: Albert Cheng 2001/12/12 - * Modifications: Support for file drivers. Christian Chilan, April, 2008 - */ -static void -do_cleanupfile(iotype iot, char *filename) -{ - char temp[2048]; - int j; - hid_t driver; - - if (clean_file_g == -1) - clean_file_g = (HDgetenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0; - - if (clean_file_g) { - - switch (iot) { - case POSIXIO: - HDremove(filename); - break; - - case HDF5: - driver = H5Pget_driver(fapl); - - if (driver == H5FD_FAMILY) { - for (j = 0; /*void*/; j++) { - HDsnprintf(temp, sizeof temp, filename, j); - - if (HDaccess(temp, F_OK) < 0) - break; - - HDremove(temp); - } - } - else if (driver == H5FD_CORE) { - hbool_t backing; /* Whether the core file has backing store */ - - H5Pget_fapl_core(fapl, NULL, &backing); - - /* If the file was stored to disk with bacing store, remove it */ - if (backing) - HDremove(filename); - } - else if (driver == H5FD_MULTI) { - H5FD_mem_t mt; - assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); - HDremove(temp); /*don't care if it fails*/ - } - } - else { - HDremove(filename); - } - H5Pclose(fapl); - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); - HDassert(0 && "Unknown IO type"); - break; - } - } -} diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c deleted file mode 100644 index 51a7825..0000000 --- a/tools/test/perform/sio_perf.c +++ /dev/null @@ -1,1437 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Serial HDF5 Performance Testing Code - * -------------------------------------- - * - * Portable code to test performance on the different platforms we support. - * This is what the report should look like: - * - * nprocs = Max#Procs - * IO API = POSIXIO - * # Files = 1, # of dsets = 1000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * # Files = 1, # of dsets = 3000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * - * . . . - * - * - * IO API = HDF5 - * # Files = 1, # of dsets = 1000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * # Files = 1, # of dsets = 3000, Elements per dset = 37000 - * Write Results = x MB/s - * Read Results = x MB/s - * - * . . . - * - * - * . . . - * - */ - -/* system header files */ -#include -#include -#include - -#include "hdf5.h" - -/* our header files */ -#include "sio_perf.h" - -/* useful macros */ -#define TAB_SPACE 4 - -#define ONE_KB 1024 -#define ONE_MB (ONE_KB * ONE_KB) -#define ONE_GB (ONE_MB * ONE_KB) - -#define SIO_POSIX 0x1 -#define SIO_HDF5 0x4 - -/* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL(t, 0.0) ? 0.0 : ((((double)bytes) / (double)ONE_MB) / (t))) - -#ifndef TRUE -#define TRUE 1 -#endif /* TRUE */ -#ifndef FALSE -#define FALSE (!TRUE) -#endif /* FALSE */ - -/* global variables */ -FILE *output; /* output file */ -int sio_debug_level = 0; /* The debug level: - * 0 - Off - * 1 - Minimal - * 2 - Some more - * 3 - Maximal - * 4 - Maximal & then some - */ - -/* local variables */ -static const char *progname = "h5perf_serial"; - -/* - * Command-line options: The user can specify short or long-named - * parameters. The long-named ones can be partially spelled. When - * adding more, make sure that they don't clash with each other. - */ - -/* - * It seems that only the options that accept additional information - * such as dataset size (-e) require the colon next to it. - */ -static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; -static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, - {"alig", require_arg, 'a'}, - {"ali", require_arg, 'a'}, - {"al", require_arg, 'a'}, - {"api", require_arg, 'A'}, - {"ap", require_arg, 'A'}, -#if 0 - /* a sighting of the elusive binary option */ - { "binary", no_arg, 'b' }, - { "binar", no_arg, 'b' }, - { "bina", no_arg, 'b' }, - { "bin", no_arg, 'b' }, - { "bi", no_arg, 'b' }, -#endif /* 0 */ - {"block-size", require_arg, 'B'}, - {"block-siz", require_arg, 'B'}, - {"block-si", require_arg, 'B'}, - {"block-s", require_arg, 'B'}, - {"block-", require_arg, 'B'}, - {"block", require_arg, 'B'}, - {"bloc", require_arg, 'B'}, - {"blo", require_arg, 'B'}, - {"bl", require_arg, 'B'}, - {"chunk", no_arg, 'c'}, - {"chun", no_arg, 'c'}, - {"chu", no_arg, 'c'}, - {"ch", no_arg, 'c'}, - {"collective", no_arg, 'C'}, - {"collectiv", no_arg, 'C'}, - {"collecti", no_arg, 'C'}, - {"collect", no_arg, 'C'}, - {"collec", no_arg, 'C'}, - {"colle", no_arg, 'C'}, - {"coll", no_arg, 'C'}, - {"col", no_arg, 'C'}, - {"co", no_arg, 'C'}, - {"debug", require_arg, 'D'}, - {"debu", require_arg, 'D'}, - {"deb", require_arg, 'D'}, - {"de", require_arg, 'D'}, - {"file-driver", require_arg, 'v'}, - {"file-drive", require_arg, 'v'}, - {"file-driv", require_arg, 'v'}, - {"file-dri", require_arg, 'v'}, - {"file-dr", require_arg, 'v'}, - {"file-d", require_arg, 'v'}, - {"file-", require_arg, 'v'}, - {"file", require_arg, 'v'}, - {"fil", require_arg, 'v'}, - {"fi", require_arg, 'v'}, - {"geometry", no_arg, 'g'}, - {"geometr", no_arg, 'g'}, - {"geomet", no_arg, 'g'}, - {"geome", no_arg, 'g'}, - {"geom", no_arg, 'g'}, - {"geo", no_arg, 'g'}, - {"ge", no_arg, 'g'}, - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"interleaved", require_arg, 'I'}, - {"interleave", require_arg, 'I'}, - {"interleav", require_arg, 'I'}, - {"interlea", require_arg, 'I'}, - {"interle", require_arg, 'I'}, - {"interl", require_arg, 'I'}, - {"inter", require_arg, 'I'}, - {"inte", require_arg, 'I'}, - {"int", require_arg, 'I'}, - {"in", require_arg, 'I'}, - {"max-num-processes", require_arg, 'P'}, - {"max-num-processe", require_arg, 'P'}, - {"max-num-process", require_arg, 'P'}, - {"max-num-proces", require_arg, 'P'}, - {"max-num-proce", require_arg, 'P'}, - {"max-num-proc", require_arg, 'P'}, - {"max-num-pro", require_arg, 'P'}, - {"max-num-pr", require_arg, 'P'}, - {"max-num-p", require_arg, 'P'}, - {"min-num-processes", require_arg, 'p'}, - {"min-num-processe", require_arg, 'p'}, - {"min-num-process", require_arg, 'p'}, - {"min-num-proces", require_arg, 'p'}, - {"min-num-proce", require_arg, 'p'}, - {"min-num-proc", require_arg, 'p'}, - {"min-num-pro", require_arg, 'p'}, - {"min-num-pr", require_arg, 'p'}, - {"min-num-p", require_arg, 'p'}, - {"max-xfer-size", require_arg, 'X'}, - {"max-xfer-siz", require_arg, 'X'}, - {"max-xfer-si", require_arg, 'X'}, - {"max-xfer-s", require_arg, 'X'}, - {"max-xfer", require_arg, 'X'}, - {"max-xfe", require_arg, 'X'}, - {"max-xf", require_arg, 'X'}, - {"max-x", require_arg, 'X'}, - {"min-xfer-size", require_arg, 'x'}, - {"min-xfer-siz", require_arg, 'x'}, - {"min-xfer-si", require_arg, 'x'}, - {"min-xfer-s", require_arg, 'x'}, - {"min-xfer", require_arg, 'x'}, - {"min-xfe", require_arg, 'x'}, - {"min-xf", require_arg, 'x'}, - {"min-x", require_arg, 'x'}, - {"num-bytes", require_arg, 'e'}, - {"num-byte", require_arg, 'e'}, - {"num-byt", require_arg, 'e'}, - {"num-by", require_arg, 'e'}, - {"num-b", require_arg, 'e'}, - {"num-dsets", require_arg, 'd'}, - {"num-dset", require_arg, 'd'}, - {"num-dse", require_arg, 'd'}, - {"num-ds", require_arg, 'd'}, - {"num-d", require_arg, 'd'}, - {"num-files", require_arg, 'F'}, - {"num-file", require_arg, 'F'}, - {"num-fil", require_arg, 'F'}, - {"num-fi", require_arg, 'F'}, - {"num-f", require_arg, 'F'}, - {"num-iterations", require_arg, 'i'}, - {"num-iteration", require_arg, 'i'}, - {"num-iteratio", require_arg, 'i'}, - {"num-iterati", require_arg, 'i'}, - {"num-iterat", require_arg, 'i'}, - {"num-itera", require_arg, 'i'}, - {"num-iter", require_arg, 'i'}, - {"num-ite", require_arg, 'i'}, - {"num-it", require_arg, 'i'}, - {"num-i", require_arg, 'i'}, - {"order", require_arg, 'r'}, - {"orde", require_arg, 'r'}, - {"ord", require_arg, 'r'}, - {"or", require_arg, 'r'}, - {"output", require_arg, 'o'}, - {"outpu", require_arg, 'o'}, - {"outp", require_arg, 'o'}, - {"out", require_arg, 'o'}, - {"ou", require_arg, 'o'}, - {"extendable", no_arg, 't'}, - {"extendabl", no_arg, 't'}, - {"extendab", no_arg, 't'}, - {"extenda", no_arg, 't'}, - {"extend", no_arg, 't'}, - {"exten", no_arg, 't'}, - {"exte", no_arg, 't'}, - {"ext", no_arg, 't'}, - {"ex", no_arg, 't'}, - {"threshold", require_arg, 'T'}, - {"threshol", require_arg, 'T'}, - {"thresho", require_arg, 'T'}, - {"thresh", require_arg, 'T'}, - {"thres", require_arg, 'T'}, - {"thre", require_arg, 'T'}, - {"thr", require_arg, 'T'}, - {"th", require_arg, 'T'}, - {"write-only", require_arg, 'w'}, - {"write-onl", require_arg, 'w'}, - {"write-on", require_arg, 'w'}, - {"write-o", require_arg, 'w'}, - {"write", require_arg, 'w'}, - {"writ", require_arg, 'w'}, - {"wri", require_arg, 'w'}, - {"wr", require_arg, 'w'}, - {NULL, 0, '\0'}}; - -struct options { - long io_types; /* bitmask of which I/O types to test */ - const char *output_file; /* file to print report to */ - long num_dsets; /* number of datasets */ - long num_files; /* number of files */ - off_t num_bpp; /* number of bytes per proc per dset */ - int num_iters; /* number of iterations */ - hsize_t dset_size[MAX_DIMS]; /* Dataset size */ - size_t buf_size[MAX_DIMS]; /* Buffer size */ - size_t chk_size[MAX_DIMS]; /* Chunk size */ - int order[MAX_DIMS]; /* Dimension access order */ - int dset_rank; /* Rank */ - int buf_rank; /* Rank */ - int order_rank; /* Rank */ - int chk_rank; /* Rank */ - int print_times; /* print times as well as throughputs */ - int print_raw; /* print raw data throughput info */ - hsize_t h5_alignment; /* alignment in HDF5 file */ - hsize_t h5_threshold; /* threshold for alignment in HDF5 file */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ - int h5_extendable; /* Perform the write tests only */ - int verify; /* Verify data correctness */ - vfdtype vfd; /* File driver */ - size_t page_buffer_size; - size_t page_size; -}; - -typedef struct { - double min; - double max; - double sum; - int num; -} minmax; - -/* local functions */ -static hsize_t parse_size_directive(const char *size); -static struct options *parse_command_line(int argc, const char *argv[]); -static void run_test_loop(struct options *options); -static int run_test(iotype iot, parameters parms, struct options *opts); -static void output_all_info(minmax *mm, int count, int indent_level); -static void get_minmax(minmax *mm, double val); -static void accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm); -static void output_results(const struct options *options, const char *name, minmax *table, int table_size, - off_t data_size); -static void output_report(const char *fmt, ...); -static void print_indent(register int indent); -static void usage(const char *prog); -static void report_parameters(struct options *opts); - -/* - * Function: main - * Purpose: Start things up. - * Return: EXIT_SUCCESS or EXIT_FAILURE - * Programmer: Bill Wendling, 30. October 2001 - * Modifications: - */ -int -main(int argc, const char *argv[]) -{ - int exit_value = EXIT_SUCCESS; - struct options *opts = NULL; - -#ifndef STANDALONE - /* Initialize h5tools lib */ - h5tools_init(); -#endif - - output = stdout; - - opts = parse_command_line(argc, argv); - - if (!opts) { - exit_value = EXIT_FAILURE; - goto finish; - } - - if (opts->output_file) { - if ((output = HDfopen(opts->output_file, "w")) == NULL) { - HDfprintf(stderr, "%s: cannot open output file\n", progname); - HDperror(opts->output_file); - goto finish; - } - } - - report_parameters(opts); - - run_test_loop(opts); - -finish: - HDfree(opts); - return exit_value; -} - -/* - * Function: run_test_loop - * Purpose: Run the I/O tests. Write the results to OUTPUT. - * - * - The slowest changing part of the test is the number of - * processors to use. For each loop iteration, we divide that - * number by 2 and rerun the test. - * - * - The second slowest is what type of IO API to perform. We have - * three choices: POSIXIO, and HDF5. - * - * - Then we change the size of the buffer. This information is - * inferred from the number of datasets to create and the number - * of integers to put into each dataset. The backend code figures - * this out. - * - * Return: Nothing - * Programmer: Bill Wendling, 30. October 2001 - * Modifications: - * Added multidimensional testing (Christian Chilan, April, 2008) - */ -static void -run_test_loop(struct options *opts) -{ - parameters parms; - int i; - size_t buf_bytes; - - /* load options into parameter structure */ - parms.num_files = opts->num_files; - parms.num_dsets = opts->num_dsets; - parms.num_iters = opts->num_iters; - parms.rank = opts->dset_rank; - parms.h5_align = opts->h5_alignment; - parms.h5_thresh = opts->h5_threshold; - parms.h5_use_chunks = opts->h5_use_chunks; - parms.h5_extendable = opts->h5_extendable; - parms.h5_write_only = opts->h5_write_only; - parms.verify = opts->verify; - parms.vfd = opts->vfd; - parms.page_buffer_size = opts->page_buffer_size; - parms.page_size = opts->page_size; - - /* load multidimensional options */ - parms.num_bytes = 1; - buf_bytes = 1; - for (i = 0; i < parms.rank; i++) { - parms.buf_size[i] = opts->buf_size[i]; - parms.dset_size[i] = opts->dset_size[i]; - parms.chk_size[i] = opts->chk_size[i]; - parms.order[i] = opts->order[i]; - parms.num_bytes *= opts->dset_size[i]; - buf_bytes *= opts->buf_size[i]; - } - - /* print size information */ - output_report("Transfer Buffer Size (bytes): %d\n", buf_bytes); - output_report("File Size(MB): %.2f\n", ((double)parms.num_bytes) / ONE_MB); - - print_indent(0); - if (opts->io_types & SIO_POSIX) - run_test(POSIXIO, parms, opts); - - print_indent(0); - if (opts->io_types & SIO_HDF5) - run_test(HDF5, parms, opts); -} - -/* - * Function: run_test - * Purpose: Inner loop call to actually run the I/O test. - * Return: Nothing - * Programmer: Bill Wendling, 18. December 2001 - * Modifications: - */ -static int -run_test(iotype iot, parameters parms, struct options *opts) -{ - results res; - register int i, ret_value = SUCCESS; - off_t raw_size; - minmax * write_sys_mm_table = NULL; - minmax * write_mm_table = NULL; - minmax * write_gross_mm_table = NULL; - minmax * write_raw_mm_table = NULL; - minmax * read_sys_mm_table = NULL; - minmax * read_mm_table = NULL; - minmax * read_gross_mm_table = NULL; - minmax * read_raw_mm_table = NULL; - minmax write_sys_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax write_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax write_gross_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax write_raw_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax read_sys_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax read_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax read_gross_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax read_raw_mm = {0.0F, 0.0F, 0.0F, 0}; - - raw_size = (off_t)parms.num_bytes; - parms.io_type = iot; - print_indent(2); - output_report("IO API = "); - - switch (iot) { - case POSIXIO: - output_report("POSIX\n"); - break; - case HDF5: - output_report("HDF5\n"); - break; - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); - HDassert(0 && "Unknown IO tpe"); - break; - } - - /* allocate space for tables minmax and that it is sufficient */ - /* to initialize all elements to zeros by calloc. */ - write_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); - write_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); - write_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); - write_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); - - if (!parms.h5_write_only) { - read_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); - read_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); - read_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); - read_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax)); - } - - /* Do IO iteration times, collecting statistics each time */ - for (i = 0; i < parms.num_iters; ++i) { - double t; - - do_sio(parms, &res); - - /* gather all of the "sys write" times */ - t = io_time_get(res.timers, HDF5_MPI_WRITE); - get_minmax(&write_sys_mm, t); - - write_sys_mm_table[i] = write_sys_mm; - - /* gather all of the "write" times */ - t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); - get_minmax(&write_mm, t); - - write_mm_table[i] = write_mm; - - /* gather all of the "write" times from open to close */ - t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); - get_minmax(&write_gross_mm, t); - - write_gross_mm_table[i] = write_gross_mm; - - /* gather all of the raw "write" times */ - t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); - get_minmax(&write_raw_mm, t); - - write_raw_mm_table[i] = write_raw_mm; - - if (!parms.h5_write_only) { - /* gather all of the "mpi read" times */ - t = io_time_get(res.timers, HDF5_MPI_READ); - get_minmax(&read_sys_mm, t); - - read_sys_mm_table[i] = read_sys_mm; - - /* gather all of the "read" times */ - t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS); - get_minmax(&read_mm, t); - - read_mm_table[i] = read_mm; - - /* gather all of the "read" times from open to close */ - t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS); - get_minmax(&read_gross_mm, t); - - read_gross_mm_table[i] = read_gross_mm; - - /* gather all of the raw "read" times */ - t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS); - get_minmax(&read_raw_mm, t); - - read_raw_mm_table[i] = read_gross_mm; - } - io_time_destroy(res.timers); - } - - /* - * Show various statistics - */ - /* Write statistics */ - /* Print the raw data throughput if desired */ - if (opts->print_raw) { - /* accumulate and output the max, min, and average "raw write" times */ - if (sio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Raw Data Write details:\n"); - output_all_info(write_raw_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size); - } /* end if */ - - /* show sys write statics */ -#if 0 - if (sio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("MPI Write details:\n"); - output_all_info(write_sys_mm_table, parms.num_iters, 4); - } -#endif - /* We don't currently output the MPI write results */ - - /* accumulate and output the max, min, and average "write" times */ - if (sio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Write details:\n"); - output_all_info(write_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Write", write_mm_table, parms.num_iters, raw_size); - - /* accumulate and output the max, min, and average "gross write" times */ - if (sio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Write Open-Close details:\n"); - output_all_info(write_gross_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Write Open-Close", write_gross_mm_table, parms.num_iters, raw_size); - - if (!parms.h5_write_only) { - /* Read statistics */ - /* Print the raw data throughput if desired */ - if (opts->print_raw) { - /* accumulate and output the max, min, and average "raw read" times */ - if (sio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Raw Data Read details:\n"); - output_all_info(read_raw_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size); - } /* end if */ - - /* show mpi read statics */ -#if 0 - if (sio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("MPI Read details:\n"); - output_all_info(read_sys_mm_table, parms.num_iters, 4); - } -#endif - /* We don't currently output the MPI read results */ - - /* accumulate and output the max, min, and average "read" times */ - if (sio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Read details:\n"); - output_all_info(read_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Read", read_mm_table, parms.num_iters, raw_size); - - /* accumulate and output the max, min, and average "gross read" times */ - if (sio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Read Open-Close details:\n"); - output_all_info(read_gross_mm_table, parms.num_iters, 4); - } - - output_results(opts, "Read Open-Close", read_gross_mm_table, parms.num_iters, raw_size); - } - - /* clean up our mess */ - HDfree(write_sys_mm_table); - HDfree(write_mm_table); - HDfree(write_gross_mm_table); - HDfree(write_raw_mm_table); - - if (!parms.h5_write_only) { - HDfree(read_sys_mm_table); - HDfree(read_mm_table); - HDfree(read_gross_mm_table); - HDfree(read_raw_mm_table); - } - - return ret_value; -} - -/* - * Function: output_all_info - * Purpose: - * Return: Nothing - * Programmer: Bill Wendling, 29. January 2002 - * Modifications: - */ -static void -output_all_info(minmax *mm, int count, int indent_level) -{ - int i; - - for (i = 0; i < count; ++i) { - print_indent(indent_level); - output_report("Iteration %d:\n", i + 1); - print_indent(indent_level + 1); - output_report("Minimum Time: %.2fs\n", mm[i].min); - print_indent(indent_level + 1); - output_report("Maximum Time: %.2fs\n", mm[i].max); - } -} - -/* - * Function: get_minmax - * Purpose: Gather all the min, max and total of val. - * Return: Nothing - * Programmer: Bill Wendling, 21. December 2001 - * Modifications: - * Use MPI_Allreduce to do it. -akc, 2002/01/11 - */ - -static void -get_minmax(minmax *mm, double val) -{ - mm->max = val; - mm->min = val; - mm->sum = val; -} - -/* - * Function: accumulate_minmax_stuff - * Purpose: Accumulate the minimum, maximum, and average of the times - * across all processes. - * Return: TOTAL_MM - the total of all of these. - * Programmer: Bill Wendling, 21. December 2001 - * Modifications: - * Changed to use seconds instead of MB/s - QAK, 5/9/02 - */ -static void -accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm) -{ - int i; - - total_mm->sum = 0.0F; - total_mm->max = -DBL_MAX; - total_mm->min = DBL_MAX; - total_mm->num = count; - - for (i = 0; i < count; ++i) { - double m = mm[i].max; - - total_mm->sum += m; - - if (m < total_mm->min) - total_mm->min = m; - - if (m > total_mm->max) - total_mm->max = m; - } -} - -/* - * Function: output_results - * Purpose: Print information about the time & bandwidth for a given - * minmax & # of iterations. - * Return: Nothing - * Programmer: Quincey Koziol, 9. May 2002 - * Modifications: - */ -static void -output_results(const struct options *opts, const char *name, minmax *table, int table_size, off_t data_size) -{ - minmax total_mm; - - accumulate_minmax_stuff(table, table_size, &total_mm); - - print_indent(3); - output_report("%s (%d iteration(s)):\n", name, table_size); - - /* Note: The maximum throughput uses the minimum amount of time & vice versa */ - - print_indent(4); - output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.min)); - if (opts->print_times) - output_report(" (%7.3f s)\n", total_mm.min); - else - output_report("\n"); - - print_indent(4); - output_report("Average Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.sum / total_mm.num)); - if (opts->print_times) - output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num)); - else - output_report("\n"); - - print_indent(4); - output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.max)); - if (opts->print_times) - output_report(" (%7.3f s)\n", total_mm.max); - else - output_report("\n"); -} - -/* - * Function: output_report - * Purpose: Print a line of the report. Only do so if I'm the 0 process. - * Return: Nothing - * Programmer: Bill Wendling, 19. December 2001 - * Modifications: - */ -static void -output_report(const char *fmt, ...) -{ - va_list ap; - - HDva_start(ap, fmt); - HDvfprintf(output, fmt, ap); - HDva_end(ap); -} - -/* - * Function: print_indent - * Purpose: Print spaces to indent a new line of text for pretty printing - * things. - * Return: Nothing - * Programmer: Bill Wendling, 29. October 2001 - * Modifications: - */ -static void -print_indent(register int indent) -{ - indent *= TAB_SPACE; - - for (; indent > 0; --indent) - HDfputc(' ', output); -} - -static void -recover_size_and_print(long long val, const char *end) -{ - if (val >= ONE_KB && (val % ONE_KB) == 0) { - if (val >= ONE_MB && (val % ONE_MB) == 0) { - if (val >= ONE_GB && (val % ONE_GB) == 0) - HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" - "GB%s", - val / ONE_GB, end); - else - HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" - "MB%s", - val / ONE_MB, end); - } - else { - HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" - "KB%s", - val / ONE_KB, end); - } - } - else { - HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" - "%s", - val, end); - } -} - -static void -print_io_api(long io_types) -{ - if (io_types & SIO_POSIX) - HDfprintf(output, "posix "); - if (io_types & SIO_HDF5) - HDfprintf(output, "hdf5 "); - HDfprintf(output, "\n"); -} - -static void -report_parameters(struct options *opts) -{ - int i, rank; - rank = opts->dset_rank; - - print_version("HDF5 Library"); /* print library version */ - HDfprintf(output, "==== Parameters ====\n"); - - HDfprintf(output, "IO API="); - print_io_api(opts->io_types); - - HDfprintf(output, "Number of iterations=%d\n", opts->num_iters); - - HDfprintf(output, "Dataset size="); - - for (i = 0; i < rank; i++) - recover_size_and_print((long long)opts->dset_size[i], " "); - HDfprintf(output, "\n"); - - HDfprintf(output, "Transfer buffer size="); - for (i = 0; i < rank; i++) - recover_size_and_print((long long)opts->buf_size[i], " "); - HDfprintf(output, "\n"); - - if (opts->page_size) { - HDfprintf(output, "Page Aggregation Enabled. Page size = %zu\n", opts->page_size); - if (opts->page_buffer_size) - HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %zu\n", opts->page_buffer_size); - else - HDfprintf(output, "Page Buffering Disabled\n"); - } - else - HDfprintf(output, "Page Aggregation Disabled\n"); - - HDfprintf(output, "Dimension access order="); - for (i = 0; i < rank; i++) - recover_size_and_print((long long)opts->order[i], " "); - HDfprintf(output, "\n"); - - if (opts->io_types & SIO_HDF5) { - - HDfprintf(output, "HDF5 data storage method="); - - if (opts->h5_use_chunks) { - - HDfprintf(output, "Chunked\n"); - HDfprintf(output, "HDF5 chunk size="); - for (i = 0; i < rank; i++) - recover_size_and_print((long long)opts->chk_size[i], " "); - HDfprintf(output, "\n"); - - HDfprintf(output, "HDF5 dataset dimensions="); - if (opts->h5_extendable) { - HDfprintf(output, "Extendable\n"); - } - else { - HDfprintf(output, "Fixed\n"); - } - } - else { - HDfprintf(output, "Contiguous\n"); - } - - HDfprintf(output, "HDF5 file driver="); - if (opts->vfd == sec2) { - HDfprintf(output, "sec2\n"); - } - else if (opts->vfd == stdio) { - HDfprintf(output, "stdio\n"); - } - else if (opts->vfd == core) { - HDfprintf(output, "core\n"); - } - else if (opts->vfd == split) { - HDfprintf(output, "split\n"); - } - else if (opts->vfd == multi) { - HDfprintf(output, "multi\n"); - } - else if (opts->vfd == family) { - HDfprintf(output, "family\n"); - } - else if (opts->vfd == direct) { - HDfprintf(output, "direct\n"); - } - } - - { - char *prefix = HDgetenv("HDF5_PREFIX"); - - HDfprintf(output, "Env HDF5_PREFIX=%s\n", (prefix ? prefix : "not set")); - } - - HDfprintf(output, "==== End of Parameters ====\n"); - HDfprintf(output, "\n"); -} - -/* - * Function: parse_command_line - * Purpose: Parse the command line options and return a STRUCT OPTIONS - * structure which will need to be freed by the calling function. - * Return: Pointer to an OPTIONS structure - * Programmer: Bill Wendling, 31. October 2001 - * Modifications: - * Added multidimensional testing (Christian Chilan, April, 2008) - */ -static struct options * -parse_command_line(int argc, const char *argv[]) -{ - int opt; - struct options *cl_opts; - int i, default_rank, actual_rank, ranks[4]; - - cl_opts = (struct options *)HDmalloc(sizeof(struct options)); - - cl_opts->page_buffer_size = 0; - cl_opts->page_size = 0; - - cl_opts->output_file = NULL; - cl_opts->io_types = 0; /* will set default after parsing options */ - cl_opts->num_iters = 1; - - default_rank = 2; - - cl_opts->dset_rank = 0; - cl_opts->buf_rank = 0; - cl_opts->chk_rank = 0; - cl_opts->order_rank = 0; - - for (i = 0; i < MAX_DIMS; i++) { - cl_opts->buf_size[i] = (size_t)((i + 1) * 10); - cl_opts->dset_size[i] = (hsize_t)((i + 1) * 100); - cl_opts->chk_size[i] = (size_t)((i + 1) * 10); - cl_opts->order[i] = i + 1; - } - - cl_opts->vfd = sec2; - - cl_opts->print_times = FALSE; /* Printing times is off by default */ - cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */ - cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */ - cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */ - cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */ - cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ - cl_opts->h5_extendable = FALSE; /* Use extendable dataset */ - cl_opts->verify = FALSE; /* No Verify data correctness by default */ - - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { - switch ((char)opt) { - case 'a': - cl_opts->h5_alignment = parse_size_directive(H5_optarg); - break; - case 'G': - cl_opts->page_size = parse_size_directive(H5_optarg); - break; - case 'b': - cl_opts->page_buffer_size = parse_size_directive(H5_optarg); - break; - case 'A': { - const char *end = H5_optarg; - while (end && *end != '\0') { - char buf[10]; - - HDmemset(buf, '\0', sizeof(buf)); - - for (i = 0; *end != '\0' && *end != ','; ++end) - if (HDisalnum(*end) && i < 10) - buf[i++] = *end; - - if (!HDstrcasecmp(buf, "hdf5")) { - cl_opts->io_types |= SIO_HDF5; - } - else if (!HDstrcasecmp(buf, "posix")) { - cl_opts->io_types |= SIO_POSIX; - } - else { - HDfprintf(stderr, "sio_perf: invalid --api option %s\n", buf); - HDexit(EXIT_FAILURE); - } - - if (*end == '\0') - break; - - end++; - } - } - - break; -#if 0 - case 'b': - /* the future "binary" option */ - break; -#endif /* 0 */ - case 'c': - /* Turn on chunked HDF5 dataset creation */ - cl_opts->h5_use_chunks = 1; - { - const char *end = H5_optarg; - int j = 0; - - while (end && *end != '\0') { - char buf[10]; - - HDmemset(buf, '\0', sizeof(buf)); - - for (i = 0; *end != '\0' && *end != ','; ++end) - if (HDisalnum(*end) && i < 10) - buf[i++] = *end; - - cl_opts->chk_size[j] = parse_size_directive(buf); - - j++; - - if (*end == '\0') - break; - - end++; - } - cl_opts->chk_rank = j; - } - - break; - - case 'D': { - const char *end = H5_optarg; - - while (end && *end != '\0') { - char buf[10]; - - HDmemset(buf, '\0', sizeof(buf)); - - for (i = 0; *end != '\0' && *end != ','; ++end) - if (HDisalnum(*end) && i < 10) - buf[i++] = *end; - - if (HDstrlen(buf) > 1 || HDisdigit(buf[0])) { - size_t j; - - for (j = 0; j < 10 && buf[j] != '\0'; ++j) - if (!HDisdigit(buf[j])) { - HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf); - HDexit(EXIT_FAILURE); - } - - sio_debug_level = atoi(buf); - - if (sio_debug_level > 4) - sio_debug_level = 4; - else if (sio_debug_level < 0) - sio_debug_level = 0; - } - else { - switch (*buf) { - case 'r': - /* Turn on raw data throughput info */ - cl_opts->print_raw = TRUE; - break; - case 't': - /* Turn on time printing */ - cl_opts->print_times = TRUE; - break; - case 'v': - /* Turn on verify data correctness*/ - cl_opts->verify = TRUE; - break; - default: - HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf); - HDexit(EXIT_FAILURE); - } - } - - if (*end == '\0') - break; - - end++; - } - } - - break; - case 'e': { - const char *end = H5_optarg; - int j = 0; - - while (end && *end != '\0') { - char buf[10]; - - HDmemset(buf, '\0', sizeof(buf)); - - for (i = 0; *end != '\0' && *end != ','; ++end) - if (HDisalnum(*end) && i < 10) - buf[i++] = *end; - - cl_opts->dset_size[j] = parse_size_directive(buf); - - j++; - - if (*end == '\0') - break; - - end++; - } - cl_opts->dset_rank = j; - } - - break; - - case 'i': - cl_opts->num_iters = HDatoi(H5_optarg); - break; - case 'o': - cl_opts->output_file = H5_optarg; - break; - case 'T': - cl_opts->h5_threshold = parse_size_directive(H5_optarg); - break; - case 'v': - if (!HDstrcasecmp(H5_optarg, "sec2")) { - cl_opts->vfd = sec2; - } - else if (!HDstrcasecmp(H5_optarg, "stdio")) { - cl_opts->vfd = stdio; - } - else if (!HDstrcasecmp(H5_optarg, "core")) { - cl_opts->vfd = core; - } - else if (!HDstrcasecmp(H5_optarg, "split")) { - cl_opts->vfd = split; - } - else if (!HDstrcasecmp(H5_optarg, "multi")) { - cl_opts->vfd = multi; - } - else if (!HDstrcasecmp(H5_optarg, "family")) { - cl_opts->vfd = family; - } - else if (!HDstrcasecmp(H5_optarg, "direct")) { - cl_opts->vfd = direct; - } - else { - HDfprintf(stderr, "sio_perf: invalid --api option %s\n", H5_optarg); - HDexit(EXIT_FAILURE); - } - break; - case 'w': - cl_opts->h5_write_only = TRUE; - break; - case 't': - cl_opts->h5_extendable = TRUE; - break; - case 'x': { - const char *end = H5_optarg; - int j = 0; - - while (end && *end != '\0') { - char buf[10]; - - HDmemset(buf, '\0', sizeof(buf)); - - for (i = 0; *end != '\0' && *end != ','; ++end) - if (HDisalnum(*end) && i < 10) - buf[i++] = *end; - - cl_opts->buf_size[j] = parse_size_directive(buf); - - j++; - - if (*end == '\0') - break; - - end++; - } - cl_opts->buf_rank = j; - } - - break; - - case 'r': { - const char *end = H5_optarg; - int j = 0; - - while (end && *end != '\0') { - char buf[10]; - - HDmemset(buf, '\0', sizeof(buf)); - - for (i = 0; *end != '\0' && *end != ','; ++end) - if (HDisalnum(*end) && i < 10) - buf[i++] = *end; - - cl_opts->order[j] = (int)parse_size_directive(buf); - - j++; - - if (*end == '\0') - break; - - end++; - } - - cl_opts->order_rank = j; - } - - break; - - case 'h': - case '?': - default: - usage(progname); - HDfree(cl_opts); - return NULL; - } - } - - /* perform rank consistency analysis */ - actual_rank = 0; - - ranks[0] = cl_opts->dset_rank; - ranks[1] = cl_opts->buf_rank; - ranks[2] = cl_opts->order_rank; - ranks[3] = cl_opts->chk_rank; - - for (i = 0; i < 4; i++) { - if (ranks[i] > 0) { - if (!actual_rank) { - actual_rank = ranks[i]; - } - else { - if (actual_rank != ranks[i]) - exit(EXIT_FAILURE); - } - } - } - - if (!actual_rank) - actual_rank = default_rank; - - cl_opts->dset_rank = actual_rank; - cl_opts->buf_rank = actual_rank; - cl_opts->order_rank = actual_rank; - cl_opts->chk_rank = actual_rank; - - for (i = 0; i < actual_rank; i++) { - if (cl_opts->order[i] > actual_rank) { - exit(EXIT_FAILURE); - } - } - - /* set default if none specified yet */ - if (!cl_opts->io_types) - cl_opts->io_types = SIO_HDF5 | SIO_POSIX; /* run all API */ - - /* verify parameters sanity. Adjust if needed. */ - /* cap xfer_size with bytes per process */ - if (cl_opts->num_iters <= 0) - cl_opts->num_iters = 1; - - return cl_opts; -} - -/* - * Function: parse_size_directive - * Purpose: Parse the size directive passed on the commandline. The size - * directive is an integer followed by a size indicator: - * - * K, k - Kilobyte - * M, m - Megabyte - * G, g - Gigabyte - * - * Return: The size as a off_t because this is related to file size. - * If an unknown size indicator is used, then the program will - * exit with EXIT_FAILURE as the return value. - * Programmer: Bill Wendling, 18. December 2001 - * Modifications: - */ - -static hsize_t -parse_size_directive(const char *size) -{ - hsize_t s; - char * endptr; - - s = HDstrtoull(size, &endptr, 10); - - if (endptr && *endptr) { - while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t')) - ++endptr; - - switch (*endptr) { - case 'K': - case 'k': - s *= ONE_KB; - break; - - case 'M': - case 'm': - s *= ONE_MB; - break; - - case 'G': - case 'g': - s *= ONE_GB; - break; - - default: - HDfprintf(stderr, "Illegal size specifier '%c'\n", *endptr); - HDexit(EXIT_FAILURE); - } - } - - return s; -} - -/* - * Function: usage - * Purpose: Print a usage message and then exit. - * Return: Nothing - * Programmer: Bill Wendling, 31. October 2001 - * Modifications: - */ -static void -usage(const char *prog) -{ - print_version(prog); - HDprintf("usage: %s [OPTIONS]\n", prog); - HDprintf(" OPTIONS\n"); - HDprintf(" -h Print an usage message and exit\n"); - HDprintf(" -A AL Which APIs to test\n"); - HDprintf(" [default: all of them]\n"); - HDprintf(" -c SL Selects chunked storage and defines chunks dimensions\n"); - HDprintf(" and sizes\n"); - HDprintf(" [default: Off]\n"); - HDprintf(" -e SL Dimensions and sizes of dataset\n"); - HDprintf(" [default: 100,200]\n"); - HDprintf(" -i N Number of iterations to perform\n"); - HDprintf(" [default: 1]\n"); - HDprintf(" -r NL Dimension access order (see below for description)\n"); - HDprintf(" [default: 1,2]\n"); - HDprintf(" -t Selects extendable dimensions for HDF5 dataset\n"); - HDprintf(" [default: Off]\n"); - HDprintf(" -v VFD Selects file driver for HDF5 access\n"); - HDprintf(" [default: sec2]\n"); - HDprintf(" -w Perform write tests, not the read tests\n"); - HDprintf(" [default: Off]\n"); - HDprintf(" -x SL Dimensions and sizes of the transfer buffer\n"); - HDprintf(" [default: 10,20]\n"); - HDprintf("\n"); - HDprintf(" N - is an integer > 0.\n"); - HDprintf("\n"); - HDprintf(" S - is a size specifier, an integer > 0 followed by a size indicator:\n"); - HDprintf(" K - Kilobyte (%d)\n", ONE_KB); - HDprintf(" M - Megabyte (%d)\n", ONE_MB); - HDprintf(" G - Gigabyte (%d)\n", ONE_GB); - HDprintf("\n"); - HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37 * ONE_MB); - HDprintf("\n"); - HDprintf(" AL - is an API list. Valid values are:\n"); - HDprintf(" hdf5 - HDF5\n"); - HDprintf(" posix - POSIX\n"); - HDprintf("\n"); - HDprintf(" Example: -A posix,hdf5\n"); - HDprintf("\n"); - HDprintf(" NL - is list of integers (N) separated by commas.\n"); - HDprintf("\n"); - HDprintf(" Example: 1,2,3\n"); - HDprintf("\n"); - HDprintf(" SL - is list of size specifiers (S) separated by commas.\n"); - HDprintf("\n"); - HDprintf(" Example: 2K,2K,3K\n"); - HDprintf("\n"); - HDprintf(" The example defines an object (dataset, tranfer buffer) with three\n"); - HDprintf(" dimensions. Be aware that as the number of dimensions increases, the\n"); - HDprintf(" the total size of the object increases exponentially.\n"); - HDprintf("\n"); - HDprintf(" VFD - is an HDF5 file driver specifier. Valid values are:\n"); - HDprintf(" sec2, stdio, core, split, multi, family, direct\n"); - HDprintf("\n"); - HDprintf(" Dimension access order:\n"); - HDprintf(" Data access starts at the cardinal origin of the dataset using the\n"); - HDprintf(" transfer buffer. The next access occurs on a dataset region next to\n"); - HDprintf(" the previous one. For a multidimensional dataset, there are several\n"); - HDprintf(" directions as to where to proceed. This can be specified in the dimension\n"); - HDprintf(" access order. For example, -r 1,2 states that the tool should traverse\n"); - HDprintf(" dimension 1 first, and then dimension 2.\n"); - HDprintf("\n"); - HDprintf(" Environment variables:\n"); - HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); - HDprintf(" HDF5_PREFIX Data file prefix\n"); - HDprintf("\n"); - HDfflush(stdout); -} /* end usage() */ diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h deleted file mode 100644 index 6242782..0000000 --- a/tools/test/perform/sio_perf.h +++ /dev/null @@ -1,104 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef SIO_PERF_H -#define SIO_PERF_H - -#ifndef STANDALONE -#include "io_timer.h" -#include "h5test.h" -#include "h5tools.h" -#include "h5tools_utils.h" -#else -#include "io_timer.h" -#include "sio_standalone.h" -#endif - -/* setup the dataset no fill option if this is v1.5 or more */ -#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4 -#define H5_HAVE_NOFILL 1 -#endif - -#define MAX_DIMS 32 - -typedef enum iotype_ { - POSIXIO, - HDF5 - /*NUM_TYPES*/ -} iotype; - -typedef enum vfdtype_ { - sec2, - stdio, - core, - split, - multi, - family, - direct - /*NUM_TYPES*/ -} vfdtype; - -typedef struct parameters_ { - iotype io_type; /* The type of IO test to perform */ - vfdtype vfd; - long num_files; /* Number of files to create */ - long num_dsets; /* Number of datasets to create */ - hsize_t num_bytes; /* Number of bytes in each dset */ - int num_iters; /* Number of times to loop doing the IO */ - int rank; /* Rank of dataset */ - hsize_t dset_size[MAX_DIMS]; /* Dataset size */ - size_t buf_size[MAX_DIMS]; /* Buffer size */ - size_t chk_size[MAX_DIMS]; /* Chunk size */ - int order[MAX_DIMS]; /* Buffer size */ - hsize_t h5_align; /* HDF5 object alignment */ - hsize_t h5_thresh; /* HDF5 object alignment threshold */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_extendable; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ - int verify; /* Verify data correctness */ - size_t page_size; - size_t page_buffer_size; -} parameters; - -typedef struct results_ { - herr_t ret_code; - io_time_t *timers; -} results; - -#ifndef SUCCESS -#define SUCCESS 0 -#endif /* !SUCCESS */ - -#ifndef FAIL -#define FAIL -1 -#endif /* !FAIL */ - -extern FILE * output; /* output file */ -extern io_time_t *timer_g; /* timer: global for stub functions */ -extern int sio_debug_level; /* The debug level: - * 0 - Off - * 1 - Minimal - * 2 - Some more - * 3 - Maximal - * 4 - Even More Debugging (timer stuff) - */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -extern void do_sio(parameters param, results *res); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* SIO_PERF_H */ diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 3b699dc..99cca75 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -456,17 +456,6 @@ extern char * strdup(const char *s); #define TRUE true #endif -/** From h5test.h **/ - -#ifdef H5_HAVE_PARALLEL -extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ -#endif - -#ifdef H5_HAVE_PARALLEL -int h5_set_info_object(void); -void h5_dump_info_object(MPI_Info info); -#endif - /** From h5tools_utils.h **/ H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */ -- cgit v0.12 From baefe444942452a17f982081ca733f010557073c Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Wed, 11 Aug 2021 07:31:49 -0500 Subject: Fix link issue with perf/h5perf in parallel library (#889) --- tools/src/h5perf/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/src/h5perf/CMakeLists.txt b/tools/src/h5perf/CMakeLists.txt index 644a5ad..36b0b2f 100644 --- a/tools/src/h5perf/CMakeLists.txt +++ b/tools/src/h5perf/CMakeLists.txt @@ -40,10 +40,10 @@ if (H5_HAVE_PARALLEL) target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (perf STATIC) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>") else () TARGET_C_PROPERTIES (perf SHARED) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>") endif () set_target_properties (perf PROPERTIES FOLDER perform) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};perf") @@ -67,10 +67,10 @@ if (H5_HAVE_PARALLEL) target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (h5perf STATIC) - target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>") else () TARGET_C_PROPERTIES (h5perf SHARED) - target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>") endif () set_target_properties (h5perf PROPERTIES FOLDER perform) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf") -- cgit v0.12 From 7c918e685fea4d58b632389999f092b1f4b33d17 Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 12 Aug 2021 08:12:21 -0400 Subject: Guard the SKIP_MPICXX macros against redefinition. (#892) --- src/H5public.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/H5public.h b/src/H5public.h index e192de0..dbccbf8 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 +#endif +#ifndef OMPI_SKIP_MPICXX #define OMPI_SKIP_MPICXX 1 +#endif #include #ifndef MPI_FILE_NULL /* MPIO may be defined in mpi.h already */ #include -- cgit v0.12 From b5c66529e9709839f336d2b6f0d453139a0744b5 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 12 Aug 2021 05:21:50 -0700 Subject: Fixes a bad memory read and unfreed memory in fsinfo code (#893) * Fixes a bad memory read and unfreed memory in fsinfo code The segfaul from CVE-2020-10810 was fixed some time ago, but the illegal memory read and unfreed memory were not. This fix tracks some buffer sizes and errors out gracefully on errors, ensuring buffers are cleaned up and avoiding the H5FL infinite loop + abort on library close. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 1 + release_docs/RELEASE.txt | 18 +++++++++++++++ src/H5Ocache.c | 21 ++++++++++-------- src/H5Ofsinfo.c | 15 ++++++++----- test/cve_2020_10810.h5 | Bin 0 -> 1808 bytes test/ohdr.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 test/cve_2020_10810.h5 diff --git a/MANIFEST b/MANIFEST index 668ba0a..ed28027 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1168,6 +1168,7 @@ ./test/cork.c ./test/corrupt_stab_msg.h5 ./test/cross_read.c +./test/cve_2020_10810.h5 ./test/dangle.c ./test/deflate.h5 ./test/del_many_dense_attrs.c diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 40b9175..396629c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -924,6 +924,24 @@ Bug Fixes since HDF5-1.12.0 release =================================== Library ------- + - Fixed an invalid read and memory leak when parsing corrupt file space + info messages + + When the corrupt file from CVE-2020-10810 was parsed by the library, + the code that imports the version 0 file space info object header + message to the version 1 struct could read past the buffer read from + the disk, causing an invalid memory read. Not catching this error would + cause downstream errors that eventually resulted in a previously + allocated buffer to be unfreed when the library shut down. In builds + where the free lists are in use, this could result in an infinite loop + and SIGABRT when the library shuts down. + + We now track the buffer size and raise an error on attempts to read + past the end of it. + + (DER - 2021/08/12, HDFFV-11053) + + - Fixed CVE-2018-14460 The tool h5repack produced a segfault when the rank in dataspace diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 62dc2f2..3aae0cb 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 */ @@ -287,7 +287,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 */ @@ -333,7 +333,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") @@ -736,7 +736,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 */ @@ -763,7 +763,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") @@ -1275,7 +1275,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 */ @@ -1295,6 +1295,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); @@ -1315,14 +1316,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/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/test/cve_2020_10810.h5 b/test/cve_2020_10810.h5 new file mode 100644 index 0000000..5cface3 Binary files /dev/null and b/test/cve_2020_10810.h5 differ diff --git a/test/ohdr.c b/test/ohdr.c index b7af77f..afcea87 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -457,6 +457,59 @@ error: } /* test_ohdr_swmr() */ /* + * Tests bad object header messages. + * + * Currently tests for CVE-2020-10810 fixes but can be expanded to handle + * other CVE badness. + */ + +/* This is a generated file that can be obtained from: + * + * https://nvd.nist.gov/vuln/detail/CVE-2020-10810 + * + * It was formerly named H5AC_unpin_entry_POC + */ +#define CVE_2020_10810_FILENAME "cve_2020_10810.h5" + +static herr_t +test_ohdr_badness(hid_t fapl) +{ + hid_t fid = H5I_INVALID_HID; + + /* CVE-2020-10810 involved a malformed fsinfo message + * This test ensures the fundamental problem is fixed. Running it under + * valgrind et al. will ensure that the memory leaks and invalid access + * are fixed. + */ + TESTING("Fix for CVE-2020-10810"); + + H5E_BEGIN_TRY + { + /* This should fail due to the malformed fsinfo message. It should + * fail gracefully and not segfault. + */ + fid = H5Fopen(CVE_2020_10810_FILENAME, H5F_ACC_RDWR, fapl); + } + H5E_END_TRY; + + if (fid >= 0) + FAIL_PUTS_ERROR("should not have been able to open malformed file"); + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Fclose(fid); + } + H5E_END_TRY; + + return FAIL; +} + +/* * To test objects with unknown messages in a file with: * a) H5O_BOGUS_VALID_ID: * --the bogus_id is within the range of H5O_msg_class_g[] @@ -2047,6 +2100,9 @@ main(void) } /* high */ } /* low */ + /* Verify bad ohdr message fixes work */ + test_ohdr_badness(fapl); + /* Verify symbol table messages are cached */ if (h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR -- cgit v0.12 From c0f1db4b96d43cd2f7bcd0134e107061e866d6e3 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 12 Aug 2021 07:50:16 -0500 Subject: Update examples version used by CMake (#882) --- bin/release | 6 +++--- config/cmake/HDF5_Examples.cmake.in | 2 +- config/cmake/HDF5_Examples_options.cmake | 4 +++- config/cmake/scripts/HDF5options.cmake | 2 +- release_docs/README_HDF5_CMake | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/release b/bin/release index 16e6bd2..0726b8c 100755 --- a/bin/release +++ b/bin/release @@ -235,7 +235,7 @@ tar2cmakezip() # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.2-Source.zip $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.3-Source.zip $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.zip $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir @@ -331,7 +331,7 @@ tar2cmaketgz() # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.2-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.3-Source.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir @@ -415,7 +415,7 @@ tar2hpccmaketgz() # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.2-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.3-Source.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 5911005..d77e2df 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -77,7 +77,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.2-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.3-Source") #endif() ############################################################################################################### diff --git a/config/cmake/HDF5_Examples_options.cmake b/config/cmake/HDF5_Examples_options.cmake index 236a814..cdd49eb 100644 --- a/config/cmake/HDF5_Examples_options.cmake +++ b/config/cmake/HDF5_Examples_options.cmake @@ -52,12 +52,14 @@ ### enable parallel program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_ENABLE_PARALLEL:BOOL=ON") +############################################################################################# +### match the hdf5 library namespace +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NAMESPACE:STRING=hdf5::") ############################################################################################# ### enable threadsafe program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_ENABLE_THREADSAFE:BOOL=ON") - ############################################################################################# ### enable test program builds, requires reference files in testfiles subdirectory #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=ON") diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index e3c4c1a..8a152d1 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -69,7 +69,7 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### package examples #### -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.2-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.3-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# ### enable parallel builds diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake index 1242695..c63eaca 100644 --- a/release_docs/README_HDF5_CMake +++ b/release_docs/README_HDF5_CMake @@ -10,7 +10,7 @@ This tar file contains LIBAEC.tar.gz source for building SZIP replacement ZLib.tar.gz source for building ZLIB hdf5_plugins.tar.gz source for building compression plugins - HDF5Examples-1.14.2-Source.tar.gz source for building examples + HDF5Examples-1.14.3-Source.tar.gz source for building examples For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in hdf5-1.13.0/release_docs, or -- cgit v0.12 From 6968906418f9ecfc383ad960c975e65a504743b7 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 16 Aug 2021 08:05:25 -0500 Subject: Fix clang/sanitizer for windows (#883) * Fix clang/sanitizer for windows * Restrict MSVC version for sanitize --- config/sanitizer/sanitizers.cmake | 10 +++++----- config/toolchain/clang.cmake | 9 +++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake index 0803279..22b9e3c 100644 --- a/config/sanitizer/sanitizers.cmake +++ b/config/sanitizer/sanitizers.cmake @@ -33,10 +33,10 @@ if(USE_SANITIZER) if(INTEL_CLANG OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}") - if(UNIX) + append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}") + if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) endif() @@ -80,10 +80,10 @@ if(USE_SANITIZER) message( FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") endif() - elseif(MSVC) + elseif(MSVC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.29) if(USE_SANITIZER MATCHES "([Aa]ddress)") message(STATUS "Building with Address sanitizer") - append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + append("/fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) else() message(FATAL_ERROR "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}") endif() diff --git a/config/toolchain/clang.cmake b/config/toolchain/clang.cmake index 5e3b13a..af176aa 100644 --- a/config/toolchain/clang.cmake +++ b/config/toolchain/clang.cmake @@ -3,8 +3,13 @@ set(CMAKE_COMPILER_VENDOR "clang") -set(CMAKE_C_COMPILER clang) -set(CMAKE_CXX_COMPILER clang++) +if(WIN32) + set(CMAKE_C_COMPILER clang-cl) + set(CMAKE_CXX_COMPILER clang-cl) +else() + set(CMAKE_C_COMPILER clang) + set(CMAKE_CXX_COMPILER clang++) +endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # the following is used if cross-compiling -- cgit v0.12 From 451b472cdd63c8fef15c0866e0d3784e33a8b1c6 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 16 Aug 2021 08:06:59 -0500 Subject: Fixed the CMake processing for C++ warnings and flags (#888) --- MANIFEST | 3 +- config/cmake/HDFCXXCompilerFlags.cmake | 298 +++++++++++++++------------ config/cmake/HDFCompilerFlags.cmake | 303 ++++++++++++++++------------ config/intel-warnings/18 | 6 - config/intel-warnings/general-19 | 2 - config/intel-warnings/win-developer-general | 1 + config/intel-warnings/win-general | 1 + release_docs/RELEASE.txt | 9 + 8 files changed, 348 insertions(+), 275 deletions(-) delete mode 100644 config/intel-warnings/general-19 create mode 100644 config/intel-warnings/win-developer-general create mode 100644 config/intel-warnings/win-general diff --git a/MANIFEST b/MANIFEST index ed28027..a0f58ce 100644 --- a/MANIFEST +++ b/MANIFEST @@ -202,7 +202,8 @@ ./config/intel-warnings/18 ./config/intel-warnings/developer-general ./config/intel-warnings/general -./config/intel-warnings/general-19 +./config/intel-warnings/win-developer-general +./config/intel-warnings/win-general ./config/intel-warnings/ifort-general ./config/site-specific/BlankForm diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index bd14a0d..dc982c1 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -9,17 +9,45 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # +ENABLE_LANGUAGE (CXX) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) + set(CMAKE_CXX_EXTENSIONS OFF) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Warnings Configuration: CXX default: ${CMAKE_CXX_FLAGS}") + message (VERBOSE "Warnings Configuration: CXX default: ${CMAKE_CXX_FLAGS}") endif () #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- +if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set(_INTEL_WINDOWS 1) +endif() + +if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + set(_CLANG_MSVC_WINDOWS 1) +endif() + +# MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it. +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105") +endif() + +if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND + NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) + if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") + endif() + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4") + endif() +endif() + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (${HDF_CFG_NAME} MATCHES "Debug") @@ -71,163 +99,167 @@ endif () # HDF5 library compile options #----------------------------------------------------------------------------- -if (NOT MSVC AND NOT MINGW) - if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - list (APPEND HDF5_CMAKE_CXX_FLAGS "-erroff=%none -DBSD_COMP") - else () - # General flags - # - # Note that some of the flags listed here really should be developer - # flags (listed in a separate variable, below) but we put them here - # because they are not raised by the current code and we'd like to - # know if they do start showing up. - # - # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) - # warnings that are emitted. If you need it, add it at configure time. - if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") +if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + list (APPEND HDF5_CMAKE_CXX_FLAGS "-erroff=%none -DBSD_COMP") +else () + # General flags + # + # Note that some of the flags listed here really should be developer + # flags (listed in a separate variable, below) but we put them here + # because they are not raised by the current code and we'd like to + # know if they do start showing up. + # + # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) + # warnings that are emitted. If you need it, add it at configure time. + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if (_INTEL_WINDOWS) + ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/win-general") + else () ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") + endif() + if (NOT _INTEL_WINDOWS) if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0) ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/15") endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/18") endif() - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED - AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - # add the general CXX flags for g++ compiler versions 4.8 and above. - ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") - else () - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") - endif () + endif() + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED + AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) + # add the general CXX flags for g++ compiler versions 4.8 and above. + ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") + else () + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") endif () - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "PGI") - list (APPEND HDF5_CMAKE_CXX_FLAGS "-Minform=inform") - endif () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "CMAKE_CXX_FLAGS_GENERAL=${HDF5_CMAKE_CXX_FLAGS}") endif () + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + list (APPEND HDF5_CMAKE_CXX_FLAGS "-Minform=inform") endif () - - #----------------------------------------------------------------------------- - # Option to allow the user to enable developer warnings - # Developer warnings (suggestions from gcc, not code problems) - #----------------------------------------------------------------------------- - if (HDF5_ENABLE_DEV_WARNINGS) - message (STATUS "....HDF5 developer group warnings are enabled") - if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/developer-general") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") - endif () - else () - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") - endif () + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "CMAKE_CXX_FLAGS_GENERAL=${HDF5_CMAKE_CXX_FLAGS}") endif () +endif () +#----------------------------------------------------------------------------- +# Option to allow the user to enable developer warnings +# Developer warnings (suggestions from gcc, not code problems) +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_DEV_WARNINGS) + message (STATUS "....HDF5 developer group warnings are enabled") + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/developer-general") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") + endif () +else () if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... Only needed for gcc 4.X - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") - endif () + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") + endif () +endif () - # Append more extra warning flags that only gcc 4.8+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.8") - if (HDF5_ENABLE_DEV_WARNINGS) - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") - else () - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") - endif () - endif () +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... Only needed for gcc 4.X + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") + endif () - # Append more extra warning flags that only gcc 4.9+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + # Append more extra warning flags that only gcc 4.8+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.8") + if (HDF5_ENABLE_DEV_WARNINGS) # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") + else () + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") endif () + endif () - # Append more extra warning flags that only gcc 5.1+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) - # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") - else () - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-5") - endif () - endif () + # Append more extra warning flags that only gcc 4.9+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9") + endif () - # Append more extra warning flags that only gcc 6.x+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") + # Append more extra warning flags that only gcc 5.1+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + # autotools always add the C flags with the CXX flags + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") + else () + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-5") endif () + endif () - # Append more extra warning flags that only gcc 7.x+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") - if (HDF5_ENABLE_DEV_WARNINGS) - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") - #else () - # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") - endif () - endif () + # Append more extra warning flags that only gcc 6.x+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") + endif () - # Append more extra warning flags that only gcc 8.x+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") - else () - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") - endif () - if (HDF5_ENABLE_DEV_WARNINGS) - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") - else () - # autotools always add the C flags with the CXX flags - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") - endif () + # Append more extra warning flags that only gcc 7.x+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") + if (HDF5_ENABLE_DEV_WARNINGS) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") + #else () + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") endif () + endif () - # Append more extra warning flags that only gcc 9.x+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) + # Append more extra warning flags that only gcc 8.x+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + else () + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") + endif () + if (HDF5_ENABLE_DEV_WARNINGS) # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-9") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") + else () + # autotools always add the C flags with the CXX flags + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") endif () + endif () - # Append more extra warning flags that only gcc 9.3+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.3) - # do not use C warnings, gnu-warnings 9.3, no cxx warniings - # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3") - endif () + # Append more extra warning flags that only gcc 9.x+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-9") + endif () - # Append more extra warning flags that only gcc 10.x+ knows about - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) - if (HDF5_ENABLE_DEV_WARNINGS) - # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10") - #else () - # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") - endif () + # Append more extra warning flags that only gcc 9.3+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.3) + # do not use C warnings, gnu-warnings 9.3, no cxx warniings + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3") + endif () + + # Append more extra warning flags that only gcc 10.x+ knows about + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) + if (HDF5_ENABLE_DEV_WARNINGS) + # Use the C warnings as CXX warnings are the same + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10") + #else () + # ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") endif () endif () endif () @@ -270,7 +302,7 @@ endif () #----------------------------------------------------------------------------- if (HDF5_ENABLE_SYMBOLS MATCHES "YES") if(CMAKE_CXX_COMPILER_LOADED) - if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") @@ -278,8 +310,8 @@ if (HDF5_ENABLE_SYMBOLS MATCHES "YES") endif () elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") if(CMAKE_CXX_COMPILER_LOADED) - if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-s") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index e38a92b..de5b563 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -14,14 +14,43 @@ set(CMAKE_C_STANDARD_REQUIRED TRUE) set (CMAKE_C_FLAGS "${CMAKE_C99_STANDARD_COMPILE_OPTION} ${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_SANITIZER_FLAGS} ${CMAKE_C_FLAGS}") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Warnings Configuration: default: ${CMAKE_C_FLAGS} : ${CMAKE_CXX_FLAGS}") + message (VERBOSE "Warnings Configuration: C default: ${CMAKE_C_FLAGS}") endif () #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- +if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel") + set(_INTEL_WINDOWS 1) +endif() + +if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Clang" + AND "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + set(_CLANG_MSVC_WINDOWS 1) +endif() + +# Disable deprecation warnings for standard C functions. +# really only needed for newer versions of VS, but should +# not hurt other versions, and this will work into the +# future +if(MSVC OR _INTEL_WINDOWS OR _CLANG_MSVC_WINDOWS) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) +else() +endif() + +if(MSVC) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stack:10000000") +endif() + +# MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it. +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.28) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd5105") +endif() + +if(_CLANG_MSVC_WINDOWS AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000") +endif() + if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") if (${HDF_CFG_NAME} MATCHES "Debug") @@ -81,33 +110,37 @@ endif () # HDF5 library compile options #----------------------------------------------------------------------------- -if (NOT MSVC AND NOT MINGW) - #----------------------------------------------------------------------------- - # Option to allow the user to interpret certain warnings as errors - # - # This should NOT be on by default as it can cause a lot of conflicts with - # new operating systems and compiler versions. Header files that are out of - # our control (MPI, HDFS, etc.) can also raise warnings. - #----------------------------------------------------------------------------- - option (HDF5_ENABLE_WARNINGS_AS_ERRORS "Interpret some warnings as errors" OFF) - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - message (STATUS "...some warnings will be interpreted as errors") - endif () +#----------------------------------------------------------------------------- +# Option to allow the user to interpret certain warnings as errors +# +# This should NOT be on by default as it can cause a lot of conflicts with +# new operating systems and compiler versions. Header files that are out of +# our control (MPI, HDFS, etc.) can also raise warnings. +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_WARNINGS_AS_ERRORS "Interpret some warnings as errors" OFF) +if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + message (STATUS "...some warnings will be interpreted as errors") +endif () - if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - list (APPEND HDF5_CMAKE_C_FLAGS "-erroff=%none -DBSD_COMP") - else () - # General flags - # - # Note that some of the flags listed here really should be developer - # flags (listed in a separate variable, below) but we put them here - # because they are not raised by the current code and we'd like to - # know if they do start showing up. - # - # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) - # warnings that are emitted. If you need it, add it at configure time. - if (CMAKE_C_COMPILER_ID STREQUAL "Intel") +if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + list (APPEND HDF5_CMAKE_C_FLAGS "-erroff=%none -DBSD_COMP") +else () + # General flags + # + # Note that some of the flags listed here really should be developer + # flags (listed in a separate variable, below) but we put them here + # because they are not raised by the current code and we'd like to + # know if they do start showing up. + # + # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) + # warnings that are emitted. If you need it, add it at configure time. + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + if (_INTEL_WINDOWS) + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/win-general") + else () ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") + endif() + if (NOT _INTEL_WINDOWS) if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/15") endif() @@ -116,133 +149,137 @@ if (NOT MSVC AND NOT MINGW) if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/18") endif() - elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") - # Add general CFlags for GCC versions 4.8 and above - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") - else () - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-general") - endif () - endif () - # gcc automatically inlines based on the optimization level - # this is just a failsafe - list (APPEND H5_CFLAGS "-finline-functions") - elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") - ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") + endif() + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + # Add general CFlags for GCC versions 4.8 and above + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") else () - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/noerror-general") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-general") endif () - elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") - list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform") endif () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") + # gcc automatically inlines based on the optimization level + # this is just a failsafe + list (APPEND H5_CFLAGS "-finline-functions") + elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") + else () + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/noerror-general") endif () + elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") + list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform") endif () + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") + endif () +endif () - #----------------------------------------------------------------------------- - # Option to allow the user to enable developer warnings - # Developer warnings (suggestions from gcc, not code problems) - #----------------------------------------------------------------------------- - option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) - if (HDF5_ENABLE_DEV_WARNINGS) - message (STATUS "....HDF5 developer group warnings are enabled") - if (CMAKE_C_COMPILER_ID STREQUAL "Intel") +#----------------------------------------------------------------------------- +# Option to allow the user to enable developer warnings +# Developer warnings (suggestions from gcc, not code problems) +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) +if (HDF5_ENABLE_DEV_WARNINGS) + message (STATUS "....HDF5 developer group warnings are enabled") + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + if (_INTEL_WINDOWS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/win-developer-general") + else () ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/developer-general") - elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") - elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") - endif () - else () - if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") - elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") + elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () +else () + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") + elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") + endif () +endif () - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... Only needed for gcc 4.X - if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") - endif () +if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... Only needed for gcc 4.X + if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last") + endif () - # Append more extra warning flags that only gcc 4.8+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") - if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") - else () - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") - endif () + # Append more extra warning flags that only gcc 4.8+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") + else () + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") endif () + endif () - # Append more extra warning flags that only gcc 4.9+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") - endif () + # Append more extra warning flags that only gcc 4.9+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") + endif () - # Append more extra warning flags that only gcc 5.x+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") - else () - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") - endif () + # Append more extra warning flags that only gcc 5.x+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + else () + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") endif () + endif () - # Append more extra warning flags that only gcc 6.x+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") - endif () + # Append more extra warning flags that only gcc 6.x+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") + endif () - # Append more extra warning flags that only gcc 7.x+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") - if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") - #else () - # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") - endif () + # Append more extra warning flags that only gcc 7.x+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") + #else () + # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") endif () + endif () - # Append more extra warning flags that only gcc 8.x+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") - endif () - if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") - else () - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") - endif () + # Append more extra warning flags that only gcc 8.x+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") endif () - - # Append more extra warning flags that only gcc 9.x+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") + else () + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") endif () + endif () - # Append more extra warning flags that only gcc 9.3+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3") - endif () + # Append more extra warning flags that only gcc 9.x+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + endif () - # Append more extra warning flags that only gcc 10.x+ knows about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0) - if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10") - #else () - # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") - endif () + # Append more extra warning flags that only gcc 9.3+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3") + endif () + + # Append more extra warning flags that only gcc 10.x+ knows about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0) + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10") + #else () + # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") endif () endif () endif () @@ -297,13 +334,13 @@ MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS) set (HDF5_ENABLE_SYMBOLS "OFF" CACHE STRING "Add debug symbols to the library independent of the build mode and optimization level (OFF NO YES)") set_property (CACHE HDF5_ENABLE_SYMBOLS PROPERTY STRINGS OFF NO YES) if (HDF5_ENABLE_SYMBOLS MATCHES "YES") - if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + if (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fno-omit-frame-pointer") endif () elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") - if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + if (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s") diff --git a/config/intel-warnings/18 b/config/intel-warnings/18 index 565b47a..02bcdea 100644 --- a/config/intel-warnings/18 +++ b/config/intel-warnings/18 @@ -1,8 +1,2 @@ --Wextra-tokens --Wformat --Wformat-security -Wic-pointer --Wshadow -Wsign-compare --Wtrigraphs --Wwrite-strings diff --git a/config/intel-warnings/general-19 b/config/intel-warnings/general-19 deleted file mode 100644 index e35af30..0000000 --- a/config/intel-warnings/general-19 +++ /dev/null @@ -1,2 +0,0 @@ -# this is only available before oneapi versions --Wcheck diff --git a/config/intel-warnings/win-developer-general b/config/intel-warnings/win-developer-general new file mode 100644 index 0000000..6cd7ed7 --- /dev/null +++ b/config/intel-warnings/win-developer-general @@ -0,0 +1 @@ +/Wport diff --git a/config/intel-warnings/win-general b/config/intel-warnings/win-general new file mode 100644 index 0000000..ef54b2b --- /dev/null +++ b/config/intel-warnings/win-general @@ -0,0 +1 @@ +/Wall diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 396629c..b3264a7 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1117,6 +1117,15 @@ Bug Fixes since HDF5-1.12.0 release Configuration ------------- + - Fixed CMake C++ compiler flags + + A recent refactoring of the C++ configure files accidently removed the + file that executed the enable_language command for C++ needed by the + HDFCXXCompilerFlags.cmake file. Also updated the intel warnings files, + including adding support for windows platforms. + + (ADB - 2021/08/10) + - Better support for libaec (open-source Szip library) in CMake Implemented better support for libaec 1.0.5 (or later) library. This version -- cgit v0.12 From 04c504664b2cbb63b6a5cdf8c58a93dc65699f6d Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 18 Aug 2021 10:58:02 -0500 Subject: Fix formatting (#923) --- src/H5public.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5public.h b/src/H5public.h index dbccbf8..e7ed518 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -60,7 +60,7 @@ #define MPICH_SKIP_MPICXX 1 #endif #ifndef OMPI_SKIP_MPICXX -#define OMPI_SKIP_MPICXX 1 +#define OMPI_SKIP_MPICXX 1 #endif #include #ifndef MPI_FILE_NULL /* MPIO may be defined in mpi.h already */ -- cgit v0.12 From af7989e858d383322ced07873c2e19b433e74988 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:02:29 -0500 Subject: Correct dataset close in java test (#919) * Correct dataset close * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- java/test/TestH5Arw.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5Arw.java b/java/test/TestH5Arw.java index 282b736..8ce2fee 100644 --- a/java/test/TestH5Arw.java +++ b/java/test/TestH5Arw.java @@ -100,7 +100,7 @@ public class TestH5Arw { if (H5aid >= 0) try {H5.H5Aclose(H5aid);} catch (Exception ex) {} if (H5did >= 0) - try {H5.H5Aclose(H5did);} catch (Exception ex) {} + try {H5.H5Dclose(H5did);} catch (Exception ex) {} if (H5fid > 0) try {H5.H5Fclose(H5fid);} catch (Exception ex) {} H5fid = HDF5Constants.H5I_INVALID_HID; -- cgit v0.12 From c019db60eecc173e1d3b118c9aeb7885865fa50f Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:05:02 -0500 Subject: Remove non-published short arg names (#917) * Remove non-published short arg names * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- tools/src/h5perf/pio_perf.c | 116 ----------------------------------- tools/src/h5perf/sio_perf.c | 136 ------------------------------------------ tools/test/perform/zip_perf.c | 51 ---------------- 3 files changed, 303 deletions(-) diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c index 96cba2d..41245d9 100644 --- a/tools/src/h5perf/pio_perf.c +++ b/tools/src/h5perf/pio_perf.c @@ -130,145 +130,29 @@ static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; #endif /* 1 */ static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, - {"alig", require_arg, 'a'}, - {"ali", require_arg, 'a'}, - {"al", require_arg, 'a'}, {"api", require_arg, 'A'}, - {"ap", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, - { "binar", no_arg, 'b' }, - { "bina", no_arg, 'b' }, - { "bin", no_arg, 'b' }, - { "bi", no_arg, 'b' }, #endif /* 0 */ {"block-size", require_arg, 'B'}, - {"block-siz", require_arg, 'B'}, - {"block-si", require_arg, 'B'}, - {"block-s", require_arg, 'B'}, - {"block-", require_arg, 'B'}, - {"block", require_arg, 'B'}, - {"bloc", require_arg, 'B'}, - {"blo", require_arg, 'B'}, - {"bl", require_arg, 'B'}, {"chunk", no_arg, 'c'}, - {"chun", no_arg, 'c'}, - {"chu", no_arg, 'c'}, - {"ch", no_arg, 'c'}, {"collective", no_arg, 'C'}, - {"collectiv", no_arg, 'C'}, - {"collecti", no_arg, 'C'}, - {"collect", no_arg, 'C'}, - {"collec", no_arg, 'C'}, - {"colle", no_arg, 'C'}, - {"coll", no_arg, 'C'}, - {"col", no_arg, 'C'}, - {"co", no_arg, 'C'}, {"debug", require_arg, 'D'}, - {"debu", require_arg, 'D'}, - {"deb", require_arg, 'D'}, - {"de", require_arg, 'D'}, {"geometry", no_arg, 'g'}, - {"geometr", no_arg, 'g'}, - {"geomet", no_arg, 'g'}, - {"geome", no_arg, 'g'}, - {"geom", no_arg, 'g'}, - {"geo", no_arg, 'g'}, - {"ge", no_arg, 'g'}, {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, {"interleaved", require_arg, 'I'}, - {"interleave", require_arg, 'I'}, - {"interleav", require_arg, 'I'}, - {"interlea", require_arg, 'I'}, - {"interle", require_arg, 'I'}, - {"interl", require_arg, 'I'}, - {"inter", require_arg, 'I'}, - {"inte", require_arg, 'I'}, - {"int", require_arg, 'I'}, - {"in", require_arg, 'I'}, {"max-num-processes", require_arg, 'P'}, - {"max-num-processe", require_arg, 'P'}, - {"max-num-process", require_arg, 'P'}, - {"max-num-proces", require_arg, 'P'}, - {"max-num-proce", require_arg, 'P'}, - {"max-num-proc", require_arg, 'P'}, - {"max-num-pro", require_arg, 'P'}, - {"max-num-pr", require_arg, 'P'}, - {"max-num-p", require_arg, 'P'}, {"min-num-processes", require_arg, 'p'}, - {"min-num-processe", require_arg, 'p'}, - {"min-num-process", require_arg, 'p'}, - {"min-num-proces", require_arg, 'p'}, - {"min-num-proce", require_arg, 'p'}, - {"min-num-proc", require_arg, 'p'}, - {"min-num-pro", require_arg, 'p'}, - {"min-num-pr", require_arg, 'p'}, - {"min-num-p", require_arg, 'p'}, {"max-xfer-size", require_arg, 'X'}, - {"max-xfer-siz", require_arg, 'X'}, - {"max-xfer-si", require_arg, 'X'}, - {"max-xfer-s", require_arg, 'X'}, - {"max-xfer", require_arg, 'X'}, - {"max-xfe", require_arg, 'X'}, - {"max-xf", require_arg, 'X'}, - {"max-x", require_arg, 'X'}, {"min-xfer-size", require_arg, 'x'}, - {"min-xfer-siz", require_arg, 'x'}, - {"min-xfer-si", require_arg, 'x'}, - {"min-xfer-s", require_arg, 'x'}, - {"min-xfer", require_arg, 'x'}, - {"min-xfe", require_arg, 'x'}, - {"min-xf", require_arg, 'x'}, - {"min-x", require_arg, 'x'}, {"num-bytes", require_arg, 'e'}, - {"num-byte", require_arg, 'e'}, - {"num-byt", require_arg, 'e'}, - {"num-by", require_arg, 'e'}, - {"num-b", require_arg, 'e'}, {"num-dsets", require_arg, 'd'}, - {"num-dset", require_arg, 'd'}, - {"num-dse", require_arg, 'd'}, - {"num-ds", require_arg, 'd'}, - {"num-d", require_arg, 'd'}, {"num-files", require_arg, 'F'}, - {"num-file", require_arg, 'F'}, - {"num-fil", require_arg, 'F'}, - {"num-fi", require_arg, 'F'}, - {"num-f", require_arg, 'F'}, {"num-iterations", require_arg, 'i'}, - {"num-iteration", require_arg, 'i'}, - {"num-iteratio", require_arg, 'i'}, - {"num-iterati", require_arg, 'i'}, - {"num-iterat", require_arg, 'i'}, - {"num-itera", require_arg, 'i'}, - {"num-iter", require_arg, 'i'}, - {"num-ite", require_arg, 'i'}, - {"num-it", require_arg, 'i'}, - {"num-i", require_arg, 'i'}, {"output", require_arg, 'o'}, - {"outpu", require_arg, 'o'}, - {"outp", require_arg, 'o'}, - {"out", require_arg, 'o'}, - {"ou", require_arg, 'o'}, {"threshold", require_arg, 'T'}, - {"threshol", require_arg, 'T'}, - {"thresho", require_arg, 'T'}, - {"thresh", require_arg, 'T'}, - {"thres", require_arg, 'T'}, - {"thre", require_arg, 'T'}, - {"thr", require_arg, 'T'}, - {"th", require_arg, 'T'}, {"write-only", require_arg, 'w'}, - {"write-onl", require_arg, 'w'}, - {"write-on", require_arg, 'w'}, - {"write-o", require_arg, 'w'}, - {"write", require_arg, 'w'}, - {"writ", require_arg, 'w'}, - {"wri", require_arg, 'w'}, - {"wr", require_arg, 'w'}, {NULL, 0, '\0'}}; struct options { diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index 51a7825..7bd58d8 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -99,168 +99,32 @@ static const char *progname = "h5perf_serial"; */ static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, - {"alig", require_arg, 'a'}, - {"ali", require_arg, 'a'}, - {"al", require_arg, 'a'}, {"api", require_arg, 'A'}, - {"ap", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, - { "binar", no_arg, 'b' }, - { "bina", no_arg, 'b' }, - { "bin", no_arg, 'b' }, - { "bi", no_arg, 'b' }, #endif /* 0 */ {"block-size", require_arg, 'B'}, - {"block-siz", require_arg, 'B'}, - {"block-si", require_arg, 'B'}, - {"block-s", require_arg, 'B'}, - {"block-", require_arg, 'B'}, - {"block", require_arg, 'B'}, - {"bloc", require_arg, 'B'}, - {"blo", require_arg, 'B'}, - {"bl", require_arg, 'B'}, {"chunk", no_arg, 'c'}, - {"chun", no_arg, 'c'}, - {"chu", no_arg, 'c'}, - {"ch", no_arg, 'c'}, {"collective", no_arg, 'C'}, - {"collectiv", no_arg, 'C'}, - {"collecti", no_arg, 'C'}, - {"collect", no_arg, 'C'}, - {"collec", no_arg, 'C'}, - {"colle", no_arg, 'C'}, - {"coll", no_arg, 'C'}, - {"col", no_arg, 'C'}, - {"co", no_arg, 'C'}, {"debug", require_arg, 'D'}, - {"debu", require_arg, 'D'}, - {"deb", require_arg, 'D'}, - {"de", require_arg, 'D'}, {"file-driver", require_arg, 'v'}, - {"file-drive", require_arg, 'v'}, - {"file-driv", require_arg, 'v'}, - {"file-dri", require_arg, 'v'}, - {"file-dr", require_arg, 'v'}, - {"file-d", require_arg, 'v'}, - {"file-", require_arg, 'v'}, - {"file", require_arg, 'v'}, - {"fil", require_arg, 'v'}, - {"fi", require_arg, 'v'}, {"geometry", no_arg, 'g'}, - {"geometr", no_arg, 'g'}, - {"geomet", no_arg, 'g'}, - {"geome", no_arg, 'g'}, - {"geom", no_arg, 'g'}, - {"geo", no_arg, 'g'}, - {"ge", no_arg, 'g'}, {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, {"interleaved", require_arg, 'I'}, - {"interleave", require_arg, 'I'}, - {"interleav", require_arg, 'I'}, - {"interlea", require_arg, 'I'}, - {"interle", require_arg, 'I'}, - {"interl", require_arg, 'I'}, - {"inter", require_arg, 'I'}, - {"inte", require_arg, 'I'}, - {"int", require_arg, 'I'}, - {"in", require_arg, 'I'}, {"max-num-processes", require_arg, 'P'}, - {"max-num-processe", require_arg, 'P'}, - {"max-num-process", require_arg, 'P'}, - {"max-num-proces", require_arg, 'P'}, - {"max-num-proce", require_arg, 'P'}, - {"max-num-proc", require_arg, 'P'}, - {"max-num-pro", require_arg, 'P'}, - {"max-num-pr", require_arg, 'P'}, - {"max-num-p", require_arg, 'P'}, {"min-num-processes", require_arg, 'p'}, - {"min-num-processe", require_arg, 'p'}, - {"min-num-process", require_arg, 'p'}, - {"min-num-proces", require_arg, 'p'}, - {"min-num-proce", require_arg, 'p'}, - {"min-num-proc", require_arg, 'p'}, - {"min-num-pro", require_arg, 'p'}, - {"min-num-pr", require_arg, 'p'}, - {"min-num-p", require_arg, 'p'}, {"max-xfer-size", require_arg, 'X'}, - {"max-xfer-siz", require_arg, 'X'}, - {"max-xfer-si", require_arg, 'X'}, - {"max-xfer-s", require_arg, 'X'}, - {"max-xfer", require_arg, 'X'}, - {"max-xfe", require_arg, 'X'}, - {"max-xf", require_arg, 'X'}, - {"max-x", require_arg, 'X'}, {"min-xfer-size", require_arg, 'x'}, - {"min-xfer-siz", require_arg, 'x'}, - {"min-xfer-si", require_arg, 'x'}, - {"min-xfer-s", require_arg, 'x'}, - {"min-xfer", require_arg, 'x'}, - {"min-xfe", require_arg, 'x'}, - {"min-xf", require_arg, 'x'}, - {"min-x", require_arg, 'x'}, {"num-bytes", require_arg, 'e'}, - {"num-byte", require_arg, 'e'}, - {"num-byt", require_arg, 'e'}, - {"num-by", require_arg, 'e'}, - {"num-b", require_arg, 'e'}, {"num-dsets", require_arg, 'd'}, - {"num-dset", require_arg, 'd'}, - {"num-dse", require_arg, 'd'}, - {"num-ds", require_arg, 'd'}, - {"num-d", require_arg, 'd'}, {"num-files", require_arg, 'F'}, - {"num-file", require_arg, 'F'}, - {"num-fil", require_arg, 'F'}, - {"num-fi", require_arg, 'F'}, - {"num-f", require_arg, 'F'}, {"num-iterations", require_arg, 'i'}, - {"num-iteration", require_arg, 'i'}, - {"num-iteratio", require_arg, 'i'}, - {"num-iterati", require_arg, 'i'}, - {"num-iterat", require_arg, 'i'}, - {"num-itera", require_arg, 'i'}, - {"num-iter", require_arg, 'i'}, - {"num-ite", require_arg, 'i'}, - {"num-it", require_arg, 'i'}, - {"num-i", require_arg, 'i'}, {"order", require_arg, 'r'}, - {"orde", require_arg, 'r'}, - {"ord", require_arg, 'r'}, - {"or", require_arg, 'r'}, {"output", require_arg, 'o'}, - {"outpu", require_arg, 'o'}, - {"outp", require_arg, 'o'}, - {"out", require_arg, 'o'}, - {"ou", require_arg, 'o'}, {"extendable", no_arg, 't'}, - {"extendabl", no_arg, 't'}, - {"extendab", no_arg, 't'}, - {"extenda", no_arg, 't'}, - {"extend", no_arg, 't'}, - {"exten", no_arg, 't'}, - {"exte", no_arg, 't'}, - {"ext", no_arg, 't'}, - {"ex", no_arg, 't'}, {"threshold", require_arg, 'T'}, - {"threshol", require_arg, 'T'}, - {"thresho", require_arg, 'T'}, - {"thresh", require_arg, 'T'}, - {"thres", require_arg, 'T'}, - {"thre", require_arg, 'T'}, - {"thr", require_arg, 'T'}, - {"th", require_arg, 'T'}, {"write-only", require_arg, 'w'}, - {"write-onl", require_arg, 'w'}, - {"write-on", require_arg, 'w'}, - {"write-o", require_arg, 'w'}, - {"write", require_arg, 'w'}, - {"writ", require_arg, 'w'}, - {"wri", require_arg, 'w'}, - {"wr", require_arg, 'w'}, {NULL, 0, '\0'}}; struct options { diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 6231587..05ad083 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -67,62 +67,11 @@ static void compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source, u static const char * s_opts = "hB:b:c:p:rs:0123456789"; static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"compressability", require_arg, 'c'}, - {"compressabilit", require_arg, 'c'}, - {"compressabili", require_arg, 'c'}, - {"compressabil", require_arg, 'c'}, - {"compressabi", require_arg, 'c'}, - {"compressab", require_arg, 'c'}, - {"compressa", require_arg, 'c'}, - {"compress", require_arg, 'c'}, - {"compres", require_arg, 'c'}, - {"compre", require_arg, 'c'}, - {"compr", require_arg, 'c'}, - {"comp", require_arg, 'c'}, - {"com", require_arg, 'c'}, - {"co", require_arg, 'c'}, {"file-size", require_arg, 's'}, - {"file-siz", require_arg, 's'}, - {"file-si", require_arg, 's'}, - {"file-s", require_arg, 's'}, - {"file", require_arg, 's'}, - {"fil", require_arg, 's'}, - {"fi", require_arg, 's'}, {"max-buffer-size", require_arg, 'B'}, - {"max-buffer-siz", require_arg, 'B'}, - {"max-buffer-si", require_arg, 'B'}, - {"max-buffer-s", require_arg, 'B'}, - {"max-buffer", require_arg, 'B'}, - {"max-buffe", require_arg, 'B'}, - {"max-buff", require_arg, 'B'}, - {"max-buf", require_arg, 'B'}, - {"max-bu", require_arg, 'B'}, - {"max-b", require_arg, 'B'}, - {"max", require_arg, 'B'}, {"min-buffer-size", require_arg, 'b'}, - {"min-buffer-siz", require_arg, 'b'}, - {"min-buffer-si", require_arg, 'b'}, - {"min-buffer-s", require_arg, 'b'}, - {"min-buffer", require_arg, 'b'}, - {"min-buffe", require_arg, 'b'}, - {"min-buff", require_arg, 'b'}, - {"min-buf", require_arg, 'b'}, - {"min-bu", require_arg, 'b'}, - {"min-b", require_arg, 'b'}, - {"min", require_arg, 'b'}, {"prefix", require_arg, 'p'}, - {"prefi", require_arg, 'p'}, - {"pref", require_arg, 'p'}, - {"pre", require_arg, 'p'}, - {"pr", require_arg, 'p'}, {"random-test", no_arg, 'r'}, - {"random-tes", no_arg, 'r'}, - {"random-te", no_arg, 'r'}, - {"random-t", no_arg, 'r'}, - {"random", no_arg, 'r'}, - {"rando", no_arg, 'r'}, - {"rand", no_arg, 'r'}, - {"ran", no_arg, 'r'}, - {"ra", no_arg, 'r'}, {NULL, 0, '\0'}}; /* -- cgit v0.12 From c88c0f2008a0a431ee64ae7a36ed29f927ba3e13 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 19 Aug 2021 13:07:49 -0500 Subject: Correct number of args to Windows HDunsetenv macro (#939) * Correct number of args to Windows HDunsetenv macro * Correct format --- src/H5win32defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v0.12 From 2524b57a6f69e1a24212cba12d504748e13e9743 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 19 Aug 2021 15:56:37 -0500 Subject: Develop windows compiler fixes (#912) * Fix windows compiler issues Restore MS C++ Default exception handling behavior #885 Remove clang toolchain as it skips compiler checks * Add check and header gaurd for pwd.h * Revert change * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- config/cmake/H5pubconf.h.in | 15 +++++---- config/cmake/HDFCXXCompilerFlags.cmake | 54 ++++++++++++++++-------------- config/cmake_ext_mod/ConfigureChecks.cmake | 2 +- configure.ac | 2 +- src/H5private.h | 2 ++ 5 files changed, 42 insertions(+), 33 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 5a94be3..04c0c9f 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -271,6 +271,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_PTHREAD_H @H5_HAVE_PTHREAD_H@ +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_PWD_H @H5_HAVE_PWD_H@ + /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_QUADMATH_H @H5_HAVE_QUADMATH_H@ @@ -631,6 +634,12 @@ PTHREAD_SCOPE_SYSTEM) call. */ #cmakedefine H5_SYSTEM_SCOPE_THREADS @H5_SYSTEM_SCOPE_THREADS@ +/* Define using v1.6 public API symbols by default */ +#cmakedefine H5_USE_16_API_DEFAULT @H5_USE_16_API_DEFAULT@ + +/* Define using v1.8 public API symbols by default */ +#cmakedefine H5_USE_18_API_DEFAULT @H5_USE_18_API_DEFAULT@ + /* Define using v1.10 public API symbols by default */ #cmakedefine H5_USE_110_API_DEFAULT @H5_USE_110_API_DEFAULT@ @@ -640,12 +649,6 @@ /* Define using v1.14 public API symbols by default */ #cmakedefine H5_USE_114_API_DEFAULT @H5_USE_114_API_DEFAULT@ -/* Define using v1.6 public API symbols by default */ -#cmakedefine H5_USE_16_API_DEFAULT @H5_USE_16_API_DEFAULT@ - -/* Define using v1.8 public API symbols by default */ -#cmakedefine H5_USE_18_API_DEFAULT @H5_USE_18_API_DEFAULT@ - /* Define if the library will use file locking */ #cmakedefine H5_USE_FILE_LOCKING @H5_USE_FILE_LOCKING@ diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index dc982c1..a121d0a 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -11,10 +11,10 @@ # ENABLE_LANGUAGE (CXX) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +set (CMAKE_CXX_STANDARD 11) +set (CMAKE_CXX_STANDARD_REQUIRED TRUE) -set(CMAKE_CXX_EXTENSIONS OFF) +set (CMAKE_CXX_EXTENSIONS OFF) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") @@ -23,30 +23,34 @@ endif () #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- -if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(_INTEL_WINDOWS 1) -endif() +if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set (_INTEL_WINDOWS 1) +endif () -if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" +if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") - set(_CLANG_MSVC_WINDOWS 1) + set (_CLANG_MSVC_WINDOWS 1) endif() # MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it. -if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105") -endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_LOADED) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105") + endif () +endif () -if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND - NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") - endif() - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4") - endif() -endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_LOADED) + if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) + if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") + endif () + else () + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4") + endif () + endif () +endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") @@ -301,7 +305,7 @@ endif () # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- if (HDF5_ENABLE_SYMBOLS MATCHES "YES") - if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_LOADED) if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -309,7 +313,7 @@ if (HDF5_ENABLE_SYMBOLS MATCHES "YES") endif () endif () elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") - if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_LOADED) if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-s") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -323,7 +327,7 @@ endif () # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- if (HDF5_ENABLE_PROFILING) - if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_LOADED) list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}") endif () endif () @@ -333,7 +337,7 @@ endif () # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- if (HDF5_ENABLE_OPTIMIZATION) - if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_LOADED) list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}") endif () endif () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 27c7045..1dd1440 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -115,7 +115,7 @@ CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H) CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) - +CHECK_INCLUDE_FILE_CONCAT ("pwd.h" ${HDF_PREFIX}_HAVE_PWD_H) CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) diff --git a/configure.ac b/configure.ac index cbb192d..d955a9f 100644 --- a/configure.ac +++ b/configure.ac @@ -1225,7 +1225,7 @@ AC_CHECK_LIB([dl], [dlopen]) ## ## Unix -AC_CHECK_HEADERS([dirent.h features.h unistd.h]) +AC_CHECK_HEADERS([dirent.h features.h unistd.h pwd.h]) AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/resource.h]) AC_CHECK_HEADERS([sys/stat.h sys/time.h sys/types.h]) diff --git a/src/H5private.h b/src/H5private.h index 802dd90..7b18df0 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -44,7 +44,9 @@ #include #endif #ifdef H5_HAVE_UNISTD_H +#ifdef H5_HAVE_PWD_H #include +#endif #include #include #endif -- cgit v0.12 From 564380d176ae71d9f4ece9df51957e3f817be45d Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 19 Aug 2021 15:57:48 -0500 Subject: Fix issue #924 in develop branch: the ${HDF5_CXXLINKER} does not work in h5c++ (#925) * Committing clang-format changes * Fix issue #924, ${HDF5_CXXLINKER} does not work in h5c++. 2 instances of CLINKER corrected to CXXLINKER comment border aligned Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/src/h5c++.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in index cf993b9..573d20d 100644 --- a/c++/src/h5c++.in +++ b/c++/src/h5c++.in @@ -35,10 +35,10 @@ HL="@HL@" ## (Advanced usage - know what you're doing - you're on your own here.) ## ## The four variables below can be used to insert paths and flags in ## ## CPPFLAGS, CXXFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ## -## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS ## +## $CXXLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS ## ## $LDFLAGS $LIBS $clibpath $link_objs $link_args $shared_link ## ## ## -## These settings can be overridden by setting HDF5_CXXFLAGS, ## +## These settings can be overridden by setting HDF5_CXXFLAGS, ## ## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ## ## ## ############################################################################ @@ -93,7 +93,7 @@ H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@" H5BLD_LIBS="@LIBS@" CXX="${HDF5_CXX:-$CXXBASE}" -CXXLINKER="${HDF5_CLINKER:-$CXXLINKERBASE}" +CXXLINKER="${HDF5_CXXLINKER:-$CXXLINKERBASE}" CXXFLAGS="${HDF5_CXXFLAGS:-$CXXFLAGSBASE}" CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" -- cgit v0.12 From 3600d33f10db1d520f360930c40bf99e282af101 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:03:05 -0500 Subject: CMake should use the output dir programs for shell scripts (#928) --- test/ShellTests.cmake | 118 ++--------------------------------------------- test/test_usecases.sh.in | 22 +++++---- test/testswmr.sh.in | 40 +++++++++------- test/testvdsswmr.sh.in | 16 +++++-- 4 files changed, 52 insertions(+), 144 deletions(-) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 812121e..9614152 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -19,7 +19,8 @@ if (UNIX) find_program (SH_PROGRAM bash) if (SH_PROGRAM) - + set (srcdir ${HDF5_TEST_SOURCE_DIR}) + set (bindir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) ############################################################################## # configure scripts to test dir ############################################################################## @@ -33,13 +34,8 @@ if (UNIX) ############################################################################## # copy test programs to test dir ############################################################################## - add_custom_command ( - TARGET swmr_check_compat_vfd - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_check_compat_vfd" - ) - + #shell script creates dir + #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") add_custom_command ( TARGET swmr_check_compat_vfd POST_BUILD @@ -47,118 +43,12 @@ if (UNIX) ARGS -E copy_if_different "${HDF5_SOURCE_DIR}/bin/output_filter.sh" "${HDF5_TEST_BINARY_DIR}/H5TEST/bin/output_filter.sh" ) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") - add_custom_command ( - TARGET flushrefresh - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh" - ) - #shell script creates dir #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test") - add_custom_command ( - TARGET use_append_mchunks - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/use_append_mchunks" - ) - add_custom_command ( - TARGET use_disable_mdc_flushes - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/use_disable_mdc_flushes" - ) - add_custom_command ( - TARGET twriteorder - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/twriteorder" - ) - add_custom_command ( - TARGET use_append_chunk - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/use_append_chunk" - ) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") - add_custom_command ( - TARGET swmr_generator - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_generator" - ) - add_custom_command ( - TARGET swmr_start_write - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_start_write" - ) - add_custom_command ( - TARGET swmr_reader - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_reader" - ) - add_custom_command ( - TARGET swmr_writer - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_writer" - ) - add_custom_command ( - TARGET swmr_remove_reader - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_remove_reader" - ) - add_custom_command ( - TARGET swmr_remove_writer - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_remove_writer" - ) - add_custom_command ( - TARGET swmr_addrem_writer - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_addrem_writer" - ) - add_custom_command ( - TARGET swmr_sparse_reader - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_sparse_reader" - ) - add_custom_command ( - TARGET swmr_sparse_writer - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_sparse_writer" - ) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") - add_custom_command ( - TARGET vds_swmr_gen - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/vds_swmr_gen" - ) - add_custom_command ( - TARGET vds_swmr_writer - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/vds_swmr_writer" - ) - add_custom_command ( - TARGET vds_swmr_reader - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${HDF5_TEST_BINARY_DIR}/H5TEST/vds_swmr_reader" - ) - - ############################################################################## ############################################################################## diff --git a/test/test_usecases.sh.in b/test/test_usecases.sh.in index bb53697..eaa875e 100644 --- a/test/test_usecases.sh.in +++ b/test/test_usecases.sh.in @@ -22,10 +22,16 @@ # exit codes are okay (0). srcdir=@srcdir@ +bindir=@bindir@ + +# If the bindir directory is not set just use current (.). +if test -z "$bindir"; then + bindir=. +fi # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -./swmr_check_compat_vfd +$bindir/swmr_check_compat_vfd rc=$? if [[ $rc != 0 ]] ; then echo @@ -85,7 +91,7 @@ TOOLTEST() { # Run test. TESTING $program $@ ( - $RUNSERIAL ./$program "$@" + $RUNSERIAL $bindir/$program "$@" ) >$actual 2>$actual_err exit_code=$? @@ -178,14 +184,14 @@ fi # main body for p in $USECASES_PROGRAMS; do - TOOLTEST ./$p - TOOLTEST ./$p -z 256 + TOOLTEST $p + TOOLTEST $p -z 256 tmpfile=/tmp/datatfile.$$ - TOOLTEST ./$p -f $tmpfile; rm -f $tmpfile - TOOLTEST ./$p -l w - TOOLTEST ./$p -l r + TOOLTEST $p -f $tmpfile; rm -f $tmpfile + TOOLTEST $p -l w + TOOLTEST $p -l r # use case 1.9, testing with multi-planes chunks - TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks + TOOLTEST $p -z 256 -y 5 # 5 planes chunks # cleanup temp datafile if test -z "$HDF5_NOCLEANUP"; then rm -f $p.h5 diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index 2df23c6..37e8f9c 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -17,6 +17,7 @@ # Albert Cheng, 2009/07/22 srcdir=@srcdir@ +bindir=@bindir@ ############################################################################### ## test parameters @@ -97,9 +98,14 @@ if test -z "$srcdir"; then srcdir=. fi +# If the bindir directory is not set just use current (.). +if test -z "$bindir"; then + bindir=. +fi + # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -./swmr_check_compat_vfd +$bindir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo @@ -172,7 +178,7 @@ do echo "###############################################################################" # Launch the Generator without SWMR_WRITE echo launch the swmr_generator - ./swmr_generator $compress $index_type + $bindir/swmr_generator $compress $index_type if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -180,7 +186,7 @@ do # Launch the Generator with SWMR_WRITE echo launch the swmr_generator with SWMR_WRITE - ./swmr_generator -s $compress $index_type + $bindir/swmr_generator -s $compress $index_type if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -204,7 +210,7 @@ do # Launch the Writer echo launch the swmr_start_writer seed="" # Put -r command here - ./swmr_start_write $compress $index_type $Nrecords $seed 2>&1 |tee swmr_writer.out & + $bindir/swmr_start_write $compress $index_type $Nrecords $seed 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -220,7 +226,7 @@ do while [ $n -lt $Nreaders ]; do #seed="-r ${seeds[$n]}" seed="" - ./swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & + $bindir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done @@ -265,7 +271,7 @@ do # Launch the Generator echo launch the swmr_generator - ./swmr_generator -s $compress $index_type + $bindir/swmr_generator -s $compress $index_type if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -277,7 +283,7 @@ do # Launch the Writer echo launch the swmr_writer seed="" # Put -r command here - ./swmr_writer -o $Nrecords $seed 2>&1 |tee swmr_writer.out & + $bindir/swmr_writer -o $Nrecords $seed 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -292,7 +298,7 @@ do while [ $n -lt $Nreaders ]; do #seed="-r ${seeds[$n]}" seed="" - ./swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & + $bindir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done @@ -340,7 +346,7 @@ do # Launch the Remove Writer echo launch the swmr_remove_writer seed="" # Put -r command here - ./swmr_remove_writer -o $Nrecs_rem $seed 2>&1 |tee swmr_writer.out & + $bindir/swmr_remove_writer -o $Nrecs_rem $seed 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -355,7 +361,7 @@ do while [ $n -lt $Nreaders ]; do #seed="-r ${seeds[$n]}" seed="" - ./swmr_remove_reader $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n & + $bindir/swmr_remove_reader $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done @@ -400,7 +406,7 @@ do # Launch the Generator echo launch the swmr_generator - ./swmr_generator $compress $index_type + $bindir/swmr_generator $compress $index_type if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -409,7 +415,7 @@ do # Launch the Writer (not in parallel - just to rebuild the datasets) echo launch the swmr_writer seed="" # Put -r command here - ./swmr_writer $Nrecords $seed + $bindir/swmr_writer $Nrecords $seed if test $? -ne 0; then echo writer had error nerrors=`expr $nerrors + 1` @@ -421,7 +427,7 @@ do # Launch the Add/Remove Writer echo launch the swmr_addrem_writer seed="" # Put -r command here - ./swmr_addrem_writer $Nrecords $seed 2>&1 |tee swmr_writer.out & + $bindir/swmr_addrem_writer $Nrecords $seed 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -436,7 +442,7 @@ do while [ $n -lt $Nreaders ]; do #seed="-r ${seeds[$n]}" seed="" - ./swmr_remove_reader $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n & + $bindir/swmr_remove_reader $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done @@ -484,7 +490,7 @@ do # created by the generator. echo launch the swmr_generator seed="" # Put -r command here - ./swmr_generator $compress $index_type $seed + $bindir/swmr_generator $compress $index_type $seed if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -494,7 +500,7 @@ do rm -f $WRITER_MESSAGE # Launch the Sparse writer echo launch the swmr_sparse_writer - nice -n 20 ./swmr_sparse_writer $Nrecs_spa 2>&1 |tee swmr_writer.out & + nice -n 20 $bindir/swmr_sparse_writer $Nrecs_spa 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -507,7 +513,7 @@ do echo launch $Nrdrs_spa swmr_sparse_readers while [ $n -lt $Nrdrs_spa ]; do # The sparse reader spits out a LOT of data so it's set to 'quiet' - ./swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n & + $bindir/swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in index 9673aa3..5399903 100644 --- a/test/testvdsswmr.sh.in +++ b/test/testvdsswmr.sh.in @@ -17,6 +17,7 @@ # Dana Robinson, November 2015 srcdir=@srcdir@ +bindir=@bindir@ ############################################################################### ## test parameters @@ -30,7 +31,7 @@ nerrors=0 ## definitions for message file to coordinate test runs ############################################################################### WRITER_MESSAGE=SWMR_WRITER_MESSAGE # The message file created by writer that the open is complete - # This should be the same as the define in "./swmr_common.h" + # This should be the same as the define in "$bindir/swmr_common.h" MESSAGE_TIMEOUT=300 # Message timeout length in secs # This should be the same as the define in "./h5test.h" @@ -83,9 +84,14 @@ if test -z "$srcdir"; then srcdir=. fi +# If the bindir directory is not set just use current (.). +if test -z "$bindir"; then + bindir=. +fi + # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -./swmr_check_compat_vfd +$bindir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo @@ -148,7 +154,7 @@ echo "########################################################################## # Launch the file generator echo launch the generator -./vds_swmr_gen +$bindir/vds_swmr_gen if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -166,7 +172,7 @@ echo "launch the $Nwriters SWMR VDS writers (1 per source)" pid_writers="" n=0 while [ $n -lt $Nwriters ]; do - ./vds_swmr_writer $n & + $bindir/vds_swmr_writer $n & pid_writers="$pid_writers $!" n=`expr $n + 1` done @@ -181,7 +187,7 @@ echo launch $Nreaders SWMR readers pid_readers="" n=0 while [ $n -lt $Nreaders ]; do - ./vds_swmr_reader & + $bindir/vds_swmr_reader & pid_readers="$pid_readers $!" n=`expr $n + 1` done -- cgit v0.12 From de60f08b0df0abdcac1c6959b393a6862dadd4ce Mon Sep 17 00:00:00 2001 From: Jan-Willem Blokland Date: Thu, 19 Aug 2021 23:45:43 +0200 Subject: CMake: (fix) ph5example test (#935) Ensure that the used number of processes times an integer number is equal to SPACE1_DIM1 and SPACE_DIM2. These variables are equal to 24 and are defined in ph5example.c. If this is not the case the ph5example test will fail. --- examples/CMakeTests.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index b422078..70142c8 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -98,11 +98,14 @@ endif () ### Windows pops up a modal permission dialog on this test if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND NOT WIN32) + # Ensure that 24 is a multiple of the number of processes. + # The number 24 corresponds to SPACE1_DIM1 and SPACE1_DIM2 defined in ph5example.c + math(EXPR NUMPROCS "24 / ((24 + ${MPIEXEC_MAX_NUMPROCS} - 1) / ${MPIEXEC_MAX_NUMPROCS})") if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) + add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) else () add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS}" + -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS}" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_OUTPUT=ph5example.out" -- cgit v0.12 From 09283ffbcb921efa89a7a1ca728f1d4b7064df8e Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 20 Aug 2021 16:32:15 -0400 Subject: Get class name null str (#899) * Fixed MSVC compile error in C++23 mode Error message from MSVC with C++23 enabled: error C2440: 'return': cannot convert from 'int' to 'std::basic_string' * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/src/H5PropList.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 7dca716..7ee8395 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -543,7 +543,7 @@ PropList::getPropSize(const H5std_string &name) const // Function: PropList::getClassName ///\brief Return the name of a generic property list class. ///\return A string containing the class name, if success, otherwise, -/// a NULL string. +/// an empty string. // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5std_string @@ -557,8 +557,9 @@ PropList::getClassName() const return (class_name); } else - return 0; + return ""; } + //-------------------------------------------------------------------------- // Function: PropList::getNumProps ///\brief Returns the number of properties in this property list or class. -- cgit v0.12 From b38bc071e956bec607b180a7d3f8217197393f02 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 20 Aug 2021 15:49:53 -0500 Subject: Remove incorrect compiler check for windows clang sanitizer (#942) --- config/sanitizer/sanitizers.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake index 22b9e3c..58c4050 100644 --- a/config/sanitizer/sanitizers.cmake +++ b/config/sanitizer/sanitizers.cmake @@ -80,7 +80,7 @@ if(USE_SANITIZER) message( FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") endif() - elseif(MSVC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.29) + elseif(MSVC) if(USE_SANITIZER MATCHES "([Aa]ddress)") message(STATUS "Building with Address sanitizer") append("/fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) -- cgit v0.12 From b5f5c59f297be19096051282068cdcc14275eb34 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 23 Aug 2021 13:36:21 +0000 Subject: cmake: simplify try_run result comparisons (#950) Instead of looking at `MATCHES 0` which runs a regex and returns a false positive for any result such as `10`, check if they are equal to `0`. Also quote `0` to avoid looking it up as a variable (which was left behind prior to the fix to use `${RETURN_VAR}` in the `c_run` macro). --- config/cmake/ConfigureChecks.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 4db3ad4..263cedf 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -149,7 +149,7 @@ if (NOT WINDOWS) OUTPUT_VARIABLE OUTPUT ) if (TEST_DIRECT_VFD_WORKS_COMPILE) - if (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) + if (TEST_DIRECT_VFD_WORKS_RUN EQUAL "0") HDF_FUNCTION_TEST (HAVE_DIRECT) set (CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") add_definitions ("-D_GNU_SOURCE") @@ -259,8 +259,8 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") endif () - if (${COMPILE_RESULT_VAR}) - if (${RUN_RESULT_VAR} MATCHES 0) + if (COMPILE_RESULT_VAR) + if (RUN_RESULT_VAR EQUAL "0") set (${RETURN_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Testing C ${FUNCTION_NAME} - OK") @@ -318,7 +318,7 @@ message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}") list (GET PROG_OUTPUT4 0 H5_LDBL_DIG) list (GET PROG_OUTPUT4 1 H5_FLT128_DIG) -if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) +if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL "0" OR FLT128_DIG EQUAL "0") set (${HDF_PREFIX}_HAVE_FLOAT128 0) set (${HDF_PREFIX}_SIZEOF___FLOAT128 0) set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG}) @@ -344,7 +344,7 @@ macro (H5ConversionTests TEST msg) OUTPUT_VARIABLE OUTPUT ) if (${TEST}_COMPILE) - if (${TEST}_RUN MATCHES 0) + if (${TEST}_RUN EQUAL "0") set (${TEST} 1 CACHE INTERNAL ${msg}) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "${msg}... yes") -- cgit v0.12 From f6c49fe8911a39810b236f7babf09a70fcc76c7b Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 23 Aug 2021 17:14:53 -0400 Subject: More clang tidy (#908) * Pacify clang-analyzer-unix.cstring.NullArg * Apply some bugprone-suspicious-string-compare * Apply some readability-simplify-boolean-expr * Apply some readability-make-member-function-const * Apple some bugprone-macro-parentheses * Changed an f suffix to L for `long double` * Applied some readability-uppercase-literal-suffix automatically * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- c++/src/H5DataType.cpp | 5 +-- c++/src/H5IdComponent.cpp | 5 +-- c++/test/tattr.cpp | 18 +++++----- c++/test/ttypes.cpp | 2 +- hl/c++/src/H5PacketTable.cpp | 25 ++++++-------- hl/c++/src/H5PacketTable.h | 20 +++++------ hl/c++/test/ptableTest.cpp | 2 +- hl/examples/ex_table_01.c | 8 ++--- hl/examples/ex_table_02.c | 10 +++--- hl/examples/ex_table_03.c | 6 ++-- hl/examples/ex_table_04.c | 10 +++--- hl/examples/ex_table_05.c | 4 +-- hl/examples/ex_table_06.c | 2 +- hl/examples/ex_table_07.c | 10 +++--- hl/examples/ex_table_08.c | 10 +++--- hl/examples/ex_table_09.c | 10 +++--- hl/examples/ex_table_10.c | 8 ++--- hl/examples/ex_table_11.c | 10 +++--- hl/examples/ex_table_12.c | 10 +++--- hl/test/gen_test_ds.c | 2 +- hl/test/test_packet.c | 8 ++--- hl/test/test_table.c | 6 ++-- src/H5Dchunk.c | 4 +-- src/H5Fefc.c | 8 ++--- src/H5SL.c | 4 +-- src/H5SM.c | 2 +- src/H5T.c | 8 ++--- src/H5Zscaleoffset.c | 58 ++++++++++++++++---------------- test/big.c | 4 +-- test/cmpd_dset.c | 4 +-- test/dsets.c | 10 +++--- test/dt_arith.c | 8 ++--- test/dtransform.c | 70 +++++++++++++++++++-------------------- test/dtypes.c | 10 +++--- test/gheap.c | 2 +- test/pool.c | 2 +- test/set_extent.c | 2 +- test/tconfig.c | 5 +-- test/testhdf5.h | 2 +- test/tfile.c | 2 +- test/tmeta.c | 4 +-- test/tsohm.c | 2 +- test/tunicode.c | 2 +- test/vds.c | 12 +++---- tools/lib/h5diff_array.c | 8 ++--- tools/src/h5perf/sio_engine.c | 2 +- tools/src/h5perf/sio_perf.c | 2 +- tools/src/misc/h5clear.c | 2 +- tools/test/h5dump/h5dumpgentest.c | 4 +-- tools/test/h5repack/h5repacktst.c | 4 +-- tools/test/perform/chunk_cache.c | 6 ++-- tools/test/perform/zip_perf.c | 2 +- 52 files changed, 219 insertions(+), 227 deletions(-) diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index b00a526..af58a90 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -338,10 +338,7 @@ DataType::encode() bool DataType::hasBinaryDesc() const { - if (encoded_buf != NULL) - return true; - else - return false; + return encoded_buf != NULL; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index d546d32..e1fc687 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -432,10 +432,7 @@ IdComponent::p_valid_id(const hid_t obj_id) return false; H5I_type_t id_type = H5Iget_type(obj_id); - if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) - return false; - else - return true; + return (id_type > H5I_BADID && id_type < H5I_NTYPES); } // Notes about IdComponent::id diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 35db334..26699d2 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -285,7 +285,7 @@ test_attr_getname() // Check for existence of attribute FATTR1_NAME bool attr_exists = fid1.attrExists(FATTR1_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Open attribute @@ -361,7 +361,7 @@ test_attr_getname() // Check for existence of attribute attr_exists = dataset.attrExists(ATTR1_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Open attribute @@ -410,7 +410,7 @@ test_attr_rename() // Check for existence of attribute bool attr_exists = fid1.attrExists(FATTR1_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Change attribute name @@ -436,7 +436,7 @@ test_attr_rename() // Check for existence of attribute attr_exists = dataset.attrExists(ATTR1_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Change attribute name @@ -464,7 +464,7 @@ test_attr_rename() // Check for existence of second attribute attr_exists = dataset.attrExists(ATTR2_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Open the second attribute @@ -492,7 +492,7 @@ test_attr_rename() // Check for existence of attribute after renaming attr_exists = dataset.attrExists(ATTR1_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); PASSED(); @@ -1681,13 +1681,13 @@ test_attr_exists() // Check for existence of attribute bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not"); // Check for existence of attribute attr_exists = fid1.attrExists(FATTR1_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not"); @@ -1696,7 +1696,7 @@ test_attr_exists() // Check for existence of attribute attr_exists = group.attrExists(ATTR2_NAME); - if (attr_exists == false) + if (!attr_exists) throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not"); diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 1cedef6..69c93d1 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -699,7 +699,7 @@ test_named() } // Check that it is committed. - if (itype.committed() == false) + if (!itype.committed()) cerr << "IntType::committed() returned false" << endl; // We should not be able to modify a type after it has been committed. diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp index 2908626..086c702 100644 --- a/hl/c++/src/H5PacketTable.cpp +++ b/hl/c++/src/H5PacketTable.cpp @@ -62,12 +62,9 @@ PacketTable::~PacketTable() * any trouble making or opening the packet table. */ bool -PacketTable::IsValid() +PacketTable::IsValid() const { - if (H5PTis_valid(table_id) == 0) - return true; - else - return false; + return H5PTis_valid(table_id) == 0; } /* IsVariableLength @@ -75,7 +72,7 @@ PacketTable::IsValid() * and 0, otherwise. Returns -1 if the table is invalid (not open). */ int -PacketTable::IsVariableLength() +PacketTable::IsVariableLength() const { return H5PTis_varlen(table_id); } @@ -84,7 +81,7 @@ PacketTable::IsVariableLength() * Sets the index to point to the first packet in the packet table */ void -PacketTable::ResetIndex() +PacketTable::ResetIndex() const { H5PTcreate_index(table_id); } @@ -94,7 +91,7 @@ PacketTable::ResetIndex() * Returns 0 on success, negative on failure (if index is out of bounds) */ int -PacketTable::SetIndex(hsize_t index) +PacketTable::SetIndex(hsize_t index) const { return H5PTset_index(table_id, index); } @@ -104,7 +101,7 @@ PacketTable::SetIndex(hsize_t index) * Returns 0 on success, negative on failure (if index is out of bounds) */ hsize_t -PacketTable::GetIndex(int &error) +PacketTable::GetIndex(int &error) const { hsize_t index; @@ -121,7 +118,7 @@ PacketTable::GetIndex(int &error) * error is set to negative. */ hsize_t -PacketTable::GetPacketCount(int &error) +PacketTable::GetPacketCount(int &error) const { hsize_t npackets; @@ -133,7 +130,7 @@ PacketTable::GetPacketCount(int &error) * Returns the identifier of the packet table */ hid_t -PacketTable::GetTableId() +PacketTable::GetTableId() const { return table_id; } @@ -145,7 +142,7 @@ PacketTable::GetTableId() * the desired functionality cannot be performed via the packet table ID. */ hid_t -PacketTable::GetDatatype() +PacketTable::GetDatatype() const { return H5PTget_type(table_id); } @@ -157,7 +154,7 @@ PacketTable::GetDatatype() * the desired functionality cannot be performed via the packet table ID. */ hid_t -PacketTable::GetDataset() +PacketTable::GetDataset() const { return H5PTget_dataset(table_id); } @@ -169,7 +166,7 @@ PacketTable::GetDataset() * Returns 0 on success, negative on error. */ int -PacketTable::FreeBuff(size_t numStructs, hvl_t *buffer) +PacketTable::FreeBuff(size_t numStructs, hvl_t *buffer) const { return H5PTfree_vlen_buff(table_id, numStructs, buffer); } diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index eae66f1..c1f1eb5 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -54,39 +54,39 @@ class H5_HLCPPDLL PacketTable { * Use this after the constructor to ensure HDF did not have * any trouble making or opening the packet table. */ - bool IsValid(); + bool IsValid() const; /* IsVariableLength * Return 1 if this packet table uses variable-length datatype, * return 0 if it is Fixed Length. Returns -1 if the table is * invalid (not open). */ - int IsVariableLength(); + int IsVariableLength() const; /* ResetIndex * Sets the "current packet" index to point to the first packet in the * packet table */ - void ResetIndex(); + void ResetIndex() const; /* SetIndex * Sets the current packet to point to the packet specified by index. * Returns 0 on success, negative on failure (if index is out of bounds) */ - int SetIndex(hsize_t index); + int SetIndex(hsize_t index) const; /* GetIndex * Returns the position of the current packet. * On failure, returns 0 and error is set to negative. */ - hsize_t GetIndex(int &error); + hsize_t GetIndex(int &error) const; /* GetPacketCount * Returns the number of packets in the packet table. Error * is set to 0 on success. On failure, returns 0 and * error is set to negative. */ - hsize_t GetPacketCount(int &error); + hsize_t GetPacketCount(int &error) const; hsize_t GetPacketCount() @@ -98,7 +98,7 @@ class H5_HLCPPDLL PacketTable { /* GetTableId * Returns the identifier of the packet table. */ - hid_t GetTableId(); + hid_t GetTableId() const; /* GetDatatype * Returns the datatype identifier used by the packet table, on success, @@ -106,7 +106,7 @@ class H5_HLCPPDLL PacketTable { * Note: it is best to avoid using this identifier in applications, unless * the desired functionality cannot be performed via the packet table ID. */ - hid_t GetDatatype(); + hid_t GetDatatype() const; /* GetDataset * Returns the dataset identifier associated with the packet table, on @@ -114,7 +114,7 @@ class H5_HLCPPDLL PacketTable { * Note: it is best to avoid using this identifier in applications, unless * the desired functionality cannot be performed via the packet table ID. */ - hid_t GetDataset(); + hid_t GetDataset() const; /* FreeBuff * Frees the buffers created when variable-length packets are read. @@ -122,7 +122,7 @@ class H5_HLCPPDLL PacketTable { * location in memory. * Returns 0 on success, negative on error. */ - int FreeBuff(size_t numStructs, hvl_t *buffer); + int FreeBuff(size_t numStructs, hvl_t *buffer) const; protected: hid_t table_id; diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 6deb24d..ab49303 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -620,7 +620,7 @@ TestHDFFV_9758() for (hsize_t i = 0; i < NUM_PACKETS; i++) { s1[i].a = static_cast(i); - s1[i].b = 1.0f * static_cast(i * i); + s1[i].b = 1.0F * static_cast(i * i); s1[i].c = 1.0 / static_cast(i + 1); HDsprintf(s1[i].d, "string%" PRIuHSIZE "", i); s1[i].e = static_cast(100 + i); diff --git a/hl/examples/ex_table_01.c b/hl/examples/ex_table_01.c index 8635acf..3294ef4 100644 --- a/hl/examples/ex_table_01.c +++ b/hl/examples/ex_table_01.c @@ -50,10 +50,10 @@ main(void) sizeof(dst_buf[0].pressure), sizeof(dst_buf[0].temperature)}; /* Define an array of Particles */ - Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; + Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"four", 40, 40, 4.0F, 40.0}, {"five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; /* Define field information */ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"}; diff --git a/hl/examples/ex_table_02.c b/hl/examples/ex_table_02.c index 9c476b3..fb2cad6 100644 --- a/hl/examples/ex_table_02.c +++ b/hl/examples/ex_table_02.c @@ -42,10 +42,10 @@ main(void) Particle dst_buf[NRECORDS + NRECORDS_ADD]; /* Define an array of Particles */ - Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; + Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"four", 40, 40, 4.0F, 40.0}, {"five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; /* Calculate the size and the offsets of our struct members in memory */ size_t dst_size = sizeof(Particle); @@ -66,7 +66,7 @@ main(void) int i; /* Append particles */ - Particle particle_in[NRECORDS_ADD] = {{"eight", 80, 80, 8.0f, 80.0}, {"nine", 90, 90, 9.0f, 90.0}}; + Particle particle_in[NRECORDS_ADD] = {{"eight", 80, 80, 8.0F, 80.0}, {"nine", 90, 90, 9.0F, 90.0}}; /* Initialize the field field_type */ string_type = H5Tcopy(H5T_C_S1); diff --git a/hl/examples/ex_table_03.c b/hl/examples/ex_table_03.c index 31cf970..3caa45e 100644 --- a/hl/examples/ex_table_03.c +++ b/hl/examples/ex_table_03.c @@ -46,14 +46,14 @@ main(void) size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi), HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)}; - Particle p = {"zero", 0, 0, 0.0f, 0.0}; + Particle p = {"zero", 0, 0, 0.0F, 0.0}; size_t dst_sizes[NFIELDS] = {sizeof(p.name), sizeof(p.lati), sizeof(p.longi), sizeof(p.pressure), sizeof(p.temperature)}; /* Define field information */ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"}; /* Fill value particle */ - Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; + Particle fill_data[1] = {{"no data", -1, -1, -99.0F, -99.0}}; hid_t field_type[NFIELDS]; hid_t string_type; hid_t file_id; @@ -63,7 +63,7 @@ main(void) int i; /* Define 2 new particles to write */ - Particle particle_in[NRECORDS_WRITE] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}}; + Particle particle_in[NRECORDS_WRITE] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}}; /* Initialize the field field_type */ string_type = H5Tcopy(H5T_C_S1); diff --git a/hl/examples/ex_table_04.c b/hl/examples/ex_table_04.c index 863fe15..9b39ef7 100644 --- a/hl/examples/ex_table_04.c +++ b/hl/examples/ex_table_04.c @@ -65,23 +65,23 @@ main(void) hid_t string_type; hid_t file_id; hsize_t chunk_size = 10; - Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; /* Fill value particle */ + Particle fill_data[1] = {{"no data", -1, -1, -99.0F, -99.0}}; /* Fill value particle */ hsize_t start; /* Record to start reading/writing */ hsize_t nrecords; /* Number of records to read/write */ int compress = 0; int i; Particle *p_data = NULL; /* Initially no data */ float pressure_in[NRECORDS_ADD] = /* Define new values for the field "Pressure" */ - {0.0f, 1.0f, 2.0f}; + {0.0F, 1.0F, 2.0F}; Position position_in[NRECORDS_ADD] = {/* Define new values for "Latitude,Longitude" */ {0, 0}, {10, 10}, {20, 20}}; NamePressure namepre_in[NRECORDS_ADD] = /* Define new values for "Name,Pressure" */ { - {"zero", 0.0f}, - {"one", 1.0f}, - {"two", 2.0f}, + {"zero", 0.0F}, + {"one", 1.0F}, + {"two", 2.0F}, }; size_t field_sizes_pos[2] = {sizeof(position_in[0].longi), sizeof(position_in[0].lati)}; size_t field_sizes_pre[1] = {sizeof(namepre_in[0].pressure)}; diff --git a/hl/examples/ex_table_05.c b/hl/examples/ex_table_05.c index 337bfb6..cac406b 100644 --- a/hl/examples/ex_table_05.c +++ b/hl/examples/ex_table_05.c @@ -64,7 +64,7 @@ main(void) hid_t string_type; hid_t file_id; hsize_t chunk_size = 10; - Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; /* Fill value particle */ + Particle fill_data[1] = {{"no data", -1, -1, -99.0F, -99.0}}; /* Fill value particle */ int compress = 0; hsize_t nfields; hsize_t start; /* Record to start reading/writing */ @@ -72,7 +72,7 @@ main(void) int i; /* Define new values for the field "Pressure" */ - float pressure_in[NRECORDS_ADD] = {0.0f, 1.0f, 2.0f}; + float pressure_in[NRECORDS_ADD] = {0.0F, 1.0F, 2.0F}; int field_index_pre[1] = {3}; int field_index_pos[2] = {1, 2}; diff --git a/hl/examples/ex_table_06.c b/hl/examples/ex_table_06.c index f6b67c8..cc1bc01 100644 --- a/hl/examples/ex_table_06.c +++ b/hl/examples/ex_table_06.c @@ -49,7 +49,7 @@ main(void) hid_t string_type; hid_t file_id; hsize_t chunk_size = 10; - Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; /* Fill value particle */ + Particle fill_data[1] = {{"no data", -1, -1, -99.0F, -99.0}}; /* Fill value particle */ int compress = 0; hsize_t nfields_out; hsize_t nrecords_out; diff --git a/hl/examples/ex_table_07.c b/hl/examples/ex_table_07.c index ab36613..e05a681 100644 --- a/hl/examples/ex_table_07.c +++ b/hl/examples/ex_table_07.c @@ -44,10 +44,10 @@ main(void) HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)}; /* Define an array of Particles */ - Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; + Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"four", 40, 40, 4.0F, 40.0}, {"five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; const char *field_names[NFIELDS] = /* Define field information */ {"Name", "Latitude", "Longitude", "Pressure", "Temperature"}; @@ -56,7 +56,7 @@ main(void) hid_t file_id; hsize_t chunk_size = 10; int compress = 0; - Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; + Particle fill_data[1] = {{"no data", -1, -1, -99.0F, -99.0}}; hsize_t start; /* Record to start reading */ hsize_t nrecords; /* Number of records to insert/delete */ hsize_t nfields_out; diff --git a/hl/examples/ex_table_08.c b/hl/examples/ex_table_08.c index 5d447dd..1063172 100644 --- a/hl/examples/ex_table_08.c +++ b/hl/examples/ex_table_08.c @@ -41,10 +41,10 @@ main(void) Particle dst_buf[NRECORDS + NRECORDS_INS]; /* Define an array of Particles */ - Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; + Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"four", 40, 40, 4.0F, 40.0}, {"five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; /* Calculate the size and the offsets of our struct members in memory */ size_t dst_size = sizeof(Particle); @@ -54,7 +54,7 @@ main(void) sizeof(p_data[0].pressure), sizeof(p_data[0].temperature)}; /* Define an array of Particles to insert */ - Particle p_data_insert[NRECORDS_INS] = {{"new", 30, 30, 3.0f, 30.0}, {"new", 40, 40, 4.0f, 40.0}}; + Particle p_data_insert[NRECORDS_INS] = {{"new", 30, 30, 3.0F, 30.0}, {"new", 40, 40, 4.0F, 40.0}}; /* Define field information */ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"}; diff --git a/hl/examples/ex_table_09.c b/hl/examples/ex_table_09.c index 381925f..171de2e 100644 --- a/hl/examples/ex_table_09.c +++ b/hl/examples/ex_table_09.c @@ -49,10 +49,10 @@ main(void) sizeof(dst_buf[0].pressure), sizeof(dst_buf[0].temperature)}; /* Define an array of Particles */ - Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; + Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"four", 40, 40, 4.0F, 40.0}, {"five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; /* Define field information */ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"}; @@ -61,7 +61,7 @@ main(void) hid_t file_id; hsize_t chunk_size = 10; int compress = 0; - Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; /* Fill value particle */ + Particle fill_data[1] = {{"no data", -1, -1, -99.0F, -99.0}}; /* Fill value particle */ hsize_t start1; /* Record to start reading from 1st table */ hsize_t nrecords; /* Number of records to insert */ hsize_t start2; /* Record to start writing in 2nd table */ diff --git a/hl/examples/ex_table_10.c b/hl/examples/ex_table_10.c index 4ba5d64..c974e84 100644 --- a/hl/examples/ex_table_10.c +++ b/hl/examples/ex_table_10.c @@ -40,10 +40,10 @@ main(void) } Particle; /* Define an array of Particles */ - Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; + Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"four", 40, 40, 4.0F, 40.0}, {"five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; Particle dst_buf[2 * NRECORDS]; /* Calculate the size and the offsets of our struct members in memory */ diff --git a/hl/examples/ex_table_11.c b/hl/examples/ex_table_11.c index 9bf3927..6b38b95 100644 --- a/hl/examples/ex_table_11.c +++ b/hl/examples/ex_table_11.c @@ -38,10 +38,10 @@ main(void) } Particle1; /* Define an array of Particles */ - Particle1 p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; + Particle1 p_data[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"four", 40, 40, 4.0F, 40.0}, {"five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; /* Calculate the size and the offsets of our struct members in memory */ size_t dst_size1 = sizeof(Particle1); @@ -56,7 +56,7 @@ main(void) hid_t file_id; hsize_t chunk_size = 10; int compress = 0; - Particle1 fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; + Particle1 fill_data[1] = {{"no data", -1, -1, -99.0F, -99.0}}; int fill_data_new[1] = {-100}; hsize_t position; hsize_t nfields_out; diff --git a/hl/examples/ex_table_12.c b/hl/examples/ex_table_12.c index 3e7c27a..a1a2c54 100644 --- a/hl/examples/ex_table_12.c +++ b/hl/examples/ex_table_12.c @@ -44,10 +44,10 @@ main(void) HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)}; /* Define an array of Particles */ - Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; + Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"four", 40, 40, 4.0F, 40.0}, {"five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; /* Define field information */ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"}; @@ -56,7 +56,7 @@ main(void) hid_t file_id; hsize_t chunk_size = 10; int compress = 0; - Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; + Particle fill_data[1] = {{"no data", -1, -1, -99.0F, -99.0}}; hsize_t nfields_out; hsize_t nrecords_out; diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c index 368c083..a56e6cf 100644 --- a/hl/test/gen_test_ds.c +++ b/hl/test/gen_test_ds.c @@ -75,7 +75,7 @@ main(int argc, char **argv) int nerrors = 0; char filename[65]; - if (argc < 2) { + if (argc < 2 || !argv[0] || !argv[1]) { HDprintf("Usage: gen_test [le | be]\n"); return 1; } diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 311f36a..5f30d4b 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -45,10 +45,10 @@ typedef struct particle_t { * a static array of particles for writing and checking reads *------------------------------------------------------------------------- */ -static particle_t testPart[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}, - {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0}, - {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0}, - {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}}; +static particle_t testPart[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0}, + {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0}, + {"Four", 40, 40, 4.0F, 40.0}, {"Five", 50, 50, 5.0F, 50.0}, + {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}}; /*------------------------------------------------------------------------- * function that compares one particle diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 531f778..6199e27 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -245,7 +245,7 @@ test_table(hid_t fid, int do_write) {"six", 60, 6.0, 60.0, 60}, {"seven", 70, 7.0, 70.0, 70}}; /* buffers for the field "Pressure" and "New_field" */ - float pressure_in[NRECORDS] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f}; + float pressure_in[NRECORDS] = {0.0F, 1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F}; float pressure_out[NRECORDS]; int buf_new[NRECORDS] = {0, 1, 2, 3, 4, 5, 6, 7}; /* buffers for the fields "Latitude,Longitude" */ @@ -254,8 +254,8 @@ test_table(hid_t fid, int do_write) /* buffers for the fields "Name,Pressure" */ namepressure_t namepre_out[NRECORDS]; namepressure_t namepre_in[NRECORDS] = { - {"zero", 0.0f}, {"one", 1.0f}, {"two", 2.0f}, {"three", 3.0f}, - {"four", 4.0f}, {"five", 5.0f}, {"six", 6.0f}, {"seven", 7.0f}, + {"zero", 0.0F}, {"one", 1.0F}, {"two", 2.0F}, {"three", 3.0F}, + {"four", 4.0F}, {"five", 5.0F}, {"six", 6.0F}, {"seven", 7.0F}, }; /*------------------------------------------------------------------------- diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ccae784..6600417 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 */ /******************/ 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/H5SL.c b/src/H5SL.c index 166019b..ba9721c 100644 --- a/src/H5SL.c +++ b/src/H5SL.c @@ -209,7 +209,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++; \ \ @@ -251,7 +251,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 */ \ diff --git a/src/H5SM.c b/src/H5SM.c index 5f055bb..b09cb45 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/H5T.c b/src/H5T.c index 1b0e8c9..19a3d39 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") \ } @@ -560,8 +560,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; diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 2e1a474..a8a63bf 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -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(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \ + pow_fun(2.0F, (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(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \ + pow_fun(2.0F, (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(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \ + pow_fun(2.0F, (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(10.0F, (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(10.0F, (type)D_val) - \ + min * pow_fun(10.0F, (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(10.0F, (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(10.0F, (type)D_val) - \ + min * pow_fun(10.0F, (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(10.0F, (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(10.0F, (type)D_val) - \ + min * pow_fun(10.0F, (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(10.0F, (type)D_val) - \ + min * pow_fun(10.0F, (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)); \ + lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (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)); \ + llround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (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(10.0F, (type)D_val) - \ + min * pow_fun(10.0F, (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(10.0F, (type)D_val) - \ + min * pow_fun(10.0F, (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(10.0F, (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(10.0F, (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(10.0F, (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(10.0F, (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(10.0F, (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(10.0F, (type)D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } diff --git a/test/big.c b/test/big.c index 36fb27d..2bbae67 100644 --- a/test/big.c +++ b/test/big.c @@ -56,8 +56,8 @@ #define DNAME "big.data" #define WRT_N 50 -#define WRT_SIZE 4 * 1024 -#define FAMILY_SIZE 1024 * 1024 * 1024 +#define WRT_SIZE (4 * 1024) +#define FAMILY_SIZE (1024 * 1024 * 1024) #define GB (HDoff_t)0x40000000L diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 4c3233d..8777096 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -110,8 +110,8 @@ typedef struct { long long r, s, t; } stype4; -#define NX 100u -#define NY 2000u +#define NX 100U +#define NY 2000U #define PACK_NMEMBS 100 /*------------------------------------------------------------------------- diff --git a/test/dsets.c b/test/dsets.c index 26322ad..922f370 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1396,10 +1396,10 @@ test_conv_buffer(hid_t fid) cf->a[j][k][l] = 10 * (j + 1) + l + k; for (j = 0; j < DIM2; j++) - cf->b[j] = 100.0f * (float)(j + 1) + 0.01f * (float)j; + cf->b[j] = 100.0F * (float)(j + 1) + 0.01F * (float)j; for (j = 0; j < DIM3; j++) - cf->c[j] = 100.0f * (float)(j + 1) + 0.02f * (float)j; + cf->c[j] = 100.0F * (float)(j + 1) + 0.02F * (float)j; /* Create data space */ if ((space = H5Screate(H5S_SCALAR)) < 0) @@ -3324,8 +3324,8 @@ test_nbit_float(hid_t file) /* orig_data[] are initialized to be within the range that can be represented by * dataset datatype (no precision loss during datatype conversion) */ - float orig_data[2][5] = {{188384.0f, 19.103516f, -1.0831790e9f, -84.242188f, 5.2045898f}, - {-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}}; + float orig_data[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F}, + {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}}; float new_data[2][5]; size_t precision, offset; size_t i, j; @@ -11642,7 +11642,7 @@ test_unfiltered_edge_chunks(hid_t fapl) TEST_ERROR /* Add "count" filter */ - if (H5Pset_filter(dcpl, H5Z_FILTER_COUNT, 0u, (size_t)0, NULL) < 0) + if (H5Pset_filter(dcpl, H5Z_FILTER_COUNT, 0U, (size_t)0, NULL) < 0) TEST_ERROR /* Disable filters on partial chunks */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 7b79102..91e31d5 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -53,7 +53,7 @@ const char *FILENAME[] = {"dt_arith1", "dt_arith2", NULL}; * endian. If local variable `endian' is H5T_ORDER_BE then the result will * be I, otherwise the result will be Z-(I+1). */ -#define ENDIAN(Z, I, E) (H5T_ORDER_BE == E ? (I) : (Z) - ((I) + 1)) +#define ENDIAN(Z, I, E) (H5T_ORDER_BE == (E) ? (I) : (Z) - ((I) + 1)) typedef enum dtype_t { INT_SCHAR, @@ -3058,10 +3058,10 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) /* Check the software results against the hardware */ for (j = 0; j < nelmts; j++) { underflow = 0; - hw_f = 911.0f; - hw_d = 911.0f; + hw_f = 911.0F; + hw_d = 911.0F; #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE - hw_ld = 911.0f; + hw_ld = 911.0L; #endif /* The hardware conversion */ diff --git a/test/dtransform.c b/test/dtransform.c index 9445d83..8d3a8c0 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -32,30 +32,30 @@ hid_t dset_id_int_chunk = -1; hid_t dset_id_float_chunk = -1; const float windchillFfloat[ROWS][COLS] = { - {36.0f, 31.0f, 25.0f, 19.0f, 13.0f, 7.0f, 1.0f, -5.0f, -11.0f, -16.0f, -22.0f, -28.0f, -34.0f, -40.0f, - -46.0f, -52.0f, -57.0f, -63.0f}, - {34.0f, 27.0f, 21.0f, 15.0f, 9.0f, 3.0f, -4.0f, -10.0f, -16.0f, -22.0f, -28.0f, -35.0f, -41.0f, -47.0f, - -53.0f, -59.0f, -66.0f, -72.0f}, - {32.0f, 25.0f, 19.0f, 13.0f, 6.0f, 0.0f, -7.0f, -13.0f, -19.0f, -26.0f, -32.0f, -39.0f, -45.0f, -51.0f, - -58.0f, -64.0f, -71.0f, -77.0f}, - {30.0f, 24.0f, 17.0f, 11.0f, 4.0f, -2.0f, -9.0f, -15.0f, -22.0f, -29.0f, -35.0f, -42.0f, -48.0f, -55.0f, - -61.0f, -68.0f, -74.0f, -81.0f}, - {29.0f, 23.0f, 16.0f, 9.0f, 3.0f, -4.0f, -11.0f, -17.0f, -24.0f, -31.0f, -37.0f, -44.0f, -51.0f, -58.0f, - -64.0f, -71.0f, -78.0f, -84.0f}, - {28.0f, 22.0f, 15.0f, 8.0f, 1.0f, -5.0f, -12.0f, -19.0f, -26.0f, -33.0f, -39.0f, -46.0f, -53.0f, -60.0f, - -67.0f, -73.0f, -80.0f, -87.0f}, - {28.0f, 21.0f, 14.0f, 7.0f, 0.0f, -7.0f, -14.0f, -21.0f, -27.0f, -34.0f, -41.0f, -48.0f, -55.0f, -62.0f, - -69.0f, -76.0f, -82.0f, -89.0f}, - {27.0f, 20.0f, 13.0f, 6.0f, -1.0f, -8.0f, -15.0f, -22.0f, -29.0f, -36.0f, -43.0f, -50.0f, -57.0f, -64.0f, - -71.0f, -78.0f, -84.0f, -91.0f}, - {26.0f, 19.0f, 12.0f, 5.0f, -2.0f, -9.0f, -16.0f, -23.0f, -30.0f, -37.0f, -44.0f, -51.0f, -58.0f, -65.0f, - -72.0f, -79.0f, -86.0f, -93.0f}, - {26.0f, 19.0f, 12.0f, 4.0f, -3.0f, -10.0f, -17.0f, -24.0f, -31.0f, -38.0f, -45.0f, -52.0f, -60.0f, -67.0f, - -74.0f, -81.0f, -88.0f, -95.0f}, - {25.0f, 18.0f, 11.0f, 4.0f, -3.0f, -11.0f, -18.0f, -25.0f, -32.0f, -39.0f, -46.0f, -54.0f, -61.0f, -68.0f, - -75.0f, -82.0f, -89.0f, -97.0f}, - {25.0f, 17.0f, 10.0f, 3.0f, -4.0f, -11.0f, -19.0f, -26.0f, -33.0f, -40.0f, -48.0f, -55.0f, -62.0f, -69.0f, - -76.0f, -84.0f, -91.0f, -98.0f}}; + {36.0F, 31.0F, 25.0F, 19.0F, 13.0F, 7.0F, 1.0F, -5.0F, -11.0F, -16.0F, -22.0F, -28.0F, -34.0F, -40.0F, + -46.0F, -52.0F, -57.0F, -63.0F}, + {34.0F, 27.0F, 21.0F, 15.0F, 9.0F, 3.0F, -4.0F, -10.0F, -16.0F, -22.0F, -28.0F, -35.0F, -41.0F, -47.0F, + -53.0F, -59.0F, -66.0F, -72.0F}, + {32.0F, 25.0F, 19.0F, 13.0F, 6.0F, 0.0F, -7.0F, -13.0F, -19.0F, -26.0F, -32.0F, -39.0F, -45.0F, -51.0F, + -58.0F, -64.0F, -71.0F, -77.0F}, + {30.0F, 24.0F, 17.0F, 11.0F, 4.0F, -2.0F, -9.0F, -15.0F, -22.0F, -29.0F, -35.0F, -42.0F, -48.0F, -55.0F, + -61.0F, -68.0F, -74.0F, -81.0F}, + {29.0F, 23.0F, 16.0F, 9.0F, 3.0F, -4.0F, -11.0F, -17.0F, -24.0F, -31.0F, -37.0F, -44.0F, -51.0F, -58.0F, + -64.0F, -71.0F, -78.0F, -84.0F}, + {28.0F, 22.0F, 15.0F, 8.0F, 1.0F, -5.0F, -12.0F, -19.0F, -26.0F, -33.0F, -39.0F, -46.0F, -53.0F, -60.0F, + -67.0F, -73.0F, -80.0F, -87.0F}, + {28.0F, 21.0F, 14.0F, 7.0F, 0.0F, -7.0F, -14.0F, -21.0F, -27.0F, -34.0F, -41.0F, -48.0F, -55.0F, -62.0F, + -69.0F, -76.0F, -82.0F, -89.0F}, + {27.0F, 20.0F, 13.0F, 6.0F, -1.0F, -8.0F, -15.0F, -22.0F, -29.0F, -36.0F, -43.0F, -50.0F, -57.0F, -64.0F, + -71.0F, -78.0F, -84.0F, -91.0F}, + {26.0F, 19.0F, 12.0F, 5.0F, -2.0F, -9.0F, -16.0F, -23.0F, -30.0F, -37.0F, -44.0F, -51.0F, -58.0F, -65.0F, + -72.0F, -79.0F, -86.0F, -93.0F}, + {26.0F, 19.0F, 12.0F, 4.0F, -3.0F, -10.0F, -17.0F, -24.0F, -31.0F, -38.0F, -45.0F, -52.0F, -60.0F, -67.0F, + -74.0F, -81.0F, -88.0F, -95.0F}, + {25.0F, 18.0F, 11.0F, 4.0F, -3.0F, -11.0F, -18.0F, -25.0F, -32.0F, -39.0F, -46.0F, -54.0F, -61.0F, -68.0F, + -75.0F, -82.0F, -89.0F, -97.0F}, + {25.0F, 17.0F, 10.0F, 3.0F, -4.0F, -11.0F, -19.0F, -26.0F, -33.0F, -40.0F, -48.0F, -55.0F, -62.0F, -69.0F, + -76.0F, -84.0F, -91.0F, -98.0F}}; const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, 28, 34, 40, 46, 52, 57, 63}, {34, 27, 21, 15, 9, 3, 4, 10, 16, 22, 28, 35, 41, 47, 53, 59, 66, 1}, @@ -77,9 +77,9 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, for (i = 0; i < ROWS; i++) \ for (j = 0; j < COLS; j++) { \ if (!((((VAR1)[i][j] >= (TYPE)((VAR2)[i][j])) && \ - (((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || \ + (((VAR1)[i][j] - (TOL)) < (TYPE)((VAR2)[i][j]))) || \ (((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && \ - (((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) { \ + (((VAR1)[i][j] + (TOL)) > (TYPE)((VAR2)[i][j]))))) { \ H5_FAILED(); \ HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ goto error; \ @@ -94,8 +94,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, \ for (i = 0; i < ROWS; i++) \ for (j = 0; j < COLS; j++) { \ - if (!(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + TOL)) && \ - ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - TOL)))) { \ + if (!(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + (TOL))) && \ + ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - (TOL))))) { \ H5_FAILED(); \ HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ goto error; \ @@ -540,19 +540,19 @@ test_poly(const hid_t dxpl_id_polynomial) for (row = 0; row < ROWS; row++) for (col = 0; col < COLS; col++) { - windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32)); - polyflres[row][col] = ((2.0f + (float)windchillC) * (((float)windchillC - 8.0f) / 2.0f)); + windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32)); + polyflres[row][col] = ((2.0F + (float)windchillC) * (((float)windchillC - 8.0F) / 2.0F)); } TESTING("data transform, polynomial transform (int->float)") if (H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread) < 0) TEST_ERROR - COMPARE(float, polyflread, polyflres, 2.0f) + COMPARE(float, polyflread, polyflres, 2.0F) for (row = 0; row < ROWS; row++) for (col = 0; col < COLS; col++) { - windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32)); + windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32)); polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2)); } @@ -752,7 +752,7 @@ test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy) for (row = 0; row < ROWS; row++) for (col = 0; col < COLS; col++) { - windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32)); + windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32)); polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2)); } @@ -786,7 +786,7 @@ test_trivial(const hid_t dxpl_id_simple) TEST_ERROR for (row = 0; row < ROWS; row++) for (col = 0; col < COLS; col++) { - if ((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL) + if ((windchillFfloatread[row][col] - 4.8F) > FLOAT_TOL) FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n"); } @@ -843,7 +843,7 @@ test_getset(const hid_t dxpl_id_c_to_f) for (row = 0; row < ROWS; row++) for (col = 0; col < COLS; col++) { - if ((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL) + if ((windchillFfloatread[row][col] - 4.8F) > FLOAT_TOL) FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n") } diff --git a/test/dtypes.c b/test/dtypes.c index 2a18302..8b3101c 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -70,7 +70,7 @@ FAIL_STACK_ERROR \ if ((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \ H5_FAILED(); \ - HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)NMEMBS, \ + HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)(NMEMBS), \ (long long)H5I_nmembers(H5I_DATATYPE)); \ goto error; \ } @@ -6683,13 +6683,13 @@ static int test_int_float_except(void) { #if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4 - float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f, - (float)4.5f}; + float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0F, (float)INT_MAX - 32.0F, (float)INT_MAX - 68.0F, + (float)4.5F}; int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 4}; - float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4}; + float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0F, (float)INT_MAX - 127.0F, 4}; int * intp; /* Pointer to buffer, as integers */ int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0}; - float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f}; + float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0F, (float)0.0F}; int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0}; float *floatp; /* Pointer to buffer #2, as floats */ hid_t dxpl; /* Dataset transfer property list */ diff --git a/test/gheap.c b/test/gheap.c index 95594ee..567fd65 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -503,7 +503,7 @@ test_ooo_indices(hid_t fapl) GHEAP_REPEATED_ERR(" Unable to insert object into global heap") /* Check that the index is as expected */ - if (obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1) + if (obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1U << 16) - 1) + 1) GHEAP_REPEATED_ERR(" Unexpected global heap index"); } diff --git a/test/pool.c b/test/pool.c index 9ce1846..c508025 100644 --- a/test/pool.c +++ b/test/pool.c @@ -34,7 +34,7 @@ #define MPOOL_LARGE_BLOCK (MPOOL_PAGE_SIZE * 3) #define MPOOL_NUM_SMALL_BLOCKS 64 #define MPOOL_SMALL_BLOCK 1 -#define MPOOL_NUM_RANDOM 10 * 1024 +#define MPOOL_NUM_RANDOM (10 * 1024) #define MPOOL_RANDOM_MAX_SIZE (MPOOL_PAGE_SIZE * 2) /*------------------------------------------------------------------------- diff --git a/test/set_extent.c b/test/set_extent.c index 5a07362..156dd19 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -39,7 +39,7 @@ const char *FILENAME[] = {"set_extent1", "set_extent2", "set_extent3", "set_exte #define CONFIG_EARLY_ALLOC 0x04u #define CONFIG_UNFILT_EDGE 0x08u #define CONFIG_ALL (CONFIG_COMPRESS + CONFIG_FILL + CONFIG_EARLY_ALLOC + CONFIG_UNFILT_EDGE) -#define FILL_VALUE -1 +#define FILL_VALUE (-1) #define DO_RANKS_PRINT_CONFIG(TEST) \ { \ HDprintf(" Config:\n"); \ diff --git a/test/tconfig.c b/test/tconfig.c index e3c6a2c..101de9a 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -37,8 +37,9 @@ /* verify if the sizeof(type) matches size defined in macro. */ /* Needs this extra step so that we can print the macro name. */ #define vrfy_macrosize(type, macro, macroname) \ - if (sizeof(type) != macro) \ - TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", #type, sizeof(type), macroname, (int)macro); + if (sizeof(type) != (macro)) \ + TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", #type, sizeof(type), macroname, \ + (int)(macro)); /* local routine prototypes */ void test_config_ctypes(void); diff --git a/test/testhdf5.h b/test/testhdf5.h index 5fb01a8..ba5fa71 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -136,7 +136,7 @@ "%s \n", \ (where), (int)__LINE__, __FILE__, x); \ } \ - if (HDstrcmp(x, val)) { \ + if (HDstrcmp(x, val) != 0) { \ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \ "in %s\n", \ where, val, x, (int)__LINE__, __FILE__); \ diff --git a/test/tfile.c b/test/tfile.c index 62f3c73..0014d08 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -125,7 +125,7 @@ #define TEST_THRESHOLD10 10 /* Free space section threshold */ #define FSP_SIZE_DEF 4096 /* File space page size default */ #define FSP_SIZE512 512 /* File space page size */ -#define FSP_SIZE1G 1024 * 1024 * 1024 /* File space page size */ +#define FSP_SIZE1G (1024 * 1024 * 1024) /* File space page size */ /* Declaration for test_libver_macros2() */ #define FILE6 "tfile6.h5" /* Test file */ diff --git a/test/tmeta.c b/test/tmeta.c index 2609703..e70db16 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -22,9 +22,9 @@ #include "testhdf5.h" #include "H5Fprivate.h" -#define TEST_INT16_VALUE -7641 +#define TEST_INT16_VALUE (-7641) #define TEST_UINT16_VALUE 45002 -#define TEST_INT32_VALUE -981236 +#define TEST_INT32_VALUE (-981236) #define TEST_UINT32_VALUE 3476589 uint8_t compar_buffer[] = { diff --git a/test/tsohm.c b/test/tsohm.c index fcbb06a..b4ece0b 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -622,7 +622,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_ HDprintf("Can't read data\n"); \ goto error; \ } \ - if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \ + if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str) != 0) { \ H5_FAILED(); \ AT(); \ HDprintf("incorrect read data\n"); \ diff --git a/test/tunicode.c b/test/tunicode.c index 52341bb..1b696ac 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -33,7 +33,7 @@ #define RANK 1 #define COMP_INT_VAL 7 -#define COMP_FLOAT_VAL -42.0F +#define COMP_FLOAT_VAL (-42.0F) #define COMP_DOUBLE_VAL 42.0F /* Test function prototypes */ diff --git a/test/vds.c b/test/vds.c index 88ac4eb..ac9bb5d 100644 --- a/test/vds.c +++ b/test/vds.c @@ -78,12 +78,12 @@ char vds_test_str_g[128] = ""; #endif /* VDS_TEST_VERBOSE */ /* I/O test config flags */ -#define TEST_IO_CLOSE_SRC 0x01u -#define TEST_IO_DIFFERENT_FILE 0x02u -#define TEST_IO_REOPEN_VIRT 0x04u -#define TEST_IO_FCLOSE_SEMI 0x08u -#define TEST_IO_FCLOSE_STRONG 0x10u -#define TEST_IO_NTESTS 0x20u +#define TEST_IO_CLOSE_SRC 0x01U +#define TEST_IO_DIFFERENT_FILE 0x02U +#define TEST_IO_REOPEN_VIRT 0x04U +#define TEST_IO_FCLOSE_SEMI 0x08U +#define TEST_IO_FCLOSE_STRONG 0x10U +#define TEST_IO_NTESTS 0x20U #define LIST_DOUBLE_SIZE (H5D_VIRTUAL_DEF_LIST_SIZE + 1) diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 43ded12..2d6c66c 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -104,9 +104,9 @@ static hbool_t not_comparable; per = -1; \ not_comparable = FALSE; \ both_zero = FALSE; \ - if (H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \ + if (H5_DBL_ABS_EQUAL(0, (double)(A)) && H5_DBL_ABS_EQUAL(0, (double)(B))) \ both_zero = TRUE; \ - if (!H5_DBL_ABS_EQUAL(0, (double)A)) \ + if (!H5_DBL_ABS_EQUAL(0, (double)(A))) \ per = (double)ABS((double)((B) - (A)) / (double)(A)); \ else \ not_comparable = TRUE; \ @@ -117,9 +117,9 @@ static hbool_t not_comparable; per = -1; \ not_comparable = FALSE; \ both_zero = FALSE; \ - if (H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \ + if (H5_DBL_ABS_EQUAL(0, (double)(A)) && H5_DBL_ABS_EQUAL(0, (double)(B))) \ both_zero = TRUE; \ - if (!H5_DBL_ABS_EQUAL(0, (double)A)) \ + if (!H5_DBL_ABS_EQUAL(0, (double)(A))) \ per = ABS((double)((TYPE)((B) - (A))) / (double)(A)); \ else \ not_comparable = TRUE; \ diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c index 1af2318..e69a7cd 100644 --- a/tools/src/h5perf/sio_engine.c +++ b/tools/src/h5perf/sio_engine.c @@ -50,7 +50,7 @@ /* verify: if val is false (0), print mesg. */ #define VRFY(val, mesg) \ do { \ - if (!val) { \ + if (!(val)) { \ ERRMSG(mesg); \ GOTOERROR(FAIL); \ } \ diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index 7bd58d8..1b200b0 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -65,7 +65,7 @@ #define SIO_HDF5 0x4 /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL(t, 0.0) ? 0.0 : ((((double)bytes) / (double)ONE_MB) / (t))) +#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL(t, 0.0) ? 0.0 : ((((double)(bytes)) / (double)ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 008dae3..face2f0 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -32,7 +32,7 @@ #define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check" /* Default increment is 1 megabytes for the --increment option */ -#define DEFAULT_INCREMENT 1024 * 1024 +#define DEFAULT_INCREMENT (1024 * 1024) static char * fname_g = NULL; static hbool_t clear_status_flags = FALSE; diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 29922e8..e74054c 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -199,8 +199,8 @@ const H5L_class_t UD_link_class[1] = {{ #define DIM1 20 #define DIM2 10 -#define CDIM1 DIM1 / 2 -#define CDIM2 DIM2 / 2 +#define CDIM1 (DIM1 / 2) +#define CDIM2 (DIM2 / 2) #define RANK 2 /* Dataspace of 0 dimension size */ diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index acad74e..b62fa53 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -111,8 +111,8 @@ const char *H5REPACK_FILENAMES[] = {"h5repack_big_out", NULL}; #define DIM1 40 #define DIM2 20 -#define CDIM1 DIM1 / 2 -#define CDIM2 DIM2 / 2 +#define CDIM1 (DIM1 / 2) +#define CDIM2 (DIM2 / 2) #define RANK 2 /* Size of userblock (for userblock test) */ diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 25fa34c..b515961 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -26,9 +26,9 @@ #define RANK 2 #define DSET1_NAME "partial_chunks" -#define DSET1_DIM1 9 * 1000 +#define DSET1_DIM1 (9 * 1000) #define DSET1_DIM2 9 -#define CHUNK1_DIM1 2 * 1000 +#define CHUNK1_DIM1 (2 * 1000) #define CHUNK1_DIM2 2 #define DSET2_NAME "hash_value" @@ -38,7 +38,7 @@ #define CHUNK2_DIM2 100 #define RDCC_NSLOTS 5 -#define RDCC_NBYTES 1024 * 1024 * 10 +#define RDCC_NBYTES (1024 * 1024 * 10) #define RDCC_W0 0.75F #define FILTER_COUNTER 306 diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 05ad083..d8cd3a1 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -35,7 +35,7 @@ #define MICROSECOND 1000000.0 /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes, t) ((fabs(t) < 0.0000000001) ? 0.0 : ((((double)bytes) / (double)ONE_MB) / (t))) +#define MB_PER_SEC(bytes, t) ((fabs(t) < 0.0000000001) ? 0.0 : ((((double)(bytes)) / (double)ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 -- cgit v0.12 From e9765e6c09de2e278e2821faef656b6d61854196 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 23 Aug 2021 16:45:29 -0700 Subject: Move pwd header check to alphabetical order (#954) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d955a9f..258f96c 100644 --- a/configure.ac +++ b/configure.ac @@ -1225,7 +1225,7 @@ AC_CHECK_LIB([dl], [dlopen]) ## ## Unix -AC_CHECK_HEADERS([dirent.h features.h unistd.h pwd.h]) +AC_CHECK_HEADERS([dirent.h features.h pwd.h unistd.h]) AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/resource.h]) AC_CHECK_HEADERS([sys/stat.h sys/time.h sys/types.h]) -- cgit v0.12 From 131402a92de9bbd5df60d5859c37c4820c60d6b9 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 25 Aug 2021 00:05:23 -0400 Subject: More various warnings (#958) * Committing clang-format changes * Fixed various -Wdouble-promotion warnings * Fixed -Wshadow warning for `optopt` conflict On macOS at least, there is a global various named `optopt` in unistd.h. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5ACprivate.h | 16 ++++++++-------- src/H5Cquery.c | 2 +- src/H5Pdxpl.c | 2 +- src/H5system.c | 24 ++++++++++++------------ test/cache_common.c | 2 +- test/enc_dec_plist.c | 4 ++-- test/fillval.c | 6 +++--- test/hyperslab.c | 6 +++--- test/set_extent.c | 4 ++-- test/tattr.c | 7 +++---- test/timer.c | 18 +++++++++--------- test/tmisc.c | 2 +- test/tvltypes.c | 8 ++++---- 13 files changed, 50 insertions(+), 51 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index b14194b..e9b8a47 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -275,24 +275,24 @@ typedef struct H5AC_proxy_entry_t { /* 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/H5Cquery.c b/src/H5Cquery.c index 6cf8ffc..710ce2a 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -201,7 +201,7 @@ H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr) if (cache_ptr->cache_accesses > 0) *hit_rate_ptr = ((double)(cache_ptr->cache_hits)) / ((double)(cache_ptr->cache_accesses)); else - *hit_rate_ptr = 0.0f; + *hit_rate_ptr = 0.0; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 5f83a1d..a0c38f8 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 diff --git a/src/H5system.c b/src/H5system.c index eba8341..fe379ad 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -958,8 +958,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 */ @@ -990,7 +990,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) { @@ -1003,7 +1003,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 = '?'; } } } @@ -1012,7 +1012,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; @@ -1024,7 +1024,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++; @@ -1036,11 +1036,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') { @@ -1058,9 +1058,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 */ @@ -1098,5 +1098,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/test/cache_common.c b/test/cache_common.c index 07c70f0..2d88e05 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -4994,7 +4994,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, double *hit_rate_ptr, hbool_t d } else { - expected_hit_rate = 0.0F; + expected_hit_rate = 0.0; } result = H5Fget_mdc_hit_rate(file_id, &hit_rate); diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 9b4879e..60b229a 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -350,7 +350,7 @@ main(void) TESTING("DXPL Encoding/Decoding"); - if ((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0) + if ((H5Pset_btree_ratios(dxpl, 0.2, 0.6, 0.2)) < 0) FAIL_STACK_ERROR if ((H5Pset_hyper_vector_size(dxpl, 5)) < 0) FAIL_STACK_ERROR @@ -544,7 +544,7 @@ main(void) FAIL_STACK_ERROR if ((H5Pset_alignment(fapl, 2, 1024)) < 0) FAIL_STACK_ERROR - if ((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0) + if ((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3)) < 0) FAIL_STACK_ERROR if ((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0) FAIL_STACK_ERROR diff --git a/test/fillval.c b/test/fillval.c index 4215c89..8de6ef1 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -1050,7 +1050,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f for (u = 0; u < nelmts; u++) { buf_c[u].a = 1111.11F; buf_c[u].x = 2222; - buf_c[u].y = 3333.3333F; + buf_c[u].y = 3333.3333; buf_c[u].z = 'd'; } if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0) @@ -1304,7 +1304,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; HDmemset(&fill_ctype, 0, sizeof(fill_ctype)); - fill_ctype.y = 4444.4444F; + fill_ctype.y = 4444.4444; if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, @@ -1370,7 +1370,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; HDmemset(&fill_ctype, 0, sizeof(fill_ctype)); - fill_ctype.y = 4444.4444F; + fill_ctype.y = 4444.4444; if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND, diff --git a/test/hyperslab.c b/test/hyperslab.c index 1f57e3b..1c55259 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -585,10 +585,10 @@ test_multifill(size_t nx) for (i = 0; i < nx; i++) { src[i].left = 1111111; - src[i].mid = 12345.6789F; + src[i].mid = 12345.6789; src[i].right = 2222222; dst[i].left = 3333333; - dst[i].mid = 98765.4321F; + dst[i].mid = 98765.4321; dst[i].right = 4444444; } /* end for */ @@ -597,7 +597,7 @@ test_multifill(size_t nx) * over and over again. */ fill.left = 55555555; - fill.mid = 3.1415927F; + fill.mid = 3.1415927; fill.right = 66666666; src_stride = 0; diff --git a/test/set_extent.c b/test/set_extent.c index 156dd19..3078c2d 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -134,11 +134,11 @@ main(void) TEST_ERROR /* Set chunk cache so only part of the chunks can be cached on fapl */ - if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75F) < 0) + if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR /* Disable chunk caching on fapl2 */ - if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0F) < 0) + if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0) < 0) TEST_ERROR /* Set the "use the latest version of the format" bounds for creating objects in the file */ diff --git a/test/tattr.c b/test/tattr.c index b602222..756e139 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -95,8 +95,7 @@ int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test d #define ATTR3_DIM2 2 #define ATTR3_DIM3 2 double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = { - {{2.3F, -26.1F}, {0.123F, -10.0F}}, - {{973.23F, -0.91827F}, {2.0F, 23.0F}}}; /* Test data for 3rd attribute */ + {{2.3, -26.1}, {0.123, -10.0}}, {{973.23, -0.91827}, {2.0, 23.0}}}; /* Test data for 3rd attribute */ #define ATTR4_NAME "Attr4" #define ATTR4_RANK 2 @@ -113,8 +112,8 @@ struct attr4_struct { double d; char c; } attr_data4[ATTR4_DIM1][ATTR4_DIM2] = { - {{3, -26.1F, 'd'}, {-100000, 0.123F, '3'}}, - {{-23, 981724.2F, 'Q'}, {0, 2.0F, '\n'}}}; /* Test data for 4th attribute */ + {{3, -26.1, 'd'}, {-100000, 0.123, '3'}}, + {{-23, 981724.2, 'Q'}, {0, 2.0, '\n'}}}; /* Test data for 4th attribute */ #define ATTR5_NAME "Attr5" #define ATTR5_RANK 0 diff --git a/test/timer.c b/test/timer.c index bb474ca..11b7427 100644 --- a/test/timer.c +++ b/test/timer.c @@ -43,55 +43,55 @@ test_time_formatting(void) TESTING("Time string formats"); /* < 0, N/A */ - s = H5_timer_get_time_string(-1.0F); + s = H5_timer_get_time_string(-1.0); if (NULL == s || HDstrcmp(s, "N/A") != 0) TEST_ERROR; HDfree(s); /* 0 0 */ - s = H5_timer_get_time_string(0.0F); + s = H5_timer_get_time_string(0.0); if (NULL == s || HDstrcmp(s, "0.0 s") != 0) TEST_ERROR; HDfree(s); /* < 1 us nanoseconds */ - s = H5_timer_get_time_string(123.0E-9F); + s = H5_timer_get_time_string(123.0E-9); if (NULL == s || HDstrcmp(s, "123 ns") != 0) TEST_ERROR; HDfree(s); /* < 1 ms microseconds */ - s = H5_timer_get_time_string(23.456E-6F); + s = H5_timer_get_time_string(23.456E-6); if (NULL == s || HDstrcmp(s, "23.5 us") != 0) TEST_ERROR; HDfree(s); /* < 1 s milliseconds */ - s = H5_timer_get_time_string(4.56789E-3F); + s = H5_timer_get_time_string(4.56789E-3); if (NULL == s || HDstrcmp(s, "4.6 ms") != 0) TEST_ERROR; HDfree(s); /* < 1 min seconds */ - s = H5_timer_get_time_string(3.14F); + s = H5_timer_get_time_string(3.14); if (NULL == s || HDstrcmp(s, "3.14 s") != 0) TEST_ERROR; HDfree(s); /* < 1 hr mins, secs */ - s = H5_timer_get_time_string(2521.0F); + s = H5_timer_get_time_string(2521.0); if (NULL == s || HDstrcmp(s, "42 m 1 s") != 0) TEST_ERROR; HDfree(s); /* < 1 d hrs, mins, secs */ - s = H5_timer_get_time_string(9756.0F); + s = H5_timer_get_time_string(9756.0); if (NULL == s || HDstrcmp(s, "2 h 42 m 36 s") != 0) TEST_ERROR; HDfree(s); /* > 1 d days, hrs, mins, secs */ - s = H5_timer_get_time_string(280802.0F); + s = H5_timer_get_time_string(280802.0); if (NULL == s || HDstrcmp(s, "3 d 6 h 0 m 2 s") != 0) TEST_ERROR; HDfree(s); diff --git a/test/tmisc.c b/test/tmisc.c index 302da0d..b267330 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -5276,7 +5276,7 @@ test_misc28(void) * bytes). */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75F); + ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75); CHECK(ret, FAIL, "H5Pset_cache"); /* Create the dcpl and set the chunk size */ diff --git a/test/tvltypes.c b/test/tvltypes.c index 50b2d7a..03a8ad3 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2526,10 +2526,10 @@ test_vltypes_fill_value(void) hsize_t small_dims[] = {SPACE4_DIM_SMALL}; hsize_t large_dims[] = {SPACE4_DIM_LARGE}; size_t dset_elmts = 0; /* Number of elements in a particular dataset */ - const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", - 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"}; - const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"}; - dtype1_struct * rbuf = NULL; /* Buffer for reading data */ + const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", + 3, 4.0, 100.0, 1.0, "liquid", "meter"}; + const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0, 200.0, 2.0, "solid", "yard"}; + dtype1_struct * rbuf = NULL; /* Buffer for reading data */ size_t mem_used = 0; /* Memory used during allocation */ H5D_layout_t layout; /* Dataset storage layout */ char dset_name1[64], dset_name2[64]; /* Dataset names */ -- cgit v0.12 From 794acf489fa093a3a119723c7cea74cb2880624b Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Mon, 30 Aug 2021 09:09:06 -0500 Subject: Fixed failure on BE with xlf (#968) * fixed missed closing of a dataset * fixed missed closing of a dataset * fixed typo in error return * Committing clang-format changes * minor edits * code format * Committing clang-format changes * code format * minor edit * switched from using MPI_count, to actual bytes written for H5FD_mpio_debug rw debugging * Committing clang-format changes * changed size_i in printf to reflect the I/O. * Committing clang-format changes * Fixed seg fault with xlf on BE with -qintsize=8 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- fortran/test/tH5Z.F90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fortran/test/tH5Z.F90 b/fortran/test/tH5Z.F90 index 0eaa941..8c39fea 100644 --- a/fortran/test/tH5Z.F90 +++ b/fortran/test/tH5Z.F90 @@ -192,7 +192,8 @@ CONTAINS INTEGER(HSIZE_T), DIMENSION(2) :: chunk_dims = (/NN, MM/) INTEGER :: rank = 2 ! Dataset rank - INTEGER, DIMENSION(N,M) :: dset_data, data_out ! Data buffers + INTEGER, DIMENSION(N,M) :: dset_data ! Data buffers + INTEGER, DIMENSION(:,:), ALLOCATABLE :: data_out ! Data buffers INTEGER :: error ! Error flag INTEGER :: num_errors = 0 ! Number of data errors @@ -363,8 +364,9 @@ CONTAINS ! ! Read the dataset. ! + ALLOCATE(data_out(1:N,1:M)) CALL h5dread_f (dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error) - CALL check("h5dread_f", error, total_error) + CALL check("h5dread_f", error, total_error) ! !Compare the data. @@ -385,6 +387,7 @@ CONTAINS 100 IF (num_errors .GT. 0) THEN total_error=total_error + 1 END IF + DEALLOCATE(data_out) ! ! End access to the dataset and release resources used by it. -- cgit v0.12 From 01fe2549a36d7635b2cbe6f6a57cbcce29c1335b Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Mon, 30 Aug 2021 09:56:32 -0500 Subject: Rework of PR #826 (#972) * H5Fget_name_f fixed to handle correctly trailing whitespaces and newly allocated buffers. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- fortran/src/H5Fff.F90 | 4 +- fortran/test/fortranlib_test.F90 | 4 ++ fortran/test/tH5F.F90 | 122 ++++++++++++++++++++++++++++++++++++++- release_docs/RELEASE.txt | 6 ++ 4 files changed, 133 insertions(+), 3 deletions(-) diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index f772558..a273431 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -824,7 +824,7 @@ CONTAINS SUBROUTINE h5fget_name_f(obj_id, buf, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier - CHARACTER(LEN=*), INTENT(INOUT) :: buf + CHARACTER(LEN=*), INTENT(OUT) :: buf ! Buffer to hold file name INTEGER(SIZE_T), INTENT(OUT) :: size ! Size of the file name INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success, @@ -844,7 +844,7 @@ CONTAINS CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: buf END FUNCTION h5fget_name_c END INTERFACE - buflen = LEN_TRIM(buf) + buflen = LEN(buf) hdferr = h5fget_name_c(obj_id, size, buf, buflen) END SUBROUTINE h5fget_name_f !****s* H5F/h5fget_filesize_f diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90 index eff4657..1640a8f 100644 --- a/fortran/test/fortranlib_test.F90 +++ b/fortran/test/fortranlib_test.F90 @@ -74,6 +74,10 @@ PROGRAM fortranlibtest CALL write_test_status(ret_total_error, ' Reopen test', total_error) ret_total_error = 0 + CALL get_name_test(cleanup, ret_total_error) + CALL write_test_status(ret_total_error, ' Get name test', total_error) + + ret_total_error = 0 CALL file_close(cleanup, ret_total_error) CALL write_test_status(ret_total_error, ' File open/close test', total_error) diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index f4a3232..06dc6de 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -21,7 +21,8 @@ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! ! CONTAINS SUBROUTINES -! mountingtest, reopentest, plisttest, file_close, file_space +! mountingtest, reopentest, get_name_test, plisttest, +! file_close, file_space ! !***** ! @@ -580,6 +581,125 @@ CONTAINS END SUBROUTINE reopentest +! The following subroutine checks that h5fget_name_f produces +! correct output for a given obj_id and filename. +! + SUBROUTINE check_get_name(obj_id, fix_filename, total_error) + USE HDF5 ! This module contains all necessary modules + USE TH5_MISC + IMPLICIT NONE + INTEGER(HID_T) :: obj_id ! Object identifier + CHARACTER(LEN=80), INTENT(IN) :: fix_filename ! Expected filename + INTEGER, INTENT(INOUT) :: total_error ! Error count + + CHARACTER(LEN=80):: file_name ! Filename buffer + INTEGER:: error ! HDF5 error code + INTEGER(SIZE_T):: name_size ! Filename length + ! + !Get file name from the dataset identifier + ! + + ! Use an uninitialized buffer + CALL h5fget_name_f(obj_id, file_name, name_size, error) + CALL check("h5fget_name_f",error,total_error) + IF(name_size .NE. LEN_TRIM(fix_filename))THEN + WRITE(*,*) " file name size obtained from the object id is incorrect" + total_error = total_error + 1 + ENDIF + IF(file_name(1:name_size) .NE. TRIM(fix_filename)) THEN + WRITE(*,*) " file name obtained from the object id is incorrect" + total_error = total_error + 1 + END IF + + ! Use a buffer initialized with spaces + file_name(:) = " " + CALL h5fget_name_f(obj_id, file_name, name_size, error) + CALL check("h5fget_name_f",error,total_error) + IF(name_size .NE. LEN_TRIM(fix_filename))THEN + WRITE(*,*) " file name size obtained from the object id is incorrect" + total_error = total_error + 1 + ENDIF + IF(file_name(1:name_size) .NE. TRIM(fix_filename)) THEN + WRITE(*,*) " file name obtained from the object id is incorrect" + total_error = total_error + 1 + END IF + + ! Use a buffer initialized with non-whitespace characters + file_name(:) = "a" + CALL h5fget_name_f(obj_id, file_name, name_size, error) + CALL check("h5fget_name_f",error,total_error) + IF(name_size .NE. LEN_TRIM(fix_filename))THEN + WRITE(*,*) " file name size obtained from the object id is incorrect" + total_error = total_error + 1 + ENDIF + IF(file_name(1:name_size) .NE. TRIM(fix_filename)) THEN + WRITE(*,*) " file name obtained from the object id is incorrect" + total_error = total_error + 1 + END IF + + END SUBROUTINE check_get_name + +! The following subroutine tests h5fget_name_f. +! It creates the file which has name "filename.h5" and +! tests that h5fget_name_f also returns the name "filename.h5" +! + + SUBROUTINE get_name_test(cleanup, total_error) + USE HDF5 ! This module contains all necessary modules + USE TH5_MISC + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(INOUT) :: total_error + + CHARACTER(LEN=*), PARAMETER :: filename = "filename" + CHARACTER(LEN=80) :: fix_filename + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: g_id ! Group identifier + + ! + ! Flag to check operation success + ! + INTEGER :: error + + ! + ! Create file "filename.h5" using default properties. + ! + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + IF (error .NE. 0) THEN + WRITE(*,*) "Cannot modify filename" + STOP + ENDIF + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + ! + ! Create group. + ! + CALL h5gopen_f(file_id,"/",g_id, error) + CALL check("h5gopen_f",error,total_error) + + CALL check_get_name(file_id, fix_filename, total_error) + CALL check_get_name(g_id, fix_filename, total_error) + + ! Close the group. + ! + CALL h5gclose_f(g_id, error) + CALL check("h5gclose_f",error,total_error) + + ! + ! Close the file identifiers. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error,total_error) + + IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + RETURN + + END SUBROUTINE get_name_test + + ! ! The following example demonstrates how to get creation property list, ! and access property list. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b3264a7..86074d0 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -745,6 +745,12 @@ New Features Fortran Library: ---------------- + + - H5Fget_name_f fixed to handle correctly trailing whitespaces and + newly allocated buffers. + + (MSB - 2021/08/30, github-826,972) + - Add wrappers for H5Pset/get_file_locking() API calls h5pget_file_locking_f() -- cgit v0.12 From cf25524474a4012a70cc2bdb6eaddc402b5ea136 Mon Sep 17 00:00:00 2001 From: Gerd Heber Date: Wed, 1 Sep 2021 16:09:27 -0500 Subject: A batch of life-cycle examples for different modules (#654) * Create a tag file for permalinks. * Added DOXYGEN_TAG_FILE. * Added Doxygen life-cycle examples for different modules. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- MANIFEST | 37 +- configure.ac | 6 +- doc/contributing.md | 35 +- doxygen/Doxyfile.in | 9 +- doxygen/aliases | 100 ++++- doxygen/dox/APIVersions.dox | 173 +++++++++ doxygen/dox/About.dox | 12 + doxygen/dox/Cookbook.dox | 14 + doxygen/dox/H5Acreate.dox | 9 - doxygen/dox/H5Aiterate.dox | 9 - doxygen/dox/H5Fget_info.dox | 44 --- doxygen/dox/H5Lget_info.dox | 17 - doxygen/dox/H5Lget_info_by_idx.dox | 17 - doxygen/dox/H5Literate.dox | 20 - doxygen/dox/H5Literate_by_name.dox | 21 - doxygen/dox/H5Lvisit.dox | 20 - doxygen/dox/H5Lvisit_by_name.dox | 20 - doxygen/dox/H5Oget_info.dox | 72 ---- doxygen/dox/H5Oget_info_by_idx.dox | 55 --- doxygen/dox/H5Oget_info_by_name.dox | 58 --- doxygen/dox/H5Ovisit.dox | 55 --- doxygen/dox/H5Ovisit_by_name.dox | 54 --- doxygen/dox/H5Sencode.dox | 5 - doxygen/dox/RFC.dox | 91 +++++ doxygen/dox/ReferenceManual.dox | 114 ++++-- doxygen/dox/cookbook/Accessibility.c | 48 +++ doxygen/dox/cookbook/Accessibility.dox | 39 ++ doxygen/dox/cookbook/Attributes.c | 61 +++ doxygen/dox/cookbook/Attributes.dox | 38 ++ doxygen/dox/cookbook/Files.c | 87 +++++ doxygen/dox/cookbook/Files.dox | 71 ++++ doxygen/dox/cookbook/Performance.dox | 21 + doxygen/dox/maybe_metadata_reads.dox | 68 +--- doxygen/dox/rm-template.dox | 171 +++++---- doxygen/examples/H5D_examples.c | 81 +++- doxygen/examples/H5E_examples.c | 97 +++++ doxygen/examples/H5F_examples.c | 55 ++- doxygen/examples/H5G_examples.c | 186 +++++++++ doxygen/examples/H5I_examples.c | 242 ++++++++++++ doxygen/examples/H5L_examples.c | 156 ++++++++ doxygen/examples/H5O_examples.c | 193 ++++++++++ doxygen/examples/H5PL_examples.c | 97 +++++ doxygen/examples/H5P_examples.c | 227 +++++++++++ doxygen/examples/H5R_examples.c | 171 +++++++++ doxygen/examples/H5S_examples.c | 132 +++++++ doxygen/examples/H5T_examples.c | 136 +++++++ doxygen/examples/H5Z_examples.c | 108 ++++++ doxygen/examples/H5_examples.c | 85 ++++ doxygen/hdf5_header.html | 2 +- doxygen/hdf5doxy_layout.xml | 1 + src/CMakeLists.txt | 1 + src/H5Amodule.h | 24 +- src/H5Apublic.h | 267 +++---------- src/H5Dmodule.h | 8 +- src/H5Dpublic.h | 562 +++++++++++---------------- src/H5ESmodule.h | 6 +- src/H5Emodule.h | 75 ++-- src/H5Epublic.h | 36 +- src/H5Fmodule.h | 19 +- src/H5Fpublic.h | 2 + src/H5Gmodule.h | 25 +- src/H5Gpublic.h | 2 + src/H5Imodule.h | 81 +++- src/H5Ipublic.h | 33 +- src/H5Lmodule.h | 25 +- src/H5Lpublic.h | 2 + src/H5Mmodule.h | 6 +- src/H5Mpublic.h | 2 + src/H5Omodule.h | 41 +- src/H5Opublic.h | 681 ++++++--------------------------- src/H5PLmodule.h | 30 +- src/H5Pmodule.h | 164 ++++++-- src/H5Ppublic.h | 51 ++- src/H5Rmodule.h | 29 +- src/H5Rpublic.h | 10 +- src/H5Smodule.h | 45 ++- src/H5Spublic.h | 112 +++--- src/H5Tmodule.h | 36 +- src/H5VLmodule.h | 8 +- src/H5Zmodule.h | 109 +++--- src/H5module.h | 27 +- src/H5public.h | 30 +- 82 files changed, 4126 insertions(+), 2063 deletions(-) create mode 100644 doxygen/dox/APIVersions.dox delete mode 100644 doxygen/dox/H5Acreate.dox delete mode 100644 doxygen/dox/H5Aiterate.dox delete mode 100644 doxygen/dox/H5Fget_info.dox delete mode 100644 doxygen/dox/H5Lget_info.dox delete mode 100644 doxygen/dox/H5Lget_info_by_idx.dox delete mode 100644 doxygen/dox/H5Literate.dox delete mode 100644 doxygen/dox/H5Literate_by_name.dox delete mode 100644 doxygen/dox/H5Lvisit.dox delete mode 100644 doxygen/dox/H5Lvisit_by_name.dox delete mode 100644 doxygen/dox/H5Oget_info.dox delete mode 100644 doxygen/dox/H5Oget_info_by_idx.dox delete mode 100644 doxygen/dox/H5Oget_info_by_name.dox delete mode 100644 doxygen/dox/H5Ovisit.dox delete mode 100644 doxygen/dox/H5Ovisit_by_name.dox delete mode 100644 doxygen/dox/H5Sencode.dox create mode 100644 doxygen/dox/RFC.dox create mode 100644 doxygen/dox/cookbook/Accessibility.c create mode 100644 doxygen/dox/cookbook/Accessibility.dox create mode 100644 doxygen/dox/cookbook/Attributes.c create mode 100644 doxygen/dox/cookbook/Attributes.dox create mode 100644 doxygen/dox/cookbook/Files.c create mode 100644 doxygen/dox/cookbook/Files.dox create mode 100644 doxygen/dox/cookbook/Performance.dox create mode 100644 doxygen/examples/H5E_examples.c create mode 100644 doxygen/examples/H5G_examples.c create mode 100644 doxygen/examples/H5I_examples.c create mode 100644 doxygen/examples/H5L_examples.c create mode 100644 doxygen/examples/H5O_examples.c create mode 100644 doxygen/examples/H5PL_examples.c create mode 100644 doxygen/examples/H5P_examples.c create mode 100644 doxygen/examples/H5R_examples.c create mode 100644 doxygen/examples/H5S_examples.c create mode 100644 doxygen/examples/H5T_examples.c create mode 100644 doxygen/examples/H5Z_examples.c create mode 100644 doxygen/examples/H5_examples.c diff --git a/MANIFEST b/MANIFEST index a0f58ce..7c97bc1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -211,9 +211,9 @@ ./doc/branches-explained.md ./doc/code-conventions.md ./doc/contributing.md - ./doxygen/aliases ./doxygen/Doxyfile.in +./doxygen/dox/APIVersions.dox ./doxygen/dox/About.dox ./doxygen/dox/Cookbook.dox ./doxygen/dox/DDLBNF110.dox @@ -221,30 +221,23 @@ ./doxygen/dox/FileFormatSpec.dox ./doxygen/dox/GettingStarted.dox ./doxygen/dox/H5AC_cache_config_t.dox -./doxygen/dox/H5Acreate.dox -./doxygen/dox/H5Aiterate.dox -./doxygen/dox/H5Fget_info.dox -./doxygen/dox/H5Lget_info_by_idx.dox -./doxygen/dox/H5Lget_info.dox -./doxygen/dox/H5Literate_by_name.dox -./doxygen/dox/H5Literate.dox -./doxygen/dox/H5Lvisit_by_name.dox -./doxygen/dox/H5Lvisit.dox -./doxygen/dox/H5Oget_info_by_idx.dox -./doxygen/dox/H5Oget_info_by_name.dox -./doxygen/dox/H5Oget_info.dox -./doxygen/dox/H5Ovisit_by_name.dox -./doxygen/dox/H5Ovisit.dox -./doxygen/dox/H5Sencode.dox ./doxygen/dox/MetadataCachingInHDF5.dox ./doxygen/dox/OtherSpecs.dox ./doxygen/dox/Overview.dox ./doxygen/dox/ReferenceManual.dox +./doxygen/dox/RFC.dox ./doxygen/dox/Specifications.dox ./doxygen/dox/TechnicalNotes.dox ./doxygen/dox/api-compat-macros.dox ./doxygen/dox/maybe_metadata_reads.dox ./doxygen/dox/rm-template.dox +./doxygen/dox/cookbook/Accessibility.c +./doxygen/dox/cookbook/Accessibility.dox +./doxygen/dox/cookbook/Attributes.c +./doxygen/dox/cookbook/Attributes.dox +./doxygen/dox/cookbook/Files.c +./doxygen/dox/cookbook/Files.dox +./doxygen/dox/cookbook/Performance.dox ./doxygen/examples/FF-IH_FileGroup.gif ./doxygen/examples/FF-IH_FileObject.gif ./doxygen/examples/FileFormatSpecChunkDiagram.jpg @@ -256,13 +249,25 @@ ./doxygen/examples/H5.format.html ./doxygen/examples/H5A_examples.c ./doxygen/examples/H5D_examples.c +./doxygen/examples/H5E_examples.c ./doxygen/examples/H5Fclose.c ./doxygen/examples/H5Fcreate.c ./doxygen/examples/H5F_examples.c +./doxygen/examples/H5G_examples.c +./doxygen/examples/H5I_examples.c +./doxygen/examples/H5L_examples.c +./doxygen/examples/H5O_examples.c +./doxygen/examples/H5PL_examples.c ./doxygen/examples/H5Pget_metadata_read_attempts.1.c ./doxygen/examples/H5Pget_metadata_read_attempts.2.c ./doxygen/examples/H5Pget_metadata_read_attempts.3.c ./doxygen/examples/H5Pget_object_flush_cb.c +./doxygen/examples/H5P_examples.c +./doxygen/examples/H5R_examples.c +./doxygen/examples/H5S_examples.c +./doxygen/examples/H5T_examples.c +./doxygen/examples/H5Z_examples.c +./doxygen/examples/H5_examples.c ./doxygen/examples/ImageSpec.html ./doxygen/examples/PaletteExample1.gif ./doxygen/examples/Palettes.fm.anc.gif diff --git a/configure.ac b/configure.ac index 258f96c..fcb2924 100644 --- a/configure.ac +++ b/configure.ac @@ -1102,9 +1102,11 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then AC_SUBST([DOXYGEN_HTML_FOOTER]) AC_SUBST([DOXYGEN_HTML_EXTRA_STYLESHEET]) AC_SUBST([DOXYGEN_HTML_EXTRA_FILES]) + AC_SUBST([DOXYGEN_TAG_FILE]) AC_SUBST([DOXYGEN_SERVER_BASED_SEARCH]) AC_SUBST([DOXYGEN_EXTERNAL_SEARCH]) AC_SUBST([DOXYGEN_SEARCHENGINE_URL]) + AC_SUBST([DOXYGEN_PREDEFINED]) # SRCDIR Environment variables used inside doxygen macro for the source location: DOXYGEN_PACKAGE=${PACKAGE_NAME} @@ -1116,15 +1118,17 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then DOXYGEN_OPTIMIZE_OUTPUT_FOR_C=YES DOXYGEN_MACRO_EXPANSION=YES DOXYGEN_OUTPUT_DIRECTORY=hdf5lib_docs - DOXYGEN_EXAMPLES_DIRECTORY='$(SRCDIR)/doxygen/examples $(SRCDIR)/src $(SRCDIR)/examples $(SRCDIR)/test' + DOXYGEN_EXAMPLES_DIRECTORY='$(SRCDIR)/doxygen/dox/cookbook $(SRCDIR)/doxygen/examples $(SRCDIR)/src $(SRCDIR)/examples $(SRCDIR)/test' DOXYGEN_LAYOUT_FILE='$(SRCDIR)/doxygen/hdf5doxy_layout.xml' DOXYGEN_HTML_HEADER='$(SRCDIR)/doxygen/hdf5_header.html' DOXYGEN_HTML_FOOTER='$(SRCDIR)/doxygen/hdf5_footer.html' DOXYGEN_HTML_EXTRA_STYLESHEET='$(SRCDIR)/doxygen/hdf5doxy.css' DOXYGEN_HTML_EXTRA_FILES='$(SRCDIR)/doxygen/hdf5_navtree_hacks.js $(SRCDIR)/doxygen/img/ftv2node.png $(SRCDIR)/doxygen/img/ftv2pnode.png' + DOXYGEN_TAG_FILE=hdf5.tag DOXYGEN_SERVER_BASED_SEARCH=NO DOXYGEN_EXTERNAL_SEARCH=NO DOXYGEN_SEARCHENGINE_URL= + DOXYGEN_PREDEFINED='H5_HAVE_DIRECT H5_HAVE_LIBHDFS H5_HAVE_MAP_API H5_HAVE_PARALLEL H5_HAVE_ROS3_VFD' DX_INIT_DOXYGEN([HDF5], [./doxygen/Doxyfile], [hdf5lib_docs]) diff --git a/doc/contributing.md b/doc/contributing.md index 7f9e8d3..d32ab4d 100644 --- a/doc/contributing.md +++ b/doc/contributing.md @@ -1,10 +1,10 @@ # How to contribute to HDF5 -The HDF Group encourages community members to contribute to the HDF5 project. We accept and are very grateful for any contributions, +The HDF Group encourages community members to contribute to the HDF5 project. We accept and are very grateful for any contributions, from minor typos and bug fixes to new features. The HDF Group is committed to work with the code contributors and make contribution process enjoyable and straightforward. -This document describes guiding principles for the HDF5 code contributors and does not pretend to address any possible -contribution. If in doubt, please do not hesitate to ask us for guidance. +This document describes guiding principles for the HDF5 code contributors and does not pretend to address any possible +contribution. If in doubt, please do not hesitate to ask us for guidance. ***Note that no contribution may be accepted unless the donor agrees with the HDF Group software license terms found in the COPYING file in every branch's top source directory.*** @@ -23,38 +23,38 @@ The process for contributing code to HDF5 is as follows: * Open an issue on [HDF5 GitHub](https://github.com/HDFGroup/hdf5/issues). -> This step is ***required*** unless the change is minor (e.g., typo fix). +> This step is ***required*** unless the change is minor (e.g., typo fix). * Fork the [HDF5](https://github.com/HDFGroup/hdf5) repository. * Make the desired changes to the HDF5 software. * New features should always go to _develop_ branch first and later should be merged to the appropriate maintenance branches. - * Bug fixes should go to all appropriate branches (_develop_ and maintenance). + * Bug fixes should go to all appropriate branches (_develop_ and maintenance). * Build and test your changes. Detailed instructions on building and testing HDF5 can be found in the `INSTALL*` files in the `release_docs` directory. * Push your changes to GitHub. * Issue a pull request and address any code formatting and testing issues reported. Once a pull request is correctly formatted and passes **ALL** CI tests, it will be reviewed and evaluated by The HDF Group developers and HDF5 community members who can approve pull requests. -The HDF Group developers will work with you to ensure that the pull request satisfies the acceptance criteria described in the next section. +The HDF Group developers will work with you to ensure that the pull request satisfies the acceptance criteria described in the next section. # Acceptance criteria for a pull request We appreciate every contribution we receive, but we may not accept them all. Those that we *do* satisfy the following criteria: -* **The pull request has a clear purpose** - What does the pull request address? How does it benefit the HDF5 community? -If the pull request does not have a clear purpose and benefits, it will not be accepted. +* **The pull request has a clear purpose** - What does the pull request address? How does it benefit the HDF5 community? +If the pull request does not have a clear purpose and benefits, it will not be accepted. * **The pull request is documented** - The HDF5 developers must understand not only *what* a change is doing, but *how* it is doing it. - Documenting the code makes it easier for us to understand your patch and maintain the code in the future. + Documenting the code makes it easier for us to understand your patch and maintain the code in the future. -* **The pull request passes HDF5 regression testing** - Any issue fixed or functionality added should be accompanied by the corresponding -tests and pass HDF5 regression testing run by The HDF Group. We do not expect you to perform comprehensive testing across multiple platforms -before we accept the pull request. If the pull request does not pass regression testing after the merge, The HDF Group developers will work with you on the fixes. +* **The pull request passes HDF5 regression testing** - Any issue fixed or functionality added should be accompanied by the corresponding +tests and pass HDF5 regression testing run by The HDF Group. We do not expect you to perform comprehensive testing across multiple platforms +before we accept the pull request. If the pull request does not pass regression testing after the merge, The HDF Group developers will work with you on the fixes. -* **The pull request does not compromise the principles behind HDF5** - HDF5 has a 100% commitment to backward compatibility. +* **The pull request does not compromise the principles behind HDF5** - HDF5 has a 100% commitment to backward compatibility. * Any file ever created with HDF5 must be readable by any future version of HDF5. If your patch's purpose is to modify the HDF5 data model or file format, - **please** discuss this with us first. File format changes and features required by those changes can be introduced only in a new major release. - * HDF5 has a commitment to remaining *machine-independent*; data created on one platform/environment/architecture **must** remain readable by HDF5 on any other. + **please** discuss this with us first. File format changes and features required by those changes can be introduced only in a new major release. + * HDF5 has a commitment to remaining *machine-independent*; data created on one platform/environment/architecture **must** remain readable by HDF5 on any other. * For binary compatibility, no changes are allowed to public APIs and data structures in the maintenance releases; new APIs can be added. * **New features are documented** - Any new features should have proper documentation; talk to us if you have any questions. @@ -64,7 +64,7 @@ before we accept the pull request. If the pull request does not pass regression Please make sure that you check the items applicable to your pull request: -* Code +* Code * [ ] Does the pull request have a corresponding GitHub issue and clear purpose? * [ ] Does the pull request follow HDF5 best practices (naming conventions, code portability, code structure, etc.)? <> * [ ] If changes were done to Autotools build, were they added to CMake and vice versa? @@ -74,7 +74,7 @@ Please make sure that you check the items applicable to your pull request: * Documentation * [ ] Was the change described in the release_docs/RELEASE.txt file? * [ ] Was MANIFEST updated if new files had been added to the source? - * [ ] Was the new function documented in the corresponding public header file using Doxygen? <> + * [ ] Was the new function documented in the corresponding public header file using [Doxygen](https://docs.hdfgroup.org/hdf5/develop/_r_m_t.html)? * [ ] Was new functionality documented for the HDF5 community (the level of documentation depends on the feature; ask us what would be appropriate) * Testing * [ ] Does the pull request have tests? @@ -83,4 +83,3 @@ Please make sure that you check the items applicable to your pull request: We want as many contributions as we can get, and we are here to help. Feel free to reach out to us if you have any questions Thank you for your contribution! - diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in index 29f3028..4af590b 100644 --- a/doxygen/Doxyfile.in +++ b/doxygen/Doxyfile.in @@ -858,16 +858,21 @@ FILE_PATTERNS = H5*public.h \ H5FDcore.h \ H5FDdirect.h \ H5FDfamily.h \ + H5FDhdfs.h \ H5FDlog.h \ + H5FDmirror.h \ H5FDmpi.h \ H5FDmpio.h \ H5FDmulti.h \ + H5FDros3.h \ H5FDsec2.h \ + H5FDsplitter.h \ H5FDstdio.h \ H5FDwindows.h \ H5VLconnector.h \ H5VLconnector_passthru.h \ H5VLnative.h \ + H5Zdevelop.h \ H5version.h \ *.dox @@ -2177,7 +2182,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = H5_HAVE_PARALLEL +PREDEFINED = @DOXYGEN_PREDEFINED@ # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2221,7 +2226,7 @@ TAGFILES = # tag file that is based on the input files it reads. See section "Linking to # external documentation" for more information about the usage of tag files. -GENERATE_TAGFILE = +GENERATE_TAGFILE = @DOXYGEN_TAG_FILE@ # If the ALLEXTERNALS tag is set to YES, all external class will be listed in # the class index. If set to NO, only the inherited external classes will be diff --git a/doxygen/aliases b/doxygen/aliases index af43902..ab6d8ea 100644 --- a/doxygen/aliases +++ b/doxygen/aliases @@ -16,11 +16,17 @@ ALIASES += success{1}="\Bold{Success:} \1" ALIASES += failure{1}="\Bold{Failure:} \1" ALIASES += herr_t="Returns a non-negative value if successful; otherwise returns a negative value." +ALIASES += herr_t_iter="\li Zero causes the iterator to continue, returning zero when the iteration is complete. \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." ALIASES += hid_t{1}="Returns a \1 identifier if successful; otherwise returns #H5I_INVALID_HID. " ALIASES += hid_ti{1}="Returns an \1 identifier if successful; otherwise returns #H5I_INVALID_HID. " ALIASES += hid_tv{1}="Returns an \1 identifier if successful; otherwise returns a negative value. " ALIASES += htri_t="Returns zero (false), a positive (true) or a negative (failure) value." +ALIASES += api_vers_2{3}="\1() is a macro that is mapped to either \2() or \3().\n\see \ref api-compat-macros" +ALIASES += api_vers_3{4}="\1() is a macro that is mapped to either \2() or \3() or \4().\n\see \ref api-compat-macros" + +ALIASES += deprecation_note{1}="\deprecated Superseded by \1." + ################################################################################ # General ################################################################################ @@ -131,6 +137,8 @@ ALIASES += map_id{1}="\param[in] \1 Map identifier" # Property lists ################################################################################ +ALIASES += plist_unused{1}="\note The \p \1 parameter is currently not used; specify #H5P_DEFAULT." + ALIASES += aapl_id="\param[in] aapl_id Attribute access property list identifier" ALIASES += aapl_id{1}="\param[in] \1 Attribute access property list identifier" @@ -217,9 +225,8 @@ ALIASES += es_id{1}="\param[in] \1 Event set identifier" # Others ################################################################################ -ALIASES += estack_id="\param[in] estack_id Error stack identifier" -ALIASES += estack_id{1}="\param[in] \1 Error stack identifier" ALIASES += cpp_c_api_note="\attention \Bold{C++ Developers using HDF5 C-API functions beware:}\n Several functions in this C-API take function pointers or callbacks as arguments. Examples include H5Pset_elink_cb(), H5Pset_type_conv_cb(), H5Tconvert(), and H5Ewalk2(). Application code must ensure that those callback functions return normally such to allow the HDF5 to manage its resources and maintain a consistent state. For instance, those functions must not use the C \c setjmp / \c longjmp mechanism to leave those callback functions. Within the context of C++, any exceptions thrown within the callback function must be caught, such as with a \Code{catch(…)} statement. Any exception state can be placed within the provided user data function call arguments, and may be thrown again once the calling function has returned. Exceptions raised and not handled inside the callback are not supported as it might leave the HDF5 library in an inconsistent state. Similarly, using C++20 coroutines cannot be used as callbacks, since they do not support plain return statements. If a callback function yields execution to another C++20 coroutine calling HDF5 functions as well, this may lead to undefined behavior." +ALIASES += par_compr_note="\attention If you are planning to use compression with parallel HDF5, ensure that calls to H5Dwrite() occur in collective mode. In other words, all MPI ranks (in the relevant communicator) call H5Dwrite() and pass a dataset transfer property list with the MPI-IO collective option property set to #H5FD_MPIO_COLLECTIVE_IO.\n Note that data transformations are currently \Bold{not} supported when writing to datasets in parallel and with compression enabled." ALIASES += sa_metadata_ops="\sa \li H5Pget_all_coll_metadata_ops() \li H5Pget_coll_metadata_write() \li H5Pset_all_coll_metadata_ops() \li H5Pset_coll_metadata_write() \li \ref maybe_metadata_reads" ################################################################################ @@ -241,6 +248,95 @@ ALIASES += ref_vlen_strings="\Emph{Creating variable-length string datatypes}" ALIASES += ref_vol_doc="VOL documentation" ################################################################################ +# RFCs +################################################################################ + +ALIASES += ref_rfc20210528="Multi-Thread HDF5" +ALIASES += ref_rfc20190923="Virtual Object Layer (VOL) API Compatibility" +ALIASES += ref_rfc20190410="A Plugin Interface for HDF5 Virtual File Drivers" +ALIASES += ref_rfc20181231="Dataset Object Header Size" +ALIASES += ref_rfc20181220="MS 3.2 – Addressing Scalability: Scalability of open, close, flush CASE STUDY: CGNS Hotspot analysis of CGNS cgp_open" +ALIASES += ref_rfc20180620="Chunk query functionality in HDF5" +ALIASES += ref_rfc20180610="VFD SWMR" +ALIASES += ref_rfc20180321="API Contexts" +ALIASES += ref_rfc20180125="Enhancement to the tool h5clear" +ALIASES += ref_rfc20170707="H5Sencode/H5Sdecode Format Change" +ALIASES += ref_rfc20160105="Setting Bounds for Object Creation in HDF5 1.10.0" +ALIASES += ref_rfc20150915="File Format Changes in HDF5 1.10.0" +ALIASES += ref_rfc20150709="Page Buffering" +ALIASES += ref_rfc20150615="Metadata Cache Image" +ALIASES += ref_rfc20150429="New Datatypes" +ALIASES += ref_rfc20150424="Collective Metadata Writes" +ALIASES += ref_rfc20150423="Enabling Collective Metadata Reads" +ALIASES += ref_rfc20150301="The Tool to Handle HDF5 File Format Compatibility for Chunked Datasets" +ALIASES += ref_rfc20150212="H5LTget_hardlinks – High-level API to list all the hard links to an object" +ALIASES += ref_rfc20150205="HDF5 Fortran Wrappers Maintenance: Dropping Support for Non-Fortran 2003 Standard Compliant Compilers" +ALIASES += ref_rfc20150202="New Autotools Behavior" +ALIASES += ref_rfc20141210="HDF5 Virtual Dataset" +ALIASES += ref_rfc20141201="Allocate/Free Mismatches in HDF5 Filter Code on Windows" +ALIASES += ref_rfc20140916="Virtual Object Layer" +ALIASES += ref_rfc20140827="Chunking and Compression Performance Tool Requirements" +ALIASES += ref_rfc20140729="Replacing H5Fis_hdf5() with H5Fis_accessible()" +ALIASES += ref_rfc20140722="Switching to a 64-bit hid_t Space in HDF5" +ALIASES += ref_rfc20140717="Data Analysis Extensions" +ALIASES += ref_rfc20140707="Virtual Object Layer" +ALIASES += ref_rfc20140524="HDF5 Compression Demystified" +ALIASES += ref_rfc20140318="Freeing Memory Allocated by the HDF5 Library" +ALIASES += ref_rfc20140313="Options to handle compatibility issues for HDF5 files" +ALIASES += ref_rfc20140224="Design: Metadata Cache Logging" +ALIASES += ref_rfc20131211="Fine-Grained Control of Metadata Cache Flushes" +ALIASES += ref_rfc20130930="Read Attempts for Metadata with Checksum" +ALIASES += ref_rfc20130919="Core VFD Backing Store Paged Writes" +ALIASES += ref_rfc20130630="Flush Dependency Testing" +ALIASES += ref_rfc20130316="HDF5 Dynamically Loaded Filters" +ALIASES += ref_rfc20121114="Direct Chunk Write" +ALIASES += ref_rfc20121024="HDF5 File Space Management" +ALIASES += ref_rfc20120828="New HDF5 API Routines for HPC Applications" +ALIASES += ref_rfc20120523="HDF5 File Space Management: Paged Aggregation" +ALIASES += ref_rfc20120501="HDF5 File Image Operations" +ALIASES += ref_rfc20120305="Enabling a Strict Consistency Semantics Model in Parallel HDF5" +ALIASES += ref_rfc20120220="h5repack: Improved Hyperslab selections for Large Chunked Datasets" +ALIASES += ref_rfc20120120="A Maintainer’s Guide for the Datatype Module in HDF5 Library" +ALIASES += ref_rfc20120104="Actual I/O Mode" +ALIASES += ref_rfc20111119="New public functions to handle comparison" +ALIASES += ref_rfc20110825="Merging Named Datatypes in H5Ocopy()" +ALIASES += ref_rfc20110811="Expanding the HDF5 Hyperslab Selection Interface" +ALIASES += ref_rfc20110726="HDF5 File Space Allocation and Aggregation" +ALIASES += ref_rfc20110614=" Refactor h5dump to Improve Maintenance" +ALIASES += ref_rfc20110329="Support External Link Open File Cache in HDF5 Tools" +ALIASES += ref_rfc20110118="h5diff Attribute Comparisons" +ALIASES += ref_rfc20101122="SWMR Timeouts" +ALIASES += ref_rfc20101104="Caching Files Opened Through External Links" +ALIASES += ref_rfc20101018="HDF5 File and Object Comparison Specification" +ALIASES += ref_rfc20100902="h5edit – An HDF5 File Editing Tool" +ALIASES += ref_rfc20100727="Reserved Characters for HDF5 Applications" +ALIASES += ref_rfc20100726="High-Level HDF5 API routines for HPC Applications" +ALIASES += ref_rfc20100511="h5diff – Exclude Object(s) from Comparison" +ALIASES += ref_rfc20100422="Generating attributes into an object with a tool" +ALIASES += ref_rfc20100312="Supporting HDF5 1.8 in HDF5 Command Line Tools" +ALIASES += ref_rfc20091218="Supporting soft-link and external-link for h5diff" +ALIASES += ref_rfc20090907="HDF5 Tools Library Functions" +ALIASES += ref_rfc20090612="Default EPSILON values for comparing floating point data" +ALIASES += ref_rfc20081218="Reporting of Non-Comparable Datasets by h5diff" +ALIASES += ref_rfc20080915="Performance Report for Free-space Manager" +ALIASES += ref_rfc20080904="Setting File Access Property List for accessing External Link" +ALIASES += ref_rfc20080301="Dynamic Transformations to HDF5 Data" +ALIASES += ref_rfc20080209="Using SVN branching to improve software development process at THG" +ALIASES += ref_rfc20080206="Maintaining the HISTORY.txt and RELEASE.txt files in HDF5" +ALIASES += ref_rfc20071111="Addressing HDF5 file corruption issue" +ALIASES += ref_rfc20071018="NaN detection in HDF5" +ALIASES += ref_rfc20070801="Metadata Journaling to Improve Crash Survivability" +ALIASES += ref_rfc20070413="API Compatibility Strategies for HDF5" +ALIASES += ref_rfc20070115="A "Private" Heap for HDF5" +ALIASES += ref_rfc20060623="Performance Comparison of Collective I/O and Independent I/O with Derived Datatypes" +ALIASES += ref_rfc20060604="h5stat tool" +ALIASES += ref_rfc20060505="Simple Performance Test on Fletcher32 Filter" +ALIASES += ref_rfc20060410="Requirement Specifications of an HDF5 File Format Validation Tool" +ALIASES += ref_rfc20060317="Proposed changes to the sec2 driver " +ALIASES += ref_rfc20060124="Mapping FITS data to HDF5" +ALIASES += ref_rfc20040811="Conversion Between Text and Datatype" + +################################################################################ # The Usual Suspects ################################################################################ diff --git a/doxygen/dox/APIVersions.dox b/doxygen/dox/APIVersions.dox new file mode 100644 index 0000000..3658f06 --- /dev/null +++ b/doxygen/dox/APIVersions.dox @@ -0,0 +1,173 @@ +/** + * \ingroup H5A + * \def H5Acreate + * \api_vers_2{H5Acreate,H5Acreate1,H5Acreate2} + */ + +/** + * \ingroup H5A + * \def H5Aiterate + * \api_vers_2{H5Aiterate,H5Aiterate1,H5Aiterate2} + */ + +/** + * \ingroup H5D + * \def H5Dcreate + * \api_vers_2{H5Dcreate,H5Dcreate1,H5Dcreate2} + */ + +/** + * \ingroup H5E + * \def H5Eget_auto + * \api_vers_2{H5Eget_auto,H5Eget_auto1,H5Eget_auto2} + */ + +/** + * \ingroup H5E + * \def H5Eprint + * \api_vers_2{H5Eprint,H5Eprint1,H5Eprint2} + */ + +/** + * \ingroup H5E + * \def H5Epush + * \api_vers_2{H5Epush,H5Epush1,H5Epush2} + */ + +/** + * \ingroup H5E + * \def H5Eset_auto + * \api_vers_2{H5Eset_auto,H5Eset_auto1,H5Eset_auto2} + */ + +/** + * \ingroup H5E + * \def H5Ewalk + * \api_vers_2{H5Ewalk,H5Ewalk1,H5Ewalk2} + */ + +/** + * \ingroup H5F + * \def H5Fget_info + * \api_vers_2{H5Fget_info,H5Fget_info1,H5Fget_info2} + */ + +/** + * \ingroup H5G + * \def H5Gcreate + * \api_vers_2{H5Gcreate,H5Gcreate1,H5Gcreate2} + */ + +/** + * \ingroup H5G + * \def H5Gopen + * \api_vers_2{H5Gopen,H5Gopen1,H5Gopen2} + */ + +/** + * \ingroup H5L + * \def H5Lget_info + * \api_vers_2{H5Lget_info,H5Lget_info1,H5Lget_info2} + */ + +/** + * \ingroup H5L + * \def H5Lget_info_by_idx + * \api_vers_2{H5Lget_info_by_idx,H5Lget_info_by_idx1,H5Lget_info_by_idx2} + */ + +/** + * \ingroup TRAV + * \def H5Literate + * \api_vers_2{H5Literate,H5Literate1,H5Literate2} + */ + +/** + * \ingroup TRAV + * \def H5Literate_by_name + * \api_vers_2{H5Literate_by_name,H5Literate_by_name1,H5Literate_by_name2} + */ + +/** + * \ingroup TRAV + * \def H5Lvisit + * \api_vers_2{H5Lvisit,H5Lvisit1,H5Lvisit2} + */ + +/** + * \ingroup TRAV + * \def H5Lvisit_by_name + * \api_vers_2{H5Lvisit_by_name,H5Lvisit_by_name1,H5Lvisit_by_name2} + */ + +/** + * \ingroup H5O + * \def H5Oget_info + * \api_vers_3{H5Oget_info,H5Oget_info1,H5Oget_info2,H5Oget_info3} + */ + +/** + * \ingroup H5O + * \def H5Oget_info_by_idx + * \api_vers_3{H5Oget_info_by_idx,H5Oget_info_by_idx1,H5Oget_info_by_idx2,H5Oget_info_by_idx3} + */ + +/** + * \ingroup H5O + * \def H5Oget_info_by_name + * \api_vers_3{H5Oget_info_by_name,H5Oget_info_by_name1,H5Oget_info_by_name2,H5Oget_info_by_name3} + */ + +/** + * \ingroup H5O + * \def H5Ovisit + * \api_vers_3{H5Ovisit,H5Ovisit1,H5Ovisit2,H5Ovisit3} + */ + +/** + * \ingroup H5O + * \def H5Ovisit_by_name + * \api_vers_3{H5Ovisit_by_name,H5Ovisit_by_name1,H5Ovisit_by_name2,H5Ovisit_by_name3} + */ + +/** + * \ingroup H5R + * \def H5Rdereference + * \api_vers_2{H5Rdereference,H5Rdereference1,H5Rdereference2} + */ + +/** + * \ingroup H5R + * \def H5Rget_obj_type + * \api_vers_3{H5Rget_obj_type,H5Rget_obj_type1,H5Rget_obj_type2,H5R_get_obj_type3} + */ + +/** + * \ingroup H5S + * \def H5Sencode + * \api_vers_2{H5Sencode,H5Sencode1,H5Sencode2} + */ + +/** + * \ingroup H5T + * \def H5Tcommit + * \api_vers_2{H5Tcommit,H5Tcommit1,H5Tcommit2} + */ + +/** + * \ingroup H5T + * \def H5Topen + * \api_vers_2{H5Topen,H5Topen1,H5Topen2} + */ + +/** + * \ingroup ARRAY + * \def H5Tarray_create + * \api_vers_2{H5Tarray_create,H5Tarray_create1,H5Tarray_create2} + */ + +/** + * \ingroup ARRAY + * \def H5Tget_array_dims + * \api_vers_2{H5Tget_array_dims,H5Tget_array_dims1,H5Tget_array_dims2} + */ diff --git a/doxygen/dox/About.dox b/doxygen/dox/About.dox index 3be9202..32930a8 100644 --- a/doxygen/dox/About.dox +++ b/doxygen/dox/About.dox @@ -1,5 +1,7 @@ /** \page About About +\section about_history History + The implementation of this documentation set is based on the fantastic work of the Eigen project. Please refer to their GitLab repository @@ -8,4 +10,14 @@ and the online version of their Not only does Eigen set a standard as a piece of software, but also as an example of documentation done right. +\section about_documentation Documentation about Documentation + +\li \todo Describe how to add a reference or a new RFC +\li \todo Describe how to add an example +\li \todo Describe how to include plain HTML +\li \todo Describe how to add an API macro +\li \todo Describe the custom commands +\li \todo Describe the S3 bucket layout and update routine +\li \todo Link the RM template + */ \ No newline at end of file diff --git a/doxygen/dox/Cookbook.dox b/doxygen/dox/Cookbook.dox index 4abc896..56523e2 100644 --- a/doxygen/dox/Cookbook.dox +++ b/doxygen/dox/Cookbook.dox @@ -2,4 +2,18 @@ Healthy, everyday recipes for every taste and budget... +\ref Files +\li \ref CB_FreeSpace +\li \ref CB_RemoveUnusedSpace +\li \ref CB_UserBlock + +\ref Attributes +\li \ref CB_LargeAttributes + +\ref Accessibility +\li \ref CB_MaintainCompat + +\ref Performance +\li \ref CB_MDCPerf + */ \ No newline at end of file diff --git a/doxygen/dox/H5Acreate.dox b/doxygen/dox/H5Acreate.dox deleted file mode 100644 index 18d648f..0000000 --- a/doxygen/dox/H5Acreate.dox +++ /dev/null @@ -1,9 +0,0 @@ -/** - * \ingroup H5A - * \def H5Acreate() - * H5Acreate() is a macro that is mapped to either H5Acreate1() or - * H5Acreate2(). - * - * - * \todo Standardize the way we describe these macros! - */ diff --git a/doxygen/dox/H5Aiterate.dox b/doxygen/dox/H5Aiterate.dox deleted file mode 100644 index 46b9bb4..0000000 --- a/doxygen/dox/H5Aiterate.dox +++ /dev/null @@ -1,9 +0,0 @@ -/** - * \ingroup H5A - * \def H5Aiterate() - * H5Aiterate() is a macro that is mapped to either H5Aiterate1() or - * H5Aiterate2(). - * - * - * \todo Standardize the way we describe these macros! - */ diff --git a/doxygen/dox/H5Fget_info.dox b/doxygen/dox/H5Fget_info.dox deleted file mode 100644 index 9b02752..0000000 --- a/doxygen/dox/H5Fget_info.dox +++ /dev/null @@ -1,44 +0,0 @@ -/** - * \ingroup H5F - * \def H5Fget_info() - * H5Fget_info() is a macro that is mapped to either H5Fget_info1() - * or H5Fget_info2(), depending on the needs of the application. - * Similarly, the macro for the \ref H5F_info_t struct is mapped to either - * H5F_info1_t or H5F_info2_t. - * - * Such macros are provided to facilitate application compatibility. - * Their use and mappings are fully described in \ref api-compat-macros. - * - * When both the HDF5 library and the application are built and installed with - * no specific compatibility flags, H5Fget_info() is mapped to the most recent - * version of the function, currently H5Fget_info2(). If the library and/or - * application is compiled for Release 1.8 emulation, H5Fget_info() will be - * mapped to H5Fget_info1(). Since there was no H5Fget_info() function in - * Release 1.6, if the library and/or application is compiled for Release 1.6 - * emulation, H5Fget_info() will be mapped to the most recent version of the - * function, currently H5Fget_info2(). Function-specific flags are available to - * override these settings on a function-by-function basis when the application - * is compiled. - * - * Specific compile-time compatibility flags and the resulting - * mappings are as follows: - * - * \Bold{Global settings}\n - * \li No compatibility flag: H5Fget_info2() and H5F_info2_t - * \li Enable deprecated symbols: H5Fget_info2() and H5F_info2_t - * \li Disable deprecated symbols: H5Fget_info2() and H5F_info2_t - * \li Emulate Release 1.6 interface: H5Fget_info2() and H5F_info2_t - * \li Emulate Release 1.8 interface: H5Fget_info1() and H5F_info1_t - * - * \Bold{Function- and struct-level macros}\n - * \li \Code{H5Fget_info_vers=2}: H5Fget_info2() - * \li \Code{H5Fget_info_vers=1}: H5Fget_info1() - * \li \Code{H5F_info_t_vers=2}: H5F_info2_t - * \li \Code{H5F_info_t_vers=1}: H5F_info1_t - * - * \version 1.10.0 The C function H5Fget_info() and H5F_info_t renamed to - * H5Fget_info1() and H5F_info1_t, respectively, and deprecated - * in this release. The C macro #H5Fget_info, the C function - * H5Fget_info2(), and the struct H5F_info2_t introduced in this - * release. - */ diff --git a/doxygen/dox/H5Lget_info.dox b/doxygen/dox/H5Lget_info.dox deleted file mode 100644 index 2c0971e..0000000 --- a/doxygen/dox/H5Lget_info.dox +++ /dev/null @@ -1,17 +0,0 @@ - /** - * \ingroup LMGT - * \def H5Lget_info() - * H5Lget_info() is a macro that is mapped to either H5Lget_info1() - * or H5Lget_info2() Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in \ref api-compat-macros. - * If the library and/or application is compiled for Release - * 1.12 emulation, H5Lget_info() will be mapped to H5Lget_info2() and - * H5Lget_info1() is deprecated. With earlier versions, H5Lget_info() is mapped to - * H5Lget_info1(). Specific compile-time compatibility flags and the resulting - * mappings are as follows: - * \li No compatibility flag: H5Lget_info2() (using 1.12 source) H5Lget_info1() - * (using 1.10 or 1.8 source) - * \li Emulate Release 1.12: H5Lget_info2() - * \li Emulate Release 1.8 or 1.10 interface: H5Lget_info1() - * - */ diff --git a/doxygen/dox/H5Lget_info_by_idx.dox b/doxygen/dox/H5Lget_info_by_idx.dox deleted file mode 100644 index bf76822..0000000 --- a/doxygen/dox/H5Lget_info_by_idx.dox +++ /dev/null @@ -1,17 +0,0 @@ - /** - * \ingroup LMGT - * \def H5Lget_info_by_idx() - * H5Lget_info_by_idx() is a macro that is mapped to either H5Lget_info_by_idx1() - * or H5Lget_info_by_idx2() Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in \ref api-compat-macros. - * If the library and/or application is compiled for Release - * 1.12 emulation, H5Lget_info_by_idx() will be mapped to H5Lget_info_by_idx2() and - * H5Lget_info_by_idx1() is deprecated. With earlier versions, H5Lget_infoby_idx() is mapped to - * H5Lget_info_by_idx1(). Specific compile-time compatibility flags and the resulting - * mappings are as follows: - * \li No compatibility flag: H5Lget_info_by_idx2() (using 1.12 source) H5Lget_info_by_idx1() - * (using 1.10 or 1.8 source) - * \li Emulate Release 1.12: H5Lget_info_by_idx2() - * \li Emulate Release 1.8 or 1.10 interface: H5Lget_info_by_idx1() - * - */ diff --git a/doxygen/dox/H5Literate.dox b/doxygen/dox/H5Literate.dox deleted file mode 100644 index eaaf2fe..0000000 --- a/doxygen/dox/H5Literate.dox +++ /dev/null @@ -1,20 +0,0 @@ -/** - * \ingroup TRAV - * \def H5Literate() - * H5Literate() is a macro that is mapped to either H5Literate1() or - * H5Literate2() Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in - * \ref api-compat-macros. If the library and/or application is - * compiled for Release 1.12 emulation, H5Literate() will be mapped to - * H5Literate2() and H5Literate1() is deprecated. With earlier versions, - * H5Literate() is mapped to H5Literate1(). Specific compile-time compatibility - * flags and the resulting mappings are as follows: - * \li No compatibility flag: H5Literate2() (using 1.12 source) H5Literate1() - * (using 1.10 or 1.8 source) - * \li Emulate Release 1.12: H5Literate2() - * \li Emulate Release 1.8 or 1.10 interface: H5Literate1() - * - * \version 1.12.0 The function H5Literate() was renamed to H5Literate1() and - * deprecated in this release. The macro H5Literate() and the - * function H5Literate2() were introduced in this release. - */ diff --git a/doxygen/dox/H5Literate_by_name.dox b/doxygen/dox/H5Literate_by_name.dox deleted file mode 100644 index 5ffd7c6..0000000 --- a/doxygen/dox/H5Literate_by_name.dox +++ /dev/null @@ -1,21 +0,0 @@ -/** - * \ingroup TRAV - * \def H5Literate_by_name() - * H5Literate_by_name() is a macro that is mapped to either - * H5Literate_by_name1() or H5Literate_by_name2() Such macros are provided to - * facilitate application compatibility. Their use and mappings are fully - * described in \ref api-compat-macros. If the library and/or application is - * compiled for Release 1.12 emulation, H5Literate_by_name() will be mapped to - * H5Literate_by_name2() and H5Literate_by_name1() is deprecated. With earlier - * versions, H5Literate_by_name() is mapped to H5Literate_by_name1(). - * Specific compile-time compatibility flags and the resulting mappings are as - * follows: - * \li No compatibility flag: H5Literate_by_name2() (using 1.12 source) - * H5Literate_by_name1() (using 1.10 or 1.8 source) - * \li Emulate Release 1.12: H5Literate_by_name2() - * \li Emulate Release 1.8 or 1.10 interface: H5Literate_by_name1() - * - * \version 1.12.0 The function H5Literate_by_name() was renamed to H5Literate_by_name1() and - * deprecated in this release. The macro H5Literate_by_name() and the - * function H5Literate_by_name2() were introduced in this release. - */ diff --git a/doxygen/dox/H5Lvisit.dox b/doxygen/dox/H5Lvisit.dox deleted file mode 100644 index 2dc547f..0000000 --- a/doxygen/dox/H5Lvisit.dox +++ /dev/null @@ -1,20 +0,0 @@ -/** - * \ingroup TRAV - * \def H5Lvisit() - * H5Lvisit() is a macro that is mapped to either H5Lvisit1() or - * H5Lvisit2() Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in - * \ref api-compat-macros. If the library and/or application is - * compiled for Release 1.12 emulation, H5Lvisit() will be mapped to - * H5Lvisit2() and H5Lvisit1() is deprecated. With earlier versions, - * H5Lvisit() is mapped to H5Lvisit1(). Specific compile-time compatibility - * flags and the resulting mappings are as follows: - * \li No compatibility flag: H5Lvisit2() (using 1.12 source) H5Lvisit1() - * (using 1.10 or 1.8 source) - * \li Emulate Release 1.12: H5Lvisit2() - * \li Emulate Release 1.8 or 1.10 interface: H5Lvisit1() - * - * \version 1.12.0 The function H5Lvisit() was renamed to H5Lvisit1() and - * deprecated in this release. The macro H5Lvisit() and the - * function H5Lvisit2() were introduced in this release. - */ diff --git a/doxygen/dox/H5Lvisit_by_name.dox b/doxygen/dox/H5Lvisit_by_name.dox deleted file mode 100644 index 691787f..0000000 --- a/doxygen/dox/H5Lvisit_by_name.dox +++ /dev/null @@ -1,20 +0,0 @@ -/** - * \ingroup TRAV - * \def H5Lvisit_by_name() - * H5Lvisit_by_name() is a macro that is mapped to either H5Lvisit_by_name1() or - * H5Lvisit_by_name2() Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in - * \ref api-compat-macros. If the library and/or application is - * compiled for Release 1.12 emulation, H5Lvisit_by_name() will be mapped to - * H5Lvisit_by_name2() and H5Lvisit_by_name1() is deprecated. With earlier versions, - * H5Lvisit_by_name() is mapped to H5Lvisit_by_name1(). Specific compile-time - * compatibility flags and the resulting mappings are as follows: - * \li No compatibility flag: H5Lvisit_by_name2() (using 1.12 source) H5Lvisit_by_name1() - * (using 1.10 or 1.8 source) - * \li Emulate Release 1.12: H5Lvisit_by_name2() - * \li Emulate Release 1.8 or 1.10 interface: H5Lvisit_by_name1() - * - * \version 1.12.0 The function H5Lvisit_by_name() was renamed to H5Lvisit_by_name1() and - * deprecated in this release. The macro H5Lvisit_by_name() and the - * function H5Lvisit_by_name2() were introduced in this release. - */ diff --git a/doxygen/dox/H5Oget_info.dox b/doxygen/dox/H5Oget_info.dox deleted file mode 100644 index ee4cd1c..0000000 --- a/doxygen/dox/H5Oget_info.dox +++ /dev/null @@ -1,72 +0,0 @@ -/** - * \ingroup H5O - * \def H5Oget_info - * - * #H5Oget_info is a macro that is mapped to: - * \li #H5Oget_info3 - * \li #H5Oget_info1 - * - * \details Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in - * API Compatibility Macros in HDF5; we urge you to read that - * document closely. - * - * In HDF5 versions 1.12 and after, #H5Oget_info is mapped to - * #H5Oget_info3 and #H5Oget_info1 is deprecated. - * In version 1.10 #H5Oget_info is identical to #H5Oget_info1. - * - * Specific compile-time compatibility flags and the resulting - * mappings are as follows: - * \par - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Compatibility settingH5Oget_info
    No compatibility flag \n  #H5Oget_info3 (in release 1.12) \n - * #H5Oget_info1 (in 1.8 or 1.10)
    Emulate Release 1.12#H5Oget_info3
    Emulate Release 1.10/1.8 interface#H5Oget_info1
    - * - * \note If you are iterating through a lot of different objects to - * retrieve information via the #H5Oget_info family of routines, - * you may see memory building up. This can be due to memory - * allocation for metadata such as object headers and messages - * when the iterated objects are put into the metadata cache. - * \note - * If the memory buildup is not desirable, you can configure a - * smaller cache via #H5Fset_mdc_config or set the file access - * property list via #H5Pset_mdc_config. A smaller sized cache - * will force metadata entries to be evicted from the cache, - * thus freeing the memory associated with the entries. - * - * \version 1.12.0 The macro #H5Oget_info and the function #H5Oget_info3 - * were added, and #H5Oget_info1 was deprecated. - * \version 1.10.5 The macro #H5Oget_info was removed. The functions - * #H5Oget_info1 and #H5Oget_info are identical - * in this release. This change was added to restore the - * broken API compatibility introduced in HDF5-1.10.3. - * \version 1.10.3 The function #H5Oget_info was renamed - * #H5Oget_info1. The macro #H5Oget_info and the function - * #H5Oget_info2 were introduced in this release. - * \version 1.8.15 Added a note about the valid values for the \c version field - * in the H5O_hdr_info_t structure. - * \version 1.8.11 Fortran subroutine introduced in this release. - * \version 1.8.10 Added #H5O_type_t structure to the Description section. - * Separated H5O_hdr_info_t structure from - * #H5O_info_t in the Description section. Clarified the - * definition and implementation of the time fields. - * - * \since 1.8.0 - * - */ diff --git a/doxygen/dox/H5Oget_info_by_idx.dox b/doxygen/dox/H5Oget_info_by_idx.dox deleted file mode 100644 index 49b8031..0000000 --- a/doxygen/dox/H5Oget_info_by_idx.dox +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \ingroup H5O - * \def H5Oget_info_by_idx - * - * #H5Oget_info_by_idx is a macro that is mapped to: - * \li #H5Oget_info_by_idx3 - * \li #H5Oget_info_by_idx1 - * - * \details Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in - * API Compatibility Macros in HDF5; we urge you to read that - * document closely. - * - * In HDF5 versions 1.12 and after, #H5Oget_info_by_idx is mapped to - * #H5Oget_info_by_idx3 and #H5Oget_info_by_idx1 is deprecated. - * In version 1.10 #H5Oget_info_by_idx is identical to #H5Oget_info_by_idx1. - * - * Specific compile-time compatibility flags and the resulting - * mappings are as follows: - * - * \par - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Compatibility settingH5Oget_info_by_idx
    No compatibility flag \n  #H5Oget_info_by_idx3 for 1.12 \n - * #H5Oget_info_by_idx1 for 1.8/1.10
    Emulate Release 1.12#H5Oget_info_by_idx3
    Emulate Release 1.10/1.8 interface#H5Oget_info_by_idx1
    - * - * \version 1.12.0 The macro #H5Oget_info_by_idx and function #H5Oget_info_by_idx3 were added, - * and #H5Oget_info_by_idx1 was deprecated. - * \version 1.10.5 The macro #H5Oget_info_by_idx was removed. The functions - * #H5Oget_info_by_idx and #H5Oget_info_by_idx1 are - * identical in this release. This change was added to restore the - * broken API compatibility introduced in HDF5-1.10.3. - * \version 1.10.3 The function #H5Oget_info_by_idx was renamed #H5Oget_info_by_idx1. - * The macro #H5Oget_info_by_idx and the function #H5Oget_info_by_idx2 - * were introduced in this release. - * \version 1.8.11 Fortran subroutine introduced in this release. - * - * \since 1.8.0 - * - */ diff --git a/doxygen/dox/H5Oget_info_by_name.dox b/doxygen/dox/H5Oget_info_by_name.dox deleted file mode 100644 index 18f7d28..0000000 --- a/doxygen/dox/H5Oget_info_by_name.dox +++ /dev/null @@ -1,58 +0,0 @@ -/** - * \ingroup H5O - * \def H5Oget_info_by_name - * - * #H5Oget_info_by_name is a macro that is mapped to: - * \li #H5Oget_info_by_name3 - * \li #H5Oget_info_by_name1 - * - * \details Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in - * API Compatibility Macros in HDF5; we urge you to read that - * document closely. - * - * In HDF5 versions 1.12 and after, #H5Oget_info_by_name is mapped to - * #H5Oget_info_by_name3. In version 1.10 #H5Oget_info_by_name is - * identical to #H5Oget_info_by_name1. - * - * Specific compile-time compatibility flags and the resulting - * mappings are as follows: - * - * \par - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Compatibility settingH5Oget_info_by_name
    No compatibility flag \n  #H5Oget_info_by_name3 for 1.12 and above \n - * #H5Oget_info_by_name1 for 1.8 or 1.10
    Emulate Release 1.12#H5Oget_info_by_name3
    Emulate Release 1.10 or 1.8 interface#H5Oget_info_by_name1
    - * - * \version 1.12.0 The macro #H5Oget_info_by_name and function - * #H5Oget_info_by_name3 were added and - * #H5Oget_info_by_name1 was deprecated. - * \version 1.10.5 The macro #H5Oget_info_by_name was removed. The functions - * #H5Oget_info_by_name and #H5Oget_info_by_name1 are - * identical in this release. This change was added to restore - * the broken API compatibility introduced in HDF5-1.10.3. - * \version 1.10.3 The function #H5Oget_info_by_name was renamed - * to #H5Oget_info_by_name1. The macro #H5Oget_info_by_name - * and the function #H5Oget_info_by_name2 were introduced - * in this release. - * \version 1.8.8 Fortran 2003 subroutine and \c h5o_info_t derived - * type introduced in this release. - * - * \since 1.8.0 - * - */ diff --git a/doxygen/dox/H5Ovisit.dox b/doxygen/dox/H5Ovisit.dox deleted file mode 100644 index 1e2a3ea..0000000 --- a/doxygen/dox/H5Ovisit.dox +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \ingroup H5O - * \def H5Ovisit - * - * #H5Ovisit is a macro that is mapped to one of the following: - * \li #H5Ovisit3 - * \li #H5Ovisit1 - * - * \details Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in - * API Compatibility Macros in HDF5; we urge you to read that - * document closely. - * - * In HDF5 versions 1.12 and after, #H5Ovisit is mapped to - * #H5Ovisit3. In version 1.10, #H5Ovisit is identical - * to #H5Ovisit1. - * - * Specific compile-time compatibility flags and the resulting - * mappings are as follows: - * - * \par - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Compatibility settingsH5Ovisit
    No compatibility flag \n  #H5Ovisit3 in 1.12 or after \n - * #H5Ovisit1 for 1.8 and 1.10
    Emulate Release 1.12#H5Ovisit3
    Emulate Release 1.10 or 1.8 interface#H5Ovisit1
    - * - * \version 1.12.0 The macro #H5Ovisit and function #H5Ovisit3 were added, - * and #H5Ovisit1 was deprecated. - * \version 1.10.5 The macro #H5Ovisit was removed. The functions - * #H5Ovisit and #H5Ovisit1 are identical in this release. - * This change was added to restore the broken API compatibility - * introduced in HDF5-1.10.3. - * \version 1.10.3 The function #H5Ovisit was renamed to #H5Ovisit1. - * The macro #H5Ovisit and the function #H5Ovisit2 were - * introduced in this release. - * \version 1.8.8 Fortran subroutine and data structure added. - * - * \since 1.8.0 - * - */ diff --git a/doxygen/dox/H5Ovisit_by_name.dox b/doxygen/dox/H5Ovisit_by_name.dox deleted file mode 100644 index 2ba4846..0000000 --- a/doxygen/dox/H5Ovisit_by_name.dox +++ /dev/null @@ -1,54 +0,0 @@ -/** - * \ingroup H5O - * \def H5Ovisit_by_name - * - * #H5Ovisit_by_name is a macro that is mapped to one of the following: - * \li #H5Ovisit_by_name3 - * \li #H5Ovisit_by_name1 - * - * \details Such macros are provided to facilitate application - * compatibility. Their use and mappings are fully described in - * API Compatibility Macros in HDF5; we urge you to read that - * document closely. - * - * In HDF5 versions 1.12 and after, #H5Ovisit_by_name is mapped to - * #H5Ovisit_by_name3. In version 1.10, #H5Ovisit_by_name - * is identical to #H5Ovisit_by_name1. - * - * Specific compile-time compatibility flags and the resulting - * mappings are as follows: - * - * \par - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Compatibility settingsH5Ovisit_by_name
    No compatibility flag \n  #H5Ovisit_by_name3 for 1.12 and above \n - * #H5Ovisit_by_name1 for 1.10 or 1.8
    Emulate Release 1.12 interface#H5Ovisit_by_name3
    Emulate Release 1.10 or 1.8 interface#H5Ovisit_by_name1
    - * - * \version 1.12.0 The macro #H5Ovisit_by_name and function #H5Ovisit_by_name3 were added. - * \version 1.10.5 The macro #H5Ovisit_by_name was removed. The functions - * #H5Ovisit_by_name and #H5Ovisit_by_name1 are identical - * in this release. This change was added to restore the - * broken API compatibility introduced in HDF5-1.10.3. - * \version 1.10.3 The function #H5Ovisit_by_name was renamed to #H5Ovisit_by_name1. - * The macro #H5Ovisit_by_name and the function #H5Ovisit_by_name2 - * were introduced in this release. - * \version 1.8.8 Fortran subroutine introduced in this release. - * - * \since 1.8.0 - * - */ diff --git a/doxygen/dox/H5Sencode.dox b/doxygen/dox/H5Sencode.dox deleted file mode 100644 index fe0995c..0000000 --- a/doxygen/dox/H5Sencode.dox +++ /dev/null @@ -1,5 +0,0 @@ -/** - * \ingroup H5S - * \def H5Sencode() - * H5Sencode() is a macro that is mapped to either H5Sencode1() or H5Sencode2(). -*/ diff --git a/doxygen/dox/RFC.dox b/doxygen/dox/RFC.dox new file mode 100644 index 0000000..c16dcea --- /dev/null +++ b/doxygen/dox/RFC.dox @@ -0,0 +1,91 @@ +/** \page RFC RFCs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    RFC IDTitleComments
    2021-05-28 \ref_rfc20210528
    2019-09-23 \ref_rfc20190923
    2019-04-10 \ref_rfc20190410
    2018-12-31 \ref_rfc20181231
    2018-12-20 \ref_rfc20181220
    2018-06-20 \ref_rfc20180620
    2018-06-10 \ref_rfc20180610
    2018-03-21 \ref_rfc20180321
    2018-01-25 \ref_rfc20180125
    2017-07-07 \ref_rfc20170707
    2016-01-05 \ref_rfc20160105
    2015-09-15 \ref_rfc20150915
    2015-07-09 \ref_rfc20150709
    2015-06-15 \ref_rfc20150615
    2015-04-29 \ref_rfc20150429
    2015-04-24 \ref_rfc20150424
    2015-04-23 \ref_rfc20150423
    2015-03-01 \ref_rfc20150301
    2015-02-12 \ref_rfc20150212
    2015-02-05 \ref_rfc20150205
    2015-02-02 \ref_rfc20150202
    2014-12-10 \ref_rfc20141210
    2014-12-01 \ref_rfc20141201
    2014-09-16 \ref_rfc20140916
    2014-08-27 \ref_rfc20140827
    2014-07-29 \ref_rfc20140729
    2014-07-22 \ref_rfc20140722
    2014-07-17 \ref_rfc20140717
    2014-07-07 \ref_rfc20140707
    2014-05-24 \ref_rfc20140524
    2014-03-18 \ref_rfc20140318
    2014-03-13 \ref_rfc20140313
    2014-02-24 \ref_rfc20140224
    2013-12-11 \ref_rfc20131211
    2013-09-30 \ref_rfc20130930
    2013-09-19 \ref_rfc20130919
    2013-06-30 \ref_rfc20130630
    2013-03-16 \ref_rfc20130316
    2012-11-14 \ref_rfc20121114
    2012-10-24 \ref_rfc20121024
    2012-08-28 \ref_rfc20120828
    2012-05-23 \ref_rfc20120523
    2012-05-01 \ref_rfc20120501
    2012-03-05 \ref_rfc20120305
    2012-02-20 \ref_rfc20120220
    2012-01-20 \ref_rfc20120120
    2012-01-04 \ref_rfc20120104
    2011-11-19 \ref_rfc20111119
    2011-08-25 \ref_rfc20110825
    2011-08-11 \ref_rfc20110811
    2011-07-26 \ref_rfc20110726
    2011-06-14 \ref_rfc20110614
    2011-03-29 \ref_rfc20110329
    2011-01-18 \ref_rfc20110118
    2010-11-22 \ref_rfc20101122
    2010-11-04 \ref_rfc20101104
    2010-10-18 \ref_rfc20101018
    2010-09-02 \ref_rfc20100902
    2010-07-27 \ref_rfc20100727
    2010-07-26 \ref_rfc20100726
    2010-05-11 \ref_rfc20100511
    2010-04-22 \ref_rfc20100422
    2010-03-12 \ref_rfc20100312
    2009-12-18 \ref_rfc20091218
    2009-09-07 \ref_rfc20090907
    2009-06-12 \ref_rfc20090612
    2008-12-18 \ref_rfc20081218
    2008-09-15 \ref_rfc20080915
    2008-09-04 \ref_rfc20080904
    2008-03-01 \ref_rfc20080301
    2008-02-09 \ref_rfc20080209
    2008-02-06 \ref_rfc20080206
    2007-11-11 \ref_rfc20071111
    2007-10-18 \ref_rfc20071018
    2007-08-01 \ref_rfc20070801
    2007-04-13 \ref_rfc20070413
    2007-01-15 \ref_rfc20070115
    2006-06-23 \ref_rfc20060623
    2006-06-04 \ref_rfc20060604
    2006-05-05 \ref_rfc20060505
    2006-04-10 \ref_rfc20060410
    2006-03-17 \ref_rfc20060317
    2006-01-24 \ref_rfc20060124
    2004-08-11 \ref_rfc20040811
    + +*/ \ No newline at end of file diff --git a/doxygen/dox/ReferenceManual.dox b/doxygen/dox/ReferenceManual.dox index 596a224..cc0f99b 100644 --- a/doxygen/dox/ReferenceManual.dox +++ b/doxygen/dox/ReferenceManual.dox @@ -3,41 +3,87 @@ The functions provided by the HDF5 C-API are grouped into the following \Emph{modules}: -\li \ref H5A "Attributes" — Management of HDF5 attributes (\ref H5A) -\li \ref H5D "Datasets" — Management of HDF5 datasets (\ref H5D) -\li \ref H5S "Dataspaces" — Management of HDF5 dataspaces which describe the shape of datasets and attributes (\ref H5S) -\li \ref H5T "Datatypes" — Management of datatypes which describe elements of datasets and attributes (\ref H5T) -\li \ref H5E "Error Handling" — Functions for handling HDF5 errors (\ref H5E) -\li \ref H5ES "Event Sets" — Functions for handling HDF5 event sets (\ref H5ES) -\li \ref H5F "Files" — Management of HDF5 files (\ref H5F) -\li \ref H5Z "Filters" — Configuration of filters that process data during I/O operation (\ref H5Z) -\li \ref H5G "Groups" — Management of groups in HDF5 files (\ref H5G) -\li \ref H5I "Identifiers" — Management of object identifiers and object names (\ref H5I) -\li \ref H5 "Library" — General purpose library functions (\ref H5) -\li \ref H5L "Links" — Management of links in HDF5 groups (\ref H5L) -\li \ref H5M "Maps" — Management of HDF5 maps (\ref H5M) -\li \ref H5O "Objects" — Management of objects in HDF5 files (\ref H5O) -\li \ref H5PL "Plugins" — Programmatic control over dynamically loaded plugins (\ref H5PL) -\li \ref H5P "Property Lists" — Management of property lists to control HDF5 library behavior (\ref H5P) -\li \ref H5R "References" — Management of references to specific objects and data regions in an HDF5 file (\ref H5R) -\li \ref H5VL "Virtual Object Layer" — Management of the Virtual Object Layer (\ref H5VL) - -\par Asynchronous Functions - A subset of functions has \ref ASYNC "asynchronous variants". - -\par API Versioning - See \ref api-compat-macros - -\par Deprecated Functions and Types - A list of deprecated functions and types can be found - here. - -\par Etiquette - Here are a few simple rules to follow: - \li \Bold{Handle discipline:} If you acquire a handle (by creation or copy), \Emph{you own it!} (..., i.e., you have to close it.) - \li \Bold{Dynamic memory allocation:} ... - \li \Bold{Use of locations:} Identifier + name combo + + + + + + + +
    Modules
    + + + + +
    +\li \ref H5A "Attributes (H5A)" +\li \ref H5D "Datasets (H5D)" +\li \ref H5S "Dataspaces (H5S)" +\li \ref H5T "Datatypes (H5T)" +\li \ref H5E "Error Handling (H5E)" +\li \ref H5ES "Event Sets (H5ES)" +\li \ref H5F "Files (H5F)" +\li \ref H5Z "Filters (H5Z)" +\li \ref H5G "Groups (H5G)" + +\li \ref H5I "Identifiers (H5I)" +\li \ref H5 "Library General (H5)" +\li \ref H5L "Links (H5L)" +\li \ref H5M "Maps (H5M)" +\li \ref H5O "Objects (H5O)" +\li \ref H5P "Property Lists (H5P)" +\li \ref H5PL "Dynamically-loaded Plugins (H5PL)" +\li \ref H5R "References (H5R)" +\li \ref H5VL "Virtual Object Layer (H5VL)" + +\li Functions with \ref ASYNC "asynchronous variants" +\li \ref api-compat-macros +\li Deprecated functions +\li High-level Extensions + +
    +\ref H5 \ref H5A \ref H5D \ref H5E \ref H5ES \ref H5F \ref H5G \ref H5I \ref H5L +\ref H5M \ref H5O \ref H5P \ref H5PL \ref H5R \ref H5S \ref H5T \ref H5VL \ref H5Z +
    + +
    Mind the gap
    +Follow these simple rules and stay out of trouble: + +\li \Bold{Handle discipline:} The HDF5 C-API is rife with handles or + identifiers, which you typically obtain by creating new HDF5 items, copying + items, or retrieving facets of items. \Emph{You acquire a handle, you own it!} + (Colin Powell) In other words, you are responsible for releasing the underlying + resources via the matching \Code{H5*close()} call, or deal with the consequences + of resource leakage. +\li \Bold{Closed means closed:} Do not pass identifiers that were previously + \Code{H5*close()}-d to other API functions! It will generate an error. +\li \Bold{Dynamic memory allocation:} The API contains a few functions in which the + HDF5 library dynamically allocates memory on the caller's behalf. The caller owns + this memory and eventually must free it by calling H5free_memory(). (\Bold{Not} + the `free` function \Emph{du jour}!) +\li \Bold{Be careful with that saw:} Do not modify the underlying collection when an + iteration is in progress! +\li \Bold{Use of locations:} Certain API functions, typically called \Code{H5***_by_name} + use a combination of identifiers and path names to refer to HDF5 objects. + If the identifier fully specifies the object in question, pass \Code{'.'} (a dot) + for the name! + +Break a leg! +
    \cpp_c_api_note +\par Don't like what you see? - You can help to improve this Reference Manual + Complete the survey linked near the top of this page!\n + We treat documentation like code: Fork the + HDF5 repo, make changes, and create a + pull request !\n + See the \ref RMT for general guidance. + */ \ No newline at end of file diff --git a/doxygen/dox/cookbook/Accessibility.c b/doxygen/dox/cookbook/Accessibility.c new file mode 100644 index 0000000..f4cc905 --- /dev/null +++ b/doxygen/dox/cookbook/Accessibility.c @@ -0,0 +1,48 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_fapl, fail_file; + hid_t fapl, file, aspace, attr; + + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_fapl; + } +#if H5_VERSION_GE(1, 10, 0) + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0) { +#elif H5_VERSION_GE(1, 8, 0) + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { +#else +#error Only HDF5 1.8.x and later supported. +#endif + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((file = H5Fcreate("set_libver_bounds.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + H5Fclose(file); +fail_file: + H5Pclose(fapl); +fail_fapl:; + } + //! + + assert(ret_val == EXIT_SUCCESS); + + return ret_val; +} diff --git a/doxygen/dox/cookbook/Accessibility.dox b/doxygen/dox/cookbook/Accessibility.dox new file mode 100644 index 0000000..f100283 --- /dev/null +++ b/doxygen/dox/cookbook/Accessibility.dox @@ -0,0 +1,39 @@ +/** \page Accessibility + +\section Accessibility + +\subsection CB_MaintainCompat Maintaining Compatibility with other HDF5 Library Versions + +\par Problem +You want to ensure that the HDF5 files you produce or modify are accessible by all +releavnt tools and applications + +\par Solution +For HDF5 items (objects, attributes, etc.) that you would like to +create in new or existing HDF5 files, ascertain the supported range of HDF5 +library versions as lower and upper bounds. When creating new or opening +existing HDF5 files, use a file access property list and configure the supported +range via the H5Pset_libver_bounds() function.\n +In the example below, we restrict HDF5 item creation to the HDF5 1.8.x family of +library versions. +\snippet{lineno} Accessibility.c set_libver_bounds + +\par Discussion +See RFC \ref_rfc20160105 for a detailed and comprehensive account of HDF5 +versioning (library, file format spec., etc.) and the H5Pset_libver_bounds() +function.\n +The default range #H5F_LIBVER_EARLIEST (low) - #H5F_LIBVER_LATEST (high) offers the +widest compatibility range, but may not be suitable for certain (feature-)use +cases.\n +The HDF5 library comes with a \Emph{forward-} and \Emph{backward-compatibility} +guarantee: This means that the latest version of the library can always read +HDF5 files created by a version realesed earlier (backward compatibility). +It also means that a given release of the library can read the contents of +HDF5 files created with later versions of the library as long as the files +do not contain features introduced in later versions (forward compatibility). + +\par See Also +See the recipe \ref CB_LargeAttributes for an example where we use HDF5 +compatibility settings to enable the creation of large HDF5 attributes. + +*/ \ No newline at end of file diff --git a/doxygen/dox/cookbook/Attributes.c b/doxygen/dox/cookbook/Attributes.c new file mode 100644 index 0000000..f4e894f --- /dev/null +++ b/doxygen/dox/cookbook/Attributes.c @@ -0,0 +1,61 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_attr, fail_aspace, fail_fapl, fail_file; + hid_t fapl, file, aspace, attr; + + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_fapl; + } +#if H5_VERSION_GE(1, 10, 0) + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0) { +#elif H5_VERSION_GE(1, 8, 0) + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { +#else +#error Only HDF5 1.8.x and later supported. +#endif + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((file = H5Fcreate("large_attribute.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + if ((aspace = H5Screate_simple(1, (hsize_t[]){1024 * 1024}, NULL)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_aspace; + } + if ((attr = H5Acreate(file, "4MiB", H5T_IEEE_F32LE, aspace, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_attr; + } + + H5Aclose(attr); +fail_attr: + H5Sclose(aspace); +fail_aspace: + H5Fclose(file); +fail_file: + H5Pclose(fapl); +fail_fapl:; + } + //! + + assert(ret_val == EXIT_SUCCESS); + + return ret_val; +} diff --git a/doxygen/dox/cookbook/Attributes.dox b/doxygen/dox/cookbook/Attributes.dox new file mode 100644 index 0000000..68fd159 --- /dev/null +++ b/doxygen/dox/cookbook/Attributes.dox @@ -0,0 +1,38 @@ +/** \page Attributes + +\section Attributes + +\subsection CB_LargeAttributes Creating "Large" HDF5 Attributes + +\par Problem +You would like to use HDF5 attributes the size of whose values +exceeds a few dozen kilobytes + +\par Solution +A file format change in the HDF5 1.8.x family of library releases made it +possible to have attributes larger than about 64 KiB. Ensure that the lower +library version bound for new HDF5 item creation is at least 1.8.x, and create +larger attributes as usual.\n +In the example below, we create an attribute whose value occupies 4 MiB. + +\note This feature is only supported in HDF5 1.8.x+ + +\snippet{lineno} Attributes.c large_attribute + +\par Discussion +Large attributes are supported only in HDF5 versions 1.8.x and higher. +This has implications for the accessibility of your HDF5 files and +is your call.\n +Since there are no size limitations for large attributes, it might +seem tempting to mistake them for dataset stand-ins. This is not the +case, for at least two reasons: +1. Attributes decorate HDF5 objects, have their own local namespace, + and can't be link targets. +2. Attribute I/O treats the attribute value as atomic, i.e., there + is no support for partial I/O. A large attribute will always be + read or written in its entirety. + +\par See Also +See \ref CB_MaintainCompat for HDF5 compatibility implications. + + */ \ No newline at end of file diff --git a/doxygen/dox/cookbook/Files.c b/doxygen/dox/cookbook/Files.c new file mode 100644 index 0000000..b824933 --- /dev/null +++ b/doxygen/dox/cookbook/Files.c @@ -0,0 +1,87 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_fcpl, fail_fapl, fail_file; + hid_t fcpl, fapl, file; + + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_fcpl; + } +#if H5_VERSION_GE(1, 10, 1) + if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, 4096) < 0) { +#else +#error HDF5 1.10.1+ required +#endif + ret_val = EXIT_FAILURE; + goto fail_fapl; + } + + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_fapl; + } +#if H5_VERSION_GE(1, 10, 1) + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V110, H5F_LIBVER_LATEST) < 0) { +#else +#error HDF5 1.10.x+ required +#endif + ret_val = EXIT_FAILURE; + goto fail_file; + } + + if ((file = H5Fcreate("free_space.h5", H5F_ACC_TRUNC, fcpl, fapl)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + H5Fclose(file); + +fail_file: + H5Pclose(fapl); +fail_fapl: + H5Pclose(fcpl); +fail_fcpl:; + } + //! + + //! + { + __label__ fail_fcpl, fail_file; + hid_t fcpl, file; + + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_fcpl; + } + if (H5Pset_userblock(fcpl, 8192 * 1024) < 0) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + if ((file = H5Fcreate("userblock.h5", H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + H5Fclose(file); + +fail_file: + H5Pclose(fcpl); +fail_fcpl:; + } + //! + + assert(ret_val == EXIT_SUCCESS); + + return ret_val; +} diff --git a/doxygen/dox/cookbook/Files.dox b/doxygen/dox/cookbook/Files.dox new file mode 100644 index 0000000..169d638 --- /dev/null +++ b/doxygen/dox/cookbook/Files.dox @@ -0,0 +1,71 @@ +/** \page Files + +\section Files + +\subsection CB_FreeSpace Tracking Free Space in HDF5 Files + +\par Problem +You sometimes delete objects in HDF5 files and don't have new content to use the +free space, but would like to reuse it in the future. + +\par Solution +At file creation time, set the file space management strategy and persistence of +free space tracking information via H5Pset_file_space_strategy(). + +\note This feature is only supported in HDF5 1.10.1+. + +\snippet{lineno} Files.c free_space + +\par Discussion +Free space tracking is supported only in HDF5 versions 1.10.x and higher. +This has implications for the accessibility of your HDF5 files and +should be considered carefully. If compatibility with previous versions of +HDF5 must be maintained, space reclamation via \Code{h5repack} might be an option.\n +The file space strategy #H5F_FSPACE_STRATEGY_FSM_AGGR is not the only option +that supports free-space tracking. #H5F_FSPACE_STRATEGY_PAGE is another option, +which adds paged allocation and is used most effectively with page buffering.\n +For an in-depth account of HDF5 file space management, paged-allocation, and +page buffering, see the following documents: +\li \ref_rfc20121024 +\li \ref_rfc20120523 +\li \ref_rfc20150709 + +\par See Also +See \ref CB_MaintainCompat for HDF5 compatibility implications. + + +\subsection CB_RemoveUnusedSpace Removing Unused Space from HDF5 Files + +\par Problem +Based on estimates or \Code{h5stat} output you know that a large portion +of an HDF5 file consists of free or unaccounted space, and you would like +to remove it. + + +\subsection CB_UserBlock Creating an HDF5 File User Block + +\par Problem +You would like to include certain ancillary, non-HDF5 content in an +HDF5 file such that it can be accessed without the HDF5 library. + +\par Solution +Use a file creation property list in which the user block size is set via +H5Pset_userblock(). In the example below, we create an 8 MiB user block. +\snippet{lineno} Files.c user_block + +\par Discussion +The user block begins at offset 0 and must be at least 512 bytes and a power +of 2. The HDF5 library ignores any content between the beginning of the +file and the end of the user block.\n +You can add or strip a user block to/from an existing HDF5 file with the +\Code{h5jam}/\Code{h5unjam} tool, respectively. +\warning +If you try to embed content into the user block for use by other applications, +pay close attention to how they handle space beyond the last used byte in the +user block or the user block in general. In the worst case, applications might +try to truncate the rest of the file and destroy the HDF5 portion of the file. + +\par See Also +References to related recipes + + */ \ No newline at end of file diff --git a/doxygen/dox/cookbook/Performance.dox b/doxygen/dox/cookbook/Performance.dox new file mode 100644 index 0000000..7ac3a18 --- /dev/null +++ b/doxygen/dox/cookbook/Performance.dox @@ -0,0 +1,21 @@ +/** \page Performance + +\section Performance + +\subsection CB_MDCPerf Assessing HDF5 Metadata Cache Performance + +\par Problem +You are trying to diagnose and improve the I/O performance of an application +and would like to understand if a simple metadata cache adjustment might +yield substantial performance gains + +\par Solution +The to-the-point solution, i.e., the solution w/o any background or explanation + +\par Discussion +A discussion of the fine points and variants of the solution + +\par See Also +References to related recipes + + */ \ No newline at end of file diff --git a/doxygen/dox/maybe_metadata_reads.dox b/doxygen/dox/maybe_metadata_reads.dox index 25c905f..1bb53e0 100644 --- a/doxygen/dox/maybe_metadata_reads.dox +++ b/doxygen/dox/maybe_metadata_reads.dox @@ -13,62 +13,30 @@ * The following is a list of those functions in the HDF5 library. This list is * integral to the discussion in the H5Pset_all_coll_metadata_ops() entry: * - *
    - *
    - * H5Awrite()
    - * H5Aread()
    - * H5Arename()
    - * H5Aiterate2()
    - * H5Adelete()
    - * H5Aexists()
    - *
    - * H5Dget_space_status()
    - * H5Dget_storage_size()
    - * H5Dset_extent()
    - * H5Ddebug()
    - * H5Dclose()
    - * H5Dget_create_plist()
    - * H5Dget_space()   (when dataset is a virtual dataset)
    - *
    - * H5Gget_create_plist()
    - * H5Gget_info()
    - * H5Gclose()
    - *
    - * H5Literate()
    - * H5Lvisit()
    - *
    - * H5Rcreate()
    - * H5Rdereference2()   (when reference is an object reference)
    - * H5Rget_region()
    - * H5Rget_obj_type2()
    - * H5Rget_name()
    - *
    - * H5Ocopy()
    - * H5Oopen_by_addr()
    - * H5Oincr_refcount()
    - * H5Odecr_refcount()
    - * H5Oget_info()
    - * H5Oset_comment()
    - * H5Ovisit()
    - *
    - * H5Fis_hdf5()
    - * H5Fflush()
    - * H5Fclose()
    - * H5Fget_file_image()
    - * H5Freopen()
    - * H5Fget_freespace()
    - * H5Fget_info2()
    - * H5Fget_free_sections()
    - * H5Fmount()
    + * H5Awrite(), H5Aread(), H5Arename(), H5Aiterate2(), H5Adelete(), H5Aexists()
    + *
    + * H5Dget_space_status(), H5Dget_storage_size(), H5Dset_extent(), H5Ddebug(),
    + * H5Dclose(), H5Dget_create_plist(), H5Dget_space() (for virtual datasets)
    + *
    + * H5Gget_create_plist(), H5Gget_info(), H5Gclose()
    + *
    + * H5Literate(), H5Lvisit()
    + *
    + * H5Rcreate(), H5Rdereference2() (for object references),
    + * H5Rget_region(), H5Rget_obj_type2(), H5Rget_name()
    + *
    + * H5Ocopy(), H5Oopen_by_addr(), H5Oincr_refcount(), H5Odecr_refcount(),
    + * H5Oget_info(), H5Oset_comment(), H5Ovisit()
    + *
    + * H5Fis_hdf5(), H5Fflush(), H5Fclose(), H5Fget_file_image(), H5Freopen(),
    + * H5Fget_freespace(), H5Fget_info2(), H5Fget_free_sections(), H5Fmount(),
      * H5Funmount()
      *
      * H5Iget_name()
      *
    - * H5Tget_create_plist()
    - * H5Tclose()
    + * H5Tget_create_plist(), H5Tclose()
      *
      * H5Zunregister()
    - * 
    * * In addition, \b most deprecated functions fall into this category. * diff --git a/doxygen/dox/rm-template.dox b/doxygen/dox/rm-template.dox index 64e4770..ebf8aed 100644 --- a/doxygen/dox/rm-template.dox +++ b/doxygen/dox/rm-template.dox @@ -1,72 +1,99 @@ -/**\ingroup H5XYZ - * - * \brief A synopsis of what H5XYZgreat_function does - * - * \param[in] name1 Description of IN parameter \p name1 - * \param[out] name2 Description of OUT parameter \p name2 - * \param[in,out] name3 Description of INOUT parameter \p name3 - * - * \return Returns what you always wanted - * - * \pre Describe preconditions for an entity. Can be repreated. - * - * \invariant Describe invariants for an entity. Can be repeated. - * - * \post Describe postconditions for an entity. Can be repreated. - * - * \deprecated This was my favorite function while it lasted. - * - * \details Describe the normal behavior flow of the function here. Try to be - * helpful! - * - * Make reference to other functions like this: H5Fopen(). - * - * Make reference to formal parameters like this: \p name1 - * - * Make reference to macros like this: #H5P_DEFAULT. - * - * Make reference to enumeration constants like this: #H5F_CLOSE_WEAK. - * - * Include code snippets like this: - * \snippet H5Zpublic.h H5Z_class2_t_snip - * - * Lists are supported: - * - mouse events - * -# mouse move event - * -# mouse click event\n - * More info about the click event. - * -# mouse double click event - * - keyboard events - * 1. key down event - * 2. key up event - * - * The distance between \f$(x_1,y_1)\f$ and \f$(x_2,y_2)\f$ is - * \f$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\f$.\n - * For tables, see - * this example. - * - * This is an example of how to use the H5XYZgreat_function().\n - * The contents of the file hello_hdf5.c will be included. - * \include hello_hdf5.c - * - * \note Dear reader, ... - * - * \attention Colorless green ideas sleep furiously. - * - * \warning Don't do this at home! - * - * \author This function was written by an esteemed author. Repeat this - * command for multiple authors. - * - * \date Record the function's birthdate! - * - * \since 1.MAJOR.MINOR The 'since' command can also be used to record a - * function's introduction (via its initial release - * version). - * - * \version 1.MAJOR.MINOR An important event in the version history of this - * function. There can be multiple such events. - * - * \see H5XYZanother_great_function(), H5XYZnot_so_great_a_function() - * - */ +/** \page RMT Reference Manual (RM) Page Template + +We treat documentation like code and use +Doxygen to +markup +comments in the code or create +stand-alone pages. + +Every RM entry consists of a subset of the elements listed below. Not every RM +entry warrants the full set. More is better, and we can, perhaps, distinguish +minimal, typical, and great RM entries. + +A minimal RM entry must include elements 1-3, 8, 11, and 7 if applicable. + +A \Emph{typical} RM entry is a minimal RM entry that in addition has elements +9, 10, and 12. + +A \Bold{great} RM entry is a typical RM entry plus everything else. + +The current RM is a mixed bag. Take what's there with a pinch of salt and apply +the Scout Rule! + +\par RM entry elements + +1. Module indication + - Indicate the HDF5 module in which the function will appear. + \verbatim + * \ingroup H5XYZ + \endverbatim +2. Synopsis + - A phrase or sentence that summarizes the function's purpose + \verbatim + * \brief Simplifies your life + \endverbatim +3. Prototype (parameters and return value) + - A description of the function parameters and return value + \verbatim + * \param[in] name1 Description of IN parameter \p name1 + * \param[out] name2 Description of OUT parameter \p name2 + * \param[in,out] name3 Description of INOUT parameter \p name3 + * \return Returns what you always wanted + \endverbatim + - Clearly indicate the parameter direction as \c in, \c out, or + \Code{in,out} + - Make reference to other parameters using \Code{\\p} +4. Preconditions + - A set of preconditions that must be met. + \verbatim + * \pre The argmument supplied in parameter \p name2 must be even. + \endverbatim +5. Invariants + - A set of invariants. + \verbatim + * \invariant The mouse pointer will always be visible. + \endverbatim +6. Postconditions + - What will be true when the function returns. + \verbatim + * \post On error, the output parameters will be unmodified. + \endverbatim +7. Deprecation note + - If a function was deprecated, list the version in which the function was + deprecated (below), why it was deprecated, and which function(s) succeed it. + \verbatim + * \deprecated Deprecated in favor of another great function. + \endverbatim +8. Details + - A detailed description of the function's behavior + \verbatim + * \details This is the heart of the matter. Try to be helpful! + \endverbatim +9. Example + - The function in context and action, usually a (Doxygen) snippet. + \verbatim + * \par Example + * \snippet H5F_examples.c minimal + \endverbatim +10. Instruction (attention, note, warning) + - Behaviors, features, side-effects, etc. the user should be aware of + \verbatim + * \note Dear reader, ... + * + * \attention Colorless green ideas sleep furiously. + * + * \warning Don't do this at home! + \endverbatim +11. Since + - The HDF5 library version in which the function was introduced + \verbatim + * \since 1.MAJOR.MINOR + \endverbatim +12. Version + - Use this element to record a deprecation version, a change in parameter + types, changes in behavior, etc. + \verbatim + * \version 1.MAJOR.MINOR Function was deprecated in this release + \endverbatim + +*/ \ No newline at end of file diff --git a/doxygen/examples/H5D_examples.c b/doxygen/examples/H5D_examples.c index aad057d..4e54c1d 100644 --- a/doxygen/examples/H5D_examples.c +++ b/doxygen/examples/H5D_examples.c @@ -5,6 +5,86 @@ #include #include +//! +int +chunk_cb(const hsize_t *offset, uint32_t filter_mask, haddr_t addr, uint32_t nbytes, void *op_data) +{ + // only print the allocated chunk size only + printf("%d\n", nbytes); + return EXIT_SUCCESS; +} +//! + +//! +herr_t +H5Ovisit_cb(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data) +{ + herr_t retval = 0; + char * base_path = (char *)op_data; + + if (info->type == H5O_TYPE_DATASET) // current object is a dataset + { + hid_t dset, dcpl; + if ((dset = H5Dopen(obj, name, H5P_DEFAULT)) == H5I_INVALID_HID) { + retval = -1; + goto func_leave; + } + if ((dcpl = H5Dget_create_plist(dset)) == H5I_INVALID_HID) { + retval = -1; + goto fail_dcpl; + } + if (H5Pget_layout(dcpl) == H5D_CHUNKED) // dataset is chunked + { + __label__ fail_dtype, fail_dspace, fail_shape; + hid_t dspace, dtype; + size_t size, i; + int rank; + hsize_t cdims[H5S_MAX_RANK]; + + // get resources + if ((dtype = H5Dget_type(dset)) < 0) { + retval = -1; + goto fail_dtype; + } + if ((dspace = H5Dget_space(dset)) < 0) { + retval = -1; + goto fail_dspace; + } + // get the shape + if ((size = H5Tget_size(dtype)) == 0 || (rank = H5Sget_simple_extent_ndims(dspace)) < 0 || + H5Pget_chunk(dcpl, H5S_MAX_RANK, cdims) < 0) { + retval = -1; + goto fail_shape; + } + // calculate the nominal chunk size + size = 1; + for (i = 0; i < (size_t)rank; ++i) + size *= cdims[i]; + // print dataset info + printf("%s%s : nominal chunk size %lu [B] \n", base_path, name, size); + // get the allocated chunk sizes + if (H5Dchunk_iter(dset, H5P_DEFAULT, &chunk_cb, NULL) < 0) { + retval = -1; + goto fail_fig; + } + +fail_shape: + H5Sclose(dspace); +fail_dspace: + H5Tclose(dtype); +fail_dtype:; + } + + H5Pclose(dcpl); +fail_dcpl: + H5Dclose(dset); + } + +func_leave: + return retval; +} +//! + int main(void) { @@ -166,7 +246,6 @@ fail_delete: H5Fclose(file); fail_file:; } - //! return ret_val; diff --git a/doxygen/examples/H5E_examples.c b/doxygen/examples/H5E_examples.c new file mode 100644 index 0000000..deea838 --- /dev/null +++ b/doxygen/examples/H5E_examples.c @@ -0,0 +1,97 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_push, fail_minor, fail_major, fail_class; + hid_t cls, major, minor; + + // register a new error class for this "application" + if ((cls = H5Eregister_class("Custom error class", "H5E_examples", "0.1")) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_class; + } + + // create custom major and minor error codes + if ((major = H5Ecreate_msg(cls, H5E_MAJOR, "Okay, Houston, we've had a problem here")) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_major; + } + if ((minor = H5Ecreate_msg(cls, H5E_MINOR, "Oops!")) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_minor; + } + + // push a custom error message onto the default stack + if (H5Epush2(H5E_DEFAULT, __FILE__, __FUNCTION__, __LINE__, cls, major, minor, "Hello, Error!\n") < + 0) { + ret_val = EXIT_FAILURE; + goto fail_push; + } + + // print the default error stack + if (H5Eprint(H5E_DEFAULT, stderr) < 0) { + ret_val = EXIT_FAILURE; + } + +fail_push: + H5Eclose_msg(minor); +fail_minor: + H5Eclose_msg(major); +fail_major: + H5Eunregister_class(cls); +fail_class:; + } + //! + + //! + { + __label__ fail_count; + + // check the number of error messages on the default stack + // and print what's there + ssize_t count = H5Eget_num(H5E_DEFAULT); + if (count < 0) { + ret_val = EXIT_FAILURE; + goto fail_count; + } + else if (H5Eprint(H5E_DEFAULT, stderr) < 0) { + ret_val = EXIT_FAILURE; + } + +fail_count:; + } + //! + + //! + { + // pop 10 error messages off the default error stack + // popping off non-existent messages is OK, but might be confusing + if (H5Epop(H5E_DEFAULT, 10) < 0) + ret_val = EXIT_FAILURE; + } + //! + + //! + { + // clear the default error stack (for the current thread) + if (H5Eclear2(H5E_DEFAULT) < 0) + ret_val = EXIT_FAILURE; + } + //! + + assert(ret_val == EXIT_SUCCESS); + + return ret_val; +} diff --git a/doxygen/examples/H5F_examples.c b/doxygen/examples/H5F_examples.c index a7ce6fb..4e89fde 100644 --- a/doxygen/examples/H5F_examples.c +++ b/doxygen/examples/H5F_examples.c @@ -10,7 +10,7 @@ main(void) { int ret_val = EXIT_SUCCESS; - //! + //! { __label__ fail_fapl, fail_fcpl, fail_file; hid_t fcpl, fapl, file; @@ -48,12 +48,13 @@ fail_fapl: H5Pclose(fcpl); fail_fcpl:; } - //! + //! - //! + //! { __label__ fail_fapl, fail_file; - hid_t fapl, file; + hid_t fapl, file; + hsize_t size; if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) { ret_val = EXIT_FAILURE; @@ -63,7 +64,7 @@ fail_fcpl:; // adjust the file access properties } - unsigned mode = H5F_ACC_RDWR; + unsigned mode = H5F_ACC_RDONLY; char name[] = "f1.h5"; if ((file = H5Fopen(name, mode, fapl)) == H5I_INVALID_HID) { @@ -71,14 +72,41 @@ fail_fcpl:; goto fail_file; } - // do something useful with FILE + if (H5Fget_filesize(file, &size) < 0) { + ret_val = EXIT_FAILURE; + } + + printf("File size: %llu bytes\n", size); H5Fclose(file); fail_file: H5Pclose(fapl); fail_fapl:; } - //! + //! + + //! + { + __label__ fail_file; + hid_t file; + + unsigned mode = H5F_ACC_RDWR; + char name[] = "f1.h5"; + + if ((file = H5Fopen(name, mode, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // create a cycle by hard linking the root group in the root group + if (H5Lcreate_hard(file, ".", file, "loopback", H5P_DEFAULT, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + } + + H5Fclose(file); +fail_file:; + } + //! //! { @@ -183,5 +211,18 @@ fail_fapl:; } //! + //! + { +#if H5_VERSION_GE(1, 12, 0) + + // this function is only available in HDF5 1.12.x + if (H5Fdelete("f1.h5", H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + } + +#endif + } + //! + return ret_val; } diff --git a/doxygen/examples/H5G_examples.c b/doxygen/examples/H5G_examples.c new file mode 100644 index 0000000..3109efb --- /dev/null +++ b/doxygen/examples/H5G_examples.c @@ -0,0 +1,186 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_group, fail_prop, fail_lcpl, fail_file; + hid_t file, lcpl, group; + char fname[] = "g1.h5"; + char path[] = "/αυτή/είναι/μια/νέα/ομάδα"; + + if ((file = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_lcpl; + } + // ensure that intermediate groups are created automatically + if (H5Pset_create_intermediate_group(lcpl, 1) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + // use UTF-8 encoding for link names + if (H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + // create five groups + if ((group = H5Gcreate(file, path, lcpl, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_group; + } + + H5Gclose(group); +fail_group: +fail_prop: + H5Pclose(lcpl); +fail_lcpl: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_file; + char fname[] = "g1.h5"; + char path[] = "/αυτή/είναι"; + hid_t file; + H5G_info_t info; + + if ((file = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + // open one of the intermediate groups + if (H5Gget_info_by_name(file, path, &info, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_info; + } + + printf("Link count: %llu\n", info.nlinks); + switch (info.storage_type) { + case H5G_STORAGE_TYPE_COMPACT: + printf("Compact storage\n"); + break; + case H5G_STORAGE_TYPE_DENSE: + printf("Compact storage\n"); + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + printf("Symbol table\n"); + break; + default: + printf("UFO\n"); + break; + } + +fail_info: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_group, fail_prop, fail_lcpl, fail_file; + hid_t file, lcpl, group; + char fname[] = "g1.h5"; + char path[] = "/αυτή/είναι/μια/άλλη/νέα/ομάδα"; + + if ((file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_lcpl; + } + // ensure that intermediate groups are created automatically + if (H5Pset_create_intermediate_group(lcpl, 1) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + // use UTF-8 encoding for link names + if (H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + // create an anonymous group + if ((group = H5Gcreate_anon(file, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_group; + } + // link the new group to existing the group at "/αυτή/είναι/μια" + if (H5Lcreate_hard(group, ".", file, path, lcpl, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + } + + H5Gclose(group); +fail_group: +fail_prop: + H5Pclose(lcpl); +fail_lcpl: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_info, fail_object, fail_file; + hid_t file, obj; + char fname[] = "g1.h5"; + char path[] = "/αυτή/είναι/μια/άλλη/νέα/ομάδα"; + char delete_path[] = "/αυτή/είναι/μια"; + H5O_info_t info; + + if ((file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // open a "leaf" group as object + if ((obj = H5Oopen(file, path, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_object; + } + // delete the link to an intermediate group on the path to the leaf + if (H5Ldelete(file, delete_path, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + } + // link deletion will propagate along hard links along all paths + // reachable from the intermediate group and cause reference counts to + // be decremented, freeing the objects if the count reaches 0 + if (H5Oget_info(obj, &info, H5O_INFO_BASIC) < 0) { + ret_val = EXIT_FAILURE; + goto fail_info; + } + + printf("Leaf reference count: %d\n", info.rc); + +fail_info: + H5Oclose(obj); +fail_object: + H5Fclose(file); +fail_file:; + } + //! + + assert(ret_val == EXIT_SUCCESS); + + return ret_val; +} diff --git a/doxygen/examples/H5I_examples.c b/doxygen/examples/H5I_examples.c new file mode 100644 index 0000000..4aa4783 --- /dev/null +++ b/doxygen/examples/H5I_examples.c @@ -0,0 +1,242 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_dcpl; + hid_t dcpl; + + // create an ID of a pre-defined ID type + if ((dcpl = H5Pcreate(H5P_DATASET_XFER)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dcpl; + } + + // we can reliably predict the ID type + assert(H5Iget_type(dcpl) == H5I_GENPROP_LST); + printf("%d\n", H5Iget_type(dcpl)); + + H5Pclose(dcpl); +fail_dcpl:; + } + //! + + //! + { + __label__ fail_dcpl; + hid_t dcpl; + + // create an ID of a pre-defined ID type + if ((dcpl = H5Pcreate(H5P_DATASET_XFER)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dcpl; + } + + // this better be valid + assert(H5Iis_valid(dcpl) > 0); + + // this ID is NOT associated with any HDF5 file; + // see the error message + assert(H5Iget_file_id(dcpl) == H5I_INVALID_HID); + + H5Pclose(dcpl); +fail_dcpl:; + } + //! + + //! + { + __label__ fail_rc, fail_dcpl; + hid_t dcpl; + int rc; + + // create an ID of a pre-defined ID type + if ((dcpl = H5Pcreate(H5P_DATASET_XFER)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dcpl; + } + + // retrieve the IDs reference count + if ((rc = H5Iget_ref(dcpl)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_rc; + } + printf("Reference count: %d\n", rc); + + // bump its reference count (by 1) + if ((rc = H5Iinc_ref(dcpl)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_rc; + } + printf("Reference count: %d\n", rc); + +fail_rc: + H5Pclose(dcpl); +fail_dcpl:; + } + //! + + //! + { + __label__ fail_rc, fail_dcpl; + hid_t dcpl; + int rc; + + // create an ID of a pre-defined ID type + if ((dcpl = H5Pcreate(H5P_DATASET_XFER)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dcpl; + } + + // decrease its reference count (from 1) to 0 + if ((rc = H5Idec_ref(dcpl)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_rc; + } + printf("Reference count: %d\n", rc); + + // at this point, the ID is no longer valid + assert(H5Iis_valid(dcpl) == 0); + + // dropping the ref. count to 0 has the side-effect of closing + // the associated item, and calling H5Pclose would create an error + goto fail_dcpl; + +fail_rc: + H5Pclose(dcpl); +fail_dcpl:; + } + //! + + //! + herr_t free_func(void *obj) + { + printf("Calling free_func...\n"); + H5free_memory(obj); + return 0; + } + + { + __label__ fail_id, fail_obj, fail_register; + H5I_type_t type; + int * obj; + hid_t obj_id; + + // register a new ID type + if ((type = H5Iregister_type(128, 1024, &free_func)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_register; + } + printf("New identifier type ID: %d\n", type); + + // create a new object + if ((obj = H5allocate_memory(10 * sizeof(int), 0)) == NULL) { + ret_val = EXIT_FAILURE; + goto fail_obj; + } + + // obtain an ID for the new object + if ((obj_id = H5Iregister(type, obj)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_id; + } + printf("New object identifier: %ld\n", obj_id); + +fail_id: + H5Iclear_type(type, 1); +fail_obj: + H5Idestroy_type(type); +fail_register:; + } + //! + + //! + { + __label__ fail_query, fail_register; + H5I_type_t type; + hsize_t count; + + // register a new ID type + if ((type = H5Iregister_type(128, 1024, NULL)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_register; + } + printf("New FOO identifier type ID: %d\n", type); + + // return the number of identifiers of TYPE currently in use + if (H5Inmembers(type, &count) < 0) { + ret_val = EXIT_FAILURE; + goto fail_query; + } + printf("%llu FOO identifiers in use\n", count); + +fail_query: + H5Idestroy_type(type); +fail_register:; + } + //! + + //! + { + __label__ fail_id, fail_register; + H5I_type_t type; + int obj = 42; + hid_t obj_id; + + // register a new ID type + if ((type = H5Iregister_type(128, 1024, NULL)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_register; + } + printf("New identifier type ID: %d\n", type); + + // obtain an ID for the new object + if ((obj_id = H5Iregister(type, &obj)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_id; + } + printf("New object identifier: %ld\n", obj_id); + + // bump the reference count + assert(H5Iinc_ref(obj_id) == 2); + + // force the deletion of all IDs regardless of reference count + H5Iclear_type(type, 1); +fail_id: + H5Idestroy_type(type); +fail_register:; + } + //! + + //! + { + __label__ fail_register; + H5I_type_t type; + + // register a new ID type + if ((type = H5Iregister_type(128, 1024, NULL)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_register; + } + printf("New identifier type ID: %d\n", type); + + // decrementing the identifier type's ref. count to 0 triggers + // the type to be destroyed + assert(H5Idec_type_ref(type) == 0); + +fail_register:; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5L_examples.c b/doxygen/examples/H5L_examples.c new file mode 100644 index 0000000..63f54fe --- /dev/null +++ b/doxygen/examples/H5L_examples.c @@ -0,0 +1,156 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +//! +herr_t +iter_cb(hid_t group, const char *name, const H5L_info_t *info, void *op_data) +{ + printf("Link \"%s\" is a", name); + switch (info->type) { + case H5L_TYPE_HARD: + printf(" hard link.\n"); + break; + case H5L_TYPE_SOFT: + printf(" soft link.\n"); + break; + case H5L_TYPE_EXTERNAL: + printf("n external link.\n"); + break; + default: + printf(" UFO link.\n"); + break; + } + + return 0; +} +//! + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_link, fail_prop, fail_lcpl, fail_create; + + hid_t file, lcpl; + + if ((file = H5Fcreate("l1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_create; + } + + // make link creation easier by auto-creating intermediate + // groups and UTF-8 encoding of link names + if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_lcpl; + } + if (H5Pset_create_intermediate_group(lcpl, 1) < 0 || H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + + // create a loop by hard linking the root group + if (H5Lcreate_hard(file, ".", file, "√", lcpl, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_link; + } + // create a soft link to nowhere + if (H5Lcreate_soft("e1 62 80 87 04 09 43 ba 02 d3", file, "/path/to/nowhere", lcpl, H5P_DEFAULT) < + 0) { + ret_val = EXIT_FAILURE; + goto fail_link; + } + // create an external link to nowhere in a non-existent file + if (H5Lcreate_external("non-existent-file.h5", "???", file, "external", lcpl, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_link; + } + +fail_link: +fail_prop: + H5Pclose(lcpl); +fail_lcpl: + H5Fclose(file); +fail_create:; + } + //! + + //! + { + __label__ fail_iterate, fail_read; + hid_t file; + hsize_t idx = 0; + + if ((file = H5Fopen("l1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_read; + } + + if (H5Literate(file, H5_INDEX_NAME, H5_ITER_NATIVE, &idx, iter_cb, NULL) < 0) { + ret_val = EXIT_FAILURE; + goto fail_iterate; + } + +fail_iterate: + H5Fclose(file); +fail_read:; + } + //! + + //! + { + __label__ fail_move, fail_update; + hid_t file; + + if ((file = H5Fopen("l1.h5", H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_update; + } + + // move the "√" link to the group at "/path/to" + // the cycle remains! + if (H5Lmove(file, "√", file, "path/to/√", H5P_DEFAULT, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_move; + } + +fail_move: + H5Fclose(file); +fail_update:; + } + //! + + //! + { + __label__ fail_delete, fail_file; + hid_t file; + + if ((file = H5Fopen("l1.h5", H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // delete the "external" link + if (H5Ldelete(file, "external", H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_delete; + } + +fail_delete: + H5Fclose(file); +fail_file:; + } + //! + + assert(ret_val == EXIT_SUCCESS); + + return ret_val; +} diff --git a/doxygen/examples/H5O_examples.c b/doxygen/examples/H5O_examples.c new file mode 100644 index 0000000..296acd1 --- /dev/null +++ b/doxygen/examples/H5O_examples.c @@ -0,0 +1,193 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include + +#define H5P_DEFAULTx2 H5P_DEFAULT, H5P_DEFAULT + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_file; + hid_t file, group; + char src_path[] = "/a/few/groups"; + + if ((file = H5Fcreate("o1.h5", H5F_ACC_TRUNC, H5P_DEFAULTx2)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // create a few groups + { + __label__ fail_group, fail_lcpl; + hid_t lcpl; + if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_lcpl; + } + if (H5Pset_create_intermediate_group(lcpl, 1) < 0) { + ret_val = EXIT_FAILURE; + goto fail_group; + } + if ((group = H5Gcreate(file, src_path, lcpl, H5P_DEFAULTx2)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_group; + } + + H5Gclose(group); +fail_group: + H5Pclose(lcpl); +fail_lcpl:; + } + + // create a copy + if (H5Ocopy(file, ".", file, "copy of", H5P_DEFAULTx2) < 0) { + ret_val = EXIT_FAILURE; + } + + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_info, fail_file; + hid_t file; + char path[] = "/a/few/groups"; + H5O_info2_t info; + + if ((file = H5Fopen("o1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // retrieve information about the object + if (H5Oget_info_by_name(file, path, &info, H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_info; + } + + // determine the object type + switch (info.type) { + case H5O_TYPE_GROUP: + printf("HDF5 group\n"); + break; + case H5O_TYPE_DATASET: + printf("HDF5 dataset\n"); + break; + case H5O_TYPE_NAMED_DATATYPE: + printf("HDF5 datatype\n"); + break; + default: + printf("UFO?\n"); + break; + } + // print basic information + printf("Reference count: %u\n", info.rc); + printf("Attribute count: %lld\n", info.num_attrs); + +fail_info: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_obj, fail_incr, fail_file; + hid_t file, obj; + char path[] = "/a/few/groups"; + H5O_info2_t info; + + if ((file = H5Fopen("o1.h5", H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // open an object by path name + if ((obj = H5Oopen(file, path, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_obj; + } + + // bump its reference count (by 1) + if (H5Oincr_refcount(obj) < 0) { + ret_val = EXIT_FAILURE; + goto fail_incr; + } + + // confirm the new reference count + if (H5Oget_info(obj, &info, H5O_INFO_BASIC) < 0) { + ret_val = EXIT_FAILURE; + goto fail_incr; + } + printf("Reference count: %u\n", info.rc); + +fail_incr: + H5Oclose(obj); +fail_obj: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_obj, fail_delete, fail_file; + hid_t file, obj; + char path[] = "/a/few/groups"; + H5O_info2_t info; + + if ((file = H5Fopen("o1.h5", H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // open an object by path name + if ((obj = H5Oopen(file, path, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_obj; + } + + // render it inaccessible from the root group by deleting the one and + // only link to it; this drops the reference count by 1 + if (H5Ldelete(file, path, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + goto fail_delete; + } + + // confirm the new reference count + if (H5Oget_info(obj, &info, H5O_INFO_BASIC) < 0) { + ret_val = EXIT_FAILURE; + goto fail_delete; + } + printf("Reference count: %u\n", info.rc); + + // if we close the file at this point, we'd be creating a tombstone, + // an object that cannot be reached and that cannot be reclaimed by the + // freespace manager; decrement the reference count to zero to prevent that + if (H5Idec_ref(obj) < 0) { + ret_val = EXIT_FAILURE; + goto fail_delete; + } + else + // attempting to close the object would be like a double H5Oclose and fail + goto fail_obj; + +fail_delete: + H5Oclose(obj); +fail_obj: + H5Fclose(file); +fail_file:; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5PL_examples.c b/doxygen/examples/H5PL_examples.c new file mode 100644 index 0000000..d012d1b --- /dev/null +++ b/doxygen/examples/H5PL_examples.c @@ -0,0 +1,97 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_set; + // enable ONLY filter plugins + if (H5PLset_loading_state(H5PL_FILTER_PLUGIN) < 0) { + ret_val = EXIT_FAILURE; + goto fail_set; + } + + // ensure that "/tmp" is at the front of the search path list + if (H5PLprepend("/tmp") < 0) { + ret_val = EXIT_FAILURE; + } + +fail_set:; + } + //! + + //! + { + __label__ fail_read; + unsigned size, mask; + char buf[255]; + + // retrieve the number of entries in the plugin path list + if (H5PLsize(&size) < 0) { + ret_val = EXIT_FAILURE; + goto fail_read; + } + printf("Number of stored plugin paths: %d\n", size); + + // check the plugin state mask + if (H5PLget_loading_state(&mask) < 0) { + ret_val = EXIT_FAILURE; + goto fail_read; + } + printf("Filter plugins %s be loaded.\n", (mask & H5PL_FILTER_PLUGIN) == 1 ? "can" : "can't"); + printf("VOL plugins %s be loaded.\n", (mask & H5PL_VOL_PLUGIN) == 2 ? "can" : "can't"); + + // print the paths in the plugin path list + for (unsigned i = 0; i < size; ++i) { + if (H5PLget(i, buf, 255) < 0) { + ret_val = EXIT_FAILURE; + break; + } + printf("%s\n", buf); + } + +fail_read:; + } + //! + + //! + { + // replace "/tmp" with something more sensible + if (H5PLreplace("/foo/bar", 0) < 0) { + ret_val = EXIT_FAILURE; + } + } + //! + + //! + { + __label__ fail_delete; + unsigned size; + + if (H5PLsize(&size) < 0) { + ret_val = EXIT_FAILURE; + goto fail_delete; + } + + // clean out the list of plugin paths + for (int i = size - 1; i >= 0; --i) { + if (H5PLremove(i) < 0) { + ret_val = EXIT_FAILURE; + break; + } + } + +fail_delete:; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5P_examples.c b/doxygen/examples/H5P_examples.c new file mode 100644 index 0000000..cdfc03b --- /dev/null +++ b/doxygen/examples/H5P_examples.c @@ -0,0 +1,227 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_dcpl; + hid_t dcpl; + + // every property list is created as an instance of a suitable + // property list class + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dcpl; + } + + // ... + + H5Pclose(dcpl); +fail_dcpl:; + } + //! + + //! + { + __label__ fail_dcpl, fail_plist_cls_id; + hid_t dcpl, plist_cls_id; + + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dcpl; + } + // to perform introspection on any kind of property list, + // we need to determine its property list class by obtaining a handle + if ((plist_cls_id = H5Pget_class(dcpl)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_plist_cls_id; + } + // Compare the handle to the handles of built-in or user-defined + // property list classes + assert(H5Pequal(plist_cls_id, H5P_DATASET_CREATE) > 0); + +fail_plist_cls_id: + H5Pclose(dcpl); +fail_dcpl:; + } + //! + + //! + { + __label__ fail_dcpl, fail_prop; + hid_t dcpl; + + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dcpl; + } + + // a property list is updated by adding (or removing) properties + if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + +fail_prop: + H5Pclose(dcpl); +fail_dcpl:; + } + //! + + //! + { + __label__ fail_dcpl; + hid_t dcpl; + + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dcpl; + } + + // a property list is "deleted" by closing it + H5Pclose(dcpl); +fail_dcpl:; + } + //! + + //! + { + __label__ fail_cls, fail_prop; + hid_t plist_cls, plist; + int izero = 0; + double dzero = 0.0; + + // create a new property list class + if ((plist_cls = H5Pcreate_class(H5P_ROOT, "int & double", NULL, NULL, NULL, NULL, NULL, NULL)) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_cls; + } + // add a permanent integer property + if (H5Pregister2(plist_cls, "int", sizeof(int), &izero, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < + 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + // add a permanent double property + if (H5Pregister2(plist_cls, "double", sizeof(double), &dzero, NULL, NULL, NULL, NULL, NULL, NULL, + NULL) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + // create an instance of this user-defined property list class + if ((plist = H5Pcreate(plist_cls)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + + // ... + + H5Pclose(plist); +fail_prop: + H5Pclose_class(plist_cls); +fail_cls:; + } + //! + + //! + { + __label__ fail_cls, fail_prop, fail_plist; + hid_t plist_cls, plist; + size_t nprops; + + if ((plist_cls = H5Pcreate_class(H5P_ROOT, "ud_plist", NULL, NULL, NULL, NULL, NULL, NULL)) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_cls; + } + if ((plist = H5Pcreate(plist_cls)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + if (H5Pinsert2(plist, "temp", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) { + ret_val = EXIT_FAILURE; + goto fail_plist; + } + // count the registered properties of this class + if (H5Pget_nprops(plist_cls, &nprops) < 0) { + ret_val = EXIT_FAILURE; + goto fail_plist; + } + // this will be 0 as there are no registered properties + printf("Property list class has %lu registered properties.\n", nprops); + + // count the properties in this property list + if (H5Pget_nprops(plist, &nprops) < 0) { + ret_val = EXIT_FAILURE; + goto fail_plist; + } + // will be 1 as there is one temporary property + printf("Property list has %lu property.\n", nprops); + +fail_plist: + H5Pclose(plist); +fail_prop: + H5Pclose_class(plist_cls); +fail_cls:; + } + //! + + //! + { + __label__ fail_cls, fail_prop, fail_plist; + hid_t plist_cls, plist; + + if ((plist_cls = H5Pcreate_class(H5P_ROOT, "ud_plist", NULL, NULL, NULL, NULL, NULL, NULL)) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_cls; + } + // create an instance of this user-defined property list class + if ((plist = H5Pcreate(plist_cls)) < 0) { + ret_val = EXIT_FAILURE; + goto fail_prop; + } + // insert a temporary property + if (H5Pinsert2(plist, "temp", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) { + ret_val = EXIT_FAILURE; + goto fail_plist; + } + +fail_plist: + H5Pclose(plist); +fail_prop: + H5Pclose_class(plist_cls); +fail_cls:; + } + //! + + //! + { + __label__ fail_cls; + hid_t plist_cls; + + if ((plist_cls = H5Pcreate_class(H5P_ROOT, "int & double", NULL, NULL, NULL, NULL, NULL, NULL)) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_cls; + } + // ... + + // a user defined property list class is destroyed by closing the handle + H5Pclose_class(plist_cls); +fail_cls:; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5R_examples.c b/doxygen/examples/H5R_examples.c new file mode 100644 index 0000000..b40b992 --- /dev/null +++ b/doxygen/examples/H5R_examples.c @@ -0,0 +1,171 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_file, fail_fspace, fail_dset, fail_sel, fail_aspace, fail_attr, fail_awrite; + hid_t file, fspace, dset, aspace, attr; + H5R_ref_t ref; + + if ((file = H5Fcreate("reference.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + // create a region reference which selects all elements of the dataset at "/data" + if ((fspace = H5Screate_simple(2, (hsize_t[]){10, 20}, NULL)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_fspace; + } + if ((dset = H5Dcreate(file, "data", H5T_STD_I32LE, fspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dset; + } + if (H5Sselect_all(fspace) < 0 || H5Rcreate_region(file, "data", fspace, H5P_DEFAULT, &ref) < 0) { + ret_val = EXIT_FAILURE; + goto fail_sel; + } + // store the region reference in a scalar attribute of the root group called "region" + if ((aspace = H5Screate(H5S_SCALAR)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_aspace; + } + if ((attr = H5Acreate(file, "region", H5T_STD_REF, aspace, H5P_DEFAULT, H5P_DEFAULT)) == + H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_attr; + } + if (H5Awrite(attr, H5T_STD_REF, &ref) < 0) { + ret_val = EXIT_FAILURE; + goto fail_awrite; + } + +fail_awrite: + H5Aclose(attr); +fail_attr: + H5Sclose(aspace); +fail_aspace: + H5Rdestroy(&ref); +fail_sel: + H5Dclose(dset); +fail_dset: + H5Sclose(fspace); +fail_fspace: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_file, fail_attr, fail_aread; + hid_t file, attr; + H5R_ref_t ref; + + if ((file = H5Fopen("reference.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // read the dataset region reference from the attribute + if ((attr = H5Aopen(file, "region", H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_attr; + } + if (H5Aread(attr, H5T_STD_REF, &ref) < 0) { + ret_val = EXIT_FAILURE; + goto fail_aread; + } + assert(H5Rget_type(&ref) == H5R_DATASET_REGION2); + + // get an HDF5 path name for the dataset of the region reference + { + char buf[255]; + if (H5Rget_obj_name(&ref, H5P_DEFAULT, buf, 255) < 0) { + ret_val = EXIT_FAILURE; + } + printf("Object name: \"%s\"\n", buf); + } + + H5Rdestroy(&ref); +fail_aread: + H5Aclose(attr); +fail_attr: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_file, fail_attr, fail_ref; + hid_t file, attr; + H5R_ref_t ref; + + if ((file = H5Fopen("reference.h5", H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + + // H5T_STD_REF is a generic reference type + // we can "update" the attribute value to refer to the attribute itself + if ((attr = H5Aopen(file, "region", H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_attr; + } + if (H5Rcreate_attr(file, "data", "region", H5P_DEFAULT, &ref) < 0) { + ret_val = EXIT_FAILURE; + goto fail_ref; + } + + assert(H5Rget_type(&ref) == H5R_ATTR); + + if (H5Awrite(attr, H5T_STD_REF, &ref) < 0) { + ret_val = EXIT_FAILURE; + } + + H5Rdestroy(&ref); +fail_ref: + H5Aclose(attr); +fail_attr: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_file, fail_ref; + hid_t file; + H5R_ref_t ref; + + // create an HDF5 object reference to the root group + if ((file = H5Fopen("reference.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + if (H5Rcreate_object(file, ".", H5P_DEFAULT, &ref) < 0) { + ret_val = EXIT_FAILURE; + goto fail_ref; + } + + // H5Rdestroy() releases all resources associated with an HDF5 reference + H5Rdestroy(&ref); +fail_ref: + H5Fclose(file); +fail_file:; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5S_examples.c b/doxygen/examples/H5S_examples.c new file mode 100644 index 0000000..c542ec0 --- /dev/null +++ b/doxygen/examples/H5S_examples.c @@ -0,0 +1,132 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_dspace; + hid_t dspace; + + // create a 2D chess board shape (8x8) + if ((dspace = H5Screate_simple(2, (hsize_t[]){8, 8}, NULL)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dspace; + } + + H5Sclose(dspace); +fail_dspace:; + } + //! + + //! + { + __label__ fail_dspace; + hid_t dspace; + + if ((dspace = H5Screate(H5S_NULL)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dspace; + } + + // make changes to the selection on DSPACE + // ... + // parse the resulting selection + + switch (H5Sget_select_type(dspace)) { + case H5S_SEL_HYPERSLABS: + // we are dealing with a hyperslab selection + // determine the regularity and block structure + break; + case H5S_SEL_POINTS: + // we are dealing with a point selection + // for example, retrieve the point list + break; + case H5S_SEL_ALL: + // all dataset elements are selected + break; + case H5S_SEL_NONE: + // the selection is empty + break; + default: + ret_val = EXIT_FAILURE; + break; + } + + if (dspace != H5S_ALL) + H5Sclose(dspace); + +fail_dspace:; + } + //! + + //! + { + __label__ fail_select, fail_dspace; + hid_t dspace; + + // create a 2D chess board shape (8x8) + if ((dspace = H5Screate_simple(2, (hsize_t[]){8, 8}, NULL)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dspace; + } + // select all black fields: do this w/ a hyperslab union in two steps + + // select the black fields on even rows + if (H5Sselect_hyperslab(dspace, H5S_SELECT_SET, (hsize_t[]){0, 0}, (hsize_t[]){2, 2}, + (hsize_t[]){4, 4}, NULL) < 0) { + ret_val = EXIT_FAILURE; + goto fail_select; + } + // select the black fields on odd rows + // notice the H5S_SELECT_OR operator + if (H5Sselect_hyperslab(dspace, H5S_SELECT_OR, (hsize_t[]){1, 1}, (hsize_t[]){2, 2}, + (hsize_t[]){4, 4}, NULL) < 0) { + ret_val = EXIT_FAILURE; + goto fail_select; + } + + // should be 32 + printf("%lld elements selected.\n", H5Sget_select_npoints(dspace)); + +fail_select: + H5Sclose(dspace); +fail_dspace:; + } + //! + + //! + { + __label__ fail_select, fail_dspace; + hid_t dspace; + + if ((dspace = H5Screate(H5S_NULL)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dspace; + } + + // make changes to and work with the selection on DSPACE + // ... + // finally, clear the selection + + if (H5Sselect_none(dspace) < 0) { + ret_val = EXIT_FAILURE; + goto fail_select; + } + +fail_select: + if (dspace != H5S_ALL) + H5Sclose(dspace); +fail_dspace:; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5T_examples.c b/doxygen/examples/H5T_examples.c new file mode 100644 index 0000000..7cfa7d4 --- /dev/null +++ b/doxygen/examples/H5T_examples.c @@ -0,0 +1,136 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_insert, fail_dtype, fail_file; + hid_t file, dtype; + + if ((file = H5Fcreate("t1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + // create a compound datatype with room for real and imaginary parts + if ((dtype = H5Tcreate(H5T_COMPOUND, 2 * sizeof(double))) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dtype; + } + // add the real part now and the imaginary part later + if (H5Tinsert(dtype, "re", 0, H5T_IEEE_F64LE) < 0) { + ret_val = EXIT_FAILURE; + goto fail_insert; + } + // commit the datatype definition to the file + if (H5Tcommit(file, "pre-complex", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + } + +fail_insert: + H5Tclose(dtype); +fail_dtype: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_dtype, fail_file; + hid_t file, dtype; + + if ((file = H5Fopen("t1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + // open the datatype object stored in the file + if ((dtype = H5Topen(file, "pre-complex", H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dtype; + } + + switch (H5Tget_class(dtype)) { // this time we are only interested in compounds + case H5T_COMPOUND: + printf("Record size: %lu bytes\n", H5Tget_size(dtype)); + printf("Record has %d field(s).\n", H5Tget_nmembers(dtype)); + break; + default: + break; + } + + H5Tclose(dtype); +fail_dtype: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_insert, fail_clone, fail_dtype, fail_file; + hid_t file, dtype, clone; + + if ((file = H5Fopen("t1.h5", H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + // open the datatype object stored in the file + if ((dtype = H5Topen(file, "pre-complex", H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_dtype; + } + // the original datatype object is immutable and we need to clone it + if ((clone = H5Tcopy(dtype)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_clone; + } + // remember that the original has enough room for real and imaginary parts + // add the imaginary part + if (H5Tinsert(clone, "im", sizeof(double), H5T_IEEE_F64LE) < 0) { + ret_val = EXIT_FAILURE; + goto fail_insert; + } + // commit the "updated" datatype definition to the file + if (H5Tcommit(file, "complex", clone, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + } + +fail_insert: + H5Tclose(clone); +fail_clone: + H5Tclose(dtype); +fail_dtype: + H5Fclose(file); +fail_file:; + } + //! + + //! + { + __label__ fail_file; + hid_t file; + + if ((file = H5Fopen("t1.h5", H5F_ACC_RDWR, H5P_DEFAULT)) == H5I_INVALID_HID) { + ret_val = EXIT_FAILURE; + goto fail_file; + } + // delete the "pre-complex" datatype by unlinking + if (H5Ldelete(file, "pre-complex", H5P_DEFAULT) < 0) { + ret_val = EXIT_FAILURE; + } + + H5Fclose(file); +fail_file:; + } + //! + + return ret_val; +} diff --git a/doxygen/examples/H5Z_examples.c b/doxygen/examples/H5Z_examples.c new file mode 100644 index 0000000..28a1ea2 --- /dev/null +++ b/doxygen/examples/H5Z_examples.c @@ -0,0 +1,108 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +//! +size_t +filter(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t *buf_size, + void **buf) +{ + buf_size = 0; + + if (flags & H5Z_FLAG_REVERSE) { + // read data, e.g., decompress data + // ... + } + else { + // write data, e.g., compress data + // ... + } + + return nbytes; +} +//! + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + __label__ fail_register; + H5Z_class_t cls; + cls.version = H5Z_CLASS_T_VERS; + cls.id = 256; + cls.encoder_present = 1; + cls.decoder_present = 1; + cls.name = "Identity filter"; + cls.can_apply = NULL; + cls.set_local = NULL; + cls.filter = &filter; + + // register the filter + if (H5Zregister(&cls) < 0) { + ret_val = EXIT_FAILURE; + goto fail_register; + } + + // do something with filter + // ... + + // unregister the filter if no longer required + // ... + +fail_register:; + } + //! + + //! + { + __label__ fail_avail; + + H5Z_filter_t flt = H5Z_FILTER_DEFLATE; + unsigned flags = 0; + + // check if the deflate filter is available + if (H5Zfilter_avail(flt) < 0) { + ret_val = EXIT_FAILURE; + goto fail_avail; + } + // retrieve the deflate filter info + if (H5Zget_filter_info(flt, &flags) < 0) { + ret_val = EXIT_FAILURE; + goto fail_avail; + } + + // check if the deflate encoder or decoder is enabled + if (H5Z_FILTER_CONFIG_ENCODE_ENABLED & flags) + printf("Deflate encoder enabled.\n"); + if (H5Z_FILTER_CONFIG_DECODE_ENABLED & flags) + printf("Deflate decoder enabled.\n"); + +fail_avail:; + } + //! + + //! + { + // N/A + } //! + + //! + { + // unregister the identity filter + if (H5Zunregister(256) < 0) { + ret_val = EXIT_FAILURE; + } + } + //! + + assert(ret_val == EXIT_SUCCESS); + + return ret_val; +} diff --git a/doxygen/examples/H5_examples.c b/doxygen/examples/H5_examples.c new file mode 100644 index 0000000..ef52ed0 --- /dev/null +++ b/doxygen/examples/H5_examples.c @@ -0,0 +1,85 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +#include "hdf5.h" + +#include +#include +#include + +//! +void +closing_shop(void *ctx) +{ + printf("GoodBye, Cruel World!\n"); +} +//! + +int +main(void) +{ + int ret_val = EXIT_SUCCESS; + + //! + { + // an HDF5 library instance is automatically initialized as + // part of the first HDF5 API call, but there's no harm in + // calling H5open(). + if (H5open() < 0) { + ret_val = EXIT_FAILURE; + } + } + //! + + //! + { + __label__ fail_read; + unsigned majnum, minnum, relnum; + hbool_t flag; + + // retrieve the library version + if (H5get_libversion(&majnum, &minnum, &relnum) < 0) { + ret_val = EXIT_FAILURE; + goto fail_read; + } + // is this a thread-safe library build? + if (H5is_library_threadsafe(&flag) < 0) { + ret_val = EXIT_FAILURE; + goto fail_read; + } + + printf("Welcome to HDF5 %d.%d.%d\n", majnum, minnum, relnum); + printf("Thread-safety %s\n", (flag > 0) ? "enabled" : "disabled"); + +fail_read:; + } + //! + + //! + { + // update the library instance free list limits + if (H5set_free_list_limits(512 * 1024, 32 * 1024, 2048 * 1024, 128 * 1024, 8192 * 1024, 512 * 1024) < + 0) { + ret_val = EXIT_FAILURE; + } + } + //! + + //! + { +#if H5_VERSION_GE(1, 13, 0) + // install a finalization routine + if (H5atclose(&closing_shop, NULL) < 0) { + ret_val = EXIT_FAILURE; + } +#endif + // close shop + if (H5close() < 0) { + ret_val = EXIT_FAILURE; + } + } + //! + + assert(ret_val == EXIT_SUCCESS); + + return ret_val; +} diff --git a/doxygen/hdf5_header.html b/doxygen/hdf5_header.html index 4a575d6..23f41f9 100644 --- a/doxygen/hdf5_header.html +++ b/doxygen/hdf5_header.html @@ -21,7 +21,7 @@ $mathjax -
    Please, help us to better know about our user community by answering the following short survey: https://www.hdfgroup.org/
    +
    Please, help us to better know about our user community by answering the following short survey: https://www.hdfgroup.org/website-survey/
    diff --git a/doxygen/hdf5doxy_layout.xml b/doxygen/hdf5doxy_layout.xml index 7f71c24..fc20aa1 100644 --- a/doxygen/hdf5doxy_layout.xml +++ b/doxygen/hdf5doxy_layout.xml @@ -11,6 +11,7 @@ + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff47c8e..7989899 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1416,6 +1416,7 @@ if (DOXYGEN_FOUND) 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_TAG_FILE ${HDF5_DOXYGEN_DIR}/hdf5.tag) set (DOXYGEN_SERVER_BASED_SEARCH NO) set (DOXYGEN_EXTERNAL_SEARCH NO) set (DOXYGEN_SEARCHENGINE_URL) 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. * * * * * * * * * * * *
    CreateRead
    - * \snippet H5A_examples.c create + * \snippet{lineno} H5A_examples.c create * - * \snippet H5A_examples.c read + * \snippet{lineno} H5A_examples.c read *
    UpdateDelete
    - * \snippet H5A_examples.c update + * \snippet{lineno} H5A_examples.c update * - * \snippet H5A_examples.c delete + * \snippet{lineno} H5A_examples.c delete *
    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/H5Dmodule.h b/src/H5Dmodule.h index 595c714..596fd48 100644 --- a/src/H5Dmodule.h +++ b/src/H5Dmodule.h @@ -44,18 +44,18 @@ * CreateRead * * - * \snippet H5D_examples.c create + * \snippet{lineno} H5D_examples.c create * * - * \snippet H5D_examples.c read + * \snippet{lineno} H5D_examples.c read * * UpdateDelete * * - * \snippet H5D_examples.c update + * \snippet{lineno} H5D_examples.c update * * - * \snippet H5D_examples.c delete + * \snippet{lineno} H5D_examples.c delete * * * diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 63cc61c..8fe8020 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; //! @@ -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; //! @@ -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; //! @@ -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; //! @@ -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; //! @@ -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; //! //! /** - * 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); //! //! /** - * 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 \pelem + * \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 //! /** - * 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 //! /** - * 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); //! //! /** - * 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. */ -//! typedef int (*H5D_chunk_iter_op_t)(const hsize_t *offset, uint32_t filter_mask, haddr_t addr, uint32_t nbytes, void *op_data); +//! /********************/ /* 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,7 +663,7 @@ 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 @@ -649,33 +674,16 @@ 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, hid_t dxpl_id, H5D_chunk_iter_op_t cb, void *op_data); @@ -696,16 +704,16 @@ H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t cb * * \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 @@ -719,9 +727,9 @@ H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t cb * \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 * @@ -737,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 @@ -786,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 @@ -833,14 +840,12 @@ H5_DLL haddr_t H5Dget_offset(hid_t dset_id); * * * - * \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, @@ -953,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 @@ -960,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() * */ @@ -1000,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 @@ -1032,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 * @@ -1074,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 @@ -1091,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 * @@ -1122,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: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    \c elem[in,out]Pointer to the memory buffer containing the current - * data element
    \c type_id[in]Datatype identifier of the elements stored in elem
    \c ndim[in]Number of dimensions for the point array
    \c point[in]Array containing the location of the element within - * the original dataspace
    \c operator_data[in,out]Pointer to any user-defined data associated with the - * operation
    - * - * 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 @@ -1217,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); @@ -1287,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 * @@ -1337,6 +1292,8 @@ 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); @@ -1395,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: - * - * - * - * - * - * - * - * - * - * - * - *
    \c src_buf[out]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.
    \c src_buf_bytes_used[out]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. - *
    \c op_data[in,out]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.
    - * - * 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 * @@ -1480,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. - * - * - * - * - * - * - * - *
    \c dst_bufPointer 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().
    \c dst_buf_bytes_usedPointer to the number of valid bytes in \p dst_buf. - * This number must be a multiple of the datatype - * size.
    \c op_dataUser-defined pointer to data required by the callback - * function; a pass-through of the \p op_data pointer - * provided with the H5Dgather() function call.
    - * 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 @@ -1524,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 * @@ -1544,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) */ @@ -1573,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. * @@ -1613,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 @@ -1680,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, @@ -1711,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: @@ -1734,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. * */ @@ -1752,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. @@ -1771,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/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/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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5E_examples.c create + * + * \snippet{lineno} H5E_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5E_examples.c update + * + * \snippet{lineno} H5E_examples.c delete + *
    + * + * \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/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.} * - * + * * * * + * + * + * + * + * * *
    CreateOpen
    CreateRead
    - * \snippet H5F_examples.c life_cycle + * \snippet{lineno} H5F_examples.c create * - * \snippet H5F_examples.c life_cycle_w_open + * \snippet{lineno} H5F_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5F_examples.c update + * + * \snippet{lineno} H5F_examples.c delete *
    diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 98d2a9f..c3230e1 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -1777,6 +1777,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) */ @@ -1796,6 +1797,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/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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5G_examples.c create + * + * \snippet{lineno} H5G_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5G_examples.c update + * + * \snippet{lineno} H5G_examples.c delete + *
    * * \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/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/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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5I_examples.c create + * + * \snippet{lineno} H5I_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5I_examples.c update + * + * \snippet{lineno} H5I_examples.c delete + *
    + * + * \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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5I_examples.c create_ud + * + * \snippet{lineno} H5I_examples.c read_ud + *
    UpdateDelete
    + * \snippet{lineno} H5I_examples.c update_ud + * + * \snippet{lineno} H5I_examples.c delete_ud + *
    + * */ #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/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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5L_examples.c create + * + * \snippet{lineno} H5L_examples.c iter_cb + * \snippet{lineno} H5L_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5L_examples.c update + * + * \snippet{lineno} H5L_examples.c delete + *
    * * \defgroup TRAV Link Traversal * \ingroup H5L 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/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/H5Mpublic.h b/src/H5Mpublic.h index b3a0903..3f94edb 100644 --- a/src/H5Mpublic.h +++ b/src/H5Mpublic.h @@ -588,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) */ @@ -606,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/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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5O_examples.c create + * + * \snippet{lineno} H5O_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5O_examples.c update + * + * \snippet{lineno} H5O_examples.c delete + *
    * */ #endif /* H5Omodule_H */ diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 7bc7784..0fcedb2 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,22 +51,26 @@ * 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) /* 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) @@ -81,9 +85,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) //! @@ -91,8 +95,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) //! @@ -146,15 +150,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; //! @@ -165,11 +169,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; //! @@ -181,6 +184,17 @@ typedef uint32_t H5O_msg_crt_idx_t; //! /** * 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); //! @@ -460,28 +474,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 +523,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 +578,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 +610,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 +641,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 +682,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 +1162,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 * best effort setting. If the application passes in * a value indicating iteration in creation order and a group is @@ -1250,62 +1173,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: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    \c objObject that serves as root of the iteration; - * same value as the H5Ovisit() \p obj_id parameter
    \c nameName of object, relative to \c obj, being examined at - * current step of the iteration
    \c infoH5O_info2_t \c struct containing information - * regarding that object
    \c op_dataUser-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
    - * - * 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 +1197,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 +1261,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 * best effort setting. If the application passes in a @@ -1425,49 +1272,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: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    \c objObject that serves as root of the iteration
    \c nameName of object, relative to \c obj, being examined at - * current step of the iteration
    \c infoH5O_info2_t \c struct containing information - * regarding that object
    \c op_dataUser-defined pointer to data required by the application in - * processing the object
    - * - * 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 +1300,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 +1366,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 +1442,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 +1482,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 +1629,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 +1653,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 +1668,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 +1702,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 +1715,16 @@ typedef struct H5O_info1_t { //! /** * 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); //! @@ -2027,36 +1797,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 +1897,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 +2092,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 * best effort setting. If the application passes in @@ -2375,56 +2103,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: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    \c objObject that serves as root of the iteration; - * same value as the H5Ovisit1() \p obj_id parameter
    \c nameName of object, relative to \c obj, being examined at - * current step of the iteration
    \c infoH5O_info1_t \c struct containing information - * regarding that object
    \c op_dataUser-defined pointer to data required by the application in - * processing the object
    - * - * 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 +2117,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 +2184,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 * best effort setting. If the application passes in a @@ -2537,10 +2195,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 +2225,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 +2287,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 * best effort setting. If the application passes in @@ -2664,57 +2298,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: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    \c objObject that serves as root of the iteration; - * same value as the H5Ovisit1() \p obj_id parameter
    \c nameName of object, relative to \c obj, being examined at - * current step of the iteration
    \c infoH5O_info1_t \c struct containing information - * regarding that object
    \c op_dataUser-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
    - * - * 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 +2317,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 +2381,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 * best effort setting. If the application passes in a @@ -2828,10 +2392,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 +2427,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/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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet H5PL_examples.c create + * + * \snippet H5PL_examples.c read + *
    UpdateDelete
    + * \snippet H5PL_examples.c update + * + * \snippet H5PL_examples.c delete + *
    + * + * \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/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. + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5P_examples.c create + * + * \snippet{lineno} H5P_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5P_examples.c update + * + * \snippet{lineno} H5P_examples.c delete + *
    * - * \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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5P_examples.c create + * + * \snippet{lineno} H5P_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5P_examples.c update + * + * \snippet{lineno} H5P_examples.c delete + *
    + * + * \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. + * + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5P_examples.c create_class + * + * \snippet{lineno} H5P_examples.c read_class + *
    UpdateDelete
    + * \snippet{lineno} H5P_examples.c update_class + * + * \snippet{lineno} H5P_examples.c delete_class + *
    + * + * \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/H5Ppublic.h b/src/H5Ppublic.h index 10609b2..5e9c4ab 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -100,7 +100,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 +115,23 @@ extern "C" { /* Define property list class callback function pointer types */ //! +/** + * \todo Document me! + */ typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data); //! //! +/** + * \todo Document me! + */ typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data); //! //! +/** + * \todo Document me! + */ typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data); //! @@ -159,12 +170,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; +//! +/** + * \todo Document me! + */ typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size); +//! +//! +/** + * \todo Document me! + */ typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); +//! typedef H5P_prp_cb2_t H5P_prp_delete_func_t; typedef H5P_prp_cb1_t H5P_prp_copy_func_t; //! +/** + * \todo Document me! + */ typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); //! @@ -172,6 +196,9 @@ typedef H5P_prp_cb1_t H5P_prp_close_func_t; /* Define property list iteration function type */ //! +/** + * \todo Document me! + */ typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); //! @@ -2211,7 +2238,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 * @@ -2220,6 +2247,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. @@ -5237,7 +5266,7 @@ 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) * @@ -5306,7 +5335,7 @@ H5_DLL herr_t H5Pget_vol_cap_flags(hid_t plist_id, unsigned *cap_flags); */ 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 * @@ -6266,6 +6295,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. @@ -6337,6 +6368,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. * @@ -6430,6 +6463,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. * @@ -6539,6 +6574,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. @@ -9455,9 +9492,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 */ @@ -9571,8 +9605,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/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. + * + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5R_examples.c create + * + * \snippet{lineno} H5R_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5R_examples.c update + * + * \snippet{lineno} H5R_examples.c delete + *
    + * */ #endif /* H5Rmodule_H */ 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/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. + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5S_examples.c create + * + * \snippet{lineno} H5S_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5S_examples.c update + * + * \snippet{lineno} H5S_examples.c delete + *
    * */ 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/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}. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5T_examples.c create + * + * \snippet{lineno} H5T_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5T_examples.c update + * + * \snippet{lineno} H5T_examples.c delete + *
    * * \defgroup ARRAY Array Datatypes * \ingroup H5T 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/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. + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5Z_examples.c filter + * \snippet{lineno} H5Z_examples.c create + * + * \snippet{lineno} H5Z_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5Z_examples.c update + * + * \snippet{lineno} H5Z_examples.c delete + *
    * - * Filter identifiers for the filters distributed with the HDF5 - * Library are as follows: - * - * - * - * - * - * - * - *
    #H5Z_FILTER_DEFLATEThe gzip compression, or - * deflation, filter
    #H5Z_FILTER_SZIPThe SZIP compression - * filter
    #H5Z_FILTER_NBITThe N-bit compression - * filter
    #H5Z_FILTER_SCALEOFFSETThe scale-offset - * compression filter
    #H5Z_FILTER_SHUFFLEThe shuffle algorithm - * filter
    #H5Z_FILTER_FLETCHER32The Fletcher32 checksum, - * or error checking, filter
    - * 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: + * + * + * + * + * + * + * + *
    #H5Z_FILTER_DEFLATEThe gzip compression, or + * deflation, filter
    #H5Z_FILTER_SZIPThe SZIP compression + * filter
    #H5Z_FILTER_NBITThe N-bit compression + * filter
    #H5Z_FILTER_SCALEOFFSETThe scale-offset + * compression filter
    #H5Z_FILTER_SHUFFLEThe shuffle algorithm + * filter
    #H5Z_FILTER_FLETCHER32The Fletcher32 checksum, + * or error checking, filter
    + * 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/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. + * + * + * + * + * + * + * + * + * + * + * + *
    CreateRead
    + * \snippet{lineno} H5_examples.c create + * + * \snippet{lineno} H5_examples.c read + *
    UpdateDelete
    + * \snippet{lineno} H5_examples.c update + * + * \snippet{lineno} H5_examples.c closing_shop + * \snippet{lineno} H5_examples.c delete + *
    + * */ #endif /* H5module_H */ diff --git a/src/H5public.h b/src/H5public.h index e7ed518..65709c6 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -172,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"); @@ -182,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 +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"); @@ -197,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 * @@ -285,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 */ //! /** -- cgit v0.12 From 6d15c45225e6b5202a4c1cfba2587ec0021de666 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 2 Sep 2021 07:57:47 -0500 Subject: Synch CMake doxygen options with autotools configure (#983) --- src/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7989899..1e3c626 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1410,7 +1410,7 @@ if (DOXYGEN_FOUND) 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_EXAMPLES_DIRECTORY "${HDF5_DOXYGEN_DIR}/dox/cookbook ${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) @@ -1420,6 +1420,7 @@ if (DOXYGEN_FOUND) set (DOXYGEN_SERVER_BASED_SEARCH NO) set (DOXYGEN_EXTERNAL_SEARCH NO) set (DOXYGEN_SEARCHENGINE_URL) + set (DOXYGEN_PREDEFINED H5_HAVE_DIRECT H5_HAVE_LIBHDFS H5_HAVE_MAP_API H5_HAVE_PARALLEL H5_HAVE_ROS3_VFD) # This configure and custom target work together # Replace variables inside @@ with the current values -- cgit v0.12 From f679c6ea28599669a3961068b04b415377c64b8b Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Sat, 4 Sep 2021 15:22:07 -0500 Subject: Small doxygen fixes plus simple doc fixes (#989) Change doxygen generated file location Clang format override for flags --- config/cmake/README.txt.cmake.in | 2 +- release_docs/RELEASE.txt | 1 - src/CMakeLists.txt | 2 +- src/H5Opublic.h | 16 +++++++--------- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in index f621515..9289870 100644 --- a/config/cmake/README.txt.cmake.in +++ b/config/cmake/README.txt.cmake.in @@ -75,6 +75,6 @@ For more information see USING_CMake_Examples.txt in the install folder. =========================================================================== Documentation for this release can be found at the following URL: - https://portal.hdfgroup.org/display/support + https://portal.hdfgroup.org/display/HDF5/HDF5 Bugs should be reported to help@hdfgroup.org. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 86074d0..29600bd 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -745,7 +745,6 @@ New Features Fortran Library: ---------------- - - H5Fget_name_f fixed to handle correctly trailing whitespaces and newly allocated buffers. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e3c626..d1d848d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1416,7 +1416,7 @@ if (DOXYGEN_FOUND) 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_TAG_FILE ${HDF5_DOXYGEN_DIR}/hdf5.tag) + set (DOXYGEN_TAG_FILE ${HDF5_BINARY_DIR}/hdf5.tag) set (DOXYGEN_SERVER_BASED_SEARCH NO) set (DOXYGEN_EXTERNAL_SEARCH NO) set (DOXYGEN_SEARCHENGINE_URL) diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 0fcedb2..d9d0500 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -61,19 +61,17 @@ (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. -- cgit v0.12 From 216f5ba65e21cef46ce23060fb57cc9f1706f22a Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 7 Sep 2021 08:18:53 -0500 Subject: Sync CMake java macros with cmake repo (#982) --- MANIFEST | 1 + config/cmake/UseJava.cmake | 838 +++++++++++++++++++------------- config/cmake/UseJavaClassFilelist.cmake | 17 +- config/cmake/UseJavaSymlinks.cmake | 11 +- config/cmake/javaTargets.cmake.in | 39 ++ 5 files changed, 537 insertions(+), 369 deletions(-) create mode 100644 config/cmake/javaTargets.cmake.in diff --git a/MANIFEST b/MANIFEST index 7c97bc1..ce9776e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3579,6 +3579,7 @@ ./config/cmake/HDF5PluginMacros.cmake ./config/cmake/HDF5PluginCache.cmake ./config/cmake/HDF5UseFortran.cmake +./config/cmake/javaTargets.cmake.in ./config/cmake/jrunTest.cmake ./config/cmake/jvolTest.cmake ./config/cmake/libh5cc.in diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 375004e..2351ce8 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -4,369 +4,516 @@ UseJava ------- -Use Module for Java - -This file provides functions for Java. It is assumed that +This file provides support for ``Java``. It is assumed that :module:`FindJava` has already been loaded. See :module:`FindJava` for -information on how to load Java into your CMake project. +information on how to load Java into your ``CMake`` project. + +Synopsis +^^^^^^^^ + +.. parsed-literal:: + + `Creating and Installing JARS`_ + `add_jar`_ ( [SOURCES] [...] ...) + `install_jar`_ ( DESTINATION [COMPONENT ]) + `install_jni_symlink`_ ( DESTINATION [COMPONENT ]) + + `Header Generation`_ + `create_javah`_ ((TARGET | GENERATED_FILES ) CLASSES ... ...) + + `Exporting JAR Targets`_ + `install_jar_exports`_ (TARGETS ... FILE DESTINATION ...) + `export_jars`_ (TARGETS ... [NAMESPACE ] FILE ) + + `Finding JARs`_ + `find_jar`_ ( NAMES [...] [PATHS [... ENV ]] ...) + + `Creating Java Documentation`_ + `create_javadoc`_ ( (PACKAGES [...] | FILES [...]) ...) Creating And Installing JARs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. code-block:: cmake +.. _add_jar: - add_jar( - [SOURCES] [...] [...] - [INCLUDE_JARS [...]] - [ENTRY_POINT ] - [VERSION ] - [OUTPUT_NAME ] - [OUTPUT_DIR ] - [GENERATE_NATIVE_HEADERS [DESTINATION ]] - ) +.. command:: add_jar -This command creates a ``.jar``. It compiles the given -```` files and adds the given ```` files to -the jar file. Source files can be java files or listing files -(prefixed by ``@``). If only resource files are given then just a jar file -is created. The list of ``INCLUDE_JARS`` are added to the classpath when -compiling the java sources and also to the dependencies of the target. -``INCLUDE_JARS`` also accepts other target names created by ``add_jar()``. -For backwards compatibility, jar files listed as sources are ignored (as -they have been since the first version of this module). + Creates a jar file containing java objects and, optionally, resources:: -The default ``OUTPUT_DIR`` can also be changed by setting the variable -``CMAKE_JAVA_TARGET_OUTPUT_DIR``. + add_jar( + [SOURCES] [...] [...] + [INCLUDE_JARS [...]] + [ENTRY_POINT ] + [VERSION ] + [MANIFEST ] + [OUTPUT_NAME ] + [OUTPUT_DIR ] + [GENERATE_NATIVE_HEADERS + [DESTINATION (|INSTALL [BUILD ])]] + ) -Optionally, using option ``GENERATE_NATIVE_HEADERS``, native header files can -be generated for methods declared as native. These files provide the -connective glue that allow your Java and C code to interact. An INTERFACE -target will be created for an easy usage of generated files. Sub-option -``DESTINATION`` can be used to specify the output directory for generated -header files. + This command creates a ``.jar``. It compiles the given + ```` files and adds the given ```` files to + the jar file. Source files can be java files or listing files + (prefixed by ``@``). If only resource files are given then just a jar file + is created. -``GENERATE_NATIVE_HEADERS`` option requires, at least, version 1.8 of the JDK. + ``SOURCES`` + Compiles the specified source files and adds the result in the jar file. -The ``add_jar()`` function sets the following target properties on -````: + .. versionadded:: 3.4 + Support for response files, prefixed by ``@``. -``INSTALL_FILES`` - The files which should be installed. This is used by ``install_jar()``. -``JNI_SYMLINK`` - The JNI symlink which should be installed. This is used by - ``install_jni_symlink()``. -``JAR_FILE`` - The location of the jar file so that you can include it. -``CLASSDIR`` - The directory where the class files can be found. For example to use them - with ``javah``. + ``INCLUDE_JARS`` + The list of jars are added to the classpath when compiling the java sources + and also to the dependencies of the target. ``INCLUDE_JARS`` also accepts + other target names created by ``add_jar()``. For backwards compatibility, + jar files listed as sources are ignored (as they have been since the first + version of this module). -.. code-block:: cmake + ``ENTRY_POINT`` + Defines an entry point in the jar file. - install_jar( ) - install_jar( DESTINATION [COMPONENT ]) + ``VERSION`` + Adds a version to the target output name. -This command installs the ```` files to the given -````. It should be called in the same scope as ``add_jar()`` or -it will fail. + The following example will create a jar file with the name + ``shibboleet-1.2.0.jar`` and will create a symlink ``shibboleet.jar`` + pointing to the jar with the version information. -The ``install_jar()`` function sets the ``INSTALL_DESTINATION`` target -property on jars so installed. This property holds the ```` as -described above, and is used by ``install_jar_exports()``. You can get this -information with :command:`get_property` and the ``INSTALL_DESTINATION`` -property key. + .. code-block:: cmake -.. code-block:: cmake + add_jar(shibboleet shibbotleet.java VERSION 1.2.0) - install_jni_symlink( ) - install_jni_symlink( DESTINATION [COMPONENT ]) + ``MANIFEST`` + Defines a custom manifest for the jar. -This command installs the ```` JNI symlinks to the given -````. It should be called in the same scope as ``add_jar()`` or -it will fail. + ``OUTPUT_NAME`` + Specify a different output name for the target. -.. code-block:: cmake + ``OUTPUT_DIR`` + Sets the directory where the jar file will be generated. If not specified, + :variable:`CMAKE_CURRENT_BINARY_DIR` is used as the output directory. - install_jar_exports(TARGETS ... - [NAMESPACE ] - FILE - DESTINATION [COMPONENT ]) + ``GENERATE_NATIVE_HEADERS`` + .. versionadded:: 3.11 -This command installs a target export file ```` for the named jar -targets to the given ```` directory. Its function is similar to -that of :command:`install(EXPORTS)`. + Generates native header files for methods declared as native. These files + provide the connective glue that allow your Java and C code to interact. + An INTERFACE target will be created for an easy usage of generated files. + Sub-option ``DESTINATION`` can be used to specify the output directory for + generated header files. -.. code-block:: cmake + This option requires, at least, version 1.8 of the JDK. - export_jars(TARGETS ... - [NAMESPACE ] - FILE ) + For an optimum usage of this option, it is recommended to include module + JNI before any call to ``add_jar()``. The produced target for native + headers can then be used to compile C/C++ sources with the + :command:`target_link_libraries` command. -This command writes a target export file ```` for the named ```` -targets. Its function is similar to that of :command:`export`. + .. code-block:: cmake + find_package(JNI) + add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native) + add_library(bar bar.cpp) + target_link_libraries(bar PRIVATE foo-native) -Examples -"""""""" + .. versionadded:: 3.20 + ``DESTINATION`` sub-option now supports the possibility to specify + different output directories for ``BUILD`` and ``INSTALL`` steps. If + ``BUILD`` directory is not specified, a default directory will be used. -To add compile flags to the target you can set these flags with the following -variable: + To export the interface target generated by ``GENERATE_NATIVE_HEADERS`` + option, sub-option ``INSTALL`` of ``DESTINATION`` is required: -.. code-block:: cmake + .. code-block:: cmake - set(CMAKE_JAVA_COMPILE_FLAGS -nowarn) + add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native + DESTINATION INSTALL include) + install(TARGETS foo-native EXPORT native) + install(DIRECTORY "$/" + DESTINATION include) + install(EXPORT native DESTINATION /to/export NAMESPACE foo) + Some variables can be set to customize the behavior of ``add_jar()`` as well + as the java compiler: -To add a path or a jar file to the class path you can do this with the -``CMAKE_JAVA_INCLUDE_PATH`` variable. + ``CMAKE_JAVA_COMPILE_FLAGS`` + Specify additional flags to java compiler. -.. code-block:: cmake + ``CMAKE_JAVA_INCLUDE_PATH`` + Specify additional paths to the class path. - set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar) + ``CMAKE_JNI_TARGET`` + If the target is a JNI library, sets this boolean variable to ``TRUE`` to + enable creation of a JNI symbolic link (see also + :ref:`install_jni_symlink() `). -To use a different output name for the target you can set it with: + ``CMAKE_JAR_CLASSES_PREFIX`` + If multiple jars should be produced from the same java source filetree, + to prevent the accumulation of duplicate class files in subsequent jars, + set/reset ``CMAKE_JAR_CLASSES_PREFIX`` prior to calling the ``add_jar()``: -.. code-block:: cmake + .. code-block:: cmake - add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar) + set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo) + add_jar(foo foo.java) -To use a different output directory than ``CMAKE_CURRENT_BINARY_DIR`` you can -set it with: + set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar) + add_jar(bar bar.java) -.. code-block:: cmake + The ``add_jar()`` function sets the following target properties on + ````: - add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) + ``INSTALL_FILES`` + The files which should be installed. This is used by + :ref:`install_jar() `. + ``JNI_SYMLINK`` + The JNI symlink which should be installed. This is used by + :ref:`install_jni_symlink() `. + ``JAR_FILE`` + The location of the jar file so that you can include it. + ``CLASSDIR`` + The directory where the class files can be found. For example to use them + with ``javah``. + ``NATIVE_HEADERS_DIRECTORY`` + .. versionadded:: 3.20 -To define an entry point in your jar you can set it with the ``ENTRY_POINT`` -named argument: + The directory where native headers are generated. Defined when option + ``GENERATE_NATIVE_HEADERS`` is specified. -.. code-block:: cmake +.. _install_jar: - add_jar(example ENTRY_POINT com/examples/MyProject/Main) +.. command:: install_jar -To define a custom manifest for the jar, you can set it with the ``MANIFEST`` -named argument: + This command installs the jar file to the given destination:: -.. code-block:: cmake + install_jar( ) + install_jar( DESTINATION [COMPONENT ]) - add_jar(example MANIFEST /path/to/manifest) + This command installs the ```` file to the given + ````. It should be called in the same scope as + :ref:`add_jar() ` or it will fail. -To add a version to the target output name you can set it using the ``VERSION`` -named argument to ``add_jar()``. The following example will create a jar file -with the name ``shibboleet-1.0.0.jar`` and will create a symlink -``shibboleet.jar`` pointing to the jar with the version information. + .. versionadded:: 3.4 + The second signature with ``DESTINATION`` and ``COMPONENT`` options. -.. code-block:: cmake + ``DESTINATION`` + Specify the directory on disk to which a file will be installed. - add_jar(shibboleet shibbotleet.java VERSION 1.2.0) + ``COMPONENT`` + Specify an installation component name with which the install rule is + associated, such as "runtime" or "development". -If the target is a JNI library, utilize the following commands to -create a JNI symbolic link: + The ``install_jar()`` command sets the following target properties + on ````: -.. code-block:: cmake + ``INSTALL_DESTINATION`` + Holds the ```` as described above, and is used by + :ref:`install_jar_exports() `. - set(CMAKE_JNI_TARGET TRUE) - add_jar(shibboleet shibbotleet.java VERSION 1.2.0) - install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) - install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) +.. _install_jni_symlink: -If a single target needs to produce more than one jar from its -java source code, to prevent the accumulation of duplicate class -files in subsequent jars, set/reset ``CMAKE_JAR_CLASSES_PREFIX`` prior -to calling the ``add_jar()`` function: +.. command:: install_jni_symlink -.. code-block:: cmake + Installs JNI symlinks for target generated by :ref:`add_jar() `:: - set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo) - add_jar(foo foo.java) + install_jni_symlink( ) + install_jni_symlink( DESTINATION [COMPONENT ]) - set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar) - add_jar(bar bar.java) + This command installs the ```` JNI symlinks to the given + ````. It should be called in the same scope as + :ref:`add_jar() ` or it will fail. -For an optimum usage of option ``GENERATE_NATIVE_HEADERS``, it is recommended to -include module JNI before any call to ``add_jar()``. The produced target for -native headers can then be used to compile C/C++ sources with the -:command:`target_link_libraries` command. + .. versionadded:: 3.4 + The second signature with ``DESTINATION`` and ``COMPONENT`` options. -.. code-block:: cmake + ``DESTINATION`` + Specify the directory on disk to which a file will be installed. - find_package(JNI) - add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native) - add_library(bar bar.cpp) - target_link_libraries(bar PRIVATE foo-native) + ``COMPONENT`` + Specify an installation component name with which the install rule is + associated, such as "runtime" or "development". + Utilize the following commands to create a JNI symbolic link: -Finding JARs -^^^^^^^^^^^^ + .. code-block:: cmake -.. code-block:: cmake - - find_jar( - | NAMES [...] - [PATHS [... ENV ]] - [VERSIONS []] - [DOC "cache documentation string"] - ) - -This command is used to find a full path to the named jar. A cache -entry named by ```` is created to store the result of this command. -If the full path to a jar is found the result is stored in the -variable and the search will not repeated unless the variable is -cleared. If nothing is found, the result will be ``-NOTFOUND``, and -the search will be attempted again next time ``find_jar()`` is invoked with -the same variable. The name of the full path to a file that is -searched for is specified by the names listed after ``NAMES`` argument. -Additional search locations can be specified after the ``PATHS`` argument. -If you require special a version of a jar file you can specify it with -the ``VERSIONS`` argument. The argument after ``DOC`` will be used for the -documentation string in the cache. - - -Javadoc -^^^^^^^ - -The ``create_javadoc()`` command can be used to create java documentation -based on files or packages. For more details please read the javadoc manpage. - -There are two main signatures for ``create_javadoc()``. The first signature -works with package names on a path with source files. - -.. code-block:: cmake - - create_javadoc( - PACKAGES [...] - [SOURCEPATH ] - [CLASSPATH ] - [INSTALLPATH ] - [DOCTITLE "the documentation title"] - [WINDOWTITLE "the title of the document"] - [AUTHOR TRUE|FALSE] - [USE TRUE|FALSE] - [VERSION TRUE|FALSE] - ) + set(CMAKE_JNI_TARGET TRUE) + add_jar(shibboleet shibbotleet.java VERSION 1.2.0) + install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) + install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) + +Header Generation +^^^^^^^^^^^^^^^^^ + +.. _create_javah: + +.. command:: create_javah -For example: - -.. code-block:: cmake - - create_javadoc(my_example_doc - PACKAGES com.example.foo com.example.bar - SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" - CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} - WINDOWTITLE "My example" - DOCTITLE "

    My example

    " - AUTHOR TRUE - USE TRUE - VERSION TRUE - ) - -The second signature for ``create_javadoc()`` works on a given list of -files. - -.. code-block:: cmake - - create_javadoc( - FILES [...] - [CLASSPATH ] - [INSTALLPATH ] - [DOCTITLE "the documentation title"] - [WINDOWTITLE "the title of the document"] - [AUTHOR TRUE|FALSE] - [USE TRUE|FALSE] - [VERSION TRUE|FALSE] + .. versionadded:: 3.4 + + Generates C header files for java classes:: + + create_javah(TARGET | GENERATED_FILES + CLASSES ... + [CLASSPATH ...] + [DEPENDS ...] + [OUTPUT_NAME |OUTPUT_DIR ] ) -For example: + .. deprecated:: 3.11 + This command will no longer be supported starting with version 10 of the JDK + due to the `suppression of javah tool `_. + The :ref:`add_jar(GENERATE_NATIVE_HEADERS) ` command should be + used instead. + + Create C header files from java classes. These files provide the connective + glue that allow your Java and C code to interact. + + There are two main signatures for ``create_javah()``. The first signature + returns generated files through variable specified by the ``GENERATED_FILES`` + option. For example: -.. code-block:: cmake + .. code-block:: cmake - create_javadoc(my_example_doc - FILES ${example_SRCS} - CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} - WINDOWTITLE "My example" - DOCTITLE "

    My example

    " - AUTHOR TRUE - USE TRUE - VERSION TRUE - ) + create_javah(GENERATED_FILES files_headers + CLASSES org.cmake.HelloWorld + CLASSPATH hello.jar + ) -Both signatures share most of the options. These options are the same -as what you can find in the javadoc manpage. Please look at the -manpage for ``CLASSPATH``, ``DOCTITLE``, ``WINDOWTITLE``, ``AUTHOR``, ``USE`` -and ``VERSION``. + The second signature for ``create_javah()`` creates a target which + encapsulates header files generation. E.g. -If you don't set the ``INSTALLPATH``, then by default the documentation will -be installed to : + .. code-block:: cmake -:: + create_javah(TARGET target_headers + CLASSES org.cmake.HelloWorld + CLASSPATH hello.jar + ) - ${CMAKE_INSTALL_PREFIX}/share/javadoc/ + Both signatures share same options. + ``CLASSES`` + Specifies Java classes used to generate headers. -Header Generation -^^^^^^^^^^^^^^^^^ + ``CLASSPATH`` + Specifies various paths to look up classes. Here ``.class`` files, jar + files or targets created by command add_jar can be used. + + ``DEPENDS`` + Targets on which the javah target depends. + + ``OUTPUT_NAME`` + Concatenates the resulting header files for all the classes listed by + option ``CLASSES`` into ````. Same behavior as option ``-o`` of + ``javah`` tool. + + ``OUTPUT_DIR`` + Sets the directory where the header files will be generated. Same behavior + as option ``-d`` of ``javah`` tool. If not specified, + :variable:`CMAKE_CURRENT_BINARY_DIR` is used as the output directory. + +Exporting JAR Targets +^^^^^^^^^^^^^^^^^^^^^ + +.. _install_jar_exports: + +.. command:: install_jar_exports + + .. versionadded:: 3.7 + + Installs a target export file:: -.. code-block:: cmake + install_jar_exports(TARGETS ... + [NAMESPACE ] + FILE + DESTINATION [COMPONENT ]) - create_javah(TARGET | GENERATED_FILES - CLASSES ... - [CLASSPATH ...] - [DEPENDS ...] - [OUTPUT_NAME |OUTPUT_DIR ] - ) + This command installs a target export file ```` for the named jar + targets to the given ```` directory. Its function is similar to + that of :command:`install(EXPORT)`. -Create C header files from java classes. These files provide the connective glue -that allow your Java and C code to interact. + ``TARGETS`` + List of targets created by :ref:`add_jar() ` command. -.. deprecated:: 3.11 + ``NAMESPACE`` + .. versionadded:: 3.9 -.. note:: + The ```` value will be prepend to the target names as they are + written to the import file. - This command will no longer be supported starting with version 10 of the JDK - due to the `suppression of javah tool `_. - The ``add_jar(GENERATE_NATIVE_HEADERS)`` command should be used instead. + ``FILE`` + Specify name of the export file. -There are two main signatures for ``create_javah()``. The first signature -returns generated files through variable specified by the ``GENERATED_FILES`` -option. For example: -.. code-block:: cmake + ``DESTINATION`` + Specify the directory on disk to which a file will be installed. - create_javah(GENERATED_FILES files_headers - CLASSES org.cmake.HelloWorld - CLASSPATH hello.jar - ) + ``COMPONENT`` + Specify an installation component name with which the install rule is + associated, such as "runtime" or "development". -The second signature for ``create_javah()`` creates a target which encapsulates -header files generation. E.g. +.. _export_jars: -.. code-block:: cmake +.. command:: export_jars - create_javah(TARGET target_headers - CLASSES org.cmake.HelloWorld - CLASSPATH hello.jar - ) + .. versionadded:: 3.7 -Both signatures share same options. + Writes a target export file:: -``CLASSES ...`` - Specifies Java classes used to generate headers. + export_jars(TARGETS ... + [NAMESPACE ] + FILE ) -``CLASSPATH ...`` - Specifies various paths to look up classes. Here .class files, jar files or - targets created by command add_jar can be used. + This command writes a target export file ```` for the named ```` + targets. Its function is similar to that of :command:`export`. -``DEPENDS ...`` - Targets on which the javah target depends. + ``TARGETS`` + List of targets created by :ref:`add_jar() ` command. -``OUTPUT_NAME `` - Concatenates the resulting header files for all the classes listed by option - ``CLASSES`` into ````. Same behavior as option ``-o`` of javah tool. + ``NAMESPACE`` + .. versionadded:: 3.9 -``OUTPUT_DIR `` - Sets the directory where the header files will be generated. Same behavior - as option ``-d`` of javah tool. If not specified, - :variable:`CMAKE_CURRENT_BINARY_DIR` is used as the output directory. + The ```` value will be prepend to the target names as they are + written to the import file. + + ``FILE`` + Specify name of the export file. + +Finding JARs +^^^^^^^^^^^^ + +.. _find_jar: + +.. command:: find_jar + + Finds the specified jar file:: + + find_jar( + | NAMES [...] + [PATHS [... ENV ]] + [VERSIONS []] + [DOC "cache documentation string"] + ) + + This command is used to find a full path to the named jar. A cache + entry named by ```` is created to store the result of this command. + If the full path to a jar is found the result is stored in the + variable and the search will not repeated unless the variable is + cleared. If nothing is found, the result will be ``-NOTFOUND``, and + the search will be attempted again next time ``find_jar()`` is invoked with + the same variable. + + ``NAMES`` + Specify one or more possible names for the jar file. + + ``PATHS`` + Specify directories to search in addition to the default locations. + The ``ENV`` var sub-option reads paths from a system environment variable. + + ``VERSIONS`` + Specify jar versions. + + ``DOC`` + Specify the documentation string for the ```` cache entry. + +Creating Java Documentation +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. _create_javadoc: + +.. command:: create_javadoc + + Creates java documentation based on files and packages:: + + create_javadoc( + (PACKAGES [...] | FILES [...]) + [SOURCEPATH ] + [CLASSPATH ] + [INSTALLPATH ] + [DOCTITLE ] + [WINDOWTITLE ] + [AUTHOR (TRUE|FALSE)] + [USE (TRUE|FALSE)] + [VERSION (TRUE|FALSE)] + ) + + The ``create_javadoc()`` command can be used to create java documentation. + There are two main signatures for ``create_javadoc()``. + + The first signature works with package names on a path with source files: + + .. code-block:: cmake + + create_javadoc(my_example_doc + PACKAGES com.example.foo com.example.bar + SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" + CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} + WINDOWTITLE "My example" + DOCTITLE "

    My example

    " + AUTHOR TRUE + USE TRUE + VERSION TRUE + ) + + The second signature for ``create_javadoc()`` works on a given list of files: + + .. code-block:: cmake + + create_javadoc(my_example_doc + FILES java/A.java java/B.java + CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} + WINDOWTITLE "My example" + DOCTITLE "

    My example

    " + AUTHOR TRUE + USE TRUE + VERSION TRUE + ) + + Both signatures share most of the options. For more details please read the + javadoc manpage. + + ``PACKAGES`` + Specify java packages. + + ``FILES`` + Specify java source files. If relative paths are specified, they are + relative to :variable:`CMAKE_CURRENT_SOURCE_DIR`. + + ``SOURCEPATH`` + Specify the directory where to look for packages. By default, + :variable:`CMAKE_CURRENT_SOURCE_DIR` directory is used. + + ``CLASSPATH`` + Specify where to find user class files. Same behavior as option + ``-classpath`` of ``javadoc`` tool. + + ``INSTALLPATH`` + Specify where to install the java documentation. If you specified, the + documentation will be installed to + ``${CMAKE_INSTALL_PREFIX}/share/javadoc/``. + + ``DOCTITLE`` + Specify the title to place near the top of the overview summary file. + Same behavior as option ``-doctitle`` of ``javadoc`` tool. + + ``WINDOWTITLE`` + Specify the title to be placed in the HTML ```` tag. Same behavior + as option ``-windowtitle`` of ``javadoc`` tool. + + ``AUTHOR`` + When value ``TRUE`` is specified, includes the ``@author`` text in the + generated docs. Same behavior as option ``-author`` of ``javadoc`` tool. + + ``USE`` + When value ``TRUE`` is specified, creates class and package usage pages. + Includes one Use page for each documented class and package. Same behavior + as option ``-use`` of ``javadoc`` tool. + + ``VERSION`` + When value ``TRUE`` is specified, includes the version text in the + generated docs. Same behavior as option ``-version`` of ``javadoc`` tool. #]=======================================================================] include(CMakeParseArguments) @@ -378,7 +525,8 @@ function (__java_copy_file src dest comment) ARGS ${src} ${dest} DEPENDS ${src} - COMMENT ${comment}) + COMMENT ${comment} + ) endfunction () function(__java_lcat VAR) @@ -409,6 +557,12 @@ set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/javaTargets.cmake.in) set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake) set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) +if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(_UseJava_PATH_SEP "$<SEMICOLON>") +else () + set(_UseJava_PATH_SEP ":") +endif() + function(add_jar _TARGET_NAME) cmake_parse_arguments(_add_jar @@ -440,6 +594,9 @@ function(add_jar _TARGET_NAME) set(_add_jar_ENTRY_POINT "${CMAKE_JAVA_JAR_ENTRY_POINT}") endif() + # This *should* still work if <resources1>... are included without a + # named RESOURCES argument. In that case, the old behavior of potentially + # misplacing the within the Jar will behave as previously (incorrectly) set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS}) if (NOT DEFINED _add_jar_OUTPUT_DIR) @@ -467,7 +624,10 @@ function(add_jar _TARGET_NAME) if (Java_VERSION VERSION_LESS 1.8) message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS is not supported with this version of Java.") endif() - cmake_parse_arguments (_add_jar_GENERATE_NATIVE_HEADERS "" "DESTINATION" "" ${_add_jar_GENERATE_NATIVE_HEADERS}) + + unset (_GENERATE_NATIVE_HEADERS_OUTPUT_DESC) + + cmake_parse_arguments (_add_jar_GENERATE_NATIVE_HEADERS "" "" "DESTINATION" ${_add_jar_GENERATE_NATIVE_HEADERS}) if (NOT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS) message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: missing required argument.") endif() @@ -478,11 +638,30 @@ function(add_jar _TARGET_NAME) endif() if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION) set (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir/native_headers") + else() + list (LENGTH _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION length) + if (NOT length EQUAL 1) + cmake_parse_arguments (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "" "BUILD;INSTALL" "" "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION}") + if (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_UNPARSED_ARGUMENTS) + message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: DESTINATION: ${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_UNPARSED_ARGUMENTS}: unexpected argument(s).") + endif() + if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_INSTALL) + message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: DESTINATION: INSTALL sub-option is required.") + endif() + if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_BUILD) + set(_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_BUILD "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir/native_headers") + endif() + set(_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_BUILD}") + set(_GENERATE_NATIVE_HEADERS_OUTPUT_DESC "$<BUILD_INTERFACE:${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_BUILD}>" "$<INSTALL_INTERFACE:${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_INSTALL}>") + endif() endif() set (_GENERATE_NATIVE_HEADERS_TARGET ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS}) set (_GENERATE_NATIVE_HEADERS_OUTPUT_DIR "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION}") set (_GENERATE_NATIVE_HEADERS -h "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}") + if(NOT _GENERATE_NATIVE_HEADERS_OUTPUT_DESC) + set(_GENERATE_NATIVE_HEADERS_OUTPUT_DESC "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}") + endif() endif() if (LIBRARY_OUTPUT_PATH) @@ -498,14 +677,8 @@ function(add_jar _TARGET_NAME) ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH} ) - if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") - set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") - else () - set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") - endif() - foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH) - string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") + string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${_UseJava_PATH_SEP}${JAVA_INCLUDE_DIR}") endforeach() set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") @@ -536,7 +709,7 @@ function(add_jar _TARGET_NAME) if (_JAVA_SOURCE_FILE MATCHES "^@(.+)$") get_filename_component(_JAVA_FULL ${CMAKE_MATCH_1} ABSOLUTE) - list (APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL}) + list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL}) elseif (_JAVA_EXT MATCHES ".java") file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR} ${_JAVA_FULL}) @@ -550,7 +723,7 @@ function(add_jar _TARGET_NAME) endif () get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH) - list (APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE}) set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class") set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE}) @@ -561,15 +734,15 @@ function(add_jar _TARGET_NAME) # Ignored for backward compatibility elseif (_JAVA_EXT STREQUAL "") - list (APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH}) - list (APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}}) + list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH}) + list(APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}}) else () __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} "Copying ${_JAVA_SOURCE_FILE} to the build directory") - list (APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}) - list (APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE}) endif () endforeach() @@ -577,18 +750,18 @@ function(add_jar _TARGET_NAME) if (TARGET ${_JAVA_INCLUDE_JAR}) get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE) if (_JAVA_JAR_PATH) - string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}") - list (APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH}) - list (APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR}) - list (APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_JAR_PATH}) + string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${_UseJava_PATH_SEP}${_JAVA_JAR_PATH}") + list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH}) + list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR}) + list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_JAR_PATH}) else () message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar") endif () else () - string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}") - list (APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}") - list (APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}") - list (APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}") + string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${_UseJava_PATH_SEP}${_JAVA_INCLUDE_JAR}") + list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}") + list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}") + list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}") endif () endforeach() @@ -627,14 +800,14 @@ function(add_jar _TARGET_NAME) OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist COMMAND ${CMAKE_COMMAND} -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH} - -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}" + -DCMAKE_JAR_CLASSES_PREFIX=${CMAKE_JAR_CLASSES_PREFIX} -P ${_JAVA_CLASS_FILELIST_SCRIPT} DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) else () # create an empty java_class_filelist - if (NOT EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist") + if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") endif() endif () @@ -731,8 +904,9 @@ function(add_jar _TARGET_NAME) # create an INTERFACE library encapsulating include directory for generated headers add_library (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE) target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE - "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}" + "${_GENERATE_NATIVE_HEADERS_OUTPUT_DESC}" ${JNI_INCLUDE_DIRS}) + set_property(TARGET ${_GENERATE_NATIVE_HEADERS_TARGET} PROPERTY NATIVE_HEADERS_DIRECTORY "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}") # this INTERFACE library depends on jar generation add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME}) @@ -985,7 +1159,7 @@ function(create_javadoc _target) elseif (arg STREQUAL "VERSION") set(_state "version") else () - list (APPEND _javadoc_packages ${arg}) + list(APPEND _javadoc_packages ${arg}) endif () elseif (_state STREQUAL "files") if (arg STREQUAL "PACKAGES") @@ -1009,7 +1183,7 @@ function(create_javadoc _target) elseif (arg STREQUAL "VERSION") set(_state "version") else () - list (APPEND _javadoc_files ${arg}) + list(APPEND _javadoc_files ${arg}) endif () elseif (_state STREQUAL "sourcepath") if (arg STREQUAL "PACKAGES") @@ -1033,7 +1207,7 @@ function(create_javadoc _target) elseif (arg STREQUAL "VERSION") set(_state "version") else () - list (APPEND _javadoc_sourcepath ${arg}) + list(APPEND _javadoc_sourcepath ${arg}) endif () elseif (_state STREQUAL "classpath") if (arg STREQUAL "PACKAGES") @@ -1057,7 +1231,7 @@ function(create_javadoc _target) elseif (arg STREQUAL "VERSION") set(_state "version") else () - list (APPEND _javadoc_classpath ${arg}) + list(APPEND _javadoc_classpath ${arg}) endif () elseif (_state STREQUAL "installpath") if (arg STREQUAL "PACKAGES") @@ -1238,68 +1412,45 @@ function(create_javadoc _target) set(_javadoc_options -d ${_javadoc_builddir}) if (_javadoc_sourcepath) - set(_start TRUE) - foreach(_path IN LISTS _javadoc_sourcepath) - if (_start) - set(_sourcepath ${_path}) - set(_start FALSE) - else () - set(_sourcepath ${_sourcepath}:${_path}) - endif () - endforeach() - set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath}) + list(JOIN _javadoc_sourcepath "${_UseJava_PATH_SEP}" _javadoc_sourcepath) + list(APPEND _javadoc_options -sourcepath "\"${_javadoc_sourcepath}\"") endif () if (_javadoc_overview) - set(_start TRUE) - foreach(_path IN LISTS _javadoc_overview) - if (_start) - set(_overview ${_path}) - set(_start FALSE) - else () - set(_overview ${_overview}:${_path}) - endif () - endforeach () - set(_javadoc_options ${_javadoc_options} -overview ${_overview}) + list(JOIN _javadoc_overview "${_UseJava_PATH_SEP}" _javadoc_overview) + list(APPEND _javadoc_options -overview "\"${_javadoc_overview}\"") endif () if (_javadoc_classpath) - set(_start TRUE) - foreach(_path IN LISTS _javadoc_classpath) - if (_start) - set(_classpath ${_path}) - set(_start FALSE) - else () - set(_classpath ${_classpath}:${_path}) - endif () - endforeach() - set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}") + list(JOIN _javadoc_classpath "${_UseJava_PATH_SEP}" _javadoc_classpath) + list(APPEND _javadoc_options -classpath "\"${_javadoc_classpath}\"") endif () if (_javadoc_doctitle) - set(_javadoc_options ${_javadoc_options} -doctitle '${_javadoc_doctitle}') + list(APPEND _javadoc_options -doctitle '${_javadoc_doctitle}') endif () if (_javadoc_windowtitle) - set(_javadoc_options ${_javadoc_options} -windowtitle '${_javadoc_windowtitle}') + list(APPEND _javadoc_options -windowtitle '${_javadoc_windowtitle}') endif () if (_javadoc_author) - set(_javadoc_options ${_javadoc_options} -author) + list(APPEND _javadoc_options -author) endif () if (_javadoc_use) - set(_javadoc_options ${_javadoc_options} -use) + list(APPEND _javadoc_options -use) endif () if (_javadoc_version) - set(_javadoc_options ${_javadoc_options} -version) + list(APPEND _javadoc_options -version) endif () add_custom_target(${_target}_javadoc ALL - COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options} - ${_javadoc_files} - ${_javadoc_packages} + COMMAND ${Java_JAVADOC_EXECUTABLE} + ${_javadoc_options} + ${_javadoc_files} + ${_javadoc_packages} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) @@ -1335,11 +1486,6 @@ function (create_javah) endif() set (_output_files) - if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") - set(_classpath_sep "$<SEMICOLON>") - else () - set(_classpath_sep ":") - endif() # handle javah options set (_javah_options) @@ -1365,7 +1511,7 @@ function (create_javah) message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not exist.") endif() endforeach() - string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}") + string (REPLACE ";" "${_UseJava_PATH_SEP}" _classpath "${_classpath}") list (APPEND _javah_options -classpath "${_classpath}") endif() diff --git a/config/cmake/UseJavaClassFilelist.cmake b/config/cmake/UseJavaClassFilelist.cmake index 8348e4c..d90ca48 100644 --- a/config/cmake/UseJavaClassFilelist.cmake +++ b/config/cmake/UseJavaClassFilelist.cmake @@ -1,17 +1,8 @@ # Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. -#[=======================================================================[.rst: -UseJavaClassFilelist --------------------- - - - - - -This script create a list of compiled Java class files to be added to -a jar file. This avoids including cmake files which get created in -the binary directory. -#]=======================================================================] +# This script creates a list of compiled Java class files to be added to +# a jar file. This avoids including cmake files which get created in +# the binary directory. if (CMAKE_JAVA_CLASS_OUTPUT_PATH) if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") @@ -23,7 +14,7 @@ if (CMAKE_JAVA_CLASS_OUTPUT_PATH) file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${JAR_CLASS_PREFIX}/*.class") if (_JAVA_GLOBBED_TMP_FILES) - list (APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES}) + list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES}) endif () endforeach() else() diff --git a/config/cmake/UseJavaSymlinks.cmake b/config/cmake/UseJavaSymlinks.cmake index a4db5c1..cb2e282 100644 --- a/config/cmake/UseJavaSymlinks.cmake +++ b/config/cmake/UseJavaSymlinks.cmake @@ -1,15 +1,6 @@ # Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. -#[=======================================================================[.rst: -UseJavaSymlinks ---------------- - - - - - -Helper script for UseJava.cmake -#]=======================================================================] +# Helper script for UseJava.cmake if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) if (_JAVA_TARGET_OUTPUT_NAME) diff --git a/config/cmake/javaTargets.cmake.in b/config/cmake/javaTargets.cmake.in new file mode 100644 index 0000000..6e14256 --- /dev/null +++ b/config/cmake/javaTargets.cmake.in @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 2.8.12) +cmake_policy(PUSH) +cmake_policy(VERSION 2.8) + +#---------------------------------------------------------------- +# Generated CMake Java target import file. +#---------------------------------------------------------------- + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget @__targets__@) + list(APPEND _expectedTargets ${_expectedTarget}) + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + else() + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() +endforeach() +if("%${_targetsDefined}" STREQUAL "%${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR + "Some (but not all) targets in this export set were already defined.\n" + "Targets Defined: ${_targetsDefined}\n" + "Targets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + +@__targetdefs__@ +cmake_policy(POP) -- cgit v0.12 From 163d40dd4255cf5623b3b8a6dc83ffbd8926bb1f Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 7 Sep 2021 08:25:39 -0500 Subject: Correction of pkg-config compile script. (#974) * Correction of pkg-config compile script. * Reword note. --- config/cmake/libh5cc.in | 2 +- release_docs/RELEASE.txt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/cmake/libh5cc.in b/config/cmake/libh5cc.in index c98d9ca..ecdd13e 100644 --- a/config/cmake/libh5cc.in +++ b/config/cmake/libh5cc.in @@ -29,4 +29,4 @@ printf 'dir is %s\n' "$dir" export PKG_CONFIG_PATH=$dir/lib/pkgconfig -@_PKG_CONFIG_COMPILER@ `pkg-config --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@` $@ +@_PKG_CONFIG_COMPILER@ $@ `pkg-config --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@` diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 29600bd..cd6b800 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1122,6 +1122,14 @@ Bug Fixes since HDF5-1.12.0 release Configuration ------------- + - Corrected pkg-config compile script + + It was discovered that the position of the "$@" argument for the command + in the compile script may fail on some platforms and configurations. The + position of the "$@"command argument was moved before the pkg-config sub command. + + (ADB - 2021/08/30) + - Fixed CMake C++ compiler flags A recent refactoring of the C++ configure files accidently removed the -- cgit v0.12 From 919f9daec6f397dfdf3fd41d2ecf002d197db293 Mon Sep 17 00:00:00 2001 From: Larry Knox <lrknox@hdfgroup.org> Date: Wed, 8 Sep 2021 09:52:03 -0500 Subject: Update copyright headers with reproduction notice in 5 files (#993) * Update copyright headers with reproduction notice in 5 files that did not match terms in COPYING file . * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java | 15 +++++++-------- java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java | 15 +++++++-------- src/H5FDhdfs.c | 16 +++++++--------- src/H5FDhdfs.h | 15 +++++++-------- tools/libtest/Makefile.am | 18 +++++++++--------- 5 files changed, 37 insertions(+), 42 deletions(-) diff --git a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java index 5da4abd..95a9254 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java @@ -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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package hdf.hdf5lib.structs; diff --git a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java index 39f5424..ad02979 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java @@ -1,15 +1,14 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package hdf.hdf5lib.structs; diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 9491e82..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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* 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/tools/libtest/Makefile.am b/tools/libtest/Makefile.am index a93e25d..1a08a01 100644 --- a/tools/libtest/Makefile.am +++ b/tools/libtest/Makefile.am @@ -1,16 +1,16 @@ # -# Read-Only S3 Virtual File Driver (VFD) -# Copyright (c) 2017-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. +# ## Makefile.am ## Run automake to generate a Makefile.in from this file. # -- cgit v0.12 From 8e06298ecfde5eb647b39cfe0dab70005f092199 Mon Sep 17 00:00:00 2001 From: Alessandro Felder <alessandrofelder@users.noreply.github.com> Date: Wed, 8 Sep 2021 21:53:15 +0100 Subject: Add high-level set/get for `unsigned long long` attributes. (#973) * add ULL attr set/get signatures to LT public API * add LT implementation of ULL set/get attribute * fix copy-paste typo in test comment * add ULL test data * define ullong attr name global variable * add LT tests for ULL attr set/get * Committing clang-format changes * correct type passed to lt get attr test for ULL * update RELEASE.txt with added ULL set/get functionality Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- hl/src/H5LT.c | 53 +++++++++++++++++++++++ hl/src/H5LTpublic.h | 6 +++ hl/test/test_lite.c | 109 +++++++++++++++++++++++++++++++++-------------- release_docs/RELEASE.txt | 8 +++- 4 files changed, 143 insertions(+), 33 deletions(-) diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 1ef0f9d..a314f3f 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1776,6 +1776,32 @@ H5LTset_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_nam } /*------------------------------------------------------------------------- + * Function: H5LTset_attribute_ullong + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Alessandro Felder + * + * Date: August 27, 2021 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTset_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned long long *data, size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_ULLONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- * Function: H5LTset_attribute_float * * Purpose: Create and write an attribute. @@ -3317,6 +3343,33 @@ H5LTget_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_nam } /*------------------------------------------------------------------------- + * Function: H5LTget_attribute_ullong + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Alessandro Felder + * + * Date: August 27, 2021 + * + * Comments: + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned long long *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_ULLONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- * Function: H5LTget_attribute_float * * Purpose: Reads an attribute named attr_name diff --git a/hl/src/H5LTpublic.h b/hl/src/H5LTpublic.h index 2af9b07..f19d353 100644 --- a/hl/src/H5LTpublic.h +++ b/hl/src/H5LTpublic.h @@ -139,6 +139,9 @@ H5_HLDLL herr_t H5LTset_attribute_long_long(hid_t loc_id, const char *obj_name, H5_HLDLL herr_t H5LTset_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned long *buffer, size_t size); +H5_HLDLL herr_t H5LTset_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned long long *buffer, size_t size); + H5_HLDLL herr_t H5LTset_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, const float *buffer, size_t size); @@ -182,6 +185,9 @@ H5_HLDLL herr_t H5LTget_attribute_long_long(hid_t loc_id, const char *obj_name, H5_HLDLL herr_t H5LTget_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned long *data); +H5_HLDLL herr_t H5LTget_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, + unsigned long long *data); + H5_HLDLL herr_t H5LTget_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, float *data); diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index cae91ff..53f834a 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -43,8 +43,9 @@ #define ATTR7_NAME "attr ushort" #define ATTR8_NAME "attr uint" #define ATTR9_NAME "attr ulong" -#define ATTR10_NAME "attr float" -#define ATTR11_NAME "attr double" +#define ATTR10_NAME "attr ullong" +#define ATTR11_NAME "attr float" +#define ATTR12_NAME "attr double" static herr_t make_attributes(hid_t loc_id, const char *obj_name); @@ -472,28 +473,30 @@ make_attributes(hid_t loc_id, const char *obj_name) size_t type_size; int i; - char attr_str_in[] = {"My attribute"}; - char attr_str_out[20]; - char attr_char_in[5] = {1, 2, 3, 4, 5}; - char attr_char_out[5]; - short attr_short_in[5] = {1, 2, 3, 4, 5}; - short attr_short_out[5]; - int attr_int_in[5] = {1, 2, 3, 4, 5}; - int attr_int_out[5]; - long attr_long_in[5] = {1, 2, 3, 4, 5}; - long attr_long_out[5]; - float attr_float_in[5] = {1, 2, 3, 4, 5}; - float attr_float_out[5]; - double attr_double_in[5] = {1, 2, 3, 4, 5}; - double attr_double_out[5]; - unsigned char attr_uchar_in[5] = {1, 2, 3, 4, 5}; - unsigned char attr_uchar_out[5]; - unsigned short attr_ushort_in[5] = {1, 2, 3, 4, 5}; - unsigned short attr_ushort_out[5]; - unsigned int attr_uint_in[5] = {1, 2, 3, 4, 5}; - unsigned int attr_uint_out[5]; - unsigned long attr_ulong_in[5] = {1, 2, 3, 4, 5}; - unsigned long attr_ulong_out[5]; + char attr_str_in[] = {"My attribute"}; + char attr_str_out[20]; + char attr_char_in[5] = {1, 2, 3, 4, 5}; + char attr_char_out[5]; + short attr_short_in[5] = {1, 2, 3, 4, 5}; + short attr_short_out[5]; + int attr_int_in[5] = {1, 2, 3, 4, 5}; + int attr_int_out[5]; + long attr_long_in[5] = {1, 2, 3, 4, 5}; + long attr_long_out[5]; + float attr_float_in[5] = {1, 2, 3, 4, 5}; + float attr_float_out[5]; + double attr_double_in[5] = {1, 2, 3, 4, 5}; + double attr_double_out[5]; + unsigned char attr_uchar_in[5] = {1, 2, 3, 4, 5}; + unsigned char attr_uchar_out[5]; + unsigned short attr_ushort_in[5] = {1, 2, 3, 4, 5}; + unsigned short attr_ushort_out[5]; + unsigned int attr_uint_in[5] = {1, 2, 3, 4, 5}; + unsigned int attr_uint_out[5]; + unsigned long attr_ulong_in[5] = {1, 2, 3, 4, 5}; + unsigned long attr_ulong_out[5]; + unsigned long long attr_ullong_in[5] = {1, 2, 3, 4, 5}; + unsigned long long attr_ullong_out[5]; /*------------------------------------------------------------------------- * H5LTset_attribute_string test @@ -509,7 +512,7 @@ make_attributes(hid_t loc_id, const char *obj_name) PASSED(); /*------------------------------------------------------------------------- - * H5LTset_attribute_string test + * H5LTget_attribute_string test *------------------------------------------------------------------------- */ @@ -859,7 +862,7 @@ make_attributes(hid_t loc_id, const char *obj_name) PASSED(); /*------------------------------------------------------------------------- - * H5LTget_attribute_long test + * H5LTget_attribute_ulong test *------------------------------------------------------------------------- */ @@ -888,6 +891,48 @@ make_attributes(hid_t loc_id, const char *obj_name) PASSED(); /*------------------------------------------------------------------------- + * H5LTset_attribute_ullong test + *------------------------------------------------------------------------- + */ + + HL_TESTING2("H5LTset_attribute_ullong"); + + /* Set the attribute */ + if (H5LTset_attribute_ullong(loc_id, obj_name, ATTR10_NAME, attr_ullong_in, (size_t)5) < 0) + return -1; + + PASSED(); + + /*------------------------------------------------------------------------- + * H5LTget_attribute_ullong test + *------------------------------------------------------------------------- + */ + + HL_TESTING2("H5LTget_attribute_ullong"); + + /* Get the attribute */ + if (H5LTget_attribute_ullong(loc_id, obj_name, ATTR10_NAME, attr_ullong_out) < 0) + return -1; + + for (i = 0; i < 5; i++) { + if (attr_ullong_in[i] != attr_ullong_out[i]) { + return -1; + } + } + + /* Get the attribute */ + if (H5LTget_attribute(loc_id, obj_name, ATTR10_NAME, H5T_NATIVE_ULLONG, attr_ullong_out) < 0) + return -1; + + for (i = 0; i < 5; i++) { + if (attr_ullong_in[i] != attr_ullong_out[i]) { + return -1; + } + } + + PASSED(); + + /*------------------------------------------------------------------------- * H5LTset_attribute_float test *------------------------------------------------------------------------- */ @@ -895,7 +940,7 @@ make_attributes(hid_t loc_id, const char *obj_name) HL_TESTING2("H5LTset_attribute_float"); /* Set the attribute */ - if (H5LTset_attribute_float(loc_id, obj_name, ATTR10_NAME, attr_float_in, (size_t)5) < 0) + if (H5LTset_attribute_float(loc_id, obj_name, ATTR11_NAME, attr_float_in, (size_t)5) < 0) return -1; PASSED(); @@ -908,7 +953,7 @@ make_attributes(hid_t loc_id, const char *obj_name) HL_TESTING2("H5LTget_attribute_float"); /* Get the attribute */ - if (H5LTget_attribute_float(loc_id, obj_name, ATTR10_NAME, attr_float_out) < 0) + if (H5LTget_attribute_float(loc_id, obj_name, ATTR11_NAME, attr_float_out) < 0) return -1; for (i = 0; i < 5; i++) { @@ -918,7 +963,7 @@ make_attributes(hid_t loc_id, const char *obj_name) } /* Get the attribute */ - if (H5LTget_attribute(loc_id, obj_name, ATTR10_NAME, H5T_NATIVE_FLOAT, attr_float_out) < 0) + if (H5LTget_attribute(loc_id, obj_name, ATTR11_NAME, H5T_NATIVE_FLOAT, attr_float_out) < 0) return -1; for (i = 0; i < 5; i++) { @@ -937,7 +982,7 @@ make_attributes(hid_t loc_id, const char *obj_name) HL_TESTING2("H5LTset_attribute_double"); /* Set the attribute */ - if (H5LTset_attribute_double(loc_id, obj_name, ATTR11_NAME, attr_double_in, (size_t)5) < 0) + if (H5LTset_attribute_double(loc_id, obj_name, ATTR12_NAME, attr_double_in, (size_t)5) < 0) return -1; PASSED(); @@ -950,7 +995,7 @@ make_attributes(hid_t loc_id, const char *obj_name) HL_TESTING2("H5LTget_attribute_double"); /* Get the attribute */ - if (H5LTget_attribute_double(loc_id, obj_name, ATTR11_NAME, attr_double_out) < 0) + if (H5LTget_attribute_double(loc_id, obj_name, ATTR12_NAME, attr_double_out) < 0) return -1; for (i = 0; i < 5; i++) { @@ -960,7 +1005,7 @@ make_attributes(hid_t loc_id, const char *obj_name) } /* Get the attribute */ - if (H5LTget_attribute(loc_id, obj_name, ATTR11_NAME, H5T_NATIVE_DOUBLE, attr_double_out) < 0) + if (H5LTget_attribute(loc_id, obj_name, ATTR12_NAME, H5T_NATIVE_DOUBLE, attr_double_out) < 0) return -1; for (i = 0; i < 5; i++) { diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cd6b800..7ccb9ad 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -907,7 +907,13 @@ New Features High-Level APIs: ---------------- - - + - added set/get for unsigned long long attributes + + the attribute writing high-level API has been expanded to include + public set/get functions for ULL attributes, analogously to the + existing set/get for other types. + + (AF - 2021/09/08) C Packet Table API: ------------------- -- cgit v0.12 From b58f8540ac3c416e1d833aad243a0df35ec4a616 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 10 Sep 2021 07:40:27 -0500 Subject: Fix various warnings and issues in doxygen doc generation (#994) * Fix various warnings and issues in doxygen doc generation * Add new file to list --- CMakeLists.txt | 29 +++++++++++----------- MANIFEST | 1 + configure.ac | 4 ++- doxygen/CMakeLists.txt | 46 +++++++++++++++++++++++++++++++++++ doxygen/Doxyfile.in | 9 +------ doxygen/aliases | 4 +-- doxygen/dox/MetadataCachingInHDF5.dox | 4 +-- hl/src/CMakeLists.txt | 29 ++++++++++++++++++++++ src/CMakeLists.txt | 46 +++++++---------------------------- src/H5Dpublic.h | 2 +- src/H5Ppublic.h | 6 +---- 11 files changed, 110 insertions(+), 70 deletions(-) create mode 100644 doxygen/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index c44c5d5..13f2e35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -572,20 +572,6 @@ endif () # endif () #----------------------------------------------------------------------------- -# Option to build documentation -#----------------------------------------------------------------------------- -option (HDF5_BUILD_DOC "Build documentation" OFF) -if (HDF5_BUILD_DOC AND EXISTS "${HDF5_DOXYGEN_DIR}" AND IS_DIRECTORY "${HDF5_DOXYGEN_DIR}") -# check if Doxygen is installed - find_package(Doxygen) - if (DOXYGEN_FOUND) - message(STATUS "Doxygen version: ${DOXYGEN_VERSION}") - else () - message(STATUS "Doxygen needs to be installed to generate the doxygen documentation") - endif () -endif () - -#----------------------------------------------------------------------------- # Option to indicate using a memory checker #----------------------------------------------------------------------------- option (HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF) @@ -926,6 +912,21 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT endif () #----------------------------------------------------------------------------- +# Option to build documentation +#----------------------------------------------------------------------------- +option (HDF5_BUILD_DOC "Build documentation" OFF) +if (HDF5_BUILD_DOC AND EXISTS "${HDF5_DOXYGEN_DIR}" AND IS_DIRECTORY "${HDF5_DOXYGEN_DIR}") +# check if Doxygen is installed + find_package(Doxygen) + if (DOXYGEN_FOUND) + message(STATUS "Doxygen version: ${DOXYGEN_VERSION}") + add_subdirectory (doxygen) + else () + message(STATUS "Doxygen needs to be installed to generate the doxygen documentation") + endif () +endif () + +#----------------------------------------------------------------------------- # Dashboard and Testing Settings #----------------------------------------------------------------------------- option (BUILD_TESTING "Build HDF5 Unit Testing" ON) diff --git a/MANIFEST b/MANIFEST index ce9776e..0782b22 100644 --- a/MANIFEST +++ b/MANIFEST @@ -212,6 +212,7 @@ ./doc/code-conventions.md ./doc/contributing.md ./doxygen/aliases +./doxygen/CMakeLists.txt ./doxygen/Doxyfile.in ./doxygen/dox/APIVersions.dox ./doxygen/dox/About.dox diff --git a/configure.ac b/configure.ac index fcb2924..bc2358f 100644 --- a/configure.ac +++ b/configure.ac @@ -1106,6 +1106,7 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then AC_SUBST([DOXYGEN_SERVER_BASED_SEARCH]) AC_SUBST([DOXYGEN_EXTERNAL_SEARCH]) AC_SUBST([DOXYGEN_SEARCHENGINE_URL]) + AC_SUBST([DOXYGEN_STRIP_FROM_PATH]) AC_SUBST([DOXYGEN_PREDEFINED]) # SRCDIR Environment variables used inside doxygen macro for the source location: @@ -1113,7 +1114,7 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then DOXYGEN_VERSION_STRING=${PACKAGE_VERSION} DOXYGEN_INCLUDE_ALIASES='$(SRCDIR)/doxygen/aliases' DOXYGEN_PROJECT_LOGO='$(SRCDIR)/doxygen/img/HDFG-logo.png' - DOXYGEN_PROJECT_BRIEF= + DOXYGEN_PROJECT_BRIEF='C-API Reference' DOXYGEN_INPUT_DIRECTORY='$(SRCDIR) $(SRCDIR)/doxygen/dox' DOXYGEN_OPTIMIZE_OUTPUT_FOR_C=YES DOXYGEN_MACRO_EXPANSION=YES @@ -1128,6 +1129,7 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then DOXYGEN_SERVER_BASED_SEARCH=NO DOXYGEN_EXTERNAL_SEARCH=NO DOXYGEN_SEARCHENGINE_URL= + DOXYGEN_STRIP_FROM_PATH='$(SRCDIR)' DOXYGEN_PREDEFINED='H5_HAVE_DIRECT H5_HAVE_LIBHDFS H5_HAVE_MAP_API H5_HAVE_PARALLEL H5_HAVE_ROS3_VFD' DX_INIT_DOXYGEN([HDF5], [./doxygen/Doxyfile], [hdf5lib_docs]) diff --git a/doxygen/CMakeLists.txt b/doxygen/CMakeLists.txt new file mode 100644 index 0000000..36ce590 --- /dev/null +++ b/doxygen/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required (VERSION 3.12) +project (HDF5_DOXYGEN C) + +#----------------------------------------------------------------------------- +# 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_SOURCE_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}/dox/cookbook ${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_TAG_FILE ${HDF5_BINARY_DIR}/hdf5.tag) + set (DOXYGEN_SERVER_BASED_SEARCH NO) + set (DOXYGEN_EXTERNAL_SEARCH NO) + set (DOXYGEN_SEARCHENGINE_URL) + set (DOXYGEN_STRIP_FROM_PATH ${HDF5_SOURCE_DIR}) + set (DOXYGEN_PREDEFINED "H5_HAVE_DIRECT H5_HAVE_LIBHDFS H5_HAVE_MAP_API H5_HAVE_PARALLEL H5_HAVE_ROS3_VFD") + +# This configure and individual custom targets work together + # Replace variables inside @@ with the current values + configure_file (${HDF5_DOXYGEN_DIR}/Doxyfile.in ${HDF5_BINARY_DIR}/Doxyfile @ONLY) + + install ( + DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs/html + DESTINATION ${HDF5_INSTALL_DATA_DIR} + COMPONENT Documents + ) + + if (NOT TARGET doxygen) + add_custom_target (doxygen) + endif () + +endif () diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in index 4af590b..44d9974 100644 --- a/doxygen/Doxyfile.in +++ b/doxygen/Doxyfile.in @@ -170,7 +170,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = +STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -1126,13 +1126,6 @@ CLANG_DATABASE_PATH = ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored diff --git a/doxygen/aliases b/doxygen/aliases index ab6d8ea..06c3445 100644 --- a/doxygen/aliases +++ b/doxygen/aliases @@ -298,7 +298,7 @@ ALIASES += ref_rfc20120305="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/RFC%20P ALIASES += ref_rfc20120220="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/h5repack_improve_hyperslab_over_chunked_dataset_v1.pdf\"><tt>h5repack</tt>: Improved Hyperslab selections for Large Chunked Datasets</a>" ALIASES += ref_rfc20120120="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/2012-1-25-Maintainers-guide-for-datatype.docx.pdf\">A Maintainer’s Guide for the Datatype Module in HDF5 Library</a>" ALIASES += ref_rfc20120104="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/RFC_actual_io_v4-1_done.docx.pdf\">Actual I/O Mode</a>" -ALIASES += ref_rfc20111119="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/RFC-H5Ocompare-review_v6.pdf\">New public functions to handle comparison</a>" +ALIASES += ref_rfc20111119="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/RFC-H5Ocompare-review_v6.pdf\">New public functions to handle comparison</a>" ALIASES += ref_rfc20110825="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/2011-08-31-RFC_H5Ocopy_Named_DT_v2.docx.pdf\">Merging Named Datatypes in H5Ocopy()</a>" ALIASES += ref_rfc20110811="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/RFC_Enhancement_Hyperslab_Selection-1.4.docx.pdf\">Expanding the HDF5 Hyperslab Selection Interface</a>" ALIASES += ref_rfc20110726="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/metadata_aggregation_RFC_v03.docx.pdf\">HDF5 File Space Allocation and Aggregation</a>" @@ -327,7 +327,7 @@ ALIASES += ref_rfc20071111="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/AURA-co ALIASES += ref_rfc20071018="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/RFC_NaNsHDF5.pdf\"><tt>NaN</tt> detection in HDF5</a>" ALIASES += ref_rfc20070801="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/Metadata_Journaling_RFC.pdf\">Metadata Journaling to Improve Crash Survivability</a>" ALIASES += ref_rfc20070413="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/API_Compatibility_RFC.txt.pdf\">API Compatibility Strategies for HDF5</a>" -ALIASES += ref_rfc20070115="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/PrivateHeap.pdf\">A "Private" Heap for HDF5</a>" +ALIASES += ref_rfc20070115="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/PrivateHeap.pdf\">A 'Private' Heap for HDF5</a>" ALIASES += ref_rfc20060623="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/coll_ind_dd6.pdf\">Performance Comparison of Collective I/O and Independent I/O with Derived Datatypes</a>" ALIASES += ref_rfc20060604="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/h5stat_spec_v3_2006-06-04.pdf\"><tt>h5stat</tt> tool</a>" ALIASES += ref_rfc20060505="<a href=\"https://docs.hdfgroup.org/hdf5/rfc/Simple%20Performance%20Test%20on%20Fletcher32%20Filter.pdf\">Simple Performance Test on Fletcher32 Filter</a>" diff --git a/doxygen/dox/MetadataCachingInHDF5.dox b/doxygen/dox/MetadataCachingInHDF5.dox index 9ba0fab..b84ddea 100644 --- a/doxygen/dox/MetadataCachingInHDF5.dox +++ b/doxygen/dox/MetadataCachingInHDF5.dox @@ -668,7 +668,7 @@ reduction. With the hit rate threshold cache size decrement algorithm, the remaining fields in the section are ignored. -\subsubsection acsr Ageout Cache Size Reduction +\subsubsection dacsr Ageout Cache Size Reduction If \ref H5AC_cache_config_t.decr_mode "decr_mode" is #H5C_decr__age_out the cache size is decreased by the ageout algorithm, and the remaining fields of the @@ -692,7 +692,7 @@ The \ref H5AC_cache_config_t.decrement "decrement" and \ref H5AC_cache_config_t.upper_hr_threshold "upper_hr_threshold" fields are ignored in this case. -\subsubsection awhrtcsr Ageout With Hit Rate Threshold Cache Size Reduction +\subsubsection dawhrtcsr Ageout With Hit Rate Threshold Cache Size Reduction If \ref H5AC_cache_config_t.decr_mode "decr_mode" is #H5C_decr__age_out_with_threshold, the cache size is decreased by the ageout diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 7678de8..a97d6fa 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -169,3 +169,32 @@ if (NOT WIN32 AND NOT MINGW) COMPONENT hllibraries ) endif () + +#----------------------------------------------------------------------------- +# Option to build documentation +#----------------------------------------------------------------------------- +if (DOXYGEN_FOUND) +# 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 +## ${HL_SOURCES} ${HL_HEADERS} ${HDF5_DOXYGEN_DIR}/dox +# ${DOXYGEN_INPUT_DIRECTORY} +# ALL +# WORKING_DIRECTORY ${HDF5_HL_SRC_DIR} +# COMMENT "Generating HDF5 HL library Source Documentation" +# ) + +# This custom target and doxygen/configure work together + # Replace variables inside @@ with the current values + add_custom_target (hdf5hllib_doc ALL + COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${HDF5_HL_SRC_DIR} + COMMENT "Generating HDF5 HL library Source API documentation with Doxygen" + VERBATIM ) + + if (NOT TARGET doxygen) + add_custom_target (doxygen) + endif () + + add_dependencies (doxygen hdf5hllib_doc) +endif () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d1d848d..cde36c9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1399,38 +1399,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}/dox/cookbook ${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_TAG_FILE ${HDF5_BINARY_DIR}/hdf5.tag) - set (DOXYGEN_SERVER_BASED_SEARCH NO) - set (DOXYGEN_EXTERNAL_SEARCH NO) - set (DOXYGEN_SEARCHENGINE_URL) - set (DOXYGEN_PREDEFINED H5_HAVE_DIRECT H5_HAVE_LIBHDFS H5_HAVE_MAP_API H5_HAVE_PARALLEL H5_HAVE_ROS3_VFD) - -# 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 @@ -1440,11 +1408,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/H5Dpublic.h b/src/H5Dpublic.h index 8fe8020..c496414 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -152,7 +152,7 @@ typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_ * * \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 \pelem + * \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 diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 5e9c4ab..a5c5c37 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -7486,10 +7486,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 * */ @@ -8092,7 +8088,7 @@ H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no * 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 \op, \p start, \p stride, \p count, and \p block parameters + * 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. -- cgit v0.12 From f6f1a0234410e2cf13f0a078c3499a33e5bd056b Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 10 Sep 2021 07:45:04 -0500 Subject: Update examples version because of HDFFV-11269 (#998) --- bin/release | 6 +++--- config/cmake/HDF5_Examples.cmake.in | 2 +- config/cmake/scripts/HDF5options.cmake | 2 +- release_docs/README_HDF5_CMake | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/release b/bin/release index 0726b8c..8774851 100755 --- a/bin/release +++ b/bin/release @@ -235,7 +235,7 @@ tar2cmakezip() # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.3-Source.zip $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.4-Source.zip $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.zip $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir @@ -331,7 +331,7 @@ tar2cmaketgz() # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.3-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.4-Source.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir @@ -415,7 +415,7 @@ tar2hpccmaketgz() # step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.3-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.4-Source.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index d77e2df..2d8dc58 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -77,7 +77,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.3-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.4-Source") #endif() ############################################################################################################### diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 8a152d1..136f55d 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -69,7 +69,7 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### package examples #### -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.3-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.4-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# ### enable parallel builds diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake index c63eaca..c575320 100644 --- a/release_docs/README_HDF5_CMake +++ b/release_docs/README_HDF5_CMake @@ -10,7 +10,7 @@ This tar file contains LIBAEC.tar.gz source for building SZIP replacement ZLib.tar.gz source for building ZLIB hdf5_plugins.tar.gz source for building compression plugins - HDF5Examples-1.14.3-Source.tar.gz source for building examples + HDF5Examples-1.14.4-Source.tar.gz source for building examples For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in hdf5-1.13.0/release_docs, or -- cgit v0.12 From 7c973deaf1e602cf165a39860e574a9b5468d164 Mon Sep 17 00:00:00 2001 From: Jan-Willem Blokland <Jan-Willem.Blokland@Shell.com> Date: Mon, 13 Sep 2021 22:05:19 +0200 Subject: =?UTF-8?q?H5Ztrans:=20(feature)=20Improved=20H5Z=5Fxform=5Fnoop()?= =?UTF-8?q?=20and=20H5Z=5Fxform=5Fcreate()=20=E2=80=A6=20(#933)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * H5Ztrans: (feature) Improved H5Z_xform_noop() and H5Z_xform_create() function - Made a small improvement for H5Z_xform_noop() function. Now, the function will also return TRUE if the data transform function expression = "x". For this case, the HDF5 library behaves in a similar fashion as the case when no data transform function has been specified. - Improved the inline documentation of the function H5Z_xform_create() such it is more inline with the rest of the code. * Committing clang-format changes * H5Ztrans: (feature) Added 3 tests for improved H5Z_xform_noop() function - Added serial test with data transform expression = "x" to verify the improved H5Z_xform_noop() function behaves as expected. - Added 2 parallel tests with data transform expression = "x" in combination with a filter. Before, these tests will fail but with the improved H5Z_xform_noop() function they work and result in the expected behavior. - Small bug fix for one of parallel filter tests. * Committing clang-format changes * H5Ztrans: (feature) Added release note about detection of the simple data transform function "x". - Added a brief explanation about the implemented improvement of the detection of the simple data transform function "x" to the RELEASE.txt file. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- release_docs/RELEASE.txt | 11 ++ src/H5Ztrans.c | 18 +- test/dtransform.c | 27 +++ testpar/t_filters_parallel.c | 403 ++++++++++++++++++++++++++++++++++++++++++- testpar/t_filters_parallel.h | 20 +++ 5 files changed, 473 insertions(+), 6 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7ccb9ad..66907be 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -935,6 +935,17 @@ Bug Fixes since HDF5-1.12.0 release =================================== Library ------- + - Detection of simple data transform function "x" + + In the case of the simple data transform function "x" the (parallel) + library recognizes this is the same as not applying this data transform + function. This improves the I/O performance. In the case of the parallel + library, it also avoids breaking to independent I/O, which makes it + possible to apply a filter when writing or reading data to or from + teh HDF5 file. + + (JWSB - 2021/09/13) + - Fixed an invalid read and memory leak when parsing corrupt file space info messages diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 7d55efd..ab7e9be 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -1547,11 +1547,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 +1749,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/test/dtransform.c b/test/dtransform.c index 8d3a8c0..743103f 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -582,6 +582,7 @@ test_specials(hid_t file) const char *special4 = "-x"; const char *special5 = "+x"; const char *special6 = "2e+1*x"; + const char *special7 = "x"; TESTING("data transform of some special cases") @@ -729,6 +730,32 @@ test_specials(hid_t file) if (H5Dclose(dset_id) < 0) TEST_ERROR + /*----------------------------- + * Operation 7: x + * This operation will be + * treated if no function has + * been specified. + *----------------------------*/ + if (H5Pset_data_transform(dxpl_id, special7) < 0) + TEST_ERROR; + + for (row = 0; row < ROWS; row++) + for (col = 0; col < COLS; col++) + data_res[row][col] = transformData[row][col]; + + if ((dset_id = H5Dcreate2(file, "/special7", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + TEST_ERROR + if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0) + TEST_ERROR + if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) + TEST_ERROR + + COMPARE_INT(read_buf, data_res) + + if (H5Dclose(dset_id) < 0) + TEST_ERROR + if (H5Pclose(dxpl_id) < 0) TEST_ERROR if (H5Sclose(dataspace) < 0) diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 694992a..78af0fb 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -62,6 +62,7 @@ static void test_write_filtered_dataset_single_no_selection(void); static void test_write_filtered_dataset_all_no_selection(void); static void test_write_filtered_dataset_point_selection(void); static void test_write_filtered_dataset_interleaved_write(void); +static void test_write_transformed_filtered_dataset_no_overlap(void); static void test_write_3d_filtered_dataset_no_overlap_separate_pages(void); static void test_write_3d_filtered_dataset_no_overlap_same_pages(void); static void test_write_3d_filtered_dataset_overlap(void); @@ -79,6 +80,7 @@ static void test_read_filtered_dataset_single_no_selection(void); static void test_read_filtered_dataset_all_no_selection(void); static void test_read_filtered_dataset_point_selection(void); static void test_read_filtered_dataset_interleaved_read(void); +static void test_read_transformed_filtered_dataset_no_overlap(void); static void test_read_3d_filtered_dataset_no_overlap_separate_pages(void); static void test_read_3d_filtered_dataset_no_overlap_same_pages(void); static void test_read_3d_filtered_dataset_overlap(void); @@ -120,6 +122,7 @@ static void (*tests[])(void) = { test_write_filtered_dataset_all_no_selection, test_write_filtered_dataset_point_selection, test_write_filtered_dataset_interleaved_write, + test_write_transformed_filtered_dataset_no_overlap, test_write_3d_filtered_dataset_no_overlap_separate_pages, test_write_3d_filtered_dataset_no_overlap_same_pages, test_write_3d_filtered_dataset_overlap, @@ -135,6 +138,7 @@ static void (*tests[])(void) = { test_read_filtered_dataset_all_no_selection, test_read_filtered_dataset_point_selection, test_read_filtered_dataset_interleaved_read, + test_read_transformed_filtered_dataset_no_overlap, test_read_3d_filtered_dataset_no_overlap_separate_pages, test_read_3d_filtered_dataset_no_overlap_same_pages, test_read_3d_filtered_dataset_overlap, @@ -428,7 +432,7 @@ test_write_filtered_dataset_no_overlap(void) /* Select hyperslab in the file */ filespace = H5Dget_space(dset_id); - VRFY((dset_id >= 0), "File dataspace retrieval succeeded"); + VRFY((filespace >= 0), "File dataspace retrieval succeeded"); VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), "Hyperslab selection succeeded"); @@ -1288,6 +1292,177 @@ test_write_filtered_dataset_interleaved_write(void) } /* + * Tests parallel write of transformed and filtered data + * in the case where only one process is writing to a + * particular chunk in the operation. Normally, a data + * transform function will cause the parallel library to + * break to independent I/O and this isn't allowed when + * there are filters in the pipeline. However, in this + * case the parallel library recognizes that the used + * data transform function "x" is the same as not applying + * the transform function. Therefore it does not apply + * the transform function resulting in not breaking to + * independent I/O. + * + * Programmer: Jan-Willem Blokland + * 08/20/2021 + */ +static void +test_write_transformed_filtered_dataset_no_overlap(void) +{ + C_DATATYPE *data = NULL; + C_DATATYPE *read_buf = NULL; + C_DATATYPE *correct_buf = NULL; + hsize_t dataset_dims[WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t chunk_dims[WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t sel_dims[WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t start[WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t stride[WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t count[WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t block[WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + size_t i, data_size, correct_buf_size; + hid_t file_id = -1, dset_id = -1, plist_id = -1; + hid_t filespace = -1, memspace = -1; + + if (MAINPROCESS) + HDputs("Testing write to unshared transformed and filtered chunks"); + + CHECK_CUR_FILTER_AVAIL(); + + /* Set up file access property list with parallel I/O access */ + plist_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((plist_id >= 0), "FAPL creation succeeded"); + + VRFY((H5Pset_fapl_mpio(plist_id, comm, info) >= 0), "Set FAPL MPIO succeeded"); + + VRFY((H5Pset_libver_bounds(plist_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) >= 0), + "Set libver bounds succeeded"); + + file_id = H5Fopen(filenames[0], H5F_ACC_RDWR, plist_id); + VRFY((file_id >= 0), "Test file open succeeded"); + + VRFY((H5Pclose(plist_id) >= 0), "FAPL close succeeded"); + + /* Create the dataspace for the dataset */ + dataset_dims[0] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NROWS; + dataset_dims[1] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS; + chunk_dims[0] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS; + chunk_dims[1] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS; + sel_dims[0] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS; + sel_dims[1] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS; + + filespace = H5Screate_simple(WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS, dataset_dims, NULL); + VRFY((filespace >= 0), "File dataspace creation succeeded"); + + memspace = H5Screate_simple(WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS, sel_dims, NULL); + VRFY((memspace >= 0), "Memory dataspace creation succeeded"); + + /* Create chunked dataset */ + plist_id = H5Pcreate(H5P_DATASET_CREATE); + VRFY((plist_id >= 0), "DCPL creation succeeded"); + + VRFY((H5Pset_chunk(plist_id, WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS, chunk_dims) >= 0), + "Chunk size set"); + + /* Add test filter to the pipeline */ + VRFY((set_dcpl_filter(plist_id) >= 0), "Filter set"); + + dset_id = H5Dcreate2(file_id, WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_NAME, HDF5_DATATYPE_NAME, + filespace, H5P_DEFAULT, plist_id, H5P_DEFAULT); + VRFY((dset_id >= 0), "Dataset creation succeeded"); + + VRFY((H5Pclose(plist_id) >= 0), "DCPL close succeeded"); + VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded"); + + /* Each process defines the dataset selection in memory and writes + * it to the hyperslab in the file + */ + count[0] = 1; + count[1] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS / + (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS; + stride[0] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS; + stride[1] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS; + block[0] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS; + block[1] = (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS; + start[0] = ((hsize_t)mpi_rank * (hsize_t)WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS * count[0]); + start[1] = 0; + + if (VERBOSE_MED) { + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", + mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); + HDfflush(stdout); + } + + /* Select hyperslab in the file */ + filespace = H5Dget_space(dset_id); + VRFY((filespace >= 0), "File dataspace retrieval succeeded"); + + VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), + "Hyperslab selection succeeded"); + + /* Fill data buffer */ + data_size = sel_dims[0] * sel_dims[1] * sizeof(*data); + correct_buf_size = dataset_dims[0] * dataset_dims[1] * sizeof(*correct_buf); + + data = (C_DATATYPE *)HDcalloc(1, data_size); + VRFY((NULL != data), "HDcalloc succeeded"); + + correct_buf = (C_DATATYPE *)HDcalloc(1, correct_buf_size); + VRFY((NULL != correct_buf), "HDcalloc succeeded"); + + for (i = 0; i < data_size / sizeof(*data); i++) + data[i] = (C_DATATYPE)GEN_DATA(i); + + for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++) + correct_buf[i] = (C_DATATYPE)((i % (dataset_dims[0] / (hsize_t)mpi_size * dataset_dims[1])) + + (i / (dataset_dims[0] / (hsize_t)mpi_size * dataset_dims[1]))); + + /* Create property list for collective dataset write and data transform */ + plist_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((plist_id >= 0), "DXPL creation succeeded"); + + VRFY((H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE) >= 0), "Set DXPL MPIO succeeded"); + + /* Set data transform expression */ + VRFY((H5Pset_data_transform(plist_id, "x") >= 0), "Set data transform expression succeeded"); + + VRFY((H5Dwrite(dset_id, HDF5_DATATYPE_NAME, memspace, filespace, plist_id, data) >= 0), + "Dataset write succeeded"); + + if (data) + HDfree(data); + + VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); + + /* Verify the correct data was written */ + read_buf = (C_DATATYPE *)HDcalloc(1, correct_buf_size); + VRFY((NULL != read_buf), "HDcalloc succeeded"); + + dset_id = H5Dopen2(file_id, "/" WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_NAME, H5P_DEFAULT); + VRFY((dset_id >= 0), "Dataset open succeeded"); + + VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), + "Dataset read succeeded"); + + VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); + + if (correct_buf) + HDfree(correct_buf); + if (read_buf) + HDfree(read_buf); + + VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); + VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded"); + VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded"); + VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded"); + VRFY((H5Fclose(file_id) >= 0), "File close succeeded"); + + return; +} + +/* * Tests parallel write of filtered data in the case where * the dataset has 3 dimensions and each process writes * to its own "page" in the 3rd dimension. @@ -4224,6 +4399,232 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void) } /* + * Tests parallel read of transformed and filtered data in the + * case where only one process is reading from a particular + * chunk in the operation. Normally, a data transform function + * will cause the parallel library to break to independent I/O + * and this isn't allowed when there are filters in the pipeline. + * However, in this case the parallel library recognizes that + * the used data transform function "x" is the same as not + * applying the transform function. Therefore it does not apply + * the transform function resulting in not breaking to + * independent I/O. + * + * The MAINPROCESS rank will first write out all of the + * data to the dataset. Then, each rank reads a part of + * the dataset and contributes its piece to a global buffer + * that is checked for consistency. + * + * Programmer: Jan-Willem Blokland + * 08/20/2021 + */ +static void +test_read_transformed_filtered_dataset_no_overlap(void) +{ + C_DATATYPE *read_buf = NULL; + C_DATATYPE *correct_buf = NULL; + C_DATATYPE *global_buf = NULL; + hsize_t dataset_dims[READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t chunk_dims[READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t sel_dims[READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t start[READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t stride[READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t count[READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t block[READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t flat_dims[1]; + size_t i, read_buf_size, correct_buf_size; + hid_t file_id = -1, dset_id = -1, plist_id = -1; + hid_t filespace = -1, memspace = -1; + int * recvcounts = NULL; + int * displs = NULL; + + if (MAINPROCESS) + HDputs("Testing read from unshared transformed and filtered chunks"); + + CHECK_CUR_FILTER_AVAIL(); + + dataset_dims[0] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NROWS; + dataset_dims[1] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS; + + /* Setup the buffer for writing and for comparison */ + correct_buf_size = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NROWS * + (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS * sizeof(*correct_buf); + + correct_buf = (C_DATATYPE *)HDcalloc(1, correct_buf_size); + VRFY((NULL != correct_buf), "HDcalloc succeeded"); + + for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++) + correct_buf[i] = (C_DATATYPE)((i % (dataset_dims[0] / (hsize_t)mpi_size * dataset_dims[1])) + + (i / (dataset_dims[0] / (hsize_t)mpi_size * dataset_dims[1]))); + + if (MAINPROCESS) { + plist_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((plist_id >= 0), "FAPL creation succeeded"); + + VRFY((H5Pset_libver_bounds(plist_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) >= 0), + "Set libver bounds succeeded"); + + file_id = H5Fopen(filenames[0], H5F_ACC_RDWR, plist_id); + VRFY((file_id >= 0), "Test file open succeeded"); + + VRFY((H5Pclose(plist_id) >= 0), "FAPL close succeeded"); + + /* Create the dataspace for the dataset */ + filespace = + H5Screate_simple(READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS, dataset_dims, NULL); + VRFY((filespace >= 0), "File dataspace creation succeeded"); + + /* Create chunked dataset */ + chunk_dims[0] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS; + chunk_dims[1] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS; + + plist_id = H5Pcreate(H5P_DATASET_CREATE); + VRFY((plist_id >= 0), "DCPL creation succeeded"); + + VRFY( + (H5Pset_chunk(plist_id, READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS, chunk_dims) >= 0), + "Chunk size set"); + + /* Add test filter to the pipeline */ + VRFY((set_dcpl_filter(plist_id) >= 0), "Filter set"); + + dset_id = H5Dcreate2(file_id, READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_NAME, + HDF5_DATATYPE_NAME, filespace, H5P_DEFAULT, plist_id, H5P_DEFAULT); + VRFY((dset_id >= 0), "Dataset creation succeeded"); + + VRFY((H5Pclose(plist_id) >= 0), "DCPL close succeeded"); + VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded"); + + /* Create property list for collective dataset read */ + plist_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((plist_id >= 0), "DXPL creation succeeded"); + + /* Set data transform expression */ + VRFY((H5Pset_data_transform(plist_id, "x") >= 0), "Set data transform expression succeeded"); + + VRFY((H5Dwrite(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, correct_buf) >= 0), + "Dataset write succeeded"); + + VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded"); + VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); + VRFY((H5Fclose(file_id) >= 0), "File close succeeded"); + } + + /* Set up file access property list with parallel I/O access */ + plist_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((plist_id >= 0), "FAPL creation succeeded"); + + VRFY((H5Pset_fapl_mpio(plist_id, comm, info) >= 0), "Set FAPL MPIO succeeded"); + + VRFY((H5Pset_libver_bounds(plist_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) >= 0), + "Set libver bounds succeeded"); + + file_id = H5Fopen(filenames[0], H5F_ACC_RDONLY, plist_id); + VRFY((file_id >= 0), "Test file open succeeded"); + + VRFY((H5Pclose(plist_id) >= 0), "FAPL close succeeded"); + + dset_id = H5Dopen2(file_id, "/" READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_NAME, H5P_DEFAULT); + VRFY((dset_id >= 0), "Dataset open succeeded"); + + sel_dims[0] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS; + sel_dims[1] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS; + + /* Setup one-dimensional memory dataspace for reading the dataset data into a contiguous buffer */ + flat_dims[0] = sel_dims[0] * sel_dims[1]; + + memspace = H5Screate_simple(1, flat_dims, NULL); + VRFY((memspace >= 0), "Memory dataspace creation succeeded"); + + /* Select hyperslab in the file */ + filespace = H5Dget_space(dset_id); + VRFY((filespace >= 0), "File dataspace retrieval succeeded"); + + /* + * Each process defines the dataset selection in the file and reads + * it to the selection in memory + */ + count[0] = 1; + count[1] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS / + (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS; + stride[0] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS; + stride[1] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS; + block[0] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS; + block[1] = (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS; + start[0] = ((hsize_t)mpi_rank * (hsize_t)READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS * count[0]); + start[1] = 0; + + if (VERBOSE_MED) { + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", + mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); + HDfflush(stdout); + } + + VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0), + "Hyperslab selection succeeded"); + + /* Create property list for collective dataset read and data transform */ + plist_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((plist_id >= 0), "DXPL creation succeeded"); + + VRFY((H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE) >= 0), "Set DXPL MPIO succeeded"); + + /* Set data transform expression */ + VRFY((H5Pset_data_transform(plist_id, "x") >= 0), "Set data transform expression succeeded"); + + read_buf_size = flat_dims[0] * sizeof(*read_buf); + + read_buf = (C_DATATYPE *)HDcalloc(1, read_buf_size); + VRFY((NULL != read_buf), "HDcalloc succeeded"); + + VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, memspace, filespace, plist_id, read_buf) >= 0), + "Dataset read succeeded"); + + global_buf = (C_DATATYPE *)HDcalloc(1, correct_buf_size); + VRFY((NULL != global_buf), "HDcalloc succeeded"); + + /* Collect each piece of data from all ranks into a global buffer on all ranks */ + recvcounts = (int *)HDcalloc(1, (size_t)mpi_size * sizeof(*recvcounts)); + VRFY((NULL != recvcounts), "HDcalloc succeeded"); + + for (i = 0; i < (size_t)mpi_size; i++) + recvcounts[i] = (int)flat_dims[0]; + + displs = (int *)HDcalloc(1, (size_t)mpi_size * sizeof(*displs)); + VRFY((NULL != displs), "HDcalloc succeeded"); + + for (i = 0; i < (size_t)mpi_size; i++) + displs[i] = (int)(i * flat_dims[0]); + + VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int)flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, + displs, C_DATATYPE_MPI, comm)), + "MPI_Allgatherv succeeded"); + + VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); + + if (displs) + HDfree(displs); + if (recvcounts) + HDfree(recvcounts); + if (global_buf) + HDfree(global_buf); + if (read_buf) + HDfree(read_buf); + if (correct_buf) + HDfree(correct_buf); + + VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); + VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded"); + VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded"); + VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded"); + VRFY((H5Fclose(file_id) >= 0), "File close succeeded"); + + return; +} + +/* * Tests parallel read of filtered data in the case where * the dataset has 3 dimensions and each process reads from * each "page" in the 3rd dimension. However, no chunk on a diff --git a/testpar/t_filters_parallel.h b/testpar/t_filters_parallel.h index 3804c09..7eb34ed 100644 --- a/testpar/t_filters_parallel.h +++ b/testpar/t_filters_parallel.h @@ -138,6 +138,16 @@ typedef struct { #define INTERLEAVED_WRITE_FILTERED_DATASET_NCOLS \ (INTERLEAVED_WRITE_FILTERED_DATASET_CH_NCOLS * DIM1_SCALE_FACTOR) +/* Defines for the unshared transformed and filtered chunks write test */ +#define WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_NAME "unshared_transformed_filtered_chunks_write" +#define WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS 2 +#define WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NROWS (mpi_size * DIM0_SCALE_FACTOR) +#define WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS (mpi_size * DIM1_SCALE_FACTOR) +#define WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS \ + (WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NROWS / mpi_size) +#define WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS \ + (WRITE_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS / mpi_size) + /* Defines for the 3D unshared filtered dataset separate page write test */ #define WRITE_UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_NAME \ "3D_unshared_filtered_chunks_separate_pages_write" @@ -280,6 +290,16 @@ typedef struct { #define INTERLEAVED_READ_FILTERED_DATASET_NCOLS \ (INTERLEAVED_READ_FILTERED_DATASET_CH_NCOLS * DIM1_SCALE_FACTOR) +/* Defines for the unshared transformed and filtered chunks read test */ +#define READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_NAME "unshared_transformed_filtered_chunks_read" +#define READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_DATASET_DIMS 2 +#define READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NROWS (mpi_size * DIM0_SCALE_FACTOR) +#define READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS (mpi_size * DIM1_SCALE_FACTOR) +#define READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NROWS \ + (READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NROWS / mpi_size) +#define READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_CH_NCOLS \ + (READ_UNSHARED_TRANSFORMED_FILTERED_CHUNKS_NCOLS / mpi_size) + /* Defines for the 3D unshared filtered dataset separate page read test */ #define READ_UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_NAME \ "3D_unshared_filtered_chunks_separate_pages_read" -- cgit v0.12 From cd2ca91875be7d3ee98ab0131c32b9ee072509e5 Mon Sep 17 00:00:00 2001 From: jhendersonHDF <jhenderson@hdfgroup.org> Date: Tue, 14 Sep 2021 15:24:01 -0500 Subject: Fix several warnings (#720) --- hl/src/H5LT.c | 2 +- java/src/jni/h5util.c | 19 +++---------------- src/H5Dio.c | 30 +++++++++++++++++++++--------- src/H5E.c | 2 +- src/H5Eint.c | 2 +- src/H5FDmulti.c | 4 ++-- src/H5FDsplitter.c | 22 ++++++++++++---------- src/H5Fsuper.c | 2 +- src/H5PL.c | 2 +- src/H5Pdapl.c | 4 ++-- src/H5Pdxpl.c | 2 +- src/H5Pencdec.c | 2 +- src/H5Plapl.c | 2 +- src/H5VLint.c | 2 +- src/H5system.c | 4 ++-- test/ohdr.c | 2 +- tools/lib/h5tools_str.c | 3 ++- tools/src/h5dump/h5dump_ddl.c | 20 ++++++++++++++------ tools/src/h5import/h5import.c | 7 +++++-- 19 files changed, 73 insertions(+), 60 deletions(-) diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index a314f3f..0917044 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2206,7 +2206,7 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str */ if (size_str < *len - 1) { if (size_str + size_str_to_add < *len - 1) { - HDstrncat(buf, str_to_add, size_str_to_add); + HDstrcat(buf, str_to_add); } else { HDstrncat(buf, str_to_add, (*len - 1) - size_str); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 8021438..4272205 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -870,11 +870,8 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i } else { if (typeSize > 0) { - if (NULL == (this_str = (char *)HDmalloc(typeSize + 1))) + if (NULL == (this_str = HDstrdup(tmp_str))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - - HDstrncpy(this_str, tmp_str, typeSize); - this_str[typeSize] = '\0'; } } @@ -3664,19 +3661,14 @@ obj_info_all(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d info_all_t *datainfo = (info_all_t *)op_data; H5O_info2_t object_info; htri_t object_exists; - size_t str_len; datainfo->otype[datainfo->count] = -1; datainfo->ltype[datainfo->count] = -1; datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF; - str_len = HDstrlen(name); - if (NULL == (datainfo->objname[datainfo->count] = (char *)HDmalloc(str_len + 1))) + if (NULL == (datainfo->objname[datainfo->count] = HDstrdup(name))) goto done; - HDstrncpy(datainfo->objname[datainfo->count], name, str_len); - (datainfo->objname[datainfo->count])[str_len] = '\0'; - if ((object_exists = H5Oexists_by_name(loc_id, name, H5P_DEFAULT)) < 0) goto done; @@ -3702,7 +3694,6 @@ obj_info_max(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d { info_all_t *datainfo = (info_all_t *)op_data; H5O_info2_t object_info; - size_t str_len; datainfo->otype[datainfo->count] = -1; datainfo->ltype[datainfo->count] = -1; @@ -3710,13 +3701,9 @@ obj_info_max(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF; /* This will be freed by h5str_array_free(oName, n) */ - str_len = HDstrlen(name); - if (NULL == (datainfo->objname[datainfo->count] = (char *)HDmalloc(str_len + 1))) + if (NULL == (datainfo->objname[datainfo->count] = HDstrdup(name))) goto done; - HDstrncpy(datainfo->objname[datainfo->count], name, str_len); - (datainfo->objname[datainfo->count])[str_len] = '\0'; - if (H5Oget_info3(loc_id, &object_info, H5O_INFO_ALL) < 0) goto done; diff --git a/src/H5Dio.c b/src/H5Dio.c index d1861c4..6bd4666 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -856,28 +856,40 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ for (cause = 1, idx = 0; (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (idx < cause_strings_len); cause <<= 1, idx++) { - size_t cause_strlen = HDstrlen(cause_strings[idx]); - if (cause & local_no_collective_cause) { + size_t local_buffer_space = sizeof(local_no_collective_cause_string) - + HDstrlen(local_no_collective_cause_string) - 1; + /* Check if there were any previous error messages included. If so, prepend a * semicolon to separate the messages. */ - if (local_error_message_previously_written) - HDstrncat(local_no_collective_cause_string, "; ", 2); + if (local_buffer_space && local_error_message_previously_written) { + HDstrncat(local_no_collective_cause_string, "; ", local_buffer_space); + local_buffer_space -= MIN(local_buffer_space, 2); + } - HDstrncat(local_no_collective_cause_string, cause_strings[idx], cause_strlen); + if (local_buffer_space) + HDstrncat(local_no_collective_cause_string, cause_strings[idx], + local_buffer_space); local_error_message_previously_written = TRUE; } /* end if */ if (cause & global_no_collective_cause) { + size_t global_buffer_space = sizeof(global_no_collective_cause_string) - + HDstrlen(global_no_collective_cause_string) - 1; + /* Check if there were any previous error messages included. If so, prepend a * semicolon to separate the messages. */ - if (global_error_message_previously_written) - HDstrncat(global_no_collective_cause_string, "; ", 2); - - HDstrncat(global_no_collective_cause_string, cause_strings[idx], cause_strlen); + if (global_buffer_space && global_error_message_previously_written) { + HDstrncat(global_no_collective_cause_string, "; ", global_buffer_space); + global_buffer_space -= MIN(global_buffer_space, 2); + } + + if (global_buffer_space) + HDstrncat(global_no_collective_cause_string, cause_strings[idx], + global_buffer_space); global_error_message_previously_written = TRUE; } /* end if */ diff --git a/src/H5E.c b/src/H5E.c index b132103..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 */ diff --git a/src/H5Eint.c b/src/H5Eint.c index b38833f..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 */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 86f7664..e059e55 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -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'; 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/H5Fsuper.c b/src/H5Fsuper.c index e7a3b53..4df0064 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -1043,7 +1043,7 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin driver info") /* Evict the driver info block from the cache */ - if (H5AC_expunge_entry(f, H5AC_DRVRINFO, sblock->driver_addr, H5AC__NO_FLAGS_SET) < 0) + if (sblock && H5AC_expunge_entry(f, H5AC_DRVRINFO, sblock->driver_addr, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge driver info block") } /* end if */ 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/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 a0c38f8..46dc94c 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -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 */ 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/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/H5VLint.c b/src/H5VLint.c index 70c8112..b4432d0 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1757,7 +1757,7 @@ H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size) len = HDstrlen(cls->name); if (name) { - HDstrncpy(name, cls->name, MIN(len + 1, size)); + HDstrncpy(name, cls->name, size); if (len >= size) name[size - 1] = '\0'; } /* end if */ diff --git a/src/H5system.c b/src/H5system.c index fe379ad..9a966b0 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 */ diff --git a/test/ohdr.c b/test/ohdr.c index afcea87..d28b11e 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -541,7 +541,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) done in the source directory. */ HDstrncpy(testfile, FILE_BOGUS, TESTFILE_LEN); testfile[TESTFILE_LEN - 1] = '\0'; - HDstrncat(testfile, ".copy", 5); + HDstrncat(testfile, ".copy", sizeof(testfile) - HDstrlen(testfile) - 1); /* Make a copy of the data file from svn. */ if (h5_make_local_copy(FILE_BOGUS, testfile) < 0) diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 5fcaee6..abc0058 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -258,7 +258,8 @@ h5tools_str_fmt(h5tools_str_t *str /*in,out*/, size_t start, const char *fmt) HDassert(temp); } - HDstrncpy(temp, str->s + start, n); + HDstrncpy(temp, str->s + start, n - 1); + temp[n - 1] = '\0'; } /* Reset the output string and append a formatted version */ diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 2a69ca6..638a738 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -1343,13 +1343,21 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a ret = FAIL; } else { + size_t buffer_space = w - 1; + HDmemset(obj_name, '\0', w); if (op_name[0] != '/') { - HDstrncat(obj_name, buf, u + 1); - if (buf[u - 1] != '/') - HDstrncat(obj_name, "/", (size_t)2); + HDstrncat(obj_name, buf, buffer_space); + buffer_space -= MIN(buffer_space, u); + + if (buf[u - 1] != '/') { + HDstrncat(obj_name, "/", buffer_space); + buffer_space -= MIN(buffer_space, 2); + } } - HDstrncat(obj_name, op_name, v + 1); + + HDstrncat(obj_name, op_name, buffer_space); + buffer_space -= MIN(buffer_space, v); handle_attributes(oid, obj_name, NULL, 0, NULL); HDfree(obj_name); @@ -1421,10 +1429,10 @@ lnk_search(const char *path, const H5L_info2_t *li, void *_op_data) else { if (k == 2) { HDstrcpy(search_name, "/"); - HDstrncat(search_name, op_name, search_len + 1); + HDstrcat(search_name, op_name); } else - HDstrncpy(search_name, op_name, search_len + 1); + HDstrcpy(search_name, op_name); search_name[search_len + k - 1] = '\0'; if (HDstrcmp(path, search_name) == 0) { diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 04e1c35..6517e43 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -3771,6 +3771,7 @@ getCompressionParameter(struct Input *in, FILE *strm) static int getExternalFilename(struct Input *in, FILE *strm) { + size_t temp_len; char temp[255]; const char *err1 = "Unable to get 'string' value.\n"; @@ -3779,8 +3780,10 @@ getExternalFilename(struct Input *in, FILE *strm) return (-1); } - in->externFilename = (char *)HDmalloc((size_t)(HDstrlen(temp) + 1) * sizeof(char)); - (void)HDstrncpy(in->externFilename, temp, HDstrlen(temp) + 1); + temp_len = HDstrlen(temp); + in->externFilename = (char *)HDmalloc((temp_len + 1) * sizeof(char)); + (void)HDstrcpy(in->externFilename, temp); + in->externFilename[temp_len] = '\0'; return (0); } -- cgit v0.12 From 1c892fb41fb5439d3b4a69fd3cd9d25e4aa2ee6e Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 15 Sep 2021 08:26:25 -0500 Subject: Fix java warnings (#1005) --- java/src/hdf/hdf5lib/HDFArray.java | 52 +++++++++++++++------------------ java/src/hdf/hdf5lib/HDFNativeData.java | 30 +++++++++---------- java/test/TestH5Pfapl.java | 2 +- 3 files changed, 37 insertions(+), 47 deletions(-) diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java index bb9357e..21e2b02 100644 --- a/java/src/hdf/hdf5lib/HDFArray.java +++ b/java/src/hdf/hdf5lib/HDFArray.java @@ -46,10 +46,10 @@ public class HDFArray { * * @param anArray * The array object. - * @exception hdf.hdf5lib.exceptions.HDF5Exception - * object is not an array. + * @exception hdf.hdf5lib.exceptions.HDF5JavaException + * object is not an array. */ - public HDFArray(Object anArray) throws HDF5Exception + public HDFArray(Object anArray) throws HDF5JavaException { if (anArray == null) { HDF5JavaException ex = new HDF5JavaException("HDFArray: array is null?: "); @@ -76,16 +76,14 @@ public class HDFArray { * @return A one-D array of bytes, filled with zeroes. The bytes are sufficient to hold the data of the Array passed * to the constructor. * @exception hdf.hdf5lib.exceptions.HDF5JavaException - * Allocation failed. + * Allocation failed. */ - public byte[] emptyBytes() - throws HDF5JavaException + public byte[] emptyBytes() throws HDF5JavaException { byte[] b = null; - if ((ArrayDescriptor.dims == 1) - && (ArrayDescriptor.NT == 'B')) { + if ((ArrayDescriptor.dims == 1) && (ArrayDescriptor.NT == 'B')) { b = (byte[]) _theArray; } else { @@ -103,10 +101,9 @@ public class HDFArray { * * @return A one-D array of bytes, constructed from the Array passed to the constructor. * @exception hdf.hdf5lib.exceptions.HDF5JavaException - * the object not an array or other internal error. + * the object not an array or other internal error. */ - public byte[] byteify() - throws HDF5JavaException + public byte[] byteify() throws HDF5JavaException { if (_barray != null) { return _barray; @@ -224,8 +221,6 @@ public class HDFArray { if (ArrayDescriptor.NT == 'J') { arow = HDFNativeData.longToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); - arow = HDFNativeData.longToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], - (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.NT == 'I') { arow = HDFNativeData.intToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], @@ -552,8 +547,7 @@ public class HDFArray { + "?")); } } - if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims - - 1]) { + if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1]) { throw new java.lang.InternalError( new String("HDFArray::arrayify Panic didn't complete all data: currentindex[" + i + "] = " + ArrayDescriptor.currentindex[i] + " (should be " + (ArrayDescriptor.dimlen[i]) + "?")); @@ -580,7 +574,7 @@ public class HDFArray { Integer[] out = new Integer[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Integer(in[i]); + out[i] = Integer.valueOf(in[i]); } return out; } @@ -592,7 +586,7 @@ public class HDFArray { Integer[] out = new Integer[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Integer(in[i]); + out[i] = Integer.valueOf(in[i]); } return out; } @@ -615,7 +609,7 @@ public class HDFArray { Short[] out = new Short[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Short(in[i]); + out[i] = Short.valueOf(in[i]); } return out; } @@ -627,7 +621,7 @@ public class HDFArray { Short[] out = new Short[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Short(in[i]); + out[i] = Short.valueOf(in[i]); } return out; } @@ -649,7 +643,7 @@ public class HDFArray { Byte[] out = new Byte[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Byte(bin[i]); + out[i] = Byte.valueOf(bin[i]); } return out; } @@ -659,7 +653,7 @@ public class HDFArray { Byte[] out = new Byte[len]; for (int i = 0; i < len; i++) { - out[i] = new Byte(bin[i]); + out[i] = Byte.valueOf(bin[i]); } return out; } @@ -682,7 +676,7 @@ public class HDFArray { Float[] out = new Float[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Float(in[i]); + out[i] = Float.valueOf(in[i]); } return out; } @@ -694,7 +688,7 @@ public class HDFArray { Float[] out = new Float[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Float(in[i]); + out[i] = Float.valueOf(in[i]); } return out; } @@ -717,7 +711,7 @@ public class HDFArray { Double[] out = new Double[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Double(in[i]); + out[i] = Double.valueOf(in[i]); } return out; } @@ -729,7 +723,7 @@ public class HDFArray { Double[] out = new Double[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Double(in[i]); + out[i] = Double.valueOf(in[i]); } return out; } @@ -752,7 +746,7 @@ public class HDFArray { Long[] out = new Long[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Long(in[i]); + out[i] = Long.valueOf(in[i]); } return out; } @@ -764,7 +758,7 @@ public class HDFArray { Long[] out = new Long[nelems]; for (int i = 0; i < nelems; i++) { - out[i] = new Long(in[i]); + out[i] = Long.valueOf(in[i]); } return out; } @@ -790,12 +784,12 @@ class ArrayDescriptor { static int dims = 0; static String className; - public ArrayDescriptor(Object anArray) throws HDF5Exception + public ArrayDescriptor(Object anArray) throws HDF5JavaException { Class tc = anArray.getClass(); if (tc.isArray() == false) { /* exception: not an array */ - HDF5Exception ex = new HDF5JavaException("ArrayDescriptor: not an array?: "); + HDF5JavaException ex = new HDF5JavaException("ArrayDescriptor: not an array?: "); throw (ex); } diff --git a/java/src/hdf/hdf5lib/HDFNativeData.java b/java/src/hdf/hdf5lib/HDFNativeData.java index 5b29050..85378db 100644 --- a/java/src/hdf/hdf5lib/HDFNativeData.java +++ b/java/src/hdf/hdf5lib/HDFNativeData.java @@ -153,8 +153,7 @@ public class HDFNativeData { * The input array of bytes * @return an array of 'len' float */ - public synchronized static native float[] byteToFloat(int start, int len, - byte[] data); + public synchronized static native float[] byteToFloat(int start, int len, byte[] data); /** * Convert 4 bytes from an array of bytes into a single float @@ -437,41 +436,38 @@ public class HDFNativeData { * - Error unsupported type. */ public synchronized static Object byteToNumber(byte[] barray, Object obj) - throws HDF5Exception { + throws HDF5Exception + { Class theClass = obj.getClass(); String type = theClass.getName(); Object retobj = null; if (type.equals("java.lang.Integer")) { int[] i = hdf.hdf5lib.HDFNativeData.byteToInt(0, 1, barray); - retobj = new Integer(i[0]); + retobj = Integer.valueOf(i[0]); } else if (type.equals("java.lang.Byte")) { - retobj = new Byte(barray[0]); + retobj = Byte.valueOf(barray[0]); } else if (type.equals("java.lang.Short")) { - short[] f = hdf.hdf5lib.HDFNativeData - .byteToShort(0, 1, barray); - retobj = new Short(f[0]); + short[] f = hdf.hdf5lib.HDFNativeData.byteToShort(0, 1, barray); + retobj = Short.valueOf(f[0]); } else if (type.equals("java.lang.Float")) { - float[] f = hdf.hdf5lib.HDFNativeData - .byteToFloat(0, 1, barray); - retobj = new Float(f[0]); + float[] f = hdf.hdf5lib.HDFNativeData.byteToFloat(0, 1, barray); + retobj = Float.valueOf(f[0]); } else if (type.equals("java.lang.Long")) { long[] f = hdf.hdf5lib.HDFNativeData.byteToLong(0, 1, barray); - retobj = new Long(f[0]); + retobj = Long.valueOf(f[0]); } else if (type.equals("java.lang.Double")) { - double[] f = hdf.hdf5lib.HDFNativeData.byteToDouble(0, 1, - barray); - retobj = new Double(f[0]); + double[] f = hdf.hdf5lib.HDFNativeData.byteToDouble(0, 1, barray); + retobj = Double.valueOf(f[0]); } else { /* exception: unsupported type */ - HDF5Exception ex = new HDF5JavaException( - "byteToNumber: setfield bad type: " + obj + " " + type); + HDF5Exception ex = new HDF5JavaException("byteToNumber: setfield bad type: " + obj + " " + type); throw (ex); } return (retobj); diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index cc674e2..a65b52e 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -102,7 +102,7 @@ public class TestH5Pfapl { for(int indx = 0; ;indx++) { java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000"); try { - file = new File("test"+myFormat.format(new Integer(indx))+".h5"); + file = new File("test"+myFormat.format(Integer.valueOf(indx))+".h5"); } catch (Throwable err) {} -- cgit v0.12 From 1f2bba5255014465a319750e2ba712ebb70eee74 Mon Sep 17 00:00:00 2001 From: Sean McBride <sean@rogue-research.com> Date: Thu, 16 Sep 2021 08:42:20 -0400 Subject: Modified gcc/clang warning suppression macros to account for some warnings flags being supported by one compiler but not the other (#379) * Committing clang-format changes * Fixed GCC warning suppression pragmas to also work with clang H5_GCC_DIAG_ON remains gcc-only. Added a new H5_CLANG_DIAG_ON that's clang-only, but it's not used anywhere currently. Added a new H5_GCC_CLANG_DIAG_ON that works with both compilers, which afterall support mostly the same warnings. Changed almost all uses of H5_GCC_DIAG_ON to use H5_GCC_CLANG_DIAG_ON, with the exception of a couple, where they really were suppressing gcc-only warnings. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- hl/src/H5LT.c | 8 +-- java/src/jni/h5Constants.c | 12 ++-- src/H5FDfamily.c | 8 +-- src/H5FDmulti.c | 4 +- src/H5Idbg.c | 4 +- src/H5Iint.c | 36 +++++------ src/H5PLint.c | 4 +- src/H5PLplugin_cache.c | 4 +- src/H5RS.c | 4 +- src/H5Tconv.c | 120 ++++++++++++++++++------------------- src/H5detect.c | 12 ++-- src/H5private.h | 44 +++++++++++--- test/big.c | 4 +- test/error_test.c | 4 +- test/fheap.c | 4 +- test/file_image.c | 4 +- test/h5test.c | 4 +- test/vfd.c | 12 ++-- tools/libtest/h5tools_test_utils.c | 4 +- 19 files changed, 162 insertions(+), 134 deletions(-) diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 0917044..8f2b33f 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1352,13 +1352,13 @@ find_dataset(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const * modify the op_data buffer (i.e.: dset_name) during the traversal, and the * library never modifies that buffer. */ -H5_GCC_DIAG_OFF("cast-qual") +H5_GCC_CLANG_DIAG_OFF("cast-qual") herr_t H5LTfind_dataset(hid_t loc_id, const char *dset_name) { return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name); } -H5_GCC_DIAG_ON("cast-qual") +H5_GCC_CLANG_DIAG_ON("cast-qual") /*------------------------------------------------------------------------- * @@ -1945,13 +1945,13 @@ H5LTfind_attribute(hid_t loc_id, const char *attr_name) * modify the op_data buffer (i.e.: attr_name) during the traversal, and the * library never modifies that buffer. */ -H5_GCC_DIAG_OFF("cast-qual") +H5_GCC_CLANG_DIAG_OFF("cast-qual") herr_t H5LT_find_attribute(hid_t loc_id, const char *attr_name) { return H5Aiterate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, find_attr, (void *)attr_name); } -H5_GCC_DIAG_ON("cast-qual") +H5_GCC_CLANG_DIAG_ON("cast-qual") /*------------------------------------------------------------------------- * Function: H5LTget_attribute_ndims diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 7354e95..bdffdbd 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -26,8 +26,8 @@ extern "C" { #include <stdlib.h> #include "h5jni.h" -H5_GCC_DIAG_OFF("missing-prototypes") -H5_GCC_DIAG_OFF("unused-parameter") +H5_GCC_CLANG_DIAG_OFF("missing-prototypes") +H5_GCC_CLANG_DIAG_OFF("unused-parameter") JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1QUARTER_1HADDR_1MAX(JNIEnv *env, jclass cls) @@ -1212,7 +1212,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1FAIL(JNIEnv *env, jclass cls) } /* Java does not have unsigned native types */ -H5_GCC_DIAG_OFF("sign-conversion") +H5_GCC_CLANG_DIAG_OFF("sign-conversion") JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1CREAT(JNIEnv *env, jclass cls) { @@ -1253,7 +1253,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1WRITE(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_WRITE; } -H5_GCC_DIAG_ON("sign-conversion") +H5_GCC_CLANG_DIAG_ON("sign-conversion") JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1DEFAULT(JNIEnv *env, jclass cls) @@ -3724,8 +3724,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ALL(JNIEnv *env, jclass cls) return H5Z_FILTER_ALL; } -H5_GCC_DIAG_ON("missing-prototypes") -H5_GCC_DIAG_ON("unused-parameter") +H5_GCC_CLANG_DIAG_ON("missing-prototypes") +H5_GCC_CLANG_DIAG_ON("unused-parameter") #ifdef __cplusplus } /* end extern "C" */ 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/H5FDmulti.c b/src/H5FDmulti.c index e059e55..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. @@ -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/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/H5PLint.c b/src/H5PLint.c index 6bb8404..d20401e 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -292,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) @@ -414,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/H5PLplugin_cache.c b/src/H5PLplugin_cache.c index 4f5c0ce..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) @@ -320,4 +320,4 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f 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/H5RS.c b/src/H5RS.c index 31fa23a..d9915f2 100644 --- a/src/H5RS.c +++ b/src/H5RS.c @@ -349,7 +349,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 +392,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 diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 0c98633..18cbcf1 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -7725,9 +7725,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 +7747,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 +7769,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 +7791,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 +7813,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 +7835,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 +7857,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 +7879,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 +7901,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 +7923,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 +7945,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 +7967,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 +7989,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 +8011,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 +8033,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 +8055,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 +8077,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 +8099,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 +8121,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 +8143,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 +8165,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 +8187,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 +8209,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 +8231,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 +8253,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 +8275,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 +8297,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 +8319,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 +8342,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 +8366,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/H5detect.c b/src/H5detect.c index 2e893cf..e8cded7 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]; \ } \ @@ -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/H5private.h b/src/H5private.h index 7b18df0..2318f10 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -451,7 +451,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 @@ -461,19 +461,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 diff --git a/test/big.c b/test/big.c index 2bbae67..6f8ce67 100644 --- a/test/big.c +++ b/test/big.c @@ -277,7 +277,7 @@ error: * '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 int enough_room(hid_t fapl) { @@ -319,7 +319,7 @@ done: return ret_value; } -H5_GCC_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: writer diff --git a/test/error_test.c b/test/error_test.c index cf1e82c..f4dc340 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -319,7 +319,7 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie * 'full_desc' 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 test_long_desc(void) { @@ -375,7 +375,7 @@ error: return -1; } /* end test_long_desc() */ -H5_GCC_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: dump_error diff --git a/test/fheap.c b/test/fheap.c index cb9c080..86a555d 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -553,7 +553,7 @@ get_fill_size(const fheap_test_param_t *tparam) * test_desc 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 int begin_test(fheap_test_param_t *tparam, const char *base_desc, fheap_heap_ids_t *keep_ids, size_t *fill_size) { @@ -581,7 +581,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc, fheap_heap_ids_t * /* Success */ return (0); } /* end begin_test() */ -H5_GCC_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: reopen_file diff --git a/test/file_image.c b/test/file_image.c index 0373468..0d031f5 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -712,7 +712,7 @@ error: * 'member_file_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 int test_get_file_image(const char *test_banner, const int file_name_num, hid_t fapl, hbool_t user) { @@ -976,7 +976,7 @@ test_get_file_image(const char *test_banner, const int file_name_num, hid_t fapl error: return 1; } /* end test_get_file_image() */ -H5_GCC_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /****************************************************************************** * Function: test_get_file_image_error_rejection diff --git a/test/h5test.c b/test/h5test.c index 755ae93..09fb5b5 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1305,7 +1305,7 @@ h5_dump_info_object(MPI_Info info) * 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") h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl) { @@ -1410,7 +1410,7 @@ h5_get_file_size(const char *filename, hid_t fapl) return (-1); } /* end get_file_size() */ -H5_GCC_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /* * This routine is designed to provide equivalent functionality to 'printf' diff --git a/test/vfd.c b/test/vfd.c index 8484bfd..f4cb988 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -859,7 +859,7 @@ error: * 'first_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 test_family_opens(char *fname, hid_t fa_pl) { @@ -924,7 +924,7 @@ test_family_opens(char *fname, hid_t fa_pl) error: return -1; } /* end test_family_opens() */ -H5_GCC_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: test_family @@ -1150,7 +1150,7 @@ error: * 'newname_individual', etc. 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 test_family_compat(void) { @@ -1236,7 +1236,7 @@ error: return -1; } /* end test_family_compat() */ -H5_GCC_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: test_family_member_fapl @@ -1376,7 +1376,7 @@ error: * 'sf_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 test_multi_opens(char *fname) { @@ -1396,7 +1396,7 @@ test_multi_opens(char *fname) return (fid >= 0 ? FAIL : SUCCEED); } /* end test_multi_opens() */ -H5_GCC_DIAG_ON("format-nonliteral") +H5_GCC_CLANG_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: test_multi diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 54f6f51..37d38fd 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -69,7 +69,7 @@ * *****************************************************************************/ -H5_GCC_DIAG_OFF("format") +H5_GCC_CLANG_DIAG_OFF("format") /*---------------------------------------------------------------------------- * @@ -1254,7 +1254,7 @@ error: #undef UTIL_TEST_DEFAULT #undef UTIL_TEST_CREATE } /* test_set_configured_fapl */ -H5_GCC_DIAG_ON("format") +H5_GCC_CLANG_DIAG_ON("format") /*---------------------------------------------------------------------------- * -- cgit v0.12 From daeb4454f6d8b72d5fab6a78546859b2182bd248 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 16 Sep 2021 10:21:21 -0500 Subject: Disable fortran warning (#1014) --- config/cmake/HDFFortranCompilerFlags.cmake | 7 ++++--- config/gnu-fflags | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake index 18ab621..94c40aa 100644 --- a/config/cmake/HDFFortranCompilerFlags.cmake +++ b/config/cmake/HDFFortranCompilerFlags.cmake @@ -91,9 +91,10 @@ if (NOT MSVC AND NOT MINGW) #endif () # Append more extra warning flags that only gcc 5.x+ knows about - if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.0) - ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-5") - endif () + # do not include -Wuse-without-only + #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.0) + # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-5") + #endif () # Append more extra warning flags that only gcc 6.x+ knows about if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0) diff --git a/config/gnu-fflags b/config/gnu-fflags index ec4fcab..ce12561 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -161,10 +161,10 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # gfortran 4.9 (nothing new) - # gfortran >= 5 - if test $f9x_vers_major -ge 5; then - H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-5)" - fi + # gfortran >= 5 (do not include -Wuse-without-only) + #if test $f9x_vers_major -ge 5; then + # H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-5)" + #fi # gfortran >= 6 if test $f9x_vers_major -ge 6; then -- cgit v0.12 From c0f2bc87aca0ddfed4bbf1a75dda5ea71b6617eb Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 16 Sep 2021 12:15:25 -0500 Subject: HDFFV-11266 - add option to build HL tools (#1018) * HDFFV-11266 - add option to build HL tools * Correct if syntax * Correct name of conditional --- config/cmake/hdf5-config.cmake.in | 1 + config/cmake/libhdf5.settings.cmake.in | 1 + configure.ac | 20 ++++++++++++++++++++ hl/CMakeLists.txt | 12 ++++++++++-- hl/Makefile.am | 5 ++++- release_docs/INSTALL_CMake.txt | 1 + release_docs/RELEASE.txt | 12 ++++++++++-- 7 files changed, 47 insertions(+), 5 deletions(-) diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 4d02c9c..8faa2fe 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -38,6 +38,7 @@ set (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) set (${HDF5_PACKAGE_NAME}_BUILD_JAVA @HDF5_BUILD_JAVA@) set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS @HDF5_BUILD_TOOLS@) set (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) +set (${HDF5_PACKAGE_NAME}_BUILD_HL_TOOLS @HDF5_BUILD_HL_TOOLS@) set (${HDF5_PACKAGE_NAME}_ENABLE_THREADSAFE @HDF5_ENABLE_THREADSAFE@) set (${HDF5_PACKAGE_NAME}_ENABLE_PLUGIN_SUPPORT @HDF5_ENABLE_PLUGIN_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index ebcbd61..eb83c3a 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -70,6 +70,7 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ High-level library: @HDF5_BUILD_HL_LIB@ Build HDF5 Tests: @BUILD_TESTING@ Build HDF5 Tools: @HDF5_BUILD_TOOLS@ + Build High-level HDF5 Tools: @HDF5_BUILD_HL_TOOLS@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ diff --git a/configure.ac b/configure.ac index bc2358f..eb101cb 100644 --- a/configure.ac +++ b/configure.ac @@ -786,6 +786,7 @@ AC_LANG_POP(C++) ## This needs to be exposed for the library info file even if the HL ## library is disabled. AC_SUBST([HDF5_HL]) +AC_SUBST([HDF5_HL_TOOLS]) ## The high-level library is enabled unless the build mode is clean. if test "X-$BUILD_MODE" = "X-clean" ; then @@ -802,6 +803,9 @@ HL="" ## Fortran high-level library AC_SUBST(HL_FOR) HL_FOR="" +## Tools high-level library +AC_SUBST(HL_TOOLS) +HL_TOOLS="" AC_MSG_CHECKING([if the high-level library is enabled]) AC_ARG_ENABLE([hl], @@ -820,6 +824,21 @@ else AC_MSG_RESULT([no]) fi +AC_MSG_CHECKING([if the high-level tools are enabled]) +AC_ARG_ENABLE([hltools], + [AS_HELP_STRING([--enable-hltools], + [Enable the high-level tools. + [default=yes)] + ])], + [HDF5_HL_TOOLS=$enableval]) + +if test "X${HDF5_HL}" = "Xyes" -a "X-$HDF5_HL_TOOLS" = "X-yes"; then + AC_MSG_RESULT([yes]) + HL_TOOLS="tools" +else + AC_MSG_RESULT([no]) +fi + ## ---------------------------------------------------------------------- ## Check which archiving tool to use. This needs to be done before @@ -3850,6 +3869,7 @@ AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"]) AM_CONDITIONAL([BUILD_TESTS_CONDITIONAL], [test "X$HDF5_TESTS" = "Xyes"]) AM_CONDITIONAL([BUILD_TESTS_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"]) AM_CONDITIONAL([BUILD_TOOLS_CONDITIONAL], [test "X$HDF5_TOOLS" = "Xyes"]) +AM_CONDITIONAL([BUILD_TOOLS_HL_CONDITIONAL], [test "X$HDF5_HL_TOOLS" = "Xyes"]) AM_CONDITIONAL([BUILD_DOXYGEN_CONDITIONAL], [test "X$HDF5_DOXYGEN" = "Xyes"]) ## ---------------------------------------------------------------------- diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 083c60e..5061c6c 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -7,9 +7,17 @@ project (HDF5_HL C) add_subdirectory (src) -#-- Build the High level Tools +# Build HDF5 Tools if (HDF5_BUILD_TOOLS) - add_subdirectory (tools) + #----------------------------------------------------------------------------- + #-- Option to build the High level Tools + #----------------------------------------------------------------------------- + if (EXISTS "${HDF5_HL_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_HL_SOURCE_DIR}/tools") + option (HDF5_BUILD_HL_TOOLS "Build HDF5 HL Tools" ON) + if (HDF5_BUILD_HL_TOOLS) + add_subdirectory (tools) + endif () + endif () endif () #-- Add High Level Examples diff --git a/hl/Makefile.am b/hl/Makefile.am index 9bf209e..8c427d3 100644 --- a/hl/Makefile.am +++ b/hl/Makefile.am @@ -37,16 +37,19 @@ else TEST_DIR = endif if BUILD_TOOLS_CONDITIONAL +if BUILD_TOOLS_HL_CONDITIONAL TOOLS_DIR = tools else TOOLS_DIR = endif +else + TOOLS_DIR = +endif ## Don't recurse into any subdirectories if HDF5 is not configured to ## use the HL library if BUILD_HDF5_HL_CONDITIONAL SUBDIRS=src $(TEST_DIR) $(TOOLS_DIR) $(CXX_DIR) $(FORTRAN_DIR) - endif DIST_SUBDIRS=src test tools c++ fortran examples diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 5d11957..91eb593 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -740,6 +740,7 @@ HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF HDF5_BUILD_JAVA "Build JAVA support" OFF HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON HDF5_BUILD_TOOLS "Build HDF5 Tools" ON +HDF5_BUILD_HL_TOOLS "Build HIGH Level HDF5 Tools" ON ---------------- HDF5 Advanced Options --------------------- ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 66907be..ed12c5e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,14 @@ New Features Configuration: ------------- + - Added new option to control the build of High-Level tools + that default ON/enabled. + + Add configure options (autotools - CMake): + enable-hltools HDF5_BUILD_HL_TOOLS + + (ADB - 2021/09/16, HDFFV-11266) + - Adds C++ Autotools configuration file for Intel * Checks for icpc as the compiler @@ -909,8 +917,8 @@ New Features ---------------- - added set/get for unsigned long long attributes - the attribute writing high-level API has been expanded to include - public set/get functions for ULL attributes, analogously to the + the attribute writing high-level API has been expanded to include + public set/get functions for ULL attributes, analogously to the existing set/get for other types. (AF - 2021/09/08) -- cgit v0.12 From 534435271f63660a8234a52578b3e8f306541686 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 22 Sep 2021 06:51:55 -0500 Subject: Need to match clang and versions not just "Clang" (#1029) --- config/cmake/HDFCXXCompilerFlags.cmake | 9 ++++----- config/cmake/HDFCompilerFlags.cmake | 3 +-- config/sanitizer/code-coverage.cmake | 18 ++++++------------ config/sanitizer/sanitizers.cmake | 2 +- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index a121d0a..7b10b9d 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -27,8 +27,7 @@ if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set (_INTEL_WINDOWS 1) endif () -if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" - AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") +if (WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set (_CLANG_MSVC_WINDOWS 1) endif() @@ -140,7 +139,7 @@ else () ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") endif () endif () - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "PGI") list (APPEND HDF5_CMAKE_CXX_FLAGS "-Minform=inform") @@ -161,14 +160,14 @@ if (HDF5_ENABLE_DEV_WARNINGS) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () else () if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index de5b563..210e475 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -24,8 +24,7 @@ if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel") set(_INTEL_WINDOWS 1) endif() -if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Clang" - AND "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") +if(WIN32 AND CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" AND "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(_CLANG_MSVC_WINDOWS 1) endif() diff --git a/config/sanitizer/code-coverage.cmake b/config/sanitizer/code-coverage.cmake index 8d765f7..c79aeac 100644 --- a/config/sanitizer/code-coverage.cmake +++ b/config/sanitizer/code-coverage.cmake @@ -99,8 +99,7 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED) ${CMAKE_COVERAGE_OUTPUT_DIRECTORY} DEPENDS ccov-clean) - if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") # Messages message(STATUS "Building with llvm Code Coverage Tools") @@ -206,8 +205,7 @@ function(target_code_coverage TARGET_NAME) if(CODE_COVERAGE) # Add code coverage instrumentation to the target's linker command - if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") target_compile_options(${TARGET_NAME} PRIVATE -fprofile-instr-generate -fcoverage-mapping) set_property( @@ -229,8 +227,7 @@ function(target_code_coverage TARGET_NAME) # Add shared library to processing for 'all' targets if(target_type STREQUAL "SHARED_LIBRARY" AND target_code_coverage_ALL) - if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") add_custom_target( ccov-run-${TARGET_NAME} COMMAND echo "-object=$<TARGET_FILE:${TARGET_NAME}>" >> @@ -250,8 +247,7 @@ function(target_code_coverage TARGET_NAME) # For executables add targets to run and produce output if(target_type STREQUAL "EXECUTABLE") - if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Cc]lang") # If there are shared objects to also work with, generate the string to # add them here @@ -409,8 +405,7 @@ endfunction() # any subdirectories. To add coverage instrumentation to only specific targets, # use `target_code_coverage`. function(add_code_coverage) - if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") add_compile_options(-fprofile-instr-generate -fcoverage-mapping) add_link_options(-fprofile-instr-generate -fcoverage-mapping) elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") @@ -435,8 +430,7 @@ function(add_code_coverage_all_targets) "${multi_value_keywords}" ${ARGN}) if(CODE_COVERAGE) - if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") # Merge the profile data for all of the run executables add_custom_target( diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake index 58c4050..8bf1d5b 100644 --- a/config/sanitizer/sanitizers.cmake +++ b/config/sanitizer/sanitizers.cmake @@ -30,7 +30,7 @@ endfunction() message(STATUS "USE_SANITIZER=${USE_SANITIZER}, CMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}") if(USE_SANITIZER) - if(INTEL_CLANG OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + if(INTEL_CLANG OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) if(UNIX) -- cgit v0.12 From 464000505245195f57f0c5e29a909159bee303de Mon Sep 17 00:00:00 2001 From: jhendersonHDF <jhenderson@hdfgroup.org> Date: Thu, 23 Sep 2021 07:50:00 -0500 Subject: VFD ctl feature (#981) * Added "ctl" callback to the VFD interface, and the associated H5FDctl() and H5FD_ctl() calls. Modified the MPIO VFD accordingly -- specifically: Added ctl() call with op-code support to expose rank, size, and communicator. Modified H5FD_mpi_get_rank(), H5FD_mpi_get_size(), and H5FD_mpi_get_comm() to use the new ctl() callback. In passing removed the const qualifier from the file parameter of these functions, as the file parameter of the ctl callback is not const. Deleted the old H5FD__mpio_mpi_rank(), H5FD__mpio_mpi_size(), and H5FD__mpio_communicator() calls from the MPIO VFD. Deleted H5FD_class_mpi_t from H5FDprivate.h, and modified the MPIO VFD accordingly. Note that all VFDs now use H5FD_class_t, with no special class for VFDs that that support MPI. Some minor touch ups to the Neil's selection I/O mods in passing. Tested serial and parallel, debug and production on charis and jelly. * Reserve a range of VFD "ctl" opcodes for library and experimental usage * Add "ctl" callbacks to passthrough VFDs * Add RELEASE.txt entry for "ctl" callback * Use H5FDopen with H5F_ACC_RDWR flag instead of H5F_ACC_TRUNC in vfd test * Remove handling of passthrough "ctl" flag from multi VFD * Move logic for testing H5FD_CTL__TEST_OPCODE into a testing VFD Revise description of "ctl" callback in RELEASE.txt Remove unused H5FD_CTL__NUM_OPCODES definition Fix some warnings in multi VFD Co-authored-by: mainzer <mainzer#hdfgroup.org> --- release_docs/RELEASE.txt | 25 +++ src/H5FD.c | 105 +++++++++ src/H5FDcore.c | 1 + src/H5FDdevelop.h | 2 + src/H5FDdirect.c | 1 + src/H5FDfamily.c | 1 + src/H5FDhdfs.c | 1 + src/H5FDlog.c | 1 + src/H5FDmirror.c | 1 + src/H5FDmpi.c | 90 ++++++-- src/H5FDmpio.c | 223 +++++++++---------- src/H5FDmulti.c | 51 +++++ src/H5FDprivate.h | 14 +- src/H5FDpublic.h | 71 +++++++ src/H5FDros3.c | 1 + src/H5FDsec2.c | 48 +++++ src/H5FDsplitter.c | 60 ++++++ src/H5FDstdio.c | 1 + test/h5test.c | 1 + test/vfd.c | 544 +++++++++++++++++++++++++++++++++++++++++++++-- 20 files changed, 1082 insertions(+), 160 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ed12c5e..6043145 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -471,6 +471,31 @@ New Features Library: -------- + - Adds new "ctl" callback to VFD H5FD_class_t structure + with the following prototype: + + herr_t (*ctl)(H5FD_t *file, uint64_t op_code, + uint64_t flags, const void *input, + void **output); + + This newly-added "ctl" callback allows Virtual File + Drivers to intercept and handle arbitary operations + identified by an operation code. Its parameters are + as follows: + + `file` [in] - A pointer to the file to be operated on + `op_code` [in] - The operation code identifying the + operation to be performed + `flags` [in] - Flags governing the behavior of the + operation performed (see H5FDpublic.h + for a list of valid flags) + `input` [in] - A pointer to arguments passed to the + VFD performing the operation + `output` [out] - A pointer for the receiving VFD to + use for output from the operation + + (JRM - 2021/08/16) + - Change how the release part of version, in major.minor.release is checked for compatibility diff --git a/src/H5FD.c b/src/H5FD.c index abda921..d3f72e8 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -1688,6 +1688,111 @@ done: } /* end H5FD_unlock() */ /*------------------------------------------------------------------------- + * Function: H5FDctl + * + * Purpose: Perform a CTL operation. + * + * The desired operation is specified by the op_code + * parameter. + * + * The flags parameter controls management of op_codes that + * are unknown to the callback + * + * The input and output parameters allow op_code specific + * input and output + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: JRM -- 8/3/21 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*#ULUL*x**x", file, op_code, flags, input, output); + + /* Check arguments */ + if (!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + + if (!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + + /* Don't attempt to validate the op code. If appropriate, that will + * be done by the underlying VFD callback, along with the input and + * output parameters. + */ + + /* Call private function */ + if (H5FD_ctl(file, op_code, flags, input, output) < 0) + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") + +done: + + FUNC_LEAVE_API(ret_value) + +} /* end H5FDctl() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_ctl + * + * Purpose: Private version of H5FDctl() + * + * The desired operation is specified by the op_code + * parameter. + * + * The flags parameter controls management of op_codes that + * are unknown to the callback + * + * The input and output parameters allow op_code specific + * input and output + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: JRM -- 8/3/21 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + + /* Dispatch to driver if the ctl function exists. + * + * If it doesn't, fail if the H5FD_CTL__FAIL_IF_UNKNOWN_FLAG is set. + * + * Otherwise, report success. + */ + if (file->cls->ctl) { + + if ((file->cls->ctl)(file, op_code, flags, input, output) < 0) + + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") + } + else if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) { + + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, + "VFD ctl request failed (no ctl callback and fail if unknown flag is set)") + } + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_ctl() */ + +/*------------------------------------------------------------------------- * Function: H5FD_get_fileno * * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 50288c4..820c74f 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -183,6 +183,7 @@ static const H5FD_class_t H5FD_core_g = { H5FD__core_lock, /* lock */ H5FD__core_unlock, /* unlock */ H5FD__core_delete, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDdevelop.h b/src/H5FDdevelop.h index 57f0a42..4895658 100644 --- a/src/H5FDdevelop.h +++ b/src/H5FDdevelop.h @@ -192,6 +192,7 @@ typedef struct H5FD_class_t { herr_t (*lock)(H5FD_t *file, hbool_t rw); herr_t (*unlock)(H5FD_t *file); herr_t (*del)(const char *name, hid_t fapl); + herr_t (*ctl)(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output); H5FD_mem_t fl_map[H5FD_MEM_NTYPES]; } H5FD_class_t; @@ -254,6 +255,7 @@ H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); H5_DLL herr_t H5FDunlock(H5FD_t *file); H5_DLL herr_t H5FDdelete(const char *name, hid_t fapl_id); +H5_DLL herr_t H5FDctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output); #ifdef __cplusplus } diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index a1b7b7e..7cca09f 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -172,6 +172,7 @@ static const H5FD_class_t H5FD_direct_g = { H5FD__direct_lock, /* lock */ H5FD__direct_unlock, /* unlock */ H5FD__direct_delete, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 8cf9f9e..af67c78 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -137,6 +137,7 @@ static const H5FD_class_t H5FD_family_g = { H5FD__family_lock, /* lock */ H5FD__family_unlock, /* unlock */ H5FD__family_delete, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 2c4bff6..ac48b42 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -310,6 +310,7 @@ static const H5FD_class_t H5FD_hdfs_g = { NULL, /* lock */ NULL, /* unlock */ NULL, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDlog.c b/src/H5FDlog.c index f996b9e..87871ab 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -212,6 +212,7 @@ static const H5FD_class_t H5FD_log_g = { H5FD__log_lock, /* lock */ H5FD__log_unlock, /* unlock */ H5FD__log_delete, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index 8cbeff6..d539f4d 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -192,6 +192,7 @@ static const H5FD_class_t H5FD_mirror_g = { H5FD__mirror_lock, /* lock */ H5FD__mirror_unlock, /* unlock */ NULL, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 048b8f3..7eb1463 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -41,26 +41,42 @@ * Programmer: Quincey Koziol * Friday, January 30, 2004 * + * Changes: Reworked function to use the ctl callback so we can get + * rid of H5FD_class_mpi_t. Since there are no real limits + * on what the ctl callback can do, its file parameter can't + * be constant. Thus, I had to remove the const qualifier + * on this functions file parameter as well. Note also the + * circumlocution required to use the ctl callbacks output + * parameter to pass back the rank without introducing + * compiler warnings. + * JRM -- 8/13/21 + * *------------------------------------------------------------------------- */ int -H5FD_mpi_get_rank(const H5FD_t *file) +H5FD_mpi_get_rank(H5FD_t *file) { - const H5FD_class_mpi_t *cls; - - int ret_value; + const H5FD_class_t *cls; + uint64_t flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + int rank = -1; + void * rank_ptr = (void *)(&rank); + int ret_value; FUNC_ENTER_NOAPI(FAIL) HDassert(file); - cls = (const H5FD_class_mpi_t *)(file->cls); + cls = (const H5FD_class_t *)(file->cls); HDassert(cls); - HDassert(cls->get_rank); /* All MPI drivers must implement this */ + HDassert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ - if ((ret_value = (cls->get_rank)(file)) < 0) + if ((cls->ctl)(file, H5FD_CTL__GET_MPI_RANK_OPCODE, flags, NULL, &rank_ptr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed") + HDassert(rank >= 0); + + ret_value = rank; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpi_get_rank() */ @@ -77,25 +93,43 @@ done: * Programmer: Quincey Koziol * Friday, January 30, 2004 * + * Changes: Reworked function to use the ctl callback so we can get + * rid of H5FD_class_mpi_t. Since there are no real limits + * on what the ctl callback can do, its file parameter can't + * be constant. Thus, I had to remove the const qualifier + * on this functions file parameter as well. Note also the + * circumlocution required to use the ctl callbacks output + * parameter to pass back the rank without introducing + * compiler warnings. + * JRM -- 8/13/21 + * *------------------------------------------------------------------------- */ int -H5FD_mpi_get_size(const H5FD_t *file) +H5FD_mpi_get_size(H5FD_t *file) { - const H5FD_class_mpi_t *cls; - int ret_value; + const H5FD_class_t *cls; + uint64_t flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + int size = 0; + void * size_ptr = (void *)(&size); + int ret_value; FUNC_ENTER_NOAPI(FAIL) HDassert(file); - cls = (const H5FD_class_mpi_t *)(file->cls); + cls = (const H5FD_class_t *)(file->cls); HDassert(cls); - HDassert(cls->get_size); /* All MPI drivers must implement this */ + HDassert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ - if ((ret_value = (cls->get_size)(file)) < 0) + if ((cls->ctl)(file, H5FD_CTL__GET_MPI_SIZE_OPCODE, flags, NULL, &size_ptr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed") + if (0 >= size) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request returned bad value") + + ret_value = size; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpi_get_size() */ @@ -112,25 +146,43 @@ done: * Programmer: Quincey Koziol * Friday, January 30, 2004 * + * Changes: Reworked function to use the ctl callback so we can get + * rid of H5FD_class_mpi_t. Since there are no real limits + * on what the ctl callback can do, its file parameter can't + * be constant. Thus, I had to remove the const qualifier + * on this functions file parameter as well. Note also the + * circumlocution required to use the ctl callbacks output + * parameter to pass back the rank without introducing + * compiler warnings. + * JRM -- 8/13/21 + * *------------------------------------------------------------------------- */ MPI_Comm -H5FD_mpi_get_comm(const H5FD_t *file) +H5FD_mpi_get_comm(H5FD_t *file) { - const H5FD_class_mpi_t *cls; - MPI_Comm ret_value; + const H5FD_class_t *cls; + uint64_t flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + MPI_Comm comm = MPI_COMM_NULL; + void * comm_ptr = (void *)(&comm); + MPI_Comm ret_value; FUNC_ENTER_NOAPI(MPI_COMM_NULL) HDassert(file); - cls = (const H5FD_class_mpi_t *)(file->cls); + cls = (const H5FD_class_t *)(file->cls); HDassert(cls); - HDassert(cls->get_comm); /* All MPI drivers must implement this */ + HDassert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ - if ((ret_value = (cls->get_comm)(file)) == MPI_COMM_NULL) + if ((cls->ctl)(file, H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE, flags, NULL, &comm_ptr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") + if (comm == MPI_COMM_NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed -- bad comm") + + ret_value = comm; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpi_get_comm() */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index dd40399..7c85897 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -72,66 +72,60 @@ typedef struct H5FD_mpio_t { /* Private Prototypes */ /* Callbacks */ -static herr_t H5FD__mpio_term(void); -static H5FD_t * H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD__mpio_close(H5FD_t *_file); -static herr_t H5FD__mpio_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD__mpio_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle); -static herr_t H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, - void *buf); -static herr_t H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, - const void *buf); -static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD__mpio_delete(const char *filename, hid_t fapl_id); -static int H5FD__mpio_mpi_rank(const H5FD_t *_file); -static int H5FD__mpio_mpi_size(const H5FD_t *_file); -static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file); +static herr_t H5FD__mpio_term(void); +static H5FD_t *H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static herr_t H5FD__mpio_close(H5FD_t *_file); +static herr_t H5FD__mpio_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__mpio_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle); +static herr_t H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + void *buf); +static herr_t H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + const void *buf); +static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__mpio_delete(const char *filename, hid_t fapl_id); +static herr_t H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, + void **output); /* The MPIO file driver information */ -static const H5FD_class_mpi_t H5FD_mpio_g = { - { - /* Start of superclass information */ - "mpio", /* name */ - HADDR_MAX, /* maxaddr */ - H5F_CLOSE_SEMI, /* fc_degree */ - H5FD__mpio_term, /* terminate */ - NULL, /* sb_size */ - NULL, /* sb_encode */ - NULL, /* sb_decode */ - 0, /* fapl_size */ - NULL, /* fapl_get */ - NULL, /* fapl_copy */ - NULL, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - H5FD__mpio_open, /* open */ - H5FD__mpio_close, /* close */ - NULL, /* cmp */ - H5FD__mpio_query, /* query */ - NULL, /* get_type_map */ - NULL, /* alloc */ - NULL, /* free */ - H5FD__mpio_get_eoa, /* get_eoa */ - H5FD__mpio_set_eoa, /* set_eoa */ - H5FD__mpio_get_eof, /* get_eof */ - H5FD__mpio_get_handle, /* get_handle */ - H5FD__mpio_read, /* read */ - H5FD__mpio_write, /* write */ - H5FD__mpio_flush, /* flush */ - H5FD__mpio_truncate, /* truncate */ - NULL, /* lock */ - NULL, /* unlock */ - H5FD__mpio_delete, /* del */ - H5FD_FLMAP_DICHOTOMY /* fl_map */ - }, /* End of superclass information */ - H5FD__mpio_mpi_rank, /* get_rank */ - H5FD__mpio_mpi_size, /* get_size */ - H5FD__mpio_communicator /* get_comm */ +static const H5FD_class_t H5FD_mpio_g = { + "mpio", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_SEMI, /* fc_degree */ + H5FD__mpio_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__mpio_open, /* open */ + H5FD__mpio_close, /* close */ + NULL, /* cmp */ + H5FD__mpio_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__mpio_get_eoa, /* get_eoa */ + H5FD__mpio_set_eoa, /* set_eoa */ + H5FD__mpio_get_eof, /* get_eof */ + H5FD__mpio_get_handle, /* get_handle */ + H5FD__mpio_read, /* read */ + H5FD__mpio_write, /* write */ + H5FD__mpio_flush, /* flush */ + H5FD__mpio_truncate, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD__mpio_delete, /* del */ + H5FD__mpio_ctl, /* ctl */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; #ifdef H5FDmpio_DEBUG @@ -245,7 +239,7 @@ H5FD_mpio_init(void) /* Register the MPI-IO VFD, if it isn't already */ if (H5I_VFL != H5I_get_type(H5FD_MPIO_g)) - H5FD_MPIO_g = H5FD_register((const H5FD_class_t *)&H5FD_mpio_g, sizeof(H5FD_class_mpi_t), FALSE); + H5FD_MPIO_g = H5FD_register((const H5FD_class_t *)&H5FD_mpio_g, sizeof(H5FD_class_t), FALSE); if (!H5FD_mpio_Debug_inited) { const char *s; /* String for environment variables */ @@ -1802,83 +1796,78 @@ done: } /* end H5FD__mpio_delete() */ /*------------------------------------------------------------------------- - * Function: H5FD__mpio_mpi_rank + * Function: H5FD__mpio_ctl * - * Purpose: Returns the MPI rank for a process + * Purpose: MPIO version of the ctl callback. * - * Return: Success: non-negative - * Failure: negative + * The desired operation is specified by the op_code + * parameter. * - * Programmer: Quincey Koziol - * Thursday, May 16, 2002 + * The flags parameter controls management of op_codes that + * are unknown to the callback * - *------------------------------------------------------------------------- - */ -static int -H5FD__mpio_mpi_rank(const H5FD_t *_file) -{ - const H5FD_mpio_t *file = (const H5FD_mpio_t *)_file; - - FUNC_ENTER_STATIC_NOERR - - /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); - - FUNC_LEAVE_NOAPI(file->mpi_rank) -} /* end H5FD__mpio_mpi_rank() */ - -/*------------------------------------------------------------------------- - * Function: H5FD__mpio_mpi_size + * The input and output parameters allow op_code specific + * input and output * - * Purpose: Returns the number of MPI processes + * At present, the supported op codes are: * - * Return: Success: non-negative - * Failure: negative + * H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE + * H5FD_CTL__GET_MPI_RANK_OPCODE + * H5FD_CTL__GET_MPI_SIZE_OPCODE * - * Programmer: Quincey Koziol - * Thursday, May 16, 2002 + * Note that these opcodes must be supported by all VFDs that + * support MPI. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: JRM -- 8/3/21 * *------------------------------------------------------------------------- */ -static int -H5FD__mpio_mpi_size(const H5FD_t *_file) +static herr_t +H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_ATTR_UNUSED *input, + void **output) { - const H5FD_mpio_t *file = (const H5FD_mpio_t *)_file; + H5FD_mpio_t *file = (H5FD_mpio_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); - FUNC_LEAVE_NOAPI(file->mpi_size) -} /* end H5FD__mpio_mpi_size() */ + switch (op_code) { -/*------------------------------------------------------------------------- - * Function: H5FD__mpio_communicator - * - * Purpose: Returns the MPI communicator for the file. - * - * Return: Success: The communicator - * Failure: Can't fail - * - * Programmer: Robb Matzke - * Monday, August 9, 1999 - * - *------------------------------------------------------------------------- - */ -static MPI_Comm -H5FD__mpio_communicator(const H5FD_t *_file) -{ - const H5FD_mpio_t *file = (const H5FD_mpio_t *)_file; + case H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE: + HDassert(output); + HDassert(*output); + **((MPI_Comm **)output) = file->comm; + break; - FUNC_ENTER_STATIC_NOERR + case H5FD_CTL__GET_MPI_RANK_OPCODE: + HDassert(output); + HDassert(*output); + **((int **)output) = file->mpi_rank; + break; - /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + case H5FD_CTL__GET_MPI_SIZE_OPCODE: + HDassert(output); + HDassert(*output); + **((int **)output) = file->mpi_size; + break; + + default: /* unknown op code */ + if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) { + + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown") + } + break; + } + +done: + + FUNC_LEAVE_NOAPI(ret_value) - FUNC_LEAVE_NOAPI(file->comm) -} /* end H5FD__mpio_communicator() */ +} /* end H5FD__mpio_ctl() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index cae4174..0d1967d 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -166,6 +166,8 @@ static herr_t H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing static herr_t H5FD_multi_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_multi_unlock(H5FD_t *_file); static herr_t H5FD_multi_delete(const char *filename, hid_t fapl_id); +static herr_t H5FD_multi_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, + void **output); /* The class struct */ static const H5FD_class_t H5FD_multi_g = { @@ -201,6 +203,7 @@ static const H5FD_class_t H5FD_multi_g = { H5FD_multi_lock, /* lock */ H5FD_multi_unlock, /* unlock */ H5FD_multi_delete, /* del */ + H5FD_multi_ctl, /* ctl */ H5FD_FLMAP_DEFAULT /* fl_map */ }; @@ -2070,6 +2073,54 @@ H5FD_multi_delete(const char *filename, hid_t fapl_id) } /* end H5FD_multi_delete() */ H5_MULTI_GCC_DIAG_ON("format-nonliteral") +/*------------------------------------------------------------------------- + * Function: H5FD_multi_ctl + * + * Purpose: Multi VFD version of the ctl callback. + * + * The desired operation is specified by the op_code + * parameter. + * + * The flags parameter controls management of op_codes that + * are unknown to the callback + * + * The input and output parameters allow op_code specific + * input and output + * + * At present, this VFD supports no op codes of its own. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_multi_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, void **output) +{ + H5FD_multi_t * file = (H5FD_multi_t *)_file; + static const char *func = "H5FD_multi_ctl"; /* Function Name for error reporting */ + herr_t ret_value = 0; + + /* Silence compiler */ + (void)file; + (void)input; + (void)output; + + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + switch (op_code) { + /* Unknown op code */ + default: + if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_FCNTL, + "VFD ctl request failed (unknown op code and fail if unknown flag is set)", -1); + + break; + } + + return ret_value; +} /* end H5FD_multi_ctl() */ + #ifdef H5private_H /* * This is not related to the functionality of the driver code. diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index c00c123..6dbd483 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -45,13 +45,6 @@ /* Definitions for file MPI type property */ #define H5FD_MPI_XFER_FILE_MPI_TYPE_NAME "H5FD_mpi_file_mpi_type" -/* Sub-class the H5FD_class_t to add more specific functions for MPI-based VFDs */ -typedef struct H5FD_class_mpi_t { - H5FD_class_t super; /* Superclass information & methods */ - int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */ - int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */ - MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */ -} H5FD_class_mpi_t; #endif /****************************/ @@ -137,6 +130,7 @@ H5_DLL herr_t H5FD_truncate(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw); H5_DLL herr_t H5FD_unlock(H5FD_t *file); H5_DLL herr_t H5FD_delete(const char *name, hid_t fapl_id); +H5_DLL herr_t H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output); H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle); H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr); @@ -156,9 +150,9 @@ H5_DLL herr_t H5FD_set_mpio_atomicity(H5FD_t *file, hbool_t flag); H5_DLL herr_t H5FD_get_mpio_atomicity(H5FD_t *file, hbool_t *flag); /* Driver specific methods */ -H5_DLL int H5FD_mpi_get_rank(const H5FD_t *file); -H5_DLL int H5FD_mpi_get_size(const H5FD_t *file); -H5_DLL MPI_Comm H5FD_mpi_get_comm(const H5FD_t *_file); +H5_DLL int H5FD_mpi_get_rank(H5FD_t *file); +H5_DLL int H5FD_mpi_get_size(H5FD_t *file); +H5_DLL MPI_Comm H5FD_mpi_get_comm(H5FD_t *file); #endif /* H5_HAVE_PARALLEL */ #endif /* H5FDprivate_H */ diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 0cfb072..b8f4f12 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -138,6 +138,77 @@ */ #define H5FD_FEAT_DEFAULT_VFD_COMPATIBLE 0x00008000 +/* ctl function definitions: */ +#define H5FD_CTL_OPC_RESERVED 512 /* Opcodes below this value are reserved for library use */ +#define H5FD_CTL_OPC_EXPER_MIN \ + H5FD_CTL_OPC_RESERVED /* Minimum opcode value available for experimental use \ + */ +#define H5FD_CTL_OPC_EXPER_MAX \ + (H5FD_CTL_OPC_RESERVED + 511) /* Maximum opcode value available for experimental use */ + +/* ctl function op codes: */ +#define H5FD_CTL__INVALID_OPCODE 0 +#define H5FD_CTL__TEST_OPCODE 1 +#define H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE 2 +#define H5FD_CTL__GET_MPI_RANK_OPCODE 3 +#define H5FD_CTL__GET_MPI_SIZE_OPCODE 4 + +/* ctl function flags: */ + +/* Definitions: + * + * WARNING: While the following definitions of Terminal + * and Passthrough VFDs should be workable for now, they + * have to be adjusted as our use cases for VFDs expand. + * + * JRM -- 8/4/21 + * + * + * Terminal VFD: Lowest VFD in the VFD stack through + * which all VFD calls pass. Note that this definition + * is situational. For example, the sec2 VFD is typically + * terminal. However, in the context of the family file + * driver, it is not -- the family file driver is the + * bottom VFD through which all VFD calls pass, and thus + * it is terminal. + * + * Similarly, on the splitter VFD, a sec2 VFD on the + * R/W channel is terminal, but a sec2 VFD on the W/O + * channel is not. + * + * + * Pass through VFD: Any VFD that relays all VFD calls + * (with the possible exception of some non-I/O related + * calls) to underlying VFD(s). + */ + +/* Unknown op codes should be ignored silently unless the + * H5FD_CTL__FAIL_IF_UNKNOWN_FLAG is set. + * + * On terminal VFDs, unknown op codes should generate an + * error unconditionally if this flag is set. + * + * On pass through VFDs, unknown op codes should be routed + * to the underlying VFD(s) as indicated by any routing + * flags. In the absence of such flags, the VFD should + * generate an error. + */ +#define H5FD_CTL__FAIL_IF_UNKNOWN_FLAG 0x0001 + +/* The H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG is used only + * by non-ternminal VFDs, and only applies to unknown + * opcodes. (known op codes should be handled as + * appropriate.) + * + * If this flag is set for an uknown op code, that + * op code should be passed to the next VFD down + * the VFD stack en-route to the terminal VFD. + * If that VFD does not support the ctl call, the + * pass through VFD should fail or succeed as directed + * by the H5FD_CTL__FAIL_IF_UNKNOWN_FLAG. + */ +#define H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG 0x0002 + /*******************/ /* Public Typedefs */ /*******************/ diff --git a/src/H5FDros3.c b/src/H5FDros3.c index c0361f9..a32d65e 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -269,6 +269,7 @@ static const H5FD_class_t H5FD_ros3_g = { NULL, /* lock */ NULL, /* unlock */ NULL, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index d823e3c..15103da 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -139,6 +139,8 @@ static herr_t H5FD__sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing static herr_t H5FD__sec2_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__sec2_unlock(H5FD_t *_file); static herr_t H5FD__sec2_delete(const char *filename, hid_t fapl_id); +static herr_t H5FD__sec2_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, + void **output); static const H5FD_class_t H5FD_sec2_g = { "sec2", /* name */ @@ -173,6 +175,7 @@ static const H5FD_class_t H5FD_sec2_g = { H5FD__sec2_lock, /* lock */ H5FD__sec2_unlock, /* unlock */ H5FD__sec2_delete, /* del */ + H5FD__sec2_ctl, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1068,3 +1071,48 @@ H5FD__sec2_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__sec2_delete() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__sec2_ctl + * + * Purpose: Sec2 VFD version of the ctl callback. + * + * The desired operation is specified by the op_code + * parameter. + * + * The flags parameter controls management of op_codes that + * are unknown to the callback + * + * The input and output parameters allow op_code specific + * input and output + * + * At present, no op codes are supported by this VFD. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__sec2_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_ATTR_UNUSED *input, + void H5_ATTR_UNUSED **output) +{ + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(file); + HDassert(H5FD_SEC2 == file->pub.driver_id); + + switch (op_code) { + /* Unknown op code */ + default: + if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set") + break; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__sec2_ctl() */ diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 73c898a..3113e8b 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -129,6 +129,8 @@ static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closin static herr_t H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__splitter_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__splitter_unlock(H5FD_t *_file); +static herr_t H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, + void **output); static const H5FD_class_t H5FD_splitter_g = { "splitter", /* name */ @@ -163,6 +165,7 @@ static const H5FD_class_t H5FD_splitter_g = { H5FD__splitter_lock, /* lock */ H5FD__splitter_unlock, /* unlock */ NULL, /* del */ + H5FD__splitter_ctl, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1145,6 +1148,63 @@ done: } /* end H5FD__splitter_unlock */ /*------------------------------------------------------------------------- + * Function: H5FD__splitter_ctl + * + * Purpose: Splitter VFD version of the ctl callback. + * + * The desired operation is specified by the op_code + * parameter. + * + * The flags parameter controls management of op_codes that + * are unknown to the callback + * + * The input and output parameters allow op_code specific + * input and output + * + * At present, this VFD supports no op codes of its own and + * simply passes ctl calls on to the R/W channel VFD. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, void **output) +{ + H5FD_splitter_t *file = (H5FD_splitter_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(file); + HDassert(H5FD_SPLITTER == file->pub.driver_id); + + switch (op_code) { + /* Unknown op code */ + default: + if (flags & H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG) { + /* Pass ctl call down to R/W channel VFD */ + if (H5FDctl(file->rw_file, op_code, flags, input, output) < 0) + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") + } + else { + /* If no valid VFD routing flag is specified, fail for unknown op code + * if H5FD_CTL__FAIL_IF_UNKNOWN_FLAG flag is set. + */ + if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, + "VFD ctl request failed (unknown op code and fail if unknown flag is set)") + } + + break; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__splitter_ctl() */ + +/*------------------------------------------------------------------------- * Function: H5FD__splitter_query * * Purpose: Set the flags that this VFL driver is capable of supporting. diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 6631325..312263c 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -215,6 +215,7 @@ static const H5FD_class_t H5FD_stdio_g = { H5FD_stdio_lock, /* lock */ H5FD_stdio_unlock, /* unlock */ H5FD_stdio_delete, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/test/h5test.c b/test/h5test.c index 09fb5b5..ba0662a 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1925,6 +1925,7 @@ static const H5FD_class_t H5FD_dummy_g = { NULL, /* lock */ NULL, /* unlock */ NULL, /* del */ + NULL, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; diff --git a/test/vfd.c b/test/vfd.c index f4cb988..4e9b9ee 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -48,20 +48,22 @@ #define DSET2_DIM 4 #endif /* H5_HAVE_DIRECT */ -const char *FILENAME[] = {"sec2_file", /*0*/ - "core_file", /*1*/ - "family_file", /*2*/ - "new_family_v16_", /*3*/ - "multi_file", /*4*/ - "direct_file", /*5*/ - "log_file", /*6*/ - "stdio_file", /*7*/ - "windows_file", /*8*/ - "new_multi_file_v16", /*9*/ - "ro_s3_file", /*10*/ - "splitter_rw_file", /*11*/ - "splitter_wo_file", /*12*/ - "splitter.log", /*13*/ +const char *FILENAME[] = {"sec2_file", /*0*/ + "core_file", /*1*/ + "family_file", /*2*/ + "new_family_v16_", /*3*/ + "multi_file", /*4*/ + "direct_file", /*5*/ + "log_file", /*6*/ + "stdio_file", /*7*/ + "windows_file", /*8*/ + "new_multi_file_v16", /*9*/ + "ro_s3_file", /*10*/ + "splitter_rw_file", /*11*/ + "splitter_wo_file", /*12*/ + "splitter.log", /*13*/ + "ctl_file", /*14*/ + "ctl_splitter_wo_file", /*15*/ NULL}; #define LOG_FILENAME "log_vfd_out.log" @@ -94,6 +96,13 @@ struct splitter_dataset_def { int n_dims; /* rank */ }; +/* Op code type enum for ctl callback test */ +typedef enum { + CTL_OPC_KNOWN_PASSTHROUGH, /* op code known to passthrough VFD */ + CTL_OPC_KNOWN_TERMINAL, /* op code known to terminal VFD */ + CTL_OPC_UNKNOWN /* unknown op code */ +} ctl_test_opc_type; + static int splitter_prepare_file_paths(H5FD_splitter_vfd_config_t *vfd_config, char *filename_rw_out); static int splitter_create_single_file_at(const char *filename, hid_t fapl_id, const struct splitter_dataset_def *data); @@ -104,6 +113,19 @@ static int splitter_RO_test(const struct splitter_dataset_def *data, hid_t child static int splitter_tentative_open_test(hid_t child_fapl_id); static int file_exists(const char *filename, hid_t fapl_id); +static herr_t run_ctl_test(uint64_t op_code, uint64_t flags, ctl_test_opc_type opc_type, hid_t fapl_id); +static H5FD_t *H5FD__ctl_test_vfd_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static herr_t H5FD__ctl_test_vfd_close(H5FD_t *_file); +static haddr_t H5FD__ctl_test_vfd_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__ctl_test_vfd_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__ctl_test_vfd_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__ctl_test_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, + size_t size, void *buf); +static herr_t H5FD__ctl_test_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, + size_t size, const void *buf); +static herr_t H5FD__ctl_test_vfd_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, + void **output); + /*------------------------------------------------------------------------- * Function: test_sec2 * @@ -3398,6 +3420,499 @@ error: #undef SPLITTER_TEST_FAULT +/* + * Callback implementations for ctl feature testing VFD + */ +static H5FD_t * +H5FD__ctl_test_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, + hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) +{ + return HDcalloc(1, sizeof(H5FD_t)); +} +static herr_t +H5FD__ctl_test_vfd_close(H5FD_t H5_ATTR_UNUSED *_file) +{ + HDfree(_file); + return SUCCEED; +} +static haddr_t +H5FD__ctl_test_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) +{ + return HADDR_UNDEF; +} +static herr_t +H5FD__ctl_test_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + haddr_t H5_ATTR_UNUSED addr) +{ + return FAIL; +} +static haddr_t +H5FD__ctl_test_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) +{ + return HADDR_UNDEF; +} +static herr_t +H5FD__ctl_test_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, + void H5_ATTR_UNUSED *buf) +{ + return FAIL; +} +static herr_t +H5FD__ctl_test_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) +{ + return FAIL; +} +static herr_t +H5FD__ctl_test_vfd_ctl(H5FD_t H5_ATTR_UNUSED *_file, uint64_t op_code, uint64_t flags, + const void H5_ATTR_UNUSED *input, void H5_ATTR_UNUSED **output) +{ + herr_t ret_value = SUCCEED; + + switch (op_code) { + /* Op code for testing purposes */ + case H5FD_CTL__TEST_OPCODE: + break; + + /* Unknown op code */ + default: + if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + ret_value = FAIL; + break; + } + + return ret_value; +} + +/* Minimal VFD for ctl feature tests */ +static const H5FD_class_t H5FD_ctl_test_vfd_g = { + "ctl_test_vfd", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_SEMI, /* fc_degree */ + NULL, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__ctl_test_vfd_open, /* open */ + H5FD__ctl_test_vfd_close, /* close */ + NULL, /* cmp */ + NULL, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__ctl_test_vfd_get_eoa, /* get_eoa */ + H5FD__ctl_test_vfd_set_eoa, /* set_eoa */ + H5FD__ctl_test_vfd_get_eof, /* get_eof */ + NULL, /* get_handle */ + H5FD__ctl_test_vfd_read, /* read */ + H5FD__ctl_test_vfd_write, /* write */ + NULL, /* flush */ + NULL, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + NULL, /* del */ + H5FD__ctl_test_vfd_ctl, /* ctl */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + +/*------------------------------------------------------------------------- + * Function: run_ctl_test + * + * Purpose: Helper method for VFD "ctl" callback test + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +run_ctl_test(uint64_t op_code, uint64_t flags, ctl_test_opc_type opc_type, hid_t fapl_id) +{ + hbool_t fail_if_unknown = FALSE; + hbool_t routing_flag_set = FALSE; + hbool_t is_passthrough_vfd = FALSE; + hbool_t expect_fail = FALSE; + H5FD_t *file_drv_ptr = NULL; + herr_t ctl_result = SUCCEED; + hid_t driver_id = H5I_INVALID_HID; + char filename[1024]; + + /* Check for a few ctl function flags */ + fail_if_unknown = (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG); + routing_flag_set = (flags & H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG); + + /* Determine if the top-level VFD is a passthrough VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + PUTS_ERROR("couldn't get VFD ID from FAPL"); + + is_passthrough_vfd = ((driver_id == H5FD_SPLITTER) || (driver_id == H5FD_MULTI)); + + /* + * "Open" testing file. Note that our VFD for testing the ctl + * feature doesn't actually create or open files, so we don't + * need to create the testing file; we just need the VFD to + * give us a pointer to a H5FD_t structure. + */ + h5_fixname(FILENAME[14], fapl_id, filename, sizeof(filename)); + if (NULL == (file_drv_ptr = H5FDopen(filename, H5F_ACC_RDWR, fapl_id, HADDR_UNDEF))) + PUTS_ERROR("couldn't get pointer to H5FD_t structure"); + + /* Determine whether the H5FDctl call is expected to fail */ + expect_fail = fail_if_unknown && (CTL_OPC_UNKNOWN == opc_type); + if (is_passthrough_vfd) { + /* Should fail if op code is unknown to passthrough VFD + * (but known to terminal VFD), no routing flag is specified + * and the "fail if unknown" flag is specified. + */ + expect_fail = + expect_fail || ((CTL_OPC_KNOWN_TERMINAL == opc_type) && !routing_flag_set && fail_if_unknown); + } + + /* Issue opcode to VFD */ + if (expect_fail) { + H5E_BEGIN_TRY + { + ctl_result = H5FDctl(file_drv_ptr, op_code, flags, NULL, NULL); + } + H5E_END_TRY; + } + else + ctl_result = H5FDctl(file_drv_ptr, op_code, flags, NULL, NULL); + + /* Verify result of H5FDctl call */ + if (expect_fail) { + if (ctl_result == SUCCEED) + PUTS_ERROR("H5FDctl call succeeded when it should have failed"); + } + else { + if (ctl_result != SUCCEED) + PUTS_ERROR("H5FDctl call failed when it should have succeeded"); + } + + /* Close H5FD_t structure pointer */ + if (H5FDclose(file_drv_ptr) < 0) + PUTS_ERROR("couldn't close H5FD_t structure pointer"); + file_drv_ptr = NULL; + + return 0; + +error: + H5E_BEGIN_TRY + { + H5FDclose(file_drv_ptr); + } + H5E_END_TRY; + + return -1; +} + +/*------------------------------------------------------------------------- + * Function: test_ctl + * + * Purpose: Tests the VFD "ctl" callback + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +test_ctl(void) +{ + H5FD_splitter_vfd_config_t *splitter_config = NULL; + uint64_t op_code; + uint64_t flags; + hid_t driver_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t sub_fapl_id = H5I_INVALID_HID; + + TESTING("VFD ctl callback"); + HDputs(""); + + /* Register VFD for test */ + if ((driver_id = H5FDregister(&H5FD_ctl_test_vfd_g)) < 0) + PUTS_ERROR("couldn't register VFD for testing"); + + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + PUTS_ERROR("couldn't create FAPL"); + if (H5Pset_driver(fapl_id, driver_id, NULL) < 0) + PUTS_ERROR("couldn't set testing VFD on FAPL"); + + TESTING_2("known op code to terminal VFD (without fail on unknown flag)") + + op_code = H5FD_CTL__TEST_OPCODE; + flags = 0; + + /* H5FDctl call should succeed normally */ + if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("known op code to terminal VFD (with fail on unknown flag)") + + op_code = H5FD_CTL__TEST_OPCODE; + flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + + /* H5FDctl call should succeed normally */ + if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("known op code to terminal VFD (without fail on unknown flag/route to terminal VFD)") + + op_code = H5FD_CTL__TEST_OPCODE; + flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + + /* H5FDctl call should succeed normally */ + if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("known op code to terminal VFD (with fail on unknown flag/route to terminal VFD)") + + op_code = H5FD_CTL__TEST_OPCODE; + flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + + /* H5FDctl call should succeed normally */ + if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("unknown op code to terminal VFD (without fail on unknown flag)") + + op_code = H5FD_CTL_OPC_RESERVED; + flags = 0; + + /* H5FDctl call should silently ignore unknown op code and succeed */ + if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("unknown op code to terminal VFD (with fail on unknown flag)") + + op_code = H5FD_CTL_OPC_RESERVED; + flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + + /* H5FDctl call should fail due to 'fail if unknown' flag being specified */ + if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("unknown op code to terminal VFD (without fail on unknown flag/route to terminal VFD)") + + op_code = H5FD_CTL_OPC_RESERVED; + flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + + /* H5FDctl call should silently ignore unknown op code and succeed */ + if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("unknown op code to terminal VFD (with fail on unknown flag/route to terminal VFD)") + + op_code = H5FD_CTL_OPC_RESERVED; + flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + + /* H5FDctl call should fail due to 'fail if unknown' flag being specified */ + if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + /* Set up splitter VFD config */ + if (NULL == (splitter_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + TEST_ERROR; + + splitter_config->magic = H5FD_SPLITTER_MAGIC; + splitter_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + splitter_config->ignore_wo_errs = TRUE; + splitter_config->rw_fapl_id = H5P_DEFAULT; + splitter_config->wo_fapl_id = H5P_DEFAULT; + h5_fixname(FILENAME[15], splitter_config->wo_fapl_id, splitter_config->wo_path, H5FD_SPLITTER_PATH_MAX); + + if ((sub_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + PUTS_ERROR("couldn't create FAPL"); + if (H5Pset_driver(sub_fapl_id, driver_id, NULL) < 0) + PUTS_ERROR("couldn't set testing VFD on FAPL"); + splitter_config->rw_fapl_id = sub_fapl_id; + + if (H5Pset_fapl_splitter(fapl_id, splitter_config) < 0) + PUTS_ERROR("couldn't set splitter VFD on FAPL"); + + TESTING_2("known op code through passthrough VFD to terminal VFD (without fail on unknown flag/no " + "routing flag)") + + op_code = H5FD_CTL__TEST_OPCODE; + flags = 0; + + /* + * H5FDctl call should silently ignore unknown op code in + * passthrough VFD since no routing flag is specified and + * 'fail if unknown' flag is not specified. + */ + if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2( + "known op code through passthrough VFD to terminal VFD (with fail on unknown flag/no routing flag)") + + op_code = H5FD_CTL__TEST_OPCODE; + flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + + /* + * H5FDctl call should fail since op code is unknown to + * passthrough VFD (though known to terminal VFD), no + * routing flag is specified and the 'fail if unknown' + * flag is specified. + */ + if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("known op code through passthrough VFD to terminal VFD (without fail on unknown flag/route to " + "terminal VFD)") + + op_code = H5FD_CTL__TEST_OPCODE; + flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + + /* + * H5Dctl call should succeed since the passthrough VFD + * doesn't recognize the op code, but has been instructed + * to route it down to the terminal VFD. + */ + if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("known op code through passthrough VFD to terminal VFD (with fail on unknown flag/route to " + "terminal VFD)") + + op_code = H5FD_CTL__TEST_OPCODE; + flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + + /* + * H5Dctl call should succeed since the passthrough VFD + * doesn't recognize the op code, but has been instructed + * to route it down to the terminal VFD. + */ + if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("unknown op code to passthrough VFD (without fail on unknown flag)") + + op_code = H5FD_CTL_OPC_RESERVED; + flags = 0; + + /* + * H5FDctl call should silently ignore unknown op code in + * passthrough VFD since no routing flag is specified and + * 'fail if unknown' flag is not specified. + */ + if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("unknown op code to passthrough VFD (with fail on unknown flag)") + + op_code = H5FD_CTL_OPC_RESERVED; + flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + + /* + * H5FDctl call should fail since op code is unknown to + * passthrough VFD, no routing flag is specified and the + * 'fail if unknown' flag is specified. + */ + if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("unknown op code to passthrough VFD (without fail on unknown flag/route to terminal VFD)") + + op_code = H5FD_CTL_OPC_RESERVED; + flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + + /* + * H5Dctl call should succeed since the passthrough VFD + * doesn't recognize the op code, but has been instructed + * to route it down to the terminal VFD and the 'fail if + * unknown' flag has not been specified. Therefore, the + * terminal VFD should silently ignore the unknown op + * code. + */ + if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("unknown op code to passthrough VFD (with fail on unknown flag/route to terminal VFD)") + + op_code = H5FD_CTL_OPC_RESERVED; + flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + + /* + * H5Dctl call should fail since the passthrough VFD + * doesn't recognize the op code, but has been instructed + * to route it down to the terminal VFD and the 'fail if + * unknown' flag has been specified. Therefore, the + * terminal VFD will throw an error for the unknown op + * code. + */ + if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + TESTING_2("test cleanup") + + HDfree(splitter_config); + + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + if (H5Pclose(sub_fapl_id) < 0) + TEST_ERROR; + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + if (splitter_config) + HDfree(splitter_config); + H5FDunregister(driver_id); + H5Pclose(sub_fapl_id); + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return -1; +} + /*------------------------------------------------------------------------- * Function: main * @@ -3429,6 +3944,7 @@ main(void) nerrors += test_windows() < 0 ? 1 : 0; nerrors += test_ros3() < 0 ? 1 : 0; nerrors += test_splitter() < 0 ? 1 : 0; + nerrors += test_ctl() < 0 ? 1 : 0; if (nerrors) { HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); -- cgit v0.12 From cc7c0eb910306b3e823867e8b9bb58204f0e1422 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 24 Sep 2021 08:06:35 -0500 Subject: MS clang needs EHsc flag (#1035) --- config/cmake/HDFCXXCompilerFlags.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index 7b10b9d..e76150f 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -32,9 +32,9 @@ if (WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang" AND "x${CMAKE_CXX_SIMULAT endif() # MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it. -if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_LOADED) +if ((_CLANG_MSVC_WINDOWS OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28) + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105") endif () endif () -- cgit v0.12 From 57cd77c478e5828bb89708d0efe109629f88ac3e Mon Sep 17 00:00:00 2001 From: Neil Fortner <nfortne2@hdfgroup.org> Date: Fri, 24 Sep 2021 12:24:20 -0500 Subject: Implement parallel collective support for selection I/O. --- src/H5Dchunk.c | 10 +++--- src/H5Dcontig.c | 8 ++--- src/H5Dio.c | 22 +++++++------ src/H5FDint.c | 2 -- src/H5FDmpio.c | 89 ++++++++++++++++++++++++++++++++++++++++++-------- testpar/t_coll_chunk.c | 5 ++- testpar/t_dset.c | 46 ++++++++++++++------------ 7 files changed, 126 insertions(+), 56 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index dcc3baa..f11e717 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2650,8 +2650,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_ /* Issue selection I/O call (we can skip the page buffer because we've * already verified it won't be used, and the metadata accumulator * because this is raw data) */ - if (num_chunks > 0 && - H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks, + if (H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks, (const H5S_t * const *)chunk_mem_spaces, (const H5S_t * const *)chunk_file_spaces, chunk_addrs, element_sizes, bufs) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunk selection read failed") @@ -2985,10 +2984,9 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize /* Issue selection I/O call (we can skip the page buffer because we've * already verified it won't be used, and the metadata accumulator * because this is raw data) */ - if (num_chunks > 0 && H5F_shared_select_write( - H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks, - (const H5S_t * const *)chunk_mem_spaces, (const H5S_t * const *)chunk_file_spaces, - chunk_addrs, element_sizes, bufs) < 0) + if (H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks, + (const H5S_t * const *)chunk_mem_spaces, (const H5S_t * const *)chunk_file_spaces, + chunk_addrs, element_sizes, bufs) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunk selection read failed") /* Clean up memory */ diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index d2a84da..cf6f543 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -658,7 +658,7 @@ H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize /* Issue selection I/O call (we can skip the page buffer because we've * already verified it won't be used, and the metadata accumulator * because this is raw data) Only call funciton if nelmts > 0. */ - if (nelmts > 0 && H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, 1, + if (H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, nelmts > 0 ? 1 : 0, &mem_space, &file_space, &(io_info->store->contig.dset_addr), &dst_type_size, &(io_info->u.rbuf)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous selection read failed") @@ -705,9 +705,9 @@ H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz /* Issue selection I/O call (we can skip the page buffer because we've * already verified it won't be used, and the metadata accumulator * because this is raw data). Only call funciton if nelmts > 0. */ - if (nelmts > 0 && H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, 1, - &mem_space, &file_space, &(io_info->store->contig.dset_addr), - &dst_type_size, &(io_info->u.wbuf)) < 0) + if (H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, nelmts > 0 ? 1 : 0, + &mem_space, &file_space, &(io_info->store->contig.dset_addr), + &dst_type_size, &(io_info->u.wbuf)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous selection write failed") } /* end if */ else diff --git a/src/H5Dio.c b/src/H5Dio.c index cc5f5bb..191ee5c 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -845,11 +845,8 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ H5CX_set_mpio_actual_io_mode(H5D_MPIO_NO_COLLECTIVE); } /* end if */ - /* Make any parallel I/O adjustments. Do not use collective code path if - * we're using selection I/O - in this case the file driver will handle it. - */ - /* Check for selection/vector support in file driver? -NAF */ - if (io_info->using_mpi_vfd /*&& !H5_use_selection_io_g*/) { + /* Make any parallel I/O adjustments */ + if (io_info->using_mpi_vfd) { H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request */ htri_t opt; /* Flag whether a selection is optimizable */ @@ -867,11 +864,16 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ /* Check if we can use the optimized parallel I/O routines */ if (opt == TRUE) { - /* Override the I/O op pointers to the MPI-specific routines */ - io_info->io_ops.multi_read = dset->shared->layout.ops->par_read; - io_info->io_ops.multi_write = dset->shared->layout.ops->par_write; - io_info->io_ops.single_read = H5D__mpio_select_read; - io_info->io_ops.single_write = H5D__mpio_select_write; + /* Override the I/O op pointers to the MPI-specific routines, unless + * selection I/O is to be used - in this case the file driver will + * handle collective I/O */ + /* Check for selection/vector support in file driver? -NAF */ + if(!io_info->use_select_io) { + io_info->io_ops.multi_read = dset->shared->layout.ops->par_read; + io_info->io_ops.multi_write = dset->shared->layout.ops->par_write; + io_info->io_ops.single_read = H5D__mpio_select_read; + io_info->io_ops.single_write = H5D__mpio_select_write; + } /* end if */ } /* end if */ else { /* Check if there are any filters in the pipeline. If there are, diff --git a/src/H5FDint.c b/src/H5FDint.c index f558b59..69dbdc4 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -751,7 +751,6 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin /* Sanity checks */ HDassert(file); HDassert(file->cls); - HDassert(count > 0); HDassert(vec_arr_nalloc == sizeof(sizes_static) / sizeof(sizes_static[0])); HDassert(vec_arr_nalloc == sizeof(vec_bufs_static) / sizeof(vec_bufs_static[0])); HDassert(mem_spaces); @@ -1370,7 +1369,6 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui /* Sanity checks */ HDassert(file); HDassert(file->cls); - HDassert(count > 0); HDassert(vec_arr_nalloc == sizeof(sizes_static) / sizeof(sizes_static[0])); HDassert(vec_arr_nalloc == sizeof(vec_bufs_static) / sizeof(vec_bufs_static[0])); HDassert(mem_spaces); diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 9a99b45..6a6dd2b 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1573,6 +1573,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou H5FD_mem_t * s_types = NULL; haddr_t * s_addrs = NULL; size_t * s_sizes = NULL; + size_t s_size; void ** s_bufs = NULL; int * mpi_block_lengths = NULL; char unused = 0; /* Unused, except for non-NULL pointer value */ @@ -1603,6 +1604,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou int io_size; /* Actual number of bytes requested */ int n; #endif + hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -1639,7 +1641,23 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou if (xfer_mode == H5FD_MPIO_COLLECTIVE) { - if (count > 0) { /* create MPI derived types describing the vector write */ + if (count == 1) { + /* Single block. Just use a series of MPI_BYTEs for the file view. + */ + size_i = (int)sizes[0]; + buf_type = MPI_BYTE; + file_type = MPI_BYTE; + mpi_bufs_base = bufs[0]; + + /* Setup s_sizes (needed for incomplete read filling code) */ + vector_was_sorted = TRUE; + s_sizes = sizes; + + /* some numeric conversions */ + if (H5FD_mpi_haddr_to_MPIOff(addrs[0], &mpi_off) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI offset") + } + else if (count > 0) { /* create MPI derived types describing the vector write */ /* sort the vector I/O request into increasing address order if required * @@ -1750,6 +1768,10 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit for file_type failed", mpi_code) + + /* some numeric conversions */ + if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0") } else { @@ -1763,14 +1785,14 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* MPI count to read */ size_i = 0; + + /* some numeric conversions */ + if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0") } /* Portably initialize MPI status variable */ - HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); - - /* some numeric conversions */ - if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0") + HDmemset(&mpi_stat, 0, sizeof(mpi_stat)); #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'r']) @@ -1782,6 +1804,10 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) + /* Reset mpi_off to 0 since the view now starts at the data offset */ + if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0") + /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) @@ -1793,15 +1819,30 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou if (H5FD_mpio_Debug[(int)'r']) HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC); #endif - if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'r']) HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); #endif + /* Check whether we should read from rank 0 and broadcast to other ranks */ + if (H5CX_get_mpio_rank0_bcast()) { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC); +#endif + /* Indicate path we've taken */ + rank0_bcast = TRUE; - if (MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, mpi_bufs_base, size_i, - buf_type, &mpi_stat))) + /* Read on rank 0 Bcast to other ranks */ + if (file->mpi_rank == 0) + if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, mpi_bufs_base, size_i, + buf_type, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code) + if (MPI_SUCCESS != (mpi_code = MPI_Bcast(mpi_bufs_base, size_i, buf_type, 0, file->comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code) + } /* end if */ + else if (MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, mpi_bufs_base, size_i, + buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code) } /* end if */ else if (size_i > 0) { @@ -1822,13 +1863,32 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) - /* How many bytes were actually read? */ + /* Only retrieve bytes read if this rank _actually_ participated in I/O */ + if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) { + /* How many bytes were actually read? */ #if MPI_VERSION >= 3 - if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read))) + if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read))) #else - if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read))) + if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read))) #endif - HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code) + } /* end if */ + + /* If the rank0-bcast feature was used, broadcast the # of bytes read to + * other ranks, which didn't perform any I/O. + */ + /* NOTE: This could be optimized further to be combined with the broadcast + * of the data. (QAK - 2019/1/2) + * Or have rank 0 clear the unread parts of the buffer prior to + * the bcast. (NAF - 2021/9/15) + */ + if (rank0_bcast) +#if MPI_VERSION >= 3 + if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_COUNT, 0, file->comm)) +#else + if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_INT, 0, file->comm)) +#endif + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0) /* Get the type's size */ #if MPI_VERSION >= 3 @@ -1915,6 +1975,9 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* Check if we acutally need to do I/O */ if (addrs[i] < max_addr) { + /* Portably initialize MPI status variable */ + HDmemset(&mpi_stat, 0, sizeof(mpi_stat)); + /* Issue read */ if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, bufs[i], size_i, MPI_BYTE, &mpi_stat))) diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 651a392..29341d7 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -832,7 +832,10 @@ coll_chunktest(const char *filename, int chunk_factor, int select_factor, int ap VRFY((status >= 0), "dataset write succeeded"); #ifdef H5_HAVE_INSTRUMENTED_LIBRARY - if (facc_type == FACC_MPIO) { + /* Only check chunk optimization mode if selection I/O is not being used - + * selection I/O bypasses this IO mode decision - it's effectively always + * multi chunk currently */ + if (facc_type == FACC_MPIO && !H5_use_selection_io_g) { switch (api_option) { case API_LINK_HARD: status = H5Pget(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, &prop_value); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 3e4a304..d65a2a9 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -3348,32 +3348,38 @@ actual_io_mode_tests(void) MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_size(MPI_COMM_WORLD, &mpi_rank); - test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); + /* Only run these tests if selection I/O is not being used - selection I/O + * bypasses this IO mode decision - it's effectively always multi chunk + * currently */ + if (!H5_use_selection_io_g) { + test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); + + /* + * Test multi-chunk-io via proc_num threshold + */ + test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); + test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_COL); - /* - * Test multi-chunk-io via proc_num threshold - */ - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_COL); + /* The Multi Chunk Mixed test requires atleast three processes. */ + if (mpi_size > 2) + test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX); + else + HDfprintf(stdout, "Multi Chunk Mixed test requires 3 proceses minimum\n"); - /* The Multi Chunk Mixed test requires atleast three processes. */ - if (mpi_size > 2) - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX); - else - HDfprintf(stdout, "Multi Chunk Mixed test requires 3 proceses minimum\n"); + test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); + /* + * Test multi-chunk-io via setting direct property + */ + test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); + test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); - /* - * Test multi-chunk-io via setting direct property - */ - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); + test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); + test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); - test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); - test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); + test_actual_io_mode(TEST_ACTUAL_IO_RESET); + } - test_actual_io_mode(TEST_ACTUAL_IO_RESET); return; } -- cgit v0.12 From 5115f8b7ac3a3b41d4bf1531815026017666a761 Mon Sep 17 00:00:00 2001 From: Neil Fortner <nfortne2@hdfgroup.org> Date: Mon, 27 Sep 2021 11:51:37 -0500 Subject: Fix comments and run formatter. --- src/H5.c | 13 ++++++------- src/H5Dchunk.c | 27 ++++++++++++++------------- src/H5Dcompact.c | 5 ++--- src/H5Dcontig.c | 30 ++++++++++++++---------------- src/H5Defl.c | 6 +++--- src/H5Dio.c | 4 ++-- src/H5Dpkg.h | 5 ++--- src/H5FDint.c | 40 ++++++++++++++++++++++------------------ src/H5FDmpio.c | 48 ++++++++++++++++++++++++------------------------ src/H5FDprivate.h | 12 ++++++------ src/H5Fio.c | 9 +++++---- src/H5Fprivate.h | 10 ++++++---- 12 files changed, 106 insertions(+), 103 deletions(-) diff --git a/src/H5.c b/src/H5.c index 0c7c8c1..f97fe31 100644 --- a/src/H5.c +++ b/src/H5.c @@ -147,8 +147,8 @@ done: herr_t H5_init_library(void) { - char *env_use_select_io = NULL; - herr_t ret_value = SUCCEED; + char * env_use_select_io = NULL; + herr_t ret_value = SUCCEED; /* Set the 'library initialized' flag as early as possible, to avoid * possible re-entrancy. @@ -281,11 +281,10 @@ H5_init_library(void) /* Check for HDF5_USE_SELECTION_IO env variable */ env_use_select_io = HDgetenv("HDF5_USE_SELECTION_IO"); - if (NULL != env_use_select_io && HDstrcmp(env_use_select_io, "") - && HDstrcmp(env_use_select_io, "0") && HDstrcmp(env_use_select_io, "no") - && HDstrcmp(env_use_select_io, "No") && HDstrcmp(env_use_select_io, "NO") - && HDstrcmp(env_use_select_io, "false") && HDstrcmp(env_use_select_io, "False") - && HDstrcmp(env_use_select_io, "FALSE")) + if (NULL != env_use_select_io && HDstrcmp(env_use_select_io, "") && HDstrcmp(env_use_select_io, "0") && + HDstrcmp(env_use_select_io, "no") && HDstrcmp(env_use_select_io, "No") && + HDstrcmp(env_use_select_io, "NO") && HDstrcmp(env_use_select_io, "false") && + HDstrcmp(env_use_select_io, "False") && HDstrcmp(env_use_select_io, "FALSE")) H5_use_selection_io_g = TRUE; /* Debugging? */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index f11e717..8de023d 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -254,9 +254,8 @@ typedef struct H5D_chunk_coll_info_t { /* Chunked layout operation callbacks */ static herr_t H5D__chunk_construct(H5F_t *f, H5D_t *dset); static herr_t H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id); -static herr_t H5D__chunk_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, - H5D_chunk_map_t *fm); +static herr_t H5D__chunk_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, + const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm); static herr_t H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm); static herr_t H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, @@ -1064,10 +1063,10 @@ H5D__chunk_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsi hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */ htri_t file_space_normalized = FALSE; /* File dataspace was normalized */ unsigned f_ndims; /* The number of dimensions of the file's dataspace */ - int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */ - htri_t use_selection_io = FALSE; /* Whether to use selection I/O */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */ + htri_t use_selection_io = FALSE; /* Whether to use selection I/O */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2541,7 +2540,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_ H5S_t * chunk_file_spaces_static[8]; /* Static buffer for chunk_file_spaces */ haddr_t * chunk_addrs = NULL; /* Array of chunk addresses */ haddr_t chunk_addrs_static[8]; /* Static buffer for chunk_addrs */ - herr_t ret_value = SUCCEED; /*return value */ + herr_t ret_value = SUCCEED; /*return value */ FUNC_ENTER_STATIC @@ -2651,8 +2650,9 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_ * already verified it won't be used, and the metadata accumulator * because this is raw data) */ if (H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks, - (const H5S_t * const *)chunk_mem_spaces, (const H5S_t * const *)chunk_file_spaces, - chunk_addrs, element_sizes, bufs) < 0) + (const H5S_t *const *)chunk_mem_spaces, + (const H5S_t *const *)chunk_file_spaces, chunk_addrs, element_sizes, + bufs) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunk selection read failed") /* Clean up memory */ @@ -2815,7 +2815,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize H5S_t * chunk_file_spaces_static[8]; /* Static buffer for chunk_file_spaces */ haddr_t * chunk_addrs = NULL; /* Array of chunk addresses */ haddr_t chunk_addrs_static[8]; /* Static buffer for chunk_addrs */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2985,8 +2985,9 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize * already verified it won't be used, and the metadata accumulator * because this is raw data) */ if (H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks, - (const H5S_t * const *)chunk_mem_spaces, (const H5S_t * const *)chunk_file_spaces, - chunk_addrs, element_sizes, bufs) < 0) + (const H5S_t *const *)chunk_mem_spaces, + (const H5S_t *const *)chunk_file_spaces, chunk_addrs, element_sizes, + bufs) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunk selection read failed") /* Clean up memory */ diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 9a6d4b2..f68a93a 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -54,9 +54,8 @@ /* Layout operation callbacks */ static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset); static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage); -static herr_t H5D__compact_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, - H5D_chunk_map_t *cm); +static herr_t H5D__compact_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, + const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]); diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index cf6f543..d7ebbee 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -91,9 +91,8 @@ typedef struct H5D_contig_writevv_ud_t { /* Layout operation callbacks */ static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset); static herr_t H5D__contig_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id); -static herr_t H5D__contig_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, - H5D_chunk_map_t *cm); +static herr_t H5D__contig_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, + const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); static ssize_t H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); @@ -555,8 +554,8 @@ H5D__contig_io_init(H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm) { - htri_t use_selection_io = FALSE; /* Whether to use selection I/O */ - htri_t ret_value = SUCCEED; /* Return value */ + htri_t use_selection_io = FALSE; /* Whether to use selection I/O */ + htri_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -601,10 +600,10 @@ H5D__contig_may_use_select_io(const H5D_io_info_t *io_info, H5D_io_op_type_t op_ /* Don't use selection I/O if it's globally disabled, if there is a type * conversion, or if it's not a contiguous dataset, or if the sieve buffer * exists (write) or is dirty (read) */ - if (!H5_use_selection_io_g || io_info->io_ops.single_read != H5D__select_read - || io_info->layout_ops.readvv != H5D__contig_readvv - || (op_type == H5D_IO_OP_READ && io_info->dset->shared->cache.contig.sieve_dirty) - || (op_type == H5D_IO_OP_WRITE && io_info->dset->shared->cache.contig.sieve_buf)) + if (!H5_use_selection_io_g || io_info->io_ops.single_read != H5D__select_read || + io_info->layout_ops.readvv != H5D__contig_readvv || + (op_type == H5D_IO_OP_READ && io_info->dset->shared->cache.contig.sieve_dirty) || + (op_type == H5D_IO_OP_WRITE && io_info->dset->shared->cache.contig.sieve_buf)) ret_value = FALSE; else { htri_t page_buf_enabled; @@ -641,7 +640,7 @@ herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -657,7 +656,7 @@ H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize /* Issue selection I/O call (we can skip the page buffer because we've * already verified it won't be used, and the metadata accumulator - * because this is raw data) Only call funciton if nelmts > 0. */ + * because this is raw data) */ if (H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, nelmts > 0 ? 1 : 0, &mem_space, &file_space, &(io_info->store->contig.dset_addr), &dst_type_size, &(io_info->u.rbuf)) < 0) @@ -666,7 +665,7 @@ H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize else /* Read data through legacy (non-selection I/O) pathway */ if ((io_info->io_ops.single_read)(io_info, type_info, nelmts, file_space, mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous read failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous read failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -688,7 +687,7 @@ herr_t H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -704,7 +703,7 @@ H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz /* Issue selection I/O call (we can skip the page buffer because we've * already verified it won't be used, and the metadata accumulator - * because this is raw data). Only call funciton if nelmts > 0. */ + * because this is raw data) */ if (H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, nelmts > 0 ? 1 : 0, &mem_space, &file_space, &(io_info->store->contig.dset_addr), &dst_type_size, &(io_info->u.wbuf)) < 0) @@ -713,7 +712,7 @@ H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz else /* Write data through legacy (non-selection I/O) pathway */ if ((io_info->io_ops.single_write)(io_info, type_info, nelmts, file_space, mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous write failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1649,4 +1648,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__contig_copy() */ - diff --git a/src/H5Defl.c b/src/H5Defl.c index fea70b0..ce6d481 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -60,9 +60,9 @@ typedef struct H5D_efl_writevv_ud_t { /********************/ /* Layout operation callbacks */ -static herr_t H5D__efl_construct(H5F_t *f, H5D_t *dset); -static herr_t H5D__efl_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); +static herr_t H5D__efl_construct(H5F_t *f, H5D_t *dset); +static herr_t H5D__efl_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, + const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); static ssize_t H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); diff --git a/src/H5Dio.c b/src/H5Dio.c index 191ee5c..c7f8a3e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -868,13 +868,13 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ * selection I/O is to be used - in this case the file driver will * handle collective I/O */ /* Check for selection/vector support in file driver? -NAF */ - if(!io_info->use_select_io) { + if (!io_info->use_select_io) { io_info->io_ops.multi_read = dset->shared->layout.ops->par_read; io_info->io_ops.multi_write = dset->shared->layout.ops->par_write; io_info->io_ops.single_read = H5D__mpio_select_read; io_info->io_ops.single_write = H5D__mpio_select_write; } /* end if */ - } /* end if */ + } /* end if */ else { /* 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; diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index f9014a7..22712ee 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -121,9 +121,8 @@ typedef herr_t (*H5D_layout_construct_func_t)(H5F_t *f, H5D_t *dset); typedef herr_t (*H5D_layout_init_func_t)(H5F_t *f, const H5D_t *dset, hid_t dapl_id); typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_storage_t *storage); typedef hbool_t (*H5D_layout_is_data_cached_func_t)(const H5D_shared_t *shared_dset); -typedef herr_t (*H5D_layout_io_init_func_t)(struct H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, hsize_t nelmts, - const H5S_t *file_space, const H5S_t *mem_space, +typedef herr_t (*H5D_layout_io_init_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info, + hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, struct H5D_chunk_map_t *cm); typedef herr_t (*H5D_layout_read_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, diff --git a/src/H5FDint.c b/src/H5FDint.c index 69dbdc4..b23b918 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -712,7 +712,7 @@ done: */ static herr_t H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, - const H5S_t * const *mem_spaces, const H5S_t * const *file_spaces, + const H5S_t *const *mem_spaces, const H5S_t *const *file_spaces, haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */) { hbool_t extend_sizes = FALSE; @@ -822,9 +822,9 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin /* Initialize values so sequence lists are retrieved on the first * iteration */ file_seq_i = H5FD_SEQ_LIST_LEN; - mem_seq_i = H5FD_SEQ_LIST_LEN; - file_nseq = 0; - mem_nseq = 0; + mem_seq_i = H5FD_SEQ_LIST_LEN; + file_nseq = 0; + mem_nseq = 0; /* Loop until all elements are processed */ while (file_seq_i < file_nseq || nelmts > 0) { @@ -891,7 +891,8 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory reallocation failed for size list") sizes = tmp_ptr; - if (NULL == (tmp_ptr = H5MM_realloc(vec_bufs, vec_arr_nalloc * sizeof(*vec_bufs) * 2))) + if (NULL == + (tmp_ptr = H5MM_realloc(vec_bufs, vec_arr_nalloc * sizeof(*vec_bufs) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory reallocation failed for buffer list") vec_bufs = tmp_ptr; @@ -1009,8 +1010,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, const H5S_t * const *mem_spaces, - const H5S_t * const *file_spaces, haddr_t offsets[], size_t element_sizes[], +H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, const H5S_t *const *mem_spaces, + const H5S_t *const *file_spaces, haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */) { hbool_t offsets_cooked = FALSE; @@ -1283,8 +1284,9 @@ H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_ } /* Translate to vector or scalar I/O */ - if (H5FD__read_selection_translate(file, type, dxpl_id, count, (const H5S_t * const *)mem_spaces, - (const H5S_t * const *)file_spaces, offsets, element_sizes, bufs) < 0) + if (H5FD__read_selection_translate(file, type, dxpl_id, count, (const H5S_t *const *)mem_spaces, + (const H5S_t *const *)file_spaces, offsets, element_sizes, + bufs) < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "translation to vector or scalar read failed") } @@ -1330,7 +1332,7 @@ done: */ static herr_t H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, - const H5S_t * const *mem_spaces, const H5S_t * const *file_spaces, + const H5S_t *const *mem_spaces, const H5S_t *const *file_spaces, haddr_t offsets[], size_t element_sizes[], const void *bufs[]) { hbool_t extend_sizes = FALSE; @@ -1440,9 +1442,9 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui /* Initialize values so sequence lists are retrieved on the first * iteration */ file_seq_i = H5FD_SEQ_LIST_LEN; - mem_seq_i = H5FD_SEQ_LIST_LEN; - file_nseq = 0; - mem_nseq = 0; + mem_seq_i = H5FD_SEQ_LIST_LEN; + file_nseq = 0; + mem_nseq = 0; /* Loop until all elements are processed */ while (file_seq_i < file_nseq || nelmts > 0) { @@ -1509,7 +1511,8 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory reallocation failed for size list") sizes = tmp_ptr; - if (NULL == (tmp_ptr = H5MM_realloc(vec_bufs, vec_arr_nalloc * sizeof(*vec_bufs) * 2))) + if (NULL == + (tmp_ptr = H5MM_realloc(vec_bufs, vec_arr_nalloc * sizeof(*vec_bufs) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory reallocation failed for buffer list") vec_bufs = tmp_ptr; @@ -1625,8 +1628,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, const H5S_t * const *mem_spaces, - const H5S_t * const *file_spaces, haddr_t offsets[], size_t element_sizes[], +H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, const H5S_t *const *mem_spaces, + const H5S_t *const *file_spaces, haddr_t offsets[], size_t element_sizes[], const void *bufs[]) { hbool_t offsets_cooked = FALSE; @@ -1884,8 +1887,9 @@ H5FD_write_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem } /* Translate to vector or scalar I/O */ - if (H5FD__write_selection_translate(file, type, dxpl_id, count, (const H5S_t * const *)mem_spaces, - (const H5S_t * const *)file_spaces, offsets, element_sizes, bufs) < 0) + if (H5FD__write_selection_translate(file, type, dxpl_id, count, (const H5S_t *const *)mem_spaces, + (const H5S_t *const *)file_spaces, offsets, element_sizes, + bufs) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "translation to vector or scalar write failed") } diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 6a6dd2b..707715d 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1281,7 +1281,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #endif HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0) - /* Get the type's size */ + /* Get the type's size */ #if MPI_VERSION >= 3 if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size))) #else @@ -1570,9 +1570,9 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou hbool_t vector_was_sorted = TRUE; hbool_t fixed_size = FALSE; size_t size; - H5FD_mem_t * s_types = NULL; - haddr_t * s_addrs = NULL; - size_t * s_sizes = NULL; + H5FD_mem_t * s_types = NULL; + haddr_t * s_addrs = NULL; + size_t * s_sizes = NULL; size_t s_size; void ** s_bufs = NULL; int * mpi_block_lengths = NULL; @@ -1594,18 +1594,18 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou H5FD_mpio_collective_opt_t coll_opt_mode; /* whether we are doing collective or independent I/O */ int size_i; #if MPI_VERSION >= 3 - MPI_Count bytes_read = 0; /* Number of bytes read in */ - MPI_Count type_size; /* MPI datatype used for I/O's size */ - MPI_Count io_size; /* Actual number of bytes requested */ - MPI_Count n; + MPI_Count bytes_read = 0; /* Number of bytes read in */ + MPI_Count type_size; /* MPI datatype used for I/O's size */ + MPI_Count io_size; /* Actual number of bytes requested */ + MPI_Count n; #else - int bytes_read = 0; /* Number of bytes read in */ - int type_size; /* MPI datatype used for I/O's size */ - int io_size; /* Actual number of bytes requested */ - int n; + int bytes_read = 0; /* Number of bytes read in */ + int type_size; /* MPI datatype used for I/O's size */ + int io_size; /* Actual number of bytes requested */ + int n; #endif - hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */ - herr_t ret_value = SUCCEED; + hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */ + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -1644,14 +1644,14 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou if (count == 1) { /* Single block. Just use a series of MPI_BYTEs for the file view. */ - size_i = (int)sizes[0]; - buf_type = MPI_BYTE; - file_type = MPI_BYTE; + size_i = (int)sizes[0]; + buf_type = MPI_BYTE; + file_type = MPI_BYTE; mpi_bufs_base = bufs[0]; /* Setup s_sizes (needed for incomplete read filling code) */ vector_was_sorted = TRUE; - s_sizes = sizes; + s_sizes = sizes; /* some numeric conversions */ if (H5FD_mpi_haddr_to_MPIOff(addrs[0], &mpi_off) < 0) @@ -1668,8 +1668,8 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou * are allocated, populated, and returned in s_types, s_addrs, s_sizes, and s_bufs respectively. * In this case, this function must free the memory allocated for the sorted vectors. */ - if (H5FD_sort_vector_io_req(&vector_was_sorted, count, types, addrs, sizes, bufs, &s_types, &s_addrs, - &s_sizes, &s_bufs) < 0) + if (H5FD_sort_vector_io_req(&vector_was_sorted, count, types, addrs, sizes, bufs, &s_types, + &s_addrs, &s_sizes, &s_bufs) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't sort vector I/O request") if ((NULL == (mpi_block_lengths = (int *)HDmalloc((size_t)count * sizeof(int)))) || @@ -1890,7 +1890,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou #endif HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0) - /* Get the type's size */ + /* Get the type's size */ #if MPI_VERSION >= 3 if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size))) #else @@ -1916,10 +1916,10 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou HDassert(i >= 0); #if MPI_VERSION >= 3 - io_size = MIN(n, (MPI_Count)s_sizes[i]); + io_size = MIN(n, (MPI_Count)s_sizes[i]); bytes_read = (MPI_Count)s_sizes[i] - io_size; #else - io_size = MIN(n, (int)s_sizes[i]); + io_size = MIN(n, (int)s_sizes[i]); bytes_read = (int)s_sizes[i] - io_size; #endif HDassert(bytes_read >= 0); @@ -1984,7 +1984,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) - /* How many bytes were actually read? */ + /* How many bytes were actually read? */ #if MPI_VERSION >= 3 if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, MPI_BYTE, &bytes_read))) #else diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 03b1e9e..60784f4 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -129,12 +129,12 @@ H5_DLL herr_t H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[] size_t sizes[], void *bufs[] /* out */); H5_DLL herr_t H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[], const void *bufs[] /* out */); -H5_DLL herr_t H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, const H5S_t * const *mem_spaces, - const H5S_t * const *file_spaces, haddr_t offsets[], size_t element_sizes[], - void *bufs[] /* out */); -H5_DLL herr_t H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, const H5S_t * const *mem_spaces, - const H5S_t * const *file_spaces, haddr_t offsets[], size_t element_sizes[], - const void *bufs[]); +H5_DLL herr_t H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, + const H5S_t *const *mem_spaces, const H5S_t *const *file_spaces, + haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */); +H5_DLL herr_t H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, + const H5S_t *const *mem_spaces, const H5S_t *const *file_spaces, + haddr_t offsets[], size_t element_sizes[], const void *bufs[]); H5_DLL herr_t H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */); diff --git a/src/H5Fio.c b/src/H5Fio.c index 9982dbc..123fe40 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -254,8 +254,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_shared_select_read(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, const H5S_t * const *mem_spaces, - const H5S_t * const *file_spaces, haddr_t offsets[], size_t element_sizes[], +H5F_shared_select_read(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, const H5S_t *const *mem_spaces, + const H5S_t *const *file_spaces, haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */) { H5FD_mem_t map_type; /* Mapped memory type */ @@ -300,8 +300,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_shared_select_write(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, const H5S_t * const *mem_spaces, - const H5S_t * const *file_spaces, haddr_t offsets[], size_t element_sizes[], const void *bufs[]) +H5F_shared_select_write(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, const H5S_t *const *mem_spaces, + const H5S_t *const *file_spaces, haddr_t offsets[], size_t element_sizes[], + const void *bufs[]) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index cd9682d..2779a2b 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -924,11 +924,13 @@ H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t si /* Functions that operate on selections of elements in the file */ H5_DLL herr_t H5F_shared_select_read(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, - const struct H5S_t * const *mem_spaces, const struct H5S_t * const *file_spaces, - haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */); + const struct H5S_t *const *mem_spaces, + const struct H5S_t *const *file_spaces, haddr_t offsets[], + size_t element_sizes[], void *bufs[] /* out */); H5_DLL herr_t H5F_shared_select_write(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, - const struct H5S_t * const *mem_spaces, const struct H5S_t * const *file_spaces, - haddr_t offsets[], size_t element_sizes[], const void *bufs[]); + const struct H5S_t *const *mem_spaces, + const struct H5S_t *const *file_spaces, haddr_t offsets[], + size_t element_sizes[], const void *bufs[]); /* Functions that flush or evict */ H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag); -- cgit v0.12 From ecb3383c8ded75a9ed0a146716cca4d5e7c03b69 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 28 Sep 2021 07:59:07 -0500 Subject: Develop libaec up (#1037) * Upgrade libaec to 1.0.6 * correct include file name --- config/cmake_ext_mod/HDFLibMacros.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index a60d09f..2af3229 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -158,7 +158,11 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}") - set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src") + if (USE_LIBAEC) + set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/include") + else () + set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src") + endif () set (SZIP_FOUND 1) set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) endmacro () @@ -167,6 +171,8 @@ endmacro () macro (PACKAGE_SZIP_LIBRARY compress_type) set (SZIP_HDR "SZconfig") if (USE_LIBAEC) + set (SZIP_HDR "aec_config") + else () set (SZIP_HDR "libaec_Export") endif () add_custom_target (SZIP-GenHeader-Copy ALL -- cgit v0.12 From 516d9677109b81b79ad1754246f4f147f9d984a3 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 28 Sep 2021 08:00:37 -0500 Subject: Develop cmake install dir (#1041) * Corrected path searched by CMake find_package command * Correct path for depend libs * Adjust examples script for install path --- CMakeInstallation.cmake | 10 +++++----- config/cmake/HDF5_Examples.cmake.in | 2 +- config/cmake/hdf5-config.cmake.in | 6 +++--- release_docs/RELEASE.txt | 9 +++++++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index d811ea5..b506f05 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -31,7 +31,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) if (HDF5_EXPORTED_TARGETS) install ( EXPORT ${HDF5_EXPORTED_TARGETS} - DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/hdf5 + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake NAMESPACE ${HDF_PACKAGE_NAMESPACE} COMPONENT configinstall @@ -72,7 +72,7 @@ set (CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) configure_package_config_file ( ${HDF_RESOURCES_DIR}/hdf5-config.cmake.in "${HDF5_BINARY_DIR}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake" - INSTALL_DESTINATION "${HDF5_INSTALL_CMAKE_DIR}/hdf5" + INSTALL_DESTINATION "${HDF5_INSTALL_CMAKE_DIR}" PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" ) @@ -86,14 +86,14 @@ set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" ) configure_package_config_file ( ${HDF_RESOURCES_DIR}/hdf5-config.cmake.in "${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake" - INSTALL_DESTINATION "${HDF5_INSTALL_CMAKE_DIR}/hdf5" + INSTALL_DESTINATION "${HDF5_INSTALL_CMAKE_DIR}" PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR ) if (NOT HDF5_EXTERNALLY_CONFIGURED) install ( FILES ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake - DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/hdf5 + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} COMPONENT configinstall ) endif () @@ -113,7 +113,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) #) install ( FILES ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake - DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/hdf5 + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} COMPONENT configinstall ) endif () diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 2d8dc58..5b7262e 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -83,7 +83,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN ############################################################################################################### if(WIN32) set(SITE_OS_NAME "Windows") - set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") + set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 8faa2fe..eab09ba 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -113,12 +113,12 @@ set (${HDF5_PACKAGE_NAME}_VERSION_MINOR @HDF5_VERSION_MINOR@) #----------------------------------------------------------------------------- if (NOT TARGET "@HDF5_PACKAGE@") if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) - include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) + include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) endif () if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) - include (@PACKAGE_SHARE_INSTALL_DIR@/@SZ_PACKAGE_NAME@/@SZ_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) + include (@PACKAGE_SHARE_INSTALL_DIR@/@SZ_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) endif () - include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) + include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) endif () # Handle default component(static) : diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6043145..453276c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1172,6 +1172,15 @@ Bug Fixes since HDF5-1.12.0 release Configuration ------------- + - Corrected path searched by CMake find_package command + + The install path for cmake find_package files had been changed to use + "share/cmake" + for all platforms. However the trailing "hdf5" directory was not removed. + This "hdf5" additional directory has been removed. + + (ADB - 2021/09/27) + - Corrected pkg-config compile script It was discovered that the position of the "$@" argument for the command -- cgit v0.12 From b410d9535c453aa888e839a251487f7a9ba1d0a2 Mon Sep 17 00:00:00 2001 From: Larry Knox <lrknox@hdfgroup.org> Date: Tue, 28 Sep 2021 14:35:19 -0500 Subject: Update Platforms Tested in RELEASE.txt. (#1045) * Update Platforms Tested in RELEASE.txt. Remove Tested Configuration Features Summary for updated replacement. * Set version to 1.13.0-6 for rc6 snapshot. --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 2 +- release_docs/RELEASE.txt | 240 ++++++++++++++-------------------- src/H5public.h | 4 +- 6 files changed, 103 insertions(+), 149 deletions(-) diff --git a/README.txt b/README.txt index fb027aa..0877bb4 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.13.0 currently under development +HDF5 version 1.13.0-6 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 71db7f6..52e5299 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.13.0" +PROJECT_NUMBER = "1.13.0-6, currently under development" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 8df7dd4..7748976 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -38,7 +38,7 @@ cmake_minimum_required (VERSION 3.12) ############################################################################## set (CTEST_SOURCE_VERSION "1.13.0") -set (CTEST_SOURCE_VERSEXT "") +set (CTEST_SOURCE_VERSEXT "-6") ############################################################################## # handle input parameters to script. diff --git a/configure.ac b/configure.ac index eb101cb..e9a3fca 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.13.0], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.13.0-6], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 453276c..b32f453 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.13.0 currently under development +HDF5 version 1.13.0-6 currently under development ================================================================================ @@ -37,9 +37,7 @@ CONTENTS - New Features - Support for new platforms and languages - Bug Fixes since HDF5-1.12.0 -- Supported Platforms -- Tested Configuration Features Summary -- More Tested Platforms +- Platforms Tested - Known Problems - CMake vs. Autotools installations @@ -1422,155 +1420,111 @@ Bug Fixes since HDF5-1.12.0 release (LRK, 2020/07/02, HDFFV-11063) -Supported Platforms +Platforms Tested =================== - Linux 2.6.32-696.16.1.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) - #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) - (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) - IBM XL C/C++ V13.1 - IBM XL Fortran V15.1 - - Linux 3.10.0-327.10.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++) - #1 SMP x86_64 GNU/Linux compilers: - (kituo/moohan) Version 4.8.5 20150623 (Red Hat 4.8.5-4) - Version 4.9.3, Version 5.2.0, - Intel(R) C (icc), C++ (icpc), Fortran (icc) - compilers: - Version 17.0.0.098 Build 20160721 - MPICH 3.1.4 compiled with GCC 4.9.3 - - SunOS 5.11 32- and 64-bit Sun C 5.12 SunOS_sparc - (emu) Sun Fortran 95 8.6 SunOS_sparc - Sun C++ 5.12 SunOS_sparc - - Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake) - Visual Studio 2017 w/ Intel Fortran 19 (cmake) - Visual Studio 2019 w/ Intel Fortran 19 (cmake) - Visual Studio 2019 w/ MSMPI 10.1 (cmake) - - Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0 - 64-bit gfortran GNU Fortran (GCC) 4.9.2 - (osx1010dev/osx1010test) Intel icc/icpc/ifort version 15.0.3 - - Mac OS X El Capitan 10.11.6 Apple clang/clang++ version 7.3.0 from Xcode 7.3 - 64-bit gfortran GNU Fortran (GCC) 5.2.0 - (osx1011dev/osx1011test) Intel icc/icpc/ifort version 16.0.2 - - Mac OS Sierra 10.12.6 Apple LLVM version 8.1.0 (clang/clang++-802.0.42) - 64-bit gfortran GNU Fortran (GCC) 7.1.0 - (swallow/kite) Intel icc/icpc/ifort version 17.0.2 - - -Tested Configuration Features Summary -===================================== - - In the tables below - y = tested - n = not tested in this release - C = Cluster - W = Workstation - x = not working in this release - dna = does not apply - ( ) = footnote appears below second table - <blank> = testing incomplete on this feature or platform - -Platform C F90/ F90 C++ zlib SZIP - parallel F2003 parallel -Solaris2.11 32-bit n y/y n y y y -Solaris2.11 64-bit n y/n n y y y -Windows 10 y y/y n y y y -Windows 10 x64 y y/y n y y y -Mac OS X Mountain Lion 10.8.5 64-bit n y/y n y y y -Mac OS X Mavericks 10.9.5 64-bit n y/y n y y ? -Mac OS X Yosemite 10.10.5 64-bit n y/y n y y ? -Mac OS X El Capitan 10.11.6 64-bit n y/y n y y ? -CentOS 6.7 Linux 2.6.18 x86_64 GNU n y/y n y y y -CentOS 6.7 Linux 2.6.18 x86_64 Intel n y/y n y y y -CentOS 6.7 Linux 2.6.32 x86_64 PGI n y/y n y y y -CentOS 7.2 Linux 2.6.32 x86_64 GNU y y/y y y y y -CentOS 7.2 Linux 2.6.32 x86_64 Intel n y/y n y y y -Linux 2.6.32-573.18.1.el6.ppc64 n y/n n y y y - - -Platform Shared Shared Shared Thread- - C libs F90 libs C++ libs safe -Solaris2.11 32-bit y y y y -Solaris2.11 64-bit y y y y -Windows 10 y y y y -Windows 10 x64 y y y y -Mac OS X Mountain Lion 10.8.5 64-bit y n y y -Mac OS X Mavericks 10.9.5 64-bit y n y y -Mac OS X Yosemite 10.10.5 64-bit y n y y -Mac OS X El Capitan 10.11.6 64-bit y n y y -CentOS 6.7 Linux 2.6.18 x86_64 GNU y y y y -CentOS 6.7 Linux 2.6.18 x86_64 Intel y y y n -CentOS 6.7 Linux 2.6.32 x86_64 PGI y y y n -CentOS 7.2 Linux 2.6.32 x86_64 GNU y y y n -CentOS 7.2 Linux 2.6.32 x86_64 Intel y y y n -Linux 2.6.32-573.18.1.el6.ppc64 y y y n - -Compiler versions for each platform are listed in the preceding -"Supported Platforms" table. - - -More Tested Platforms -===================== -The following platforms are not supported but have been tested for this release. - - Linux 2.6.32-573.22.1.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) - #1 SMP x86_64 GNU/Linux compilers: - (mayll/platypus) Version 4.4.7 20120313 - Version 4.9.3, 5.3.0, 6.2.0 - PGI C, Fortran, C++ for 64-bit target on - x86-64; - Version 17.10-0 - Intel(R) C (icc), C++ (icpc), Fortran (icc) - compilers: - Version 17.0.4.196 Build 20170411 - MPICH 3.1.4 compiled with GCC 4.9.3 - - Linux 3.10.0-327.18.2.el7 GNU C (gcc) and C++ (g++) compilers - #1 SMP x86_64 GNU/Linux Version 4.8.5 20150623 (Red Hat 4.8.5-4) - (jelly) with NAG Fortran Compiler Release 6.1(Tozai) - GCC Version 7.1.0 - OpenMPI 3.0.0-GCC-7.2.0-2.29 - Intel(R) C (icc) and C++ (icpc) compilers - Version 17.0.0.098 Build 20160721 - with NAG Fortran Compiler Release 6.1(Tozai) - - Linux 3.10.0-327.10.1.el7 MPICH 3.2 compiled with GCC 5.3.0 - #1 SMP x86_64 GNU/Linux - (moohan) - - Linux 2.6.32-573.18.1.el6.ppc64 MPICH mpich 3.1.4 compiled with - #1 SMP ppc64 GNU/Linux IBM XL C/C++ for Linux, V13.1 - (ostrich) and IBM XL Fortran for Linux, V15.1 - - Fedora33 5.11.18-200.fc33.x86_64 - #1 SMP x86_64 GNU/Linux GNU gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) - GNU Fortran (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) - clang version 11.0.0 (Fedora 11.0.0-2.fc33) + Linux 5.13.14-200.fc34 GNU gcc (GCC) 11.2.1 2021078 (Red Hat 11.2.1-1) + #1 SMP x86_64 GNU/Linux GNU Fortran (GCC) 11.2.1 2021078 (Red Hat 11.2.1-1) + Fedora34 clang version 12.0.1 (Fedora 12.0.1-1.fc34) (cmake and autotools) - Ubuntu20.04 5.8.0-53-generic-x86_64 - #60~20.04-Ubuntu SMP x86_64 GNU/Linux GNU gcc (GCC) 9.3.0-17ubuntu1 - GNU Fortran (GCC) 9.3.0-17ubuntu1 - clang version 10.0.0-4ubuntu1 + Linux 5.11.0-34-generic GNU gcc (GCC) 9.3.0-17ubuntu1 + #36-Ubuntu SMP x86_64 GNU/Linux GNU Fortran (GCC) 9.3.0-17ubuntu1 + Ubuntu 20.04 Ubuntu clang version 10.0.0-4 (cmake and autotools) - Ubuntu20.10 5.8.0-53-generic-x86_64 - #60-Ubuntu SMP x86_64 GNU/Linux GNU gcc (GCC) 10.2.0-13ubuntu1 - GNU Fortran (GCC) 10.2.0-13ubuntu1 - Ubuntu clang version 11.0.0-2 + Linux 5.8.0-63-generic GNU gcc (GCC) 10.3.0-1ubuntu1 + #71-Ubuntu SMP x86_64 GNU/Linux GNU Fortran (GCC) 10.3.0-1ubuntu1 + Ubuntu20.10 Ubuntu clang version 11.0.0-2 (cmake and autotools) - SUSE15sp2 5.3.18-22-default - #1 SMP x86_64 GNU/Linux GNU gcc (SUSE Linux) 7.5.0 - GNU Fortran (SUSE Linux) 7.5.0 - clang version 7.0.1 (tags/RELEASE_701/final 349238) + Linux 5.3.18-22-default GNU gcc (SUSE Linux) 7.5.0 + #1 SMP x86_64 GNU/Linux GNU Fortran (SUSE Linux) 7.5.0 + SUSE15sp2 clang version 7.0.1 (tags/RELEASE_701/final 349238) (cmake and autotools) + Linux-4.14.0-115.21.2 spectrum-mpi/rolling-release + #1 SMP ppc64le GNU/Linux clang 8.0.1, 11.0.1 + (lassen) GCC 7.3.1 + XL 16.1.1.2 + (cmake) + + Linux-4.12.14-150.75-default cray-mpich/7.7.10 + #1 SMP x86_64 GNU/Linux GCC 7.3.0, 8.2.0 + (cori) Intel (R) Version 19.0.3.199 + (cmake) + + Linux-4.12.14-197.86-default cray-mpich/7.7.6 + # 1SMP x86_64 GNU/Linux GCC 7.3.0, 9.3.0, 10.2.0 + (mutrino) Intel (R) Version 17.0.4, 18.0.5, 19.1.3 + (cmake) + + Linux 3.10.0-1160.36.2.el7.ppc64 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) + #1 SMP ppc64be GNU/Linux g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) + Power8 (echidna) GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) + + Linux 3.10.0-1160.24.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers: + Centos7 Version 4.8.5 20150623 (Red Hat 4.8.5-4) + (jelly/kituo/moohan) Version 4.9.3, Version 5.3.0, Version 6.3.0, + Version 7.2.0, Version 8.3.0, Version 9.1.0 + Intel(R) C (icc), C++ (icpc), Fortran (icc) + compilers: + Version 17.0.0.098 Build 20160721 + GNU C (gcc) and C++ (g++) 4.8.5 compilers + with NAG Fortran Compiler Release 6.1(Tozai) + Intel(R) C (icc) and C++ (icpc) 17.0.0.098 compilers + with NAG Fortran Compiler Release 6.1(Tozai) + MPICH 3.1.4 compiled with GCC 4.9.3 + MPICH 3.3 compiled with GCC 7.2.0 + OpenMPI 2.1.6 compiled with icc 18.0.1 + OpenMPI 3.1.3 and 4.0.0 compiled with GCC 7.2.0 + PGI C, Fortran, C++ for 64-bit target on + x86_64; + Version 19.10-0 + + Linux-3.10.0-1127.0.0.1chaos openmpi-4.0.0 + #1 SMP x86_64 GNU/Linux clang 6.0.0, 11.0.1 + (quartz) GCC 7.3.0, 8.1.0 + Intel 16.0.4, 18.0.2, 19.0.4 + + macOS Apple M1 11.6 Apple clang version 12.0.5 (clang-1205.0.22.11) + Darwin 20.6.0 arm64 gfortran GNU Fortran (Homebrew GCC 11.2.0) 11.1.0 + (macmini-m1) Intel icc/icpc/ifort version 2021.3.0 202106092021.3.0 20210609 + + macOS Big Sur 11.3.1 Apple clang version 12.0.5 (clang-1205.0.22.9) + Darwin 20.4.0 x86_64 gfortran GNU Fortran (Homebrew GCC 10.2.0_3) 10.2.0 + (bigsur-1) Intel icc/icpc/ifort version 2021.2.0 20210228 + + macOS High Sierra 10.13.6 Apple LLVM version 10.0.0 (clang-1000.10.44.4) + 64-bit gfortran GNU Fortran (GCC) 6.3.0 + (bear) Intel icc/icpc/ifort version 19.0.4.233 20190416 + + macOS Sierra 10.12.6 Apple LLVM version 9.0.0 (clang-900.39.2) + 64-bit gfortran GNU Fortran (GCC) 7.4.0 + (kite) Intel icc/icpc/ifort version 17.0.2 + + Mac OS X El Capitan 10.11.6 Apple clang version 7.3.0 from Xcode 7.3 + 64-bit gfortran GNU Fortran (GCC) 5.2.0 + (osx1011test) Intel icc/icpc/ifort version 16.0.2 + + + Linux 2.6.32-573.22.1.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers: + Centos6 Version 4.4.7 20120313 + (platypus) Version 4.9.3, 5.3.0, 6.2.0 + MPICH 3.1.4 compiled with GCC 4.9.3 + PGI C, Fortran, C++ for 64-bit target on + x86_64; + Version 19.10-0 + + Windows 10 x64 Visual Studio 2015 w/ Intel C/C++/Fortran 18 (cmake) + Visual Studio 2017 w/ Intel C/C++/Fortran 19 (cmake) + Visual Studio 2019 w/ clang 12.0.0 + with MSVC-like command-line (C/C++ only - cmake) + Visual Studio 2019 w/ Intel Fortran 19 (cmake) + Visual Studio 2019 w/ MSMPI 10.1 (C only - cmake) + Known Problems ============== diff --git a/src/H5public.h b/src/H5public.h index 65709c6..9936a69 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -87,11 +87,11 @@ /** * For pre-releases like \c snap0. Empty string for official releases. */ -#define H5_VERS_SUBRELEASE "" +#define H5_VERS_SUBRELEASE "6" /** * Full version string */ -#define H5_VERS_INFO "HDF5 library version: 1.13.0" +#define H5_VERS_INFO "HDF5 library version: 1.13.0-6" #define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE) -- cgit v0.12 From 1c52149f75a4b6ba0e5cf542d33ae9104019a272 Mon Sep 17 00:00:00 2001 From: Larry Knox <lrknox@hdfgroup.org> Date: Wed, 29 Sep 2021 07:38:59 -0500 Subject: Update version to 1.13.0-7 after snapshot release 1.13.0-6. (#1048) --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 2 +- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index 0877bb4..b9494db 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.13.0-6 currently under development +HDF5 version 1.13.0-7 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 52e5299..002db5d 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.13.0-6, currently under development" +PROJECT_NUMBER = "1.13.0-7, currently under development" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 7748976..ee898b0 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -38,7 +38,7 @@ cmake_minimum_required (VERSION 3.12) ############################################################################## set (CTEST_SOURCE_VERSION "1.13.0") -set (CTEST_SOURCE_VERSEXT "-6") +set (CTEST_SOURCE_VERSEXT "-7") ############################################################################## # handle input parameters to script. diff --git a/configure.ac b/configure.ac index e9a3fca..cd5a42a 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.13.0-6], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.13.0-7], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b32f453..0c3a398 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.13.0-6 currently under development +HDF5 version 1.13.0-7 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index 9936a69..c9430dc 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -87,11 +87,11 @@ /** * For pre-releases like \c snap0. Empty string for official releases. */ -#define H5_VERS_SUBRELEASE "6" +#define H5_VERS_SUBRELEASE "7" /** * Full version string */ -#define H5_VERS_INFO "HDF5 library version: 1.13.0-6" +#define H5_VERS_INFO "HDF5 library version: 1.13.0-7" #define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE) -- cgit v0.12 From 9e319d403ce35e7ab971c93cdeaded668abc5c9a Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Wed, 29 Sep 2021 08:59:11 -0500 Subject: OESS-168: Remove clang warnings. (#1046) This patch will remove clang warnings on Mac: ``` warning: implicit conversion increases floating-point precision: 'float' to 'double' [-Wdouble-promotion] ``` --- tools/src/h5perf/sio_perf.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index 1b200b0..9c7675f 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -310,14 +310,14 @@ run_test(iotype iot, parameters parms, struct options *opts) minmax * read_mm_table = NULL; minmax * read_gross_mm_table = NULL; minmax * read_raw_mm_table = NULL; - minmax write_sys_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax write_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax write_gross_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax write_raw_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax read_sys_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax read_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax read_gross_mm = {0.0F, 0.0F, 0.0F, 0}; - minmax read_raw_mm = {0.0F, 0.0F, 0.0F, 0}; + minmax write_sys_mm = {0.0, 0.0, 0.0, 0}; + minmax write_mm = {0.0, 0.0, 0.0, 0}; + minmax write_gross_mm = {0.0, 0.0, 0.0, 0}; + minmax write_raw_mm = {0.0, 0.0, 0.0, 0}; + minmax read_sys_mm = {0.0, 0.0, 0.0, 0}; + minmax read_mm = {0.0, 0.0, 0.0, 0}; + minmax read_gross_mm = {0.0, 0.0, 0.0, 0}; + minmax read_raw_mm = {0.0, 0.0, 0.0, 0}; raw_size = (off_t)parms.num_bytes; parms.io_type = iot; @@ -574,7 +574,7 @@ accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm) { int i; - total_mm->sum = 0.0F; + total_mm->sum = 0.0; total_mm->max = -DBL_MAX; total_mm->min = DBL_MAX; total_mm->num = count; -- cgit v0.12 From 35cf4a69bfc2abd6d1bb1782c3a34feb3f504b57 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Wed, 29 Sep 2021 08:59:24 -0500 Subject: OESS-168: Remove clang warnings. (#1047) This patch will remove clang warnings on Mac: 'float' to 'double' [-Wdouble-promotion] --- tools/test/perform/zip_perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index d8cd3a1..123fb98 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -396,7 +396,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, unsigned long error("out of memory"); } - compression_time = 0.0F; + compression_time = 0.0; if (random_test) fill_with_random_data(src, src_len); -- cgit v0.12 From c7d79425109a4363cc3ab6817e054712b73c5cb1 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Wed, 29 Sep 2021 08:59:34 -0500 Subject: OESS-168: Remove clang warnings (#1049) This patch will remove clang double-promotion warning. --- tools/test/perform/overhead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c index 60ec8d8..64192ba 100644 --- a/tools/test/perform/overhead.c +++ b/tools/test/perform/overhead.c @@ -187,7 +187,7 @@ test(fill_t fill_style, const double splits[], hbool_t verbose, hbool_t use_rdcc if (!use_rdcc) { if (H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL) < 0) goto error; - if (H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0F) < 0) + if (H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0) < 0) goto error; } if ((file = H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) -- cgit v0.12 From 0fa5836cc5f037dd9f2cdd7f9a1051ddcc1c9ad0 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Wed, 29 Sep 2021 08:59:47 -0500 Subject: OESS-168: Remove clang warnings. (#1050) This patch will remove clang double-promotion warning. --- tools/test/perform/chunk_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index b515961..ad9bf09 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -39,7 +39,7 @@ #define RDCC_NSLOTS 5 #define RDCC_NBYTES (1024 * 1024 * 10) -#define RDCC_W0 0.75F +#define RDCC_W0 0.75 #define FILTER_COUNTER 306 static size_t nbytes_global; -- cgit v0.12 From 3da0802c40d58759995916bf9d0880e19f0af44d Mon Sep 17 00:00:00 2001 From: jhendersonHDF <jhenderson@hdfgroup.org> Date: Wed, 29 Sep 2021 13:28:12 -0500 Subject: VFD plugins (#602) * Implement support for loading of Virtual File Drivers as plugins Fix plugin caching for VOL connector and VFD plugins Fix plugin iteration to skip paths that can't be opened * Enable dynamic loading of VFDs with HDF5_DRIVER environment variable * Temporarily disable error reporting during H5F_open double file open * Default to using HDstat in h5_get_file_size for unknown VFDs * Use macros for some environment variables that HDF5 interprets * Update "null" and "ctl testing" VFDs --- .gitattributes | 8 +- MANIFEST | 11 +- bin/trace | 1 + c++/test/CMakeVFDTests.cmake | 18 + c++/test/testhdf5.cpp | 2 +- config/conclude.am | 19 +- examples/h5_drivers.c | 2 +- fortran/test/t.c | 2 +- hl/tools/h5watch/swmr_check_compat_vfd.c | 2 +- src/H5.c | 4 +- src/H5FD.c | 56 ++ src/H5FDcore.c | 45 +- src/H5FDcore.h | 3 +- src/H5FDdevelop.h | 3 + src/H5FDdirect.c | 84 +- src/H5FDdirect.h | 6 +- src/H5FDfamily.c | 232 +++++- src/H5FDfamily.h | 3 +- src/H5FDhdfs.c | 3 +- src/H5FDhdfs.h | 6 +- src/H5FDint.c | 371 +++++++++ src/H5FDlog.c | 91 ++- src/H5FDlog.h | 3 +- src/H5FDmirror.c | 3 +- src/H5FDmirror.h | 3 +- src/H5FDmpio.c | 63 +- src/H5FDmulti.c | 432 ++++++---- src/H5FDprivate.h | 21 +- src/H5FDpublic.h | 43 + src/H5FDros3.c | 3 +- src/H5FDros3.h | 6 +- src/H5FDsec2.c | 5 +- src/H5FDsec2.h | 3 +- src/H5FDsplitter.c | 355 +++++++-- src/H5FDsplitter.h | 3 +- src/H5FDstdio.c | 3 +- src/H5FDwindows.c | 2 +- src/H5Fint.c | 17 +- src/H5PLint.c | 65 +- src/H5PLpath.c | 29 +- src/H5PLplugin_cache.c | 140 ++-- src/H5PLprivate.h | 31 +- src/H5PLpublic.h | 6 +- src/H5Pfapl.c | 567 ++++++++++++- src/H5Pint.c | 74 +- src/H5Ppkg.h | 3 + src/H5Pprivate.h | 13 +- src/H5Ppublic.h | 79 ++ src/H5VLcallback.c | 29 +- src/H5VLint.c | 70 +- src/H5public.h | 52 ++ src/H5trace.c | 59 ++ test/CMakeLists.txt | 59 +- test/CMakeTests.cmake | 10 +- test/CMakeVFDTests.cmake | 38 + test/Makefile.am | 12 +- test/accum.c | 2 +- test/accum_swmr_reader.c | 2 +- test/app_ref.c | 24 +- test/btree2.c | 10 +- test/cache.c | 5 + test/cache_api.c | 47 +- test/cache_image.c | 5 +- test/cache_tagging.c | 6 + test/cork.c | 17 + test/dangle.c | 16 +- test/dsets.c | 25 +- test/dtransform.c | 2 + test/dtypes.c | 86 +- test/error_test.c | 20 +- test/family_v16-000000.h5 | Bin 0 -> 5120 bytes test/family_v16-000001.h5 | Bin 0 -> 5120 bytes test/family_v16-000002.h5 | Bin 0 -> 5120 bytes test/family_v16-000003.h5 | Bin 0 -> 4048 bytes test/family_v16_00000.h5 | Bin 5120 -> 0 bytes test/family_v16_00001.h5 | Bin 5120 -> 0 bytes test/family_v16_00002.h5 | Bin 5120 -> 0 bytes test/family_v16_00003.h5 | Bin 4048 -> 0 bytes test/fheap.c | 2 +- test/file_image.c | 5 +- test/filenotclosed.c | 2 +- test/fillval.c | 5 +- test/flush1.c | 2 +- test/flush2.c | 2 +- test/flushrefresh.c | 2 +- test/freespace.c | 28 +- test/getname.c | 8 +- test/h5test.c | 399 +++++----- test/h5test.h | 12 +- test/lheap.c | 40 +- test/links.c | 175 ++-- test/links_env.c | 16 +- test/mf.c | 203 ++--- test/mtime.c | 101 +-- test/ntypes.c | 16 +- test/null_vfd_plugin.c | 131 +++ test/null_vfd_plugin.h | 33 + test/objcopy.c | 41 +- test/ohdr.c | 26 +- test/page_buffer.c | 2 +- test/reserved.c | 2 +- test/set_extent.c | 43 +- test/stab.c | 16 +- test/swmr.c | 8 +- test/swmr_check_compat_vfd.c | 2 +- test/tarray.c | 6 +- test/tattr.c | 108 ++- test/testhdf5.c | 2 +- test/tfile.c | 886 +++++++++++---------- test/th5o.c | 117 ++- test/th5s.c | 2 +- test/titerate.c | 6 +- test/tmisc.c | 94 ++- test/trefer.c | 14 +- test/tselect.c | 33 +- test/tsohm.c | 44 +- test/ttsafe.c | 2 +- test/vds.c | 17 +- test/vds_env.c | 17 +- test/vfd.c | 18 +- test/vfd_plugin.c | 388 +++++++++ test/vol.c | 71 +- test/vol_plugin.c | 4 +- testpar/CMakeVFDTests.cmake | 17 + testpar/t_pflush1.c | 4 +- testpar/t_pflush2.c | 4 +- tools/lib/h5diff.c | 16 +- tools/lib/h5diff.h | 2 + tools/lib/h5tools.c | 219 +++-- tools/lib/h5tools.h | 9 +- tools/libtest/h5tools_test_utils.c | 7 +- tools/src/h5diff/h5diff_common.c | 56 ++ tools/src/h5dump/h5dump.c | 74 +- tools/src/h5ls/h5ls.c | 78 +- tools/src/h5perf/perf.c | 2 +- tools/src/h5perf/pio_engine.c | 2 +- tools/src/h5perf/sio_engine.c | 2 +- tools/src/h5repack/h5repack.c | 4 +- tools/src/h5repack/h5repack_copy.c | 4 +- tools/src/h5repack/h5repack_main.c | 88 +- tools/src/h5repack/h5repack_verify.c | 8 +- tools/src/h5stat/h5stat.c | 24 +- tools/src/misc/h5mkgrp.c | 46 +- tools/test/h5diff/testfiles/h5diff_10.txt | 12 + tools/test/h5diff/testfiles/h5diff_600.txt | 12 + tools/test/h5diff/testfiles/h5diff_603.txt | 12 + tools/test/h5diff/testfiles/h5diff_606.txt | 12 + tools/test/h5diff/testfiles/h5diff_612.txt | 12 + tools/test/h5diff/testfiles/h5diff_615.txt | 12 + tools/test/h5diff/testfiles/h5diff_621.txt | 12 + tools/test/h5diff/testfiles/h5diff_622.txt | 12 + tools/test/h5diff/testfiles/h5diff_623.txt | 12 + tools/test/h5diff/testfiles/h5diff_624.txt | 12 + tools/test/h5repack/CMakeVFDTests.cmake | 17 + tools/test/h5repack/h5repacktst.c | 807 ++++++++++--------- tools/test/h5repack/testfiles/h5repack-help.txt | 12 + tools/test/misc/testfiles/h5mkgrp_help.txt | 6 + tools/test/perform/chunk_cache.c | 2 +- tools/test/perform/overhead.c | 2 +- tools/test/perform/zip_perf.c | 2 +- tools/testfiles/h5dump-help.txt | 6 + tools/testfiles/help-1.ls | 6 + tools/testfiles/help-2.ls | 6 + tools/testfiles/help-3.ls | 6 + .../pbits/tnofilename-with-packed-bits.ddl | 6 + tools/testfiles/pbits/tpbitsIncomplete.ddl | 6 + tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 6 + tools/testfiles/pbits/tpbitsLengthPositive.ddl | 6 + tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 6 + tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 6 + tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 6 + tools/testfiles/textlinksrc-nodangle-1.ls | 6 + tools/testfiles/tgroup-1.ls | 6 + 173 files changed, 6120 insertions(+), 2283 deletions(-) create mode 100644 test/family_v16-000000.h5 create mode 100644 test/family_v16-000001.h5 create mode 100644 test/family_v16-000002.h5 create mode 100644 test/family_v16-000003.h5 delete mode 100644 test/family_v16_00000.h5 delete mode 100644 test/family_v16_00001.h5 delete mode 100644 test/family_v16_00002.h5 delete mode 100644 test/family_v16_00003.h5 create mode 100644 test/null_vfd_plugin.c create mode 100644 test/null_vfd_plugin.h create mode 100644 test/vfd_plugin.c diff --git a/.gitattributes b/.gitattributes index e01442a..385f805 100644 --- a/.gitattributes +++ b/.gitattributes @@ -393,10 +393,10 @@ test/cork.c -text test/corrupt_stab_msg.h5 -text test/deflate.h5 -text test/dynlib4.c -text -test/family_v16_00000.h5 -text -test/family_v16_00001.h5 -text -test/family_v16_00002.h5 -text -test/family_v16_00003.h5 -text +test/family_v16-000000.h5 -text +test/family_v16-000001.h5 -text +test/family_v16-000002.h5 -text +test/family_v16-000003.h5 -text test/file_image_core_test.h5 -text test/filespace_1_6.h5 -text test/filespace_1_8.h5 -text diff --git a/MANIFEST b/MANIFEST index 0782b22..32c3457 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1199,10 +1199,10 @@ ./test/external_common.h ./test/external_env.c ./test/external_fname.h -./test/family_v16_00000.h5 -./test/family_v16_00001.h5 -./test/family_v16_00002.h5 -./test/family_v16_00003.h5 +./test/family_v16-000000.h5 +./test/family_v16-000001.h5 +./test/family_v16-000002.h5 +./test/family_v16-000003.h5 ./test/farray.c ./test/fheap.c ./test/file_image.c @@ -1287,6 +1287,8 @@ ./test/ntypes.c ./test/null_vol_connector.c ./test/null_vol_connector.h +./test/null_vfd_plugin.c +./test/null_vfd_plugin.h ./test/objcopy.c ./test/objcopy_ref.c ./test/ohdr.c @@ -1395,6 +1397,7 @@ ./test/vds_swmr_reader.c ./test/vds_swmr_writer.c ./test/vfd.c +./test/vfd_plugin.c ./test/vol.c ./test/vol_plugin.c diff --git a/bin/trace b/bin/trace index cc26f86..55ce7d4 100755 --- a/bin/trace +++ b/bin/trace @@ -53,6 +53,7 @@ $Source = ""; "H5D_scatter_func_t" => "DS", "H5FD_mpio_xfer_t" => "Dt", "H5D_vds_view_t" => "Dv", + "H5FD_class_value_t" => "DV", "H5D_chunk_iter_op_t" => "x", "herr_t" => "e", "H5E_auto1_t" => "Ea", diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index 360d14e..6a74244 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -24,11 +24,29 @@ set (VFD_LIST split multi family + splitter + #log - log VFD currently has file space allocation bugs ) if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () +if (H5_HAVE_PARALLEL) + # MPI I/O VFD is currently incompatible with too many tests in the VFD test set + # set (VFD_LIST ${VFD_LIST} mpio) +endif () +if (H5_HAVE_MIRROR_VFD) + set (VFD_LIST ${VFD_LIST} mirror) +endif () +if (H5_HAVE_ROS3_VFD) + set (VFD_LIST ${VFD_LIST} ros3) +endif () +if (H5_HAVE_LIBHDFS) + set (VFD_LIST ${VFD_LIST} hdfs) +endif () +if (H5_HAVE_WINDOWS) + set (VFD_LIST ${VFD_LIST} windows) +endif () ############################################################################## ############################################################################## diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index 71428ce..af50646 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -114,7 +114,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !getenv(HDF5_NOCLEANUP)) TestCleanup(); /* Release test infrastructure */ diff --git a/config/conclude.am b/config/conclude.am index 7d19082..e798d8d 100644 --- a/config/conclude.am +++ b/config/conclude.am @@ -270,10 +270,27 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS) echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ fi -VFD_LIST = sec2 stdio core core_paged split multi family +VFD_LIST = sec2 stdio core core_paged split multi family splitter + +# log VFD currently has file space allocation bugs +# VFD_LIST += log + if DIRECT_VFD_CONDITIONAL VFD_LIST += direct endif +if BUILD_PARALLEL_CONDITIONAL + # MPI I/O VFD is currently incompatible with too many tests in the VFD test set + # VFD_LIST += mpio +endif +if MIRROR_VFD_CONDITIONAL + VFD_LIST += mirror +endif +if ROS3_VFD_CONDITIONAL + VFD_LIST += ros3 +endif +if HDFS_VFD_CONDITIONAL + VFD_LIST += hdfs +endif # Run test with different Virtual File Driver check-vfd: $(LIB) $(PROGS) $(chk_TESTS) diff --git a/examples/h5_drivers.c b/examples/h5_drivers.c index bd57004..d9321ed 100644 --- a/examples/h5_drivers.c +++ b/examples/h5_drivers.c @@ -35,7 +35,7 @@ void cleanup(const char *filename) { if (cleanup_g == -1) - cleanup_g = getenv("HDF5_NOCLEANUP") ? 0 : 1; + cleanup_g = getenv(HDF5_NOCLEANUP) ? 0 : 1; if (cleanup_g) remove(filename); } diff --git a/fortran/test/t.c b/fortran/test/t.c index 6dce111..6c856fa 100644 --- a/fortran/test/t.c +++ b/fortran/test/t.c @@ -152,6 +152,6 @@ void nh5_env_nocleanup_c(int_f *status) { *status = (int_f)0; - if (HDgetenv("HDF5_NOCLEANUP")) + if (HDgetenv(HDF5_NOCLEANUP)) *status = (int_f)1; } /* h5_env_nocleanup_c */ diff --git a/hl/tools/h5watch/swmr_check_compat_vfd.c b/hl/tools/h5watch/swmr_check_compat_vfd.c index a2340bf..b4021e4 100644 --- a/hl/tools/h5watch/swmr_check_compat_vfd.c +++ b/hl/tools/h5watch/swmr_check_compat_vfd.c @@ -45,7 +45,7 @@ main(void) { char *driver = NULL; - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; diff --git a/src/H5.c b/src/H5.c index 3ceaecd..731f15a 100644 --- a/src/H5.c +++ b/src/H5.c @@ -261,7 +261,7 @@ H5_init_library(void) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface") if (H5VL_init_phase1() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface") - if (H5P_init() < 0) + if (H5P_init_phase1() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface") if (H5AC_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize metadata caching interface") @@ -273,6 +273,8 @@ H5_init_library(void) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataspace interface") /* Finish initializing interfaces that depend on the interfaces above */ + if (H5P_init_phase2() < 0) + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface") if (H5VL_init_phase2() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface") diff --git a/src/H5FD.c b/src/H5FD.c index d3f72e8..da0b97b 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -301,6 +301,62 @@ done: } /* end H5FD_register() */ /*------------------------------------------------------------------------- + * Function: H5FDis_driver_registered_by_name + * + * Purpose: Tests whether a VFD class has been registered or not + * according to a supplied driver name. + * + * Return: >0 if a VFD with that name has been registered + * 0 if a VFD with that name has NOT been registered + * <0 on errors + * + *------------------------------------------------------------------------- + */ +htri_t +H5FDis_driver_registered_by_name(const char *driver_name) +{ + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("t", "*s", driver_name); + + /* Check if driver with this name is registered */ + if ((ret_value = H5FD_is_driver_registered_by_name(driver_name, NULL)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFD is registered") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDis_driver_registered_by_name() */ + +/*------------------------------------------------------------------------- + * Function: H5FDis_driver_registered_by_value + * + * Purpose: Tests whether a VFD class has been registered or not + * according to a supplied driver value (ID). + * + * Return: >0 if a VFD with that value has been registered + * 0 if a VFD with that value hasn't been registered + * <0 on errors + * + *------------------------------------------------------------------------- + */ +htri_t +H5FDis_driver_registered_by_value(H5FD_class_value_t driver_value) +{ + htri_t ret_value = FALSE; + + FUNC_ENTER_API(FAIL) + H5TRACE1("t", "DV", driver_value); + + /* Check if driver with this value is registered */ + if ((ret_value = H5FD_is_driver_registered_by_value(driver_value, NULL)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFD is registered") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDis_driver_registered_by_value() */ + +/*------------------------------------------------------------------------- * Function: H5FDunregister * * Purpose: Removes a driver ID from the library. This in no way affects diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 820c74f..ce96582 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -149,8 +149,10 @@ static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing static herr_t H5FD__core_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__core_unlock(H5FD_t *_file); static herr_t H5FD__core_delete(const char *filename, hid_t fapl_id); +static inline const H5FD_core_fapl_t *H5FD__core_get_default_config(void); static const H5FD_class_t H5FD_core_g = { + H5FD_CORE_VALUE, /* value */ "core", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -187,6 +189,11 @@ static const H5FD_class_t H5FD_core_g = { H5FD_FLMAP_DICHOTOMY /* fl_map */ }; +/* Default configurations, if none provided */ +static const H5FD_core_fapl_t H5FD_core_default_config_g = {H5_MB, TRUE, H5FD_CORE_WRITE_TRACKING_FLAG, + H5FD_CORE_WRITE_TRACKING_PAGE_SIZE}; +static const H5FD_core_fapl_t H5FD_core_default_paged_config_g = {H5_MB, TRUE, TRUE, (size_t)4096}; + /* Define a free list to manage the region type */ H5FL_DEFINE(H5FD_core_region_t); @@ -409,6 +416,32 @@ done: } /* end H5FD__core_write_to_bstore() */ /*------------------------------------------------------------------------- + * Function: H5FD__core_get_default_config + * + * Purpose: Retrieves a default configuration for this VFD when no + * configuration information has been provided. + * + * Return: Valid Core VFD configuration information pointer (can't + * fail) + * + *------------------------------------------------------------------------- + */ +static inline const H5FD_core_fapl_t * +H5FD__core_get_default_config(void) +{ + char *driver = HDgetenv(HDF5_DRIVER); + + if (driver) { + if (!HDstrcmp(driver, "core")) + return &H5FD_core_default_config_g; + else if (!HDstrcmp(driver, "core_paged")) + return &H5FD_core_default_paged_config_g; + } + + return &H5FD_core_default_config_g; +} /* end H5FD__core_get_default_config() */ + +/*------------------------------------------------------------------------- * Function: H5FD__init_package * * Purpose: Initializes any interface-specific data or routines. @@ -426,7 +459,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC /* Check the use disabled file locks environment variable */ - lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */ else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) @@ -529,7 +562,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) if (H5FD_CORE != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") if (NULL == (old_fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + old_fa = H5FD__core_get_default_config(); /* Set VFD info values */ HDmemset(&fa, 0, sizeof(H5FD_core_fapl_t)); @@ -539,7 +572,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) fa.page_size = page_size; /* Set the property values & the driver for the FAPL */ - if (H5P_set_driver(plist, H5FD_CORE, &fa) < 0) + if (H5P_set_driver(plist, H5FD_CORE, &fa, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver") done: @@ -623,7 +656,7 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) fa.page_size = H5FD_CORE_WRITE_TRACKING_PAGE_SIZE; /* Set the property values & the driver for the FAPL */ - if (H5P_set_driver(plist, H5FD_CORE, &fa) < 0) + if (H5P_set_driver(plist, H5FD_CORE, &fa, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver") done: @@ -748,7 +781,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") + fa = H5FD__core_get_default_config(); /* Build the open flags */ o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY; @@ -1735,7 +1768,7 @@ H5FD__core_delete(const char *filename, hid_t fapl_id) if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + fa = H5FD__core_get_default_config(); if (fa->backing_store) if (HDremove(filename) < 0) diff --git a/src/H5FDcore.h b/src/H5FDcore.h index d456c3e..590478e 100644 --- a/src/H5FDcore.h +++ b/src/H5FDcore.h @@ -20,7 +20,8 @@ #ifndef H5FDcore_H #define H5FDcore_H -#define H5FD_CORE (H5FD_core_init()) +#define H5FD_CORE (H5FD_core_init()) +#define H5FD_CORE_VALUE H5_VFD_CORE #ifdef __cplusplus extern "C" { diff --git a/src/H5FDdevelop.h b/src/H5FDdevelop.h index 4895658..e897eb0 100644 --- a/src/H5FDdevelop.h +++ b/src/H5FDdevelop.h @@ -160,6 +160,7 @@ typedef struct H5FD_t H5FD_t; /* Class information for each file driver */ typedef struct H5FD_class_t { + H5FD_class_value_t value; const char * name; haddr_t maxaddr; H5F_close_degree_t fc_degree; @@ -235,6 +236,8 @@ extern "C" { #endif H5_DLL hid_t H5FDregister(const H5FD_class_t *cls); +H5_DLL htri_t H5FDis_driver_registered_by_name(const char *driver_name); +H5_DLL htri_t H5FDis_driver_registered_by_value(H5FD_class_value_t driver_value); H5_DLL herr_t H5FDunregister(hid_t driver_id); H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); H5_DLL herr_t H5FDclose(H5FD_t *file); diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 7cca09f..8c5001c 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -120,6 +120,8 @@ typedef struct H5FD_direct_t { /* Prototypes */ static herr_t H5FD__direct_term(void); +static herr_t H5FD__direct_populate_config(size_t boundary, size_t block_size, size_t cbuf_size, + H5FD_direct_fapl_t *fa_out); static void * H5FD__direct_fapl_get(H5FD_t *file); static void * H5FD__direct_fapl_copy(const void *_old_fa); static H5FD_t *H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); @@ -140,6 +142,7 @@ static herr_t H5FD__direct_unlock(H5FD_t *_file); static herr_t H5FD__direct_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_direct_g = { + H5FD_DIRECT_VALUE, /* value */ "direct", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -200,7 +203,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC /* Check the use disabled file locks environment variable */ - lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */ else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) @@ -296,28 +299,10 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - HDmemset(&fa, 0, sizeof(H5FD_direct_fapl_t)); - if (boundary != 0) - fa.mboundary = boundary; - else - fa.mboundary = MBOUNDARY_DEF; - if (block_size != 0) - fa.fbsize = block_size; - else - fa.fbsize = FBSIZE_DEF; - if (cbuf_size != 0) - fa.cbsize = cbuf_size; - else - fa.cbsize = CBSIZE_DEF; - - /* Set the default to be true for data alignment */ - fa.must_align = TRUE; - - /* Copy buffer size must be a multiple of file block size */ - if (fa.cbsize % fa.fbsize != 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "copy buffer size must be a multiple of block size") + if (H5FD__direct_populate_config(boundary, block_size, cbuf_size, &fa) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info") - ret_value = H5P_set_driver(plist, H5FD_DIRECT, &fa); + ret_value = H5P_set_driver(plist, H5FD_DIRECT, &fa, NULL); done: FUNC_LEAVE_API(ret_value) @@ -367,6 +352,53 @@ done: } /* end H5Pget_fapl_direct() */ /*------------------------------------------------------------------------- + * Function: H5FD__direct_populate_config + * + * Purpose: Populates a H5FD_direct_fapl_t structure with the provided + * values, supplying defaults where values are not provided. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__direct_populate_config(size_t boundary, size_t block_size, size_t cbuf_size, H5FD_direct_fapl_t *fa_out) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(fa_out); + + HDmemset(fa_out, 0, sizeof(H5FD_direct_fapl_t)); + + if (boundary != 0) + fa_out->mboundary = boundary; + else + fa_out->mboundary = MBOUNDARY_DEF; + + if (block_size != 0) + fa_out->fbsize = block_size; + else + fa_out->fbsize = FBSIZE_DEF; + + if (cbuf_size != 0) + fa_out->cbsize = cbuf_size; + else + fa_out->cbsize = CBSIZE_DEF; + + /* Set the default to be true for data alignment */ + fa_out->must_align = TRUE; + + /* Copy buffer size must be a multiple of file block size */ + if (fa_out->cbsize % fa_out->fbsize != 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "copy buffer size must be a multiple of block size") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__direct_populate_config() */ + +/*------------------------------------------------------------------------- * Function: H5FD__direct_fapl_get * * Purpose: Returns a file access property list which indicates how the @@ -450,6 +482,7 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad int fd = (-1); H5FD_direct_t * file = NULL; const H5FD_direct_fapl_t *fa; + H5FD_direct_fapl_t default_fa; #ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; @@ -498,8 +531,11 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad /* Get the driver specific information */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if (NULL == (fa = (const H5FD_direct_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") + if (NULL == (fa = (const H5FD_direct_fapl_t *)H5P_peek_driver_info(plist))) { + if (H5FD__direct_populate_config(0, 0, 0, &default_fa) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't initialize driver configuration info") + fa = &default_fa; + } file->fd = fd; H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t); diff --git a/src/H5FDdirect.h b/src/H5FDdirect.h index f06de7f..a439e55 100644 --- a/src/H5FDdirect.h +++ b/src/H5FDdirect.h @@ -21,9 +21,11 @@ #define H5FDdirect_H #ifdef H5_HAVE_DIRECT -#define H5FD_DIRECT (H5FD_direct_init()) +#define H5FD_DIRECT (H5FD_direct_init()) +#define H5FD_DIRECT_VALUE H5_VFD_DIRECT #else -#define H5FD_DIRECT (H5I_INVALID_HID) +#define H5FD_DIRECT (H5I_INVALID_HID) +#define H5FD_DIRECT_VALUE H5_VFD_INVALID #endif /* H5_HAVE_DIRECT */ #ifdef H5_HAVE_DIRECT diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index af67c78..d187b7b 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -47,6 +47,9 @@ /* The size of the member name buffers */ #define H5FD_FAM_MEMB_NAME_BUF_SIZE 4096 +/* Default member size - 100 MiB */ +#define H5FD_FAM_DEF_MEM_SIZE ((hsize_t)(100 * H5_MB)) + /* The driver identification number, initialized at runtime */ static hid_t H5FD_FAMILY_g = 0; @@ -77,6 +80,10 @@ typedef struct H5FD_family_fapl_t { hid_t memb_fapl_id; /*file access property list of each memb*/ } H5FD_family_fapl_t; +/* Private routines */ +static herr_t H5FD__family_get_default_config(H5FD_family_fapl_t *fa_out); +static char * H5FD__family_get_default_printf_filename(const char *old_filename); + /* Callback prototypes */ static herr_t H5FD__family_term(void); static void * H5FD__family_fapl_get(H5FD_t *_file); @@ -105,6 +112,7 @@ static herr_t H5FD__family_delete(const char *filename, hid_t fapl_id); /* The class struct */ static const H5FD_class_t H5FD_family_g = { + H5FD_FAMILY_VALUE, /* value */ "family", /* name */ HADDR_MAX, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -141,6 +149,122 @@ static const H5FD_class_t H5FD_family_g = { H5FD_FLMAP_DICHOTOMY /* fl_map */ }; +/*------------------------------------------------------------------------- + * Function: H5FD__family_get_default_config + * + * Purpose: Populates a H5FD_family_fapl_t structure with default + * values. + * + * Return: Non-negative on Success/Negative on Failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__family_get_default_config(H5FD_family_fapl_t *fa_out) +{ + H5P_genplist_t *def_plist; + H5P_genplist_t *plist; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(fa_out); + + fa_out->memb_size = H5FD_FAM_DEF_MEM_SIZE; + + /* Use copy of default file access property list for member FAPL ID. + * The Sec2 driver is explicitly set on the member FAPL ID, as the + * default driver might have been replaced with the Family VFD, which + * would cause recursion badness in the child members. + */ + if (NULL == (def_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if ((fa_out->memb_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list") + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fa_out->memb_fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on member FAPL") + +done: + if (ret_value < 0 && fa_out->memb_fapl_id >= 0) { + if (H5I_dec_ref(fa_out->memb_fapl_id) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement ref. count on member FAPL ID") + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__family_get_default_config() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__family_get_default_printf_filename + * + * Purpose: Given a filename, allocates and returns a new filename + * buffer that contains the given filename modified into this + * VFD's printf-style format. For example, the filename + * "file1.h5" would be modified to "file1-%06d.h5". This would + * allow for member filenames such as "file1-000000.h5", + * "file1-000001.h5", etc. The caller is responsible for + * freeing the returned buffer. + * + * Return: Non-negative on Success/Negative on Failure + * + *------------------------------------------------------------------------- + */ +static char * +H5FD__family_get_default_printf_filename(const char *old_filename) +{ + const char *suffix = "-%06d"; + size_t old_filename_len = 0; + size_t new_filename_len = 0; + char * file_extension = NULL; + char * tmp_buffer = NULL; + char * ret_value = NULL; + + FUNC_ENTER_STATIC + + HDassert(old_filename); + + old_filename_len = HDstrlen(old_filename); + if (0 == old_filename_len) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid filename") + + new_filename_len = old_filename_len + HDstrlen(suffix) + 1; + if (NULL == (tmp_buffer = H5MM_malloc(new_filename_len))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer") + + /* Determine if filename contains a ".h5" extension. */ + if ((file_extension = strstr(old_filename, ".h5"))) { + /* Insert the printf format between the filename and ".h5" extension. */ + HDstrcpy(tmp_buffer, old_filename); + file_extension = strstr(tmp_buffer, ".h5"); + HDsprintf(file_extension, "%s%s", suffix, ".h5"); + } + else if ((file_extension = strrchr(old_filename, '.'))) { + char *new_extension_loc = NULL; + + /* If the filename doesn't contain a ".h5" extension, but contains + * AN extension, just insert the printf format before that extension. + */ + HDstrcpy(tmp_buffer, old_filename); + new_extension_loc = strrchr(tmp_buffer, '.'); + HDsprintf(new_extension_loc, "%s%s", suffix, file_extension); + } + else { + /* If the filename doesn't contain an extension at all, just insert + * the printf format at the end of the filename. + */ + HDsnprintf(tmp_buffer, new_filename_len, "%s%s", old_filename, suffix); + } + + ret_value = tmp_buffer; + +done: + if (!ret_value) + H5MM_xfree(tmp_buffer); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__family_get_default_printf_filename() */ + /*-------------------------------------------------------------------------- NAME H5FD__init_package -- Initialize interface-specific information @@ -243,7 +367,7 @@ herr_t H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) { herr_t ret_value; - H5FD_family_fapl_t fa = {0, -1}; + H5FD_family_fapl_t fa = {0, H5I_INVALID_HID}; H5P_genplist_t * plist; /* Property list pointer */ FUNC_ENTER_API(FAIL) @@ -252,18 +376,22 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) /* Check arguments */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (H5P_DEFAULT == memb_fapl_id) - memb_fapl_id = H5P_FILE_ACCESS_DEFAULT; + if (H5P_DEFAULT == memb_fapl_id) { + /* Get default configuration for member FAPL */ + if (H5FD__family_get_default_config(&fa) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default driver configuration info") + } else if (TRUE != H5P_isa_class(memb_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") /* Initialize driver specific information. */ - fa.memb_size = msize; - fa.memb_fapl_id = memb_fapl_id; + fa.memb_size = msize; + if (H5P_DEFAULT != memb_fapl_id) + fa.memb_fapl_id = memb_fapl_id; if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - ret_value = H5P_set_driver(plist, H5FD_FAMILY, &fa); + ret_value = H5P_set_driver(plist, H5FD_FAMILY, &fa, NULL); done: FUNC_LEAVE_API(ret_value) @@ -589,9 +717,10 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad { H5FD_family_t *file = NULL; char * memb_name = NULL, *temp = NULL; - hsize_t eof = HADDR_UNDEF; - unsigned t_flags = flags & ~H5F_ACC_CREAT; - H5FD_t * ret_value = NULL; + hsize_t eof = HADDR_UNDEF; + hbool_t default_config = FALSE; + unsigned t_flags = flags & ~H5F_ACC_CREAT; + H5FD_t * ret_value = NULL; FUNC_ENTER_STATIC @@ -605,21 +734,32 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad if (NULL == (file = (H5FD_family_t *)H5MM_calloc(sizeof(H5FD_family_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") if (H5P_FILE_ACCESS_DEFAULT == fapl_id) { - file->memb_fapl_id = H5P_FILE_ACCESS_DEFAULT; - if (H5I_inc_ref(file->memb_fapl_id, FALSE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") - file->memb_size = 1024 * 1024 * 1024; /*1GB. Actual member size to be updated later */ - file->pmem_size = 1024 * 1024 * 1024; /*1GB. Member size passed in through property */ - file->mem_newsize = 0; /*New member size used by h5repart only */ - } /* end if */ + H5FD_family_fapl_t default_fa; + + /* Get default configuration */ + if (H5FD__family_get_default_config(&default_fa) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default driver configuration info") + + file->memb_fapl_id = default_fa.memb_fapl_id; + file->memb_size = H5FD_FAM_DEF_MEM_SIZE; /* Actual member size to be updated later */ + file->pmem_size = H5FD_FAM_DEF_MEM_SIZE; /* Member size passed in through property */ + file->mem_newsize = 0; /*New member size used by h5repart only */ + + default_config = TRUE; + } /* end if */ else { H5P_genplist_t * plist; /* Property list pointer */ const H5FD_family_fapl_t *fa; + H5FD_family_fapl_t default_fa; if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") + if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) { + if (H5FD__family_get_default_config(&default_fa) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default family VFD configuration") + fa = &default_fa; + default_config = TRUE; + } /* Check for new family file size. It's used by h5repart only. */ if (H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0) { @@ -643,7 +783,10 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad } /* end else */ file->memb_size = fa->memb_size; /* Actual member size to be updated later */ file->pmem_size = fa->memb_size; /* Member size passed in through property */ - } /* end else */ + + if (default_config && H5I_dec_ref(fa->memb_fapl_id) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, NULL, "can't decrement ref. count on member FAPL") + } /* end else */ file->name = H5MM_strdup(name); file->flags = flags; @@ -656,8 +799,16 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad /* Check that names are unique */ HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0); HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 1); - if (!HDstrcmp(memb_name, temp)) - HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique") + if (!HDstrcmp(memb_name, temp)) { + if (default_config) { + temp = H5MM_xfree(temp); + if (NULL == (temp = H5FD__family_get_default_printf_filename(name))) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default printf-style filename") + name = temp; + } + else + HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique") + } /* Open all the family members */ while (1) { @@ -1361,7 +1512,9 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) { H5P_genplist_t * plist; const H5FD_family_fapl_t *fa; - hid_t memb_fapl_id = H5I_INVALID_HID; + H5FD_family_fapl_t default_fa = {0, H5I_INVALID_HID}; + hbool_t default_config = FALSE; + hid_t memb_fapl_id = H5I_INVALID_HID; unsigned current_member; char * member_name = NULL; char * temp = NULL; @@ -1375,13 +1528,21 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) /* Get the driver info (for the member fapl) * The family_open call accepts H5P_DEFAULT, so we'll accept that here, too. */ - if (H5P_FILE_ACCESS_DEFAULT == fapl_id) - memb_fapl_id = H5P_FILE_ACCESS_DEFAULT; + if (H5P_FILE_ACCESS_DEFAULT == fapl_id) { + if (H5FD__family_get_default_config(&default_fa) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default family VFD configuration") + memb_fapl_id = default_fa.memb_fapl_id; + default_config = TRUE; + } else { if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad family VFD driver info") + if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) { + if (H5FD__family_get_default_config(&default_fa) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default family VFD configuration") + fa = &default_fa; + default_config = TRUE; + } memb_fapl_id = fa->memb_fapl_id; } @@ -1394,8 +1555,17 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) /* Sanity check to make sure that generated names are unique */ HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 0); HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 1); - if (!HDstrcmp(member_name, temp)) - HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "provided file name cannot generate unique sub-files") + if (!HDstrcmp(member_name, temp)) { + if (default_config) { + temp = H5MM_xfree(temp); + if (NULL == (temp = H5FD__family_get_default_printf_filename(filename))) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default printf-style filename") + filename = temp; + } + else + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, + "provided file name cannot generate unique sub-files") + } /* Delete all the family members */ current_member = 0; @@ -1431,9 +1601,9 @@ done: if (temp) H5MM_xfree(temp); - /* Don't close memb_fapl_id - We didn't bump its reference count since we're - * only using it in this call. - */ + /* Only close memb_fapl_id if we created one from the default configuration */ + if (default_fa.memb_fapl_id >= 0 && H5I_dec_ref(default_fa.memb_fapl_id) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement ref. count on member FAPL ID") FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__family_delete() */ diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h index 20ef532..7b76a16 100644 --- a/src/H5FDfamily.h +++ b/src/H5FDfamily.h @@ -20,7 +20,8 @@ #ifndef H5FDfamily_H #define H5FDfamily_H -#define H5FD_FAMILY (H5FD_family_init()) +#define H5FD_FAMILY (H5FD_family_init()) +#define H5FD_FAMILY_VALUE H5_VFD_FAMILY #ifdef __cplusplus extern "C" { diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index ac48b42..bbaf42c 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -278,6 +278,7 @@ static herr_t H5FD__hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing static herr_t H5FD__hdfs_validate_config(const H5FD_hdfs_fapl_t *fa); static const H5FD_class_t H5FD_hdfs_g = { + H5FD_HDFS_VALUE, /* value */ "hdfs", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -624,7 +625,7 @@ H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) if (FAIL == H5FD__hdfs_validate_config(fa)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hdfs config") - ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa); + ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa, NULL); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index 7c871a4..a9f34a0 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -22,9 +22,11 @@ #define H5FDhdfs_H #ifdef H5_HAVE_LIBHDFS -#define H5FD_HDFS (H5FD_hdfs_init()) +#define H5FD_HDFS (H5FD_hdfs_init()) +#define H5FD_HDFS_VALUE H5_VFD_HDFS #else /* H5_HAVE_LIBHDFS */ -#define H5FD_HDFS (H5I_INVALID_HID) +#define H5FD_HDFS (H5I_INVALID_HID) +#define H5FD_HDFS_VALUE H5_VFD_INVALID #endif /* H5_HAVE_LIBHDFS */ #ifdef H5_HAVE_LIBHDFS diff --git a/src/H5FDint.c b/src/H5FDint.c index f13f222..c567499 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -35,6 +35,7 @@ #include "H5Fprivate.h" /* File access */ #include "H5FDpkg.h" /* File Drivers */ #include "H5Iprivate.h" /* IDs */ +#include "H5PLprivate.h" /* Plugins */ /****************/ /* Local Macros */ @@ -44,6 +45,20 @@ /* Local Typedefs */ /******************/ +/* Information needed for iterating over the registered VFD hid_t IDs. + * The name or value of the new VFD that is being registered is stored + * in the name (or value) field and the found_id field is initialized to + * H5I_INVALID_HID (-1). If we find a VFD with the same name / value, + * we set the found_id field to the existing ID for return to the function. + */ +typedef struct H5FD_get_driver_ud_t { + /* IN */ + H5PL_vfd_key_t key; + + /* OUT */ + hid_t found_id; /* The driver ID, if we found a match */ +} H5FD_get_driver_ud_t; + /********************/ /* Package Typedefs */ /********************/ @@ -51,6 +66,7 @@ /********************/ /* Local Prototypes */ /********************/ +static int H5FD__get_driver_cb(void *obj, hid_t id, void *_op_data); /*********************/ /* Package Variables */ @@ -425,3 +441,358 @@ H5FD_delete(const char *filename, hid_t fapl_id) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_delete() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_check_plugin_load + * + * Purpose: Check if a VFD plugin matches the search criteria, and can + * be loaded. + * + * Note: Matching the driver's name / value, but the driver having + * an incompatible version is not an error, but means that the + * driver isn't a "match". Setting the SUCCEED value to FALSE + * and not failing for that case allows the plugin framework + * to keep looking for other DLLs that match and have a + * compatible version. + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_check_plugin_load(const H5FD_class_t *cls, const H5PL_key_t *key, hbool_t *success) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cls); + HDassert(key); + HDassert(success); + + /* Which kind of key are we looking for? */ + if (key->vfd.kind == H5FD_GET_DRIVER_BY_NAME) { + /* Check if plugin name matches VFD class name */ + if (cls->name && !HDstrcmp(cls->name, key->vfd.u.name)) + *success = TRUE; + } /* end if */ + else { + /* Sanity check */ + HDassert(key->vfd.kind == H5FD_GET_DRIVER_BY_VALUE); + + /* Check if plugin value matches VFD class value */ + if (cls->value == key->vfd.u.value) + *success = TRUE; + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_check_plugin_load() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__get_driver_cb + * + * Purpose: Callback routine to search through registered VFDs + * + * Return: Success: H5_ITER_STOP if the class and op_data name + * members match. H5_ITER_CONT otherwise. + * Failure: Can't fail + * + *------------------------------------------------------------------------- + */ +static int +H5FD__get_driver_cb(void *obj, hid_t id, void *_op_data) +{ + H5FD_get_driver_ud_t *op_data = (H5FD_get_driver_ud_t *)_op_data; /* User data for callback */ + H5FD_class_t * cls = (H5FD_class_t *)obj; + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + if (H5FD_GET_DRIVER_BY_NAME == op_data->key.kind) { + if (0 == HDstrcmp(cls->name, op_data->key.u.name)) { + op_data->found_id = id; + ret_value = H5_ITER_STOP; + } /* end if */ + } /* end if */ + else { + HDassert(H5FD_GET_DRIVER_BY_VALUE == op_data->key.kind); + if (cls->value == op_data->key.u.value) { + op_data->found_id = id; + ret_value = H5_ITER_STOP; + } /* end if */ + } /* end else */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__get_driver_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_register_driver_by_name + * + * Purpose: Registers a new VFD as a member of the virtual file driver + * class. + * + * Return: Success: A VFD ID which is good until the library is + * closed. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5FD_register_driver_by_name(const char *name, hbool_t app_ref) +{ + htri_t driver_is_registered = FALSE; + hid_t driver_id = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Check if driver is already registered */ + if ((driver_is_registered = H5FD_is_driver_registered_by_name(name, &driver_id)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't check if driver is already registered") + + /* If driver is already registered, increment ref count on ID and return ID */ + if (driver_is_registered) { + HDassert(driver_id >= 0); + + if (H5I_inc_ref(driver_id, app_ref) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFD") + } /* end if */ + else { + H5PL_key_t key; + const H5FD_class_t *cls; + + /* Try loading the driver */ + key.vfd.kind = H5FD_GET_DRIVER_BY_NAME; + key.vfd.u.name = name; + if (NULL == (cls = (const H5FD_class_t *)H5PL_load(H5PL_TYPE_VFD, &key))) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VFD") + + /* Register the driver we loaded */ + if ((driver_id = H5FD_register(cls, sizeof(*cls), app_ref)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VFD ID") + } /* end else */ + + ret_value = driver_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_register_driver_by_name() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_register_driver_by_value + * + * Purpose: Registers a new VFD as a member of the virtual file driver + * class. + * + * Return: Success: A VFD ID which is good until the library is + * closed. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5FD_register_driver_by_value(H5FD_class_value_t value, hbool_t app_ref) +{ + htri_t driver_is_registered = FALSE; + hid_t driver_id = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Check if driver is already registered */ + if ((driver_is_registered = H5FD_is_driver_registered_by_value(value, &driver_id)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't check if driver is already registered") + + /* If driver is already registered, increment ref count on ID and return ID */ + if (driver_is_registered) { + HDassert(driver_id >= 0); + + if (H5I_inc_ref(driver_id, app_ref) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFD") + } /* end if */ + else { + H5PL_key_t key; + const H5FD_class_t *cls; + + /* Try loading the driver */ + key.vfd.kind = H5FD_GET_DRIVER_BY_VALUE; + key.vfd.u.value = value; + if (NULL == (cls = (const H5FD_class_t *)H5PL_load(H5PL_TYPE_VFD, &key))) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VFD") + + /* Register the driver we loaded */ + if ((driver_id = H5FD_register(cls, sizeof(*cls), app_ref)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VFD ID") + } /* end else */ + + ret_value = driver_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_register_driver_by_value() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_is_driver_registered_by_name + * + * Purpose: Checks if a driver with a particular name is registered. + * If `registered_id` is non-NULL and a driver with the + * specified name has been registered, the driver's ID will be + * returned in `registered_id`. + * + * Return: >0 if a VFD with that name has been registered + * 0 if a VFD with that name has NOT been registered + * <0 on errors + * + *------------------------------------------------------------------------- + */ +htri_t +H5FD_is_driver_registered_by_name(const char *driver_name, hid_t *registered_id) +{ + H5FD_get_driver_ud_t op_data; /* Callback info for driver search */ + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set up op data for iteration */ + op_data.key.kind = H5FD_GET_DRIVER_BY_NAME; + op_data.key.u.name = driver_name; + op_data.found_id = H5I_INVALID_HID; + + /* Find driver with name */ + if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADITER, FAIL, "can't iterate over VFDs") + + /* Found a driver with that name */ + if (op_data.found_id != H5I_INVALID_HID) { + if (registered_id) + *registered_id = op_data.found_id; + ret_value = TRUE; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_is_driver_registered_by_name() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_is_driver_registered_by_value + * + * Purpose: Checks if a driver with a particular value (ID) is + * registered. If `registered_id` is non-NULL and a driver + * with the specified value has been registered, the driver's + * ID will be returned in `registered_id`. + * + * Return: >0 if a VFD with that value has been registered + * 0 if a VFD with that value has NOT been registered + * <0 on errors + * + *------------------------------------------------------------------------- + */ +htri_t +H5FD_is_driver_registered_by_value(H5FD_class_value_t driver_value, hid_t *registered_id) +{ + H5FD_get_driver_ud_t op_data; /* Callback info for driver search */ + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set up op data for iteration */ + op_data.key.kind = H5FD_GET_DRIVER_BY_VALUE; + op_data.key.u.value = driver_value; + op_data.found_id = H5I_INVALID_HID; + + /* Find driver with value */ + if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADITER, FAIL, "can't iterate over VFDs") + + /* Found a driver with that value */ + if (op_data.found_id != H5I_INVALID_HID) { + if (registered_id) + *registered_id = op_data.found_id; + ret_value = TRUE; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_is_driver_registered_by_value() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_get_driver_id_by_name + * + * Purpose: Retrieves the ID for a registered VFL driver. + * + * Return: Positive if the VFL driver has been registered + * Negative on error (if the driver is not a valid driver or + * is not registered) + * + *------------------------------------------------------------------------- + */ +hid_t +H5FD_get_driver_id_by_name(const char *name, hbool_t is_api) +{ + H5FD_get_driver_ud_t op_data; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Set up op data for iteration */ + op_data.key.kind = H5FD_GET_DRIVER_BY_NAME; + op_data.key.u.name = name; + op_data.found_id = H5I_INVALID_HID; + + /* Find driver with specified name */ + if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VFL drivers") + + /* Found a driver with that name */ + if (op_data.found_id != H5I_INVALID_HID) { + ret_value = op_data.found_id; + if (H5I_inc_ref(ret_value, is_api) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_get_driver_id_by_name() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_get_driver_id_by_value + * + * Purpose: Retrieves the ID for a registered VFL driver. + * + * Return: Positive if the VFL driver has been registered + * Negative on error (if the driver is not a valid driver or + * is not registered) + * + *------------------------------------------------------------------------- + */ +hid_t +H5FD_get_driver_id_by_value(H5FD_class_value_t value, hbool_t is_api) +{ + H5FD_get_driver_ud_t op_data; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Set up op data for iteration */ + op_data.key.kind = H5FD_GET_DRIVER_BY_VALUE; + op_data.key.u.value = value; + op_data.found_id = H5I_INVALID_HID; + + /* Find driver with specified value */ + if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VFL drivers") + + /* Found a driver with that value */ + if (op_data.found_id != H5I_INVALID_HID) { + ret_value = op_data.found_id; + if (H5I_inc_ref(ret_value, is_api) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_get_driver_id_by_value() */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 87871ab..1828a88 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -180,42 +180,46 @@ static herr_t H5FD__log_unlock(H5FD_t *_file); static herr_t H5FD__log_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_log_g = { - "log", /* name */ - MAXADDR, /* maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD__log_term, /* terminate */ - NULL, /* sb_size */ - NULL, /* sb_encode */ - NULL, /* sb_decode */ - sizeof(H5FD_log_fapl_t), /* fapl_size */ - H5FD__log_fapl_get, /* fapl_get */ - H5FD__log_fapl_copy, /* fapl_copy */ - H5FD__log_fapl_free, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - H5FD__log_open, /* open */ - H5FD__log_close, /* close */ - H5FD__log_cmp, /* cmp */ - H5FD__log_query, /* query */ - NULL, /* get_type_map */ - H5FD__log_alloc, /* alloc */ - H5FD__log_free, /* free */ - H5FD__log_get_eoa, /* get_eoa */ - H5FD__log_set_eoa, /* set_eoa */ - H5FD__log_get_eof, /* get_eof */ - H5FD__log_get_handle, /* get_handle */ - H5FD__log_read, /* read */ - H5FD__log_write, /* write */ - NULL, /* flush */ - H5FD__log_truncate, /* truncate */ - H5FD__log_lock, /* lock */ - H5FD__log_unlock, /* unlock */ - H5FD__log_delete, /* del */ - NULL, /* ctl */ - H5FD_FLMAP_DICHOTOMY /* fl_map */ + H5FD_LOG_VALUE, /* value */ + "log", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__log_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_log_fapl_t), /* fapl_size */ + H5FD__log_fapl_get, /* fapl_get */ + H5FD__log_fapl_copy, /* fapl_copy */ + H5FD__log_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__log_open, /* open */ + H5FD__log_close, /* close */ + H5FD__log_cmp, /* cmp */ + H5FD__log_query, /* query */ + NULL, /* get_type_map */ + H5FD__log_alloc, /* alloc */ + H5FD__log_free, /* free */ + H5FD__log_get_eoa, /* get_eoa */ + H5FD__log_set_eoa, /* set_eoa */ + H5FD__log_get_eof, /* get_eof */ + H5FD__log_get_handle, /* get_handle */ + H5FD__log_read, /* read */ + H5FD__log_write, /* write */ + NULL, /* flush */ + H5FD__log_truncate, /* truncate */ + H5FD__log_lock, /* lock */ + H5FD__log_unlock, /* unlock */ + H5FD__log_delete, /* del */ + NULL, /* ctl */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; +/* Default configuration, if none provided */ +static const H5FD_log_fapl_t H5FD_log_default_config_g = {NULL, H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC, 4096}; + /* Declare a free list to manage the H5FD_log_t struct */ H5FL_DEFINE_STATIC(H5FD_log_t); @@ -237,7 +241,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC /* Check the use disabled file locks environment variable */ - lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */ else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) @@ -348,7 +352,7 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si fa.flags = flags; fa.buf_size = buf_size; - ret_value = H5P_set_driver(plist, H5FD_LOG, &fa); + ret_value = H5P_set_driver(plist, H5FD_LOG, &fa, NULL); done: if (fa.logfile) @@ -483,10 +487,11 @@ static H5FD_t * H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_log_t * file = NULL; - H5P_genplist_t * plist; /* Property list */ - const H5FD_log_fapl_t *fa; /* File access property list information */ - int fd = -1; /* File descriptor */ - int o_flags; /* Flags for open() call */ + H5P_genplist_t * plist; /* Property list */ + const H5FD_log_fapl_t *fa; /* File access property list information */ + H5FD_log_fapl_t default_fa = H5FD_log_default_config_g; + int fd = -1; /* File descriptor */ + int o_flags; /* Flags for open() call */ #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -524,8 +529,10 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the driver specific information */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if (NULL == (fa = (const H5FD_log_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") + if (NULL == (fa = (const H5FD_log_fapl_t *)H5P_peek_driver_info(plist))) { + /* Use default driver configuration*/ + fa = &default_fa; + } /* Start timer for open() call */ if (fa->flags & H5FD_LOG_TIME_OPEN) diff --git a/src/H5FDlog.h b/src/H5FDlog.h index 969c091..bc96c52 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -20,7 +20,8 @@ #ifndef H5FDlog_H #define H5FDlog_H -#define H5FD_LOG (H5FD_log_init()) +#define H5FD_LOG (H5FD_log_init()) +#define H5FD_LOG_VALUE H5_VFD_LOG /* Flags for H5Pset_fapl_log() */ /* Flags for tracking 'meta' operations (truncate) */ diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index d539f4d..738e9d5 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -160,6 +160,7 @@ static herr_t H5FD__mirror_unlock(H5FD_t *_file); static herr_t H5FD__mirror_verify_reply(H5FD_mirror_t *file); static const H5FD_class_t H5FD_mirror_g = { + H5FD_MIRROR_VALUE, /* value */ "mirror", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -1336,7 +1337,7 @@ H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa) if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa->version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown fapl_t version"); - ret_value = H5P_set_driver(plist, H5FD_MIRROR, (const void *)fa); + ret_value = H5P_set_driver(plist, H5FD_MIRROR, (const void *)fa, NULL); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5FDmirror.h b/src/H5FDmirror.h index 49e24c1..66954b1 100644 --- a/src/H5FDmirror.h +++ b/src/H5FDmirror.h @@ -19,7 +19,8 @@ #ifdef H5_HAVE_MIRROR_VFD -#define H5FD_MIRROR (H5FD_mirror_init()) +#define H5FD_MIRROR (H5FD_mirror_init()) +#define H5FD_MIRROR_VALUE H5_VFD_MIRROR #ifdef __cplusplus extern "C" { diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 7c85897..f4d3fed 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -45,6 +45,9 @@ static hid_t H5FD_MPIO_g = 0; /* (Can be changed by setting "HDF5_MPI_OPT_TYPES" environment variable to '0' or '1') */ hbool_t H5FD_mpi_opt_types_g = TRUE; +/* Whether the driver initialized MPI on its own */ +hbool_t H5FD_mpi_self_initialized = FALSE; + /* * The view is set to this value */ @@ -92,6 +95,7 @@ static herr_t H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, c /* The MPIO file driver information */ static const H5FD_class_t H5FD_mpio_g = { + H5_VFD_MPIO, /* value */ "mpio", /* name */ HADDR_MAX, /* maxaddr */ H5F_CLOSE_SEMI, /* fc_degree */ @@ -233,6 +237,7 @@ hid_t H5FD_mpio_init(void) { static int H5FD_mpio_Debug_inited = 0; + char * env = NULL; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -241,6 +246,21 @@ H5FD_mpio_init(void) if (H5I_VFL != H5I_get_type(H5FD_MPIO_g)) H5FD_MPIO_g = H5FD_register((const H5FD_class_t *)&H5FD_mpio_g, sizeof(H5FD_class_t), FALSE); + /* Check if MPI driver has been loaded dynamically */ + env = HDgetenv(HDF5_DRIVER); + if (env && !HDstrcmp(env, "mpio")) { + int mpi_initialized = 0; + + /* Initialize MPI if not already initialized */ + if (MPI_SUCCESS != MPI_Initialized(&mpi_initialized)) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, H5I_INVALID_HID, "can't check if MPI is initialized") + if (!mpi_initialized) { + if (MPI_SUCCESS != MPI_Init(NULL, NULL)) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "can't initialize MPI") + H5FD_mpi_self_initialized = TRUE; + } + } + if (!H5FD_mpio_Debug_inited) { const char *s; /* String for environment variables */ @@ -286,6 +306,17 @@ H5FD__mpio_term(void) { FUNC_ENTER_STATIC_NOERR + /* Terminate MPI if the driver initialized it */ + if (H5FD_mpi_self_initialized) { + int mpi_finalized = 0; + + MPI_Finalized(&mpi_finalized); + if (!mpi_finalized) + MPI_Finalize(); + + H5FD_mpi_self_initialized = FALSE; + } + /* Reset VFL ID */ H5FD_MPIO_g = 0; @@ -347,7 +378,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI info object") /* duplication is done during driver setting. */ - ret_value = H5P_set_driver(plist, H5FD_MPIO, NULL); + ret_value = H5P_set_driver(plist, H5FD_MPIO, NULL, NULL); done: FUNC_LEAVE_API(ret_value) @@ -802,11 +833,16 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - /* Get the MPI communicator and info object from the property list */ - if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator") - if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object") + if (H5FD_mpi_self_initialized) { + comm = MPI_COMM_WORLD; + } + else { + /* Get the MPI communicator and info object from the property list */ + if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator") + if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object") + } /* Get the MPI rank of this process and the total number of processes */ if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank))) @@ -1768,11 +1804,16 @@ H5FD__mpio_delete(const char *filename, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") HDassert(H5FD_MPIO == H5P_peek_driver(plist)); - /* Get the MPI communicator and info from the fapl */ - if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI info object") - if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator") + if (H5FD_mpi_self_initialized) { + comm = MPI_COMM_WORLD; + } + else { + /* Get the MPI communicator and info from the fapl */ + if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI info object") + if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator") + } /* Get the MPI rank of this process */ if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank))) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 0d1967d..3dcfa37 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -135,8 +135,13 @@ typedef struct H5FD_multi_dxpl_t { } H5FD_multi_dxpl_t; /* Private functions */ -static int compute_next(H5FD_multi_t *file); -static int open_members(H5FD_multi_t *file); +static herr_t H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char *raw_ext, + hid_t raw_plist_id, hbool_t relax, H5FD_multi_fapl_t *fa_out); +static herr_t H5FD_multi_populate_config(const H5FD_mem_t *memb_map, const hid_t *memb_fapl, + const char *const *memb_name, const haddr_t *memb_addr, + hbool_t relax, H5FD_multi_fapl_t *fa_out); +static int compute_next(H5FD_multi_t *file); +static int open_members(H5FD_multi_t *file); /* Callback prototypes */ static herr_t H5FD_multi_term(void); @@ -171,6 +176,7 @@ static herr_t H5FD_multi_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, c /* The class struct */ static const H5FD_class_t H5FD_multi_g = { + H5_VFD_MULTI, /* value */ "multi", /* name */ HADDR_MAX, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -274,74 +280,19 @@ herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const char *raw_ext, hid_t raw_plist_id) { - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char meta_name[H5FD_MULT_MAX_FILE_NAME_LEN]; - char raw_name[H5FD_MULT_MAX_FILE_NAME_LEN]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + H5FD_multi_fapl_t fa; + static const char *func = "H5Pset_fapl_split"; /* Function Name for error reporting */ /*NO TRACE*/ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - /* Initialize */ - ALL_MEMBERS (mt) { - /* Treat global heap as raw data, not metadata */ - memb_map[mt] = ((mt == H5FD_MEM_DRAW || mt == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : H5FD_MEM_SUPER); - memb_fapl[mt] = -1; - memb_name[mt] = NULL; - memb_addr[mt] = HADDR_UNDEF; - } - END_MEMBERS; - - /* The file access properties */ - memb_fapl[H5FD_MEM_SUPER] = meta_plist_id; - memb_fapl[H5FD_MEM_DRAW] = raw_plist_id; - - /* The names */ - /* process meta filename */ - if (meta_ext) { - if (strstr(meta_ext, "%s")) { - /* Note: this doesn't accommodate for when the '%s' in the user's - * string is at a position >sizeof(meta_name) - QK & JK - 2013/01/17 - */ - strncpy(meta_name, meta_ext, sizeof(meta_name)); - meta_name[sizeof(meta_name) - 1] = '\0'; - } - else - sprintf(meta_name, "%%s%s", meta_ext); - } - else { - strncpy(meta_name, "%s.meta", sizeof(meta_name)); - meta_name[sizeof(meta_name) - 1] = '\0'; - } - memb_name[H5FD_MEM_SUPER] = meta_name; - - /* process raw filename */ - if (raw_ext) { - if (strstr(raw_ext, "%s")) { - /* Note: this doesn't accommodate for when the '%s' in the user's - * string is at a position >sizeof(raw_name) - QK & JK - 2013/01/17 - */ - strncpy(raw_name, raw_ext, sizeof(raw_name)); - raw_name[sizeof(raw_name) - 1] = '\0'; - } - else - sprintf(raw_name, "%%s%s", raw_ext); - } - else { - strncpy(raw_name, "%s.raw", sizeof(raw_name)); - raw_name[sizeof(raw_name) - 1] = '\0'; - } - memb_name[H5FD_MEM_DRAW] = raw_name; - - /* The sizes */ - memb_addr[H5FD_MEM_SUPER] = 0; - memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2; + if (H5FD_split_populate_config(meta_ext, meta_plist_id, raw_ext, raw_plist_id, TRUE, &fa) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "can't setup split driver configuration", + -1); - return H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE); + return H5Pset_driver(fapl, H5FD_MULTI, &fa); } /*------------------------------------------------------------------------- @@ -425,14 +376,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f const char *const *memb_name, const haddr_t *memb_addr, hbool_t relax) { H5FD_multi_fapl_t fa; - H5FD_mem_t mt, mmt; - H5FD_mem_t _memb_map[H5FD_MEM_NTYPES]; - hid_t _memb_fapl[H5FD_MEM_NTYPES]; - char _memb_name[H5FD_MEM_NTYPES][16]; - const char * _memb_name_ptrs[H5FD_MEM_NTYPES]; - haddr_t _memb_addr[H5FD_MEM_NTYPES]; - static const char *letters = "Xsbrglo"; - static const char *func = "H5FDset_fapl_multi"; /* Function Name for error reporting */ + static const char *func = "H5FDset_fapl_multi"; /* Function Name for error reporting */ /*NO TRACE*/ @@ -442,66 +386,9 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f /* Check arguments and supply default values */ if (H5I_GENPROP_LST != H5Iget_type(fapl_id) || TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "not an access list", -1); - if (!memb_map) { - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) - _memb_map[mt] = H5FD_MEM_DEFAULT; - memb_map = _memb_map; - } - if (!memb_fapl) { - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) - _memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS); - memb_fapl = _memb_fapl; - } - if (!memb_name) { - assert(strlen(letters) == H5FD_MEM_NTYPES); - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - sprintf(_memb_name[mt], "%%s-%c.h5", letters[mt]); - _memb_name_ptrs[mt] = _memb_name[mt]; - } - memb_name = _memb_name_ptrs; - } - if (!memb_addr) { - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) - _memb_addr[mt] = (hsize_t)(mt ? (mt - 1) : 0) * (HADDR_MAX / (H5FD_MEM_NTYPES - 1)); - memb_addr = _memb_addr; - } - - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - /* Map usage type */ - mmt = memb_map[mt]; - if (mmt < 0 || mmt >= H5FD_MEM_NTYPES) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1); - if (H5FD_MEM_DEFAULT == mmt) - mmt = mt; + if (H5FD_multi_populate_config(memb_map, memb_fapl, memb_name, memb_addr, relax, &fa) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "can't setup driver configuration", -1); - /* - * All members of MEMB_FAPL must be either defaults or actual file - * access property lists. - */ - if (H5P_DEFAULT != memb_fapl[mmt] && TRUE != H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1); - - /* All names must be defined */ - if (!memb_name[mmt] || !memb_name[mmt][0]) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1); - } - - /* - * Initialize driver specific information. No need to copy it into the FA - * struct since all members will be copied by H5Pset_driver(). - */ - memset(&fa, 0, sizeof(H5FD_multi_fapl_t)); - memcpy(fa.memb_map, memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t)); - memcpy(fa.memb_fapl, memb_fapl, H5FD_MEM_NTYPES * sizeof(hid_t)); - memcpy(fa.memb_name, memb_name, H5FD_MEM_NTYPES * sizeof(char *)); - memcpy(fa.memb_addr, memb_addr, H5FD_MEM_NTYPES * sizeof(haddr_t)); - fa.relax = relax; - - /* Patch up H5P_DEFAULT property lists for members */ - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { - if (fa.memb_fapl[mt] == H5P_DEFAULT) - fa.memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS); - } return H5Pset_driver(fapl_id, H5FD_MULTI, &fa); } @@ -526,6 +413,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl char **memb_name /*out*/, haddr_t *memb_addr /*out*/, hbool_t *relax) { const H5FD_multi_fapl_t *fa; + H5FD_multi_fapl_t default_fa; H5FD_mem_t mt; static const char * func = "H5FDget_fapl_multi"; /* Function Name for error reporting */ @@ -538,8 +426,17 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", -1); if (H5FD_MULTI != H5Pget_driver(fapl_id)) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1); - if (NULL == (fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id))) - H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1); + H5E_BEGIN_TRY + { + fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); + } + H5E_END_TRY; + if (!fa || (H5P_FILE_ACCESS_DEFAULT == fapl_id)) { + if (H5FD_multi_populate_config(NULL, NULL, NULL, NULL, TRUE, &default_fa) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup default driver configuration", + -1); + fa = &default_fa; + } if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t)); @@ -568,6 +465,231 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl } /*------------------------------------------------------------------------- + * Function: H5FD_split_populate_config + * + * Purpose: Populates a H5FD_multi_fapl_t structure with the provided + * split driver values, supplying defaults where values are not + * provided. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char *raw_ext, hid_t raw_plist_id, + hbool_t relax, H5FD_multi_fapl_t *fa_out) +{ + static const char *func = "H5FD_split_populate_config"; /* Function Name for error reporting */ + static char + meta_name_g[H5FD_MULT_MAX_FILE_NAME_LEN]; /* Static scratch buffer to store metadata member name */ + static char + raw_name_g[H5FD_MULT_MAX_FILE_NAME_LEN]; /* Static scratch buffer to store raw data member name */ + const char *_memb_name[H5FD_MEM_NTYPES]; + H5FD_mem_t _memb_map[H5FD_MEM_NTYPES]; + hid_t _memb_fapl[H5FD_MEM_NTYPES]; + haddr_t _memb_addr[H5FD_MEM_NTYPES]; + herr_t ret_value = 0; + + assert(fa_out); + + /* Initialize */ + ALL_MEMBERS (mt) { + /* Treat global heap as raw data, not metadata */ + _memb_map[mt] = ((mt == H5FD_MEM_DRAW || mt == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : H5FD_MEM_SUPER); + _memb_fapl[mt] = H5P_DEFAULT; + _memb_name[mt] = NULL; + _memb_addr[mt] = HADDR_UNDEF; + } + END_MEMBERS; + + /* The file access properties */ + _memb_fapl[H5FD_MEM_SUPER] = meta_plist_id; + _memb_fapl[H5FD_MEM_DRAW] = raw_plist_id; + + /* The names */ + /* process meta filename */ + if (meta_ext) { + if (strstr(meta_ext, "%s")) { + /* Note: this doesn't accommodate for when the '%s' in the user's + * string is at a position >sizeof(meta_name) - QK & JK - 2013/01/17 + */ + strncpy(meta_name_g, meta_ext, sizeof(meta_name_g)); + meta_name_g[sizeof(meta_name_g) - 1] = '\0'; + } + else + sprintf(meta_name_g, "%%s%s", meta_ext); + } + else { + strncpy(meta_name_g, "%s.meta", sizeof(meta_name_g)); + meta_name_g[sizeof(meta_name_g) - 1] = '\0'; + } + _memb_name[H5FD_MEM_SUPER] = meta_name_g; + + /* process raw filename */ + if (raw_ext) { + if (strstr(raw_ext, "%s")) { + /* Note: this doesn't accommodate for when the '%s' in the user's + * string is at a position >sizeof(raw_name) - QK & JK - 2013/01/17 + */ + strncpy(raw_name_g, raw_ext, sizeof(raw_name_g)); + raw_name_g[sizeof(raw_name_g) - 1] = '\0'; + } + else + sprintf(raw_name_g, "%%s%s", raw_ext); + } + else { + strncpy(raw_name_g, "%s.raw", sizeof(raw_name_g)); + raw_name_g[sizeof(raw_name_g) - 1] = '\0'; + } + _memb_name[H5FD_MEM_DRAW] = raw_name_g; + + /* The sizes */ + _memb_addr[H5FD_MEM_SUPER] = 0; + _memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2; + + ALL_MEMBERS (mt) { + /* Map usage type */ + H5FD_mem_t mmt = _memb_map[mt]; + if (mmt < 0 || mmt >= H5FD_MEM_NTYPES) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1); + + /* + * All members of MEMB_FAPL must be either defaults or actual file + * access property lists. + */ + if (H5P_DEFAULT != _memb_fapl[mmt] && TRUE != H5Pisa_class(_memb_fapl[mmt], H5P_FILE_ACCESS)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1); + + /* All names must be defined */ + if (!_memb_name[mmt] || !_memb_name[mmt][0]) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1); + } + END_MEMBERS; + + /* + * Initialize driver specific information. No need to copy it into the FA + * struct since all members will be copied by H5Pset_driver(). + */ + memset(fa_out, 0, sizeof(H5FD_multi_fapl_t)); + memcpy(fa_out->memb_map, _memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t)); + memcpy(fa_out->memb_fapl, _memb_fapl, H5FD_MEM_NTYPES * sizeof(hid_t)); + memcpy(fa_out->memb_name, _memb_name, H5FD_MEM_NTYPES * sizeof(char *)); + memcpy(fa_out->memb_addr, _memb_addr, H5FD_MEM_NTYPES * sizeof(haddr_t)); + fa_out->relax = relax; + + /* Patch up H5P_DEFAULT property lists for members */ + ALL_MEMBERS (mt) { + if (fa_out->memb_fapl[mt] == H5P_DEFAULT) { + fa_out->memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS); + if (H5Pset_fapl_sec2(fa_out->memb_fapl[mt]) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, + "can't set sec2 driver on member FAPL", -1); + } + } + END_MEMBERS; + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Function: H5FD_multi_populate_config + * + * Purpose: Populates a H5FD_multi_fapl_t structure with the provided + * values, supplying defaults where values are not provided. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_multi_populate_config(const H5FD_mem_t *memb_map, const hid_t *memb_fapl, const char *const *memb_name, + const haddr_t *memb_addr, hbool_t relax, H5FD_multi_fapl_t *fa_out) +{ + static const char *func = "H5FD_multi_populate_config"; /* Function Name for error reporting */ + static const char *letters = "Xsbrglo"; + static char _memb_name_g[H5FD_MEM_NTYPES][16]; /* Static scratch buffer to store member names */ + H5FD_mem_t mt, mmt; + H5FD_mem_t _memb_map[H5FD_MEM_NTYPES]; + hid_t _memb_fapl[H5FD_MEM_NTYPES]; + const char * _memb_name_ptrs[H5FD_MEM_NTYPES]; + haddr_t _memb_addr[H5FD_MEM_NTYPES]; + herr_t ret_value = 0; + + assert(fa_out); + + if (!memb_map) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) + _memb_map[mt] = H5FD_MEM_DEFAULT; + memb_map = _memb_map; + } + if (!memb_fapl) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { + _memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS); + if (H5Pset_fapl_sec2(_memb_fapl[mt]) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, + "can't set sec2 driver on member FAPL", -1); + } + memb_fapl = _memb_fapl; + } + if (!memb_name) { + assert(strlen(letters) == H5FD_MEM_NTYPES); + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { + sprintf(_memb_name_g[mt], "%%s-%c.h5", letters[mt]); + _memb_name_ptrs[mt] = _memb_name_g[mt]; + } + memb_name = _memb_name_ptrs; + } + if (!memb_addr) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) + _memb_addr[mt] = (hsize_t)(mt ? (mt - 1) : 0) * (HADDR_MAX / (H5FD_MEM_NTYPES - 1)); + memb_addr = _memb_addr; + } + + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { + /* Map usage type */ + mmt = memb_map[mt]; + if (mmt < 0 || mmt >= H5FD_MEM_NTYPES) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1); + if (H5FD_MEM_DEFAULT == mmt) + mmt = mt; + + /* + * All members of MEMB_FAPL must be either defaults or actual file + * access property lists. + */ + if (H5P_DEFAULT != memb_fapl[mmt] && TRUE != H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS)) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1); + + /* All names must be defined */ + if (!memb_name[mmt] || !memb_name[mmt][0]) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1); + } + + /* + * Initialize driver specific information. No need to copy it into the FA + * struct since all members will be copied by H5Pset_driver(). + */ + memset(fa_out, 0, sizeof(H5FD_multi_fapl_t)); + memcpy(fa_out->memb_map, memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t)); + memcpy(fa_out->memb_fapl, memb_fapl, H5FD_MEM_NTYPES * sizeof(hid_t)); + memcpy(fa_out->memb_name, memb_name, H5FD_MEM_NTYPES * sizeof(char *)); + memcpy(fa_out->memb_addr, memb_addr, H5FD_MEM_NTYPES * sizeof(haddr_t)); + fa_out->relax = relax; + + /* Patch up H5P_DEFAULT property lists for members */ + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { + if (fa_out->memb_fapl[mt] == H5P_DEFAULT) { + fa_out->memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS); + if (H5Pset_fapl_sec2(fa_out->memb_fapl[mt]) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, + "can't set sec2 driver on member FAPL", -1); + } + } + + return ret_value; +} /* end H5FD_multi_populate_config() */ + +/*------------------------------------------------------------------------- * Function: H5FD_multi_sb_size * * Purpose: Returns the size of the private information to be stored in @@ -1012,12 +1134,26 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr */ if (NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t)))) H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL); - if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MULTI != H5Pget_driver(fapl_id)) { + H5E_BEGIN_TRY + { + fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); + } + H5E_END_TRY; + if (!fa || (H5P_FILE_ACCESS_DEFAULT == fapl_id) || (H5FD_MULTI != H5Pget_driver(fapl_id))) { + char *env = getenv(HDF5_DRIVER); + close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0) - H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) + if (env && !strcmp(env, "split")) { + if (H5Pset_fapl_split(fapl_id, NULL, H5P_DEFAULT, NULL, H5P_DEFAULT) < 0) + H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) + } + else { + if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0) + H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) + } + + fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); } - fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); assert(fa); ALL_MEMBERS (mt) { file->fa.memb_map[mt] = fa->memb_map[mt]; @@ -2040,6 +2176,7 @@ H5FD_multi_delete(const char *filename, hid_t fapl_id) char full_filename[H5FD_MULT_MAX_FILE_NAME_LEN]; int nchars; const H5FD_multi_fapl_t *fa; + H5FD_multi_fapl_t default_fa; static const char * func = "H5FD_multi_delete"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -2047,11 +2184,26 @@ H5FD_multi_delete(const char *filename, hid_t fapl_id) assert(filename); - /* Quiet compiler */ - (void)fapl_id; - /* Get the driver info */ - fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); + H5E_BEGIN_TRY + { + fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); + } + H5E_END_TRY; + if (!fa) { + char *env = getenv(HDF5_DRIVER); + + if (env && !strcmp(env, "split")) { + if (H5FD_split_populate_config(NULL, H5P_DEFAULT, NULL, H5P_DEFAULT, TRUE, &default_fa) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup driver configuration", -1); + } + else { + if (H5FD_multi_populate_config(NULL, NULL, NULL, NULL, TRUE, &default_fa) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup driver configuration", -1); + } + + fa = &default_fa; + } assert(fa); /* Delete each member file using the underlying fapl */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 6dbd483..fa562f9 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -81,12 +81,19 @@ typedef struct { } \ } -/* Define structure to hold driver ID & info for FAPLs */ +/* Define structure to hold driver ID, info & configuration string for FAPLs */ typedef struct { - hid_t driver_id; /* Driver's ID */ - const void *driver_info; /* Driver info, for open callbacks */ + hid_t driver_id; /* Driver's ID */ + const void *driver_info; /* Driver info, for open callbacks */ + const char *driver_config_str; /* Driver configuration string */ } H5FD_driver_prop_t; +/* Which kind of VFD field to use for searching */ +typedef enum H5FD_get_driver_kind_t { + H5FD_GET_DRIVER_BY_NAME, /* Name field is set */ + H5FD_GET_DRIVER_BY_VALUE /* Value field is set */ +} H5FD_get_driver_kind_t; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -97,6 +104,7 @@ typedef struct { /* Forward declarations for prototype arguments */ struct H5F_t; +union H5PL_key_t; H5_DLL int H5FD_term_interface(void); H5_DLL herr_t H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr); @@ -107,10 +115,17 @@ H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t H5_DLL void * H5FD_fapl_get(H5FD_t *file); H5_DLL herr_t H5FD_free_driver_info(hid_t driver_id, const void *driver_info); H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref); +H5_DLL hid_t H5FD_register_driver_by_name(const char *name, hbool_t app_ref); +H5_DLL hid_t H5FD_register_driver_by_value(H5FD_class_value_t value, hbool_t app_ref); +H5_DLL htri_t H5FD_is_driver_registered_by_name(const char *driver_name, hid_t *registered_id); +H5_DLL htri_t H5FD_is_driver_registered_by_value(H5FD_class_value_t driver_value, hid_t *registered_id); +H5_DLL hid_t H5FD_get_driver_id_by_name(const char *name, hbool_t is_api); +H5_DLL hid_t H5FD_get_driver_id_by_value(H5FD_class_value_t value, hbool_t is_api); H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); H5_DLL herr_t H5FD_close(H5FD_t *file); H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2); H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/); +H5_DLL herr_t H5FD_check_plugin_load(const H5FD_class_t *cls, const union H5PL_key_t *key, hbool_t *success); H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size); H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, haddr_t addr, hsize_t size); diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index b8f4f12..a72dc80 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -28,6 +28,39 @@ #define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */ +/* VFD identifier values + * These are H5FD_class_value_t values, NOT hid_t values! + */ +#define H5_VFD_INVALID ((H5FD_class_value_t)(-1)) +#define H5_VFD_SEC2 ((H5FD_class_value_t)(0)) +#define H5_VFD_CORE ((H5FD_class_value_t)(1)) +#define H5_VFD_LOG ((H5FD_class_value_t)(2)) +#define H5_VFD_FAMILY ((H5FD_class_value_t)(3)) +#define H5_VFD_MULTI ((H5FD_class_value_t)(4)) +#define H5_VFD_STDIO ((H5FD_class_value_t)(5)) +#define H5_VFD_SPLITTER ((H5FD_class_value_t)(6)) +#ifdef H5_HAVE_PARALLEL +#define H5_VFD_MPIO ((H5FD_class_value_t)(7)) +#endif +#ifdef H5_HAVE_DIRECT +#define H5_VFD_DIRECT ((H5FD_class_value_t)(8)) +#endif +#ifdef H5_HAVE_MIRROR_VFD +#define H5_VFD_MIRROR ((H5FD_class_value_t)(9)) +#endif +#ifdef H5_HAVE_LIBHDFS +#define H5_VFD_HDFS ((H5FD_class_value_t)(10)) +#endif +#ifdef H5_HAVE_ROS3_VFD +#define H5_VFD_ROS3 ((H5FD_class_value_t)(11)) +#endif + +/* VFD IDs below this value are reserved for library use. */ +#define H5_VFD_RESERVED 256 + +/* Maximum VFD ID */ +#define H5_VFD_MAX 65535 + /* Define VFL driver features that can be enabled on a per-driver basis */ /* These are returned with the 'query' function pointer in H5FD_class_t */ /* @@ -213,6 +246,16 @@ /* Public Typedefs */ /*******************/ +/* + * File driver identifiers. + * + * Values 0 through 255 are for drivers defined by the HDF5 library. + * Values 256 through 511 are available for testing new drivers. + * Subsequent values should be obtained from the HDF5 development + * team at mailto:help@hdfgroup.org. + */ +typedef int H5FD_class_value_t; + /* Types of allocation requests: see H5Fpublic.h */ typedef enum H5F_mem_t H5FD_mem_t; diff --git a/src/H5FDros3.c b/src/H5FDros3.c index a32d65e..2ffee17 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -237,6 +237,7 @@ static herr_t H5FD__ros3_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing static herr_t H5FD__ros3_validate_config(const H5FD_ros3_fapl_t *fa); static const H5FD_class_t H5FD_ros3_g = { + H5FD_ROS3_VALUE, /* value */ "ros3", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -411,7 +412,7 @@ H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa) if (FAIL == H5FD__ros3_validate_config(fa)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid ros3 config") - ret_value = H5P_set_driver(plist, H5FD_ROS3, (void *)fa); + ret_value = H5P_set_driver(plist, H5FD_ROS3, (void *)fa, NULL); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 8e42ca2..d69ebe4 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -22,9 +22,11 @@ #define H5FDros3_H #ifdef H5_HAVE_ROS3_VFD -#define H5FD_ROS3 (H5FD_ros3_init()) +#define H5FD_ROS3 (H5FD_ros3_init()) +#define H5FD_ROS3_VALUE H5_VFD_ROS3 #else -#define H5FD_ROS3 (H5I_INVALID_HID) +#define H5FD_ROS3 (H5I_INVALID_HID) +#define H5FD_ROS3_VALUE H5_VFD_INVALID #endif /* H5_HAVE_ROS3_VFD */ #ifdef H5_HAVE_ROS3_VFD diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 15103da..2dbdd6f 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -143,6 +143,7 @@ static herr_t H5FD__sec2_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, c void **output); static const H5FD_class_t H5FD_sec2_g = { + H5FD_SEC2_VALUE, /* value */ "sec2", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -200,7 +201,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC /* Check the use disabled file locks environment variable */ - lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */ else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) @@ -295,7 +296,7 @@ H5Pset_fapl_sec2(hid_t fapl_id) if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - ret_value = H5P_set_driver(plist, H5FD_SEC2, NULL); + ret_value = H5P_set_driver(plist, H5FD_SEC2, NULL, NULL); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5FDsec2.h b/src/H5FDsec2.h index 541ac71..5c35677 100644 --- a/src/H5FDsec2.h +++ b/src/H5FDsec2.h @@ -20,7 +20,8 @@ #ifndef H5FDsec2_H #define H5FDsec2_H -#define H5FD_SEC2 (H5FD_sec2_init()) +#define H5FD_SEC2 (H5FD_sec2_init()) +#define H5FD_SEC2_VALUE H5_VFD_SEC2 #ifdef __cplusplus extern "C" { diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 3113e8b..321973e 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -104,6 +104,10 @@ static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr); /* Prototypes */ static herr_t H5FD__splitter_term(void); +static herr_t H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, + H5FD_splitter_fapl_t * fapl_out); +static herr_t H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, + const char *base_filename); static hsize_t H5FD__splitter_sb_size(H5FD_t *_file); static herr_t H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out*/); static herr_t H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); @@ -129,10 +133,12 @@ static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closin static herr_t H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__splitter_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__splitter_unlock(H5FD_t *_file); +static herr_t H5FD__splitter_delete(const char *filename, hid_t fapl_id); static herr_t H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, void **output); static const H5FD_class_t H5FD_splitter_g = { + H5FD_SPLITTER_VALUE, /* value */ "splitter", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -140,7 +146,7 @@ static const H5FD_class_t H5FD_splitter_g = { H5FD__splitter_sb_size, /* sb_size */ H5FD__splitter_sb_encode, /* sb_encode */ H5FD__splitter_sb_decode, /* sb_decode */ - sizeof(H5FD_splitter_fapl_t), /* fapl_size */ + sizeof(H5FD_splitter_fapl_t), /* fapl_size */ H5FD__splitter_fapl_get, /* fapl_get */ H5FD__splitter_fapl_copy, /* fapl_copy */ H5FD__splitter_fapl_free, /* fapl_free */ @@ -151,7 +157,7 @@ static const H5FD_class_t H5FD_splitter_g = { H5FD__splitter_close, /* close */ H5FD__splitter_cmp, /* cmp */ H5FD__splitter_query, /* query */ - H5FD__splitter_get_type_map, /* get_type_map */ + H5FD__splitter_get_type_map, /* get_type_map */ H5FD__splitter_alloc, /* alloc */ H5FD__splitter_free, /* free */ H5FD__splitter_get_eoa, /* get_eoa */ @@ -164,7 +170,7 @@ static const H5FD_class_t H5FD_splitter_g = { H5FD__splitter_truncate, /* truncate */ H5FD__splitter_lock, /* lock */ H5FD__splitter_unlock, /* unlock */ - NULL, /* del */ + H5FD__splitter_delete, /* del */ H5FD__splitter_ctl, /* ctl */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -312,57 +318,14 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid property list") - /* Make sure that the W/O channel supports write-only capability. - * Some drivers (e.g. family or multi) do revision of the superblock - * in-memory, causing problems in that channel. - * Uses the feature flag H5FD_FEAT_DEFAULT_VFD_COMPATIBLE as the - * determining attribute. - */ - if (H5P_DEFAULT != vfd_config->wo_fapl_id) { - H5FD_class_t * wo_driver = NULL; - H5FD_driver_prop_t wo_driver_prop; - H5P_genplist_t * wo_plist_ptr = NULL; - unsigned long wo_driver_flags = 0; - - wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id); - if (NULL == wo_plist_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") - wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id); - if (NULL == wo_driver) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") - if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags") - if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver") - } /* end if W/O VFD is non-default */ - info = H5FL_CALLOC(H5FD_splitter_fapl_t); if (NULL == info) 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 + 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) { - if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - info->rw_fapl_id = vfd_config->rw_fapl_id; - } - if (H5P_DEFAULT != vfd_config->wo_fapl_id) { - if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - info->wo_fapl_id = vfd_config->wo_fapl_id; - } + if (H5FD__splitter_populate_config(vfd_config, info) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't setup driver configuration") - ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info); + ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info, NULL); done: if (info) @@ -386,9 +349,10 @@ done: herr_t H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) { - const H5FD_splitter_fapl_t *fapl_ptr = NULL; - H5P_genplist_t * plist_ptr = NULL; - herr_t ret_value = SUCCEED; + const H5FD_splitter_fapl_t *fapl_ptr = NULL; + H5FD_splitter_fapl_t * default_fapl = NULL; + H5P_genplist_t * plist_ptr = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", fapl_id, config); @@ -414,8 +378,14 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if (H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - 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") + fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr); + if (NULL == fapl_ptr) { + if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") + if (H5FD__splitter_populate_config(NULL, default_fapl) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info") + fapl_ptr = default_fapl; + } 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); @@ -428,10 +398,188 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy W/O FAPL"); done: + if (default_fapl) + H5FL_FREE(H5FD_splitter_fapl_t, default_fapl); + FUNC_LEAVE_API(ret_value) } /* end H5Pget_fapl_splitter() */ /*------------------------------------------------------------------------- + * Function: H5FD__splitter_populate_config + * + * Purpose: Populates a H5FD_splitter_fapl_t structure with the provided + * values, supplying defaults where values are not provided. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_splitter_fapl_t *fapl_out) +{ + H5P_genplist_t *def_plist; + H5P_genplist_t *plist; + hbool_t free_config = FALSE; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(fapl_out); + + HDmemset(fapl_out, 0, sizeof(H5FD_splitter_fapl_t)); + + if (!vfd_config) { + vfd_config = H5MM_calloc(sizeof(H5FD_splitter_vfd_config_t)); + if (NULL == vfd_config) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") + + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->rw_fapl_id = H5P_DEFAULT; + vfd_config->wo_fapl_id = H5P_DEFAULT; + + free_config = TRUE; + } + + /* Make sure that the W/O channel supports write-only capability. + * Some drivers (e.g. family or multi) do revision of the superblock + * in-memory, causing problems in that channel. + * Uses the feature flag H5FD_FEAT_DEFAULT_VFD_COMPATIBLE as the + * determining attribute. + */ + if (H5P_DEFAULT != vfd_config->wo_fapl_id) { + H5FD_class_t * wo_driver = NULL; + H5FD_driver_prop_t wo_driver_prop; + H5P_genplist_t * wo_plist_ptr = NULL; + unsigned long wo_driver_flags = 0; + + wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id); + if (NULL == wo_plist_ptr) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") + wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id); + if (NULL == wo_driver) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") + if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags") + if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver") + } /* end if W/O VFD is non-default */ + + fapl_out->ignore_wo_errs = vfd_config->ignore_wo_errs; + HDstrncpy(fapl_out->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1); + fapl_out->wo_path[H5FD_SPLITTER_PATH_MAX] = '\0'; + HDstrncpy(fapl_out->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); + fapl_out->log_file_path[H5FD_SPLITTER_PATH_MAX] = '\0'; + fapl_out->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ + fapl_out->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ + + if (NULL == (def_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + /* Set non-default channel FAPL IDs in splitter configuration info */ + if (H5P_DEFAULT != vfd_config->rw_fapl_id) { + if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + fapl_out->rw_fapl_id = vfd_config->rw_fapl_id; + } + else { + /* Use copy of default file access property list for R/W channel FAPL ID. + * The Sec2 driver is explicitly set on the FAPL ID, as the default + * driver might have been replaced with the Splitter VFD, which + * would cause recursion badness. + */ + if ((fapl_out->rw_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list") + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_out->rw_fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on R/W channel FAPL") + } + if (H5P_DEFAULT != vfd_config->wo_fapl_id) { + if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + fapl_out->wo_fapl_id = vfd_config->wo_fapl_id; + } + else { + /* Use copy of default file access property list for W/O channel FAPL ID. + * The Sec2 driver is explicitly set on the FAPL ID, as the default + * driver might have been replaced with the Splitter VFD, which + * would cause recursion badness. + */ + if ((fapl_out->wo_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list") + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_out->wo_fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on R/W channel FAPL") + } + +done: + if (free_config && vfd_config) + H5MM_free(vfd_config); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__splitter_populate_config() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__splitter_get_default_wo_path + * + * Purpose: Given a base filename, returns a default filename for the + * W/O channel file by appending '_wo' to the base file name. + * + * Return: Non-negative on Success/Negative on Failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, const char *base_filename) +{ + const char *suffix = "_wo"; + size_t old_filename_len = 0; + char * file_extension = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(new_path); + HDassert(base_filename); + + /* Check that output buffer can hold base filename + `_wo` suffix */ + old_filename_len = HDstrlen(base_filename); + if (old_filename_len > H5FD_SPLITTER_PATH_MAX - HDstrlen(suffix) - 1) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length") + + /* Determine if filename contains a ".h5" extension. */ + if ((file_extension = strstr(base_filename, ".h5"))) { + /* Insert the suffix between the filename and ".h5" extension. */ + HDstrcpy(new_path, base_filename); + file_extension = strstr(new_path, ".h5"); + HDsprintf(file_extension, "%s%s", suffix, ".h5"); + } + else if ((file_extension = strrchr(base_filename, '.'))) { + char *new_extension_loc = NULL; + + /* If the filename doesn't contain a ".h5" extension, but contains + * AN extension, just insert the suffix before that extension. + */ + HDstrcpy(new_path, base_filename); + new_extension_loc = strrchr(new_path, '.'); + HDsprintf(new_extension_loc, "%s%s", suffix, file_extension); + } + else { + /* If the filename doesn't contain an extension at all, just insert + * the suffix at the end of the filename. + */ + HDsnprintf(new_path, new_path_len, "%s%s", base_filename, suffix); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__splitter_get_default_wo_path() */ + +/*------------------------------------------------------------------------- * Function: H5FD__splitter_flush * * Purpose: Flushes all data to disk for both channels. @@ -658,10 +806,11 @@ done: static H5FD_t * H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr) { - H5FD_splitter_t * file_ptr = NULL; /* Splitter VFD info */ - const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */ - H5P_genplist_t * plist_ptr = NULL; - H5FD_t * ret_value = NULL; + H5FD_splitter_t * file_ptr = NULL; /* Splitter VFD info */ + const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */ + H5FD_splitter_fapl_t * default_fapl = NULL; + H5P_genplist_t * plist_ptr = NULL; + H5FD_t * ret_value = NULL; FUNC_ENTER_STATIC @@ -674,8 +823,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") if (ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") - if ((H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id))) - /* presupposes that H5P_FILE_ACCESS_DEFAULT is not a splitter */ + if (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "driver is not splitter") file_ptr = (H5FD_splitter_t *)H5FL_CALLOC(H5FD_splitter_t); @@ -689,8 +837,20 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha if (NULL == plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr); - if (NULL == fapl_ptr) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get VFL driver info") + if (NULL == fapl_ptr) { + if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file access property list struct") + if (H5FD__splitter_populate_config(NULL, default_fapl) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't initialize driver configuration info") + + /* If W/O path is not set, use base filename with '_wo' suffix */ + if (*default_fapl->wo_path == '\0') + if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, name) < + 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't generate default filename for W/O channel") + + fapl_ptr = default_fapl; + } /* Copy simpler info */ HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1); @@ -726,6 +886,9 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha ret_value = (H5FD_t *)file_ptr; done: + if (default_fapl) + H5FL_FREE(H5FD_splitter_fapl_t, default_fapl); + if (NULL == ret_value) { if (file_ptr) { if (H5I_INVALID_HID != file_ptr->fa.rw_fapl_id) @@ -1339,6 +1502,74 @@ done: } /* end H5FD__splitter_free() */ /*------------------------------------------------------------------------- + * Function: H5FD__splitter_delete + * + * Purpose: Delete a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__splitter_delete(const char *filename, hid_t fapl_id) +{ + const H5FD_splitter_fapl_t *fapl_ptr = NULL; + H5FD_splitter_fapl_t * default_fapl = NULL; + H5P_genplist_t * plist; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(filename); + + /* Get the driver info */ + if (H5P_FILE_ACCESS_DEFAULT == fapl_id) { + if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") + if (H5FD__splitter_populate_config(NULL, default_fapl) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info") + + /* If W/O path is not set, use base filename with '_wo' suffix */ + if (*default_fapl->wo_path == '\0') + if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, + filename) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel") + + fapl_ptr = default_fapl; + } + else { + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist))) { + if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, + "unable to allocate file access property list struct") + if (H5FD__splitter_populate_config(NULL, default_fapl) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info") + + /* If W/O path is not set, use base filename with '_wo' suffix */ + if (*default_fapl->wo_path == '\0') + if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, + filename) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel") + + fapl_ptr = default_fapl; + } + } + + if (H5FDdelete(filename, fapl_ptr->rw_fapl_id) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + if (H5FDdelete(fapl_ptr->wo_path, fapl_ptr->wo_fapl_id) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete W/O channel file") + +done: + if (default_fapl) + H5FL_FREE(H5FD_splitter_fapl_t, default_fapl); + + FUNC_LEAVE_NOAPI(ret_value) +} + +/*------------------------------------------------------------------------- * Function: H5FD__splitter_log_error * * Purpose: Log an error from the W/O channel appropriately. diff --git a/src/H5FDsplitter.h b/src/H5FDsplitter.h index ee6e7c5..3a743e4 100644 --- a/src/H5FDsplitter.h +++ b/src/H5FDsplitter.h @@ -17,7 +17,8 @@ #ifndef H5FDsplitter_H #define H5FDsplitter_H -#define H5FD_SPLITTER (H5FD_splitter_init()) +#define H5FD_SPLITTER (H5FD_splitter_init()) +#define H5FD_SPLITTER_VALUE H5_VFD_SPLITTER /* The version of the H5FD_splitter_vfd_config_t structure used */ #define H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION 1 diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 312263c..122379a 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -183,6 +183,7 @@ static herr_t H5FD_stdio_unlock(H5FD_t *_file); static herr_t H5FD_stdio_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_stdio_g = { + H5_VFD_STDIO, /* value */ "stdio", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -243,7 +244,7 @@ H5FD_stdio_init(void) H5Eclear2(H5E_DEFAULT); /* Check the use disabled file locks environment variable */ - lock_env_var = getenv("HDF5_USE_FILE_LOCKING"); + lock_env_var = getenv(HDF5_USE_FILE_LOCKING); if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = 1; /* Override: Ignore disabled locks */ else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c index 6ce33a7..fa3c05f 100644 --- a/src/H5FDwindows.c +++ b/src/H5FDwindows.c @@ -56,7 +56,7 @@ H5Pset_fapl_windows(hid_t fapl_id) if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - ret_value = H5P_set_driver(plist, H5FD_WINDOWS, NULL); + ret_value = H5P_set_driver(plist, H5FD_WINDOWS, NULL, NULL); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Fint.c b/src/H5Fint.c index c2d3e77..d772088 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -277,7 +277,7 @@ H5F__parse_file_lock_env_var(htri_t *use_locks) FUNC_ENTER_PACKAGE_NOERR /* Check the file locking environment variable */ - lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); if (lock_env_var && (!HDstrcmp(lock_env_var, "FALSE") || !HDstrcmp(lock_env_var, "0"))) *use_locks = FALSE; /* Override: Never use locks */ else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "BEST_EFFORT") || @@ -454,9 +454,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") /* Prepare the driver property */ - driver_prop.driver_id = f->shared->lf->driver_id; - driver_prop.driver_info = H5FD_fapl_get(f->shared->lf); - driver_prop_copied = TRUE; + driver_prop.driver_id = f->shared->lf->driver_id; + driver_prop.driver_info = H5FD_fapl_get(f->shared->lf); + driver_prop.driver_config_str = H5P_peek_driver_config_str(old_plist); + driver_prop_copied = TRUE; /* Set the driver property */ if (H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) @@ -1828,7 +1829,13 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) else tent_flags = flags; - if (NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) { + H5E_BEGIN_TRY + { + lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF); + } + H5E_END_TRY; + + if (NULL == lf) { if (tent_flags == flags) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags) diff --git a/src/H5PLint.c b/src/H5PLint.c index d20401e..848bd1d 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -144,7 +144,7 @@ H5PL__init_package(void) * to ignore plugins. The special symbol H5PL_NO_PLUGIN (defined in * H5PLpublic.h) means we don't want to load plugins. */ - if (NULL != (env_var = HDgetenv("HDF5_PLUGIN_PRELOAD"))) + if (NULL != (env_var = HDgetenv(HDF5_PLUGIN_PRELOAD))) if (!HDstrcmp(env_var, H5PL_NO_PLUGIN)) { H5PL_plugin_control_mask_g = 0; H5PL_allow_plugins_g = FALSE; @@ -243,6 +243,11 @@ H5PL_load(H5PL_type_t type, const H5PL_key_t *key) "Virtual Object Layer (VOL) driver plugins disabled") break; + case H5PL_TYPE_VFD: + if ((H5PL_plugin_control_mask_g & H5PL_VFD_PLUGIN) == 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Virtual File Driver (VFD) plugins disabled") + break; + case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: @@ -275,9 +280,31 @@ done: * * Purpose: Opens a plugin. * - * The success parameter will be set to TRUE and the plugin_info - * parameter will be filled in on success. Otherwise, they - * will be FALSE and NULL, respectively. + * `path` specifies the path to the plugin library file. + * + * `type` specifies the type of plugin being searched for and + * will be used to verify that a loaded plugin matches the + * type requested. H5PL_TYPE_NONE may be passed, in which case + * no plugin type verification is performed. This is most + * useful when iterating over available plugins without regard + * to their types. + * + * `key` specifies the information that will be used to find a + * specific plugin. For filter plugins, this is typically an + * integer identifier. For VOL connector and VFD plugins, this + * is typically either an integer identifier or a name string. + * After a plugin has been opened, this information will be + * compared against the relevant information provided by the + * plugin to ensure that the plugin is a match. If + * H5PL_TYPE_NONE is provided for `type`, then `key` should be + * NULL. + * + * On successful open of a plugin, the `success` parameter + * will be set to TRUE and the `plugin_type` and `plugin_info` + * parameters will be filled appropriately. On failure, the + * `success` parameter will be set to FALSE, the `plugin_type` + * parameter will be set to H5PL_TYPE_ERROR and the + * `plugin_info` parameter will be set to NULL. * * Return: SUCCEED/FAIL * @@ -308,6 +335,8 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s /* Check args - Just assert on package functions */ HDassert(path); + if (type == H5PL_TYPE_NONE) + HDassert(!key); HDassert(success); HDassert(plugin_info); @@ -396,6 +425,34 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s break; } + case H5PL_TYPE_VFD: { + const void *cls; + + /* Get the plugin info */ + if (NULL == (cls = (const void *)(*get_plugin_info)())) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VFD info from plugin") + + /* Setup temporary plugin key if one wasn't supplied */ + if (!key) { + tmp_key.vfd.kind = H5FD_GET_DRIVER_BY_NAME; + tmp_key.vfd.u.name = ((const H5FD_class_t *)cls)->name; + key = &tmp_key; + } + + /* Ask VFD interface if this class is the one we are looking for and is compatible, etc */ + if (H5FD_check_plugin_load(cls, key, success) < 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, FAIL, "VFD compatibility check failed") + + /* Check for finding the correct plugin */ + if (*success) { + if (plugin_type) + *plugin_type = H5PL_TYPE_VFD; + *plugin_info = cls; + } + + break; + } + case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 39a7d0d..9aecad1 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -248,7 +248,7 @@ H5PL__create_path_table(void) /* Retrieve paths from HDF5_PLUGIN_PATH if the user sets it * or from the default paths if it isn't set. */ - env_var = HDgetenv("HDF5_PLUGIN_PATH"); + env_var = HDgetenv(HDF5_PLUGIN_PATH); if (NULL == env_var) paths = H5MM_strdup(H5PL_DEFAULT_PATH); else @@ -571,12 +571,12 @@ H5PL__path_table_iterate(H5PL_iterate_type_t iter_type, H5PL_iterate_t iter_op, FUNC_ENTER_PACKAGE - for (u = 0; (u < H5PL_num_paths_g) && (ret_value == H5_ITER_CONT); u++) - ret_value = H5PL__path_table_iterate_process_path(H5PL_paths_g[u], iter_type, iter_op, op_data); - - if (ret_value < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_BADITER, H5_ITER_ERROR, "can't iterate over plugins in plugin path '%s'", - H5PL_paths_g[u]); + for (u = 0; (u < H5PL_num_paths_g) && (ret_value == H5_ITER_CONT); u++) { + if ((ret_value = + H5PL__path_table_iterate_process_path(H5PL_paths_g[u], iter_type, iter_op, op_data)) < 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_BADITER, H5_ITER_ERROR, + "can't iterate over plugins in plugin path '%s'", H5PL_paths_g[u]); + } done: FUNC_LEAVE_NOAPI(ret_value); @@ -615,9 +615,9 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type HDassert(plugin_path); HDassert(iter_op); - /* Open the directory */ + /* Open the directory - skip the path if the directory can't be opened */ if (!(dirp = HDopendir(plugin_path))) - HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, H5_ITER_ERROR, "can't open directory: %s", plugin_path) + HGOTO_DONE(H5_ITER_CONT) /* Iterate through all entries in the directory */ while (NULL != (dp = HDreaddir(dirp))) { @@ -663,7 +663,8 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type /* Determine if we should process this plugin */ plugin_matches = (iter_type == H5PL_ITER_TYPE_ALL) || ((iter_type == H5PL_ITER_TYPE_FILTER) && (plugin_type == H5PL_TYPE_FILTER)) || - ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL)); + ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL)) || + ((iter_type == H5PL_ITER_TYPE_VFD) && (plugin_type == H5PL_TYPE_VFD)); /* If the plugin was successfully loaded, call supplied callback function on plugin */ if (plugin_loaded && plugin_matches && (ret_value = iter_op(plugin_type, plugin_info, op_data))) @@ -706,10 +707,11 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type HDassert(plugin_path); HDassert(iter_op); - /* Specify a file mask. *.* = We want everything! */ + /* Specify a file mask. *.* = We want everything! - + * skip the path if the directory can't be opened */ HDsprintf(service, "%s\\*.dll", plugin_path); if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE) - HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, H5_ITER_ERROR, "can't open directory") + HGOTO_DONE(H5_ITER_CONT) /* Loop over all the files */ do { @@ -740,7 +742,8 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type /* Determine if we should process this plugin */ plugin_matches = (iter_type == H5PL_ITER_TYPE_ALL) || ((iter_type == H5PL_ITER_TYPE_FILTER) && (plugin_type == H5PL_TYPE_FILTER)) || - ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL)); + ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL)) || + ((iter_type == H5PL_ITER_TYPE_VFD) && (plugin_type == H5PL_TYPE_VFD)); /* If the plugin was successfully loaded, call supplied callback function on plugin */ if (plugin_loaded && plugin_matches && (ret_value = iter_op(plugin_type, plugin_info, op_data))) diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c index b7cdac0..25e373f 100644 --- a/src/H5PLplugin_cache.c +++ b/src/H5PLplugin_cache.c @@ -263,59 +263,99 @@ 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.) match, proceed */ - if (search_params->type == H5PL_cache_g[u].type) { - hbool_t matched = FALSE; /* Whether cached plugin info matches */ + 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) + /* Determine if the plugin types match */ + if (search_params->type != H5PL_cache_g[u].type) + continue; + + /* Determine if cache entry matches based on type-specific information */ + switch (search_params->type) { + case H5PL_TYPE_FILTER: + /* Check if specified filter plugin ID matches cache entry's ID */ + 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_NAME) { + /* Make sure the plugin cache entry key type matches our search key type */ + if (H5PL_cache_g[u].key.vol.kind != H5VL_GET_CONNECTOR_BY_NAME) + continue; + + /* Check if specified VOL connector name matches cache entry's name */ + if (!HDstrcmp(search_params->key->vol.u.name, H5PL_cache_g[u].key.vol.u.name)) + matched = TRUE; + } + else { + HDassert(search_params->key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE); + + /* Make sure the plugin cache entry key type matches our search key type */ + if (H5PL_cache_g[u].key.vol.kind != H5VL_GET_CONNECTOR_BY_VALUE) + continue; + + /* Check if specified VOL connector ID matches cache entry's ID */ + if (search_params->key->vol.u.value == H5PL_cache_g[u].key.vol.u.value) + matched = TRUE; + } + + break; + + case H5PL_TYPE_VFD: + if (search_params->key->vfd.kind == H5FD_GET_DRIVER_BY_NAME) { + /* Make sure the plugin cache entry key type matches our search key type */ + if (H5PL_cache_g[u].key.vfd.kind != H5FD_GET_DRIVER_BY_NAME) + continue; + + /* Check if specified VFD name matches cache entry's name */ + if (!HDstrcmp(search_params->key->vfd.u.name, H5PL_cache_g[u].key.vfd.u.name)) 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 */ + } + else { + HDassert(search_params->key->vfd.kind == H5FD_GET_DRIVER_BY_VALUE); + + /* Make sure the plugin cache entry key type matches our search key type */ + if (H5PL_cache_g[u].key.vfd.kind != H5FD_GET_DRIVER_BY_VALUE) + continue; + + /* Check if specified VFD ID matches cache entry's ID */ + if (search_params->key->vfd.u.value == H5PL_cache_g[u].key.vfd.u.value) + matched = TRUE; + } + break; - } /* end if */ - } /* end if */ - } /* end for */ + + case H5PL_TYPE_ERROR: + case H5PL_TYPE_NONE: + default: + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified") + } + + /* If the plugin type (filter, VOL connector, VFD plugin, 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 for */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index 7eae513..7ff5c1a 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -22,6 +22,7 @@ /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ +#include "H5FDprivate.h" /* File Drivers */ #include "H5VLprivate.h" /* Virtual Object Layer */ /**************************/ @@ -32,16 +33,29 @@ /* Library Private Typedefs */ /****************************/ +/* Key used to find VOL connector plugins */ +typedef struct H5PL_vol_key_t { + H5VL_get_connector_kind_t kind; /* Kind of VOL lookup to do */ + union { + H5VL_class_value_t value; /* VOL connector value */ + const char * name; /* VOL connector name */ + } u; +} H5PL_vol_key_t; + +/* Key used to find VFD plugins */ +typedef struct H5PL_vfd_key_t { + H5FD_get_driver_kind_t kind; /* Kind of VFD lookup to do */ + union { + H5FD_class_value_t value; /* VFD value */ + const char * name; /* VFD name */ + } u; +} H5PL_vfd_key_t; + /* The key that will be used to find the plugin */ typedef union H5PL_key_t { - int id; /* I/O filters */ - struct { - H5VL_get_connector_kind_t kind; /* Kind of VOL lookup to do */ - union { - H5VL_class_value_t value; /* VOL connector value */ - const char * name; /* VOL connector name */ - } u; - } vol; + int id; /* I/O filters */ + H5PL_vol_key_t vol; + H5PL_vfd_key_t vfd; } H5PL_key_t; /* Enum dictating the type of plugins to process @@ -50,6 +64,7 @@ typedef union H5PL_key_t { typedef enum { H5PL_ITER_TYPE_FILTER, H5PL_ITER_TYPE_VOL, + H5PL_ITER_TYPE_VFD, H5PL_ITER_TYPE_ALL, } H5PL_iterate_type_t; diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index 55ff594..ab24bd5 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -35,14 +35,16 @@ typedef enum H5PL_type_t { H5PL_TYPE_ERROR = -1, /**< Error */ H5PL_TYPE_FILTER = 0, /**< Filter */ - H5PL_TYPE_VOL = 1, /**< VOL driver */ - H5PL_TYPE_NONE = 2 /**< Sentinel: This must be last! */ + H5PL_TYPE_VOL = 1, /**< VOL connector */ + H5PL_TYPE_VFD = 2, /**< VFD */ + H5PL_TYPE_NONE = 3 /**< Sentinel: This must be last! */ } H5PL_type_t; //! <!-- [H5PL_type_t_snip] --> /* Common dynamic plugin type flags used by the set/get_loading_state functions */ #define H5PL_FILTER_PLUGIN 0x0001 #define H5PL_VOL_PLUGIN 0x0002 +#define H5PL_VFD_PLUGIN 0x0004 #define H5PL_ALL_PLUGIN 0xFFFF #ifdef __cplusplus diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a8e0d8e..f37cb74 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -41,8 +41,28 @@ #include "H5VMprivate.h" /* Vector Functions */ /* Includes needed to set default file driver */ -#include "H5FDsec2.h" /* POSIX unbuffered I/O */ +#include "H5FDsec2.h" /* POSIX unbuffered I/O */ +#include "H5FDcore.h" +#include "H5FDlog.h" +#include "H5FDfamily.h" +#include "H5FDmulti.h" #include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDsplitter.h" +#ifdef H5_HAVE_PARALLEL +#include "H5FDmpio.h" +#endif +#ifdef H5_HAVE_DIRECT +#include "H5FDdirect.h" +#endif +#ifdef H5_HAVE_MIRROR_VFD +#include "H5FDmirror.h" +#endif +#ifdef H5_HAVE_LIBHDFS +#include "H5FDhdfs.h" +#endif +#ifdef H5_HAVE_ROS3_VFD +#include "H5FDros3.h" +#endif #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Win32 I/O */ #endif @@ -113,7 +133,7 @@ #define H5F_ACS_FILE_DRV_SIZE sizeof(H5FD_driver_prop_t) #define H5F_ACS_FILE_DRV_DEF \ { \ - H5_DEFAULT_VFD, NULL \ + H5_DEFAULT_VFD, NULL, NULL \ } #define H5F_ACS_FILE_DRV_CRT H5P__facc_file_driver_create #define H5F_ACS_FILE_DRV_SET H5P__facc_file_driver_set @@ -398,6 +418,9 @@ static int H5P__facc_mpi_info_cmp(const void *value1, const void *value2, siz static herr_t H5P__facc_mpi_info_close(const char *name, size_t size, void *value); #endif /* H5_HAVE_PARALLEL */ +/* Internal routines */ +static herr_t H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver_id); + /*********************/ /* Package Variables */ /*********************/ @@ -809,6 +832,208 @@ done: } /* end H5P__facc_reg_prop() */ /*------------------------------------------------------------------------- + * Function: H5P__facc_set_def_driver + * + * Purpose: Parses a string that contains the name of the default VFL + * driver for the default FAPL. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__facc_set_def_driver(void) +{ + const char *driver_env_var; + hbool_t driver_ref_inc = FALSE; + hid_t driver_id = H5I_INVALID_HID; /* VFL driver ID */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Check if VFL driver environment variable is set */ + driver_env_var = HDgetenv(HDF5_DRIVER); + + /* Only parse VFL driver string if it's set */ + if (driver_env_var && *driver_env_var) { + H5FD_driver_prop_t driver_prop; + H5P_genplist_t * def_fapl; /* Default file access property list */ + H5P_genclass_t * def_fapclass; /* Default file access property class */ + const char * driver_config_env_var; + htri_t driver_is_registered; + + /* Check to see if the driver is already registered */ + if ((driver_is_registered = H5FD_is_driver_registered_by_name(driver_env_var, &driver_id)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFL driver is already registered") + if (driver_is_registered) { + HDassert(driver_id >= 0); + + if (H5I_inc_ref(driver_id, TRUE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFD") + driver_ref_inc = TRUE; + } /* end else-if */ + else { + /* Check for VFL drivers that ship with the library */ + if (H5P__facc_set_def_driver_check_predefined(driver_env_var, &driver_id) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check for predefined VFL driver name") + else if (driver_id > 0) { + if (H5I_inc_ref(driver_id, TRUE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "can't increment VFL driver refcount") + driver_ref_inc = TRUE; + } + else { + /* Register the VFL driver */ + if ((driver_id = H5FD_register_driver_by_name(driver_env_var, TRUE)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "can't register VFL driver") + driver_ref_inc = TRUE; + } /* end else */ + } /* end else */ + + /* Retrieve driver configuration string from environment variable, if set. */ + driver_config_env_var = HDgetenv(HDF5_DRIVER_CONFIG); + + driver_prop.driver_id = driver_id; + driver_prop.driver_info = NULL; + driver_prop.driver_config_str = driver_config_env_var; + + /* Get default file access pclass */ + if (NULL == (def_fapclass = (H5P_genclass_t *)H5I_object(H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_VFL, H5E_BADID, FAIL, + "can't find object for default file access property class ID") + + /* Set new default VFL driver for default file access pclass */ + if (H5P__class_set(def_fapclass, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, + "can't set default VFL driver for default file access property list class") + + /* Get default file access plist */ + if (NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_VFL, H5E_BADID, FAIL, "can't find object for default fapl ID") + + /* Set new default VFL driver for default FAPL */ + if (H5P_set_driver(def_fapl, driver_prop.driver_id, driver_prop.driver_info, + driver_prop.driver_config_str) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default VFL driver for default FAPL") + } + +done: + /* Clean up on error */ + if (ret_value < 0) { + if (driver_id >= 0 && driver_ref_inc && H5I_dec_app_ref(driver_id) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "unable to unregister VFL driver") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_set_def_driver() */ + +/*------------------------------------------------------------------------- + * Function: H5P__facc_set_def_driver_check_predefined + * + * Purpose: Checks a given driver name against a list of predefined + * names for VFL drivers that are internal to HDF5. If a name + * is matched, the ID for that driver is returned through + * `driver_id`. Otherwise, `driver_id` is set to + * H5I_INVALID_HID. + * + * Return: Non-negative on sucess/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver_id) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(driver_name); + HDassert(driver_id); + + if (!HDstrcmp(driver_name, "sec2")) { + if ((*driver_id = H5FD_SEC2) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize sec2 VFD") + } + else if (!HDstrcmp(driver_name, "core") || !HDstrcmp(driver_name, "core_paged")) { + if ((*driver_id = H5FD_CORE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize core VFD") + } + else if (!HDstrcmp(driver_name, "log")) { + if ((*driver_id = H5FD_LOG) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize log VFD") + } + else if (!HDstrcmp(driver_name, "family")) { + if ((*driver_id = H5FD_FAMILY) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize family VFD") + } + else if (!HDstrcmp(driver_name, "multi") || !HDstrcmp(driver_name, "split")) { + if ((*driver_id = H5FD_MULTI) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize multi VFD") + } + else if (!HDstrcmp(driver_name, "stdio")) { + if ((*driver_id = H5FD_STDIO) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize stdio VFD") + } + else if (!HDstrcmp(driver_name, "splitter")) { + if ((*driver_id = H5FD_SPLITTER) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize splitter VFD") + } + else if (!HDstrcmp(driver_name, "mpio")) { +#ifdef H5_HAVE_PARALLEL + if ((*driver_id = H5FD_MPIO) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize MPI I/O VFD") +#else + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "MPI-I/O VFD is not enabled") +#endif + } + else if (!HDstrcmp(driver_name, "direct")) { +#ifdef H5_HAVE_DIRECT + if ((*driver_id = H5FD_DIRECT) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Direct I/O VFD") +#else + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Direct I/O VFD is not enabled") +#endif + } + else if (!HDstrcmp(driver_name, "mirror")) { +#ifdef H5_HAVE_MIRROR_VFD + if ((*driver_id = H5FD_MIRROR) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize mirror VFD") +#else + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Mirror VFD is not enabled") +#endif + } + else if (!HDstrcmp(driver_name, "hdfs")) { +#ifdef H5_HAVE_LIBHDFS + if ((*driver_id = H5FD_HDFS) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize HDFS VFD") +#else + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "HDFS VFD is not enabled") +#endif + } + else if (!HDstrcmp(driver_name, "ros3")) { +#ifdef H5_HAVE_ROS3_VFD + if ((*driver_id = H5FD_ROS3) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize ROS3 VFD") +#else + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "ROS3 VFD is not enabled") +#endif + } + else if (!HDstrcmp(driver_name, "windows")) { +#ifdef H5_HAVE_WINDOWS + if ((*driver_id = H5FD_WINDOWS) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Windows VFD") +#else + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Windows VFD is not enabled") +#endif + } + else { + *driver_id = H5I_INVALID_HID; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_set_def_driver_check_predefined() */ + +/*------------------------------------------------------------------------- * Function: H5Pset_alignment * * Purpose: Sets the alignment properties of a file access property list @@ -899,42 +1124,52 @@ done: } /* end H5Pget_alignment() */ /*------------------------------------------------------------------------- - * Function: H5P_set_driver + * Function: H5P_set_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (NEW_DRIVER_ID) for a file access + * property list (PLIST). A struct (NEW_DRIVER_INFO) or string + * (NEW_DRIVER_CONFIG_STR) containing the driver-specific + * properties can optionally be supplied. The driver properties + * (struct or string) will be copied into the property list and + * the reference count on the driver will be incremented, + * allowing the caller to close the driver ID but still use the + * property list. * - * Return: Success: Non-negative - * Failure: Negative + * Note: Only one of either NEW_DRIVER_INFO or NEW_DRIVER_CONFIG_STR + * should be specified, but not both. + * + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * Tuesday, August 3, 1999 + * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- */ herr_t -H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info) +H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info, + const char *new_driver_config_str) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* If VFD configuration information is supplied, ensure that either binary + * configuration data or a configuration string is supplied, but not both. + */ + HDassert(!new_driver_info || !new_driver_config_str); + if (NULL == H5I_object_verify(new_driver_id, H5I_VFL)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID") if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & config. string */ /* Prepare the driver property */ - driver_prop.driver_id = new_driver_id; - driver_prop.driver_info = new_driver_info; + driver_prop.driver_id = new_driver_id; + driver_prop.driver_info = new_driver_info; + driver_prop.driver_config_str = new_driver_config_str; - /* Set the driver ID & info property */ + /* Set the driver ID, info & config. string property */ if (H5P_set(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID & info") } /* end if */ @@ -980,7 +1215,7 @@ H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID") /* Set the driver */ - if (H5P_set_driver(plist, new_driver_id, new_driver_info) < 0) + if (H5P_set_driver(plist, new_driver_id, new_driver_info, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") done: @@ -988,6 +1223,180 @@ done: } /* end H5Pset_driver() */ /*------------------------------------------------------------------------- + * Function: H5P_set_driver_by_name + * + * Purpose: Set the file driver name (DRIVER_NAME) for a file access + * property list (PLIST) and supply an optional string + * containing the driver-specific properties (DRIVER_CONFIG). + * The driver properties string will be copied into the + * property list. + * + * If the file driver specified by DRIVER_NAME is not + * currently registered, an attempt will be made to load the + * driver as a plugin. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5P_set_driver_by_name(H5P_genplist_t *plist, const char *driver_name, const char *driver_config, + hbool_t app_ref) +{ + hid_t new_driver_id = H5I_INVALID_HID; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + assert(plist); + assert(driver_name); + + /* Register the driver */ + if ((new_driver_id = H5FD_register_driver_by_name(driver_name, app_ref)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register VFD") + + /* Set the driver */ + if (H5P_set_driver(plist, new_driver_id, NULL, driver_config) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + +done: + if (ret_value < 0) { + if (new_driver_id >= 0 && H5I_dec_app_ref(new_driver_id) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement count on VFD ID") + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_set_driver_by_name() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_driver_by_name + * + * Purpose: Set the file driver name (DRIVER_NAME) for a file access + * property list (PLIST_ID) and supply an optional string + * containing the driver-specific properties (DRIVER_CONFIG). + * The driver properties string will be copied into the + * property list. + * + * If the file driver specified by DRIVER_NAME is not + * currently registered, an attempt will be made to load the + * driver as a plugin. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_driver_by_name(hid_t plist_id, const char *driver_name, const char *driver_config) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*s*s", plist_id, driver_name, driver_config); + + /* Check arguments */ + 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") + if (!driver_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "driver_name parameter cannot be NULL") + if (!*driver_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "driver_name parameter cannot be an empty string") + + /* Set the driver */ + if (H5P_set_driver_by_name(plist, driver_name, driver_config, TRUE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_driver_by_name() */ + +/*------------------------------------------------------------------------- + * Function: H5P_set_driver_by_value + * + * Purpose: Set the file driver value (DRIVER_VALUE) for a file access + * property list (PLIST) and supply an optional string + * containing the driver-specific properties (DRIVER_CONFIG). + * The driver properties string will be copied into the + * property list. + * + * If the file driver specified by DRIVER_VALUE is not + * currently registered, an attempt will be made to load the + * driver as a plugin. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5P_set_driver_by_value(H5P_genplist_t *plist, H5FD_class_value_t driver_value, const char *driver_config, + hbool_t app_ref) +{ + hid_t new_driver_id = H5I_INVALID_HID; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + assert(plist); + assert(driver_value >= 0); + + /* Register the driver */ + if ((new_driver_id = H5FD_register_driver_by_value(driver_value, app_ref)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register VFD") + + /* Set the driver */ + if (H5P_set_driver(plist, new_driver_id, NULL, driver_config) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + +done: + if (ret_value < 0) { + if (new_driver_id >= 0 && H5I_dec_app_ref(new_driver_id) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement count on VFD ID") + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_set_driver_by_value() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_driver_by_value + * + * Purpose: Set the file driver value (DRIVER_VALUE) for a file access + * property list (PLIST_ID) and supply an optional string + * containing the driver-specific properties (DRIVER_CONFIG). + * The driver properties string will be copied into the + * property list. + * + * If the file driver specified by DRIVER_VALUE is not + * currently registered, an attempt will be made to load the + * driver as a plugin. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_driver_by_value(hid_t plist_id, H5FD_class_value_t driver_value, const char *driver_config) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "iDV*s", plist_id, driver_value, driver_config); + + /* Check arguments */ + 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") + if (driver_value < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "negative VFD value is disallowed") + + /* Set the driver */ + if (H5P_set_driver_by_value(plist, driver_value, driver_config, TRUE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_driver_by_value() */ + +/*------------------------------------------------------------------------- * Function: H5P_peek_driver * * Purpose: Return the ID of the low-level file driver. PLIST_ID should @@ -1014,7 +1423,7 @@ H5P_peek_driver(H5P_genplist_t *plist) /* Get the current driver ID */ if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") @@ -1098,7 +1507,7 @@ H5P_peek_driver_info(H5P_genplist_t *plist) /* Get the current driver info */ if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info") @@ -1151,13 +1560,104 @@ done: } /* end H5Pget_driver_info() */ /*------------------------------------------------------------------------- + * Function: H5P_peek_driver_config_str + * + * Purpose: Returns a pointer directly to the file driver configuration + * string of a file access property list. + * + * Return: Success: Ptr to *uncopied* driver configuration string, if + * any. + * + * Failure: NULL. NULL is also returned if the driver has not + * been configured with a driver configuration string. + * + *------------------------------------------------------------------------- + */ +const char * +H5P_peek_driver_config_str(H5P_genplist_t *plist) +{ + const char *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Get the current driver configuration string */ + if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */ + + if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver configuration string") + ret_value = driver_prop.driver_config_str; + } /* end if */ + else + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_peek_driver_config_str() */ + +/*------------------------------------------------------------------------- + * Function: H5Pget_driver_config_str + * + * Purpose: Retrieves a string representation of the configuration for + * the driver set on the given FAPL. The returned string can + * be used to configure the same driver in an identical way. + * + * `config_buf` may be NULL, in which case the length of the + * driver configuration string is simply returned. The caller + * can then allocate a buffer of the appropriate size and call + * this routine again. + * + * Return: Length of the driver configuration string on success (not + * including the NUL terminator) + * Negative on failure + * + *------------------------------------------------------------------------- + */ +ssize_t +H5Pget_driver_config_str(hid_t fapl_id, char *config_buf, size_t buf_size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + const char * config_str = NULL; + ssize_t ret_value = -1; + + FUNC_ENTER_API((-1)) + H5TRACE3("Zs", "i*sz", fapl_id, config_buf, buf_size); + + /* Check arguments */ + if (!config_buf && buf_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "config_buf cannot be NULL if buf_size is non-zero") + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't find object for ID") + + /* Retrieve configuration string property */ + if ((config_str = H5P_peek_driver_config_str(plist))) { + size_t config_str_len = HDstrlen(config_str); + + if (config_buf) { + HDstrncpy(config_buf, config_str, MIN(config_str_len + 1, buf_size)); + if (config_str_len >= buf_size) + config_buf[buf_size - 1] = '\0'; + } + + ret_value = (ssize_t)config_str_len; + } + else + ret_value = 0; + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pget_driver_config_str() */ + +/*------------------------------------------------------------------------- * Function: H5P__file_driver_copy * * Purpose: Copy file driver ID & info. * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. + * finishes the "deep" part of the copy. * * Return: Success: Non-negative * Failure: Negative @@ -1208,6 +1708,15 @@ H5P__file_driver_copy(void *value) /* Set the driver info for the copy */ info->driver_info = new_pl; } /* end if */ + + /* Copy driver configuration string, if it exists */ + if (info->driver_config_str) { + char *new_config_str = NULL; + + if (NULL == (new_config_str = H5MM_strdup(info->driver_config_str))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver configuration string copy failed") + info->driver_config_str = new_config_str; + } /* end if */ } /* end if */ } /* end if */ @@ -1238,7 +1747,6 @@ H5P__file_driver_free(void *value) if (value) { H5FD_driver_prop_t *info = (H5FD_driver_prop_t *)value; /* Driver ID & info struct */ - /* Copy the driver & info, if there is one */ if (info->driver_id > 0) { /* Free the driver info, if it exists */ @@ -1246,6 +1754,9 @@ H5P__file_driver_free(void *value) if (H5FD_free_driver_info(info->driver_id, info->driver_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") + /* Free the driver configuration string, if it exists */ + H5MM_xfree_const(info->driver_config_str); + /* Decrement reference count for driver */ if (H5I_dec_ref(info->driver_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") @@ -1465,6 +1976,16 @@ H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, size_t H5_ATTR HGOTO_DONE(cmp_value); } /* end if */ + /* Compare driver configuration strings */ + if (info1->driver_config_str == NULL && info2->driver_config_str != NULL) + HGOTO_DONE(-1); + if (info1->driver_config_str != NULL && info2->driver_config_str == NULL) + HGOTO_DONE(1); + if (info1->driver_config_str) { + if (0 != (cmp_value = HDstrcmp(info1->driver_config_str, info2->driver_config_str))) + HGOTO_DONE(cmp_value); + } + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_cmp() */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 9530d87..9206d4c 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -412,20 +412,22 @@ static const H5I_class_t H5I_GENPROPLST_CLS[1] = {{ }}; /*------------------------------------------------------------------------- - * Function: H5P_init + * Function: H5P_init_phase1 * - * Purpose: Initialize the interface from some other layer. + * Purpose: Initialize the interface from some other layer. This should + * be followed with a call to H5P_init_phase2 after the H5P + * interface is completely setup. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 4, 2000 * *------------------------------------------------------------------------- */ herr_t -H5P_init(void) +H5P_init_phase1(void) { herr_t ret_value = SUCCEED; /* Return value */ @@ -434,7 +436,36 @@ H5P_init(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_init() */ +} /* end H5P_init_phase1() */ + +/*------------------------------------------------------------------------- + * Function: H5P_init_phase2 + * + * Purpose: Finish initializing the interface from some other package. + * + * Note: This is broken out as a separate routine so that the + * library's default VFL driver can be chosen and initialized + * after the entire H5P interface has been initialized. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5P_init_phase2(void) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Set up the default VFL driver */ + if (H5P__facc_set_def_driver() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "unable to set default VFL driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_init_phase2() */ /*-------------------------------------------------------------------------- NAME @@ -449,8 +480,9 @@ DESCRIPTION herr_t H5P__init_package(void) { - size_t tot_init; /* Total # of classes initialized */ - size_t pass_init; /* # of classes initialized in each pass */ + size_t tot_init = 0; /* Total # of classes initialized */ + size_t pass_init; /* # of classes initialized in each pass */ + size_t u; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -472,8 +504,6 @@ H5P__init_package(void) */ tot_init = 0; do { - size_t u; /* Local index variable */ - /* Reset pass initialization counter */ pass_init = 0; @@ -523,6 +553,28 @@ H5P__init_package(void) HDassert(tot_init == NELMTS(init_class)); done: + if (ret_value < 0 && tot_init > 0) { + /* First uninitialize all default property lists */ + H5I_clear_type(H5I_GENPROP_LST, FALSE, FALSE); + + /* Then uninitialize any initialized libclass */ + for (u = 0; u < NELMTS(init_class); u++) { + H5P_libclass_t const *lib_class = init_class[u]; /* Current class to operate on */ + + HDassert(lib_class->class_id); + if (*lib_class->class_id >= 0) { + /* Close the class ID */ + if (H5I_dec_ref(*lib_class->class_id) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to close property list class ID") + } + else if (lib_class->pclass && *lib_class->pclass) { + /* Close a half-initialized pclass */ + if (H5P__close_class(*lib_class->pclass) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to close property list class") + } + } + } + FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__init_package() */ diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index dd43f76..2946931 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -188,6 +188,9 @@ H5_DLL herr_t H5P__decode_double(const void **_pp, void *value); H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size); H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); +/* Private FAPL routines */ +H5_DLL herr_t H5P__facc_set_def_driver(void); + /* Private OCPL routines */ H5_DLL herr_t H5P__get_filter(const struct H5Z_filter_info_t *filter, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 6ebe5d3..7cbb397 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -156,8 +156,9 @@ struct H5O_fill_t; struct H5T_t; struct H5VL_connector_prop_t; -/* Package initialization routine */ -H5_DLL herr_t H5P_init(void); +/* Package initialization routines */ +H5_DLL herr_t H5P_init_phase1(void); +H5_DLL herr_t H5P_init_phase2(void); /* Internal versions of API routines */ H5_DLL herr_t H5P_close(H5P_genplist_t *plist); @@ -181,7 +182,13 @@ H5_DLL char * H5P_get_class_name(H5P_genclass_t *pclass); H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist); -H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); +H5_DLL const char *H5P_peek_driver_config_str(H5P_genplist_t *plist); +H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info, + const char *new_driver_config_str); +H5_DLL herr_t H5P_set_driver_by_name(H5P_genplist_t *plist, const char *driver_name, + const char *driver_config, hbool_t app_ref); +H5_DLL herr_t H5P_set_driver_by_value(H5P_genplist_t *plist, H5FD_class_value_t driver_value, + const char *driver_config, hbool_t app_ref); H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info); H5_DLL herr_t H5P_reset_vol_class(const H5P_genclass_t *pclass, const struct H5VL_connector_prop_t *vol_prop); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void *alloc_info, diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index a5c5c37..3fa7118 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -3448,6 +3448,34 @@ H5_DLL const void *H5Pget_driver_info(hid_t plist_id); /** * \ingroup FAPL * + * \brief Retrieves a string representation of the configuration for + * the driver set on the given FAPL. The returned string can + * be used to configure the same driver in an identical way. + * + * \fapl_id + * \param[out] config_buf Driver configuration string output buffer + * \param[in] buf_size Size of driver configuration string output buffer + * + * \return Returns the length of the driver configuration string on + * success (not including the NUL terminator). Returns negative + * on failure. + * + * \details H5Pget_driver_config_str() retrieves a string representation + * of the configuration for the driver set on the given FAPL. The + * returned string can be used to configure the same driver in + * an identical way. + * + * If \p config_buf is NULL, the length of the driver configuration + * string is simply returned. The caller can then allocate a buffer + * of the appropriate size and call this routine again. + * + * \version 1.12.1 Function publicized in this release. + * + */ +H5_DLL ssize_t H5Pget_driver_config_str(hid_t fapl_id, char *config_buf, size_t buf_size); +/** + * \ingroup FAPL + * * \brief Retrieves the size of the external link open file cache * * \fapl_id{plist_id} @@ -4287,6 +4315,57 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_ /** * \ingroup FAPL * + * \brief Sets a file driver according to a given driver name + * + * \plist_id + * \param[in] driver_name The new driver name + * \param[in] driver_config Optional string containing driver properties + * + * \return \herr_t + * + * \details H5Pset_driver_by_name() sets the file driver, by the name + * driver_name, for a file access or data transfer property list, + * \p plist_id, and supplies an optional string containing the + * driver-specific properties, \p driver_config. The driver + * properties string will be copied into the property list. + * + * If the driver specified by \p driver_name is not currently + * registered, an attempt will be made to load the driver as a + * plugin. + * + * \version 1.12.1 Function publicized in this release. + * + */ +H5_DLL herr_t H5Pset_driver_by_name(hid_t plist_id, const char *driver_name, const char *driver_config); +/** + * \ingroup FAPL + * + * \brief Sets a file driver according to a given driver value (ID). + * + * \plist_id + * \param[in] driver_value The new driver value (ID) + * \param[in] driver_config Optional string containing driver properties + * + * \return \herr_t + * + * \details H5Pset_driver_by_value() sets the file driver, by the value + * driver_value, for a file access or data transfer property list, + * \p plist_id, and supplies an optional string containing the + * driver-specific properties, \p driver_config. The driver + * properties string will be copied into the property list. + * + * If the driver specified by \p driver_value is not currently + * registered, an attempt will be made to load the driver as a + * plugin. + * + * \version 1.12.1 Function publicized in this release. + * + */ +H5_DLL herr_t H5Pset_driver_by_value(hid_t plist_id, H5FD_class_value_t driver_value, + const char *driver_config); +/** + * \ingroup FAPL + * * \brief Sets the number of files that can be held open in an external * link open file cache * diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index a61b003..2369be5 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -3527,6 +3527,7 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in 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; hid_t connector_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -3565,6 +3566,10 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in 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 { @@ -3572,11 +3577,23 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in } 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) { + 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. @@ -3586,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) { diff --git a/src/H5VLint.c b/src/H5VLint.c index b4432d0..936614f 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -69,11 +69,7 @@ typedef struct H5VL_wrap_ctx_t { */ typedef struct { /* IN */ - H5VL_get_connector_kind_t kind; /* Which kind of connector search to make */ - union { - const char * name; /* The name of the VOL connector to check */ - H5VL_class_value_t value; /* The value of the VOL connector to check */ - } u; + H5PL_vol_key_t key; /* OUT */ hid_t found_id; /* The connector ID, if we found a match */ @@ -341,15 +337,15 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data) FUNC_ENTER_STATIC_NOERR - if (H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) { - if (0 == HDstrcmp(cls->name, op_data->u.name)) { + if (H5VL_GET_CONNECTOR_BY_NAME == op_data->key.kind) { + if (0 == HDstrcmp(cls->name, op_data->key.u.name)) { op_data->found_id = id; ret_value = H5_ITER_STOP; } /* end if */ } /* end if */ else { - HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->kind); - if (cls->value == op_data->u.value) { + HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->key.kind); + if (cls->value == op_data->key.u.value) { op_data->found_id = id; ret_value = H5_ITER_STOP; } /* end if */ @@ -398,7 +394,7 @@ H5VL__set_def_conn(void) } /* end if */ /* Check for environment variable set */ - env_var = HDgetenv("HDF5_VOL_CONNECTOR"); + env_var = HDgetenv(HDF5_VOL_CONNECTOR); /* Only parse the string if it's set */ if (env_var && *env_var) { @@ -1299,9 +1295,9 @@ H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_ "callback is provided") /* Set up op data for iteration */ - op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; - op_data.u.name = cls->name; - op_data.found_id = H5I_INVALID_HID; + op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.key.u.name = cls->name; + op_data.found_id = H5I_INVALID_HID; /* Check if connector is already registered */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) @@ -1350,9 +1346,9 @@ H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_i FUNC_ENTER_PACKAGE /* Set up op data for iteration */ - op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; - op_data.u.name = name; - op_data.found_id = H5I_INVALID_HID; + op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.key.u.name = name; + op_data.found_id = H5I_INVALID_HID; /* Check if connector is already registered */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, app_ref) < 0) @@ -1410,12 +1406,12 @@ H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid FUNC_ENTER_PACKAGE /* Set up op data for iteration */ - op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE; - op_data.u.value = value; - op_data.found_id = H5I_INVALID_HID; + op_data.key.kind = H5VL_GET_CONNECTOR_BY_VALUE; + op_data.key.u.value = value; + op_data.found_id = H5I_INVALID_HID; /* Check if connector is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, app_ref) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") /* If connector alread registered, increment ref count on ID and return ID */ @@ -1449,8 +1445,9 @@ done: * * Purpose: Checks if a connector with a particular name is registered. * - * Return: Success: 0 - * Failure: -1 + * Return: >0 if a VOL connector with that name has been registered + * 0 if a VOL connector with that name has NOT been registered + * <0 on errors * * Programmer: Dana Robinson * June 17, 2017 @@ -1466,9 +1463,9 @@ H5VL__is_connector_registered_by_name(const char *name) FUNC_ENTER_PACKAGE /* Set up op data for iteration */ - op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; - op_data.u.name = name; - op_data.found_id = H5I_INVALID_HID; + op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.key.u.name = name; + op_data.found_id = H5I_INVALID_HID; /* Find connector with name */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) @@ -1488,8 +1485,9 @@ done: * Purpose: Checks if a connector with a particular value (ID) is * registered. * - * Return: Success: 0 - * Failure: -1 + * Return: >0 if a VOL connector with that value has been registered + * 0 if a VOL connector with that value hasn't been registered + * <0 on errors * *------------------------------------------------------------------------- */ @@ -1502,9 +1500,9 @@ H5VL__is_connector_registered_by_value(H5VL_class_value_t value) FUNC_ENTER_PACKAGE /* Set up op data for iteration */ - op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE; - op_data.u.value = value; - op_data.found_id = H5I_INVALID_HID; + op_data.key.kind = H5VL_GET_CONNECTOR_BY_VALUE; + op_data.key.u.value = value; + op_data.found_id = H5I_INVALID_HID; /* Find connector with value */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) @@ -1635,9 +1633,9 @@ H5VL__peek_connector_id_by_name(const char *name) FUNC_ENTER_PACKAGE /* Set up op data for iteration */ - op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; - op_data.u.name = name; - op_data.found_id = H5I_INVALID_HID; + op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.key.u.name = name; + op_data.found_id = H5I_INVALID_HID; /* Find connector with name */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) @@ -1671,9 +1669,9 @@ H5VL__peek_connector_id_by_value(H5VL_class_value_t value) FUNC_ENTER_PACKAGE /* Set up op data for iteration */ - op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE; - op_data.u.value = value; - op_data.found_id = H5I_INVALID_HID; + op_data.key.kind = H5VL_GET_CONNECTOR_BY_VALUE; + op_data.key.u.value = value; + op_data.found_id = H5I_INVALID_HID; /* Find connector with value */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) diff --git a/src/H5public.h b/src/H5public.h index c9430dc..3e59e24 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -168,6 +168,58 @@ (((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE <= Rel)) || \ ((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR < Min)) || (H5_VERS_MAJOR < Maj)) +/* Macros for various environment variables that HDF5 interprets */ +/** + * Used to specify the name of an HDF5 Virtual File Driver to use as + * the default file driver for file access. Setting this environment + * variable overrides the default file driver for File Access Property + * Lists. + */ +#define HDF5_DRIVER "HDF5_DRIVER" +/** + * Used to specify a configuration string for the HDF5 Virtual File + * Driver being used for file access. + */ +#define HDF5_DRIVER_CONFIG "HDF5_DRIVER_CONFIG" +/** + * Used to specify the name of an HDF5 Virtual Object Layer Connector + * to use as the default VOL connector for file access. Setting this + * environment variable overrides the default VOL connector for File + * Access Property Lists. + */ +#define HDF5_VOL_CONNECTOR "HDF5_VOL_CONNECTOR" +/** + * Used to specify a delimiter-separated (currently, ';' for Windows + * and ':' for other systems) list of paths that HDF5 should search + * when loading plugins. + */ +#define HDF5_PLUGIN_PATH "HDF5_PLUGIN_PATH" +/** + * Used to control the loading of HDF5 plugins at runtime. If this + * environment variable is set to the special string "::" (defined + * in H5PLpublic.h as H5PL_NO_PLUGIN), then dynamic loading of any + * HDF5 plugins will be disabled. No other values are valid for this + * environment variable. + */ +#define HDF5_PLUGIN_PRELOAD "HDF5_PLUGIN_PRELOAD" +/** + * Used to control whether HDF5 uses file locking when creating or + * opening a file. Valid values for this environment variable are + * as follows: + * + * "TRUE" or "1" - Request that file locks should be used + * "FALSE" or "0" - Request that file locks should NOT be used + * "BEST_EFFORT" - Request that file locks should be used and + * that any locking errors caused by file + * locking being disabled on the system + * should be ignored + */ +#define HDF5_USE_FILE_LOCKING "HDF5_USE_FILE_LOCKING" +/** + * Used to instruct HDF5 not to cleanup files created during testing. + */ +#define HDF5_NOCLEANUP "HDF5_NOCLEANUP" + /** * Status return values. Failed integer functions in HDF5 result almost * always in a negative value (unsigned failing functions sometimes return diff --git a/src/H5trace.c b/src/H5trace.c index 3a5d420..a735df3 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1046,6 +1046,65 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) } /* end block */ break; + case 'V': /* H5FD_class_value_t */ + { + H5FD_class_value_t class_val = + (H5FD_class_value_t)HDva_arg(ap, H5FD_class_value_t); + + switch (class_val) { + case H5_VFD_INVALID: + H5RS_acat(rs, "H5_VFD_INVALID"); + break; + case H5_VFD_SEC2: + H5RS_acat(rs, "H5_VFD_SEC2"); + break; + case H5_VFD_CORE: + H5RS_acat(rs, "H5_VFD_CORE"); + break; + case H5_VFD_LOG: + H5RS_acat(rs, "H5_VFD_LOG"); + break; + case H5_VFD_FAMILY: + H5RS_acat(rs, "H5_VFD_FAMILY"); + break; + case H5_VFD_MULTI: + H5RS_acat(rs, "H5_VFD_MULTI"); + break; + case H5_VFD_STDIO: + H5RS_acat(rs, "H5_VFD_STDIO"); + break; +#ifdef H5_HAVE_PARALLEL + case H5_VFD_MPIO: + H5RS_acat(rs, "H5_VFD_MPIO"); + break; +#endif +#ifdef H5_HAVE_DIRECT + case H5_VFD_DIRECT: + H5RS_acat(rs, "H5_VFD_DIRECT"); + break; +#endif +#ifdef H5_HAVE_MIRROR_VFD + case H5_HAVE_MIRROR_VFD: + H5RS_acat(rs, "H5_HAVE_MIRROR_VFD"); + break; +#endif +#ifdef H5_HAVE_LIBHDFS + case H5_HAVE_LIBHDFS: + H5RS_acat(rs, "H5_HAVE_LIBHDFS"); + break; +#endif +#ifdef H5_HAVE_ROS3_VFD + case H5_HAVE_ROS3_VFD: + H5RS_acat(rs, "H5_HAVE_ROS3_VFD"); + break; +#endif + default: + H5RS_asprintf_cat(rs, "%ld", (long)class_val); + break; + } + } /* end block */ + break; + default: H5RS_asprintf_cat(rs, "BADTYPE(D%c)", type[1]); goto error; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 56427f5..1461101 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -78,7 +78,7 @@ if (HDF5_ENABLE_FORMATTERS) endif () ################################################################################# -# If filter and vol plugin tests can be tested +# If filter, vfd and vol plugin tests can be tested ################################################################################# if (BUILD_SHARED_LIBS) # make plugins dir @@ -162,6 +162,50 @@ if (BUILD_SHARED_LIBS) endforeach () ################################################################################# + # make vfd plugins dir + ################################################################################# + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/null_vfd_plugin_dir") + + #----------------------------------------------------------------------------- + # Define VFD Plugin Test Sources + #----------------------------------------------------------------------------- + set (VFD_PLUGIN_LIBS + null_vfd_plugin + ) + + foreach (vfd_lib ${VFD_PLUGIN_LIBS}) + set (HDF5_VFD_PLUGIN_LIB_CORENAME "${vfd_lib}") + set (HDF5_VFD_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_VFD_PLUGIN_LIB_CORENAME}") + set (HDF5_VFD_PLUGIN_LIB_TARGET ${HDF5_VFD_PLUGIN_LIB_CORENAME}) + + add_library (${HDF5_VFD_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${vfd_lib}.c) + target_include_directories (${HDF5_VFD_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_VFD_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_VFD_PLUGIN_LIB_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_VFD_PLUGIN_LIB_TARGET} ${HDF5_VFD_PLUGIN_LIB_NAME} SHARED "LIB") + set_target_properties (${HDF5_VFD_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_${HDF5_VFD_PLUGIN_LIB_TARGET}_FORMAT ${HDF5_VFD_PLUGIN_LIB_TARGET}) + endif () + + #----------------------------------------------------------------------------- + # Copy VFD plugin to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_VFD_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_VFD_PLUGIN_LIB_TARGET}>" + "${CMAKE_BINARY_DIR}/null_vfd_plugin_dir/$<TARGET_FILE_NAME:${HDF5_VFD_PLUGIN_LIB_TARGET}>" + ) + endforeach () + + ################################################################################# # make vol plugins dir ################################################################################# file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/null_vol_plugin_dir") @@ -661,6 +705,19 @@ if (BUILD_SHARED_LIBS) clang_format (HDF5_TEST_filter_plugin_FORMAT filter_plugin) endif () + add_executable (vfd_plugin ${HDF5_TEST_SOURCE_DIR}/vfd_plugin.c) + target_include_directories (vfd_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (vfd_plugin SHARED) + target_link_libraries (vfd_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + set_target_properties (vfd_plugin PROPERTIES FOLDER test) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_vfd_plugin_FORMAT vfd_plugin) + endif () + add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c) target_include_directories (vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (vol_plugin SHARED) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index bb5356d..c537f37 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -127,10 +127,10 @@ set (HDF5_REFERENCE_TEST_FILES btree_idx_1_8.h5 corrupt_stab_msg.h5 deflate.h5 - family_v16_00000.h5 - family_v16_00001.h5 - family_v16_00002.h5 - family_v16_00003.h5 + family_v16-000000.h5 + family_v16-000001.h5 + family_v16-000002.h5 + family_v16-000003.h5 file_image_core_test.h5 filespace_1_6.h5 filespace_1_8.h5 @@ -331,7 +331,7 @@ set (test_CLEANFILES sec2_file.h5 direct_file.h5 family_file000*.h5 - new_family_v16_000*.h5 + new_family_v16-000*.h5 multi_file-*.h5 core_file filter_plugin.h5 diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 892ccf3..723595b 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -25,10 +25,29 @@ set (VFD_LIST split multi family + splitter + #log - log VFD currently has file space allocation bugs ) + if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () +if (H5_HAVE_PARALLEL) + # MPI I/O VFD is currently incompatible with too many tests in the VFD test set + # set (VFD_LIST ${VFD_LIST} mpio) +endif () +if (H5_HAVE_MIRROR_VFD) + set (VFD_LIST ${VFD_LIST} mirror) +endif () +if (H5_HAVE_ROS3_VFD) + set (VFD_LIST ${VFD_LIST} ros3) +endif () +if (H5_HAVE_LIBHDFS) + set (VFD_LIST ${VFD_LIST} hdfs) +endif () +if (H5_HAVE_WINDOWS) + set (VFD_LIST ${VFD_LIST} windows) +endif () foreach (vfdtest ${VFD_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") @@ -208,3 +227,22 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD foreach (h5_vfd ${VFD_LIST}) ADD_VFD_TEST (${h5_vfd} 0) endforeach () + + ############################################################################## + ### V F D P L U G I N T E S T S + ############################################################################## + if (BUILD_SHARED_LIBS) + if (WIN32) + set (CMAKE_SEP "\;") + set (BIN_REL_PATH "../../") + else () + set (CMAKE_SEP ":") + set (BIN_REL_PATH "../") + endif () + + add_test (NAME H5PLUGIN-vfd_plugin COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:vfd_plugin>) + set_tests_properties (H5PLUGIN-vfd_plugin PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/null_vfd_plugin_dir;srcdir=${HDF5_TEST_BINARY_DIR}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} + ) + endif () diff --git a/test/Makefile.am b/test/Makefile.am index d465664..09277b0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -94,7 +94,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ swmr_check_compat_vfd vds_env vds_swmr_gen vds_swmr_reader vds_swmr_writer \ mirror_vfd if HAVE_SHARED_CONDITIONAL - check_PROGRAMS+= filter_plugin vol_plugin + check_PROGRAMS+= filter_plugin vfd_plugin vol_plugin endif # These programs generate test files for the tests. They don't need to be @@ -117,7 +117,7 @@ if HAVE_SHARED_CONDITIONAL # The libh5test library provides common support code for the tests. # The filter_plugin* libraries are for use in filter_plugin.c. # Build them as shared libraries if that option was enabled in configure. - noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la libnull_vol_connector.la + noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la libnull_vfd_plugin.la libnull_vol_connector.la libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c @@ -129,6 +129,12 @@ if HAVE_SHARED_CONDITIONAL libfilter_plugin3_dsets_la_LIBADD=$(LIBHDF5) libfilter_plugin4_groups_la_LIBADD=$(LIBHDF5) + # VFD plugin test libraries + # + # null_vfd_plugin is used for testing basic VFD plugin functionality. + libnull_vfd_plugin_la_SOURCES=null_vfd_plugin.c + libnull_vfd_plugin_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + # VOL plugin test libraries # # null_vol_connector is used for testing basic VOL plugin functionality. @@ -192,7 +198,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \ tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \ getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \ - family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \ + family_file000[0-3][0-9].h5 new_family_v16-000[0-3][0-9].h5 \ multi_file-[rs].h5 core_file filter_plugin.h5 \ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \ dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ diff --git a/test/accum.c b/test/accum.c index c3346bc..08f86ca 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2121,7 +2121,7 @@ test_swmr_write_big(hbool_t newest_format) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (!H5FD__supports_swmr_test(driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index ce0e830..76f45bf 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -56,7 +56,7 @@ main(void) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (!H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; diff --git a/test/app_ref.c b/test/app_ref.c index 09cfb72..2777dc0 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -79,11 +79,12 @@ Abrt_Handler(int H5_ATTR_UNUSED sig) int main(void) { - hid_t ids[T_NUMCLASSES]; - hid_t fapl; /* File Access Property List */ - int ninc; - int i; - char filename[1024]; + const char *env_h5_drvr; /* File Driver value from environment */ + hid_t ids[T_NUMCLASSES]; + hid_t fapl; /* File Access Property List */ + int ninc; + int i; + char filename[1024]; h5_reset(); h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename); @@ -92,6 +93,19 @@ main(void) TESTING("library shutdown with reference count > 1"); + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Don't run this test with the multi/split VFD. A bug in library shutdown + * ordering causes problems with the multi VFD when IDs are left dangling. + */ + if (!HDstrcmp(env_h5_drvr, "multi") || !HDstrcmp(env_h5_drvr, "split")) { + HDputs("\n -- SKIPPED for incompatible VFD --"); + return 0; + } + /* Create the file */ if ((ids[T_FILE] = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/btree2.c b/test/btree2.c index aca0c77..2d34fa7 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -8849,8 +8849,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); TEST_ERROR /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0); + single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_NON_MULTIPART_DRIVERS); if (single_file_vfd) { /* Make a copy of the file in memory, in order to speed up deletion testing */ @@ -10127,7 +10126,7 @@ main(void) const char * envval = NULL; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; @@ -10135,6 +10134,11 @@ main(void) h5_reset(); fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); + + /* For the Direct I/O driver, skip intensive tests due to poor performance */ + if (!HDstrcmp(envval, "direct")) + ExpressMode = 2; + if (ExpressMode > 1) HDprintf("***Express test mode on. Some tests may be skipped\n"); diff --git a/test/cache.c b/test/cache.c index 6989564..e802a9b 100644 --- a/test/cache.c +++ b/test/cache.c @@ -35888,6 +35888,11 @@ main(void) HDprintf(" express_test = %d\n", express_test); HDprintf("=========================================\n"); + if (!h5_using_default_driver(NULL)) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } + if (create_entry_arrays() < 0) { HDprintf("ERROR: Unable to create entries arrays. Aborting.\n"); diff --git a/test/cache_api.c b/test/cache_api.c index 7858c65..432dab3 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -306,10 +306,10 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fclose() failed.\n"; } - else if (HDremove(filename) < 0) { + else if (H5Fdelete(filename, H5P_DEFAULT) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Fdelete() failed.\n"; } } @@ -442,28 +442,28 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) } } - /* close the fapl used to create the file */ + /* close the file and delete it */ if (pass) { - if (H5Pclose(fapl_id) < 0) { + if (H5Fclose(file_id) < 0) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = "H5Fclose() failed.\n"; + } + else if (H5Fdelete(filename, fapl_id) < 0) { + + pass = FALSE; + failure_mssg = "H5Fdelete() failed.\n"; } } - /* close the file and delete it */ + /* close the fapl used to create the file */ if (pass) { - if (H5Fclose(file_id) < 0) { - - pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; - } - else if (HDremove(filename) < 0) { + if (H5Pclose(fapl_id) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Pclose() failed.\n"; } } @@ -803,10 +803,10 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fclose() failed.\n"; } - else if (HDremove(filename) < 0) { + else if (H5Fdelete(filename, H5P_DEFAULT) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Fdelete() failed.\n"; } } @@ -1445,10 +1445,10 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fclose() failed.\n"; } - else if (HDremove(filename) < 0) { + else if (H5Fdelete(filename, H5P_DEFAULT) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Fdelete() failed.\n"; } } @@ -2170,10 +2170,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fclose() failed.\n"; } - else if (HDremove(filename) < 0) { + else if (H5Fdelete(filename, H5P_DEFAULT) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Fdelete() failed.\n"; } } @@ -2258,8 +2258,13 @@ main(void) for (paged = FALSE; paged <= TRUE; paged++) { hid_t my_fcpl = fcpl_id; - if (paged) - my_fcpl = fcpl2_id; + if (paged) { + /* Only run paged aggregation tests with sec2/default driver */ + if (!h5_using_default_driver(NULL)) + continue; + else + my_fcpl = fcpl2_id; + } if (!check_fapl_mdc_api_calls(paged, my_fcpl)) nerrs += 1; diff --git a/test/cache_image.c b/test/cache_image.c index 4967066..4100c1f 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -7839,7 +7839,7 @@ main(void) int express_test; /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -7853,8 +7853,7 @@ main(void) HDprintf("=========================================\n"); /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0); + single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_NON_MULTIPART_DRIVERS); nerrs += check_cache_image_ctl_flow_1(single_file_vfd); nerrs += check_cache_image_ctl_flow_2(single_file_vfd); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 06de174..b69a501 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -4572,6 +4572,12 @@ main(void) /* Open the HDF5 Library */ H5open(); + /* Only run with sec2/default driver */ + if (!h5_using_default_driver(NULL)) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } + /* ========== */ /* Test Setup */ /* ========== */ diff --git a/test/cork.c b/test/cork.c index 80934ad..8001f5d 100644 --- a/test/cork.c +++ b/test/cork.c @@ -26,7 +26,11 @@ */ #define H5C_FRIEND /*suppress error about including H5Cpkg */ #define H5C_TESTING /*suppress warning about H5C testing funcs*/ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_TESTING + #include "H5Cpkg.h" /* Cache */ +#include "H5FDpkg.h" /* ============ */ /* Test Defines */ @@ -2243,6 +2247,19 @@ main(void) nerrs += verify_old_dset_cork(); for (swmr = 0; swmr <= 1; swmr++) { + if (swmr) { + char *driver = NULL; + + /* Skip these tests if SWMR I/O is not supported for the VFD specified + * by the environment variable. + */ + driver = HDgetenv(HDF5_DRIVER); + if (!H5FD__supports_swmr_test(driver)) { + HDputs("-- SKIPPED SWMR tests for SWMR-incompatible VFD --"); + continue; + } + } + /* Tests with new/old library format */ /* This is the test moved from th5o.c: test_h5o_cork() */ nerrs += test_objs_cork(swmr, TRUE); diff --git a/test/dangle.c b/test/dangle.c index d41507b..95d3105 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -660,7 +660,21 @@ error: int main(void) { - int nerrors = 0; + const char *env_h5_drvr; /* File Driver value from environment */ + int nerrors = 0; + + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Don't run this test with the multi/split VFD. A bug in library shutdown + * ordering causes problems with the multi VFD when IDs are left dangling. + */ + if (!HDstrcmp(env_h5_drvr, "multi") || !HDstrcmp(env_h5_drvr, "split")) { + HDputs(" -- SKIPPED for incompatible VFD --"); + return 0; + } /* Run tests w/weak file close */ HDputs("Testing dangling objects with weak file close:"); diff --git a/test/dsets.c b/test/dsets.c index 922f370..5e80ef7 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -15558,10 +15558,11 @@ main(void) int nerrors = 0; const char *envval; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); int i; /* Don't run this test using certain file drivers */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; @@ -15718,7 +15719,11 @@ main(void) nerrors += (test_multiopen(file) < 0 ? 1 : 0); nerrors += (test_types(file) < 0 ? 1 : 0); nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0); - nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + + if (!driver_uses_modified_filename) { + nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + } + nerrors += (test_can_apply(file) < 0 ? 1 : 0); nerrors += (test_can_apply2(file) < 0 ? 1 : 0); nerrors += (test_optional_filters(file) < 0 ? 1 : 0); @@ -15727,7 +15732,11 @@ main(void) nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0); nerrors += (test_filter_delete(file) < 0 ? 1 : 0); - nerrors += (test_filters_endianess() < 0 ? 1 : 0); + + if (!driver_uses_modified_filename) { + nerrors += (test_filters_endianess() < 0 ? 1 : 0); + } + nerrors += (test_zero_dims(file) < 0 ? 1 : 0); nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); @@ -15745,7 +15754,11 @@ main(void) nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0); nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0); - nerrors += (test_idx_compatible() < 0 ? 1 : 0); + + if (!driver_uses_modified_filename) { + nerrors += (test_idx_compatible() < 0 ? 1 : 0); + } + nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0); nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0); @@ -15779,7 +15792,9 @@ main(void) nerrors += (test_gather_error() < 0 ? 1 : 0); /* Tests version bounds using its own file */ - nerrors += (test_versionbounds() < 0 ? 1 : 0); + if (!driver_uses_modified_filename) { + nerrors += (test_versionbounds() < 0 ? 1 : 0); + } /* Tests that use their own file */ nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0); diff --git a/test/dtransform.c b/test/dtransform.c index 743103f..b721a59 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -199,6 +199,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, COMPARE(TYPE, array, COMPARE_DATA, 2) \ } \ \ + if (H5Dclose(dset_nn) < 0) \ + TEST_ERROR; \ if (H5Dclose(dset) < 0) \ TEST_ERROR; \ if (H5Sclose(dataspace) < 0) \ diff --git a/test/dtypes.c b/test/dtypes.c index 8b3101c..1c1a6ec 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -3725,53 +3725,55 @@ test_compound_18(void) if (H5Fclose(file) < 0) FAIL_STACK_ERROR - /* Open Generated File */ - /* (generated with gen_bad_compound.c) */ - if ((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if (!h5_driver_uses_modified_filename()) { + /* Open Generated File */ + /* (generated with gen_bad_compound.c) */ + if ((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Try to open the datatype */ + H5E_BEGIN_TRY + { + tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); + } + H5E_END_TRY; + if (tid > 0) { + H5Tclose(tid); + FAIL_PUTS_ERROR("opened named datatype with bad compound datatype") + } /* end if */ - /* Try to open the datatype */ - H5E_BEGIN_TRY - { - tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); - } - H5E_END_TRY; - if (tid > 0) { - H5Tclose(tid); - FAIL_PUTS_ERROR("opened named datatype with bad compound datatype") - } /* end if */ + /* Try to open the dataset */ + H5E_BEGIN_TRY + { + did = H5Dopen2(file, "dataset", H5P_DEFAULT); + } + H5E_END_TRY; + if (did > 0) { + H5Dclose(did); + FAIL_PUTS_ERROR("opened dataset with bad compound datatype") + } /* end if */ - /* Try to open the dataset */ - H5E_BEGIN_TRY - { - did = H5Dopen2(file, "dataset", H5P_DEFAULT); - } - H5E_END_TRY; - if (did > 0) { - H5Dclose(did); - FAIL_PUTS_ERROR("opened dataset with bad compound datatype") - } /* end if */ + /* Open the group with the attribute */ + if ((gid = H5Gopen2(file, "group", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Open the group with the attribute */ - if ((gid = H5Gopen2(file, "group", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Try to open the dataset */ + H5E_BEGIN_TRY + { + aid = H5Aopen(gid, "attr", H5P_DEFAULT); + } + H5E_END_TRY; + if (aid > 0) { + H5Aclose(aid); + FAIL_PUTS_ERROR("opened attribute with bad compound datatype") + } /* end if */ - /* Try to open the dataset */ - H5E_BEGIN_TRY - { - aid = H5Aopen(gid, "attr", H5P_DEFAULT); + /* Close IDs */ + if (H5Gclose(gid) < 0) + FAIL_STACK_ERROR + if (H5Fclose(file) < 0) + FAIL_STACK_ERROR } - H5E_END_TRY; - if (aid > 0) { - H5Aclose(aid); - FAIL_PUTS_ERROR("opened attribute with bad compound datatype") - } /* end if */ - - /* Close IDs */ - if (H5Gclose(gid) < 0) - FAIL_STACK_ERROR - if (H5Fclose(file) < 0) - FAIL_STACK_ERROR PASSED(); return 0; diff --git a/test/error_test.c b/test/error_test.c index f4dc340..9ac76dd 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -738,7 +738,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_filter_error(const char *fname) +test_filter_error(const char *fname, hid_t fapl) { const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */ hid_t file = -1; @@ -748,7 +748,7 @@ test_filter_error(const char *fname) HDfprintf(stderr, "\nTesting error message during data reading when filter isn't registered\n"); /* Open the file */ - if ((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if ((file = H5Fopen(pathname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; /* Open the regular dataset */ @@ -785,9 +785,15 @@ main(void) hid_t fapl = -1; hid_t estack_id = -1; char filename[1024]; + const char *env_h5_drvr; /* File driver value from environment */ const char *FUNC_main = "main"; int i; + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n"); /* Initialize errors */ @@ -877,7 +883,15 @@ main(void) * the test file was pre-generated. */ h5_fixname(DATAFILE, H5P_DEFAULT, filename, sizeof filename); - if (test_filter_error(filename) < 0) + if (!h5_using_default_driver(env_h5_drvr) && HDstrcmp(env_h5_drvr, "stdio")) { + /* If not using the library's default VFD or the stdio VFD, force + * the library's default VFD here. The test file was pre-generated + * and can cause issues with many VFDs. + */ + if (H5Pset_driver(fapl, H5_DEFAULT_VFD, NULL) < 0) + TEST_ERROR; + } + if (test_filter_error(filename, fapl) < 0) TEST_ERROR; h5_clean_files(FILENAME, fapl); diff --git a/test/family_v16-000000.h5 b/test/family_v16-000000.h5 new file mode 100644 index 0000000..ac75ea9 Binary files /dev/null and b/test/family_v16-000000.h5 differ diff --git a/test/family_v16-000001.h5 b/test/family_v16-000001.h5 new file mode 100644 index 0000000..bf55b32 Binary files /dev/null and b/test/family_v16-000001.h5 differ diff --git a/test/family_v16-000002.h5 b/test/family_v16-000002.h5 new file mode 100644 index 0000000..9bd0891 Binary files /dev/null and b/test/family_v16-000002.h5 differ diff --git a/test/family_v16-000003.h5 b/test/family_v16-000003.h5 new file mode 100644 index 0000000..fedce2a Binary files /dev/null and b/test/family_v16-000003.h5 differ diff --git a/test/family_v16_00000.h5 b/test/family_v16_00000.h5 deleted file mode 100644 index ac75ea9..0000000 Binary files a/test/family_v16_00000.h5 and /dev/null differ diff --git a/test/family_v16_00001.h5 b/test/family_v16_00001.h5 deleted file mode 100644 index bf55b32..0000000 Binary files a/test/family_v16_00001.h5 and /dev/null differ diff --git a/test/family_v16_00002.h5 b/test/family_v16_00002.h5 deleted file mode 100644 index 9bd0891..0000000 Binary files a/test/family_v16_00002.h5 and /dev/null differ diff --git a/test/family_v16_00003.h5 b/test/family_v16_00003.h5 deleted file mode 100644 index fedce2a..0000000 Binary files a/test/family_v16_00003.h5 and /dev/null differ diff --git a/test/fheap.c b/test/fheap.c index 86a555d..3c3088d 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16365,7 +16365,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Don't run this test using certain file drivers */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; diff --git a/test/file_image.c b/test/file_image.c index 0d031f5..e2b7810 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -1361,7 +1361,10 @@ main(void) errors += test_properties(); errors += test_callbacks(); - errors += test_core(); + + if (!h5_driver_uses_modified_filename()) { + errors += test_core(); + } /* Perform tests with/without user block */ for (user = FALSE; user <= TRUE; user++) { diff --git a/test/filenotclosed.c b/test/filenotclosed.c index b5def9b..58edc06 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -68,7 +68,7 @@ main(void) hbool_t contig_addr_vfd; /* Contiguous address vfd */ /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; diff --git a/test/fillval.c b/test/fillval.c index 8de6ef1..7faeb65 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -2722,7 +2722,10 @@ main(int argc, char *argv[]) nerrors += test_create(my_fapl, FILENAME[1], H5D_CONTIGUOUS); nerrors += test_rdwr(my_fapl, FILENAME[3], H5D_CONTIGUOUS); nerrors += test_extend(my_fapl, FILENAME[5], H5D_CONTIGUOUS); - nerrors += test_compatible(); + + if (!h5_driver_uses_modified_filename()) { + nerrors += test_compatible(); + } } /* end if */ /* Compact dataset storage tests */ diff --git a/test/flush1.c b/test/flush1.c index 456f5f4..f5c4e2b 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -201,7 +201,7 @@ main(void) TEST_ERROR /* Check if the current VFD supports SWMR */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); vfd_supports_swmr = H5FD__supports_swmr_test(driver); /*************************************************/ diff --git a/test/flush2.c b/test/flush2.c index 3262b14..bf1187b 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -251,7 +251,7 @@ main(void) PUTS_ERROR("bad vfd-dependent fapl") /* Check if the current VFD supports SWMR */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); vfd_supports_swmr = H5FD__supports_swmr_test(driver); /* TEST 1 */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 5efff2f..8d2c083 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -153,7 +153,7 @@ main(int argc, const char *argv[]) * anything. */ /* Determine driver being used */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL || H5FD__supports_swmr_test(envval)) { if (test_flush() != SUCCEED) diff --git a/test/freespace.c b/test/freespace.c index e888b2b..1107609 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -661,13 +661,16 @@ test_fs_sect_add(hid_t fapl) /* Close the file */ if (H5Fclose(file) < 0) FAIL_STACK_ERROR + sect_node = NULL; - /* Get the size of a file w/empty heap*/ - if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0) - TEST_ERROR + if (h5_using_default_driver(NULL)) { + /* Get the size of a file w/empty heap*/ + if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR - if (tmp_file_size <= (file_size + fr_meta_size)) - TEST_ERROR + if (tmp_file_size <= (file_size + fr_meta_size)) + TEST_ERROR + } PASSED(); @@ -723,13 +726,16 @@ test_fs_sect_add(hid_t fapl) /* Close the file */ if (H5Fclose(file) < 0) FAIL_STACK_ERROR + sect_node = NULL; - /* Get the size of a file w/empty heap*/ - if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0) - TEST_ERROR + if (h5_using_default_driver(NULL)) { + /* Get the size of a file w/empty heap*/ + if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR - if (tmp_file_size != (file_size + fr_meta_size)) - TEST_ERROR + if (tmp_file_size != (file_size + fr_meta_size)) + TEST_ERROR + } PASSED(); @@ -799,6 +805,7 @@ test_fs_sect_add(hid_t fapl) /* Close the file */ if (H5Fclose(file) < 0) FAIL_STACK_ERROR + sect_node = NULL; PASSED(); @@ -878,6 +885,7 @@ test_fs_sect_add(hid_t fapl) /* Close the file */ if (H5Fclose(file) < 0) FAIL_STACK_ERROR + sect_node = NULL; PASSED(); diff --git a/test/getname.c b/test/getname.c index 200c426..485e3c1 100644 --- a/test/getname.c +++ b/test/getname.c @@ -3775,8 +3775,12 @@ main(void) /* Call "main" test routine */ nerrors += test_main(file_id, fapl); - nerrors += test_obj_ref(fapl); - nerrors += test_reg_ref(fapl); + + if (!h5_using_parallel_driver(NULL)) { + nerrors += test_obj_ref(fapl); + nerrors += test_reg_ref(fapl); + } + nerrors += test_elinks(fapl); /* Close file */ diff --git a/test/h5test.c b/test/h5test.c index ba0662a..e69a682 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -40,10 +40,7 @@ * to the cpp constant. If neither is defined then use some default value. * * HDF5_DRIVER: This string describes what low level file driver to - * use for HDF5 file access. The first word in the - * value is the name of the driver and subsequent data - * is interpreted according to the driver. See - * h5_get_vfd_fapl() for details. + * use for HDF5 file access. * * HDF5_LIBVER_BOUNDS: This string describes what library version bounds to * use for HDF5 file access. See h5_get_libver_fapl() for details. @@ -525,8 +522,8 @@ static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock) { - const char *prefix = NULL; - const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *prefix = NULL; + const char *driver_env_var = NULL; /* HDF5_DRIVER environment variable */ char * ptr, last = '\0'; const char *suffix = _suffix; size_t i, j; @@ -538,6 +535,13 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu HDmemset(fullname, 0, size); + /* Determine if driver is set by environment variable. If it is, + * only generate a suffix if fixing the filename for the superblock + * file. */ + driver_env_var = HDgetenv(HDF5_DRIVER); + if (driver_env_var && (H5P_DEFAULT == fapl) && subst_for_superblock) + fapl = H5P_FILE_ACCESS_DEFAULT; + /* figure out the suffix */ if (H5P_DEFAULT != fapl) { if ((driver = H5Pget_driver(fapl)) < 0) @@ -546,28 +550,25 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu if (suffix) { if (H5FD_FAMILY == driver) { if (subst_for_superblock) - suffix = "00000.h5"; + suffix = "-000000.h5"; else - suffix = nest_printf ? "%%05d.h5" : "%05d.h5"; + suffix = nest_printf ? "-%%06d.h5" : "-%06d.h5"; } else if (H5FD_MULTI == driver) { - /* Get the environment variable, if it exists, in case + /* Check the HDF5_DRIVER environment variable in case * we are using the split driver since both of those * use the multi VFD under the hood. */ - env = HDgetenv("HDF5_DRIVER"); #ifdef HDF5_DRIVER /* Use the environment variable, then the compile-time constant */ - if (!env) - env = HDF5_DRIVER; + if (!driver_env_var) + driver_env_var = HDF5_DRIVER; #endif - if (env && !HDstrcmp(env, "split")) { + if (driver_env_var && !HDstrcmp(driver_env_var, "split")) { /* split VFD */ if (subst_for_superblock) - suffix = "-m.h5"; - else - suffix = NULL; + suffix = ".h5.meta"; } else { /* multi VFD */ @@ -583,7 +584,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX * could be of value -1 if it is not defined. */ - isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver); + isppdriver = ((H5P_DEFAULT != fapl) || driver_env_var) && (H5FD_MPIO == driver); /* Check HDF5_NOCLEANUP environment setting. * (The #ifdef is needed to prevent compile failure in case MPI is not @@ -591,12 +592,12 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu */ if (isppdriver) { #ifdef H5_HAVE_PARALLEL - if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP")) + if (getenv_all(MPI_COMM_WORLD, 0, HDF5_NOCLEANUP)) SetTestNoCleanup(); #endif /* H5_HAVE_PARALLEL */ } else { - if (HDgetenv("HDF5_NOCLEANUP")) + if (HDgetenv(HDF5_NOCLEANUP)) SetTestNoCleanup(); } @@ -798,11 +799,7 @@ h5_fileaccess(void) if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; - /* Attempt to set up a file driver first */ - if (h5_get_vfd_fapl(fapl_id) < 0) - goto error; - - /* Finally, check for libver bounds */ + /* Check for libver bounds */ if (h5_get_libver_fapl(fapl_id) < 0) goto error; @@ -837,11 +834,7 @@ h5_fileaccess_flags(unsigned flags) if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; - /* Attempt to set up a file driver first */ - if ((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0) - goto error; - - /* Finally, check for libver bounds */ + /* Check for libver bounds */ if ((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) goto error; @@ -854,150 +847,6 @@ error: } /* end h5_fileaccess_flags() */ /*------------------------------------------------------------------------- - * Function: h5_get_vfd_fapl - * - * Purpose: Sets the file driver for a FAPL according to the value specified - * in the constant or environment variable "HDF5_DRIVER". - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Dana Robinson - * February 2016 - * - *------------------------------------------------------------------------- - */ -herr_t -h5_get_vfd_fapl(hid_t fapl) -{ - const char *env = NULL; /* HDF5_DRIVER environment variable */ - const char *tok = NULL; /* strtok pointer */ - char * lasts = NULL; /* Context pointer for strtok_r() call */ - char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ - - /* Get the environment variable, if it exists */ - env = HDgetenv("HDF5_DRIVER"); -#ifdef HDF5_DRIVER - /* Use the environment variable, then the compile-time constant */ - if (!env) - env = HDF5_DRIVER; -#endif - - /* If the environment variable was not set, just return - * without modifying the FAPL. - */ - if (!env || !*env) - goto done; - - /* Get the first 'word' of the environment variable. - * If it's nothing (environment variable was whitespace) - * just return the default fapl. - */ - HDstrncpy(buf, env, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; - if (NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) - goto done; - - if (!HDstrcmp(tok, "sec2")) { - /* POSIX (section 2) read() and write() system calls */ - if (H5Pset_fapl_sec2(fapl) < 0) - goto error; - } - else if (!HDstrcmp(tok, "stdio")) { - /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(fapl) < 0) - goto error; - } - else if (!HDstrcmp(tok, "core")) { - /* In-memory driver settings (backing store on, 1 MB increment) */ - if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) - goto error; - } - else if (!HDstrcmp(tok, "core_paged")) { - /* In-memory driver with write tracking and paging on */ - if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) - goto error; - if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) - goto error; - } - else if (!HDstrcmp(tok, "split")) { - /* Split meta data and raw data each using default driver */ - if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) - goto error; - } - else if (!HDstrcmp(tok, "multi")) { - /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char * sv[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - H5FD_mem_t mt; - - HDmemset(memb_map, 0, sizeof(memb_map)); - HDmemset(memb_fapl, 0, sizeof(memb_fapl)); - HDmemset(memb_name, 0, sizeof(memb_name)); - HDmemset(memb_addr, 0, sizeof(memb_addr)); - - HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - memb_fapl[mt] = H5P_DEFAULT; - sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN); - HDassert(sv[mt]); - HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); - memb_name[mt] = sv[mt]; - memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); - } /* end for */ - - if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) - goto error; - - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - HDfree(sv[mt]); - } - else if (!HDstrcmp(tok, "family")) { - /* Family of files, each 1MB and using the default driver */ - hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */ - - /* Was a family size specified in the environment variable? */ - if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) - fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024); - if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) - goto error; - } - else if (!HDstrcmp(tok, "log")) { - /* Log file access */ - unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; - - /* Were special log file flags specified in the environment variable? */ - if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) - log_flags = (unsigned)HDstrtol(tok, NULL, 0); - - if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - goto error; -#ifdef H5_HAVE_DIRECT - } - else if (!HDstrcmp(tok, "direct")) { - /* Linux direct read() and write() system calls. Set memory boundary, - * file block size, and copy buffer size to the default values. - */ - if (H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) - goto error; -#endif - } - else { - /* Unknown driver */ - goto error; - } /* end if */ - -done: - return 0; - -error: - return -1; -} /* end h5_get_vfd_fapl() */ - -/*------------------------------------------------------------------------- * Function: h5_get_libver_fapl * * Purpose: Sets the library version bounds for a FAPL according to the @@ -1333,30 +1182,58 @@ h5_get_file_size(const char *filename, hid_t fapl) #ifdef H5_HAVE_DIRECT driver == H5FD_DIRECT || #endif /* H5_HAVE_DIRECT */ - driver == H5FD_LOG) { + driver == H5FD_LOG || driver == H5FD_SPLITTER) { /* Get the file's statistics */ if (0 == HDstat(filename, &sb)) return ((h5_stat_size_t)sb.st_size); } /* end if */ else if (driver == H5FD_MULTI) { H5FD_mem_t mt; - h5_stat_size_t tot_size = 0; - - HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - /* Create the filename to query */ - HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); - - /* Check for existence of file */ - if (0 == HDaccess(temp, F_OK)) { - /* Get the file's statistics */ - if (0 != HDstat(temp, &sb)) - return (-1); - - /* Add to total size */ - tot_size += (h5_stat_size_t)sb.st_size; - } /* end if */ - } /* end for */ + h5_stat_size_t tot_size = 0; + char * driver_env_var = NULL; + + driver_env_var = HDgetenv(HDF5_DRIVER); + if (driver_env_var && !HDstrcmp(driver_env_var, "split")) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + if (mt != H5FD_MEM_DRAW && mt != H5FD_MEM_SUPER) + continue; + + /* Create the filename to query */ + if (mt == H5FD_MEM_DRAW) { + HDsnprintf(temp, sizeof temp, "%s.raw", filename); + } + else { + HDsnprintf(temp, sizeof temp, "%s.meta", filename); + } + + /* Check for existence of file */ + if (0 == HDaccess(temp, F_OK)) { + /* Get the file's statistics */ + if (0 != HDstat(temp, &sb)) + return (-1); + + /* Add to total size */ + tot_size += (h5_stat_size_t)sb.st_size; + } /* end if */ + } /* end for */ + } + else { + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + /* Create the filename to query */ + HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); + + /* Check for existence of file */ + if (0 == HDaccess(temp, F_OK)) { + /* Get the file's statistics */ + if (0 != HDstat(temp, &sb)) + return (-1); + + /* Add to total size */ + tot_size += (h5_stat_size_t)sb.st_size; + } /* end if */ + } /* end for */ + } /* Return total size */ return (tot_size); @@ -1404,7 +1281,9 @@ h5_get_file_size(const char *filename, hid_t fapl) return (tot_size); } /* end if */ else { - HDassert(0 && "Unknown VFD!"); + /* Get the file's statistics */ + if (0 == HDstat(filename, &sb)) + return ((h5_stat_size_t)sb.st_size); } /* end else */ } /* end else */ @@ -1892,7 +1771,9 @@ dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hi } /* Dummy VFD with the minimum parameters to make a VFD that can be registered */ +#define DUMMY_VFD_VALUE (H5FD_class_value_t)155 static const H5FD_class_t H5FD_dummy_g = { + DUMMY_VFD_VALUE, /* value */ "dummy", /* name */ 1, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -2288,3 +2169,137 @@ error: } return FAIL; } /* end h5_check_if_file_locking_enabled() */ + +/*------------------------------------------------------------------------- + * Function: h5_using_default_driver + * + * Purpose: Checks if the specified VFD name matches the library's + * default VFD. If `drv_name` is NULL, the HDF5_DRIVER + * environment is checked instead (if it is set). + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +h5_using_default_driver(const char *drv_name) +{ + hbool_t ret_val = TRUE; + + HDassert(H5_DEFAULT_VFD == H5FD_SEC2); + + if (!drv_name) + drv_name = HDgetenv(HDF5_DRIVER); + + if (drv_name) + return (!HDstrcmp(drv_name, "sec2") || !HDstrcmp(drv_name, "nomatch")); + + return ret_val; +} + +/*------------------------------------------------------------------------- + * Function: h5_using_parallel_driver + * + * Purpose: Checks if the specified VFD name matches a parallel-enabled + * VFD (usually `mpio`). If `drv_name` is NULL, the + * HDF5_DRIVER environment is checked instead (if it is set). + * + * This is mostly useful for avoiding tests that use features + * which are not currently supported for parallel HDF5, such + * as writing of VL or region reference datatypes. + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +h5_using_parallel_driver(const char *drv_name) +{ + hbool_t ret_val = FALSE; + + if (!drv_name) + drv_name = HDgetenv(HDF5_DRIVER); + + if (drv_name) + return (!HDstrcmp(drv_name, "mpio")); + + return ret_val; +} + +/*------------------------------------------------------------------------- + * Function: h5_driver_uses_modified_filename + * + * Purpose: Checks if the current VFD set by use of the HDF5_DRIVER + * environment variable uses a modified filename. Examples + * are the multi and family drivers. + * + * This routine is helpful for skipping tests that use + * pre-generated files. VFDs that use a modified filename will + * not be able to find these files and those tests will fail. + * Eventually, HDF5's testing framework should be modified to + * not run VFD testing against tests that use pre-generated + * files. + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +h5_driver_uses_modified_filename(void) +{ + hbool_t ret_val = FALSE; + char * driver = HDgetenv(HDF5_DRIVER); + + if (driver) { + ret_val = !HDstrcmp(driver, "multi") || !HDstrcmp(driver, "split") || !HDstrcmp(driver, "family") || + !HDstrcmp(driver, "splitter"); + } + + return ret_val; +} /* end h5_driver_uses_modified_filename() */ + +/*------------------------------------------------------------------------- + * Function: h5_driver_uses_multiple_files + * + * Purpose: Checks if the specified VFD name matches a driver that + * stores data using multiple files. + * + * The following flags can be used to control what types of + * drivers are checked for by this routine: + * + * H5_EXCLUDE_MULTIPART_DRIVERS - This flag excludes any + * drivers which store data using multiple files which, + * together, make up a single logical file. These are + * drivers like the split, multi and family drivers. + * + * H5_EXCLUDE_NON_MULTIPART_DRIVERS - This flag excludes any + * drivers which store data using multiple files which are + * separate logical files. The splitter driver is an example + * of this type of driver. + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +h5_driver_uses_multiple_files(const char *drv_name, unsigned flags) +{ + hbool_t ret_val = FALSE; + + if (!drv_name) + drv_name = HDgetenv(HDF5_DRIVER); + + if (drv_name) { + if ((flags & H5_EXCLUDE_MULTIPART_DRIVERS) == 0) { + if (!HDstrcmp(drv_name, "split") || !HDstrcmp(drv_name, "multi") || !HDstrcmp(drv_name, "family")) + return TRUE; + } + + if ((flags & H5_EXCLUDE_NON_MULTIPART_DRIVERS) == 0) { + if (!HDstrcmp(drv_name, "splitter")) + return TRUE; + } + } + + return ret_val; +} diff --git a/test/h5test.h b/test/h5test.h index 2855fb5..914a534 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -166,8 +166,11 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #define H5_ALARM_SEC 1200 /* default is 20 minutes */ /* Flags for h5_fileaccess_flags() */ -#define H5_FILEACCESS_VFD 0x01 -#define H5_FILEACCESS_LIBVER 0x02 +#define H5_FILEACCESS_LIBVER 0x01 + +/* Flags for h5_driver_uses_multiple_files() */ +#define H5_EXCLUDE_MULTIPART_DRIVERS 0x01 +#define H5_EXCLUDE_NON_MULTIPART_DRIVERS 0x02 /* Macros to create and fill 2D arrays with a single heap allocation. * These can be used to replace large stack and global arrays which raise @@ -255,9 +258,12 @@ H5TEST_DLL const char * h5_get_version_string(H5F_libver_t libver); H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2); H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest); H5TEST_DLL herr_t h5_check_if_file_locking_enabled(hbool_t *are_enabled); +H5TEST_DLL hbool_t h5_using_default_driver(const char *drv_name); +H5TEST_DLL hbool_t h5_using_parallel_driver(const char *drv_name); +H5TEST_DLL hbool_t h5_driver_uses_modified_filename(void); +H5TEST_DLL hbool_t h5_driver_uses_multiple_files(const char *drv_name, unsigned flags); /* Functions that will replace components of a FAPL */ -H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); H5TEST_DLL herr_t h5_get_libver_fapl(hid_t fapl_id); /* h5_clean_files() replacements */ diff --git a/test/lheap.c b/test/lheap.c index 2609510..283c3e3 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -174,27 +174,29 @@ main(void) goto error; PASSED(); - /* Check opening existing file non-default sizes of lengths and addresses */ - TESTING("opening pre-created file with non-default sizes"); - { - const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ - hid_t dset = -1; - file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); - if (file >= 0) { - if ((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) - TEST_ERROR - if (H5Dclose(dset) < 0) - TEST_ERROR - if (H5Fclose(file) < 0) - TEST_ERROR + if (!h5_driver_uses_modified_filename()) { + /* Check opening existing file non-default sizes of lengths and addresses */ + TESTING("opening pre-created file with non-default sizes"); + { + const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ + hid_t dset = -1; + file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + if (file >= 0) { + if ((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) + TEST_ERROR + if (H5Dclose(dset) < 0) + TEST_ERROR + if (H5Fclose(file) < 0) + TEST_ERROR + } + else { + H5_FAILED(); + HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n", testfile); + goto error; + } /* end else */ } - else { - H5_FAILED(); - HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n", testfile); - goto error; - } /* end else */ + PASSED(); } - PASSED(); /* Verify symbol table messages are cached */ if (h5_verify_cached_stabs(FILENAME, fapl) < 0) diff --git a/test/links.c b/test/links.c index f022783..e1a9dba 100644 --- a/test/links.c +++ b/test/links.c @@ -9897,7 +9897,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) would report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI || - base_driver == H5FD_MPIO || base_driver == H5FD_CORE) + base_driver == H5FD_MPIO || base_driver == H5FD_CORE || base_driver == H5FD_DIRECT) ? H5P_DEFAULT : fapl; op_data.fam_size = ELINK_CB_FAM_SIZE; @@ -10071,8 +10071,11 @@ external_reset_register(void) if (H5Fclose(file) < 0) TEST_ERROR - if (HDremove(filename) != 0) - TEST_ERROR + H5E_BEGIN_TRY + { + H5Fdelete(filename, H5P_DEFAULT); + } + H5E_END_TRY; PASSED(); return SUCCEED; @@ -16629,11 +16632,14 @@ link_filters(hid_t fapl, hbool_t new_format) /* Close file, get file size */ if (H5Fclose(fid) < 0) TEST_ERROR - filesize_filtered = h5_get_file_size(filename, fapl); - /* Check that the file size is smaller with the filter */ - if ((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) - TEST_ERROR + if (h5_using_default_driver(NULL)) { + filesize_filtered = h5_get_file_size(filename, fapl); + + /* Check that the file size is smaller with the filter */ + if ((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) + TEST_ERROR + } /* Close */ if (H5Pclose(fcpl) < 0) @@ -22544,8 +22550,9 @@ main(void) unsigned minimize_dset_oh; unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -22611,88 +22618,100 @@ main(void) nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on the fapl - */ - nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; + /* Skip external link tests for splitter VFD, which has external link-related bugs */ + if (HDstrcmp(env_h5_drvr, "splitter")) { - /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open - */ - nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; + /* tests for external link */ + /* Test external file cache first, so it sees the default efc setting on the fapl + */ + nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; - /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent - */ - nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + /* This test cannot run with the EFC because it assumes that an + * intermediate file is not held open + */ + nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; - /* Try external link tests both with and without the external file cache */ - for (efc = FALSE; efc <= TRUE; efc++) { - if (efc) { - if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR - HDprintf("\n---Testing with external file cache---\n"); - } /* end if */ - else { - if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR - HDprintf("\n---Testing without external file cache---\n"); - } /* end else */ + /* This test cannot run with the EFC because the EFC cannot currently + * reopen a cached file with a different intent + */ + nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + + /* Try external link tests both with and without the external file cache */ + for (efc = FALSE; efc <= TRUE; efc++) { + if (efc) { + if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0) + TEST_ERROR + HDprintf("\n---Testing with external file cache---\n"); + } /* end if */ + else { + if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR + HDprintf("\n---Testing without external file cache---\n"); + } /* end else */ - nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_endian(new_format) < 0 ? 1 : 0; - nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; - - nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; + + if (!driver_uses_modified_filename) { + nerrors += external_link_endian(new_format) < 0 ? 1 : 0; + } + + nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; + + nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; + + if (!driver_uses_modified_filename) { + nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; + } + + nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH - nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; #endif - nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; - } /* with/without external file cache */ + nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + } /* with/without external file cache */ + } /* These tests assume that external links are a form of UD links, * so assume that everything that passed for external links diff --git a/test/links_env.c b/test/links_env.c index 590be20..7170132 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -152,8 +152,20 @@ error: int main(void) { - hid_t fapl; /* File access property lists */ - int nerrors = 0; /* Error from tests */ + const char *env_h5_drvr; /* File driver value from environment */ + hid_t fapl; /* File access property lists */ + int nerrors = 0; /* Error from tests */ + + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Splitter VFD has issues with external links */ + if (!HDstrcmp(env_h5_drvr, "splitter")) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } h5_reset(); fapl = h5_fileaccess(); diff --git a/test/mf.c b/test/mf.c index 59088dc..5f2abc0 100644 --- a/test/mf.c +++ b/test/mf.c @@ -223,15 +223,16 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2; haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF; hsize_t ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MM_alloc() of file allocation"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -371,15 +372,16 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) haddr_t addr = 0; haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MF_try_shrink() of file allocation: test 1"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -478,9 +480,9 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of file allocation: test 2"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - if (contig_addr_vfd) { + if (suitable_vfd) { /* Re-open the file with meta/small data setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -528,9 +530,9 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of file allocation: test 3"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - if (contig_addr_vfd) { + if (suitable_vfd) { /* Re-open the file with meta/small data setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -573,9 +575,9 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of file allocation: test 4"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - if (contig_addr_vfd) { + if (suitable_vfd) { /* Re-open the file with meta/small data setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -658,15 +660,16 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) htri_t was_extended; haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MF_try_extend() of file allocation: test 1"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -763,9 +766,9 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_extend() of file allocation: test 2"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - if (contig_addr_vfd) { + if (suitable_vfd) { /* Re-open the file with meta/small data setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -2188,13 +2191,14 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2; haddr_t ma_addr = HADDR_UNDEF; hsize_t ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator:test 1"); - /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + /* Skip test when using VFDs that don't use the metadata aggregator. Also skip test for Direct VFD. */ + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2339,13 +2343,14 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2, addr3; haddr_t ma_addr = HADDR_UNDEF; hsize_t ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator:test 2"); - /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + /* Skip test when using VFDs that don't use the metadata aggregator. Also skip test for Direct VFD. */ + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3847,16 +3852,17 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) htri_t was_extended; H5FS_stat_t state; hsize_t alignment = 0, mis_align = 0, tmp = 0, accum = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MM_alloc() of file allocation with alignment: test 1"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3966,9 +3972,10 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TESTING("H5MF_try_shrink() of file allocation with alignment: test 2"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - if (have_alloc_vfd) { + if (suitable_vfd) { /* Re-open the file with alignment and meta/sdata setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0) FAIL_STACK_ERROR @@ -4023,9 +4030,10 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TESTING("H5MF_try_extend() of file allocation with alignment: test 3"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - if (have_alloc_vfd) { + if (suitable_vfd) { /* Re-open the file with alignment and meta/sdata setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0) FAIL_STACK_ERROR @@ -4080,6 +4088,9 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ + if (fapl1 >= 0 && H5Pclose(fapl1) < 0) + FAIL_STACK_ERROR + return (0); error: @@ -4135,7 +4146,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) H5FS_stat_t state; htri_t was_extended; hsize_t alignment = 0, tmp = 0, mis_align = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of free-space manager with alignment: test 1"); @@ -4297,10 +4308,11 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { if ((file_size = h5_get_file_size(filename, new_fapl)) < 0) TEST_ERROR @@ -4497,16 +4509,17 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, mis_align = 0; hsize_t alignment = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 1"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4759,16 +4772,17 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF; hsize_t ma_size = 0, sdata_size = 0, mis_align = 0; hsize_t alignment = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 2"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5104,16 +5118,17 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF; hsize_t ma_size = 0, sdata_size = 0, mis_align = 0; hsize_t alignment = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 3"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5417,16 +5432,17 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, saved_ma_size = 0; hsize_t alignment = 0, mis_align = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 4"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5635,16 +5651,17 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t sdata_addr = HADDR_UNDEF, new_sdata_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0, new_sdata_size = 0; hsize_t alignment = 0, mis_align = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 5"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5905,16 +5922,17 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0; hsize_t alignment = 0, mis_align = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 6"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -6139,20 +6157,23 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) /* Add alignment to member files for split/multi driver */ if (split || multi) { - hid_t memb_fapl; + if (split) { + hid_t memb_fapl_arr[H5FD_MEM_NTYPES]; - /* Creat fapl */ - if ((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - TEST_ERROR + /* Get current multi settings */ + if (H5Pget_fapl_multi(copied_fapl, NULL, memb_fapl_arr, NULL, NULL, NULL) < 0) + TEST_ERROR - /* Set alignment. Note that it is the block size of the parent FAPL that - * is important here. */ - if (H5Pset_alignment(memb_fapl, 0, align) < 0) - TEST_ERROR + /* Set alignment. Note that it is the block size of the parent FAPL that + * is important here. */ + if (H5Pset_alignment(memb_fapl_arr[H5FD_MEM_SUPER], 0, align) < 0) + TEST_ERROR + if (H5Pset_alignment(memb_fapl_arr[H5FD_MEM_DRAW], 0, align) < 0) + TEST_ERROR - if (split) { /* Set split driver with new FAPLs */ - if (H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0) + if (H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl_arr[H5FD_MEM_SUPER], "-r.h5", + memb_fapl_arr[H5FD_MEM_DRAW]) < 0) TEST_ERROR } /* end if */ else { @@ -6165,14 +6186,17 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) /* Get current multi settings */ HDmemset(memb_name, 0, sizeof memb_name); - if (H5Pget_fapl_multi(copied_fapl, memb_map, NULL, memb_name, memb_addr, &relax) < 0) + if (H5Pget_fapl_multi(copied_fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0) TEST_ERROR /* Populate memb_fapl_arr, patch memb_addr so member file addresses * are aligned */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - memb_fapl_arr[mt] = memb_fapl; - memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align; + /* Set alignment. Note that it is the block size of the parent FAPL that + * is important here. */ + if (H5Pset_alignment(memb_fapl_arr[mt], 0, align) < 0) + TEST_ERROR + memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align; } /* end for */ /* Set multi driver with new FAPLs */ @@ -6184,11 +6208,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) HDfree(memb_name[mt]); } /* end else */ - - /* Close memb_fapl */ - if (H5Pclose(memb_fapl) < 0) - TEST_ERROR - } /* end if */ + } /* end if */ /* Reopen the file with alignment */ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, copied_fapl)) < 0) @@ -6253,6 +6273,9 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) PASSED(); + if (H5Pclose(copied_fapl) < 0) + TEST_ERROR + /* Close file */ if (H5Fclose(file) < 0) TEST_ERROR @@ -9128,7 +9151,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; diff --git a/test/mtime.c b/test/mtime.c index 43dc502..10cafd1 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -60,6 +60,7 @@ main(void) signed char buf1[32], buf2[32]; char filename[1024]; int token_cmp; + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); h5_reset(); fapl = h5_fileaccess(); @@ -131,63 +132,67 @@ main(void) } PASSED(); - /* Check opening existing file with old-style modification time information - * and make certain that the time is correct - */ - TESTING("accessing old modification time messages"); - - { - const char *testfile = H5_get_srcdir_filename(TESTFILE1); /* Corrected test file name */ - - file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); - if (file >= 0) { - if (H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) - TEST_ERROR; - if (oi1.ctime != MTIME1) { + if (!driver_uses_modified_filename) { + /* Check opening existing file with old-style modification time information + * and make certain that the time is correct + */ + TESTING("accessing old modification time messages"); + + { + const char *testfile = H5_get_srcdir_filename(TESTFILE1); /* Corrected test file name */ + + file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + if (file >= 0) { + if (H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) + TEST_ERROR; + if (oi1.ctime != MTIME1) { + H5_FAILED(); + /* If this fails, examine H5Omtime.c. Modification time is very + * system dependent (e.g., on Windows DST must be hardcoded). */ + HDputs(" Old modification time incorrect"); + goto error; + } + if (H5Fclose(file) < 0) + TEST_ERROR; + } + else { H5_FAILED(); - /* If this fails, examine H5Omtime.c. Modification time is very - * system dependent (e.g., on Windows DST must be hardcoded). */ - HDputs(" Old modification time incorrect"); + HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); goto error; - } - if (H5Fclose(file) < 0) - TEST_ERROR; + } /* end else */ } - else { - H5_FAILED(); - HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); - goto error; - } /* end else */ + PASSED(); } - PASSED(); - /* Check opening existing file with new-style modification time information - * and make certain that the time is correct - */ - TESTING("accessing new modification time messages"); - - { - const char *testfile = H5_get_srcdir_filename(TESTFILE2); /* Corrected test file name */ - - file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); - if (file >= 0) { - if (H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) - TEST_ERROR; - if (oi2.ctime != MTIME2) { + if (!driver_uses_modified_filename) { + /* Check opening existing file with new-style modification time information + * and make certain that the time is correct + */ + TESTING("accessing new modification time messages"); + + { + const char *testfile = H5_get_srcdir_filename(TESTFILE2); /* Corrected test file name */ + + file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + if (file >= 0) { + if (H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) + TEST_ERROR; + if (oi2.ctime != MTIME2) { + H5_FAILED(); + HDputs(" Modification time incorrect."); + goto error; + } + if (H5Fclose(file) < 0) + TEST_ERROR; + } + else { H5_FAILED(); - HDputs(" Modification time incorrect."); + HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); goto error; - } - if (H5Fclose(file) < 0) - TEST_ERROR; + } /* end else */ } - else { - H5_FAILED(); - HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); - goto error; - } /* end else */ + PASSED(); } - PASSED(); /* Verify symbol table messages are cached */ if (h5_verify_cached_stabs(FILENAME, fapl) < 0) diff --git a/test/ntypes.c b/test/ntypes.c index 13cc72a..37a63a4 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -3131,11 +3131,19 @@ main(void) nerrors += test_enum_dtype(file) < 0 ? 1 : 0; nerrors += test_array_dtype(file) < 0 ? 1 : 0; nerrors += test_array_dtype2(file) < 0 ? 1 : 0; - nerrors += test_vl_dtype(file) < 0 ? 1 : 0; - nerrors += test_vlstr_dtype(file) < 0 ? 1 : 0; + + if (!h5_using_parallel_driver(NULL)) { + nerrors += test_vl_dtype(file) < 0 ? 1 : 0; + nerrors += test_vlstr_dtype(file) < 0 ? 1 : 0; + } + nerrors += test_str_dtype(file) < 0 ? 1 : 0; - nerrors += test_refer_dtype(file) < 0 ? 1 : 0; - nerrors += test_refer_dtype2(file) < 0 ? 1 : 0; + + if (!h5_using_parallel_driver(NULL)) { + nerrors += test_refer_dtype(file) < 0 ? 1 : 0; + nerrors += test_refer_dtype2(file) < 0 ? 1 : 0; + } + nerrors += test_opaque_dtype(file) < 0 ? 1 : 0; nerrors += test_bitfield_dtype(file) < 0 ? 1 : 0; nerrors += test_ninteger() < 0 ? 1 : 0; diff --git a/test/null_vfd_plugin.c b/test/null_vfd_plugin.c new file mode 100644 index 0000000..8031484 --- /dev/null +++ b/test/null_vfd_plugin.c @@ -0,0 +1,131 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Purpose: A simple Virtual File Driver (VFD) with almost no functionality + * that is used for testing basic VFD plugin handling (registration, etc.). + */ + +/* Public HDF5 headers */ +#include "hdf5.h" + +/* For HDF5 plugin functionality */ +#include "H5PLextern.h" + +/* This driver's header */ +#include "null_vfd_plugin.h" + +/* Prototypes */ +static H5FD_t *H5FD_null_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static herr_t H5FD_null_close(H5FD_t *_file); +static herr_t H5FD_null_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + void *buf); +static herr_t H5FD_null_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + const void *buf); +static haddr_t H5FD_null_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_null_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD_null_get_eof(const H5FD_t *_file, H5FD_mem_t type); + +static const H5FD_class_t H5FD_null_g = { + NULL_VFD_VALUE, /* value */ + NULL_VFD_NAME, /* name */ + 1, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + NULL, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD_null_open, /* open */ + H5FD_null_close, /* close */ + NULL, /* cmp */ + NULL, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD_null_get_eoa, /* get_eoa */ + H5FD_null_set_eoa, /* set_eoa */ + H5FD_null_get_eof, /* get_eof */ + NULL, /* get_handle */ + H5FD_null_read, /* read */ + H5FD_null_write, /* write */ + NULL, /* flush */ + NULL, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + NULL, /* del */ + NULL, /* ctl */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + +static H5FD_t * +H5FD_null_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +{ + return NULL; +} + +static herr_t +H5FD_null_close(H5FD_t *_file) +{ + return 0; +} + +static herr_t +H5FD_null_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf) +{ + return 0; +} + +static herr_t +H5FD_null_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) +{ + return 0; +} + +static haddr_t +H5FD_null_get_eoa(const H5FD_t *_file, H5FD_mem_t type) +{ + return HADDR_UNDEF; +} + +static herr_t +H5FD_null_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) +{ + return 0; +} + +static haddr_t +H5FD_null_get_eof(const H5FD_t *_file, H5FD_mem_t type) +{ + return HADDR_UNDEF; +} + +/* These two functions are necessary to load this plugin using + * the HDF5 library. + */ + +H5PL_type_t +H5PLget_plugin_type(void) +{ + return H5PL_TYPE_VFD; +} + +const void * +H5PLget_plugin_info(void) +{ + return &H5FD_null_g; +} diff --git a/test/null_vfd_plugin.h b/test/null_vfd_plugin.h new file mode 100644 index 0000000..7b7671f --- /dev/null +++ b/test/null_vfd_plugin.h @@ -0,0 +1,33 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The public header file for the null testing VFD plugin. + */ +#ifndef H5FDnull_H +#define H5FDnull_H + +#define H5FD_NULL (H5FD_null_init()) +#define NULL_VFD_NAME "null_vfd_plugin" +#define NULL_VFD_VALUE ((H5FD_class_value_t)200) + +#ifdef __cplusplus +extern "C" { +#endif + +H5_DLL hid_t H5FD_null_init(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/test/objcopy.c b/test/objcopy.c index e01083d..c8a5bac 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -17305,13 +17305,18 @@ error: int main(void) { - int nerrors = 0; - hid_t fapl, fapl2; - hid_t fcpl_shared, ocpl; - unsigned max_compact, min_dense; - int configuration; /* Configuration of tests. */ - int ExpressMode; - hbool_t same_file; /* Whether to run tests that only use one file */ + int nerrors = 0; + hid_t fapl, fapl2; + hid_t fcpl_shared, ocpl; + unsigned max_compact, min_dense; + int configuration; /* Configuration of tests. */ + int ExpressMode; + const char *env_h5_drvr; /* File Driver value from environment */ + hbool_t same_file; /* Whether to run tests that only use one file */ + + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; /* Setup */ h5_reset(); @@ -17468,9 +17473,14 @@ main(void) FALSE, "H5Ocopy(): expand soft link"); nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Ocopy(): expand external link"); - nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, - H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, - "H5Ocopy(): expand soft and external links"); + + /* Splitter VFD currently has external link-related bugs */ + if (HDstrcmp(env_h5_drvr, "splitter")) { + nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, + H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, + "H5Ocopy(): expand soft and external links"); + } + nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG, FALSE, "H5Ocopy(): shallow group copy"); nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG, @@ -17548,9 +17558,14 @@ main(void) nerrors += test_copy_same_file_named_datatype(fcpl_src, src_fapl); - /* Test with dataset opened in the file or not */ - nerrors += test_copy_old_layout(fcpl_dst, dst_fapl, FALSE); - nerrors += test_copy_old_layout(fcpl_dst, dst_fapl, TRUE); + /* Check if current driver might modify the filename. Skip these tests + * if so, since the file is pre-generated. + */ + if (!h5_driver_uses_modified_filename()) { + /* Test with dataset opened in the file or not */ + nerrors += test_copy_old_layout(fcpl_dst, dst_fapl, FALSE); + nerrors += test_copy_old_layout(fcpl_dst, dst_fapl, TRUE); + } /* Test with dataset opened in the file or not */ nerrors += test_copy_null_ref(fcpl_src, fcpl_dst, src_fapl, dst_fapl); diff --git a/test/ohdr.c b/test/ohdr.c index d28b11e..60d32b7 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -34,6 +34,13 @@ #define H5G_FRIEND /* suppress error about including H5Gpkg */ #include "H5Gpkg.h" +/* + * This file needs to access private routines from the H5FD package. + */ +#define H5FD_FRIEND /* suppress error about including H5FDpkg */ +#define H5FD_TESTING +#include "H5FDpkg.h" + const char *FILENAME[] = {"ohdr", "ohdr_min_a", "ohdr_min_b", NULL}; /* used for object header size comparison */ @@ -1813,13 +1820,12 @@ main(void) herr_t ret; /* Generic return value */ /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0); + single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, 0); /* Reset library */ h5_reset(); @@ -2107,11 +2113,15 @@ main(void) if (h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR - /* A test to exercise the re-read of the object header for SWMR access */ - if (test_ohdr_swmr(TRUE) < 0) - TEST_ERROR - if (test_ohdr_swmr(FALSE) < 0) - TEST_ERROR + if (H5FD__supports_swmr_test(env_h5_drvr)) { + /* A test to exercise the re-read of the object header for SWMR access */ + if (test_ohdr_swmr(TRUE) < 0) + TEST_ERROR + if (test_ohdr_swmr(FALSE) < 0) + TEST_ERROR + } + else + HDputs("Skipped SWMR tests for SWMR-incompatible VFD"); /* Pop API context */ if (api_ctx_pushed && H5CX_pop(FALSE) < 0) diff --git a/test/page_buffer.c b/test/page_buffer.c index b80d330..cb59fda 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -2153,7 +2153,7 @@ main(void) h5_reset(); /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; diff --git a/test/reserved.c b/test/reserved.c index 6e41a16..f864329 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -489,7 +489,7 @@ main(void) hid_t fapl; const char *envval = NULL; - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; /* QAK: should be able to use the core driver? */ diff --git a/test/set_extent.c b/test/set_extent.c index 3078c2d..ab2a443 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -117,7 +117,7 @@ main(void) const char *env_h5_drvr; /* File Driver value from environment */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; /* Current VFD that does not support contigous address space */ @@ -343,35 +343,42 @@ do_ranks(hid_t fapl, hbool_t new_format) goto error; } /* end if */ - /* VL test */ - if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { - DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length") - HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE - ? "btree" - : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); - goto error; - } /* end if */ - - /* Sparse allocation test (regular and VL) */ - if (!(config & CONFIG_EARLY_ALLOC)) { - if (test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) { - DO_RANKS_PRINT_CONFIG("Randomized rank 4 with sparse allocation") + if (!h5_using_parallel_driver(NULL)) { + /* VL test */ + if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < + 0) { + DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length") HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; } /* end if */ - if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < - 0) { - DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation") + } + + /* Sparse allocation test (regular and VL) */ + if (!(config & CONFIG_EARLY_ALLOC)) { + if (test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) { + DO_RANKS_PRINT_CONFIG("Randomized rank 4 with sparse allocation") HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; } /* end if */ - } /* end if */ + + if (!h5_using_parallel_driver(NULL)) { + if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, + index_type) < 0) { + DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation") + HDprintf(" Index: %s\n", + index_type == RANK4_INDEX_BTREE + ? "btree" + : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); + goto error; + } /* end if */ + } + } /* end if */ /* Break out if using the old format */ if (!new_format) diff --git a/test/stab.c b/test/stab.c index 798619d..31ff497 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1417,10 +1417,11 @@ main(void) unsigned new_format; /* Whether to use the new format or not */ const char *env_h5_drvr; /* File Driver value from environment */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ - int nerrors = 0; + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); + int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -1473,14 +1474,21 @@ main(void) if (contig_addr_vfd) { nerrors += lifecycle(fcpl2, fapl2); nerrors += long_compact(fcpl2, fapl2); - nerrors += read_old(); + + if (!driver_uses_modified_filename) { + nerrors += read_old(); + } + nerrors += no_compact(fcpl2, fapl2); nerrors += gcpl_on_root(fapl2); } /* Old group API specific tests */ nerrors += old_api(fapl); - nerrors += corrupt_stab_msg(); + + if (!driver_uses_modified_filename) { + nerrors += corrupt_stab_msg(); + } /* Close 2nd FAPL */ H5Pclose(fapl2); diff --git a/test/swmr.c b/test/swmr.c index 24a0b7c..e6fdb47 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -6270,13 +6270,13 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri /* If requested, set the environment variable */ if (env_var_override) { - if (HDsetenv("HDF5_USE_FILE_LOCKING", turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0) + if (HDsetenv(HDF5_USE_FILE_LOCKING, turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0) TEST_ERROR if (H5F__reparse_file_lock_variable_test() < 0) TEST_ERROR } else { - if (HDsetenv("HDF5_USE_FILE_LOCKING", "", TRUE) < 0) + if (HDsetenv(HDF5_USE_FILE_LOCKING, "", TRUE) < 0) TEST_ERROR if (H5F__reparse_file_lock_variable_test() < 0) TEST_ERROR @@ -7367,7 +7367,7 @@ main(void) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (!H5FD__supports_swmr_test(driver)) { HDprintf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; @@ -7377,7 +7377,7 @@ main(void) * about file locking. File locking should be used unless explicitly * disabled. */ - lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); if (lock_env_var && !HDstrcmp(lock_env_var, "FALSE")) use_file_locking = FALSE; else diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c index 4133696..720c747 100644 --- a/test/swmr_check_compat_vfd.c +++ b/test/swmr_check_compat_vfd.c @@ -43,7 +43,7 @@ main(void) { char *driver = NULL; - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; diff --git a/test/tarray.c b/test/tarray.c index af167a7..3b17239 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -2217,8 +2217,10 @@ test_array(void) test_array_bkg(); /* Read compound datatype with array fields and background fields read */ - /* This test uses a custom file */ - test_compat(); /* Test compatibility changes for compound datatype fields */ + if (!h5_driver_uses_modified_filename()) { + /* This test uses a custom file */ + test_compat(); /* Test compatibility changes for compound datatype fields */ + } } /* end test_array() */ diff --git a/test/tattr.c b/test/tattr.c index 756e139..b807bce 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -2274,9 +2274,11 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_create() */ /**************************************************************** @@ -2418,9 +2420,11 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_open() */ /**************************************************************** @@ -2448,6 +2452,10 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ + /* Only run this test for sec2/default driver */ + if (!h5_using_default_driver(NULL)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n")); @@ -2611,9 +2619,11 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_delete() */ /**************************************************************** @@ -2643,6 +2653,10 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) unsigned use_corder; /* Track creation order or not */ herr_t ret; /* Generic return value */ + /* Only run this test for sec2/default driver */ + if (!h5_using_default_driver(NULL)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n")); @@ -2802,9 +2816,11 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_rename() */ /**************************************************************** @@ -2833,6 +2849,10 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ + /* Only run this test for sec2/default driver */ + if (!h5_using_default_driver(NULL)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n")); @@ -2945,9 +2965,11 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_unlink() */ /**************************************************************** @@ -3109,9 +3131,11 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_limits() */ /**************************************************************** @@ -3896,9 +3920,11 @@ test_attr_big(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_big() */ /**************************************************************** @@ -4105,9 +4131,11 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) ret = H5Sclose(null_sid); CHECK(ret, FAIL, "H5Sclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_null_space() */ /**************************************************************** @@ -8705,9 +8733,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* end for */ /* Close dataspaces */ @@ -9151,9 +9181,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* end for */ /* Close dataspaces */ @@ -9521,9 +9553,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* end for */ /* Close dataspaces */ @@ -9878,9 +9912,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* end for */ /* Close dataspaces */ diff --git a/test/testhdf5.c b/test/testhdf5.c index 45c0f9f..dc5f0aa 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -81,7 +81,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !HDgetenv(HDF5_NOCLEANUP)) TestCleanup(); /* Release test infrastructure */ diff --git a/test/tfile.c b/test/tfile.c index 0014d08..47d1b67 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -35,6 +35,10 @@ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg.h */ +#define H5FD_TESTING +#include "H5FDpkg.h" + #define H5D_FRIEND /*suppress error about including H5Dpkg */ #include "H5Dpkg.h" /* Dataset access */ @@ -176,8 +180,8 @@ const char *FILESPACE_NAME[] = {"tfilespace", NULL}; #define DSET_DS1 "DS1" /* Local test function declarations for version bounds */ -static void test_libver_bounds_low_high(void); -static void test_libver_bounds_super(hid_t fapl); +static void test_libver_bounds_low_high(const char *env_h5_drvr); +static void test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr); static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_obj(hid_t fapl); @@ -304,186 +308,189 @@ test_file_create(void) VERIFY(ret, FAIL, "H5Pclose"); #endif - /* Create a new file with a non-standard file-creation template */ - tmpl1 = H5Pcreate(H5P_FILE_CREATE); - CHECK(tmpl1, FAIL, "H5Pcreate"); + if (h5_using_default_driver(NULL)) { - /* Try setting some bad userblock sizes */ - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - - /* Set the new file-creation parameters */ - ret = H5Pset_userblock(tmpl1, F2_USERBLOCK_SIZE); - CHECK(ret, FAIL, "H5Pset_userblock"); + /* Create a new file with a non-standard file-creation template */ + tmpl1 = H5Pcreate(H5P_FILE_CREATE); + CHECK(tmpl1, FAIL, "H5Pcreate"); - ret = H5Pset_sizes(tmpl1, (size_t)F2_OFFSET_SIZE, (size_t)F2_LENGTH_SIZE); - CHECK(ret, FAIL, "H5Pset_sizes"); + /* Try setting some bad userblock sizes */ + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); - ret = H5Pset_sym_k(tmpl1, F2_SYM_INTERN_K, F2_SYM_LEAF_K); - CHECK(ret, FAIL, "H5Pset_sym_k"); + /* Set the new file-creation parameters */ + ret = H5Pset_userblock(tmpl1, F2_USERBLOCK_SIZE); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* - * Try to create second file, with non-standard file-creation template - * params. - */ - fid2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, tmpl1, H5P_DEFAULT); - CHECK(fid2, FAIL, "H5Fcreate"); + ret = H5Pset_sizes(tmpl1, (size_t)F2_OFFSET_SIZE, (size_t)F2_LENGTH_SIZE); + CHECK(ret, FAIL, "H5Pset_sizes"); - /* Release file-creation template */ - ret = H5Pclose(tmpl1); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pset_sym_k(tmpl1, F2_SYM_INTERN_K, F2_SYM_LEAF_K); + CHECK(ret, FAIL, "H5Pset_sym_k"); - /* Make certain we can create a dataset properly in the file with the userblock */ - { - hid_t dataset_id, dataspace_id; /* identifiers */ - hsize_t dims[F2_RANK]; - unsigned data[F2_DIM0][F2_DIM1]; - unsigned i, j; + /* + * Try to create second file, with non-standard file-creation template + * params. + */ + fid2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, tmpl1, H5P_DEFAULT); + CHECK(fid2, FAIL, "H5Fcreate"); - /* Create the data space for the dataset. */ - dims[0] = F2_DIM0; - dims[1] = F2_DIM1; - dataspace_id = H5Screate_simple(F2_RANK, dims, NULL); - CHECK(dataspace_id, FAIL, "H5Screate_simple"); + /* Release file-creation template */ + ret = H5Pclose(tmpl1); + CHECK(ret, FAIL, "H5Pclose"); - /* Create the dataset. */ - dataset_id = - H5Dcreate2(fid2, F2_DSET, H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(dataset_id, FAIL, "H5Dcreate2"); + /* Make certain we can create a dataset properly in the file with the userblock */ + { + hid_t dataset_id, dataspace_id; /* identifiers */ + hsize_t dims[F2_RANK]; + unsigned data[F2_DIM0][F2_DIM1]; + unsigned i, j; + + /* Create the data space for the dataset. */ + dims[0] = F2_DIM0; + dims[1] = F2_DIM1; + dataspace_id = H5Screate_simple(F2_RANK, dims, NULL); + CHECK(dataspace_id, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dataset_id = H5Dcreate2(fid2, F2_DSET, H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); + CHECK(dataset_id, FAIL, "H5Dcreate2"); + + for (i = 0; i < F2_DIM0; i++) + for (j = 0; j < F2_DIM1; j++) + data[i][j] = i * 10 + j; + + /* Write data to the new dataset */ + ret = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + CHECK(ret, FAIL, "H5Dwrite"); + + /* End access to the dataset and release resources used by it. */ + ret = H5Dclose(dataset_id); + CHECK(ret, FAIL, "H5Dclose"); - for (i = 0; i < F2_DIM0; i++) - for (j = 0; j < F2_DIM1; j++) - data[i][j] = i * 10 + j; + /* Terminate access to the data space. */ + ret = H5Sclose(dataspace_id); + CHECK(ret, FAIL, "H5Sclose"); + } - /* Write data to the new dataset */ - ret = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); - CHECK(ret, FAIL, "H5Dwrite"); + /* Get the file-creation template */ + tmpl1 = H5Fget_create_plist(fid2); + CHECK(tmpl1, FAIL, "H5Fget_create_plist"); - /* End access to the dataset and release resources used by it. */ - ret = H5Dclose(dataset_id); - CHECK(ret, FAIL, "H5Dclose"); + /* Get the file-creation parameters */ + ret = H5Pget_userblock(tmpl1, &ublock); + CHECK(ret, FAIL, "H5Pget_userblock"); + VERIFY(ublock, F2_USERBLOCK_SIZE, "H5Pget_userblock"); - /* Terminate access to the data space. */ - ret = H5Sclose(dataspace_id); - CHECK(ret, FAIL, "H5Sclose"); - } + ret = H5Pget_sizes(tmpl1, &parm, &parm2); + CHECK(ret, FAIL, "H5Pget_sizes"); + VERIFY(parm, F2_OFFSET_SIZE, "H5Pget_sizes"); + VERIFY(parm2, F2_LENGTH_SIZE, "H5Pget_sizes"); - /* Get the file-creation template */ - tmpl1 = H5Fget_create_plist(fid2); - CHECK(tmpl1, FAIL, "H5Fget_create_plist"); + ret = H5Pget_sym_k(tmpl1, &iparm, &iparm2); + CHECK(ret, FAIL, "H5Pget_sym_k"); + VERIFY(iparm, F2_SYM_INTERN_K, "H5Pget_sym_k"); + VERIFY(iparm2, F2_SYM_LEAF_K, "H5Pget_sym_k"); - /* Get the file-creation parameters */ - ret = H5Pget_userblock(tmpl1, &ublock); - CHECK(ret, FAIL, "H5Pget_userblock"); - VERIFY(ublock, F2_USERBLOCK_SIZE, "H5Pget_userblock"); + /* Clone the file-creation template */ + tmpl2 = H5Pcopy(tmpl1); + CHECK(tmpl2, FAIL, "H5Pcopy"); - ret = H5Pget_sizes(tmpl1, &parm, &parm2); - CHECK(ret, FAIL, "H5Pget_sizes"); - VERIFY(parm, F2_OFFSET_SIZE, "H5Pget_sizes"); - VERIFY(parm2, F2_LENGTH_SIZE, "H5Pget_sizes"); + /* Release file-creation template */ + ret = H5Pclose(tmpl1); + CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pget_sym_k(tmpl1, &iparm, &iparm2); - CHECK(ret, FAIL, "H5Pget_sym_k"); - VERIFY(iparm, F2_SYM_INTERN_K, "H5Pget_sym_k"); - VERIFY(iparm2, F2_SYM_LEAF_K, "H5Pget_sym_k"); + /* Set the new file-creation parameter */ + ret = H5Pset_userblock(tmpl2, F3_USERBLOCK_SIZE); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* Clone the file-creation template */ - tmpl2 = H5Pcopy(tmpl1); - CHECK(tmpl2, FAIL, "H5Pcopy"); + /* + * Try to create second file, with non-standard file-creation template + * params + */ + fid3 = H5Fcreate(FILE3, H5F_ACC_TRUNC, tmpl2, H5P_DEFAULT); + CHECK(fid3, FAIL, "H5Fcreate"); - /* Release file-creation template */ - ret = H5Pclose(tmpl1); - CHECK(ret, FAIL, "H5Pclose"); + /* Release file-creation template */ + ret = H5Pclose(tmpl2); + CHECK(ret, FAIL, "H5Pclose"); - /* Set the new file-creation parameter */ - ret = H5Pset_userblock(tmpl2, F3_USERBLOCK_SIZE); - CHECK(ret, FAIL, "H5Pset_userblock"); + /* Get the file-creation template */ + tmpl1 = H5Fget_create_plist(fid3); + CHECK(tmpl1, FAIL, "H5Fget_create_plist"); - /* - * Try to create second file, with non-standard file-creation template - * params - */ - fid3 = H5Fcreate(FILE3, H5F_ACC_TRUNC, tmpl2, H5P_DEFAULT); - CHECK(fid3, FAIL, "H5Fcreate"); + /* Get the file-creation parameters */ + ret = H5Pget_userblock(tmpl1, &ublock); + CHECK(ret, FAIL, "H5Pget_userblock"); + VERIFY(ublock, F3_USERBLOCK_SIZE, "H5Pget_userblock"); - /* Release file-creation template */ - ret = H5Pclose(tmpl2); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pget_sizes(tmpl1, &parm, &parm2); + CHECK(ret, FAIL, "H5Pget_sizes"); + VERIFY(parm, F3_OFFSET_SIZE, "H5Pget_sizes"); + VERIFY(parm2, F3_LENGTH_SIZE, "H5Pget_sizes"); - /* Get the file-creation template */ - tmpl1 = H5Fget_create_plist(fid3); - CHECK(tmpl1, FAIL, "H5Fget_create_plist"); + ret = H5Pget_sym_k(tmpl1, &iparm, &iparm2); + CHECK(ret, FAIL, "H5Pget_sym_k"); + VERIFY(iparm, F3_SYM_INTERN_K, "H5Pget_sym_k"); + VERIFY(iparm2, F3_SYM_LEAF_K, "H5Pget_sym_k"); - /* Get the file-creation parameters */ - ret = H5Pget_userblock(tmpl1, &ublock); - CHECK(ret, FAIL, "H5Pget_userblock"); - VERIFY(ublock, F3_USERBLOCK_SIZE, "H5Pget_userblock"); - - ret = H5Pget_sizes(tmpl1, &parm, &parm2); - CHECK(ret, FAIL, "H5Pget_sizes"); - VERIFY(parm, F3_OFFSET_SIZE, "H5Pget_sizes"); - VERIFY(parm2, F3_LENGTH_SIZE, "H5Pget_sizes"); + /* Release file-creation template */ + ret = H5Pclose(tmpl1); + CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pget_sym_k(tmpl1, &iparm, &iparm2); - CHECK(ret, FAIL, "H5Pget_sym_k"); - VERIFY(iparm, F3_SYM_INTERN_K, "H5Pget_sym_k"); - VERIFY(iparm2, F3_SYM_LEAF_K, "H5Pget_sym_k"); + /* Close second file */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); - /* Release file-creation template */ - ret = H5Pclose(tmpl1); - CHECK(ret, FAIL, "H5Pclose"); + /* Close third file */ + ret = H5Fclose(fid3); + CHECK(ret, FAIL, "H5Fclose"); + } /* Close first file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); - - /* Close second file */ - ret = H5Fclose(fid2); - CHECK(ret, FAIL, "H5Fclose"); - - /* Close third file */ - ret = H5Fclose(fid3); - CHECK(ret, FAIL, "H5Fclose"); } /* test_file_create() */ /**************************************************************** @@ -492,7 +499,7 @@ test_file_create(void) ** ****************************************************************/ static void -test_file_open(void) +test_file_open(const char *env_h5_drvr) { hid_t fid1, fid2; /*HDF5 File IDs */ hid_t did; /*dataset ID */ @@ -510,6 +517,10 @@ test_file_open(void) * Test single file open */ + /* Only run this test with sec2/default driver */ + if (!h5_using_default_driver(env_h5_drvr)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File Opening I/O\n")); @@ -1619,22 +1630,24 @@ test_file_perm2(void) ** H5Fis_accessible() API call. ** *****************************************************************/ -#define FILE_IS_ACCESSIBLE "tfile_is_accessible" +#define FILE_IS_ACCESSIBLE "tfile_is_accessible" +#define FILE_IS_ACCESSIBLE_NON_HDF5 "tfile_is_accessible_non_hdf5" static void test_file_is_accessible(const char *env_h5_drvr) { - hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */ - hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */ - hid_t fapl_id = H5I_INVALID_HID; /* File access property list */ - int fd; /* POSIX file descriptor */ - char filename[FILENAME_LEN]; /* Filename to use */ - char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */ - ssize_t nbytes; /* Number of bytes written */ - unsigned u; /* Local index variable */ - unsigned char buf[1024]; /* Buffer of data to write */ - htri_t is_hdf5; /* Whether a file is an HDF5 file */ - int posix_ret; /* Return value from POSIX calls */ - herr_t ret; /* Return value from HDF5 calls */ + hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */ + hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */ + hid_t fapl_id = H5I_INVALID_HID; /* File access property list */ + int fd; /* POSIX file descriptor */ + char filename[FILENAME_LEN]; /* Filename to use */ + char non_hdf5_filename[FILENAME_LEN]; /* Base name of non-hdf5 file */ + char non_hdf5_sb_filename[FILENAME_LEN]; /* Name of non-hdf5 superblock file */ + ssize_t nbytes; /* Number of bytes written */ + unsigned u; /* Local index variable */ + unsigned char buf[1024]; /* Buffer of data to write */ + htri_t is_hdf5; /* Whether a file is an HDF5 file */ + int posix_ret; /* Return value from POSIX calls */ + herr_t ret; /* Return value from HDF5 calls */ /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files\n")); @@ -1643,13 +1656,11 @@ test_file_is_accessible(const char *env_h5_drvr) fapl_id = h5_fileaccess(); CHECK(fapl_id, H5I_INVALID_HID, "H5Pcreate"); - /* Fix up filenames - * For VFDs that create multiple files, we also need the name - * of the file with the superblock. With single-file VFDs, this - * will be equal to the one from h5_fixname(). - */ + /* Fix up filenames */ h5_fixname(FILE_IS_ACCESSIBLE, fapl_id, filename, sizeof(filename)); - h5_fixname_superblock(FILE_IS_ACCESSIBLE, fapl_id, sb_filename, sizeof(filename)); + h5_fixname(FILE_IS_ACCESSIBLE_NON_HDF5, fapl_id, non_hdf5_filename, sizeof(non_hdf5_filename)); + h5_fixname_superblock(FILE_IS_ACCESSIBLE_NON_HDF5, fapl_id, non_hdf5_sb_filename, + sizeof(non_hdf5_sb_filename)); /****************/ /* Normal usage */ @@ -1722,48 +1733,54 @@ test_file_is_accessible(const char *env_h5_drvr) VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); } /* end if */ - /***********************/ - /* EMPTY non-HDF5 file */ - /***********************/ + /* Don't run the below tests for drivers that use multiple + * logical files, like the splitter driver. + */ + if (!h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_MULTIPART_DRIVERS)) { + /***********************/ + /* EMPTY non-HDF5 file */ + /***********************/ - /* Create non-HDF5 file and check it */ - fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); - CHECK(fd, (-1), "HDopen"); + /* Create non-HDF5 file and check it */ + fd = HDopen(non_hdf5_sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, (-1), "HDopen"); - /* Close the file */ - posix_ret = HDclose(fd); - CHECK(posix_ret, (-1), "HDclose"); + /* Close the file */ + posix_ret = HDclose(fd); + CHECK(posix_ret, (-1), "HDclose"); - /* Verify that the file is NOT an HDF5 file */ - is_hdf5 = H5Fis_accessible(filename, fapl_id); - VERIFY(is_hdf5, FALSE, "H5Fis_accessible (empty non-HDF5 file)"); + /* Verify that the file is NOT an HDF5 file using the base filename */ + is_hdf5 = H5Fis_accessible(non_hdf5_filename, fapl_id); + VERIFY(is_hdf5, FALSE, "H5Fis_accessible (empty non-HDF5 file)"); - /***************************/ - /* Non-empty non-HDF5 file */ - /***************************/ + /***************************/ + /* Non-empty non-HDF5 file */ + /***************************/ - /* Create non-HDF5 file and check it */ - fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); - CHECK(fd, (-1), "HDopen"); + /* Create non-HDF5 file and check it */ + fd = HDopen(non_hdf5_sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, (-1), "HDopen"); - /* Initialize information to write */ - for (u = 0; u < 1024; u++) - buf[u] = (unsigned char)u; + /* Initialize information to write */ + for (u = 0; u < 1024; u++) + buf[u] = (unsigned char)u; - /* Write some information */ - nbytes = HDwrite(fd, buf, (size_t)1024); - VERIFY(nbytes, 1024, "HDwrite"); + /* Write some information */ + nbytes = HDwrite(fd, buf, (size_t)1024); + VERIFY(nbytes, 1024, "HDwrite"); - /* Close the file */ - posix_ret = HDclose(fd); - CHECK(posix_ret, (-1), "HDclose"); + /* Close the file */ + posix_ret = HDclose(fd); + CHECK(posix_ret, (-1), "HDclose"); - /* Verify that the file is not an HDF5 file */ - is_hdf5 = H5Fis_accessible(filename, fapl_id); - VERIFY(is_hdf5, FALSE, "H5Fis_accessible (non-HDF5 file)"); + /* Verify that the file is not an HDF5 file */ + is_hdf5 = H5Fis_accessible(non_hdf5_filename, fapl_id); + VERIFY(is_hdf5, FALSE, "H5Fis_accessible (non-HDF5 file)"); + } /* Clean up files */ h5_delete_test_file(filename, fapl_id); + h5_delete_test_file(non_hdf5_filename, fapl_id); /* Close property list */ ret = H5Pclose(fapl_id); @@ -1795,6 +1812,9 @@ test_file_ishdf5(const char *env_h5_drvr) int posix_ret; /* Return value from POSIX calls */ herr_t ret; /* Return value from HDF5 calls */ + if (!h5_using_default_driver(env_h5_drvr)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n")); @@ -1830,33 +1850,28 @@ test_file_ishdf5(const char *env_h5_drvr) /* Non-default user block size */ /*******************************/ - /* This test is not currently working for the family VFD. - * There are failures when creating files with userblocks. - */ - if (0 != HDstrcmp(env_h5_drvr, "family")) { - /* Create a file creation property list with a non-default user block size */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate"); + /* Create a file creation property list with a non-default user block size */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate"); - ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); - CHECK(ret, FAIL, "H5Pset_userblock"); + ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* Create file with non-default user block */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); + /* Create file with non-default user block */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); - /* Release file creation property list */ - ret = H5Pclose(fcpl_id); - CHECK(ret, FAIL, "H5Pclose"); + /* Release file creation property list */ + ret = H5Pclose(fcpl_id); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - /* Verify that the file is an HDF5 file */ - is_hdf5 = H5Fis_hdf5(sb_filename); - VERIFY(is_hdf5, TRUE, "H5Fis_hdf5"); - } /* end if */ + /* Verify that the file is an HDF5 file */ + is_hdf5 = H5Fis_hdf5(sb_filename); + VERIFY(is_hdf5, TRUE, "H5Fis_hdf5"); /***************************/ /* Non-empty non-HDF5 file */ @@ -2891,7 +2906,7 @@ test_file_double_datatype_open(void) ** *****************************************************************/ static void -test_userblock_file_size(void) +test_userblock_file_size(const char *env_h5_drvr) { hid_t file1_id, file2_id; hid_t group1_id, group2_id; @@ -2903,6 +2918,11 @@ test_userblock_file_size(void) unsigned long fileno1, fileno2; /* File number */ herr_t ret; /* Generic return value */ + /* Don't run with multi/split, family or direct drivers */ + if (!HDstrcmp(env_h5_drvr, "multi") || !HDstrcmp(env_h5_drvr, "split") || + !HDstrcmp(env_h5_drvr, "family") || !HDstrcmp(env_h5_drvr, "direct")) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing file size with user block\n")); @@ -3289,13 +3309,17 @@ test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw) ** *****************************************************************/ static void -test_userblock_alignment(void) +test_userblock_alignment(const char *env_h5_drvr) { hid_t fid; /* File ID */ hid_t fcpl; /* File creation property list ID */ hid_t fapl; /* File access property list ID */ herr_t ret; /* Generic return value */ + /* Only run with sec2 driver */ + if (!h5_using_default_driver(env_h5_drvr)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing that non-zero userblocks and object alignment interact correctly.\n")); @@ -3507,13 +3531,17 @@ test_userblock_alignment(void) ** *****************************************************************/ static void -test_userblock_alignment_paged(void) +test_userblock_alignment_paged(const char *env_h5_drvr) { hid_t fid; /* File ID */ hid_t fcpl; /* File creation property list ID */ hid_t fapl; /* File access property list ID */ herr_t ret; /* Generic return value */ + /* Only run with sec2 driver */ + if (!h5_using_default_driver(env_h5_drvr)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing interaction between userblock and alignment (via paged aggregation and " "H5Pset_alignment)\n")); @@ -5570,7 +5598,10 @@ test_libver_bounds(void) test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2); test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2); test_libver_bounds_open(); - test_libver_bounds_copy(); + + if (!h5_driver_uses_modified_filename()) { + test_libver_bounds_copy(); + } } /* end test_libver_bounds() */ /************************************************************************************** @@ -5595,7 +5626,7 @@ test_libver_bounds(void) ** **************************************************************************************/ static void -test_libver_bounds_low_high(void) +test_libver_bounds_low_high(const char *env_h5_drvr) { hid_t fapl = H5I_INVALID_HID; /* File access property list */ H5F_libver_t low, high; /* Low and high bounds */ @@ -5635,7 +5666,7 @@ test_libver_bounds_low_high(void) VERIFY(ret, SUCCEED, "H5Pset_libver_bounds"); /* Tests to verify version bounds */ - test_libver_bounds_super(fapl); + test_libver_bounds_super(fapl, env_h5_drvr); test_libver_bounds_obj(fapl); test_libver_bounds_dataset(fapl); test_libver_bounds_dataspace(fapl); @@ -5668,7 +5699,7 @@ test_libver_bounds_low_high(void) ** *************************************************************************/ static void -test_libver_bounds_super(hid_t fapl) +test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) { hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ herr_t ret; /* The return value */ @@ -5680,12 +5711,14 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ @@ -5701,12 +5734,14 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ @@ -5724,38 +5759,44 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); CHECK(ret, FAIL, "H5Pclose"); - /* Create a fcpl with persistent free-space manager enabled: #D */ - /* This will result in superblock version 2 */ - fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); - ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1); - CHECK(ret, FAIL, "H5Pset_file_space"); - - /* Verify superblock version when creating a file with input fapl, - fcpl #D and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE, TRUE); - - /* Verify superblock version when opening a file which is created - with input fapl, fcpl #D and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE, TRUE); - - /* Close the fcpl */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + if (h5_using_default_driver(env_h5_drvr)) { + /* Create a fcpl with persistent free-space manager enabled: #D */ + /* This will result in superblock version 2 */ + fcpl = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); + ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1); + CHECK(ret, FAIL, "H5Pset_file_space"); + + /* Verify superblock version when creating a file with input fapl, + fcpl #D and with/without SWMR access */ + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_create(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, TRUE); + + /* Verify superblock version when opening a file which is created + with input fapl, fcpl #D and with/without SWMR access */ + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_open(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, TRUE); + + /* Close the fcpl */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); + } } /* end test_libver_bounds_super() */ @@ -7747,7 +7788,7 @@ test_min_dset_ohdr(void) ****************************************************************/ #ifndef H5_NO_DEPRECATED_SYMBOLS static void -test_deprec(void) +test_deprec(const char *env_h5_drvr) { hid_t file; /* File IDs for old & new files */ hid_t fcpl; /* File creation property list */ @@ -7800,166 +7841,169 @@ test_deprec(void) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - /* Create a file creation property list */ - fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + /* Only run this part of the test with the sec2/default driver */ + if (h5_using_default_driver(env_h5_drvr)) { + /* Create a file creation property list */ + fcpl = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl, FAIL, "H5Pcreate"); - /* Set a property in the FCPL that will push the superblock version up */ - ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)0); - ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512); - CHECK(ret, FAIL, "H5Pset_file_space_strategy"); + /* Set a property in the FCPL that will push the superblock version up */ + ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)0); + ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512); + CHECK(ret, FAIL, "H5Pset_file_space_strategy"); - fapl = H5Pcreate(H5P_FILE_ACCESS); - ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024); - CHECK(ret, FAIL, "H5Pset_alignment"); + fapl = H5Pcreate(H5P_FILE_ACCESS); + ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024); + CHECK(ret, FAIL, "H5Pset_alignment"); - /* Creating a file with the non-default file creation property list should - * create a version 2 superblock - */ + /* Creating a file with the non-default file creation property list should + * create a version 2 superblock + */ - /* Create file with custom file creation property list */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(file, FAIL, "H5Fcreate"); + /* Create file with custom file creation property list */ + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(file, FAIL, "H5Fcreate"); - new_fapl = H5Fget_access_plist(file); - H5Pget_alignment(new_fapl, NULL, &align); + new_fapl = H5Fget_access_plist(file); + H5Pget_alignment(new_fapl, NULL, &align); - /* Close FCPL */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close FCPL */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Get the file's version information */ - ret = H5Fget_info1(file, &finfo); - CHECK(ret, FAIL, "H5Fget_info1"); - VERIFY(finfo.super_ext_size, 152, "H5Fget_info1"); - VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1"); - VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1"); - VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1"); + /* Get the file's version information */ + ret = H5Fget_info1(file, &finfo); + CHECK(ret, FAIL, "H5Fget_info1"); + VERIFY(finfo.super_ext_size, 152, "H5Fget_info1"); + VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1"); + VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1"); + VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1"); - /* Get the file's dataset creation property list */ - fcpl = H5Fget_create_plist(file); - CHECK(fcpl, FAIL, "H5Fget_create_plist"); + /* Get the file's dataset creation property list */ + fcpl = H5Fget_create_plist(file); + CHECK(fcpl, FAIL, "H5Fget_create_plist"); - /* Get the file's version information */ - ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); - CHECK(ret, FAIL, "H5Pget_version"); - VERIFY(super, 2, "H5Pget_version"); - VERIFY(freelist, 0, "H5Pget_version"); - VERIFY(stab, 0, "H5Pget_version"); - VERIFY(shhdr, 0, "H5Pget_version"); + /* Get the file's version information */ + ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); + CHECK(ret, FAIL, "H5Pget_version"); + VERIFY(super, 2, "H5Pget_version"); + VERIFY(freelist, 0, "H5Pget_version"); + VERIFY(stab, 0, "H5Pget_version"); + VERIFY(shhdr, 0, "H5Pget_version"); - /* Close FCPL */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close FCPL */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(file); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); - /* Re-open the file */ - file = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK(file, FAIL, "H5Fcreate"); + /* Re-open the file */ + file = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(file, FAIL, "H5Fcreate"); - /* Get the file's version information */ - ret = H5Fget_info1(file, &finfo); - CHECK(ret, FAIL, "H5Fget_info1"); - VERIFY(finfo.super_ext_size, 152, "H5Fget_info1"); - VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1"); - VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1"); - VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1"); + /* Get the file's version information */ + ret = H5Fget_info1(file, &finfo); + CHECK(ret, FAIL, "H5Fget_info1"); + VERIFY(finfo.super_ext_size, 152, "H5Fget_info1"); + VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1"); + VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1"); + VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1"); - /* Get the file's creation property list */ - fcpl = H5Fget_create_plist(file); - CHECK(fcpl, FAIL, "H5Fget_create_plist"); + /* Get the file's creation property list */ + fcpl = H5Fget_create_plist(file); + CHECK(fcpl, FAIL, "H5Fget_create_plist"); - /* Get the file's version information */ - ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); - CHECK(ret, FAIL, "H5Pget_version"); - VERIFY(super, 2, "H5Pget_version"); - VERIFY(freelist, 0, "H5Pget_version"); - VERIFY(stab, 0, "H5Pget_version"); - VERIFY(shhdr, 0, "H5Pget_version"); + /* Get the file's version information */ + ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); + CHECK(ret, FAIL, "H5Pget_version"); + VERIFY(super, 2, "H5Pget_version"); + VERIFY(freelist, 0, "H5Pget_version"); + VERIFY(stab, 0, "H5Pget_version"); + VERIFY(shhdr, 0, "H5Pget_version"); - /* Close FCPL */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close FCPL */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(file); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); - { /* Test deprecated H5Pget/set_file_space() */ + { /* Test deprecated H5Pget/set_file_space() */ - H5F_file_space_type_t old_strategy; - hsize_t old_threshold; - hid_t fid; - hid_t ffcpl; + H5F_file_space_type_t old_strategy; + hsize_t old_threshold; + hid_t fid; + hid_t ffcpl; - fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + fcpl = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl, FAIL, "H5Pcreate"); - ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL, "H5Pget_file_space"); - VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space"); + ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL, "H5Pget_file_space"); + VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space"); - /* Set file space strategy and free space section threshold */ - ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); - CHECK(ret, FAIL, "H5Pget_file_space"); + /* Set file space strategy and free space section threshold */ + ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); + CHECK(ret, FAIL, "H5Pget_file_space"); - /* Get the file space info from the creation property */ - ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); - VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space"); + /* Get the file space info from the creation property */ + ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); + VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space"); - ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_DEFAULT, (hsize_t)3); - CHECK(ret, FAIL, "H5Pget_file_space"); + ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_DEFAULT, (hsize_t)3); + CHECK(ret, FAIL, "H5Pget_file_space"); - ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); - VERIFY(old_threshold, 3, "H5Pget_file_space"); + ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); + VERIFY(old_threshold, 3, "H5Pget_file_space"); - /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); - CHECK(file, FAIL, "H5Fcreate"); + /* Create a file */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + CHECK(file, FAIL, "H5Fcreate"); - old_strategy = H5F_FILE_SPACE_DEFAULT; - old_threshold = 0; - ffcpl = H5Fget_create_plist(fid); - ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); - VERIFY(old_threshold, 3, "H5Pget_file_space"); + old_strategy = H5F_FILE_SPACE_DEFAULT; + old_threshold = 0; + ffcpl = H5Fget_create_plist(fid); + ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); + VERIFY(old_threshold, 3, "H5Pget_file_space"); - /* Close file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - ret = H5Pclose(ffcpl); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(ffcpl); + CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Reopen the file */ - fid = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK(fid, FAIL, "H5Fcreate"); + /* Reopen the file */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); - old_strategy = H5F_FILE_SPACE_DEFAULT; - old_threshold = 0; - ffcpl = H5Fget_create_plist(fid); - ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); - VERIFY(old_threshold, 3, "H5Pget_file_space"); + old_strategy = H5F_FILE_SPACE_DEFAULT; + old_threshold = 0; + ffcpl = H5Fget_create_plist(fid); + ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); + VERIFY(old_threshold, 3, "H5Pget_file_space"); - ret = H5Pclose(ffcpl); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(ffcpl); + CHECK(ret, FAIL, "H5Pclose"); - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } } } /* test_deprec */ @@ -7973,15 +8017,16 @@ test_deprec(void) void test_file(void) { - const char *env_h5_drvr; /* File Driver value from environment */ - hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */ + const char *env_h5_drvr; /* File Driver value from environment */ + hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */ + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); herr_t ret; /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File I/O\n")); /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -7990,7 +8035,7 @@ test_file(void) CHECK(fapl_id, H5I_INVALID_HID, "h5_fileaccess"); test_file_create(); /* Test file creation(also creation templates)*/ - test_file_open(); /* Test file opening */ + test_file_open(env_h5_drvr); /* Test file opening */ test_file_reopen(); /* Test file reopening */ test_file_close(); /* Test file close behavior */ test_get_file_id(); /* Test H5Iget_file_id */ @@ -8008,14 +8053,19 @@ test_file(void) test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ test_file_double_file_dataset_open(TRUE); test_file_double_file_dataset_open(FALSE); - test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ - test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ - test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ - test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly - */ - test_userblock_alignment_paged(); /* Tests files created with a userblock and alignment (via paged - aggregation) interact properly */ - test_filespace_info(env_h5_drvr); /* Test file creation public routines: */ + test_userblock_file_size( + env_h5_drvr); /* Tests that files created with a userblock have the correct size */ + test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ + + if (!driver_uses_modified_filename) { + test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ + } + + test_userblock_alignment( + env_h5_drvr); /* Tests that files created with a userblock and alignment interact properly */ + test_userblock_alignment_paged(env_h5_drvr); /* Tests files created with a userblock and alignment (via + paged aggregation) interact properly */ + test_filespace_info(env_h5_drvr); /* Test file creation public routines: */ /* H5Pget/set_file_space_strategy() & H5Pget/set_file_space_page_size() */ /* Skipped testing for multi/split drivers */ test_file_freespace(env_h5_drvr); /* Test file public routine H5Fget_freespace() */ @@ -8027,19 +8077,25 @@ test_file(void) /* Setup for multi/split drivers are there already */ test_sects_freespace(env_h5_drvr, FALSE); /* Test file public routine H5Fget_free_sections() */ /* Skipped testing for multi/split drivers */ - test_filespace_compatible(); /* Test compatibility for file space management */ - test_filespace_round_compatible(); /* Testing file space compatibility for files from trunk to 1_8 to - trunk */ - test_filespace_1_10_0_compatible(); /* Testing file space compatibility for files from release 1.10.0 */ - test_libver_bounds(); /* Test compatibility for file space management */ - test_libver_bounds_low_high(); + + if (!driver_uses_modified_filename) { + test_filespace_compatible(); /* Test compatibility for file space management */ + + test_filespace_round_compatible(); /* Testing file space compatibility for files from trunk to 1_8 to + trunk */ + test_filespace_1_10_0_compatible(); /* Testing file space compatibility for files from release 1.10.0 + */ + } + + test_libver_bounds(); /* Test compatibility for file space management */ + test_libver_bounds_low_high(env_h5_drvr); test_libver_macros(); /* Test the macros for library version comparison */ test_libver_macros2(); /* Test the macros for library version comparison */ test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */ test_min_dset_ohdr(); /* Test datset object header minimization */ #ifndef H5_NO_DEPRECATED_SYMBOLS test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */ - test_deprec(); /* Test deprecated routines */ + test_deprec(env_h5_drvr); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ ret = H5Pclose(fapl_id); @@ -8064,13 +8120,17 @@ test_file(void) void cleanup_file(void) { - HDremove(SFILE1); - HDremove(FILE1); - HDremove(FILE2); - HDremove(FILE3); - HDremove(FILE4); - HDremove(FILE5); - HDremove(FILE6); - HDremove(FILE7); - HDremove(DST_FILE); + H5E_BEGIN_TRY + { + H5Fdelete(SFILE1, H5P_DEFAULT); + H5Fdelete(FILE1, H5P_DEFAULT); + H5Fdelete(FILE2, H5P_DEFAULT); + H5Fdelete(FILE3, H5P_DEFAULT); + H5Fdelete(FILE4, H5P_DEFAULT); + H5Fdelete(FILE5, H5P_DEFAULT); + H5Fdelete(FILE6, H5P_DEFAULT); + H5Fdelete(FILE7, H5P_DEFAULT); + H5Fdelete(DST_FILE, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/th5o.c b/test/th5o.c index ebb6c6e..48c0a81 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -43,14 +43,17 @@ test_h5o_open(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ + char filename[1024]; hsize_t dims[RANK]; H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ H5G_info_t ginfo; /* Group info struct */ H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -155,11 +158,14 @@ test_h5o_close(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ + char filename[1024]; hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -247,8 +253,9 @@ test_h5o_open_by_addr(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info2_t li; /* Buffer for H5Lget_info2 */ - haddr_t grp_addr; /* Addresses for objects */ + char filename[1024]; + H5L_info2_t li; /* Buffer for H5Lget_info2 */ + haddr_t grp_addr; /* Addresses for objects */ haddr_t dset_addr; haddr_t dtype_addr; hsize_t dims[RANK]; @@ -257,8 +264,10 @@ test_h5o_open_by_addr(void) H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -397,15 +406,18 @@ test_h5o_open_by_token(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info2_t li; /* Buffer for H5Lget_info */ + char filename[1024]; + H5L_info2_t li; /* Buffer for H5Lget_info */ hsize_t dims[RANK]; H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ H5G_info_t ginfo; /* Group info struct */ H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -515,12 +527,15 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5O_info2_t oinfo; /* Object info struct */ + char filename[1024]; + H5O_info2_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -612,7 +627,7 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file and check that the reference counts were really incremented */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); grp = H5Gopen2(fid, "group", H5P_DEFAULT); @@ -650,7 +665,7 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file and check that the reference counts were really decremented */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); grp = H5Gopen2(fid, "group", H5P_DEFAULT); @@ -709,10 +724,11 @@ test_h5o_refcount(void) static void test_h5o_plist(void) { - hid_t fid; /* HDF5 File ID */ - hid_t grp, dset, dtype, dspace; /* Object identifiers */ - hid_t fapl; /* File access property list */ - hid_t gcpl, dcpl, tcpl; /* Object creation properties */ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + hid_t fapl; /* File access property list */ + hid_t gcpl, dcpl, tcpl; /* Object creation properties */ + char filename[1024]; unsigned def_max_compact, def_min_dense; /* Default phase change parameters */ unsigned max_compact, min_dense; /* Actual phase change parameters */ herr_t ret; /* Value returned from API calls */ @@ -725,8 +741,10 @@ test_h5o_plist(void) ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); + h5_fixname(TEST_FILENAME, fapl, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Create group, dataset & named datatype creation property lists */ @@ -840,7 +858,7 @@ test_h5o_plist(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file and check that the object creation properties persist */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, fapl); + fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid, FAIL, "H5Fopen"); /* Re-open objects */ @@ -909,7 +927,8 @@ test_h5o_link(void) hid_t type_id = -1; hid_t fapl_id = -1; hid_t lcpl_id = -1; - hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2}; + char filename[1024]; + hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2}; htri_t committed; /* Whether the named datatype is committed */ H5F_libver_t low, high; /* File format bounds */ int * wdata; @@ -917,6 +936,8 @@ test_h5o_link(void) int i, n; herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Allocate memory buffers */ /* (These are treated as 2-D buffers) */ wdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int)); @@ -957,7 +978,7 @@ test_h5o_link(void) continue; /* Create a new HDF5 file */ - file_id = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); CHECK(file_id, FAIL, "H5Fcreate"); /* Close the FAPL */ @@ -1060,6 +1081,7 @@ test_h5o_comment(void) hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ hid_t attr_space, attr_id; + char filename[1024]; hsize_t dims[RANK]; hsize_t attr_dims = 1; int attr_value = 5; @@ -1073,8 +1095,10 @@ test_h5o_comment(void) herr_t ret; /* Value returned from API calls */ int ret_value; + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create an attribute for the file */ @@ -1152,7 +1176,7 @@ test_h5o_comment(void) /* Now make sure that the comments are correct all 4 types of objects */ /* Open file */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); /* Getting the comment on the file and verify it */ @@ -1232,6 +1256,7 @@ test_h5o_comment_by_name(void) hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ hid_t attr_space, attr_id; + char filename[1024]; hsize_t dims[RANK]; hsize_t attr_dims = 1; int attr_value = 5; @@ -1245,8 +1270,10 @@ test_h5o_comment_by_name(void) herr_t ret; /* Value returned from API calls */ int ret_value; + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create an attribute for the file */ @@ -1324,7 +1351,7 @@ test_h5o_comment_by_name(void) /* Now make sure that the comments are correct all 4 types of objects */ /* Open file */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); /* Getting the comment on the file and verify it */ @@ -1390,13 +1417,16 @@ test_h5o_comment_by_name(void) static void test_h5o_getinfo_same_file(void) { - hid_t fid1, fid2; /* HDF5 File ID */ - hid_t gid1, gid2; /* Group IDs */ + hid_t fid1, fid2; /* HDF5 File ID */ + hid_t gid1, gid2; /* Group IDs */ + char filename[1024]; H5O_info2_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid1 = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid1, FAIL, "H5Fcreate"); /* Create two groups in the file */ @@ -1438,9 +1468,9 @@ test_h5o_getinfo_same_file(void) CHECK(ret, FAIL, "H5Fclose"); /* Open file twice */ - fid1 = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid1, FAIL, "H5Fopen"); - fid2 = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid2, FAIL, "H5Fopen"); /* Open the two groups in the file */ @@ -1497,8 +1527,9 @@ test_h5o_open_by_addr_deprec(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info1_t li; /* Buffer for H5Lget_info1 */ - haddr_t grp_addr; /* Addresses for objects */ + char filename[1024]; + H5L_info1_t li; /* Buffer for H5Lget_info1 */ + haddr_t grp_addr; /* Addresses for objects */ haddr_t dset_addr; haddr_t dtype_addr; hsize_t dims[RANK]; @@ -1507,8 +1538,10 @@ test_h5o_open_by_addr_deprec(void) H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -1682,13 +1715,16 @@ test_h5o_getinfo_visit(void) hid_t gid1 = -1, gid2 = -1; /* Group IDs */ hid_t sid = -1; /* Dataspace ID */ hid_t aid = -1; /* Attribute ID */ - H5O_info1_t oinfo1, oinfo2; /* Object info structs */ - char attrname[25]; /* Attribute name */ - int j; /* Local index variable */ - herr_t ret; /* Value returned from API calls */ + char filename[1024]; + H5O_info1_t oinfo1, oinfo2; /* Object info structs */ + char attrname[25]; /* Attribute name */ + int j; /* Local index variable */ + herr_t ret; /* Value returned from API calls */ + + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Create an HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create "group1" in the file */ @@ -1806,5 +1842,12 @@ test_h5o(void) void cleanup_h5o(void) { - HDremove(TEST_FILENAME); + char filename[1024]; + + H5E_BEGIN_TRY + { + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + H5Fdelete(filename, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/th5s.c b/test/th5s.c index 51216dc..97a6728 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -194,7 +194,7 @@ test_h5s_basic(void) * If this test fails and the H5S_MAX_RANK variable has changed, follow * the instructions in space_overflow.c for regenerating the th5s.h5 file. */ - { + if (!h5_driver_uses_modified_filename()) { const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); diff --git a/test/titerate.c b/test/titerate.c index 10ed039..1d87343 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -1175,8 +1175,10 @@ test_iterate(void) #endif } /* end for */ - /* Test the fix for issue HDFFV-10588 */ - test_corrupted_attnamelen(); + if (!h5_driver_uses_modified_filename()) { + /* Test the fix for issue HDFFV-10588 */ + test_corrupted_attnamelen(); + } /* Close FAPLs */ ret = H5Pclose(fapl); diff --git a/test/tmisc.c b/test/tmisc.c index b267330..bb8d8c8 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -287,7 +287,7 @@ typedef struct { #define MISC25C_ATTRNAME2 "ab" /* Definitions for misc. test #26 */ -#define MISC26_FILE "dcpl_file" +#define MISC26_FILE "dcpl_file.h5" /* Definitions for misc. test #27 */ /* (Note that this test file is generated by the "gen_bad_ohdr.c" code) */ @@ -6026,29 +6026,51 @@ test_misc36(void) void test_misc(void) { + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); + hbool_t default_driver = h5_using_default_driver(NULL); + /* Output message about test being performed */ MESSAGE(5, ("Testing Miscellaneous Routines\n")); - test_misc1(); /* Test unlinking a dataset & immediately re-using name */ - test_misc2(); /* Test storing a VL-derived datatype in two different files */ - test_misc3(); /* Test reading from chunked dataset with non-zero fill value */ - test_misc4(); /* Test retrieving the fileno for various objects with H5Oget_info() */ - test_misc5(); /* Test several level deep nested compound & VL datatypes */ - test_misc6(); /* Test object header continuation code */ - test_misc7(); /* Test for sensible datatypes stored on disk */ - test_misc8(); /* Test storage sizes of various types of dataset storage */ - test_misc9(); /* Test for opening (not creating) core files */ - test_misc10(); /* Test for using dataset creation property lists from old files */ - test_misc11(); /* Test for all properties of a file creation property list being stored */ + test_misc1(); /* Test unlinking a dataset & immediately re-using name */ + test_misc2(); /* Test storing a VL-derived datatype in two different files */ + test_misc3(); /* Test reading from chunked dataset with non-zero fill value */ + test_misc4(); /* Test retrieving the fileno for various objects with H5Oget_info() */ + test_misc5(); /* Test several level deep nested compound & VL datatypes */ + test_misc6(); /* Test object header continuation code */ + test_misc7(); /* Test for sensible datatypes stored on disk */ + test_misc8(); /* Test storage sizes of various types of dataset storage */ + test_misc9(); /* Test for opening (not creating) core files */ + + if (!driver_uses_modified_filename) { + test_misc10(); /* Test for using dataset creation property lists from old files */ + } + + if (default_driver) { + test_misc11(); /* Test for all properties of a file creation property list being stored */ + } + test_misc12(); /* Test VL-strings in chunked datasets operating correctly */ - test_misc13(); /* Test that a user block can be insert in front of file contents */ + + if (default_driver) { + test_misc13(); /* Test that a user block can be insert in front of file contents */ + } + test_misc14(); /* Test that deleted dataset's data is removed from sieve buffer correctly */ - test_misc15(); /* Test that checking a file's access property list more than once works */ + + if (!driver_uses_modified_filename) { + test_misc15(); /* Test that checking a file's access property list more than once works */ + } + test_misc16(); /* Test array of fixed-length string */ test_misc17(); /* Test array of ASCII character */ test_misc18(); /* Test new object header information in H5O_info_t struct */ test_misc19(); /* Test incrementing & decrementing ref count on IDs */ - test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */ + + if (!driver_uses_modified_filename) { + test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */ + } + #ifdef H5_HAVE_FILTER_SZIP test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked datasets w/a filters */ @@ -6057,19 +6079,39 @@ test_misc(void) test_misc23(); /* Test intermediate group creation */ test_misc24(); /* Test inappropriate API opens of objects */ test_misc25a(); /* Exercise null object header message merge bug */ - test_misc25b(); /* Exercise null object header message merge bug on existing file */ + + if (!driver_uses_modified_filename) { + test_misc25b(); /* Exercise null object header message merge bug on existing file */ + } + test_misc25c(); /* Exercise another null object header message merge bug */ test_misc26(); /* Test closing property lists with long filter pipelines */ - test_misc27(); /* Test opening file with object that has bad # of object header messages */ - test_misc28(); /* Test that chunks are cached appropriately */ - test_misc29(); /* Test that speculative metadata reads are handled correctly */ - test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */ - test_misc31(); /* Test Reentering library through deprecated routines after H5close() */ - test_misc32(); /* Test filter memory allocation functions */ - test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */ - test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */ - test_misc35(); /* Test behavior of free-list & allocation statistics API calls */ - test_misc36(); /* Exercise H5atclose and H5is_library_terminating */ + + if (!driver_uses_modified_filename) { + test_misc27(); /* Test opening file with object that has bad # of object header messages */ + } + + test_misc28(); /* Test that chunks are cached appropriately */ + + if (!driver_uses_modified_filename) { + test_misc29(); /* Test that speculative metadata reads are handled correctly */ + } + + test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */ + + if (default_driver) { + test_misc31(); /* Test Reentering library through deprecated routines after H5close() */ + } + + test_misc32(); /* Test filter memory allocation functions */ + + if (!driver_uses_modified_filename) { + test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */ + } + + test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */ + test_misc35(); /* Test behavior of free-list & allocation statistics API calls */ + test_misc36(); /* Exercise H5atclose and H5is_library_terminating */ } /* test_misc() */ diff --git a/test/trefer.c b/test/trefer.c index 9b6c415..48d3670 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -3452,11 +3452,17 @@ test_reference_perf(void) void test_reference(void) { - H5F_libver_t low, high; /* Low and high bounds */ + H5F_libver_t low, high; /* Low and high bounds */ + const char * env_h5_drvr; /* File Driver value from environment */ /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + test_reference_params(); /* Test for correct parameter checking */ test_reference_obj(); /* Test basic H5R object reference code */ test_reference_vlen_obj(); /* Test reference within vlen */ @@ -3476,7 +3482,11 @@ test_reference(void) } /* end high bound */ } /* end low bound */ - test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ + /* The following test is currently broken with the Direct VFD */ + if (HDstrcmp(env_h5_drvr, "direct") != 0) { + test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ + } + test_reference_group(); /* Test operations on dereferenced groups */ test_reference_attr(); /* Test attribute references */ test_reference_external(); /* Test external references */ diff --git a/test/tselect.c b/test/tselect.c index 1bfb663..5fec1da 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -15991,18 +15991,24 @@ test_h5s_set_extent_none(void) void test_select(void) { - hid_t plist_id; /* Property list for reading random hyperslabs */ - hid_t fapl; /* Property list accessing the file */ - int mdc_nelmts; /* Metadata number of elements */ - size_t rdcc_nelmts; /* Raw data number of elements */ - size_t rdcc_nbytes; /* Raw data number of bytes */ - double rdcc_w0; /* Raw data write percentage */ - hssize_t offset[SPACE7_RANK] = {1, 1}; /* Offset for testing selection offsets */ - herr_t ret; /* Generic return value */ + hid_t plist_id; /* Property list for reading random hyperslabs */ + hid_t fapl; /* Property list accessing the file */ + int mdc_nelmts; /* Metadata number of elements */ + size_t rdcc_nelmts; /* Raw data number of elements */ + size_t rdcc_nbytes; /* Raw data number of bytes */ + double rdcc_w0; /* Raw data write percentage */ + hssize_t offset[SPACE7_RANK] = {1, 1}; /* Offset for testing selection offsets */ + const char *env_h5_drvr; /* File Driver value from environment */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Selections\n")); + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + /* Create a dataset transfer property list */ plist_id = H5Pcreate(H5P_DATASET_XFER); CHECK(plist_id, FAIL, "H5Pcreate"); @@ -16065,10 +16071,13 @@ test_select(void) test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */ test_select_hyper_valid_combination(); /* Test different input combinations */ - test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */ - test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */ - test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */ - test_select_hyper_nota_2d(); /* Test hyperslab NOTA code for 2-D dataset */ + /* The following tests are currently broken with the Direct VFD */ + if (HDstrcmp(env_h5_drvr, "direct") != 0) { + test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */ + test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */ + test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */ + test_select_hyper_nota_2d(); /* Test hyperslab NOTA code for 2-D dataset */ + } /* test the random hyperslab I/O with the default property list for reading */ test_select_hyper_union_random_5d(H5P_DEFAULT); /* Test hyperslab union code for random 5-D hyperslabs */ diff --git a/test/tsohm.c b/test/tsohm.c index b4ece0b..774378a 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3815,23 +3815,45 @@ test_sohm_external_dtype(void) void test_sohm(void) { + const char *env_h5_drvr; + hbool_t default_driver; + MESSAGE(5, ("Testing Shared Object Header Messages\n")); - test_sohm_fcpl(); /* Test SOHMs and file creation plists */ - test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ - test_sohm_size1(); /* Tests the sizes of files with one SOHM */ -#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + default_driver = h5_using_default_driver(env_h5_drvr); + + test_sohm_fcpl(); /* Test SOHMs and file creation plists */ + test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ + + /* Only run this test with sec2/default driver */ + if (default_driver) + test_sohm_size1(); /* Tests the sizes of files with one SOHM */ + +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ test_sohm_size_consistency_open_create(); -#endif /* Jira HDFFV-10645 */ - test_sohm_attrs(); /* Tests shared messages in attributes */ - test_sohm_size2(0); /* Tests the sizes of files with multiple SOHMs */ - test_sohm_size2(1); /* Tests the sizes of files with multiple - * SOHMs, closing and reopening file after - * each write. */ +#endif /* Jira HDFFV-10645 */ + test_sohm_attrs(); /* Tests shared messages in attributes */ + + /* Only run these tests with sec2/default driver */ + if (default_driver) { + test_sohm_size2(0); /* Tests the sizes of files with multiple SOHMs */ + test_sohm_size2(1); /* Tests the sizes of files with multiple + * SOHMs, closing and reopening file after + * each write. */ + } + test_sohm_delete(); /* Test deleting shared messages */ test_sohm_delete_revert(); /* Test that a file with SOHMs becomes an * empty file again when they are deleted. */ - test_sohm_extlink(); /* Test SOHMs when external links are used */ + + if (!h5_driver_uses_modified_filename()) { + test_sohm_extlink(); /* Test SOHMs when external links are used */ + } test_sohm_extend_dset(); /* Test extending shared datasets */ test_sohm_external_dtype(); /* Test using datatype in another file */ diff --git a/test/ttsafe.c b/test/ttsafe.c index 067a715..da78a7d 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -132,7 +132,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !HDgetenv(HDF5_NOCLEANUP)) TestCleanup(); /* Release test infrastructure */ diff --git a/test/vds.c b/test/vds.c index ac9bb5d..61b974b 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12288,9 +12288,24 @@ main(void) hid_t src_fapl = -1; /* File access property list */ int test_api_config; unsigned bit_config; - H5F_libver_t low, high; /* Low and high bounds */ + H5F_libver_t low, high; /* Low and high bounds */ + const char * env_h5_drvr; /* File Driver value from environment */ int nerrors = 0; + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* + * Skip VDS tests for parallel-enabled and splitter VFDs. VDS currently + * doesn't support parallel reads and the splitter VFD has external + * link-related bugs. + */ + if (h5_using_parallel_driver(env_h5_drvr) || !HDstrcmp(env_h5_drvr, "splitter")) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } + /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); diff --git a/test/vds_env.c b/test/vds_env.c index 58d90fc..5020db6 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -298,9 +298,24 @@ main(void) { hid_t fapl, my_fapl; unsigned bit_config; - H5F_libver_t low, high; /* Low and high bounds */ + H5F_libver_t low, high; /* Low and high bounds */ + const char * env_h5_drvr; /* File Driver value from environment */ int nerrors = 0; + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* + * Skip VDS tests for parallel-enabled and splitter VFDs. VDS currently + * doesn't support parallel reads and the splitter VFD has external + * link-related bugs. + */ + if (h5_using_parallel_driver(env_h5_drvr) || !HDstrcmp(env_h5_drvr, "splitter")) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } + /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); diff --git a/test/vfd.c b/test/vfd.c index 4e9b9ee..ea526b1 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -51,7 +51,7 @@ const char *FILENAME[] = {"sec2_file", /*0*/ "core_file", /*1*/ "family_file", /*2*/ - "new_family_v16_", /*3*/ + "new_family_v16", /*3*/ "multi_file", /*4*/ "direct_file", /*5*/ "log_file", /*6*/ @@ -68,7 +68,7 @@ const char *FILENAME[] = {"sec2_file", /*0*/ #define LOG_FILENAME "log_vfd_out.log" -#define COMPAT_BASENAME "family_v16_" +#define COMPAT_BASENAME "family_v16" #define MULTI_COMPAT_BASENAME "multi_file_v16" #define SPLITTER_DATASET_NAME "dataset" @@ -3488,6 +3488,7 @@ H5FD__ctl_test_vfd_ctl(H5FD_t H5_ATTR_UNUSED *_file, uint64_t op_code, uint64_t /* Minimal VFD for ctl feature tests */ static const H5FD_class_t H5FD_ctl_test_vfd_g = { + (H5FD_class_value_t)201, /* value */ "ctl_test_vfd", /* name */ HADDR_MAX, /* maxaddr */ H5F_CLOSE_SEMI, /* fc_degree */ @@ -3925,7 +3926,18 @@ error: int main(void) { - int nerrors = 0; + char *env_h5_drvr = NULL; + int nerrors = 0; + + /* Don't run VFD tests when HDF5_DRIVER is set. These tests expect a + * specific VFD to be set and HDF5_DRIVER being set can interfere + * with that. + */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr) { + HDprintf(" -- SKIPPED VFD tests because %s is set -- \n", HDF5_DRIVER); + HDexit(EXIT_SUCCESS); + } h5_reset(); diff --git a/test/vfd_plugin.c b/test/vfd_plugin.c new file mode 100644 index 0000000..df211cc --- /dev/null +++ b/test/vfd_plugin.c @@ -0,0 +1,388 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Tests basic VFD plugin operations. Uses a basic testing VFD + * which is loaded as a dynamic plugin. + */ + +#include "h5test.h" + +#include "null_vfd_plugin.h" + +#define DEFAULT_DRIVER_NAME "sec2" + +/*------------------------------------------------------------------------- + * Function: test_set_by_name() + * + * Purpose: Tests if we can load and register a VFD plugin by name. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_set_by_name(void) +{ + htri_t is_registered = FAIL; + hid_t driver_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + + TESTING("VFD plugin registration by name"); + + /* The null VFD should not be registered at the start of the test */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Register the null VFD by name */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + if (H5Pset_driver_by_name(fapl_id, NULL_VFD_NAME, NULL) < 0) + TEST_ERROR; + + /* The null VFD should be registered now */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VFD was not registered"); + + /* Unregister the null VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + + /* Close FAPL, which holds last reference to null VFD */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* The null VFD should not be registered now */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: test_set_by_value() + * + * Purpose: Tests if we can load and register a VFD plugin by value + * (ID). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_set_by_value(void) +{ + htri_t is_registered = FAIL; + hid_t driver_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + + TESTING("VFD plugin registration by value (ID)"); + + /* The null VFD should not be registered at the start of the test */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Register the null VFD by value */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + if (H5Pset_driver_by_value(fapl_id, NULL_VFD_VALUE, NULL) < 0) + TEST_ERROR; + + /* The null VFD should be registered now */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VFD was not registered"); + + /* Unregister the null VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + + /* Close FAPL, which holds last reference to null VFD */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* The null VFD should not be registered now */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: test_set_multi() + * + * Purpose: Tests if we can register a VFD plugin multiple times. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +#define N_REGISTRATIONS 10 +static herr_t +test_set_multi(void) +{ + htri_t is_registered = FAIL; + hid_t driver_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + int i; + + TESTING("registering a VFD plugin multiple times"); + + /* The null VFD should not be registered at the start of the test */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Register the VFD multiple times */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5Pset_driver_by_name(fapl_id, NULL_VFD_NAME, NULL) < 0) + TEST_ERROR; + } + + /* The null VFD should be registered now */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VFD was not registered"); + + /* Unregister the null VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + } + + /* Close FAPL, which holds last reference to null VFD */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* The null VFD should not be registered now */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Repeat testing with the _by_value routines */ + + /* The null VFD should not be registered at the start of the test */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Register the VFD multiple times */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5Pset_driver_by_value(fapl_id, NULL_VFD_VALUE, NULL) < 0) + TEST_ERROR; + } + + /* The null VFD should be registered now */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VFD was not registered"); + + /* Unregister the null VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + } + + /* Close FAPL, which holds last reference to null VFD */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* The null VFD should not be registered now */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} +#undef N_REGISTRATIONS + +/*------------------------------------------------------------------------- + * Function: test_get_config_str() + * + * Purpose: Tests if we can retrieve a configuration string set for a + * VFL driver. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_get_config_str(void) +{ + const char *const config_str = "{name: sec2}"; + ssize_t config_str_len = 0; + hid_t fapl_id = H5I_INVALID_HID; + char config_str_buf[128]; + + TESTING("Retrieval of VFD configuration string"); + + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + + /* Try to retrieve length of default configuration string - should be 0 */ + HDmemset(config_str_buf, 0, 128); + + if ((config_str_len = H5Pget_driver_config_str(fapl_id, config_str_buf, 128)) < 0) + TEST_ERROR; + if (0 != config_str_len) + TEST_ERROR; + if (HDstrlen(config_str_buf) > 0) + TEST_ERROR; + + /* Set a new configuration string on the FAPL and retrieve it */ + if (H5Pset_driver_by_name(fapl_id, DEFAULT_DRIVER_NAME, config_str) < 0) + TEST_ERROR; + if ((config_str_len = H5Pget_driver_config_str(fapl_id, config_str_buf, 128)) < 0) + TEST_ERROR; + if (HDstrlen(config_str) != config_str_len) + TEST_ERROR; + if (HDstrncmp(config_str_buf, config_str, 128)) + TEST_ERROR; + + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* Set default driver and driver configuration using environment variables */ + if (HDsetenv(HDF5_DRIVER, "sec2", 1) < 0) + TEST_ERROR; + if (HDsetenv(HDF5_DRIVER_CONFIG, config_str, 1) < 0) + TEST_ERROR; + + /* Close and re-open HDF5 to have it parse the environment variables */ + if (H5close() < 0) + TEST_ERROR; + if (H5open() < 0) + TEST_ERROR; + + /* Retrieve configuration string from default FAPL */ + HDmemset(config_str_buf, 0, 128); + if ((config_str_len = H5Pget_driver_config_str(H5P_FILE_ACCESS_DEFAULT, config_str_buf, 128)) < 0) + TEST_ERROR; + if (HDstrlen(config_str) != config_str_len) + TEST_ERROR; + if (HDstrncmp(config_str_buf, config_str, 128)) + TEST_ERROR; + + /* Unset environment variables */ + if (HDsetenv(HDF5_DRIVER, "", 1) < 0) + TEST_ERROR; + if (HDsetenv(HDF5_DRIVER_CONFIG, "", 1) < 0) + TEST_ERROR; + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests VFD plugin operations + * + * Return: EXIT_SUCCESS/EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; + + h5_reset(); + + HDputs("Testing VFD plugin functionality."); + + nerrors += (test_set_by_name() < 0) ? 1 : 0; + nerrors += (test_set_by_value() < 0) ? 1 : 0; + nerrors += (test_set_multi() < 0) ? 1 : 0; + nerrors += (test_get_config_str() < 0) ? 1 : 0; + + if (nerrors) { + HDprintf("***** %d VFD plugin TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); + HDexit(EXIT_FAILURE); + } + + HDputs("All VFD plugin tests passed."); + + HDexit(EXIT_SUCCESS); +} diff --git a/test/vol.c b/test/vol.c index c7586d5..76be111 100644 --- a/test/vol.c +++ b/test/vol.c @@ -814,9 +814,11 @@ test_basic_file_operation(const char *env_h5_drvr) if ((obj_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET, 2, obj_id_list)) < 0) TEST_ERROR; - /* Can't compare VFD properties for split / multi / family VFDs */ + /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0)) { + HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -876,9 +878,11 @@ test_basic_file_operation(const char *env_h5_drvr) if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR; - /* Can't compare VFD properties for split / multi / family VFDs */ + /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0)) { + HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -891,9 +895,11 @@ test_basic_file_operation(const char *env_h5_drvr) if ((fid_reopen = H5Freopen(fid)) < 0) TEST_ERROR; - /* Can't compare VFD properties for split / multi / family VFDs */ + /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0)) { + HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) TEST_ERROR; @@ -942,7 +948,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_group_operation(void) +test_basic_group_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -985,9 +991,10 @@ test_basic_group_operation(void) if (H5Gget_info_by_idx(fid, "/", H5_INDEX_NAME, H5_ITER_NATIVE, 0, &info, H5P_DEFAULT) < 0) TEST_ERROR; - /* H5Gflush */ - if (H5Gflush(gid) < 0) - TEST_ERROR; + /* H5Gflush - skip for MPIO file driver as flush calls cause assertions in the library */ + if (HDstrcmp(env_h5_drvr, "mpio") != 0) + if (H5Gflush(gid) < 0) + TEST_ERROR; /* H5Gclose */ if (H5Gclose(gid) < 0) @@ -1045,7 +1052,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_dataset_operation(void) +test_basic_dataset_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -1110,9 +1117,10 @@ test_basic_dataset_operation(void) if (H5Dset_extent(did, &curr_dims) < 0) TEST_ERROR; - /* H5Dflush */ - if (H5Dflush(did) < 0) - TEST_ERROR; + /* H5Dflush - skip for MPIO file driver as flush calls cause assertions in the library */ + if (HDstrcmp(env_h5_drvr, "mpio") != 0) + if (H5Dflush(did) < 0) + TEST_ERROR; /* H5Dwrite */ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0) @@ -1384,10 +1392,10 @@ test_basic_object_operation(void) if (H5Oclose(oid) < 0) TEST_ERROR; - if (H5Fclose(fid) < 0) - TEST_ERROR; if (H5Gclose(gid) < 0) TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; h5_delete_test_file(FILENAME[0], fapl_id); @@ -1463,10 +1471,10 @@ test_basic_link_operation(void) H5P_DEFAULT) < 0) TEST_ERROR; - if (H5Fclose(fid) < 0) - TEST_ERROR; if (H5Gclose(gid) < 0) TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; h5_delete_test_file(FILENAME[0], fapl_id); @@ -1500,7 +1508,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_datatype_operation(void) +test_basic_datatype_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -1524,9 +1532,10 @@ test_basic_datatype_operation(void) if (H5Tcommit2(fid, NATIVE_VOL_TEST_DATATYPE_NAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR; - /* H5Tflush */ - if (H5Tflush(tid) < 0) - TEST_ERROR; + /* H5Tflush - skip for MPIO file driver as flush calls cause assertions in the library */ + if (HDstrcmp(env_h5_drvr, "mpio") != 0) + if (H5Tflush(tid) < 0) + TEST_ERROR; /* H5Trefresh */ if (H5Trefresh(tid) < 0) @@ -1975,11 +1984,11 @@ test_async_vol_props(void) FAIL_STACK_ERROR; /* Override possible environment variable & re-initialize default VOL connector */ - conn_env_str = HDgetenv("HDF5_VOL_CONNECTOR"); + conn_env_str = HDgetenv(HDF5_VOL_CONNECTOR); if (conn_env_str) { if (NULL == (conn_env_str = HDstrdup(conn_env_str))) TEST_ERROR - if (HDunsetenv("HDF5_VOL_CONNECTOR") < 0) + if (HDunsetenv(HDF5_VOL_CONNECTOR) < 0) TEST_ERROR if (H5VL__reparse_def_vol_conn_variable_test() < 0) TEST_ERROR @@ -2004,7 +2013,7 @@ test_async_vol_props(void) FAIL_STACK_ERROR; /* Set environment variable to use 'fake async' connector & re-init default connector */ - if (HDsetenv("HDF5_VOL_CONNECTOR", "fake_async", TRUE) < 0) + if (HDsetenv(HDF5_VOL_CONNECTOR, "fake_async", TRUE) < 0) TEST_ERROR if (H5VL__reparse_def_vol_conn_variable_test() < 0) TEST_ERROR @@ -2022,7 +2031,7 @@ test_async_vol_props(void) TEST_ERROR /* Reset environment variable & re-init default connector */ - if (HDunsetenv("HDF5_VOL_CONNECTOR") < 0) + if (HDunsetenv(HDF5_VOL_CONNECTOR) < 0) TEST_ERROR if (H5VL__reparse_def_vol_conn_variable_test() < 0) TEST_ERROR @@ -2072,7 +2081,7 @@ test_async_vol_props(void) /* Restore environment variable, if there was one */ if (conn_env_str) { - if (HDsetenv("HDF5_VOL_CONNECTOR", conn_env_str, TRUE) < 0) + if (HDsetenv(HDF5_VOL_CONNECTOR, conn_env_str, TRUE) < 0) TEST_ERROR HDfree(conn_env_str); @@ -2112,7 +2121,7 @@ main(void) int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -2124,12 +2133,12 @@ main(void) nerrors += test_register_opt_operation() < 0 ? 1 : 0; nerrors += test_native_vol_init() < 0 ? 1 : 0; nerrors += test_basic_file_operation(env_h5_drvr) < 0 ? 1 : 0; - nerrors += test_basic_group_operation() < 0 ? 1 : 0; - nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; + nerrors += test_basic_group_operation(env_h5_drvr) < 0 ? 1 : 0; + nerrors += test_basic_dataset_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; nerrors += test_basic_object_operation() < 0 ? 1 : 0; nerrors += test_basic_link_operation() < 0 ? 1 : 0; - nerrors += test_basic_datatype_operation() < 0 ? 1 : 0; + nerrors += test_basic_datatype_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_async_vol_props() < 0 ? 1 : 0; if (nerrors) { diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 7656870..c7baf5a 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -150,8 +150,8 @@ error: static herr_t test_multiple_registration(void) { - htri_t is_registered = FAIL; - hid_t vol_ids[N_REGISTRATIONS]; + htri_t is_registered = FAIL; + hid_t vol_ids[N_REGISTRATIONS] = {0}; int i; TESTING("registering a VOL connector multiple times"); diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index f50ca16..785c08d 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -23,6 +23,8 @@ set (VFD_LIST split multi family + splitter + #log - log VFD currently has file space allocation bugs ) set (H5P_VFD_TESTS @@ -33,6 +35,21 @@ set (H5P_VFD_TESTS if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () +if (H5_HAVE_PARALLEL) + set (VFD_LIST ${VFD_LIST} mpio) +endif () +if (H5_HAVE_MIRROR_VFD) + set (VFD_LIST ${VFD_LIST} mirror) +endif () +if (H5_HAVE_ROS3_VFD) + set (VFD_LIST ${VFD_LIST} ros3) +endif () +if (H5_HAVE_LIBHDFS) + set (VFD_LIST ${VFD_LIST} hdfs) +endif () +if (H5_HAVE_WINDOWS) + set (VFD_LIST ${VFD_LIST} windows) +endif () foreach (vfdtest ${VFD_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c index 2a80f4a..cc569f6 100644 --- a/testpar/t_pflush1.c +++ b/testpar/t_pflush1.c @@ -133,7 +133,7 @@ main(int argc, char *argv[]) TESTING("H5Fflush (part1)"); /* Don't run using the split VFD */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; @@ -207,5 +207,7 @@ error: HDfflush(stderr); HDprintf("*** ERROR ***\n"); HDprintf("THERE WAS A REAL ERROR IN t_pflush1.\n"); + HDfflush(stdout); + HD_exit(EXIT_FAILURE); } /* end main() */ diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index c96233a..e782f8a 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -157,7 +157,7 @@ main(int argc, char *argv[]) TESTING("H5Fflush (part2 with flush)"); /* Don't run using the split VFD */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; @@ -167,7 +167,7 @@ main(int argc, char *argv[]) HDputs(" Test not compatible with current Virtual File Driver"); } MPI_Finalize(); - HDexit(EXIT_FAILURE); + HDexit(EXIT_SUCCESS); } if ((fapl_id1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 0ad319e..74db58f 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -648,14 +648,16 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char *------------------------------------------------------------------------- */ /* open file 1 */ - if (opts->custom_vol[0]) { - if ((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info[0]), NULL)) < 0) { + if (opts->custom_vol[0] || opts->custom_vfd[0]) { + if ((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, opts->custom_vol[0] ? &(opts->vol_info[0]) : NULL, + opts->custom_vfd[0] ? &(opts->vfd_info[0]) : NULL)) < 0) { parallel_print("h5diff: unable to create fapl for input file\n"); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n"); } } - if ((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, fapl1_id, FALSE, NULL, (size_t)0)) < 0) { + if ((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, fapl1_id, (fapl1_id != H5P_DEFAULT), NULL, + (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname1); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "<%s>: unable to open file\n", fname1); } @@ -663,14 +665,16 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char /* open file 2 */ - if (opts->custom_vol[1]) { - if ((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info[1]), NULL)) < 0) { + if (opts->custom_vol[1] || opts->custom_vfd[1]) { + if ((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, opts->custom_vol[1] ? &(opts->vol_info[1]) : NULL, + opts->custom_vfd[1] ? &(opts->vfd_info[1]) : NULL)) < 0) { parallel_print("h5diff: unable to create fapl for output file\n"); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n"); } } - if ((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, fapl2_id, FALSE, NULL, (size_t)0)) < 0) { + if ((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, fapl2_id, (fapl2_id != H5P_DEFAULT), NULL, + (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname2); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "<%s>: unable to open file\n", fname2); } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 7b41538..8d7ac13 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -89,7 +89,9 @@ typedef struct { char * obj_name[2]; /* name for object */ struct subset_t * sset[2]; /* subsetting parameters */ h5tools_vol_info_t vol_info[2]; /* VOL information for input file, output file */ + h5tools_vfd_info_t vfd_info[2]; /* VFD information for input file, output file */ hbool_t custom_vol[2]; /* Using a custom input, output VOL? */ + hbool_t custom_vfd[2]; /* Using a custom input, output VFD? */ } diff_opt_t; /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index eee9c53..4de2c5c 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -459,8 +459,8 @@ h5tools_set_error_file(const char *fname, int is_bin) /*------------------------------------------------------------------------- * Function: h5tools_set_fapl_vfd * - * Purpose: Given a VFL driver name, sets the appropriate driver on the - * specified FAPL. + * Purpose: Given a VFL driver name or ID, sets the appropriate driver on + * the specified FAPL. * * Return: positive - succeeded * negative - failed @@ -471,107 +471,139 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) { herr_t ret_value = SUCCEED; - /* Determine which driver the user wants to open the file with */ - if (!HDstrcmp(vfd_info->name, drivernames[SEC2_VFD_IDX])) { - /* SEC2 Driver */ - if (H5Pset_fapl_sec2(fapl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_sec2 failed"); - } - else if (!HDstrcmp(vfd_info->name, drivernames[DIRECT_VFD_IDX])) { + switch (vfd_info->type) { + case VFD_BY_NAME: + /* Determine which driver the user wants to open the file with */ + if (!HDstrcmp(vfd_info->u.name, drivernames[SEC2_VFD_IDX])) { + /* SEC2 Driver */ + if (H5Pset_fapl_sec2(fapl_id) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_sec2 failed"); + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[DIRECT_VFD_IDX])) { #ifdef H5_HAVE_DIRECT - /* Direct Driver */ - if (H5Pset_fapl_direct(fapl_id, 1024, 4096, 8 * 4096) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_direct failed"); + /* Direct Driver */ + if (H5Pset_fapl_direct(fapl_id, 1024, 4096, 8 * 4096) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_direct failed"); #else - H5TOOLS_GOTO_ERROR(FAIL, "Direct VFD is not enabled"); + H5TOOLS_GOTO_ERROR(FAIL, "Direct VFD is not enabled"); #endif - } - else if (!HDstrcmp(vfd_info->name, drivernames[LOG_VFD_IDX])) { - unsigned long long log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[LOG_VFD_IDX])) { + unsigned long long log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; - /* Log Driver */ - if (H5Pset_fapl_log(fapl_id, NULL, log_flags, (size_t)0) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_log failed"); - } - else if (!HDstrcmp(vfd_info->name, drivernames[WINDOWS_VFD_IDX])) { + /* Log Driver */ + if (H5Pset_fapl_log(fapl_id, NULL, log_flags, (size_t)0) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_log failed"); + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[WINDOWS_VFD_IDX])) { #ifdef H5_HAVE_WINDOWS - /* There is no Windows VFD - use SEC2 */ - if (H5Pset_fapl_sec2(fapl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_sec2 failed"); + /* There is no Windows VFD - use SEC2 */ + if (H5Pset_fapl_sec2(fapl_id) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_sec2 failed"); #else - H5TOOLS_GOTO_ERROR(FAIL, "Windows VFD is not enabled"); + H5TOOLS_GOTO_ERROR(FAIL, "Windows VFD is not enabled"); #endif - } - else if (!HDstrcmp(vfd_info->name, drivernames[STDIO_VFD_IDX])) { - /* Stdio Driver */ - if (H5Pset_fapl_stdio(fapl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_stdio failed"); - } - else if (!HDstrcmp(vfd_info->name, drivernames[CORE_VFD_IDX])) { - /* Core Driver */ - if (H5Pset_fapl_core(fapl_id, (size_t)H5_MB, TRUE) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_core failed"); - } - else if (!HDstrcmp(vfd_info->name, drivernames[FAMILY_VFD_IDX])) { - /* FAMILY Driver */ - /* Set member size to be 0 to indicate the current first member size - * is the member size. - */ - if (H5Pset_fapl_family(fapl_id, (hsize_t)0, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_family failed"); - } - else if (!HDstrcmp(vfd_info->name, drivernames[SPLIT_VFD_IDX])) { - /* SPLIT Driver */ - if (H5Pset_fapl_split(fapl_id, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_split failed"); - } - else if (!HDstrcmp(vfd_info->name, drivernames[MULTI_VFD_IDX])) { - /* MULTI Driver */ - if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_multi failed"); - } - else if (!HDstrcmp(vfd_info->name, drivernames[MPIO_VFD_IDX])) { + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[STDIO_VFD_IDX])) { + /* Stdio Driver */ + if (H5Pset_fapl_stdio(fapl_id) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_stdio failed"); + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[CORE_VFD_IDX])) { + /* Core Driver */ + if (H5Pset_fapl_core(fapl_id, (size_t)H5_MB, TRUE) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_core failed"); + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[FAMILY_VFD_IDX])) { + /* FAMILY Driver */ + /* Set member size to be 0 to indicate the current first member size + * is the member size. + */ + if (H5Pset_fapl_family(fapl_id, (hsize_t)0, H5P_DEFAULT) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_family failed"); + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[SPLIT_VFD_IDX])) { + /* SPLIT Driver */ + if (H5Pset_fapl_split(fapl_id, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_split failed"); + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[MULTI_VFD_IDX])) { + /* MULTI Driver */ + if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_multi failed"); + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[MPIO_VFD_IDX])) { #ifdef H5_HAVE_PARALLEL - int mpi_initialized, mpi_finalized; + int mpi_initialized, mpi_finalized; - /* MPI-I/O Driver */ + /* MPI-I/O Driver */ - /* check if MPI is available. */ - MPI_Initialized(&mpi_initialized); - MPI_Finalized(&mpi_finalized); + /* check if MPI is available. */ + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); - if (mpi_initialized && !mpi_finalized) { - if (H5Pset_fapl_mpio(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_mpio failed"); - } + if (mpi_initialized && !mpi_finalized) { + if (H5Pset_fapl_mpio(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_mpio failed"); + } #else - H5TOOLS_GOTO_ERROR(FAIL, "MPI-I/O VFD is not enabled"); + H5TOOLS_GOTO_ERROR(FAIL, "MPI-I/O VFD is not enabled"); #endif /* H5_HAVE_PARALLEL */ - } - else if (!HDstrcmp(vfd_info->name, drivernames[ROS3_VFD_IDX])) { + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[ROS3_VFD_IDX])) { #ifdef H5_HAVE_ROS3_VFD - if (!vfd_info->info) - H5TOOLS_GOTO_ERROR(FAIL, "Read-only S3 VFD info is invalid"); - if (H5Pset_fapl_ros3(fapl_id, (H5FD_ros3_fapl_t *)vfd_info->info) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_ros3() failed"); + if (!vfd_info->info) + H5TOOLS_GOTO_ERROR(FAIL, "Read-only S3 VFD info is invalid"); + if (H5Pset_fapl_ros3(fapl_id, (H5FD_ros3_fapl_t *)vfd_info->info) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_ros3() failed"); #else - H5TOOLS_GOTO_ERROR(FAIL, "Read-only S3 VFD is not enabled"); + H5TOOLS_GOTO_ERROR(FAIL, "Read-only S3 VFD is not enabled"); #endif - } - else if (!HDstrcmp(vfd_info->name, drivernames[HDFS_VFD_IDX])) { + } + else if (!HDstrcmp(vfd_info->u.name, drivernames[HDFS_VFD_IDX])) { #ifdef H5_HAVE_LIBHDFS - if (!vfd_info->info) - H5TOOLS_GOTO_ERROR(FAIL, "HDFS VFD info is invalid"); - if (H5Pset_fapl_hdfs(fapl_id, (H5FD_hdfs_fapl_t *)vfd_info->info) < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_hdfs() failed"); + if (!vfd_info->info) + H5TOOLS_GOTO_ERROR(FAIL, "HDFS VFD info is invalid"); + if (H5Pset_fapl_hdfs(fapl_id, (H5FD_hdfs_fapl_t *)vfd_info->info) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_hdfs() failed"); #else - H5TOOLS_GOTO_ERROR(FAIL, "The HDFS VFD is not enabled"); + H5TOOLS_GOTO_ERROR(FAIL, "The HDFS VFD is not enabled"); #endif + } + else { + /* + * Try to load VFD plugin. + * + * Currently, driver configuration strings are unsupported. + */ + if (H5Pset_driver_by_name(fapl_id, vfd_info->u.name, (const char *)vfd_info->info) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "can't load VFD plugin by driver name '%s'", vfd_info->u.name); + } + + break; + + case VFD_BY_VALUE: + /* + * Try to load VFD plugin. + * + * Currently, driver configuration strings are unsupported. + */ + if (H5Pset_driver_by_value(fapl_id, vfd_info->u.value, (const char *)vfd_info->info) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "can't load VFD plugin by driver value '%ld'", + (long int)vfd_info->u.value); + break; + + default: + H5TOOLS_GOTO_ERROR(FAIL, "invalid VFD retrieval type"); } - else - H5TOOLS_GOTO_ERROR(FAIL, "invalid VFD name"); done: + if (ret_value < 0) { + /* Clear error message unless asked for */ + if (enable_error_stack <= 1) + H5Epop(H5tools_ERR_STACK_g, 1); + } + return ret_value; } @@ -671,6 +703,10 @@ done: if (ret_value < 0) { if (connector_id >= 0 && H5Idec_ref(connector_id) < 0) H5TOOLS_ERROR(FAIL, "failed to decrement refcount on VOL connector ID"); + + /* Clear error message unless asked for */ + if (enable_error_stack <= 1) + H5Epop(H5tools_ERR_STACK_g, 1); } return ret_value; @@ -719,9 +755,15 @@ h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info, h5tools_vfd_i ret_value = new_fapl_id; done: - if ((new_fapl_id >= 0) && (ret_value < 0)) { - H5Pclose(new_fapl_id); - new_fapl_id = H5I_INVALID_HID; + if (ret_value < 0) { + if (new_fapl_id >= 0) { + H5Pclose(new_fapl_id); + new_fapl_id = H5I_INVALID_HID; + } + + /* Clear error message unless asked for */ + if (enable_error_stack <= 1) + H5Epop(H5tools_ERR_STACK_g, 1); } return ret_value; @@ -937,8 +979,9 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_spec if (drivernum == LOG_VFD_IDX) continue; - vfd_info.info = NULL; - vfd_info.name = drivernames[drivernum]; + vfd_info.type = VFD_BY_NAME; + vfd_info.info = NULL; + vfd_info.u.name = drivernames[drivernum]; /* Get a fapl reflecting the selected VOL connector and VFD */ if ((tmp_fapl_id = h5tools_get_fapl(fapl_id, &vol_info, &vfd_info)) < 0) @@ -989,6 +1032,10 @@ done: if (tmp_fapl_id >= 0) H5Pclose(tmp_fapl_id); + /* Clear error message unless asked for */ + if (ret_value < 0 && enable_error_stack <= 1) + H5Epop(H5tools_ERR_STACK_g, 1); + return ret_value; } diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 9d065f3..dde4026 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -553,6 +553,7 @@ typedef struct h5tools_context_t { */ typedef enum { VOL_BY_NAME, VOL_BY_VALUE } h5tools_vol_info_type_t; +typedef enum { VFD_BY_NAME, VFD_BY_VALUE } h5tools_vfd_info_type_t; typedef struct h5tools_vol_info_t { h5tools_vol_info_type_t type; @@ -568,12 +569,16 @@ typedef struct h5tools_vol_info_t { } h5tools_vol_info_t; typedef struct h5tools_vfd_info_t { + h5tools_vfd_info_type_t type; /* Pointer to information to be passed to the driver for its setup */ const void *info; - /* Name of the VFD */ - const char *name; + /* Field specifying either the driver's name or value (ID) */ + union { + const char * name; + H5FD_class_value_t value; + } u; } h5tools_vfd_info_t; /* This enum should match the entries in the above 'volnames' diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 37d38fd..1a15a47 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -1201,9 +1201,10 @@ test_set_configured_fapl(void) #endif /* UTIL_TEST_DEBUG */ /* test */ - vfd_info.info = C.conf_fa; - vfd_info.name = C.vfdname; - result = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info); + vfd_info.type = VFD_BY_NAME; + vfd_info.info = C.conf_fa; + vfd_info.u.name = C.vfdname; + result = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info); if (C.expected == 0) JSVERIFY(result, H5I_INVALID_HID, C.message) else diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index b669087..3d89936 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -48,6 +48,12 @@ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"vol-value-2", require_arg, '4'}, {"vol-name-2", require_arg, '5'}, {"vol-info-2", require_arg, '6'}, + {"vfd-value-1", require_arg, '7'}, + {"vfd-name-1", require_arg, '8'}, + {"vfd-info-1", require_arg, '9'}, + {"vfd-value-2", require_arg, '0'}, + {"vfd-name-2", require_arg, 'Y'}, + {"vfd-info-2", require_arg, 'Z'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- @@ -432,6 +438,38 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char case '6': opts->vol_info[1].info_string = H5_optarg; break; + + case '7': + opts->vfd_info[0].type = VFD_BY_VALUE; + opts->vfd_info[0].u.value = (H5FD_class_value_t)HDatoi(H5_optarg); + opts->custom_vfd[0] = TRUE; + break; + + case '8': + opts->vfd_info[0].type = VFD_BY_NAME; + opts->vfd_info[0].u.name = H5_optarg; + opts->custom_vol[0] = TRUE; + break; + + case '9': + opts->vfd_info[0].info = (const void *)H5_optarg; + break; + + case '0': + opts->vfd_info[1].type = VFD_BY_VALUE; + opts->vfd_info[1].u.value = (H5FD_class_value_t)HDatoi(H5_optarg); + opts->custom_vfd[1] = TRUE; + break; + + case 'Y': + opts->vfd_info[1].type = VFD_BY_NAME; + opts->vfd_info[1].u.name = H5_optarg; + opts->custom_vfd[1] = TRUE; + break; + + case 'Z': + opts->vfd_info[1].info = (const void *)H5_optarg; + break; } } @@ -657,6 +695,24 @@ usage(void) PRINTVALSTREAM(rawoutstream, " --vol-info-2 VOL-specific info to pass to the VOL connector used for\n"); PRINTVALSTREAM(rawoutstream, " opening the second HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-value-1 Value (ID) of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " first HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-name-1 Name of the VFL driver to use for opening the first\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-info-1 VFD-specific info to pass to the VFL driver used for\n"); + PRINTVALSTREAM(rawoutstream, " opening the first HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-value-2 Value (ID) of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " second HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-name-2 Name of the VFL driver to use for opening the second\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-info-2 VFD-specific info to pass to the VFL driver used for\n"); + PRINTVALSTREAM(rawoutstream, " opening the second HDF5 file specified\n"); PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n"); PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links and compare the)\n"); diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 36114ba..e6d1de3 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -18,14 +18,15 @@ /* Name of tool */ #define PROGRAMNAME "h5dump" -static const char *driver_name_g = NULL; /* The driver to open the file with. */ const char * outfname_g = NULL; static hbool_t doxml_g = FALSE; static hbool_t useschema_g = TRUE; static const char *xml_dtd_uri_g = NULL; static hbool_t use_custom_vol_g = FALSE; +static hbool_t use_custom_vfd_g = FALSE; static h5tools_vol_info_t vol_info_g; +static h5tools_vfd_info_t vfd_info_g; #ifdef H5_HAVE_ROS3_VFD /* Default "anonymous" S3 configuration */ @@ -127,6 +128,9 @@ static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'}, {"vol-value", require_arg, '1'}, {"vol-name", require_arg, '2'}, {"vol-info", require_arg, '3'}, + {"vfd-value", require_arg, '4'}, + {"vfd-name", require_arg, '5'}, + {"vfd-info", require_arg, '6'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- @@ -196,6 +200,14 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " --vol-info VOL-specific info to pass to the VOL connector used for\n"); PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-value Value (ID) of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, " --vfd-name Name of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-info VFD-specific info to pass to the VFL driver used for\n"); + PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); PRINTVALSTREAM(rawoutstream, @@ -943,7 +955,10 @@ parse_start: last_was_dset = TRUE; break; case 'f': - driver_name_g = H5_optarg; + vfd_info_g.type = VFD_BY_NAME; + vfd_info_g.u.name = H5_optarg; + vfd_info_g.info = NULL; + use_custom_vfd_g = TRUE; break; case 'g': dump_opts.display_all = 0; @@ -1264,6 +1279,22 @@ end_collect: vol_info_g.info_string = H5_optarg; break; + case '4': + vfd_info_g.type = VFD_BY_VALUE; + vfd_info_g.u.value = (H5FD_class_value_t)HDatoi(H5_optarg); + use_custom_vfd_g = TRUE; + break; + + case '5': + vfd_info_g.type = VFD_BY_NAME; + vfd_info_g.u.name = H5_optarg; + use_custom_vfd_g = TRUE; + break; + + case '6': + vfd_info_g.info = (const void *)H5_optarg; + break; + case '?': default: usage(h5tools_getprogname()); @@ -1378,40 +1409,9 @@ main(int argc, const char *argv[]) /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); - if (driver_name_g != NULL) { - h5tools_vfd_info_t vfd_info; - - vfd_info.info = NULL; - vfd_info.name = driver_name_g; - - if (!HDstrcmp(driver_name_g, drivernames[ROS3_VFD_IDX])) { -#ifdef H5_HAVE_ROS3_VFD - vfd_info.info = (void *)&ros3_fa_g; -#else - error_msg("Read-Only S3 VFD not enabled.\n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; -#endif - } - else if (!HDstrcmp(driver_name_g, drivernames[HDFS_VFD_IDX])) { -#ifdef H5_HAVE_LIBHDFS - vfd_info.info = (void *)&hdfs_fa_g; -#else - error_msg("The HDFS VFD is not enabled.\n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; -#endif - } - - if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) { - error_msg("unable to create FAPL for file access\n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } /* driver name defined */ - - if (use_custom_vol_g) { - if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, &vol_info_g, NULL)) < 0) { + if (use_custom_vol_g || use_custom_vfd_g) { + if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, use_custom_vol_g ? &vol_info_g : NULL, + use_custom_vfd_g ? &vfd_info_g : NULL)) < 0) { error_msg("unable to create FAPL for file access\n"); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -1421,7 +1421,7 @@ main(int argc, const char *argv[]) while (H5_optind < argc) { fname = HDstrdup(argv[H5_optind++]); - fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0); + fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), NULL, 0); if (fid < 0) { error_msg("unable to open file \"%s\"\n", fname); diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 4392d85..2ec8da2 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -240,6 +240,12 @@ usage(void) PRINTVALSTREAM(rawoutstream, " --vol-info VOL-specific info to pass to the VOL connector used for\n"); PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, " --vfd-value Value (ID) of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, " --vfd-name Name of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, " --vfd-info VFD-specific info to pass to the VFL driver used for\n"); + PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " file/OBJECT\n"); PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n"); @@ -2649,11 +2655,12 @@ main(int argc, const char *argv[]) int argno; static char root_name[] = "/"; char drivername[50]; - const char * preferred_driver = NULL; - int err_exit = 0; - hid_t fapl_id = H5P_DEFAULT; - hbool_t custom_vol_fapl = FALSE; + int err_exit = 0; + hid_t fapl_id = H5P_DEFAULT; + hbool_t custom_vol_fapl = FALSE; + hbool_t custom_vfd_fapl = FALSE; h5tools_vol_info_t vol_info; + h5tools_vfd_info_t vfd_info; #ifdef H5_HAVE_ROS3_VFD /* Default "anonymous" S3 configuration */ @@ -2684,8 +2691,9 @@ main(int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - /* Initialize fapl info struct */ + /* Initialize fapl info structs */ HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t)); + HDmemset(&vfd_info, 0, sizeof(h5tools_vfd_info_t)); /* Build object display table */ DISPATCH(H5O_TYPE_GROUP, "Group", NULL, NULL); @@ -2747,9 +2755,6 @@ main(int argc, const char *argv[]) else if (!HDstrcmp(argv[argno], "--string")) { string_g = TRUE; } - else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) { - preferred_driver = argv[argno] + 6; - } else if (!HDstrncmp(argv[argno], "--vol-value=", (size_t)12)) { vol_info.type = VOL_BY_VALUE; vol_info.u.value = (H5VL_class_value_t)HDatoi(argv[argno] + 12); @@ -2763,6 +2768,25 @@ main(int argc, const char *argv[]) else if (!HDstrncmp(argv[argno], "--vol-info=", (size_t)11)) { vol_info.info_string = argv[argno] + 11; } + else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) { + vfd_info.type = VFD_BY_NAME; + vfd_info.u.name = argv[argno] + 6; + vfd_info.info = NULL; + custom_vfd_fapl = TRUE; + } + else if (!HDstrncmp(argv[argno], "--vfd-value=", (size_t)12)) { + vfd_info.type = VFD_BY_VALUE; + vfd_info.u.value = (H5FD_class_value_t)HDatoi(argv[argno] + 12); + custom_vfd_fapl = TRUE; + } + else if (!HDstrncmp(argv[argno], "--vfd-name=", (size_t)11)) { + vfd_info.type = VFD_BY_NAME; + vfd_info.u.name = argv[argno] + 11; + custom_vfd_fapl = TRUE; + } + else if (!HDstrncmp(argv[argno], "--vfd-info=", (size_t)11)) { + vfd_info.info = (const void *)(argv[argno] + 11); + } else if (!HDstrncmp(argv[argno], "--width=", (size_t)8)) { width_g = (int)HDstrtol(argv[argno] + 8, &rest, 0); @@ -2959,42 +2983,14 @@ main(int argc, const char *argv[]) } /* Setup a custom fapl for file accesses */ - if (custom_vol_fapl) { - if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, &vol_info, NULL)) < 0) { + if (custom_vol_fapl || custom_vfd_fapl) { + if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, custom_vol_fapl ? &vol_info : NULL, + custom_vfd_fapl ? &vfd_info : NULL)) < 0) { error_msg("failed to setup file access property list (fapl) for file\n"); leave(EXIT_FAILURE); } } - if (preferred_driver) { - h5tools_vfd_info_t vfd_info; - - vfd_info.info = NULL; - vfd_info.name = preferred_driver; - - if (!HDstrcmp(preferred_driver, drivernames[ROS3_VFD_IDX])) { -#ifdef H5_HAVE_ROS3_VFD - vfd_info.info = (void *)&ros3_fa; -#else - HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD is not enabled\n\n"); - leave(EXIT_FAILURE); -#endif - } - else if (!HDstrcmp(preferred_driver, drivernames[HDFS_VFD_IDX])) { -#ifdef H5_HAVE_LIBHDFS - vfd_info.info = (void *)&hdfs_fa; -#else - HDfprintf(rawerrorstream, "Error: The HDFS VFD is not enabled\n\n"); - leave(EXIT_FAILURE); -#endif - } - - if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) { - HDfprintf(rawerrorstream, "Error: Unable to create FAPL for file access\n\n"); - leave(EXIT_FAILURE); - } - } - /* Each remaining argument is an hdf5 file followed by an optional slash * and object name. * @@ -3019,8 +3015,8 @@ main(int argc, const char *argv[]) file_id = H5I_INVALID_HID; while (fname && *fname) { - file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, - drivername, sizeof drivername); + file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), drivername, + sizeof drivername); if (file_id >= 0) { if (verbose_g) diff --git a/tools/src/h5perf/perf.c b/tools/src/h5perf/perf.c index 83d4ab0..50b18bc 100644 --- a/tools/src/h5perf/perf.c +++ b/tools/src/h5perf/perf.c @@ -605,7 +605,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu * we are using the split driver since both of those * use the multi VFD under the hood. */ - env = HDgetenv("HDF5_DRIVER"); + env = HDgetenv(HDF5_DRIVER); #ifdef HDF5_DRIVER /* Use the environment variable, then the compile-time constant */ if (!env) diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index cac36d7..f890c7d 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -2676,7 +2676,7 @@ do_cleanupfile(iotype iot, char *fname) return; if (clean_file_g == -1) - clean_file_g = (getenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0; + clean_file_g = (getenv(HDF5_NOCLEANUP) == NULL) ? 1 : 0; if (clean_file_g) { switch (iot) { diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c index e69a7cd..3ebacc0 100644 --- a/tools/src/h5perf/sio_engine.c +++ b/tools/src/h5perf/sio_engine.c @@ -1272,7 +1272,7 @@ do_cleanupfile(iotype iot, char *filename) hid_t driver; if (clean_file_g == -1) - clean_file_g = (HDgetenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0; + clean_file_g = (HDgetenv(HDF5_NOCLEANUP) == NULL) ? 1 : 0; if (clean_file_g) { diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 7cad36b..d75b1cf 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -758,8 +758,8 @@ check_objects(const char *fname, pack_opt_t *options) * open the file *------------------------------------------------------------------------- */ - if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl, - (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0) + if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_fapl != H5P_DEFAULT), + NULL, 0)) < 0) H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); /*------------------------------------------------------------------------- diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 934b4d1..3806a4e 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -81,8 +81,8 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) * open input file *------------------------------------------------------------------------- */ - if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl, - (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, (size_t)0)) < 0) + if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_fapl != H5P_DEFAULT), + NULL, (size_t)0)) < 0) H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR); /* get user block size and file space strategy/persist/threshold */ diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 3526268..08568cd 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -31,7 +31,7 @@ const char *outfile = NULL; * Command-line options: The user can specify short or long-named * parameters. */ -static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW1:2:3:4:5:6:"; +static const char *s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXWY:Z:1:2:3:4:5:6:7:8:9:0:"; static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'}, {"block", require_arg, 'b'}, {"compact", require_arg, 'c'}, @@ -68,6 +68,12 @@ static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'}, {"dst-vol-value", require_arg, '4'}, {"dst-vol-name", require_arg, '5'}, {"dst-vol-info", require_arg, '6'}, + {"src-vfd-value", require_arg, '7'}, + {"src-vfd-name", require_arg, '8'}, + {"src-vfd-info", require_arg, '9'}, + {"dst-vfd-value", require_arg, '0'}, + {"dst-vfd-name", require_arg, 'Y'}, + {"dst-vfd-info", require_arg, 'Z'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- @@ -112,6 +118,24 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " --dst-vol-info VOL-specific info to pass to the VOL connector used for\n"); PRINTVALSTREAM(rawoutstream, " opening the output HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --src-vfd-value Value (ID) of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " input HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --src-vfd-name Name of the VFL driver to use for opening the input\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --src-vfd-info VFD-specific info to pass to the VFL driver used for\n"); + PRINTVALSTREAM(rawoutstream, " opening the input HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --dst-vfd-value Value (ID) of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " output HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --dst-vfd-name Name of the VFL driver to use for opening the output\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --dst-vfd-info VFD-specific info to pass to the VFL driver used for\n"); + PRINTVALSTREAM(rawoutstream, " opening the output HDF5 file specified\n"); PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n"); PRINTVALSTREAM(rawoutstream, " This option will take precedence over the options\n"); @@ -486,15 +510,21 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) { h5tools_vol_info_t in_vol_info; h5tools_vol_info_t out_vol_info; - hbool_t custom_in_fapl = FALSE; - hbool_t custom_out_fapl = FALSE; - hid_t tmp_fapl = H5I_INVALID_HID; + h5tools_vfd_info_t in_vfd_info; + h5tools_vfd_info_t out_vfd_info; + hbool_t custom_in_vol = FALSE; + hbool_t custom_in_vfd = FALSE; + hbool_t custom_out_vol = FALSE; + hbool_t custom_out_vfd = FALSE; + hid_t tmp_fapl = H5I_INVALID_HID; int bound, opt; int ret_value = 0; /* Initialize fapl info structs */ HDmemset(&in_vol_info, 0, sizeof(h5tools_vol_info_t)); HDmemset(&out_vol_info, 0, sizeof(h5tools_vol_info_t)); + HDmemset(&in_vfd_info, 0, sizeof(h5tools_vfd_info_t)); + HDmemset(&out_vfd_info, 0, sizeof(h5tools_vfd_info_t)); /* parse command line options */ while (EOF != (opt = H5_get_option(argc, argv, s_opts, l_opts))) { @@ -741,13 +771,13 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) case '1': in_vol_info.type = VOL_BY_VALUE; in_vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); - custom_in_fapl = TRUE; + custom_in_vol = TRUE; break; case '2': in_vol_info.type = VOL_BY_NAME; in_vol_info.u.name = H5_optarg; - custom_in_fapl = TRUE; + custom_in_vol = TRUE; break; case '3': @@ -757,19 +787,51 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) case '4': out_vol_info.type = VOL_BY_VALUE; out_vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); - custom_out_fapl = TRUE; + custom_out_vol = TRUE; break; case '5': out_vol_info.type = VOL_BY_NAME; out_vol_info.u.name = H5_optarg; - custom_out_fapl = TRUE; + custom_out_vol = TRUE; break; case '6': out_vol_info.info_string = H5_optarg; break; + case '7': + in_vfd_info.type = VFD_BY_VALUE; + in_vfd_info.u.value = (H5FD_class_value_t)HDatoi(H5_optarg); + custom_in_vfd = TRUE; + break; + + case '8': + in_vfd_info.type = VFD_BY_NAME; + in_vfd_info.u.name = H5_optarg; + custom_in_vfd = TRUE; + break; + + case '9': + in_vfd_info.info = (const void *)H5_optarg; + break; + + case '0': + out_vfd_info.type = VFD_BY_VALUE; + out_vfd_info.u.value = (H5FD_class_value_t)HDatoi(H5_optarg); + custom_out_vfd = TRUE; + break; + + case 'Y': + out_vfd_info.type = VFD_BY_NAME; + out_vfd_info.u.name = H5_optarg; + custom_out_vfd = TRUE; + break; + + case 'Z': + out_vfd_info.info = (const void *)H5_optarg; + break; + default: break; } /* end switch */ @@ -803,8 +865,9 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) } /* Setup FAPL for input and output file accesses */ - if (custom_in_fapl) { - if ((tmp_fapl = h5tools_get_fapl(options->fin_fapl, &in_vol_info, NULL)) < 0) { + if (custom_in_vol || custom_in_vfd) { + if ((tmp_fapl = h5tools_get_fapl(options->fin_fapl, custom_in_vol ? &in_vol_info : NULL, + custom_in_vfd ? &in_vfd_info : NULL)) < 0) { error_msg("failed to setup FAPL for input file\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; @@ -823,8 +886,9 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options) options->fin_fapl = tmp_fapl; } - if (custom_out_fapl) { - if ((tmp_fapl = h5tools_get_fapl(options->fout_fapl, &out_vol_info, NULL)) < 0) { + if (custom_out_vol || custom_out_vfd) { + if ((tmp_fapl = h5tools_get_fapl(options->fout_fapl, custom_out_vol ? &out_vol_info : NULL, + custom_out_vfd ? &out_vfd_info : NULL)) < 0) { error_msg("failed to setup FAPL for output file\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index 0542d03..8c54dde 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -378,11 +378,11 @@ h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t *------------------------------------------------------------------------- */ /* Open the files */ - if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, - (fname1_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0) + if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, (fname1_fapl != H5P_DEFAULT), NULL, 0)) < + 0) H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR); - if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, - (fname2_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0) + if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, (fname2_fapl != H5P_DEFAULT), NULL, 0)) < + 0) H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR); /*------------------------------------------------------------------------- diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index efc80b6..d745c0f 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1702,25 +1702,9 @@ main(int argc, const char *argv[]) if (drivername) { h5tools_vfd_info_t vfd_info; - vfd_info.info = NULL; - vfd_info.name = drivername; - - if (!HDstrcmp(drivername, drivernames[ROS3_VFD_IDX])) { -#ifdef H5_HAVE_ROS3_VFD - vfd_info.info = (void *)&ros3_fa; -#else - error_msg("Read-Only S3 VFD not enabled.\n"); - goto done; -#endif - } - else if (!HDstrcmp(drivername, drivernames[HDFS_VFD_IDX])) { -#ifdef H5_HAVE_LIBHDFS - vfd_info.info = (void *)&hdfs_fa; -#else - error_msg("HDFS VFD not enabled.\n"); - goto done; -#endif - } + vfd_info.type = VFD_BY_NAME; + vfd_info.info = NULL; + vfd_info.u.name = drivername; if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) { error_msg("Unable to create FAPL for file access\n"); @@ -1737,7 +1721,7 @@ main(int argc, const char *argv[]) HDprintf("Filename: %s\n", fname); - fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0); + fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), NULL, 0); if (fid < 0) { error_msg("unable to open file \"%s\"\n", fname); diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index a85ee4d..1e66fce 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -26,7 +26,8 @@ static const char * s_opts = "hlpvV"; static struct h5_long_options l_opts[] = { {"help", no_arg, 'h'}, {"latest", no_arg, 'l'}, {"parents", no_arg, 'p'}, {"verbose", no_arg, 'v'}, {"version", no_arg, 'V'}, {"vol-value", require_arg, '1'}, - {"vol-name", require_arg, '2'}, {"vol-info", require_arg, '3'}, {NULL, 0, '\0'}}; + {"vol-name", require_arg, '2'}, {"vol-info", require_arg, '3'}, {"vfd-value", require_arg, '4'}, + {"vfd-name", require_arg, '5'}, {"vfd-info", require_arg, '6'}, {NULL, 0, '\0'}}; /* Command line parameter settings */ typedef struct mkgrp_opt_t { @@ -105,6 +106,14 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " --vol-info VOL-specific info to pass to the VOL connector used for\n"); PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-value Value (ID) of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, " --vfd-name Name of the VFL driver to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vfd-info VFD-specific info to pass to the VFL driver used for\n"); + PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n"); PRINTVALSTREAM(rawoutstream, "\n"); } /* end usage() */ @@ -126,8 +135,10 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options) { int opt; /* Option from command line */ size_t curr_group; /* Current group name to copy */ - hbool_t custom_fapl = FALSE; + hbool_t custom_vol = FALSE; + hbool_t custom_vfd = FALSE; h5tools_vol_info_t vol_info; + h5tools_vfd_info_t vfd_info; hid_t tmp_fapl_id = H5I_INVALID_HID; /* Check for empty command line */ @@ -136,8 +147,9 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options) leave(EXIT_SUCCESS); } - /* Initialize fapl info struct */ + /* Initialize fapl info structs */ HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t)); + HDmemset(&vfd_info, 0, sizeof(h5tools_vfd_info_t)); /* Parse command line options */ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { @@ -172,19 +184,35 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options) case '1': vol_info.type = VOL_BY_VALUE; vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); - custom_fapl = TRUE; + custom_vol = TRUE; break; case '2': vol_info.type = VOL_BY_NAME; vol_info.u.name = H5_optarg; - custom_fapl = TRUE; + custom_vol = TRUE; break; case '3': vol_info.info_string = H5_optarg; break; + case '4': + vfd_info.type = VFD_BY_VALUE; + vfd_info.u.value = (H5FD_class_value_t)HDatoi(H5_optarg); + custom_vfd = TRUE; + break; + + case '5': + vfd_info.type = VFD_BY_NAME; + vfd_info.u.name = H5_optarg; + custom_vfd = TRUE; + break; + + case '6': + vfd_info.info = (const void *)H5_optarg; + break; + /* Bad command line argument */ default: usage(h5tools_getprogname()); @@ -223,8 +251,9 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options) } /* Setup a custom fapl for file accesses */ - if (custom_fapl) { - if ((tmp_fapl_id = h5tools_get_fapl(options->fapl_id, &vol_info, NULL)) < 0) { + if (custom_vol || custom_vfd) { + if ((tmp_fapl_id = h5tools_get_fapl(options->fapl_id, custom_vol ? &vol_info : NULL, + custom_vfd ? &vfd_info : NULL)) < 0) { error_msg("failed to setup file access property list (fapl) for file\n"); leave(EXIT_FAILURE); } @@ -296,7 +325,8 @@ main(int argc, const char *argv[]) } /* Attempt to open an existing HDF5 file first */ - fid = h5tools_fopen(params_g.fname, H5F_ACC_RDWR, params_g.fapl_id, FALSE, NULL, 0); + fid = h5tools_fopen(params_g.fname, H5F_ACC_RDWR, params_g.fapl_id, (params_g.fapl_id != H5P_DEFAULT), + NULL, 0); /* If we couldn't open an existing file, try creating file */ /* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */ diff --git a/tools/test/h5diff/testfiles/h5diff_10.txt b/tools/test/h5diff/testfiles/h5diff_10.txt index 3631db7..c8e8560 100644 --- a/tools/test/h5diff/testfiles/h5diff_10.txt +++ b/tools/test/h5diff/testfiles/h5diff_10.txt @@ -36,6 +36,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt index 8a4ce6d..c8190ce 100644 --- a/tools/test/h5diff/testfiles/h5diff_600.txt +++ b/tools/test/h5diff/testfiles/h5diff_600.txt @@ -36,6 +36,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_603.txt b/tools/test/h5diff/testfiles/h5diff_603.txt index d4c7336..03c23e7 100644 --- a/tools/test/h5diff/testfiles/h5diff_603.txt +++ b/tools/test/h5diff/testfiles/h5diff_603.txt @@ -37,6 +37,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_606.txt b/tools/test/h5diff/testfiles/h5diff_606.txt index 3123587..0e9d5be 100644 --- a/tools/test/h5diff/testfiles/h5diff_606.txt +++ b/tools/test/h5diff/testfiles/h5diff_606.txt @@ -37,6 +37,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_612.txt b/tools/test/h5diff/testfiles/h5diff_612.txt index ce2d887..ac19926 100644 --- a/tools/test/h5diff/testfiles/h5diff_612.txt +++ b/tools/test/h5diff/testfiles/h5diff_612.txt @@ -37,6 +37,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_615.txt b/tools/test/h5diff/testfiles/h5diff_615.txt index 61fd036..44eba43 100644 --- a/tools/test/h5diff/testfiles/h5diff_615.txt +++ b/tools/test/h5diff/testfiles/h5diff_615.txt @@ -37,6 +37,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_621.txt b/tools/test/h5diff/testfiles/h5diff_621.txt index dc8655d..32310eb 100644 --- a/tools/test/h5diff/testfiles/h5diff_621.txt +++ b/tools/test/h5diff/testfiles/h5diff_621.txt @@ -37,6 +37,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_622.txt b/tools/test/h5diff/testfiles/h5diff_622.txt index f20ffbe..630184f 100644 --- a/tools/test/h5diff/testfiles/h5diff_622.txt +++ b/tools/test/h5diff/testfiles/h5diff_622.txt @@ -37,6 +37,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_623.txt b/tools/test/h5diff/testfiles/h5diff_623.txt index f73d202..82c4ce2 100644 --- a/tools/test/h5diff/testfiles/h5diff_623.txt +++ b/tools/test/h5diff/testfiles/h5diff_623.txt @@ -37,6 +37,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5diff/testfiles/h5diff_624.txt b/tools/test/h5diff/testfiles/h5diff_624.txt index 903b738..a675ec6 100644 --- a/tools/test/h5diff/testfiles/h5diff_624.txt +++ b/tools/test/h5diff/testfiles/h5diff_624.txt @@ -37,6 +37,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] HDF5 file specified --vol-info-2 VOL-specific info to pass to the VOL connector used for opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index e26941b..4f6e51d 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -24,11 +24,28 @@ set (VFD_LIST split multi family + splitter + #log - log VFD currently has file space allocation bugs ) if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () +if (H5_HAVE_PARALLEL) + set (VFD_LIST ${VFD_LIST} mpio) +endif () +if (H5_HAVE_MIRROR_VFD) + set (VFD_LIST ${VFD_LIST} mirror) +endif () +if (H5_HAVE_ROS3_VFD) + set (VFD_LIST ${VFD_LIST} ros3) +endif () +if (H5_HAVE_LIBHDFS) + set (VFD_LIST ${VFD_LIST} hdfs) +endif () +if (H5_HAVE_WINDOWS) + set (VFD_LIST ${VFD_LIST} windows) +endif () ############################################################################## ############################################################################## diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index b62fa53..ed3fedd 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -272,98 +272,100 @@ main(void) GOERROR; PASSED(); - TESTING(" files with file space info setting-- options -S and -P are set & -L"); - ++j; /* #3 */ - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - fname = H5REPACK_FSPACE_FNAMES[j]; - if (h5repack_init(&pack_options, 0, TRUE) < 0) - GOERROR; - pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; /* "PAGE" specified via -S */ - pack_options.fs_persist = TRUE; - if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) - GOERROR; - if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + if (h5_using_default_driver(NULL)) { + TESTING(" files with file space info setting-- options -S and -P are set & -L"); + ++j; /* #3 */ + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + fname = H5REPACK_FSPACE_FNAMES[j]; + if (h5repack_init(&pack_options, 0, TRUE) < 0) + GOERROR; + pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; /* "PAGE" specified via -S */ + pack_options.fs_persist = TRUE; + if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) + GOERROR; + if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); - TESTING(" files with file space info setting-- options -P and -T are set & -L"); - ++j; /* #4 */ - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - fname = H5REPACK_FSPACE_FNAMES[j]; - if (h5repack_init(&pack_options, 0, TRUE) < 0) - GOERROR; - pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ - pack_options.fs_threshold = 2; - if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) - GOERROR; - if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + TESTING(" files with file space info setting-- options -P and -T are set & -L"); + ++j; /* #4 */ + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + fname = H5REPACK_FSPACE_FNAMES[j]; + if (h5repack_init(&pack_options, 0, TRUE) < 0) + GOERROR; + pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ + pack_options.fs_threshold = 2; + if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) + GOERROR; + if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); - TESTING(" files with file space info setting-- options -S and -G are set & -L"); - ++j; /* #5 */ - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - fname = H5REPACK_FSPACE_FNAMES[j]; - if (h5repack_init(&pack_options, 0, TRUE) < 0) - GOERROR; - pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; - pack_options.fs_pagesize = 8192; - if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) - GOERROR; - if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + TESTING(" files with file space info setting-- options -S and -G are set & -L"); + ++j; /* #5 */ + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + fname = H5REPACK_FSPACE_FNAMES[j]; + if (h5repack_init(&pack_options, 0, TRUE) < 0) + GOERROR; + pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; + pack_options.fs_pagesize = 8192; + if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) + GOERROR; + if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); - TESTING(" files with file space info setting-- options -S, -P, -T, -G are set"); - ++j; /* #6 */ - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - fname = H5REPACK_FSPACE_FNAMES[j]; - if (h5repack_init(&pack_options, 0, FALSE) < 0) - GOERROR; - pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE; - pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ - pack_options.fs_threshold = 1; - pack_options.fs_pagesize = 8192; - if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) - GOERROR; - if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + TESTING(" files with file space info setting-- options -S, -P, -T, -G are set"); + ++j; /* #6 */ + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + fname = H5REPACK_FSPACE_FNAMES[j]; + if (h5repack_init(&pack_options, 0, FALSE) < 0) + GOERROR; + pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE; + pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ + pack_options.fs_threshold = 1; + pack_options.fs_pagesize = 8192; + if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) + GOERROR; + if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); - TESTING(" files with file space info setting-- options -S, -T, -G are set & -L"); - ++j; /* #7 */ - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - fname = H5REPACK_FSPACE_FNAMES[j]; - if (h5repack_init(&pack_options, 0, TRUE) < 0) - GOERROR; - pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR; - pack_options.fs_threshold = 1; - pack_options.fs_pagesize = 4096; - if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) - GOERROR; - if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + TESTING(" files with file space info setting-- options -S, -T, -G are set & -L"); + ++j; /* #7 */ + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + fname = H5REPACK_FSPACE_FNAMES[j]; + if (h5repack_init(&pack_options, 0, TRUE) < 0) + GOERROR; + pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR; + pack_options.fs_threshold = 1; + pack_options.fs_pagesize = 4096; + if (h5repack(fname, FSPACE_OUT, &pack_options) < 0) + GOERROR; + if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); + } /*------------------------------------------------------------------------- * file with fill values @@ -389,20 +391,22 @@ main(void) * file with all kinds of dataset datatypes *------------------------------------------------------------------------- */ - TESTING(" copy of datasets (all datatypes)"); - if (h5repack_init(&pack_options, 0, FALSE) < 0) - GOERROR; - if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0) - GOERROR; - if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_cmp_pl(FNAME1, pack_options.fin_fapl, FNAME1OUT, pack_options.fout_fapl) <= 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + if (!h5_using_parallel_driver(NULL)) { + TESTING(" copy of datasets (all datatypes)"); + if (h5repack_init(&pack_options, 0, FALSE) < 0) + GOERROR; + if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0) + GOERROR; + if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0) + GOERROR; + if (h5repack_cmp_pl(FNAME1, pack_options.fin_fapl, FNAME1OUT, pack_options.fout_fapl) <= 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); + } /*------------------------------------------------------------------------- * file with attributes @@ -1487,49 +1491,53 @@ main(void) GOERROR; PASSED(); - /*------------------------------------------------------------------------- - * test file with userblock - *------------------------------------------------------------------------- - */ - TESTING(" file with userblock"); - if (h5repack_init(&pack_options, 0, FALSE) < 0) - GOERROR; - if (h5repack(FNAME16, FNAME16OUT, &pack_options) < 0) - GOERROR; - if (h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0) - GOERROR; - if (verify_userblock(FNAME16OUT) < 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + if (h5_using_default_driver(NULL)) { + /*------------------------------------------------------------------------- + * test file with userblock + *------------------------------------------------------------------------- + */ + TESTING(" file with userblock"); + if (h5repack_init(&pack_options, 0, FALSE) < 0) + GOERROR; + if (h5repack(FNAME16, FNAME16OUT, &pack_options) < 0) + GOERROR; + if (h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0) + GOERROR; + if (verify_userblock(FNAME16OUT) < 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); + } /*------------------------------------------------------------------------- * test --latest options *------------------------------------------------------------------------- */ - TESTING(" latest file format options"); - if (h5repack_init(&pack_options, 0, FALSE) < 0) - GOERROR; - pack_options.latest = 1; - pack_options.grp_compact = 10; - pack_options.grp_indexed = 5; - pack_options.msg_size[0] = 10; - pack_options.msg_size[1] = 20; - pack_options.msg_size[2] = 30; - pack_options.msg_size[3] = 40; - pack_options.msg_size[4] = 50; - if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0) - GOERROR; - if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + if (!h5_using_parallel_driver(NULL)) { + TESTING(" latest file format options"); + if (h5repack_init(&pack_options, 0, FALSE) < 0) + GOERROR; + pack_options.latest = 1; + pack_options.grp_compact = 10; + pack_options.grp_indexed = 5; + pack_options.msg_size[0] = 10; + pack_options.msg_size[1] = 20; + pack_options.msg_size[2] = 30; + pack_options.msg_size[3] = 40; + pack_options.msg_size[4] = 50; + if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0) + GOERROR; + if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); + } /*------------------------------------------------------------------------- * test several global filters @@ -1560,36 +1568,38 @@ main(void) SKIPPED(); #endif - /*------------------------------------------------------------------------- - * test file with userblock - *------------------------------------------------------------------------- - */ - TESTING(" file with added userblock"); + if (h5_using_default_driver(NULL)) { + /*------------------------------------------------------------------------- + * test file with userblock + *------------------------------------------------------------------------- + */ + TESTING(" file with added userblock"); #ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init(&pack_options, 0, FALSE) < 0) - GOERROR; + if (h5repack_init(&pack_options, 0, FALSE) < 0) + GOERROR; - /* add the options for a user block size and user block filename */ - pack_options.ublock_size = USERBLOCK_SIZE; - pack_options.ublock_filename = FNAME_UB; + /* add the options for a user block size and user block filename */ + pack_options.ublock_size = USERBLOCK_SIZE; + pack_options.ublock_filename = FNAME_UB; - if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) - GOERROR; - if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0) - GOERROR; - if (verify_userblock(FNAME8OUT) < 0) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; + if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) + GOERROR; + if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0) + GOERROR; + if (verify_userblock(FNAME8OUT) < 0) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; - PASSED(); + PASSED(); #else - SKIPPED(); + SKIPPED(); #endif + } /*------------------------------------------------------------------------- * test file with aligment @@ -1664,48 +1674,50 @@ main(void) PASSED(); - /*------------------------------------------------------------------------- - * test --metadata_block_size option - * Also verify that output file using the metadata_block_size option is - * larger than the output file one not using it. - * FNAME4 is used because it is the same as the test file used for the - * shell script version of this test (h5repack.sh). - *------------------------------------------------------------------------- - */ - TESTING(" metadata block size option"); - /* First run without metadata option. No need to verify the correctness */ - /* since this has been verified by earlier tests. Just record the file */ - /* size of the output file. */ - if (h5repack_init(&pack_options, 0, FALSE) < 0) - GOERROR; - if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) - GOERROR; - if (HDstat(FNAME4OUT, &file_stat) < 0) - GOERROR; - fsize1 = file_stat.st_size; - if (h5repack_end(&pack_options) < 0) - GOERROR; + if (h5_using_default_driver(NULL)) { + /*------------------------------------------------------------------------- + * test --metadata_block_size option + * Also verify that output file using the metadata_block_size option is + * larger than the output file one not using it. + * FNAME4 is used because it is the same as the test file used for the + * shell script version of this test (h5repack.sh). + *------------------------------------------------------------------------- + */ + TESTING(" metadata block size option"); + /* First run without metadata option. No need to verify the correctness */ + /* since this has been verified by earlier tests. Just record the file */ + /* size of the output file. */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) + GOERROR; + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) + GOERROR; + if (HDstat(FNAME4OUT, &file_stat) < 0) + GOERROR; + fsize1 = file_stat.st_size; + if (h5repack_end(&pack_options) < 0) + GOERROR; - /* run it again with metadata option */ - if (h5repack_init(&pack_options, 0, FALSE) < 0) - GOERROR; - pack_options.meta_block_size = 8192; - if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) - GOERROR; - if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) - GOERROR; - /* record the file size of the output file */ - if (HDstat(FNAME4OUT, &file_stat) < 0) - GOERROR; - fsize2 = file_stat.st_size; - /* verify second file size is larger than the first one */ - if (fsize2 <= fsize1) - GOERROR; - if (h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); + /* run it again with metadata option */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) + GOERROR; + pack_options.meta_block_size = 8192; + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) + GOERROR; + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) + GOERROR; + /* record the file size of the output file */ + if (HDstat(FNAME4OUT, &file_stat) < 0) + GOERROR; + fsize2 = file_stat.st_size; + /* verify second file size is larger than the first one */ + if (fsize2 <= fsize1) + GOERROR; + if (h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); + } /*------------------------------------------------------------------------- * clean temporary test files @@ -1725,7 +1737,10 @@ main(void) return 0; error: + h5tools_close(); + puts("***** H5REPACK TESTS FAILED *****"); + return 1; } @@ -1760,12 +1775,14 @@ make_testfiles(void) * create another file for general copy test (all datatypes) *------------------------------------------------------------------------- */ - if ((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - if (make_all_objects(fid) < 0) - goto out; - if (H5Fclose(fid) < 0) - return -1; + if (!h5_using_parallel_driver(NULL)) { + if ((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return -1; + if (make_all_objects(fid) < 0) + goto out; + if (H5Fclose(fid) < 0) + return -1; + } /*------------------------------------------------------------------------- * create a file for attributes copy test @@ -1934,19 +1951,21 @@ make_testfiles(void) if (H5Fclose(fid) < 0) return -1; - /*------------------------------------------------------------------------- - * create a file with userblock - *------------------------------------------------------------------------- - */ - if (make_userblock() < 0) - goto out; + if (h5_using_default_driver(NULL)) { + /*------------------------------------------------------------------------- + * create a file with userblock + *------------------------------------------------------------------------- + */ + if (make_userblock() < 0) + goto out; - /*------------------------------------------------------------------------- - * create a userblock file - *------------------------------------------------------------------------- - */ - if (make_userblock_file() < 0) - goto out; + /*------------------------------------------------------------------------- + * create a userblock file + *------------------------------------------------------------------------- + */ + if (make_userblock_file() < 0) + goto out; + } /*------------------------------------------------------------------------- * create a file with named datatypes @@ -1959,30 +1978,32 @@ make_testfiles(void) if (H5Fclose(fid) < 0) return -1; - /*------------------------------------------------------------------------- - * create obj and region reference type datasets (bug1814) - * add attribute with int type (bug1726) - * add attribute with obj and region reference type (bug1726) - *------------------------------------------------------------------------- - */ - if ((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - /* create reference type datasets */ - if (make_references(fid) < 0) - goto out; - if (H5Fclose(fid) < 0) - return -1; + if (!h5_using_parallel_driver(NULL)) { + /*------------------------------------------------------------------------- + * create obj and region reference type datasets (bug1814) + * add attribute with int type (bug1726) + * add attribute with obj and region reference type (bug1726) + *------------------------------------------------------------------------- + */ + if ((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return -1; + /* create reference type datasets */ + if (make_references(fid) < 0) + goto out; + if (H5Fclose(fid) < 0) + return -1; - /*------------------------------------------------------------------------- - * create a file with obj and region references in attribute of compound and - * vlen datatype - *-------------------------------------------------------------------------*/ - if ((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - if (make_complex_attr_references(fid) < 0) - goto out; - if (H5Fclose(fid) < 0) - return -1; + /*------------------------------------------------------------------------- + * create a file with obj and region references in attribute of compound and + * vlen datatype + *-------------------------------------------------------------------------*/ + if ((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return -1; + if (make_complex_attr_references(fid) < 0) + goto out; + if (H5Fclose(fid) < 0) + return -1; + } /*------------------------------------------------------------------------- * create 8 files with combinations ??? @@ -2018,111 +2039,113 @@ make_testfiles(void) if (H5Fclose(fid) < 0) return -1; - /* - * #2 -- h5repack_page_persist.h5 - * Setting: - * strategy=PAGE, persist=TRUE, threshold=1 - * inpage=512 - * latest format - */ - /* Create file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - return -1; - if (H5Pset_file_space_page_size(fcpl, (hsize_t)512) < 0) - return -1; - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0) - return -1; - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0) - return -1; - if (H5Fclose(fid) < 0) - return -1; - if (H5Pclose(fcpl) < 0) - return -1; - - /* - * #3 -- h5repack_fsm_aggr_persist.h5 - * Setting: - * strategy=FSM_AGGR, persist=TRUE, threshold=1 - * default: inpage=4096 - */ - /* Create file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - return -1; - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) - return -1; - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) - return -1; - if (H5Fclose(fid) < 0) - return -1; - if (H5Pclose(fcpl) < 0) - return -1; - - /* - * #4 -- h5repack_page_threshold.h5 - * Setting: - * strategy=PAGE, persist=FALSE, threshold=3 - * inpage=8192 - * latest format - */ - - /* Create file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - return -1; - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)3) < 0) - return -1; - if (H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0) - return -1; - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0) - return -1; - if (H5Fclose(fid) < 0) - return -1; - if (H5Pclose(fcpl) < 0) - return -1; - - /* - * #5 -- h5repack_fsm_aggr_threshold.h5 - * Setting: - * strategy=FSM_AGGR, persist=FALSE, threshold=3 - * inpage=4096 - */ + if (h5_using_default_driver(NULL)) { + /* + * #2 -- h5repack_page_persist.h5 + * Setting: + * strategy=PAGE, persist=TRUE, threshold=1 + * inpage=512 + * latest format + */ + /* Create file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + return -1; + if (H5Pset_file_space_page_size(fcpl, (hsize_t)512) < 0) + return -1; + if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0) + return -1; + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0) + return -1; + if (H5Fclose(fid) < 0) + return -1; + if (H5Pclose(fcpl) < 0) + return -1; + + /* + * #3 -- h5repack_fsm_aggr_persist.h5 + * Setting: + * strategy=FSM_AGGR, persist=TRUE, threshold=1 + * default: inpage=4096 + */ + /* Create file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + return -1; + if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) + return -1; + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) + return -1; + if (H5Fclose(fid) < 0) + return -1; + if (H5Pclose(fcpl) < 0) + return -1; + + /* + * #4 -- h5repack_page_threshold.h5 + * Setting: + * strategy=PAGE, persist=FALSE, threshold=3 + * inpage=8192 + * latest format + */ - /* Create file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - return -1; - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)3) < 0) - return -1; - if (H5Pset_file_space_page_size(fcpl, (hsize_t)FS_PAGESIZE_DEF) < 0) - return -1; - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) - return -1; - if (H5Fclose(fid) < 0) - return -1; - if (H5Pclose(fcpl) < 0) - return -1; + /* Create file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + return -1; + if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)3) < 0) + return -1; + if (H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0) + return -1; + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0) + return -1; + if (H5Fclose(fid) < 0) + return -1; + if (H5Pclose(fcpl) < 0) + return -1; + + /* + * #5 -- h5repack_fsm_aggr_threshold.h5 + * Setting: + * strategy=FSM_AGGR, persist=FALSE, threshold=3 + * inpage=4096 + */ - /* - * #6 -- h5repack_aggr.h5 - * Setting: - * strategy=AGGR, persist=FALSE, threshold=1 - * latest format - */ + /* Create file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + return -1; + if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)3) < 0) + return -1; + if (H5Pset_file_space_page_size(fcpl, (hsize_t)FS_PAGESIZE_DEF) < 0) + return -1; + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) + return -1; + if (H5Fclose(fid) < 0) + return -1; + if (H5Pclose(fcpl) < 0) + return -1; + + /* + * #6 -- h5repack_aggr.h5 + * Setting: + * strategy=AGGR, persist=FALSE, threshold=1 + * latest format + */ - /* Create file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - return -1; - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0) - return -1; - HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0) - return -1; - if (H5Fclose(fid) < 0) - return -1; - if (H5Pclose(fcpl) < 0) - return -1; + /* Create file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + return -1; + if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0) + return -1; + HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); + if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0) + return -1; + if (H5Fclose(fid) < 0) + return -1; + if (H5Pclose(fcpl) < 0) + return -1; + } /* * #7 -- h5repack_none.h5 @@ -2726,6 +2749,7 @@ make_nbit(hid_t loc_id) hid_t sid = H5I_INVALID_HID; /* dataspace ID */ hid_t dtid = H5I_INVALID_HID; hid_t dsid = H5I_INVALID_HID; + hid_t dxpl = H5P_DEFAULT; hsize_t dims[RANK] = {DIM1, DIM2}; hsize_t chunk_dims[RANK] = {CDIM1, CDIM2}; int ** buf = NULL; @@ -2746,6 +2770,16 @@ make_nbit(hid_t loc_id) if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto error; +#ifdef H5_HAVE_PARALLEL + /* Set up collective writes for parallel driver */ + if (h5_using_parallel_driver(NULL)) { + if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0) + goto error; + } +#endif + dtid = H5Tcopy(H5T_NATIVE_INT); if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0) goto error; @@ -2757,7 +2791,7 @@ make_nbit(hid_t loc_id) goto error; if ((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf[0]) < 0) goto error; H5Dclose(dsid); @@ -2765,7 +2799,7 @@ make_nbit(hid_t loc_id) goto error; if ((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf[0]) < 0) goto error; H5Dclose(dsid); @@ -2773,6 +2807,8 @@ make_nbit(hid_t loc_id) * close *------------------------------------------------------------------------- */ + if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0) + goto error; if (H5Sclose(sid) < 0) goto error; if (H5Pclose(dcpl) < 0) @@ -2788,6 +2824,7 @@ error: H5E_BEGIN_TRY { H5Tclose(dtid); + H5Pclose(dxpl); H5Pclose(dcpl); H5Sclose(sid); H5Dclose(dsid); @@ -2813,6 +2850,7 @@ make_scaleoffset(hid_t loc_id) hid_t sid = H5I_INVALID_HID; /* dataspace ID */ hid_t dtid = H5I_INVALID_HID; hid_t dsid = H5I_INVALID_HID; + hid_t dxpl = H5P_DEFAULT; hsize_t dims[RANK] = {DIM1, DIM2}; hsize_t chunk_dims[RANK] = {CDIM1, CDIM2}; int ** buf = NULL; @@ -2833,6 +2871,16 @@ make_scaleoffset(hid_t loc_id) if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto error; +#ifdef H5_HAVE_PARALLEL + /* Set up collective writes for parallel driver */ + if (h5_using_parallel_driver(NULL)) { + if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0) + goto error; + } +#endif + dtid = H5Tcopy(H5T_NATIVE_INT); /* remove the filters from the dcpl */ @@ -2842,20 +2890,22 @@ make_scaleoffset(hid_t loc_id) goto error; if ((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf[0]) < 0) goto error; H5Dclose(dsid); if ((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf[0]) < 0) goto error; H5Tclose(dtid); H5Dclose(dsid); /*------------------------------------------------------------------------- - * close space and dcpl + * close space, dxpl and dcpl *------------------------------------------------------------------------- */ + if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0) + goto error; if (H5Sclose(sid) < 0) goto error; if (H5Pclose(dcpl) < 0) @@ -2868,6 +2918,7 @@ make_scaleoffset(hid_t loc_id) error: H5E_BEGIN_TRY { + H5Pclose(dxpl); H5Dclose(dsid); H5Tclose(dtid); H5Pclose(dcpl); @@ -2894,6 +2945,7 @@ make_all_filters(hid_t loc_id) hid_t sid = H5I_INVALID_HID; /* dataspace ID */ hid_t dtid = H5I_INVALID_HID; hid_t dsid = H5I_INVALID_HID; + hid_t dxpl = H5P_DEFAULT; #if defined(H5_HAVE_FILTER_SZIP) unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block = 8; @@ -2921,6 +2973,16 @@ make_all_filters(hid_t loc_id) if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto error; +#ifdef H5_HAVE_PARALLEL + /* Set up collective writes for parallel driver */ + if (h5_using_parallel_driver(NULL)) { + if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0) + goto error; + } +#endif + /* set the shuffle filter */ if (H5Pset_shuffle(dcpl) < 0) goto error; @@ -3010,7 +3072,7 @@ make_all_filters(hid_t loc_id) goto error; if ((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf[0]) < 0) goto error; /* close */ @@ -3021,6 +3083,8 @@ make_all_filters(hid_t loc_id) if (H5Sclose(sid) < 0) goto error; + if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0) + goto error; if (H5Pclose(dcpl) < 0) goto error; @@ -3033,6 +3097,7 @@ error: { H5Tclose(dtid); H5Dclose(dsid); + H5Pclose(dxpl); H5Pclose(dcpl); H5Sclose(sid); } @@ -5802,11 +5867,25 @@ out: static int make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t dcpl, void *buf) { - hid_t did = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t dxpl_id = H5P_DEFAULT; if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) return -1; - if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + +#ifdef H5_HAVE_PARALLEL + /* Set up collective writes for parallel driver */ + if (h5_using_parallel_driver(NULL)) { + if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto out; + if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0) + goto out; + } +#endif + + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) + goto out; + if (dxpl_id != H5P_DEFAULT && H5Pclose(dxpl_id) < 0) goto out; if (H5Dclose(did) < 0) return -1; @@ -5835,17 +5914,30 @@ out: static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf) { - hid_t did = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t dxpl_id = H5P_DEFAULT; if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) return -1; if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if (buf) { - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) +#ifdef H5_HAVE_PARALLEL + /* Set up collective writes for parallel driver */ + if (h5_using_parallel_driver(NULL)) { + if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto out; + if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0) + goto out; + } +#endif + + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) goto out; } + if (dxpl_id != H5P_DEFAULT && H5Pclose(dxpl_id) < 0) + goto out; if (H5Dclose(did) < 0) goto out; if (H5Sclose(sid) < 0) @@ -5856,6 +5948,7 @@ write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t t out: H5E_BEGIN_TRY { + H5Pclose(dxpl_id); H5Dclose(did); H5Sclose(sid); } diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt index cb10d22..894f88c 100644 --- a/tools/test/h5repack/testfiles/h5repack-help.txt +++ b/tools/test/h5repack/testfiles/h5repack-help.txt @@ -20,6 +20,18 @@ usage: h5repack [OPTIONS] file1 file2 HDF5 file specified --dst-vol-info VOL-specific info to pass to the VOL connector used for opening the output HDF5 file specified + --src-vfd-value Value (ID) of the VFL driver to use for opening the + input HDF5 file specified + --src-vfd-name Name of the VFL driver to use for opening the input + HDF5 file specified + --src-vfd-info VFD-specific info to pass to the VFL driver used for + opening the input HDF5 file specified + --dst-vfd-value Value (ID) of the VFL driver to use for opening the + output HDF5 file specified + --dst-vfd-name Name of the VFL driver to use for opening the output + HDF5 file specified + --dst-vfd-info VFD-specific info to pass to the VFL driver used for + opening the output HDF5 file specified -L, --latest Use latest version of file format This option will take precedence over the options --low and --high diff --git a/tools/test/misc/testfiles/h5mkgrp_help.txt b/tools/test/misc/testfiles/h5mkgrp_help.txt index 9525230..5d81b34 100644 --- a/tools/test/misc/testfiles/h5mkgrp_help.txt +++ b/tools/test/misc/testfiles/h5mkgrp_help.txt @@ -11,4 +11,10 @@ usage: h5mkgrp [OPTIONS] FILE GROUP... HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index ad9bf09..a99334f 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -81,7 +81,7 @@ counter(unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, static void cleanup(void) { - if (!getenv("HDF5_NOCLEANUP")) { + if (!getenv(HDF5_NOCLEANUP)) { remove(FILENAME); } } diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c index 64192ba..c974928 100644 --- a/tools/test/perform/overhead.c +++ b/tools/test/perform/overhead.c @@ -119,7 +119,7 @@ usage(const char *prog) static void cleanup(void) { - if (!getenv("HDF5_NOCLEANUP")) { + if (!getenv(HDF5_NOCLEANUP)) { remove(FILE_NAME_1); } } diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 123fb98..30eb06e 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -103,7 +103,7 @@ error(const char *fmt, ...) static void cleanup(void) { - if (!HDgetenv("HDF5_NOCLEANUP")) + if (!HDgetenv(HDF5_NOCLEANUP)) HDunlink(filename); HDfree(filename); } diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 5b11223..53c666b 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -28,6 +28,12 @@ usage: h5dump [OPTIONS] files HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/help-1.ls b/tools/testfiles/help-1.ls index 0926c4c..6ed1aab 100644 --- a/tools/testfiles/help-1.ls +++ b/tools/testfiles/help-1.ls @@ -52,6 +52,12 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified file/OBJECT Each object consists of an HDF5 file name optionally followed by a diff --git a/tools/testfiles/help-2.ls b/tools/testfiles/help-2.ls index 0926c4c..6ed1aab 100644 --- a/tools/testfiles/help-2.ls +++ b/tools/testfiles/help-2.ls @@ -52,6 +52,12 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified file/OBJECT Each object consists of an HDF5 file name optionally followed by a diff --git a/tools/testfiles/help-3.ls b/tools/testfiles/help-3.ls index 0926c4c..6ed1aab 100644 --- a/tools/testfiles/help-3.ls +++ b/tools/testfiles/help-3.ls @@ -52,6 +52,12 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified file/OBJECT Each object consists of an HDF5 file name optionally followed by a diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 5b11223..53c666b 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -28,6 +28,12 @@ usage: h5dump [OPTIONS] files HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index 5b11223..53c666b 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -28,6 +28,12 @@ usage: h5dump [OPTIONS] files HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index 5b11223..53c666b 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -28,6 +28,12 @@ usage: h5dump [OPTIONS] files HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index 5b11223..53c666b 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -28,6 +28,12 @@ usage: h5dump [OPTIONS] files HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 5b11223..53c666b 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -28,6 +28,12 @@ usage: h5dump [OPTIONS] files HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index 5b11223..53c666b 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -28,6 +28,12 @@ usage: h5dump [OPTIONS] files HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index 5b11223..53c666b 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -28,6 +28,12 @@ usage: h5dump [OPTIONS] files HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/textlinksrc-nodangle-1.ls b/tools/testfiles/textlinksrc-nodangle-1.ls index 0926c4c..6ed1aab 100644 --- a/tools/testfiles/textlinksrc-nodangle-1.ls +++ b/tools/testfiles/textlinksrc-nodangle-1.ls @@ -52,6 +52,12 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified file/OBJECT Each object consists of an HDF5 file name optionally followed by a diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls index 0926c4c..6ed1aab 100644 --- a/tools/testfiles/tgroup-1.ls +++ b/tools/testfiles/tgroup-1.ls @@ -52,6 +52,12 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] HDF5 file specified --vol-info VOL-specific info to pass to the VOL connector used for opening the HDF5 file specified + --vfd-value Value (ID) of the VFL driver to use for opening the + HDF5 file specified + --vfd-name Name of the VFL driver to use for opening the + HDF5 file specified + --vfd-info VFD-specific info to pass to the VFL driver used for + opening the HDF5 file specified file/OBJECT Each object consists of an HDF5 file name optionally followed by a -- cgit v0.12 From 5b5f0c08c9f15bb1740208de67d9242463fa0cb4 Mon Sep 17 00:00:00 2001 From: jhendersonHDF <jhenderson@hdfgroup.org> Date: Wed, 29 Sep 2021 23:00:24 -0500 Subject: Update compact dataset I/O routines to handle driver-level memory copy (#1054) * Update compact dataset I/O routines to handle driver-level memory copy * Combine compact I/O read/write struct into single I/O struct Rename CTL memory copy flag and H5Fquery routine to get file driver structure * Add RELEASE.txt entry for new "ctl" memory copy operation --- release_docs/RELEASE.txt | 42 +++++++++++++++++++ src/H5Dcompact.c | 106 ++++++++++++++++++++++++++++++++++++++++++----- src/H5FDpublic.h | 24 +++++++++++ src/H5Fprivate.h | 5 +-- src/H5Fquery.c | 23 ++++++++++ 5 files changed, 187 insertions(+), 13 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 0c3a398..ec558c6 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -469,6 +469,48 @@ New Features Library: -------- + - Adds new file driver-level memory copy operation for + "ctl" callback and updates compact dataset I/O routines + to utilize it + + When accessing an HDF5 file with a file driver that uses + memory allocated in special ways (e.g., without standard + library's `malloc`), a crash could be observed when HDF5 + tries to perform `memcpy` operations on such a memory + region. + + These changes add a new H5FD_FEAT_MEMMANAGE VFD feature + flag, which, if specified as supported by a VFD, will + inform HDF5 that the VFD either uses special memory + management routines or wishes to perform memory management + in a specific way. Therefore, this flag instructs HDF5 to + ask the file driver to perform memory management for + certain operations. + + These changes also introduce a new "ctl" callback + operation identified by the H5FD_CTL__MEM_COPY op code. + This operation simply asks a VFD to perform a memory copy. + The arguments to this operation are passed to the "ctl" + callback's "input" parameter as a pointer to a struct + defined as: + + struct H5FD_ctl_memcpy_args_t { + void * dstbuf; /**< Destination buffer */ + hsize_t dst_off; /**< Offset within destination buffer */ + const void *srcbuf; /**< Source buffer */ + hsize_t src_off; /**< Offset within source buffer */ + size_t len; /**< Length of data to copy from source buffer */ + } H5FD_ctl_memcpy_args_t; + + Further, HDF5's compact dataset I/O routines were + identified as a problematic area that could cause a crash + for VFDs that make use of special memory management. Those + I/O routines were therefore updated to make use of this new + "ctl" callback operation in order to ask the underlying + file driver to correctly handle memory copies. + + (JTH - 2021/09/28) + - Adds new "ctl" callback to VFD H5FD_class_t structure with the following prototype: diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index fe41298..88926c2 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -47,6 +47,15 @@ /* Local Typedefs */ /******************/ +/* Callback info for I/O operation when file driver + * wishes to do its own memory management + */ +typedef struct H5D_compact_iovv_memmanage_ud_t { + H5F_shared_t *f_sh; /* Shared file for dataset */ + void * dstbuf; /* Pointer to buffer to be read into/written into */ + const void * srcbuf; /* Pointer to buffer to be read from/written from */ +} H5D_compact_iovv_memmanage_ud_t; + /********************/ /* Local Prototypes */ /********************/ @@ -57,6 +66,7 @@ static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage); static herr_t H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); +static herr_t H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata); static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]); @@ -240,6 +250,48 @@ H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR } /* end H5D__compact_io_init() */ /*------------------------------------------------------------------------- + * Function: H5D__compact_iovv_memmanage_cb + * + * Purpose: Callback operator for H5D__compact_readvv()/_writevv() to + * send a memory copy request to the underlying file driver. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) +{ + H5D_compact_iovv_memmanage_ud_t *udata = (H5D_compact_iovv_memmanage_ud_t *)_udata; + H5FD_ctl_memcpy_args_t op_args; + uint64_t op_flags; + H5FD_t * file_handle = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Retrieve pointer to file driver structure for ctl call */ + if (H5F_shared_get_file_driver(udata->f_sh, &file_handle) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "can't get file handle") + + /* Setup operation flags and arguments */ + op_flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG | H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + + op_args.dstbuf = udata->dstbuf; + op_args.dst_off = dst_off; + op_args.srcbuf = udata->srcbuf; + op_args.src_off = src_off; + op_args.len = len; + + /* Make request to file driver */ + if (H5FD_ctl(file_handle, H5FD_CTL__MEM_COPY, op_flags, &op_args, NULL) < 0) + HGOTO_ERROR(H5E_IO, H5E_FCNTL, FAIL, "VFD memcpy request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__compact_iovv_memmanage_cb() */ + +/*------------------------------------------------------------------------- * Function: H5D__compact_readvv * * Purpose: Reads some data vectors from a dataset into a buffer. @@ -268,11 +320,28 @@ H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t * HDassert(io_info); - /* Use the vectorized memory copy routine to do actual work */ - if ((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, - io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, - dset_offset_arr)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + /* Check if file driver wishes to do its own memory management */ + if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_MEMMANAGE)) { + H5D_compact_iovv_memmanage_ud_t udata; + + /* Set up udata for memory copy operation */ + udata.f_sh = io_info->f_sh; + udata.dstbuf = io_info->u.rbuf; + udata.srcbuf = io_info->store->compact.buf; + + /* Request that file driver does the memory copy */ + if ((ret_value = H5VM_opvv(mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, dset_max_nseq, + dset_curr_seq, dset_size_arr, dset_offset_arr, + H5D__compact_iovv_memmanage_cb, &udata)) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + } + else { + /* Use the vectorized memory copy routine to do actual work */ + if ((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, + mem_offset_arr, io_info->store->compact.buf, dset_max_nseq, + dset_curr_seq, dset_size_arr, dset_offset_arr)) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -310,11 +379,28 @@ H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t HDassert(io_info); - /* Use the vectorized memory copy routine to do actual work */ - if ((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, - dset_offset_arr, io_info->u.wbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, - mem_offset_arr)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + /* Check if file driver wishes to do its own memory management */ + if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_MEMMANAGE)) { + H5D_compact_iovv_memmanage_ud_t udata; + + /* Set up udata for memory copy operation */ + udata.f_sh = io_info->f_sh; + udata.dstbuf = io_info->store->compact.buf; + udata.srcbuf = io_info->u.wbuf; + + /* Request that file driver does the memory copy */ + if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr, mem_max_nseq, + mem_curr_seq, mem_size_arr, mem_offset_arr, H5D__compact_iovv_memmanage_cb, + &udata)) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + } + else { + /* Use the vectorized memory copy routine to do actual work */ + if ((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, + dset_size_arr, dset_offset_arr, io_info->u.wbuf, mem_max_nseq, + mem_curr_seq, mem_size_arr, mem_offset_arr)) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + } /* Mark the compact dataset's buffer as dirty */ *io_info->store->compact.dirty = TRUE; diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index a72dc80..d774210 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -170,6 +170,14 @@ * enabled may be used as the Write-Only (W/O) channel driver. */ #define H5FD_FEAT_DEFAULT_VFD_COMPATIBLE 0x00008000 +/* + * Defining H5FD_FEAT_MEMMANAGE for a VFL driver means that + * the driver uses special memory management routines or wishes + * to do memory management in a specific manner. Therefore, HDF5 + * should request that the driver handle any memory management + * operations when appropriate. + */ +#define H5FD_FEAT_MEMMANAGE 0x00010000 /* ctl function definitions: */ #define H5FD_CTL_OPC_RESERVED 512 /* Opcodes below this value are reserved for library use */ @@ -185,6 +193,9 @@ #define H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE 2 #define H5FD_CTL__GET_MPI_RANK_OPCODE 3 #define H5FD_CTL__GET_MPI_SIZE_OPCODE 4 +#define H5FD_CTL__MEM_ALLOC 5 +#define H5FD_CTL__MEM_FREE 6 +#define H5FD_CTL__MEM_COPY 7 /* ctl function flags: */ @@ -367,6 +378,19 @@ typedef struct { } H5FD_file_image_callbacks_t; //! <!-- [H5FD_file_image_callbacks_t_snip] --> +/** + * Define structure to hold "ctl memory copy" parameters + */ +//! <!-- [H5FD_ctl_memcpy_args_t_snip] --> +typedef struct H5FD_ctl_memcpy_args_t { + void * dstbuf; /**< Destination buffer */ + hsize_t dst_off; /**< Offset within destination buffer */ + const void *srcbuf; /**< Source buffer */ + hsize_t src_off; /**< Offset within source buffer */ + size_t len; /**< Length of data to copy from source buffer */ +} H5FD_ctl_memcpy_args_t; +//! <!-- [H5FD_ctl_memcpy_args_t_snip] --> + /********************/ /* Public Variables */ /********************/ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 051abd9..a5ccbab 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -24,11 +24,9 @@ typedef struct H5F_t H5F_t; /* Include package's public header */ #include "H5Fpublic.h" -/* Public headers needed by this file */ -#include "H5FDpublic.h" /* File drivers */ - /* Private headers needed by this file */ #include "H5MMprivate.h" /* Memory management */ +#include "H5FDprivate.h" /* File drivers */ #ifdef H5_HAVE_PARALLEL #include "H5Pprivate.h" /* Property lists */ #endif /* H5_HAVE_PARALLEL */ @@ -906,6 +904,7 @@ H5_DLL hbool_t H5F_shared_has_feature(const H5F_shared_t *f, unsigned feature); H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature); 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_shared_get_file_driver(const H5F_shared_t *f_sh, H5FD_t **file_handle); H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle); /* File mounting routines */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 04792b4..a625897 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -950,6 +950,29 @@ done: } /* end H5F_get_eoa() */ /*------------------------------------------------------------------------- + * Function: H5F_shared_get_file_driver + * + * Purpose: Returns a pointer to the file driver structure of the + * file's 'shared' structure. + * + * Return: file handle on success/abort on failure (shouldn't fail) + *------------------------------------------------------------------------- + */ +herr_t +H5F_shared_get_file_driver(const H5F_shared_t *f_sh, H5FD_t **file_handle) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f_sh); + HDassert(file_handle); + + *file_handle = f_sh->lf; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5F_shared_get_file_driver() */ + +/*------------------------------------------------------------------------- * Function: H5F_get_vfd_handle * * Purpose: Returns a pointer to the file handle of the low-level file -- cgit v0.12 From bbbc31e28e47e8f92ee14a3a75430584f3902974 Mon Sep 17 00:00:00 2001 From: jhendersonHDF <jhenderson@hdfgroup.org> Date: Thu, 30 Sep 2021 10:37:23 -0500 Subject: Fix Mirror, HDFS and ROS3 case statements for VFD value in H5trace (#1062) --- src/H5trace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/H5trace.c b/src/H5trace.c index a735df3..0797f65 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1084,18 +1084,18 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) break; #endif #ifdef H5_HAVE_MIRROR_VFD - case H5_HAVE_MIRROR_VFD: - H5RS_acat(rs, "H5_HAVE_MIRROR_VFD"); + case H5_VFD_MIRROR: + H5RS_acat(rs, "H5_VFD_MIRROR"); break; #endif #ifdef H5_HAVE_LIBHDFS - case H5_HAVE_LIBHDFS: - H5RS_acat(rs, "H5_HAVE_LIBHDFS"); + case H5_VFD_HDFS: + H5RS_acat(rs, "H5_VFD_HDFS"); break; #endif #ifdef H5_HAVE_ROS3_VFD - case H5_HAVE_ROS3_VFD: - H5RS_acat(rs, "H5_HAVE_ROS3_VFD"); + case H5_VFD_ROS3: + H5RS_acat(rs, "H5_VFD_ROS3"); break; #endif default: -- cgit v0.12 From 6c794a8d982bb55ba518753474be73169187b017 Mon Sep 17 00:00:00 2001 From: jhendersonHDF <jhenderson@hdfgroup.org> Date: Thu, 30 Sep 2021 10:37:40 -0500 Subject: Move HDstrcmp operations inside casting block for PGI compilers (#1063) --- test/vol.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/vol.c b/test/vol.c index 76be111..aba9311 100644 --- a/test/vol.c +++ b/test/vol.c @@ -817,8 +817,8 @@ test_basic_file_operation(const char *env_h5_drvr) /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && - HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && - HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0 && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -881,8 +881,8 @@ test_basic_file_operation(const char *env_h5_drvr) /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && - HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && - HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0 && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -898,8 +898,8 @@ test_basic_file_operation(const char *env_h5_drvr) /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && - HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && - HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0 && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) TEST_ERROR; -- cgit v0.12 From 80c041d6da141c7cdb158f7bcdf8ecba744eb61d Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Thu, 30 Sep 2021 10:45:08 -0500 Subject: OESS-168: Remove clang warnings. (#1056) --- tools/test/h5dump/h5dumpgentest.c | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index e74054c..7efe53c 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -498,7 +498,7 @@ gent_dataset(void) for (i = 0; i < 30; i++) for (j = 0; j < 20; j++) - dset2[i][j] = 0.0001F * (float)j + (float)i; + dset2[i][j] = 0.0001 * (double)j + (double)i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_data); @@ -605,7 +605,7 @@ gent_attribute(void) attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 10; i++) - d[i] = 0.1F * (float)i; + d[i] = 0.1 * (double)i; H5Awrite(attr, H5T_NATIVE_DOUBLE, d); H5Sclose(space); @@ -1019,7 +1019,7 @@ gent_compound_dt(void) for (i = 0; i < (int)sdim; i++) { dset1[i].a = i; dset1[i].b = (float)(i * i); - dset1[i].c = (float)(1.0F / (float)(i + 1)); + dset1[i].c = (double)(1.0 / (double)(i + 1)); dset2[i].a = i; dset2[i].b = (float)((float)i + (float)i * 0.1F); @@ -1206,7 +1206,7 @@ gent_compound_dt2(void) for (i = 0; i < (int)sdim; i++) { dset1[i].a = i; dset1[i].b = (float)(i * i); - dset1[i].c = (float)(1.0F / (float)(i + 1)); + dset1[i].c = (double)(1.0 / (double)(i + 1)); dset2[i].a = i; dset2[i].b = (float)((float)i + (float)i * 0.1F); @@ -1646,7 +1646,7 @@ gent_many(void) space2 = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 10; i++) - d[i] = 0.1F * (float)i; + d[i] = 0.1 * (double)i; H5Awrite(attr, H5T_NATIVE_DOUBLE, d); H5Sclose(space2); H5Aclose(attr); @@ -2503,7 +2503,7 @@ gent_nestcomp(void) for (i = 0; i < 10; i++) { s1[i].a = i; s1[i].b = (float)(i * i); - s1[i].c = 1.0F / (float)(i + 1); + s1[i].c = 1.0 / (double)(i + 1); s1[i].d.a = (char)(65 + i); s1[i].d.b[0] = -100.0F; s1[i].d.b[1] = 100.0F; @@ -5077,7 +5077,7 @@ gent_compound_complex(void) Array1[m].e = (float)((float)m * 0.96F); for (n = 0; n < F41_ARRAY_DIMf; n++) - Array1[m].f[n] = ((float)m * 1024.9637F); + Array1[m].f[n] = ((double)m * 1024.9637); Array1[m].g = 'm'; } @@ -6361,7 +6361,7 @@ gent_ldouble_scalar(void) hid_t tid; hid_t sid; hsize_t dims[1] = {6}; - long double buf[6] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + long double buf[6] = {0.0L, 1.0L, 2.0L, 3.0L, 4.0L, 5.0L}; if ((fid = H5Fcreate(FILE88, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; @@ -7022,7 +7022,7 @@ gent_fpformat(void) { hid_t fid, sid, did; hsize_t dims[1] = {6}; - double dbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0}; + double dbuf[6] = {-0.1234567, 0.1234567, 0, 0, 0, 0}; float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0}; fid = H5Fcreate(FILE60, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -7450,7 +7450,7 @@ gent_packedbits(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * (float)j + (float)i; + dsetdbl[i][j] = 0.0001 * (double)j + (double)i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]); @@ -7684,7 +7684,7 @@ gent_attr_intsize(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * (float)j + (float)i; + dsetdbl[i][j] = 0.0001 * (double)j + (double)i; H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl[0]); @@ -7994,7 +7994,7 @@ gent_compound_intsizes(void) for (n = 0; n < (int)dims[0]; n++) for (o = 0; o < (int)dims[1]; o++) - Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n; + Array1[m].dsetdbl[n][o] = 0.0001 * (double)o + (double)n; } /* Create the array data type for the 8 bits signed int array */ @@ -8284,7 +8284,7 @@ gent_compound_attr_intsizes(void) for (n = 0; n < (int)dims[0]; n++) for (o = 0; o < (int)dims[1]; o++) - Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n; + Array1[m].dsetdbl[n][o] = 0.0001 * (double)o + (double)n; } /* Create the array data type for the 8 bits signed int array */ @@ -8789,7 +8789,7 @@ gent_intscalars(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * (float)j + (float)i; + dsetdbl[i][j] = 0.0001 * (double)j + (double)i; H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]); @@ -9033,7 +9033,7 @@ gent_attr_intscalars(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * (float)j + (float)i; + dsetdbl[i][j] = 0.0001 * (double)j + (double)i; H5Awrite(attr, tid, dsetdbl[0]); @@ -9236,7 +9236,7 @@ gent_compound_int_array(void) dims[0] = F76_DIM8; for (n = 0; n < (int)dims[0]; n++) - Cmpd1[m].dsetdbl[n] = 0.0001F + (float)n; + Cmpd1[m].dsetdbl[n] = 0.0001 + (double)n; } /* Create the array data type for the 8 bits signed int array */ @@ -9477,8 +9477,8 @@ gent_compound_ints(void) val64bits <<= 1; /* Double Dummy set for failure tests */ - Cmpd1[m].dsetdbl = 0.0001F + (float)m; - Cmpd2[m].dsetdbl = 0.0001F + (float)m; + Cmpd1[m].dsetdbl = 0.0001 + (double)m; + Cmpd2[m].dsetdbl = 0.0001 + (double)m; } /* Create the dataspace */ @@ -9853,7 +9853,7 @@ gent_intattrscalars(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * (float)j + (float)i; + dsetdbl[i][j] = 0.0001 * (double)j + (double)i; H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); /* Attribute of double */ @@ -10182,7 +10182,7 @@ gent_intsattrs(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) { - dsetdbl[i][j] = 0.0001F * (float)j + (float)i; + dsetdbl[i][j] = 0.0001 * (double)j + (double)i; asetdbl[i * dims[1] + j] = dsetdbl[i][j]; } -- cgit v0.12 From 1f7ddf47f51b2c6c0321718f5844c6400151ad1e Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Thu, 30 Sep 2021 10:45:33 -0500 Subject: OESS-168: Remove clang warnings. (#1057) * OESS-168: Remove clang warnings. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- tools/test/h5diff/h5diffgentest.c | 112 +++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 118a3a7..8b23e27 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -358,10 +358,10 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) */ { - double data1[3][2] = {{1.0F, 1.0F}, {1.00F, 1.000F}, {0.0F, 0.0F}}; - double data2[3][2] = {{0.0F, 1.1F}, {1.01F, 1.001F}, {0.0F, 1.0F}}; - double data3[3][2] = {{100.0F, 100.0F}, {100.00F, 100.000F}, {100.0F, 100.0F}}; - double data4[3][2] = {{105.0F, 120.0F}, {160.00F, 95.000F}, {80.0F, 40.0F}}; + double data1[3][2] = {{1.0, 1.0}, {1.00, 1.000}, {0.0, 0.0}}; + double data2[3][2] = {{0.0, 1.1}, {1.01, 1.001}, {0.0, 1.0}}; + double data3[3][2] = {{100.0, 100.0}, {100.00, 100.000}, {100.0, 100.0}}; + double data4[3][2] = {{105.0, 120.0}, {160.00, 95.000}, {80.0, 40.0}}; write_dset(gid1, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data1); write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_DOUBLE, data2); @@ -409,8 +409,8 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - double data9[3][2] = {{100.0F, 100.0F}, {100.0F, 0.0F}, {0.0F, 100.0F}}; - double data10[3][2] = {{120.0F, 80.0F}, {0.0F, 100.0F}, {0.0F, 50.0F}}; + double data9[3][2] = {{100.0, 100.0}, {100.0, 0.0}, {0.0, 100.0}}; + double data10[3][2] = {{120.0, 80.0}, {0.0, 100.0}, {0.0, 50.0}}; write_dset(gid1, 2, dims2, "dset9", H5T_NATIVE_DOUBLE, data9); write_dset(gid1, 2, dims2, "dset10", H5T_NATIVE_DOUBLE, data10); @@ -466,18 +466,18 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) float data16[6]; data15[0] = (float)HDsqrt(-1.0); - data15[1] = 1.0F; + data15[1] = 1.0; data15[2] = (float)HDsqrt(-1.0); - data15[3] = 1.0F; - data15[4] = 1.0F; - data15[5] = 1.0F; + data15[3] = 1.0; + data15[4] = 1.0; + data15[5] = 1.0; data16[0] = (float)HDsqrt(-1.0); data16[1] = (float)HDsqrt(-1.0); - data16[2] = 1.0F; - data16[3] = 1.0F; - data16[4] = 1.0F; - data16[5] = 1.0F; + data16[2] = 1.0; + data16[3] = 1.0; + data16[4] = 1.0; + data16[5] = 1.0; write_dset(gid1, 1, dims1, "fp15", H5T_NATIVE_FLOAT, data15); write_dset(gid1, 1, dims1, "fp16", H5T_NATIVE_FLOAT, data16); @@ -554,8 +554,8 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) buf1[1].d = HDsqrt(-1.0); buf1[1].f = (float)HDsqrt(-1.0); - buf2[1].d = 0.0F; - buf2[1].f = 0.0F; + buf2[1].d = 0.0; + buf2[1].f = 0.0; type_size = sizeof(cmp1_t); tid = H5Tcreate(H5T_COMPOUND, type_size); @@ -583,13 +583,13 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) int i; } cmp3_t; - double data2[6] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; + double data2[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; int data3[6] = {0, 0, 0, 0, 0, 0}; int data4[3][2] = {{0, 0}, {0, 0}, {0, 0}}; int data5[2][2] = {{0, 0}, {0, 0}}; unsigned int data6[3][2] = {{0, 0}, {0, 0}, {0, 0}}; - cmp1_t data7[1] = {{1.0f, 2}}; - cmp2_t data8[1] = {{1, 2.0f}}; + cmp1_t data7[1] = {{1.0, 2}}; + cmp2_t data8[1] = {{1, 2.0}}; hsize_t dims3[2] = {2, 2}; hsize_t dims4[1] = {1}; size_t type_size; @@ -789,10 +789,10 @@ test_datatypes(const char *fname) int buf3b[3][2] = {{1, 1}, {3, 4}, {5, 6}}; long buf4a[3][2] = {{1, 1}, {1, 1}, {1, 1}}; long buf4b[3][2] = {{1, 1}, {3, 4}, {5, 6}}; - float buf5a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}}; - float buf5b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; - double buf6a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}}; - double buf6b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; + float buf5a[3][2] = {{1.0, 1.0}, {1.0, 1.0}, {1.0, 1.0}}; + float buf5b[3][2] = {{1.0, 1.0}, {3.0, 4.0}, {5.0, 6.0}}; + double buf6a[3][2] = {{1.0, 1.0}, {1.0, 1.0}, {1.0, 1.0}}; + double buf6b[3][2] = {{1.0, 1.0}, {3.0, 4.0}, {5.0, 6.0}}; /*unsigned/signed test signed char -128 to 127 @@ -5212,27 +5212,27 @@ write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */ char * buf1a[2]; /* VL string */ char buf2[2] = {1, 2}; /* bitfield, opaque */ - s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */ + s_t buf3[2] = {{1, 2.0}, {3, 4.0}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ e_t buf45[2] = {RED, RED}; /* enum */ hvl_t buf5[2]; /* vlen */ hsize_t dimarray[1] = {3}; /* array dimension */ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */ int buf7[2] = {1, 2}; /* integer */ - float buf8[2] = {1.0F, 2.0F}; /* float */ + float buf8[2] = {1.0, 2.0}; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2] = {3, 2}; - char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ - char * buf12a[3][2]; /* VL string */ - char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ - s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */ + hsize_t dims2[2] = {3, 2}; + char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ + char * buf12a[3][2]; /* VL string */ + char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ + s_t buf32[6] = {{1, 2.0}, {3, 4.0}, {5, 6.0}, {7, 8.0}, {9, 10.0}, {11, 12.0}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ e_t buf452[3][2]; /* enum */ hvl_t buf52[3][2]; /* vlen */ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */ - int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ - float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */ + int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ + float buf82[3][2] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}}; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3] = {4, 3, 2}; @@ -5933,7 +5933,7 @@ write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, for (k = 0; k < 2; k++) if (make_diffs) { buf33[i][j][k].a = 0; - buf33[i][j][k].b = 0.0F; + buf33[i][j][k].b = 0.0; } else { buf33[i][j][k].a = (char)n++; @@ -6143,7 +6143,7 @@ write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, for (k = 0; k < 2; k++) { if (make_diffs) { buf73[i][j][k] = 0; - buf83[i][j][k] = 0.0F; + buf83[i][j][k] = 0.0; } else { buf73[i][j][k] = n++; @@ -6201,27 +6201,27 @@ write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */ char * buf1a[2]; /* VL string */ char buf2[2] = {1, 2}; /* bitfield, opaque */ - s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */ + s_t buf3[2] = {{1, 2.0}, {3, 4.0}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ e_t buf45[2] = {RED, RED}; /* enum */ hvl_t buf5[2]; /* vlen */ hsize_t dimarray[1] = {3}; /* array dimension */ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */ int buf7[2] = {1, 2}; /* integer */ - float buf8[2] = {1.0F, 2.0F}; /* float */ + float buf8[2] = {1.0, 2.0}; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2] = {3, 2}; - char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ - char * buf12a[3][2]; /* VL string */ - char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ - s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */ + hsize_t dims2[2] = {3, 2}; + char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ + char * buf12a[3][2]; /* VL string */ + char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ + s_t buf32[6] = {{1, 2.0}, {3, 4.0}, {5, 6.0}, {7, 8.0}, {9, 10.0}, {11, 12.0}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ e_t buf452[3][2]; /* enum */ hvl_t buf52[3][2]; /* vlen */ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */ - int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ - float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */ + int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ + float buf82[3][2] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}}; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3] = {4, 3, 2}; @@ -6922,7 +6922,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a = 0; - buf33[i][j][k].b = 0.0F; + buf33[i][j][k].b = 0.0; } else { buf33[i][j][k].a = (char)n++; @@ -7132,7 +7132,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, for (k = 0; k < 2; k++) { if (make_diffs) { buf73[i][j][k] = 0; - buf83[i][j][k] = 0.0F; + buf83[i][j][k] = 0.0; } else { buf73[i][j][k] = n++; @@ -7193,26 +7193,26 @@ write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */ char * buf1a[2]; /* VL string */ char buf2[2] = {1, 2}; /* bitfield, opaque */ - s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */ + s_t buf3[2] = {{1, 2.0}, {3, 4.0}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ e_t buf45[2] = {RED, GREEN}; /* enum */ hvl_t buf5[2]; /* vlen */ hsize_t dimarray[1] = {3}; /* array dimension */ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */ int buf7[2] = {1, 2}; /* integer */ - float buf8[2] = {1.0F, 2.0F}; /* float */ + float buf8[2] = {1.0, 2.0}; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2] = {3, 2}; - char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ - char * buf12a[3][2]; /* VL string */ - char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ - s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */ + hsize_t dims2[2] = {3, 2}; + char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ + char * buf12a[3][2]; /* VL string */ + char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ + s_t buf32[6] = {{1, 2.0}, {3, 4.0}, {5, 6.0}, {7, 8.0}, {9, 10.0}, {11, 12.0}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ hvl_t buf52[3][2]; /* vlen */ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */ - int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ - float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */ + int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ + float buf82[3][2] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}}; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3] = {4, 3, 2}; @@ -7680,7 +7680,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a = 0; - buf33[i][j][k].b = 0.0F; + buf33[i][j][k].b = 0.0; } else { buf33[i][j][k].a = (char)n++; @@ -7778,7 +7778,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, for (k = 0; k < 2; k++) { if (make_diffs) { buf73[i][j][k] = 0; - buf83[i][j][k] = 0.0F; + buf83[i][j][k] = 0.0; } else { buf73[i][j][k] = n++; -- cgit v0.12 From 22cdccb799a3ea1f65fdf0c938e5a7c6ebf534f1 Mon Sep 17 00:00:00 2001 From: Neil Fortner <nfortne2@hdfgroup.org> Date: Fri, 1 Oct 2021 14:28:50 -0500 Subject: Fix bug with cross platform compatibility of references within vlens. (#1064) No testing yet. --- release_docs/RELEASE.txt | 9 +++++++++ src/H5Tconv.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ec558c6..bf14fbc 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1008,6 +1008,15 @@ Bug Fixes since HDF5-1.12.0 release =================================== Library ------- + - Fixed cross platform incompatibility of references within variable length + types + + Reference types within variable length types previously could not be + read on a platform with different endianness from where they were + written. Fixed so cross platform portability is restored. + + (NAF - 2021/09/30) + - Detection of simple data transform function "x" In the case of the simple data transform function "x" the (parallel) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 18cbcf1..273bb23 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3205,14 +3205,14 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy src type for conversion") /* References need to know about the src file */ if (tsrc_cpy->shared->type == H5T_REFERENCE) - if (H5T_set_loc(tsrc_cpy, src->shared->u.vlen.file, H5T_LOC_MEMORY) < 0) + if (H5T_set_loc(tsrc_cpy, src->shared->u.vlen.file, src->shared->u.vlen.loc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); if (NULL == (tdst_cpy = H5T_copy(dst->shared->parent, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy dst type for conversion") /* References need to know about the dst file */ if (tdst_cpy->shared->type == H5T_REFERENCE) - if (H5T_set_loc(tdst_cpy, dst->shared->u.vlen.file, H5T_LOC_MEMORY) < 0) + if (H5T_set_loc(tdst_cpy, dst->shared->u.vlen.file, dst->shared->u.vlen.loc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); if (((tsrc_id = H5I_register(H5I_DATATYPE, tsrc_cpy, FALSE)) < 0) || -- cgit v0.12 From b3cb56e2550958da00826a25580621cdbd28d91a Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:51:38 -0500 Subject: ASAN fix for test_ld - free sub-allocation of fields (#1052) --- hl/src/H5LD.c | 70 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/hl/src/H5LD.c b/hl/src/H5LD.c index 8bfd0d6..2368127 100644 --- a/hl/src/H5LD.c +++ b/hl/src/H5LD.c @@ -29,9 +29,9 @@ static herr_t H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsi * Function: H5LD_clean_vector * * Purpose: Process the vector of info: - * 1) free the array of pointers to member names in listv[n] - * 2) close the type id of the last member in listv[n] - * 3) free the H5LD_memb_t structure itself as pointed to by listv[n] + * 1) free the array of pointers to member names in listv[n] + * 2) close the type id of the last member in listv[n] + * 3) free the H5LD_memb_t structure itself as pointed to by listv[n] * * Return: void * @@ -69,12 +69,12 @@ H5LD_clean_vector(H5LD_memb_t *listv[]) * Function: H5LD_construct_info() * * Purpose: Get the remaining info for a field: - * 1) Get the type id of the last member in the field - * 2) Get the total offset of all the members in the field - * 3) Get the type size of the last member in the field + * 1) Get the type id of the last member in the field + * 2) Get the total offset of all the members in the field + * 3) Get the type size of the last member in the field * * Return: Success: 0 - * Failure: negative + * Failure: negative * * Programmer: Vailin Choi; Aug 2010 * @@ -129,24 +129,24 @@ done: * Function: H5LD_construct_vector * * Purpose: Process the comma-separated list of fields in "fields" as follows: - * Example: - * "fields": "a.b.c,d" - * listv[0]->tot_offset = total offset of "a" & "b" & "c" - * listv[0]->last_tid = type id of "c" - * listv[0]->last_tsize = type size of "c" - * listv[0]->names[0] = "a" - * listv[0]->names[1] = "b" - * listv[0]->names[2] = "c" - * listv[0]->names[3] = NULL - * - * listv[1]->tot_offset = offset of "d" - * listv[1]->last_tid = type id of "d" - * listv[1]->last_tsize = type size of "d" - * listv[1]->names[0] = "d" - * listv[1]->names[1] = NULL + * Example: + * "fields": "a.b.c,d" + * listv[0]->tot_offset = total offset of "a" & "b" & "c" + * listv[0]->last_tid = type id of "c" + * listv[0]->last_tsize = type size of "c" + * listv[0]->names[0] = "a" + * listv[0]->names[1] = "b" + * listv[0]->names[2] = "c" + * listv[0]->names[3] = NULL + * + * listv[1]->tot_offset = offset of "d" + * listv[1]->last_tid = type id of "d" + * listv[1]->last_tsize = type size of "d" + * listv[1]->names[0] = "d" + * listv[1]->names[1] = NULL * * Return: Success: # of comma-separated fields in "fields" - * Failure: negative value + * Failure: negative value * * Programmer: Vailin Choi; Aug 2010 * @@ -251,8 +251,10 @@ H5LD_construct_vector(char *fields, H5LD_memb_t *listv[] /*OUT*/, hid_t par_tid) goto done; } /* end if */ else { - if (memb) + if (memb) { + HDfree(memb->names); HDfree(memb); + } goto done; } /* end else */ } /* while !end_of_fields */ @@ -272,10 +274,10 @@ done: * Function: H5LD_get_dset_dims * * Purpose: To return the current size for each dimension of the - * dataset's dataspace + * dataset's dataspace * * Return: Success: 0 - * Failure: negative value + * Failure: negative value * * Programmer: Vailin Choi; March 2010 * @@ -316,12 +318,12 @@ done: * Function: H5LD_get_dset_type_size * * Purpose: To return the size of the dataset's datatype in bytes - * null "fields": return the size of the dataset's datatype - * non-null "fields": return the size of the dataset's datatype - * with respect to the selection in "fields" + * null "fields": return the size of the dataset's datatype + * non-null "fields": return the size of the dataset's datatype + * with respect to the selection in "fields" * * Return: Success: size of the dataset's datatype - * Failure: 0 (valid datatypes are never zero size) + * Failure: 0 (valid datatypes are never zero size) * * Programmer: Vailin Choi; March 2010 * @@ -402,7 +404,7 @@ done: * Purpose: To retrieve selected data from the dataset * * Return: Success: 0 - * Failure: negative + * Failure: negative * * Programmer: Vailin Choi; August 2010 * @@ -578,7 +580,7 @@ done: * Purpose: To retrieve the current dimension sizes for a dataset * * Return: Success: 0 - * Failure: negative value + * Failure: negative value * * Programmer: Vailin Choi; March 2010 * @@ -596,7 +598,7 @@ H5LDget_dset_dims(hid_t did, hsize_t *cur_dims) * Purpose: To return the size in bytes of the datatype for the dataset * * Return: Success: size in bytes of the dataset's datatype - * Failure: 0 (valid datatypes are never zero size) + * Failure: 0 (valid datatypes are never zero size) * * Programmer: Vailin Choi; March 2010 * @@ -614,7 +616,7 @@ H5LDget_dset_type_size(hid_t did, const char *fields) * Purpose: To retrieve selected data from the dataset * * Return: Success: 0 - * Failure: negative value + * Failure: negative value * * Programmer: Vailin Choi; March 2010 * -- cgit v0.12 From eca8d5b767b40df359e7654fc92f00c516947f7f Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Sun, 3 Oct 2021 08:06:08 -0500 Subject: Fix ASAN issue in h5dump error path (#1051) * Fix ASAN issue in h5dump error path * Rework error allocation free. --- tools/lib/h5tools_utils.c | 1 + tools/src/h5dump/h5dump.c | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index f2407bf..ea9812b 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -450,6 +450,7 @@ free_table(table_t *table) HDfree(table->objs[u].objname); HDfree(table->objs); + HDfree(table); } #ifdef H5DUMP_DEBUG diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index e6d1de3..23498bd 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -465,11 +465,8 @@ table_list_free(void) /* Free each table */ free_table(table_list.tables[u].group_table); - HDfree(table_list.tables[u].group_table); free_table(table_list.tables[u].dset_table); - HDfree(table_list.tables[u].dset_table); free_table(table_list.tables[u].type_table); - HDfree(table_list.tables[u].type_table); } /* Free the table list */ -- cgit v0.12 From a08059894bc85655e4ed895fd5c5f4c1ba64a2f6 Mon Sep 17 00:00:00 2001 From: Larry Knox <lrknox@hdfgroup.org> Date: Mon, 4 Oct 2021 06:16:13 -0500 Subject: Add tools/src/h5perf/Makefile.in (#1066) --- MANIFEST | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST b/MANIFEST index 32c3457..c23e498 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3827,6 +3827,7 @@ ./tools/src/h5import/Makefile.in ./tools/src/h5jam/Makefile.in ./tools/src/h5ls/Makefile.in +./tools/src/h5perf/Makefile.in ./tools/src/h5repack/Makefile.in ./tools/src/h5stat/Makefile.in ./tools/src/misc/Makefile.in -- cgit v0.12 From 174f4275bab93e734fafd94d9b69929f3aeb963c Mon Sep 17 00:00:00 2001 From: David Young <dyoung@hdfgroup.org> Date: Wed, 6 Oct 2021 16:24:22 -0500 Subject: To reduce maintenance effort, delete the `noerror-` variants of the compiler flags files (#1033) * Avoid maintenance headaches: delete the `noerror-` variants of the compiler flags files, since they essentially duplicate the `error-` files modulo the replacement of `-Werror=` with `-W` and any changes in comments. (I verified the duplication with a script.) For autoconf, reinstate the use of the `demote_errors` shell function to derive the `noerror-` content from the `error-` content. `demote_errors` replaces `-Werror=` with `-W` when `WARNINGS_AS_ERRORS` is `no`. Slightly reorder `configure.ac` so that the setting of `WARNINGS_AS_ERRORS` takes effect before the `error-` files are sourced. * Take a stab at updating the CMake files to match the changes I made to the autoconf files to remove `noerror-` files. I'm not much of a CMake user so these changes are quite rough. Looks like the duplication can be reduced with the introduction of a new macro. * Delete `noerror-` files from the MANIFEST. * Reduce duplication in the CMake files: perform the HDF5_ENABLE_WARNINGS_AS_ERRORS test once in the ADD_H5_FLAGS macro. * Add a release note. --- MANIFEST | 6 --- config/clang-cxxflags | 9 ++-- config/clang-flags | 9 ++-- config/clang-warnings/noerror-general | 82 ----------------------------- config/cmake/HDFCXXCompilerFlags.cmake | 18 ++----- config/cmake/HDFCompilerFlags.cmake | 22 ++------ config/cmake_ext_mod/HDFMacros.cmake | 3 ++ config/gnu-cxxflags | 11 ++-- config/gnu-flags | 11 ++-- config/gnu-warnings/cxx-noerror-5 | 11 ---- config/gnu-warnings/cxx-noerror-general | 32 ------------ config/gnu-warnings/noerror-5 | 12 ----- config/gnu-warnings/noerror-8 | 25 --------- config/gnu-warnings/noerror-general | 92 --------------------------------- configure.ac | 81 +++++++++++++++-------------- release_docs/RELEASE.txt | 7 +++ 16 files changed, 75 insertions(+), 356 deletions(-) delete mode 100644 config/clang-warnings/noerror-general delete mode 100644 config/gnu-warnings/cxx-noerror-5 delete mode 100644 config/gnu-warnings/cxx-noerror-general delete mode 100644 config/gnu-warnings/noerror-5 delete mode 100644 config/gnu-warnings/noerror-8 delete mode 100644 config/gnu-warnings/noerror-general diff --git a/MANIFEST b/MANIFEST index c23e498..bd9817f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -159,7 +159,6 @@ ./config/clang-warnings/error-general ./config/clang-warnings/general ./config/clang-warnings/no-developer-general -./config/clang-warnings/noerror-general ./config/gnu-warnings/4.8-4.last ./config/gnu-warnings/4.8 ./config/gnu-warnings/4.9 @@ -176,8 +175,6 @@ ./config/gnu-warnings/cxx-9 ./config/gnu-warnings/cxx-error-5 ./config/gnu-warnings/cxx-error-general -./config/gnu-warnings/cxx-noerror-5 -./config/gnu-warnings/cxx-noerror-general ./config/gnu-warnings/developer-4.8 ./config/gnu-warnings/developer-7 ./config/gnu-warnings/developer-8 @@ -195,9 +192,6 @@ ./config/gnu-warnings/no-developer-4.8 ./config/gnu-warnings/no-developer-8 ./config/gnu-warnings/no-developer-general -./config/gnu-warnings/noerror-5 -./config/gnu-warnings/noerror-8 -./config/gnu-warnings/noerror-general ./config/intel-warnings/15 ./config/intel-warnings/18 ./config/intel-warnings/developer-general diff --git a/config/clang-cxxflags b/config/clang-cxxflags index c585ce7..76f095f 100644 --- a/config/clang-cxxflags +++ b/config/clang-cxxflags @@ -20,15 +20,15 @@ # # For now, do not promote any warnings to errors. # -PROMOTE_ERRORS_DFLT=no +WARNINGS_AS_ERRORS_DFLT=no # # This filter rewrites -Werror= as -W, in that way demoting warnings -# promoted to errors back to warnings, if PROMOTE_ERRORS is no. +# promoted to errors back to warnings, if WARNINGS_AS_ERRORS is no. # demote_errors() { - if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then + if [ ${WARNINGS_AS_ERRORS:-${WARNINGS_AS_ERRORS_DFLT}} = no ]; then sed 's,-Werror=,-W,g' else cat @@ -44,7 +44,7 @@ demote_errors() load_clang_arguments() { set -- $(for arg; do - sed 's,#.*$,,' $srcdir/config/clang-warnings/${arg} + sed 's,#.*$,,' $srcdir/config/clang-warnings/${arg} | demote_errors done) IFS=' ' echo "$*" } @@ -161,7 +161,6 @@ if test "X-clang" = "X-$cxx_vendor" -o "X-Apple LLVM" = "X-$cxx_vendor"; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_clang_arguments general)" H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_clang_arguments error-general)" - H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_clang_arguments noerror-general)" ###################### # Developer warnings # diff --git a/config/clang-flags b/config/clang-flags index 92a8973..5c377ed 100644 --- a/config/clang-flags +++ b/config/clang-flags @@ -20,15 +20,15 @@ # # For now, do not promote any warnings to errors. # -PROMOTE_ERRORS_DFLT=no +WARNINGS_AS_ERRORS_DFLT=no # # This filter rewrites -Werror= as -W, in that way demoting warnings -# promoted to errors back to warnings, if PROMOTE_ERRORS is no. +# promoted to errors back to warnings, if WARNINGS_AS_ERRORS is no. # demote_errors() { - if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then + if [ ${WARNINGS_AS_ERRORS:-${WARNINGS_AS_ERRORS_DFLT}} = no ]; then sed 's,-Werror=,-W,g' else cat @@ -44,7 +44,7 @@ demote_errors() load_clang_arguments() { set -- $(for arg; do - sed 's,#.*$,,' $srcdir/config/clang-warnings/${arg} + sed 's,#.*$,,' $srcdir/config/clang-warnings/${arg} | demote_errors done) IFS=' ' echo "$*" } @@ -183,7 +183,6 @@ if test "X-clang" = "X-$cc_vendor" -o "X-Apple LLVM" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS $(load_clang_arguments general)" H5_ECFLAGS="$H5_ECFLAGS $(load_clang_arguments error-general)" - H5_NECFLAGS="$H5_NECFLAGS $(load_clang_arguments noerror-general)" ###################### # Developer warnings # diff --git a/config/clang-warnings/noerror-general b/config/clang-warnings/noerror-general deleted file mode 100644 index 4690ebd..0000000 --- a/config/clang-warnings/noerror-general +++ /dev/null @@ -1,82 +0,0 @@ -# -# These warnings will be treated as errors, using the error-general file, -# when HDF5_ENABLE_WARNINGS_AS_ERRORS is set to true for CMake or -# the --enable-warnings-as-errors option is specified for configure. -# Otherwise this file will be used to treat them as warnings. -# --Wbad-function-cast --Wimplicit-function-declaration --Wincompatible-pointer-types --Wmissing-declarations --Wpacked --Wshadow --Wswitch -# -# NOTE: Following files are not compatible with incompatible-pointer-types as errors -# src/H5Dchunk.c,src/H5Dint.c,src/H5Gint.c,src/H5HFcache.c,src/H5I.c,src/H5T.c --Wno-error=incompatible-pointer-types-discards-qualifiers -# -# -# NOTE: File Driver files are not compatible with these warnings as errors -# H5FDdirect.c,H5FDmpio.c,H5FDros3.c, -# -Werror=unused-function -# --Wunused-function -# -# H5FDdrvr_module.h -# -Werror=unused-variable -# --Wunused-variable -# -# H5VLpassthru.c -# -Werror=unused-parameter -# --Wunused-parameter -# -# -# -# NOTE: Tools files are not compatible with these warnings as errors -# lib/h5tools.c -# -Werror=cast-align -# --Wcast-align -# -# lib/h5tools_utils.c -# -Werror=unused-parameter -# -# -# NOTE: JNI files are not compatible with these warnings as errors -# jni/h5pDCPLImp.c,jni/nativeData.c,jni/h5util.c,jni/h5rImp.c -# jni/h5sImp.c,jni/h5tImp.c -# -Werror=cast-align -# jni/h5util.c -# -Werror=format(-overflow) -# --Wformat -# -# -#Examples and tests do not use the same set of extensive warning flags as libraries -# Here is a list of tests and examples that have issues with the stricter warnings as error -# -# NOTE: Test files are not compatible with these warnings as errors -# thread_id.c, -# -Werror=unused-function -# dsets.c -# -Werror=unused-parameter -# -# -# NOTE: Examples files are not compatible with these warnings as errors -# h5_vds-eiger.c,h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,h5_vds-percival-unlim-maxmin.c -# h5_vds-percival.c,h5_read.c,h5_rdwt.c,h5_mount.c,h5_extend.c,h5_extend_write.c -# h5_write.c,h5_vds-simpleIO.c,h5_ref2reg_deprec.c,h5_crtgrp.c,h5_select.c -# h5_vds-percival-unlim.c,h5_crtatt.c,h5_group.c,h5_attribute.c,h5_crtdat.c -# h5_reference_deprec.c -# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c -# -Werror=strict-prototypes -# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c -# -Werror=old-style-definition -# h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c, -# -Werror=unused-variable -# h5_elink_unix2win.c,h5_extlink.c,h5_attribute.c -# -Werror=unused-parameter - diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index e76150f..7bfd0bd 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -133,11 +133,7 @@ else () AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) # add the general CXX flags for g++ compiler versions 4.8 and above. ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") - else () - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") - endif () + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") endif () elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") @@ -201,11 +197,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") - else () - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-5") - endif () + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") endif () # Append more extra warning flags that only gcc 6.x+ knows about @@ -230,11 +222,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") - else () - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") - endif () + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") if (HDF5_ENABLE_DEV_WARNINGS) # Use the C warnings as CXX warnings are the same ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 210e475..eb43b73 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -153,22 +153,14 @@ else () # Add general CFlags for GCC versions 4.8 and above if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") - else () - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-general") - endif () + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") endif () # gcc automatically inlines based on the optimization level # this is just a failsafe list (APPEND H5_CFLAGS "-finline-functions") elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") - else () - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/noerror-general") - endif () + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform") endif () @@ -228,11 +220,7 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU") # Append more extra warning flags that only gcc 5.x+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") - else () - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") - endif () + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") endif () # Append more extra warning flags that only gcc 6.x+ knows about @@ -253,9 +241,7 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU") # Append more extra warning flags that only gcc 8.x+ knows about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") - if (HDF5_ENABLE_WARNINGS_AS_ERRORS) - ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") - endif () + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") if (HDF5_ENABLE_DEV_WARNINGS) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index ae0ebca..6da2b74 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -464,6 +464,9 @@ macro (ADD_H5_FLAGS h5_flag_var infile) list (GET TEST_FLAG_STREAM ${line} str_flag) string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") #message (TRACE "str_flag=${str_flag}") + if (NOT HDF5_ENABLE_WARNINGS_AS_ERRORS) + string (REGEX REPLACE "-Werror=" "-W" str_flag "${str_flag}") + endif () if (str_flag) list (APPEND ${h5_flag_var} "${str_flag}") endif () diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 9f11406..280679d 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -20,15 +20,15 @@ # # For now, do not promote any warnings to errors. # -PROMOTE_ERRORS_DFLT=no +WARNINGS_AS_ERRORS_DFLT=no # # This filter rewrites -Werror= as -W, in that way demoting warnings -# promoted to errors back to warnings, if PROMOTE_ERRORS is no. +# promoted to errors back to warnings, if WARNINGS_AS_ERRORS is no. # demote_errors() { - if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then + if [ ${WARNINGS_AS_ERRORS:-${WARNINGS_AS_ERRORS_DFLT}} = no ]; then sed 's,-Werror=,-W,g' else cat @@ -44,7 +44,7 @@ demote_errors() load_gnu_arguments() { set -- $(for arg; do - sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} + sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors done) IFS=' ' echo "$*" } @@ -192,7 +192,6 @@ if test "X-g++" = "X-$cxx_vendor"; then if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 8 -o $cxx_vers_major -ge 5; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-general)" H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments cxx-error-general)" - H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_gnu_arguments cxx-noerror-general)" ###################### # Developer warnings # @@ -235,7 +234,6 @@ if test "X-g++" = "X-$cxx_vendor"; then if test $cxx_vers_major -ge 5; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-5)" H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments cxx-error-5)" - H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_gnu_arguments cxx-noerror-5)" fi # gcc >= 6 @@ -256,7 +254,6 @@ if test "X-g++" = "X-$cxx_vendor"; then # Use the C warnings as CXX warnings are the same H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 8)" #H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-8)" - #H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_gnu_arguments noerror-8)" # Use the C warnings as CXX warnings are the same DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-8)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-8)" diff --git a/config/gnu-flags b/config/gnu-flags index 3e4ceb2..89239df 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -20,15 +20,15 @@ # # For now, do not promote any warnings to errors. # -PROMOTE_ERRORS_DFLT=no +WARNINGS_AS_ERRORS_DFLT=no # # This filter rewrites -Werror= as -W, in that way demoting warnings -# promoted to errors back to warnings, if PROMOTE_ERRORS is no. +# promoted to errors back to warnings, if WARNINGS_AS_ERRORS is no. # demote_errors() { - if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then + if [ ${WARNINGS_AS_ERRORS:-${WARNINGS_AS_ERRORS_DFLT}} = no ]; then sed 's,-Werror=,-W,g' else cat @@ -44,7 +44,7 @@ demote_errors() load_gnu_arguments() { set -- $(for arg; do - sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} + sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors done) IFS=' ' echo "$*" } @@ -205,7 +205,6 @@ if test "X-gcc" = "X-$cc_vendor"; then if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8 -o $cc_vers_major -gt 4; then H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments general)" H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-general)" - H5_NECFLAGS="$H5_NECFLAGS $(load_gnu_arguments noerror-general)" ###################### # Developer warnings # @@ -245,7 +244,6 @@ if test "X-gcc" = "X-$cc_vendor"; then if test $cc_vers_major -ge 5; then H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 5)" H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-5)" - H5_NECFLAGS="$H5_NECFLAGS $(load_gnu_arguments noerror-5)" fi # gcc >= 6 @@ -263,7 +261,6 @@ if test "X-gcc" = "X-$cc_vendor"; then if test $cc_vers_major -ge 8; then H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 8)" H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-8)" - H5_NECFLAGS="$H5_NECFLAGS $(load_gnu_arguments noerror-8)" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-8)" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments no-developer-8)" fi diff --git a/config/gnu-warnings/cxx-noerror-5 b/config/gnu-warnings/cxx-noerror-5 deleted file mode 100644 index 7bce3e8..0000000 --- a/config/gnu-warnings/cxx-noerror-5 +++ /dev/null @@ -1,11 +0,0 @@ -# -# In GCC 4.4.7, the compiler gripes about shadowed global -# declarations when a local variable uses the name of a -# function that's in a system header file. For some reason, -# later versions of GCC (e.g., 5.2.0) don't complain about -# the shadowed globals. Maybe later versions are less fussy? -# Anyway, the shadowing seems to be harmless, and GCC 4.4.7 -# is not a supported compiler, so let us promote shadowed globals -# warnings to errors only for GCC 5 and later. -# --Wshadow diff --git a/config/gnu-warnings/cxx-noerror-general b/config/gnu-warnings/cxx-noerror-general deleted file mode 100644 index 8cc1d94..0000000 --- a/config/gnu-warnings/cxx-noerror-general +++ /dev/null @@ -1,32 +0,0 @@ -# -# HDF5 code should not trigger the following warnings under any -# circumstances, so ask the compiler to treat them as errors: -# -# NOTE: c++/test files are not compatible with these warnings as errors -# c++/test/tcompound.cpp -# -Werror=cast-align --Wcast-align -# NOTE: c++/src files are not compatible with these warnings as errors -# c++/src/H5Object.cpp -# -Werror=missing-declarations --Wmissing-declarations --Wpacked --Wredundant-decls --Wswitch -# NOTE: c++/test files are not compatible with these warnings as errors -# c++/test/tattr.cpp -# -Werror=unused-but-set-variable --Wunused-but-set-variable --Wunused-function --Wunused-variable -# NOTE: c++/src files are not compatible with these warnings as errors -# c++/src/H5Object.cpp,c++/src/H5StrType.cpp,c++/src/H5PredType.cpp -# -Werror=unused-parameter --Wunused-parameter -# -# Other files not compatible -# NOTE: c++/test files are not compatible with these warnings as errors -# c++/test/titerate.cpp,c++/test/tarray.cpp -# -Werror=missing-declarations -# c++/test/titerate.cpp,c++/test/tarray.cpp,c++/test/tlinks.cpp,c++/test/ttypes.cpp,c++/test/dsets.cpp -# -Werror=unused-parameter diff --git a/config/gnu-warnings/noerror-5 b/config/gnu-warnings/noerror-5 deleted file mode 100644 index a7d40dd..0000000 --- a/config/gnu-warnings/noerror-5 +++ /dev/null @@ -1,12 +0,0 @@ --Wincompatible-pointer-types -# -# In GCC 4.4.7, the compiler gripes about shadowed global -# declarations when a local variable uses the name of a -# function that's in a system header file. For some reason, -# later versions of GCC (e.g., 5.2.0) don't complain about -# the shadowed globals. Maybe later versions are less fussy? -# Anyway, the shadowing seems to be harmless, and GCC 4.4.7 -# is not a supported compiler, so let us promote shadowed globals -# warnings to errors only for GCC 5 and later. -# --Wshadow diff --git a/config/gnu-warnings/noerror-8 b/config/gnu-warnings/noerror-8 deleted file mode 100644 index 2f54a4d..0000000 --- a/config/gnu-warnings/noerror-8 +++ /dev/null @@ -1,25 +0,0 @@ -# NOTE: src/ files are not compatible with these warnings as errors -# src/H5Dchunk.c -# -Werror=cast-function-type --Wcast-function-type -# -# For GCC 8, promote maybe-initialized warnings to an error. GCC 8 -# reports 0 maybe-uninitialized warnings where earlier versions -# make many false reports. GCC 8 seems to analyze calls to static -# in order to detect initializations that occur there. It's possible -# that GCC 8 only performs that analysis at -O3, though. -# -# -# NOTE: File Driver files are not compatible with these warnings as errors -# H5FDlog.c, -# -Werror=maybe-uninitialized --Wmaybe-uninitialized -# NOTE: src/ files are not compatible with these warnings as errors -# src/H5Shyper.c,src/H5SL.c,src/H5Shyper.c -# -Werror=maybe-uninitialized -# NOTE: Test files are not compatible with these warnings as errors -# test/cache_common.c, -# -Werror=maybe-uninitialized -# NOTE: hl/src/ files are not compatible with these warnings as errors -# hl/src/H5DS.c, -# -Werror=maybe-uninitialized diff --git a/config/gnu-warnings/noerror-general b/config/gnu-warnings/noerror-general deleted file mode 100644 index f49d89a..0000000 --- a/config/gnu-warnings/noerror-general +++ /dev/null @@ -1,92 +0,0 @@ -# -# These warnings will be treated as errors, using the error-general file, -# when HDF5_ENABLE_WARNINGS_AS_ERRORS is set to true for CMake or -# the --enable-warnings-as-errors option is specified for configure. -# Otherwise this file will be used to treat them as warnings. -# --Wbad-function-cast --Wimplicit-function-declaration --Wmissing-declarations --Wmissing-prototypes --Wnested-externs --Wold-style-definition --Wpacked --Wpointer-sign --Wpointer-to-int-cast --Wredundant-decls --Wstrict-prototypes --Wswitch -# -#-Werror=discarded-qualifiers -# -# -# NOTE: File Driver files are not compatible with these warnings as errors -# H5FDdirect.c,H5FDmpio.c,H5FDros3.c, -# -Werror=unused-function -# --Wunused-function -# -# H5FDdrvr_module.h -# -Werror=unused-variable -# --Wunused-variable -# -# H5VLpassthru.c -# -Werror=unused-parameter -# --Wunused-parameter -# -# -# -# NOTE: Tools files are not compatible with these warnings as errors -# lib/h5tools.c -# -Werror=cast-align -# --Wcast-align -# -# lib/h5diff_array.c -# -Werror=unused-but-set-variable -# --Wunused-but-set-variable -# -# lib/h5tools_utils.c -# -Werror=unused-parameter -# -# -# NOTE: JNI files are not compatible with these warnings as errors -# jni/h5pDCPLImp.c,jni/nativeData.c,jni/h5util.c,jni/h5rImp.c -# jni/h5sImp.c,jni/h5tImp.c -# -Werror=cast-align -# jni/h5util.c -# -Werror=format(-overflow) -# --Wformat -# -# -#Examples and tests do not use the same set of extensive warning flags as libraries -# Here is a list of tests and examples that have issues with the stricter warnings as error -# -# NOTE: Test files are not compatible with these warnings as errors -# thread_id.c, -# -Werror=unused-function -# dsets.c -# -Werror=unused-parameter -# external.c,perform/sio_engine.c -# -Werror=format(-truncation) -# -# -# NOTE: Examples files are not compatible with these warnings as errors -# h5_vds-eiger.c,h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,h5_vds-percival-unlim-maxmin.c -# h5_vds-percival.c,h5_read.c,h5_rdwt.c,h5_mount.c,h5_extend.c,h5_extend_write.c -# h5_write.c,h5_vds-simpleIO.c,h5_ref2reg_deprec.c,h5_crtgrp.c,h5_select.c -# h5_vds-percival-unlim.c,h5_crtatt.c,h5_group.c,h5_attribute.c,h5_crtdat.c -# h5_reference_deprec.c -# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c -# -Werror=strict-prototypes -# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c -# -Werror=old-style-definition -# h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c, -# -Werror=unused-variable -# h5_elink_unix2win.c,h5_extlink.c,h5_attribute.c -# -Werror=unused-parameter - diff --git a/configure.ac b/configure.ac index cd5a42a..e5f67d4 100644 --- a/configure.ac +++ b/configure.ac @@ -237,6 +237,41 @@ elif test $hdf5_cv_host != $host; then fi ## ---------------------------------------------------------------------- +## Check if we should consider certain compiler warnings as errors +## +## We have to set WARNINGS_AS_ERRORS before sourcing a $host_config +## file, below. +## +## These should NOT be on by default as the risk of breakage is high +## when compiling HDF5 on new (or new versions) of platforms and +## compilers. It can also cause failures when header files we have no +## control over (e.g. MPI, HDFS) raise warnings. +## +AC_MSG_CHECKING([enable warnings as errors]) +AC_ARG_ENABLE([warnings-as-errors], + [AS_HELP_STRING([--enable-warnings-as-errors], + [Determines whether certain warnings will be + considered errors. This is mainly for use + by HDF5 library developers. + [default=no] + ])], + [WARNINGS_AS_ERRORS=$enableval]) + +## Set default +if test "X-$WARNINGS_AS_ERRORS" = X- ; then + WARNINGS_AS_ERRORS=no +fi + +case "X-$WARNINGS_AS_ERRORS" in + X-yes|X-no) + AC_MSG_RESULT([$WARNINGS_AS_ERRORS]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $WARNINGS_AS_ERRORS]) + ;; +esac + +## ---------------------------------------------------------------------- ## Source any special files that we need. These files normally aren't ## present but can be used by the maintainers to fine tune things like ## turning on debug or profiling flags for the compiler. The search order @@ -2233,6 +2268,13 @@ case "X-$ASSERTS" in ;; esac +## Incorporate the potentially warning-to-error promoting flags after +## feature tests. Some of the tests (e.g., `off_t`) generate compilation +## errors with the flags we chose for the HDF5 library and tools. +## +H5_CFLAGS="$H5_CFLAGS $H5_ECFLAGS" +H5_CXXFLAGS="$H5_CXXFLAGS $H5_ECXXFLAGS" + ## ---------------------------------------------------------------------- ## Check if developer warnings should be turned on ## These are warnings that provide suggestions like gcc's -Wsuggest-attribute. @@ -2272,45 +2314,6 @@ case "X-$DEV_WARNINGS" in esac ## ---------------------------------------------------------------------- -## Check if we should consider certain compiler warnings as errors -## -## These should NOT be on by default as the risk of breakage is high -## when compiling HDF5 on new (or new versions) of platforms and -## compilers. It can also cause failures when header files we have no -## control over (e.g. MPI, HDFS) raise warnings. -## -AC_MSG_CHECKING([enable warnings as errors]) -AC_ARG_ENABLE([warnings-as-errors], - [AS_HELP_STRING([--enable-warnings-as-errors], - [Determines whether certain warnings will be - considered errors. This is mainly for use - by HDF5 library developers. - [default=no] - ])], - [WARNINGS_AS_ERRORS=$enableval]) - -## Set default -if test "X-$WARNINGS_AS_ERRORS" = X- ; then - WARNINGS_AS_ERRORS=no -fi - -case "X-$WARNINGS_AS_ERRORS" in - X-yes) - H5_CFLAGS="$H5_CFLAGS $H5_ECFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $H5_ECXXFLAGS" - AC_MSG_RESULT([yes]) - ;; - X-no) - H5_CFLAGS="$H5_CFLAGS $H5_NECFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $H5_NECXXFLAGS" - AC_MSG_RESULT([no]) - ;; - *) - AC_MSG_ERROR([Unrecognized value: $WARNINGS_AS_ERRORS]) - ;; -esac - -## ---------------------------------------------------------------------- ## Check if the compiler should use profiling flags/settings ## AC_MSG_CHECKING([profiling]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index bf14fbc..8a2c496 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,13 @@ New Features Configuration: ------------- + - Changed autotools and CMake configurations to derive both + compilation warnings-as-errors and warnings-only-warn configurations + from the same files, `config/*/*error*`. Removed redundant files + `config/*/*noerror*`. + + (DCY - 2021/09/29) + - Added new option to control the build of High-Level tools that default ON/enabled. -- cgit v0.12 From 52cb2833de142f67bf52318457bb95c5a3682563 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Wed, 6 Oct 2021 16:25:08 -0500 Subject: OESS-168: Remove clang warnings. (#1071) * OESS-168: Remove clang warnings. * Address review by @jehndersonHDF. --- test/objcopy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/objcopy.c b/test/objcopy.c index c8a5bac..911a45b 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -11092,7 +11092,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for (j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1.0F / ((float)i + 1.0F); + buf[i].c = 1.0 / ((double)i + 1.0); } /* end for */ /* Initialize the filenames */ @@ -11268,7 +11268,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for (j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1.0F / ((float)i + 1.0F); + buf[i].c = 1.0 / ((double)i + 1.0); } /* end for */ /* Initialize the filenames */ @@ -11453,7 +11453,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for (j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1.0F / ((float)i + 1.0F); + buf[i].c = 1.0 / ((double)i + 1.0); } /* end for */ /* Initialize the filenames */ -- cgit v0.12 From e2cdb618ae77851388acba04c74f7afdaddb7592 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Wed, 6 Oct 2021 16:25:40 -0500 Subject: OESS-168: Remove clang warnings. (#1074) * OESS-168: Remove clang warnings. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- tools/lib/h5diff_array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 2d6c66c..e16a045 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -2070,7 +2070,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, /* both not NaN, do the comparison */ if (!isnan1 && !isnan2) { - if (ABS(temp1_double - temp2_double) > opts->delta) { + if ((double)ABS(temp1_double - temp2_double) > opts->delta) { opts->print_percentage = 0; print_pos(opts, elem_idx, 0); if (print_data(opts)) { @@ -2163,7 +2163,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, } nfound++; } - else if (per > opts->percent && ABS(temp1_double - temp2_double) > opts->delta) { + else if (per > opts->percent && (double)ABS(temp1_double - temp2_double) > opts->delta) { opts->print_percentage = 1; print_pos(opts, elem_idx, 0); if (print_data(opts)) { -- cgit v0.12 From 83eeef504a44e5659ced901c38ed31362d89a9f5 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 7 Oct 2021 17:06:49 -0500 Subject: Add missing dataset reference text (#1081) * Add missing dataset reference text * Only print name if not printing data --- java/src/jni/h5util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 4272205..2550ad9 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -658,8 +658,6 @@ h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, void *ref_p) int ret_value = FAIL; - if (!h5str_append(out_str, " \"")) - H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); buf_size = H5Rget_file_name(ref_vp, NULL, 0); if (buf_size) { ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); @@ -697,8 +695,6 @@ h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, void *ref_p) ref_name = NULL; } } - if (!h5str_append(out_str, "\"")) - H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); ret_value = SUCCEED; done: @@ -725,6 +721,10 @@ h5str_region_dataset(JNIEnv *env, h5str_t *out_str, H5R_ref_t *ref_vp, int expan if ((new_obj_sid = H5Ropen_region(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) < 0) H5_LIBRARY_ERROR(ENVONLY); + if (expand_data == 0) + if (h5str_sprint_reference(ENVONLY, out_str, ref_vp) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + if ((region_type = H5Sget_select_type(new_obj_sid)) > H5S_SEL_ERROR) { if (H5S_SEL_POINTS == region_type) { if (h5str_dump_region_points(ENVONLY, out_str, new_obj_sid, new_obj_id, expand_data) < 0) -- cgit v0.12 From 0f3ed99d85364411945cd978acfe9ce22c5de8d6 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Thu, 7 Oct 2021 21:59:10 -0500 Subject: OESS-168: Remove clang warnings. (#1076) --- src/H5ACprivate.h | 18 +++++++++--------- test/cache_api.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index e9b8a47..d252d85 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,7 +270,7 @@ 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, \ diff --git a/test/cache_api.c b/test/cache_api.c index 432dab3..ff74f64 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -546,7 +546,7 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05f, + /* double empty_reserve = */ 0.05, /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; -- cgit v0.12 From 780dc11e6eb23d58b9418c46d829372e89ee0237 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Thu, 7 Oct 2021 21:59:32 -0500 Subject: OESS-168: Remove clang warnings. (#1077) --- test/tunicode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tunicode.c b/test/tunicode.c index 1b696ac..7d4dba6 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -34,7 +34,7 @@ #define RANK 1 #define COMP_INT_VAL 7 #define COMP_FLOAT_VAL (-42.0F) -#define COMP_DOUBLE_VAL 42.0F +#define COMP_DOUBLE_VAL 42.0 /* Test function prototypes */ void test_fl_string(hid_t fid, const char *string); -- cgit v0.12 From 82b61574e1eb5f157d289185656eb877c3a33582 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" <hyoklee@hdfgroup.org> Date: Thu, 14 Oct 2021 22:06:42 -0500 Subject: OESS-168: Remove clang warnings. (#1072) * OESS-168: Remove clang warnings. * Committing clang-format changes * Address review by @jehndersonHDF. * Address review by @jehndersonHDF. * OESS-168: Fix CI failure. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/dsets.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/dsets.c b/test/dsets.c index 5e80ef7..a4b5757 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1399,7 +1399,7 @@ test_conv_buffer(hid_t fid) cf->b[j] = 100.0F * (float)(j + 1) + 0.01F * (float)j; for (j = 0; j < DIM3; j++) - cf->c[j] = 100.0F * (float)(j + 1) + 0.02F * (float)j; + cf->c[j] = 100.0 * (double)(j + 1) + 0.02 * (double)j; /* Create data space */ if ((space = H5Screate(H5S_SCALAR)) < 0) @@ -3442,11 +3442,11 @@ test_nbit_double(hid_t file) /* orig_data[] are initialized to be within the range that can be represented by * dataset datatype (no precision loss during datatype conversion) */ - double orig_data[2][5] = {{(double)1.6081706885101836e+60L, -255.32099170994480f, - (double)1.2677579992621376e-61L, 64568.289448797700f, + double orig_data[2][5] = {{(double)1.6081706885101836e+60L, -255.32099170994480, + (double)1.2677579992621376e-61L, 64568.289448797700, (double)-1.0619721778839084e-75L}, - {(double)2.1499497833454840e+56L, 6.6562295504670740e-3f, -1.5747263393432150f, - 1.0711093225222612f, -9.8971679387636870e-1f}}; + {(double)2.1499497833454840e+56L, 6.6562295504670740e-3, -1.5747263393432150, + 1.0711093225222612, -9.8971679387636870e-1}}; double new_data[2][5]; size_t precision, offset; size_t i, j; @@ -5201,7 +5201,7 @@ test_scaleoffset_float(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < (size_t)size[0]; i++) { for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0, -3.0)) { + if (HDfabs((double)(new_data[i][j] - orig_data[i][j])) > HDpow(10.0, -3.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -5347,7 +5347,7 @@ test_scaleoffset_float_2(hid_t file) /* Check that the values read are the same as the values written */ for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0, -3.0)) { + if (HDfabs((double)(new_data[0][j] - orig_data[0][j])) > HDpow(10.0, -3.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -5435,7 +5435,7 @@ test_scaleoffset_double(hid_t file) /* Initialize data */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (float)(HDrandom() % 10000000) / 10000000.0F; + orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0; /* even-numbered values are negtive */ if ((i * size[1] + j + 1) % 2 == 0) @@ -5544,7 +5544,7 @@ test_scaleoffset_double_2(hid_t file) goto error; /* Set fill value */ - fillval = 10000.0F; + fillval = 10000.0; if (H5Pset_fill_value(dc, H5T_NATIVE_DOUBLE, &fillval) < 0) goto error; @@ -5581,7 +5581,7 @@ test_scaleoffset_double_2(hid_t file) /* Initialize data of hyperslab */ for (j = 0; j < (size_t)size[1]; j++) { - orig_data[0][j] = (float)(HDrandom() % 10000000) / 10000000.0F; + orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0; /* even-numbered values are negtive */ if ((j + 1) % 2 == 0) @@ -5614,7 +5614,7 @@ test_scaleoffset_double_2(hid_t file) /* Check that the values read are the same as the values written */ for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0, -7.0)) { + if (HDfabs((double)(new_data[0][j] - orig_data[0][j])) > HDpow(10.0, -7.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -6525,7 +6525,7 @@ test_set_local(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Initialize the integer & floating-point dataset */ - n = 1.0F; + n = 1.0; for (i = 0; i < DSET_DIM1; i++) for (j = 0; j < DSET_DIM2; j++) { points[i][j] = (int)n++; @@ -9085,7 +9085,7 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Define cache size to be smaller than chunk size */ rdcc_nelmts = BYPASS_CHUNK_DIM / 5; rdcc_nbytes = sizeof(int) * BYPASS_CHUNK_DIM / 5; - if (H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, 0.0F) < 0) + if (H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, 0.0) < 0) FAIL_STACK_ERROR /* Create file */ -- cgit v0.12 From 28ba743c3dc56bec1098e438cab4ee357c50ea3f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 18 Oct 2021 20:22:27 +0000 Subject: Committing clang-format changes --- src/H5FD.c | 3 ++- src/H5FDmpio.c | 78 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index 11071d1..80523cf 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -2147,7 +2147,8 @@ H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void } else if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) { - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed (no ctl and fail if unknown flag is set)") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, + "VFD ctl request failed (no ctl and fail if unknown flag is set)") } done: diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 445cc65..13cafb6 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -97,44 +97,44 @@ static herr_t H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, c /* The MPIO file driver information */ static const H5FD_class_t H5FD_mpio_g = { - "mpio", /* name */ - HADDR_MAX, /* maxaddr */ - H5F_CLOSE_SEMI, /* fc_degree */ - H5FD__mpio_term, /* terminate */ - NULL, /* sb_size */ - NULL, /* sb_encode */ - NULL, /* sb_decode */ - 0, /* fapl_size */ - NULL, /* fapl_get */ - NULL, /* fapl_copy */ - NULL, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - H5FD__mpio_open, /* open */ - H5FD__mpio_close, /* close */ - NULL, /* cmp */ - H5FD__mpio_query, /* query */ - NULL, /* get_type_map */ - NULL, /* alloc */ - NULL, /* free */ - H5FD__mpio_get_eoa, /* get_eoa */ - H5FD__mpio_set_eoa, /* set_eoa */ - H5FD__mpio_get_eof, /* get_eof */ - H5FD__mpio_get_handle, /* get_handle */ - H5FD__mpio_read, /* read */ - H5FD__mpio_write, /* write */ + "mpio", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_SEMI, /* fc_degree */ + H5FD__mpio_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__mpio_open, /* open */ + H5FD__mpio_close, /* close */ + NULL, /* cmp */ + H5FD__mpio_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__mpio_get_eoa, /* get_eoa */ + H5FD__mpio_set_eoa, /* set_eoa */ + H5FD__mpio_get_eof, /* get_eof */ + H5FD__mpio_get_handle, /* get_handle */ + H5FD__mpio_read, /* read */ + H5FD__mpio_write, /* write */ H5FD__mpio_read_vector, /*read_vector */ H5FD__mpio_write_vector, /*write_vector */ NULL, /*read_selection */ NULL, /*write_selection */ - H5FD__mpio_flush, /* flush */ - H5FD__mpio_truncate, /* truncate */ - NULL, /* lock */ - NULL, /* unlock */ - H5FD__mpio_delete, /* del */ - H5FD__mpio_ctl, /* ctl */ - H5FD_FLMAP_DICHOTOMY /* fl_map */ + H5FD__mpio_flush, /* flush */ + H5FD__mpio_truncate, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD__mpio_delete, /* del */ + H5FD__mpio_ctl, /* ctl */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; #ifdef H5FDmpio_DEBUG @@ -1641,9 +1641,9 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou hbool_t vector_was_sorted = TRUE; hbool_t fixed_size = FALSE; size_t size; - H5FD_mem_t * s_types = NULL; - haddr_t * s_addrs = NULL; - size_t * s_sizes = NULL; + H5FD_mem_t * s_types = NULL; + haddr_t * s_addrs = NULL; + size_t * s_sizes = NULL; void ** s_bufs = NULL; int * mpi_block_lengths = NULL; char unused = 0; /* Unused, except for non-NULL pointer value */ @@ -1679,7 +1679,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); hbool_t H5FD_mpio_debug_r_flag = (H5FD_mpio_debug_flags_s[(int)'r'] && H5FD_MPIO_TRACE_THIS_RANK(file)); #endif - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -2226,7 +2226,7 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); hbool_t H5FD_mpio_debug_w_flag = (H5FD_mpio_debug_flags_s[(int)'w'] && H5FD_MPIO_TRACE_THIS_RANK(file)); #endif - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC -- cgit v0.12 From 2a5d2a27c492170f84d89b7725df4983fe6466a8 Mon Sep 17 00:00:00 2001 From: Neil Fortner <nfortne2@hdfgroup.org> Date: Mon, 18 Oct 2021 16:56:37 -0500 Subject: Run formatter --- src/H5FDprivate.h | 10 ++++++---- src/H5Tprivate.h | 14 +++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 1660f48..c48d0fc 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -149,11 +149,13 @@ H5_DLL herr_t H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[] H5_DLL herr_t H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[], const void *bufs[] /* out */); H5_DLL herr_t H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, - const struct H5S_t *const *mem_spaces, const struct H5S_t *const *file_spaces, - haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */); + const struct H5S_t *const *mem_spaces, + const struct H5S_t *const *file_spaces, haddr_t offsets[], + size_t element_sizes[], void *bufs[] /* out */); H5_DLL herr_t H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, - const struct H5S_t *const *mem_spaces, const struct H5S_t *const *file_spaces, - haddr_t offsets[], size_t element_sizes[], const void *bufs[]); + const struct H5S_t *const *mem_spaces, + const struct H5S_t *const *file_spaces, haddr_t offsets[], + size_t element_sizes[], const void *bufs[]); H5_DLL herr_t H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */); diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 735adc7..9731379 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -122,14 +122,14 @@ H5_DLL size_t H5T_get_size(const H5T_t *dt); H5_DLL hbool_t H5T_get_force_conv(const H5T_t *dt); H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset); H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); -H5_DLL H5T_t * H5T_decode(size_t buf_size, const unsigned char *buf); -H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE *stream); -H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt); +H5_DLL H5T_t * H5T_decode(size_t buf_size, const unsigned char *buf); +H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE *stream); +H5_DLL struct H5O_loc_t * H5T_oloc(H5T_t *dt); H5_DLL struct H5G_name_t *H5T_nameof(const H5T_t *dt); -H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); -H5_DLL htri_t H5T_is_named(const H5T_t *dt); -H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f); -H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt); +H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); +H5_DLL htri_t H5T_is_named(const H5T_t *dt); +H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f); +H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt); H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst); H5_DLL hbool_t H5T_path_noop(const H5T_path_t *p); H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p); -- cgit v0.12