From d69b541c2009e534d746622345268595b2ca614c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 11 Oct 2018 11:31:09 -0500 Subject: TRILABS-34 add batch option. Also fix cmakedefine01 usage --- fortran/src/H5config_f.inc.cmake | 2 +- src/CMakeLists.txt | 55 +++++++++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index aa3d135..3dd3c8c 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -12,7 +12,7 @@ ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure ! Define if we have parallel support -#cmakedefine01 H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +#cmakedefine01 H5_HAVE_PARALLEL #if H5_HAVE_PARALLEL == 0 #undef H5_HAVE_PARALLEL #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7045012..49a84df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -898,24 +898,43 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) INTERFACE $<$:"-O0"> ) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - if (BUILD_SHARED_LIBS) - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + option (HDF5_BATCH_DETECT "Use batch file to execute H5detect" OFF) + if (HDF5_BATCH_DETECT) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${HDF5_BATCH_DETECT_CMD} + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + if (BUILD_SHARED_LIBS) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ) - else () - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () + else () + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}H5detect + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}H5detect + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + ) + else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () endif () endif () else () @@ -942,7 +961,7 @@ target_link_libraries (H5make_libsettings add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}H5make_libsettings ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} @@ -950,7 +969,7 @@ add_custom_command ( if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}H5make_libsettings ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} -- cgit v0.12 From 4659e43a6b0914e3da6048328cece6e01be95e44 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 11 Oct 2018 12:24:15 -0500 Subject: HDFFV-10603 fixup cmake usage --- config/cmake_ext_mod/ConfigureChecks.cmake | 4 ++-- src/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 4204511..40f1440 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -273,7 +273,7 @@ if (NOT WINDOWS) set (HDF_EXTRA_C_FLAGS -D_GNU_SOURCE) option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) - if (HDF_ENABLE_LARGE_FILE) + if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN) set (msg "Performing TEST_LFS_WORKS") TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE ${CMAKE_BINARY_DIR} @@ -563,7 +563,7 @@ endif () if (WINDOWS) if (NOT HDF_NO_IOEO_TEST) message (STATUS "Checking for InitOnceExecuteOnce:") - if (NOT DEFINED ${${HDF_PREFIX}_HAVE_IOEO}) + if (NOT DEFINED ${HDF_PREFIX}_HAVE_IOEO) if (LARGEFILE) set (CMAKE_REQUIRED_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 49a84df..5314697 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -895,7 +895,7 @@ 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> - INTERFACE $<$:"-O0"> + PRIVATE $<$:"-O0"> ) option (HDF5_BATCH_DETECT "Use batch file to execute H5detect" OFF) @@ -956,7 +956,7 @@ 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> - INTERFACE $<$:"-O0"> + PRIVATE $<$:"-O0"> ) add_custom_command ( -- cgit v0.12 From 46e7e5f8f2dd4711728728d43d04fdabe88547ee Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 11 Oct 2018 12:35:53 -0500 Subject: Add more descriptive option name --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5314697..f41e31b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -898,11 +898,11 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) PRIVATE $<$:"-O0"> ) - option (HDF5_BATCH_DETECT "Use batch file to execute H5detect" OFF) - if (HDF5_BATCH_DETECT) + option (HDF5_BATCH_H5DETECT "Use batch file to execute H5detect" OFF) + if (HDF5_BATCH_H5DETECT) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - COMMAND ${HDF5_BATCH_DETECT_CMD} + COMMAND ${HDF5_BATCH_H5DETECT_CMD} ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} -- cgit v0.12 From 42c8dd66d7c58c454d36f5d0016c2763f491270d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 11 Oct 2018 14:34:34 -0500 Subject: Correct quote char --- config/cmake/scripts/HDF5options.cmake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 80a28d3..440a3ae 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -70,18 +70,18 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING ### enable parallel builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF”) -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF”) -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF”) +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") ############################################################################################# ### enable thread-safety builds -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON”) +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON") #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=OFF") -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF”) -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF”) -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF”) +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF") ############################################################################################# ### disable test program builds -- cgit v0.12 From 689f184345d9014f5725b8bc7f96945e78001a2f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Oct 2018 13:55:29 -0500 Subject: TRILAB-34 batch command options --- src/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f41e31b..e511469 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -898,12 +898,11 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) PRIVATE $<$:"-O0"> ) - option (HDF5_BATCH_H5DETECT "Use batch file to execute H5detect" OFF) if (HDF5_BATCH_H5DETECT) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - COMMAND ${HDF5_BATCH_H5DETECT_CMD} - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${HDF5_BATCH_CMD} + ARGS ${HDF5_BATCH_H5DETECT_SCRIPT} ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) -- cgit v0.12 From 2e4e4f38e64a35d9d6e6ab6f45093e992e3a4ea8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 15 Oct 2018 13:49:53 -0500 Subject: HDFFV-10603 patch 6 --- CMakeInstallation.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 2339049..464477b 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -125,7 +125,7 @@ else () endif () configure_file ( ${HDF_RESOURCES_DIR}/libhdf5.settings.cmake.in - ${HDF5_BINARY_DIR}/libhdf5.settings @ONLY + ${HDF5_BINARY_DIR}/libhdf5.settings ESCAPE_QUOTES @ONLY ) install ( FILES ${HDF5_BINARY_DIR}/libhdf5.settings -- cgit v0.12 From db3fe90abd9660f5fe94684f28ae9e48afb762e6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 15 Oct 2018 16:57:50 -0500 Subject: Add generated propoerty to H5lib_settings --- src/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e511469..cc9fe7c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -965,6 +965,7 @@ add_custom_command ( DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) +set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c @@ -973,6 +974,7 @@ if (BUILD_SHARED_LIBS) DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) + set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -- cgit v0.12 From 77f284a17545c32100d1560c7fd691455844f85c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 16 Oct 2018 11:33:44 -0500 Subject: TRILAB-36 Revert to target_file and correct property --- src/CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc9fe7c..bf48915 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -906,6 +906,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + 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 @@ -913,31 +914,31 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () else () add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}H5detect + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}H5detect + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared ) - else () set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () endif () endif () else () - 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 @@ -960,7 +961,7 @@ target_link_libraries (H5make_libsettings add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}H5make_libsettings + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} @@ -969,7 +970,7 @@ set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENE if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}H5make_libsettings + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} -- cgit v0.12 From 6b65a1b78f13adaa1cc95a805c558ac4f8e98278 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 16 Oct 2018 12:06:07 -0500 Subject: TRILAB-34 Add batch script config command --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf48915..ed97a76 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -899,6 +899,10 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) ) if (HDF5_BATCH_H5DETECT) + configure_file ( + ${HDF5_SOURCE_DIR}/bin/batch/${HDF5_DETECT_BATCH_SCRIPT}.in + ${HDF5_BINARY_DIR}/${HDF5_DETECT_BATCH_SCRIPT} ESCAPE_QUOTES @ONLY + ) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${HDF5_BATCH_CMD} -- cgit v0.12 From 2e28fad2d007841c08cdb3f06a3bd177d12ce30e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 16 Oct 2018 16:46:45 -0500 Subject: TRILAB-34 remove extra arg --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ed97a76..610111b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -906,7 +906,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${HDF5_BATCH_CMD} - ARGS ${HDF5_BATCH_H5DETECT_SCRIPT} ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS ${HDF5_BATCH_H5DETECT_SCRIPT} DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) -- cgit v0.12 From 2d6d5cad0cc426cd53b9d4fda15e53d8021e4c7b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 17 Oct 2018 02:06:28 -0700 Subject: Updates to the VOL ID and object API calls. This brings the H5VL code in line with the H5I code regarding naming, parameter order, etc. Several public API calls were affected by this change. These changed names to reflect their use with VOL drivers: H5VLregister() --> H5VLregister_driver() H5VLregister_by_name() --> H5VLregister_driver_by_name() H5VLunregister() --> H5VLunregister_driver() H5VLis_registered() --> H5VLis_driver_registered() This call was renamed to match H5Iregister(). The order of the first two parameters also reversed and the object pointer is now const. H5VLobject_register() --> H5VLregister() --- examples/h5_vol_external_log_native.c | 192 ++++++++++++++------------------ src/H5A.c | 44 ++++---- src/H5Adeprec.c | 14 +-- src/H5D.c | 6 +- src/H5Ddeprec.c | 8 +- src/H5Dvirtual.c | 2 +- src/H5F.c | 12 +- src/H5Fint.c | 2 +- src/H5G.c | 6 +- src/H5Gdeprec.c | 4 +- src/H5I.c | 42 +++---- src/H5Iprivate.h | 26 ++++- src/H5L.c | 6 +- src/H5O.c | 34 +++--- src/H5Odeprec.c | 10 +- src/H5Oflush.c | 8 +- src/H5R.c | 4 +- src/H5Rdeprec.c | 6 +- src/H5Tcommit.c | 2 +- src/H5Tdeprec.c | 2 +- src/H5VL.c | 73 ++++++------ src/H5VLint.c | 204 +++++++++++++++++++++++----------- src/H5VLnative.c | 8 +- src/H5VLnative.h | 2 +- src/H5VLprivate.h | 31 ++++-- src/H5VLpublic.h | 10 +- test/h5test.c | 2 +- test/tmisc.c | 14 +-- test/vol.c | 8 +- 29 files changed, 429 insertions(+), 353 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index 945588a..a25be6d 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -142,125 +142,105 @@ visit_cb(hid_t oid, const char *name, } /* end h5_verify_cached_stabs_cb() */ int main(int argc, char **argv) { - const char file_name[]="large_dataset.h5"; + const char file_name[]="large_dataset.h5"; const char group_name[]="/Group"; const char dataset_name[]="Data"; char fullpath[500]; hid_t file_id; hid_t group_id; hid_t dataspaceId; - hid_t datasetId; - hid_t acc_tpl; - hid_t under_fapl; - hid_t vol_id, vol_id2; - hid_t int_id; - hid_t attr; - hid_t space; - const unsigned int nelem=60; - int *data; - unsigned int i; - hsize_t dims[1]; - ssize_t len; - char name[25]; - static hsize_t ds_size[2] = {10, 20}; - - under_fapl = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_fapl_native(under_fapl); - assert(H5VLis_registered("native") == 1); - - vol_id = H5VLregister (&H5VL_log_g); - assert(vol_id > 0); - assert(H5VLis_registered("log") == 1); - - vol_id2 = H5VLget_driver_id("log"); - H5VLinitialize(vol_id2, H5P_DEFAULT); - H5VLclose(vol_id2); - - native_driver_id = H5VLget_driver_id("native"); - assert(native_driver_id > 0); - - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_vol(acc_tpl, vol_id, &under_fapl); - - file_id = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); - len = H5VLget_driver_name(file_id, name, 25); - printf ("FILE VOL name = %s %d\n", name, len); - - group_id = H5Gcreate2(file_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - len = H5VLget_driver_name(group_id, name, 50); - printf ("GROUP VOL name = %s %d\n", name, len); - - int_id = H5Tcopy(H5T_NATIVE_INT); - H5Tcommit2(file_id, "int", int_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - len = H5VLget_driver_name(int_id, name, 50); - printf ("DT COMMIT name = %s %d\n", name, len); - H5Tclose(int_id); - - int_id = H5Topen2(file_id, "int", H5P_DEFAULT); - len = H5VLget_driver_name(int_id, name, 50); - printf ("DT OPEN name = %s %d\n", name, len); - H5Tclose(int_id); - - int_id = H5Oopen(file_id,"int",H5P_DEFAULT); - len = H5VLget_driver_name(int_id, name, 50); - printf ("DT OOPEN name = %s %d\n", name, len); - - len = H5Fget_name(file_id, name, 50); - printf("name = %d %s\n", len, name); - - data = malloc (sizeof(int)*nelem); - for(i=0;i 0); + assert(H5VLis_driver_registered("log") == 1); - int_id = H5Oopen(file_id,"int",H5P_DEFAULT); - len = H5VLget_driver_name(int_id, name, 50); - printf ("DT OOPEN name = %s %d\n", name, len); - H5Oclose(int_id); + vol_id2 = H5VLget_driver_id("log"); + H5VLinitialize(vol_id2, H5P_DEFAULT); + H5VLclose(vol_id2); + native_driver_id = H5VLget_driver_id("native"); + assert(native_driver_id > 0); - H5Fclose(file_id); - file_id = H5Fopen(file_name, H5F_ACC_RDWR, H5P_DEFAULT);//acc_tpl); - H5Fflush(file_id, H5F_SCOPE_GLOBAL); -#endif + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + H5Pset_vol(acc_tpl, vol_id, &under_fapl); + + file_id = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); + len = H5VLget_driver_name(file_id, name, 25); + printf ("FILE VOL name = %s %d\n", name, len); + + group_id = H5Gcreate2(file_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + len = H5VLget_driver_name(group_id, name, 50); + printf ("GROUP VOL name = %s %d\n", name, len); + + int_id = H5Tcopy(H5T_NATIVE_INT); + H5Tcommit2(file_id, "int", int_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + len = H5VLget_driver_name(int_id, name, 50); + printf ("DT COMMIT name = %s %d\n", name, len); + H5Tclose(int_id); + + int_id = H5Topen2(file_id, "int", H5P_DEFAULT); + len = H5VLget_driver_name(int_id, name, 50); + printf ("DT OPEN name = %s %d\n", name, len); + H5Tclose(int_id); + + int_id = H5Oopen(file_id,"int",H5P_DEFAULT); + len = H5VLget_driver_name(int_id, name, 50); + printf ("DT OOPEN name = %s %d\n", name, len); - H5Fclose(file_id); - H5Pclose(acc_tpl); - H5Pclose(under_fapl); + len = H5Fget_name(file_id, name, 50); + printf("name = %d %s\n", len, name); - H5VLclose(native_driver_id); - H5VLterminate(vol_id, H5P_DEFAULT); - H5VLunregister (vol_id); - assert(H5VLis_registered("log") == 0); - return 0; + data = malloc (sizeof(int)*nelem); + for(i=0;idriver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -398,7 +398,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ @@ -407,7 +407,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -467,7 +467,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ @@ -476,7 +476,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name) /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -550,7 +550,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if (NULL == (vol_obj = H5VL_get_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ @@ -559,7 +559,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -642,7 +642,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ @@ -651,7 +651,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -973,7 +973,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + 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; @@ -1118,7 +1118,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ @@ -1182,7 +1182,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ @@ -1230,7 +1230,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -1295,7 +1295,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Rename the attribute */ @@ -1373,7 +1373,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(loc_id); /* get the loc object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over attributes */ @@ -1463,7 +1463,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* get the loc object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over attributes */ @@ -1518,7 +1518,7 @@ H5Adelete(hid_t loc_id, const char *name) loc_params.obj_type = H5I_get_type(loc_id); /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ @@ -1577,7 +1577,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ @@ -1648,7 +1648,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ @@ -1724,7 +1724,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* get the object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1777,7 +1777,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* get the object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + 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_NAME; diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 47983ea..cce9316 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -152,7 +152,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ @@ -161,7 +161,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: @@ -218,7 +218,7 @@ H5Aopen_name(hid_t loc_id, const char *name) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if (NULL == (vol_obj = H5VL_get_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ @@ -227,7 +227,7 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if ((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -287,7 +287,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ @@ -296,7 +296,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -342,7 +342,7 @@ H5Aget_num_attrs(hid_t loc_id) loc_params.obj_type = H5I_get_type(loc_id); /* get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the number of attributes for the object */ diff --git a/src/H5D.c b/src/H5D.c index 9f56197..eb40cc8 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -163,7 +163,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: @@ -256,7 +256,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: @@ -319,7 +319,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 4abba93..58238bc 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -157,7 +157,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ @@ -166,7 +166,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: @@ -217,7 +217,7 @@ H5Dopen1(hid_t loc_id, const char *name) loc_params.obj_type = H5I_get_type(loc_id); /* get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ @@ -226,7 +226,7 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 89974b2..77047e9 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2977,7 +2977,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get native VOL driver ID") /* Get a temporary identifier for this source dataset */ - if((temp_id = H5VL_object_register(*dset, H5I_DATASET, native_vol_id, FALSE)) < 0) + if((temp_id = H5VL_register_using_vol_id(H5I_DATASET, *dset, native_vol_id, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") /* Refresh source dataset */ diff --git a/src/H5F.c b/src/H5F.c index 2dcafb9..a31dff3 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -677,7 +677,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") /* Get an atom for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -757,7 +757,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") /* Get an ID for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -794,7 +794,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) } /* get the file object */ - if(NULL == (vol_obj = H5VL_get_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Flush the object */ @@ -883,7 +883,7 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") /* Get an atom for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -1288,7 +1288,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file or file object") /* Get the file object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the filename via the VOL */ @@ -1334,7 +1334,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Get the file object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 230a744..6a57ca5 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3303,7 +3303,7 @@ H5F__start_swmr_write(H5F_t *f) if(grp_dset_count > 0) { H5VL_object_t *vol_obj = NULL; - if(NULL == (vol_obj = H5VL_get_object(obj_ids[0]))) + if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0]))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") vol_driver = vol_obj->driver; diff --git a/src/H5G.c b/src/H5G.c index 772d567..1d4667f 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -370,7 +370,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: @@ -450,7 +450,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: @@ -511,7 +511,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index ab73e7e..d2e991b 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -240,7 +240,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: @@ -302,7 +302,7 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: diff --git a/src/H5I.c b/src/H5I.c index 7d445a5..e1d947c 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -764,7 +764,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_register_with_id + * Function: H5I_register_using_existing_id * * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. * This routine will check to ensure the supplied ID is not already @@ -773,14 +773,17 @@ done: * registered (thus, it is possible to register one object under * multiple IDs). * + * NOTE: Intended for use in refresh calls, where we have to close + * and re-open the underlying data, then hook the object back + * up to the original ID. + * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t id) +H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id) { - H5VL_object_t *new_vol_obj = NULL; /* pointer to new VOL object */ H5I_id_type_t *type_ptr; /* ptr to the type */ H5I_id_info_t *id_ptr; /* ptr to the new ID information */ herr_t ret_value = SUCCEED; /* return value */ @@ -789,10 +792,9 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t /* Check arguments */ HDassert(object); - HDassert(vol_driver); /* Make sure ID is not already in use */ - if(NULL != (id_ptr = H5I__find_id(id))) + if(NULL != (id_ptr = H5I__find_id(existing_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use") /* Make sure type number is valid */ @@ -806,36 +808,18 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Make sure requested ID belongs to object's type */ - if(H5I_TYPE(id) != type) + if(H5I_TYPE(existing_id) != type) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID") /* Allocate new structure to house this ID */ if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") - /* Set up the new VOL object */ - if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object"); - new_vol_obj->driver = vol_driver; - new_vol_obj->data = object; - - /* Bump the reference count on the VOL driver */ - vol_driver->nrefs++; - /* Create the struct & insert requested ID */ - id_ptr->id = id; + id_ptr->id = existing_id; id_ptr->count = 1; /* initial reference count*/ id_ptr->app_count = !!app_ref; - if(H5I_DATATYPE == type) { - void *dt = NULL; - - if(NULL == (dt = (void *)H5T_construct_datatype(new_vol_obj))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "can't construct datatype object"); - - id_ptr->obj_ptr = dt; - } - else - id_ptr->obj_ptr = new_vol_obj; + id_ptr->obj_ptr = object; /* Insert into the type */ if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -844,7 +828,7 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_register_with_id() */ +} /* end H5I_register_using_existing_id() */ /*------------------------------------------------------------------------- @@ -2222,7 +2206,7 @@ H5I__get_file_id(hid_t obj_id, H5I_type_t type) FUNC_ENTER_STATIC /* Get the object pointer */ - if (NULL == (vol_obj = H5VL_get_object(obj_id))) + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") /* Get the file through the VOL */ @@ -2237,7 +2221,7 @@ H5I__get_file_id(hid_t obj_id, H5I_type_t type) /* If the ID does not exist, register it with the VOL driver */ if (H5I_INVALID_HID == ret_value) { - if ((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) + if ((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } else { diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 8fd7caa..9068b5f 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -67,13 +67,7 @@ typedef struct H5I_class_t { H5_DLL herr_t H5I_register_type(const H5I_class_t *cls); H5_DLL int64_t H5I_nmembers(H5I_type_t type); H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref); -H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); -H5_DLL herr_t H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t id); -H5_DLL void *H5I_subst(hid_t id, const void *new_object); -H5_DLL void *H5I_object(hid_t id); -H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); H5_DLL H5I_type_t H5I_get_type(hid_t id); -H5_DLL void *H5I_remove(hid_t id); H5_DLL herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref); H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref); H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref); @@ -83,6 +77,26 @@ H5_DLL int H5I_dec_app_ref_always_close(hid_t id); H5_DLL int H5I_dec_type_ref(H5I_type_t type); H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*out*/); +/* NOTE: The object and ID functions below deal in non-VOL objects (i.e.; + * H5S_t, etc.). Similar VOL calls exist in H5VLprivate.h. Use + * the H5VL calls with objects that go through the VOL, such as + * datasets and groups, and the H5I calls with objects + * that do not, such as property lists and dataspaces. Datatypes + * are can be either named, where they will use the VOL, or not, + * and thus require special treatment. See the datatype docs for + * how to handle this. + */ + +/* Functions that manipulate objects */ +H5_DLL void *H5I_object(hid_t id); +H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); +H5_DLL void *H5I_remove(hid_t id); +H5_DLL void *H5I_subst(hid_t id, const void *new_object); + +/* ID registration functions */ +H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); +H5_DLL herr_t H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id); + /* Debugging functions */ H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type); diff --git a/src/H5L.c b/src/H5L.c index 656edec..0beafba 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -489,7 +489,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name loc_params.obj_type = H5I_get_type(link_loc_id); /* get the location object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5VL_get_object(link_loc_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the plist structure */ @@ -580,12 +580,12 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(H5L_SAME_LOC != cur_loc_id) { /* Get the current location object */ - if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_get_object(cur_loc_id))) + if (NULL == (vol_obj1 = (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) { /* Get the new location object */ - if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_get_object(new_loc_id))) + if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_vol_object(new_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") } diff --git a/src/H5O.c b/src/H5O.c index 77b9498..23b6dda7 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -135,7 +135,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Get an atom for the object */ - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) @@ -207,7 +207,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -276,7 +276,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Register the dataset ID */ - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -350,12 +350,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(H5L_SAME_LOC != obj_id) { /* get the location object */ - if(NULL == (vol_obj1 = H5VL_get_object(obj_id))) + 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_get_object(new_loc_id))) + 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 plugins are the same */ @@ -419,7 +419,7 @@ H5Oincr_refcount(hid_t object_id) loc_params.obj_type = H5I_get_type(object_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -470,7 +470,7 @@ H5Odecr_refcount(hid_t object_id) loc_params.obj_type = H5I_get_type(object_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -521,7 +521,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set the location struct fields */ @@ -575,7 +575,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -634,7 +634,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -700,7 +700,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -741,7 +741,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) H5TRACE2("e", "i*s", obj_id, comment); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -805,7 +805,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* (Re)set the object's comment */ @@ -845,7 +845,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); /* Get the object */ - if (NULL == (vol_obj = H5VL_get_object(obj_id))) + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Set fields in the location struct */ @@ -904,7 +904,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Retrieve the object's comment */ @@ -974,7 +974,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set location parameters */ @@ -1058,7 +1058,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set location parameters */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index ead2028..68eb170 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -105,7 +105,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -157,7 +157,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -219,7 +219,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ @@ -284,7 +284,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set location parameters */ @@ -363,7 +363,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the location object */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set location parameters */ diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 84095d9..40b6c6e 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -80,7 +80,7 @@ H5Oflush(hid_t obj_id) H5TRACE1("e", "i", obj_id); /* Check args */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set up collective metadata if appropriate */ @@ -245,7 +245,7 @@ H5Orefresh(hid_t oid) H5TRACE1("e", "i", oid); /* Check args */ - if(NULL == (vol_obj = H5VL_get_object(oid))) + if(NULL == (vol_obj = H5VL_vol_object(oid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set up collective metadata if appropriate */ @@ -323,7 +323,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) * The vol_obj will disappear when the underlying object is closed, so * we can't use that directly. */ - if(NULL == (vol_obj = H5VL_get_object(oid))) + if(NULL == (vol_obj = H5VL_vol_object(oid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") driver = vol_obj->driver; @@ -501,7 +501,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h } /* end switch */ /* Re-register ID for the object */ - if((H5I_register_with_id(type, object, vol_driver, TRUE, oid)) < 0) + if((H5VL_register_using_existing_id(type, object, vol_driver, TRUE, oid)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") done: diff --git a/src/H5R.c b/src/H5R.c index 3e6517f..a2a7a14 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -189,7 +189,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the VOL object */ - if(NULL == (vol_obj = H5VL_get_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Set location parameters */ @@ -204,7 +204,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 9c1fcc5..f224cda 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -122,7 +122,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) loc_params.obj_type = H5I_get_type(id); /* Get the vol object */ - if (NULL == (vol_obj = H5VL_get_object(id))) + if (NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") /* Get the object information */ @@ -173,7 +173,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Get the VOL object */ - if (NULL == (vol_obj = H5VL_get_object(obj_id))) + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") loc_params.type = H5VL_OBJECT_BY_REF; @@ -188,7 +188,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") /* Get an atom for the object */ - if ((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 8f7b4de..09a0f3f 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -600,7 +600,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 1b59c6b..0e45587 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -203,7 +203,7 @@ H5Topen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: diff --git a/src/H5VL.c b/src/H5VL.c index 24e558c..85b991f 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -201,7 +201,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLregister + * Function: H5VLregister_driver * * Purpose: Registers a new VOL driver as a member of the virtual object * layer class. @@ -210,17 +210,17 @@ done: * library is closed or the driver is * unregistered. * - * Failure: A negative value (H5I_INVALID_HID). + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VLregister(const H5VL_class_t *cls) +H5VLregister_driver(const H5VL_class_t *cls) { H5VL_get_driver_ud_t op_data; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", cls); /* Check arguments */ @@ -246,16 +246,16 @@ H5VLregister(const H5VL_class_t *cls) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver with the same name is already registered.") /* Create the new class ID */ - if ((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0) + if ((ret_value = H5VL_register_driver(cls, sizeof(H5VL_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister() */ +} /* end H5VLregister_driver() */ /*------------------------------------------------------------------------- - * Function: H5VLregister_by_name + * Function: H5VLregister_driver_by_name * * Purpose: Registers a new VOL driver as a member of the virtual object * layer class. @@ -264,17 +264,17 @@ done: * library is closed or the driver is * unregistered. * - * Failure: A negative value. + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VLregister_by_name(const char *name) +H5VLregister_driver_by_name(const char *name) { H5VL_get_driver_ud_t op_data; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*s", name); /* Check arguments */ @@ -306,21 +306,21 @@ H5VLregister_by_name(const char *name) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL driver") /* Register the driver we loaded */ - if ((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0) + if ((ret_value = H5VL_register_driver(cls, sizeof(H5VL_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID") } done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister_by_name() */ +} /* end H5VLregister_driver_by_name() */ /*------------------------------------------------------------------------- - * Function: H5VLunregister + * Function: H5VLunregister_driver * - * Purpose: Removes a vol driver ID from the library. This in no way affects + * Purpose: Removes a VOL driver ID from the library. This in no way affects * file access property lists which have been defined to use - * this vol driver or files which are already opened under with + * this VOL driver or files which are already opened under with * this driver. * * Return: Success: Non-negative @@ -330,7 +330,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLunregister(hid_t vol_id) +H5VLunregister_driver(hid_t vol_id) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -348,11 +348,11 @@ H5VLunregister(hid_t vol_id) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLunregister() */ +} /* end H5VLunregister_driver() */ /*------------------------------------------------------------------------- - * Function: H5VLis_registered + * Function: H5VLis_driver_registered * * Purpose: Tests whether a VOL class has been registered or not * @@ -365,7 +365,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5VLis_registered(const char *name) +H5VLis_driver_registered(const char *name) { H5VL_get_driver_ud_t op_data; htri_t ret_value = FALSE; /* Return value */ @@ -385,7 +385,7 @@ H5VLis_registered(const char *name) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLis_registered() */ +} /* end H5VLis_driver_registered() */ /*------------------------------------------------------------------------- @@ -455,34 +455,39 @@ done: /*--------------------------------------------------------------------------- - * Function: H5VLobject_register + * Function: H5VLregister * - * Purpose: Public routine to create an HDF5 hid_t with library - * specific types, bypassing the limitation of H5Iregister. + * Purpose: Public routine to register an object and get an ID given a + * VOL driver ID. * - * Return: Success: Non-negative + * Unlike H5Iregister(), this API call can register library + * types (e.g.; H5I_DATASET). * - * Failure: Negative + * NOTE: This API call is mainly intended for VOL driver authors. + * + * Return: Success: A valid HDF5 ID + * + * Failure: H5I_INVALID_HID * *--------------------------------------------------------------------------- */ hid_t -H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t driver_id) +H5VLregister(H5I_type_t type, const void *obj, hid_t driver_id) { - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) - H5TRACE3("i", "*xIti", obj, obj_type, driver_id); + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE3("i", "It*xi", type, obj, driver_id); if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object to register") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "obj pointer can't be NULL") - if ((ret_value = H5VL_object_register(obj, obj_type, driver_id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") + if ((ret_value = H5VL_register_using_vol_id(type, obj, driver_id, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object") done: FUNC_LEAVE_API(ret_value) -} /* H5VLobject_register */ +} /* H5VLregister */ /*------------------------------------------------------------------------- @@ -540,7 +545,7 @@ H5VLget_object(hid_t obj_id, void **obj) if (!obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object pointer") - if (NULL == (*obj = H5VL_get_object(obj_id))) + if (NULL == (*obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain a valid object") done: diff --git a/src/H5VLint.c b/src/H5VLint.c index 78ba6d9..e246989 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -213,20 +213,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_register_id + * Function: H5VL_register * - * Purpose: Wrapper to register an object ID with a VOL aux struct - * and increment ref count on VOL driver ID + * Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t + * from the passed-in object and registers that. Does the right + * thing with datatypes, which are complicated under the VOL. * - * Return: Success: A valid HDF5 ID + * Return: Success: A valid HDF5 ID * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref) +H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_driver, hbool_t app_ref) { - H5VL_object_t *new_obj = NULL; + H5VL_object_t *vol_obj = NULL; hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -235,32 +236,135 @@ H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ HDassert(object); HDassert(vol_driver); - /* setup VOL object */ - if (NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) + /* Set up VOL object to wrap the passed-in data */ + if (NULL == (vol_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate top object structure"); - new_obj->driver = vol_driver; - new_obj->data = object; + vol_obj->driver = vol_driver; + vol_obj->data = object; vol_driver->nrefs++; + /* Datatypes need special handling under the VOL, since they have a non-VOL aspect */ if (H5I_DATATYPE == type) { H5T_t *dt = NULL; - if (NULL == (dt = H5T_construct_datatype(new_obj))) + if (NULL == (dt = H5T_construct_datatype(vol_obj))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object"); if ((ret_value = H5I_register(type, dt, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle"); } else { - if ((ret_value = H5I_register(type, new_obj, app_ref)) < 0) + if ((ret_value = H5I_register(type, vol_obj, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle"); } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_register_id() */ +} /* end H5VL_register() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_register_using_existing_id + * + * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. + * This routine will check to ensure the supplied ID is not already + * in use, and ensure that it is a valid ID for the given type, + * but will NOT check to ensure the OBJECT is not already + * registered (thus, it is possible to register one object under + * multiple IDs). + * + * NOTE: Intended for use in refresh calls, where we have to close + * and re-open the underlying data, then hook the VOL object back + * up to the original ID. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t existing_id) +{ + H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */ + void *stored_obj = NULL; /* Pointer to the object that will be stored */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + HDassert(object); + HDassert(vol_driver); + + /* Make sure type number is valid */ + if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + + /* Set up the new VOL object */ + if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object"); + new_vol_obj->driver = vol_driver; + new_vol_obj->data = object; + + /* Bump the reference count on the VOL driver */ + vol_driver->nrefs++; + + /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */ + if(H5I_DATATYPE == type) { + if(NULL == (stored_obj = (void *)H5T_construct_datatype(new_vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't construct datatype object"); + } + else + stored_obj = (void *)new_vol_obj; + + /* Call the underlying H5I function to complete the registration */ + if(H5I_register_using_existing_id(type, stored_obj, app_ref, existing_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register_using_existing_id() */ + + +/*------------------------------------------------------------------------- + * 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 driver's ID to + * get the driver 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, const void *obj, hid_t driver_id, hbool_t app_ref) +{ + H5VL_class_t *cls = NULL; + H5VL_t *driver = NULL; /* VOL driver struct */ + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_NOAPI(FAIL) + + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID"); + + /* Setup VOL info struct */ + if (NULL == (driver = H5FL_CALLOC(H5VL_t))) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct"); + driver->cls = cls; + driver->id = driver_id; + if (H5I_inc_ref(driver->id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver"); + + /* Get an ID for the VOL object */ + if ((ret_value = H5VL_register(type, obj, driver, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register_using_vol_id() */ /*------------------------------------------------------------------------- @@ -299,7 +403,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_register + * Function: H5VL_register_driver * * Purpose: Registers a new VOL driver as a member of the virtual object * layer class. @@ -312,7 +416,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register(const void *_cls, size_t size, hbool_t app_ref) +H5VL_register_driver(const void *_cls, size_t size, hbool_t app_ref) { const H5VL_class_t *cls = (const H5VL_class_t *)_cls; H5VL_class_t *saved = NULL; @@ -338,47 +442,7 @@ done: H5MM_xfree(saved); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_register() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_register - * - * Purpose: Utility function to create a user ID for an object created - * or opened through the VOL - * - * Return: Success: A valid HDF5 ID - * Failure: H5I_INVALID_HID - * - *------------------------------------------------------------------------- - */ -hid_t -H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t driver_id, hbool_t app_ref) -{ - H5VL_class_t *cls = NULL; - H5VL_t *driver = NULL; /* VOL driver struct */ - hid_t ret_value = H5I_INVALID_HID; - - FUNC_ENTER_NOAPI(FAIL) - - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID"); - - /* Setup VOL info struct */ - if (NULL == (driver = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct"); - driver->cls = cls; - driver->id = driver_id; - if (H5I_inc_ref(driver->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver"); - - /* Get an ID for the VOL object */ - if ((ret_value = H5VL_register_id(obj_type, obj, driver, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_register() */ +} /* end H5VL_register_driver() */ /*------------------------------------------------------------------------- @@ -402,7 +466,7 @@ H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size) FUNC_ENTER_NOAPI(FAIL) /* get the object pointer */ - if (NULL == (vol_obj = H5VL_get_object(id))) + if (NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); cls = vol_obj->driver->cls; @@ -423,7 +487,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_get_object + * Function: H5VL_vol_object * * Purpose: Utility function to return the object pointer associated with * a hid_t. This routine is the same as H5I_object for all types @@ -436,7 +500,7 @@ done: *------------------------------------------------------------------------- */ H5VL_object_t * -H5VL_get_object(hid_t id) +H5VL_vol_object(hid_t id) { void *obj = NULL; H5I_type_t obj_type = H5I_get_type(id); @@ -463,7 +527,7 @@ H5VL_get_object(hid_t id) ret_value = (H5VL_object_t *)obj; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_get_object() */ +} /* end H5VL_vol_object() */ /*------------------------------------------------------------------------- @@ -597,15 +661,27 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_verify() */ - -/* XXX (VOL MERGE): This could be a macro like in H5F */ + +/*------------------------------------------------------------------------- + * Function: H5VL_driver_data + * + * Purpose: Get the VOL-specific data stored in a VOL object + * + * Return: Success: Pointer to the data + * + * Failure: NULL (technically can't fail) + * + *------------------------------------------------------------------------- + */ void * -H5VL_driver_object(H5VL_object_t *vol_obj) +H5VL_driver_data(H5VL_object_t *vol_obj) { FUNC_ENTER_NOAPI_NOINIT_NOERR + HDassert(vol_obj); + FUNC_LEAVE_NOAPI(vol_obj->data) -} /* end H5VL_driver_object() */ +} /* end H5VL_driver_data() */ /*------------------------------------------------------------------------- diff --git a/src/H5VLnative.c b/src/H5VLnative.c index acfceed..acd56cd 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -215,7 +215,7 @@ H5VL_native_init(void) /* Register the native VOL driver, if it isn't already */ if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) { - if((H5VL_NATIVE_ID_g = H5VL_register((const H5VL_class_t *)&H5VL_native_cls_g, + if((H5VL_NATIVE_ID_g = H5VL_register_driver((const H5VL_class_t *)&H5VL_native_cls_g, sizeof(H5VL_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL driver") } @@ -379,7 +379,7 @@ done: *--------------------------------------------------------------------------- */ hid_t -H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) +H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref) { hid_t ret_value = H5I_INVALID_HID; @@ -395,7 +395,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") /* Get an ID for the object */ - if((ret_value = H5VL_object_register(obj, type, H5VL_NATIVE_ID_g, app_ref)) < 0) + if((ret_value = H5VL_register_using_vol_id(type, obj, H5VL_NATIVE_ID_g, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") done: @@ -422,7 +422,7 @@ H5VL_native_unregister(hid_t obj_id) FUNC_ENTER_NOAPI_NOINIT /* get the driver pointer */ - if(NULL == (vol_obj = (H5VL_object_t *)H5VL_get_object(obj_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid ID") /* free object */ diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 4e33e8a..19b9ff9 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -34,7 +34,7 @@ extern "C" { H5_DLL herr_t H5Pset_fapl_native(hid_t fapl_id); H5_DLL hid_t H5VL_native_get_driver_id(void); H5_DLL hid_t H5VL_native_init(void); -H5_DLL hid_t H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref); +H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref); H5_DLL herr_t H5VL_native_unregister(hid_t obj_id); #ifdef __cplusplus diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 98be308..003e6f5 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -53,17 +53,34 @@ typedef struct H5VL_driver_prop_t { /* Library Private Prototypes */ /******************************/ -/* Common functions */ +/* Utility functions */ H5_DLL herr_t H5VL_init(void); -H5_DLL hid_t H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref); -H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); -H5_DLL hid_t H5VL_register(const void *cls, size_t size, hbool_t app_ref); -H5_DLL hid_t H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t driver_id, hbool_t app_ref); + +/* Functions that deal with VOL drivers */ +H5_DLL hid_t H5VL_register_driver(const void *cls, size_t size, hbool_t app_ref); H5_DLL ssize_t H5VL_get_driver_name(hid_t id, char *name/*out*/, size_t size); -H5_DLL H5VL_object_t *H5VL_get_object(hid_t id); + +/* NOTE: The object and ID functions below deal in VOL objects (i.e.; + * H5VL_object_t). Similar non-VOL calls exist in H5Iprivate.h. Use + * the H5VL calls with objects that go through the VOL, such as + * datasets and groups, and the H5I calls with objects + * that do not, such as property lists and dataspaces. Datatypes + * are can be either named, where they will use the VOL, or not, + * and thus require special treatment. See the datatype docs for + * how to handle this. + */ + +/* Functions that manipulate VOL objects */ H5_DLL void *H5VL_object(hid_t id); H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); -H5_DLL void *H5VL_driver_object(H5VL_object_t *obj); +H5_DLL void *H5VL_driver_data(H5VL_object_t *obj); +H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id); +H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); + +/* ID registration functions */ +H5_DLL hid_t H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_driver, hbool_t app_ref); +H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t driver_id, hbool_t app_ref); +H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t existing_id); /* Attribute functions */ H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index d118bcc..600de0d 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -411,13 +411,13 @@ extern "C" { H5_DLL herr_t H5VLinitialize(hid_t driver_id, hid_t vipl_id); H5_DLL herr_t H5VLterminate(hid_t driver_id, hid_t vtpl_id); H5_DLL herr_t H5VLclose(hid_t driver_id); -H5_DLL hid_t H5VLregister(const H5VL_class_t *cls); -H5_DLL hid_t H5VLregister_by_name(const char *driver_name); -H5_DLL herr_t H5VLunregister(hid_t driver_id); -H5_DLL htri_t H5VLis_registered(const char *name); +H5_DLL hid_t H5VLregister_driver(const H5VL_class_t *cls); +H5_DLL hid_t H5VLregister_driver_by_name(const char *driver_name); +H5_DLL herr_t H5VLunregister_driver(hid_t driver_id); +H5_DLL htri_t H5VLis_driver_registered(const char *name); H5_DLL hid_t H5VLget_driver_id(const char *name); H5_DLL ssize_t H5VLget_driver_name(hid_t id, char *name/*out*/, size_t size); -H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t driver_id); +H5_DLL hid_t H5VLregister(H5I_type_t obj_type, const void *obj, hid_t driver_id); H5_DLL void *H5VLobject(hid_t id); H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj); diff --git a/test/h5test.c b/test/h5test.c index 888fded..c1cc55b 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1915,7 +1915,7 @@ error: * them (e.g.: for testing VOL driver ID handling). * * This API call will return a pointer to a VOL class that - * can be used to construct a test VOL using H5VLregister(). + * can be used to construct a test VOL using H5VLregister_driver(). * * Return: Success: A pointer to a VOL class struct * Failure: NULL diff --git a/test/tmisc.c b/test/tmisc.c index 9eed5db..2a977bf 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -3487,9 +3487,9 @@ test_misc19(void) vol_cls = h5_get_dummy_vol_class(); CHECK(vol_cls, NULL, "h5_get_dummy_vol_class"); - /* Register a virtual object driver */ - volid = H5VLregister(vol_cls); - CHECK(volid, FAIL, "H5VLregister"); + /* Register a VOL driver */ + volid = H5VLregister_driver(vol_cls); + CHECK(volid, FAIL, "H5VLregister_driver"); /* Check the reference count */ rc = H5Iget_ref(volid); @@ -3500,8 +3500,8 @@ test_misc19(void) VERIFY(rc, 2, "H5Iinc_ref"); /* Unregister the VOL driver normally */ - ret = H5VLunregister(volid); - CHECK(ret, FAIL, "H5VLunregister"); + ret = H5VLunregister_driver(volid); + CHECK(ret, FAIL, "H5VLunregister_driver"); /* Check the reference count */ rc = H5Iget_ref(volid); @@ -3513,9 +3513,9 @@ test_misc19(void) /* Try unregistering the VOL driver again (should fail) */ H5E_BEGIN_TRY { - ret = H5VLunregister(volid); + ret = H5VLunregister_driver(volid); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5VLunregister"); + VERIFY(ret, FAIL, "H5VLunregister_driver"); HDfree(vol_cls); diff --git a/test/vol.c b/test/vol.c index 3152a93..ad65a62 100644 --- a/test/vol.c +++ b/test/vol.c @@ -135,17 +135,17 @@ test_vol_registration(void) TESTING("VOL registration"); /* The test/fake VOL driver should not be registered at the start of the test */ - if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) + if ((is_registered = H5VLis_driver_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (is_registered > 0) FAIL_PUTS_ERROR("native VOL driver is inappropriately registered"); /* Load a VOL interface */ - if ((vol_id = H5VLregister(&fake_vol_g)) < 0) + if ((vol_id = H5VLregister_driver(&fake_vol_g)) < 0) FAIL_STACK_ERROR; /* The test/fake VOL driver should be registered now */ - if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) + if ((is_registered = H5VLis_driver_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("native VOL driver is un-registered"); @@ -183,7 +183,7 @@ test_native_vol_init(void) TESTING("Native VOL driver initialization"); /* The native VOL driver should always be registered */ - if ((is_registered = H5VLis_registered(H5VL_NATIVE_NAME)) < 0) + if ((is_registered = H5VLis_driver_registered(H5VL_NATIVE_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("native VOL driver is un-registered"); -- cgit v0.12 From 7e00924d1b9d235b988e63556e3f2c2644bae543 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Oct 2018 14:44:27 -0500 Subject: EED-258 Add modules uses toolchain files --- MANIFEST | 1 + config/GCC.cmake | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 config/GCC.cmake diff --git a/MANIFEST b/MANIFEST index b820622..2ca6110 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3160,6 +3160,7 @@ ./java/lib/ext/slf4j-simple-1.7.25.jar # CMake-specific Files +./config/GCC.cmake ./config/intel.cmake ./config/cmake/cacheinit.cmake diff --git a/config/GCC.cmake b/config/GCC.cmake new file mode 100644 index 0000000..ddb1641 --- /dev/null +++ b/config/GCC.cmake @@ -0,0 +1,10 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "GCC") + +set(CMAKE_C_COMPILER cc) +set(CMAKE_CXX_COMPILER c++) +set(CMAKE_Fortran_COMPILER gfortran) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") -- cgit v0.12 From 494d39f1c2f6225c732cb857c860d6b475d03226 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Oct 2018 13:34:31 -0500 Subject: Move options to root cmake file --- CMakeLists.txt | 6 ++++++ src/CMakeLists.txt | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 53cddf7..e2fb000 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -913,4 +913,10 @@ endif () #----------------------------------------------------------------------------- configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY) +#----------------------------------------------------------------------------- +# Options for use by cross compiling and toolchains +#----------------------------------------------------------------------------- +option (HDF5_USE_PREGEN "Use pre-generated Files" OFF) +option (HDF5_BATCH_H5DETECT "Use a batch command for running h5detect" OFF) + include (CMakeInstallation.cmake) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 610111b..5104019 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -877,7 +877,6 @@ endif () # Setup the H5detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -option (HDF5_USE_PREGEN "Use pre-generated Files" OFF) if (HDF5_USE_PREGEN) set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR}) else () -- cgit v0.12 From 46c5b059f1a7c434bff7b04f56f74de84a41edd2 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 20 Oct 2018 13:06:37 -0700 Subject: Split H5VLnative.h into public and private files and updated --- MANIFEST | 1 + src/CMakeLists.txt | 1 + src/H5Aint.c | 2 +- src/H5Dint.c | 2 +- src/H5Dvirtual.c | 2 +- src/H5Fint.c | 3 +-- src/H5Gint.c | 2 +- src/H5Gtraverse.c | 2 +- src/H5L.c | 2 +- src/H5Lexternal.c | 2 +- src/H5Oint.c | 2 +- src/H5Pfapl.c | 2 +- src/H5VLnative.c | 2 +- src/H5VLnative.h | 8 -------- src/H5VLnative_private.h | 40 ++++++++++++++++++++++++++++++++++++++++ src/hdf5.h | 3 +++ test/vol.c | 2 +- 17 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 src/H5VLnative_private.h diff --git a/MANIFEST b/MANIFEST index 2ca6110..a7df90c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -893,6 +893,7 @@ ./src/H5VLmodule.h ./src/H5VLnative.c ./src/H5VLnative.h +./src/H5VLnative_private.h ./src/H5VLpkg.h ./src/H5VLprivate.h ./src/H5VLpublic.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5104019..f82b8de 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -835,6 +835,7 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5STprivate.h ${HDF5_SRC_DIR}/H5Tprivate.h ${HDF5_SRC_DIR}/H5TSprivate.h + ${HDF5_SRC_DIR}/H5VLnative_private.h ${HDF5_SRC_DIR}/H5VLprivate.h ${HDF5_SRC_DIR}/H5VMprivate.h ${HDF5_SRC_DIR}/H5WBprivate.h diff --git a/src/H5Aint.c b/src/H5Aint.c index 80a3e98..ca5cb80 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -43,7 +43,7 @@ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Dint.c b/src/H5Dint.c index 3436105..253d005 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -31,7 +31,7 @@ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 77047e9..c7c1eec 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -58,7 +58,7 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property Lists */ #include "H5Sprivate.h" /* Dataspaces */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ #include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ diff --git a/src/H5Fint.c b/src/H5Fint.c index 6a57ca5..1a0c8b9 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -38,8 +38,7 @@ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLprivate.h" /* VOL drivers */ - -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Gint.c b/src/H5Gint.c index 88ef82b..26c582e 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -39,7 +39,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ -#include "H5VLnative.h" /* Virtual Object Layer (native) */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index a103f53..8fefcd8 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -43,7 +43,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppublic.h" /* Property Lists */ #include "H5WBprivate.h" /* Wrapped Buffers */ -#include "H5VLnative.h" /* Virtual Object Layer (native) */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5L.c b/src/H5L.c index 0beafba..5142c82 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -34,7 +34,7 @@ #include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Virtual Object Layer (native) */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index d9cc7a3..34c96a8 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -34,7 +34,7 @@ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Native VOL Driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Oint.c b/src/H5Oint.c index c569226..30fe127 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -43,7 +43,7 @@ #endif /* H5O_ENABLE_BOGUS */ #include "H5Opkg.h" /* Object headers */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Virtual Object Layer (native) */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 0340b67..a50c5ee 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -49,7 +49,7 @@ #endif /* Includes needed to set the default VOL driver */ -#include "H5VLnative.h" /* Native HDF5 file VOL driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index acd56cd..e71e08e 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -41,7 +41,7 @@ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tpkg.h" /* Datatypes */ #include "H5VLprivate.h" /* VOL drivers */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL driver */ /* * The VOL driver identification number. diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 19b9ff9..832c758 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -17,9 +17,6 @@ #ifndef _H5VLnative_H #define _H5VLnative_H -/* Initializer function for native VOL driver */ -#define H5VL_NATIVE (H5VL_native_init()) - /* Characteristics of the native VOL driver */ #define H5VL_NATIVE_NAME "native" #define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */ @@ -30,12 +27,7 @@ extern "C" { #endif -/* XXX (VOL_MERGE): Poor separation of public and private functionality here */ H5_DLL herr_t H5Pset_fapl_native(hid_t fapl_id); -H5_DLL hid_t H5VL_native_get_driver_id(void); -H5_DLL hid_t H5VL_native_init(void); -H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref); -H5_DLL herr_t H5VL_native_unregister(hid_t obj_id); #ifdef __cplusplus } diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h new file mode 100644 index 0000000..79a6e1c --- /dev/null +++ b/src/H5VLnative_private.h @@ -0,0 +1,40 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 private header file for the native VOL driver. + */ + +#ifndef _H5VLnative_private_H +#define _H5VLnative_private_H + +/* Include driver's public header */ +#include "H5VLnative.h" + +/* Initializer function for native VOL driver */ +#define H5VL_NATIVE (H5VL_native_init()) + + +#ifdef __cplusplus +extern "C" { +#endif + +H5_DLL hid_t H5VL_native_get_driver_id(void); +H5_DLL hid_t H5VL_native_init(void); +H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref); +H5_DLL herr_t H5VL_native_unregister(hid_t obj_id); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5VLnative_private_H */ diff --git a/src/hdf5.h b/src/hdf5.h index fbeae83..f19abd9 100644 --- a/src/hdf5.h +++ b/src/hdf5.h @@ -52,4 +52,7 @@ #include "H5FDwindows.h" /* Win32 I/O */ #endif +/* Virtual object layer drivers */ +#include "H5VLnative.h" /* Native VOL driver */ + #endif diff --git a/test/vol.c b/test/vol.c index ad65a62..0ef84c5 100644 --- a/test/vol.c +++ b/test/vol.c @@ -19,7 +19,7 @@ */ #include "h5test.h" -#include "H5VLnative.h" +#include "H5VLnative_private.h" #define NATIVE_VOL_TEST_FILENAME "native_vol_test" -- cgit v0.12 From b33a2e7dfe76a2947c12462adb40c88af9c92e75 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 21 Oct 2018 10:08:26 -0700 Subject: Fixed warnings in the VOL example and run it from the script. --- examples/h5_vol_external_log_native.c | 16 ++++++++-------- examples/run-c-ex.sh.in | 4 +++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index a25be6d..d6e44db 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -131,7 +131,7 @@ visit_cb(hid_t oid, const char *name, if(H5Iget_type(oid) == H5I_GROUP) { len = H5VLget_driver_name(oid, n, 50); - printf ("Visiting GROUP VOL name = %s %d\n", n, len); + printf ("Visiting GROUP VOL name = %s %zd\n", n, len); } if(H5Iget_type(oid) == H5I_DATASET) printf("visiting dataset\n"); @@ -184,29 +184,29 @@ int main(int argc, char **argv) { file_id = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); len = H5VLget_driver_name(file_id, name, 25); - printf ("FILE VOL name = %s %d\n", name, len); + printf ("FILE VOL name = %s %zd\n", name, len); group_id = H5Gcreate2(file_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); len = H5VLget_driver_name(group_id, name, 50); - printf ("GROUP VOL name = %s %d\n", name, len); + printf ("GROUP VOL name = %s %zd\n", name, len); int_id = H5Tcopy(H5T_NATIVE_INT); H5Tcommit2(file_id, "int", int_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); len = H5VLget_driver_name(int_id, name, 50); - printf ("DT COMMIT name = %s %d\n", name, len); + printf ("DT COMMIT name = %s %zd\n", name, len); H5Tclose(int_id); int_id = H5Topen2(file_id, "int", H5P_DEFAULT); len = H5VLget_driver_name(int_id, name, 50); - printf ("DT OPEN name = %s %d\n", name, len); + printf ("DT OPEN name = %s %zd\n", name, len); H5Tclose(int_id); int_id = H5Oopen(file_id,"int",H5P_DEFAULT); len = H5VLget_driver_name(int_id, name, 50); - printf ("DT OOPEN name = %s %d\n", name, len); + printf ("DT OOPEN name = %s %zd\n", name, len); len = H5Fget_name(file_id, name, 50); - printf("name = %d %s\n", len, name); + printf("name = %zd %s\n", len, name); data = malloc (sizeof(int)*nelem); for(i=0;i Date: Mon, 22 Oct 2018 15:39:03 -0500 Subject: TRILAB-36 add option for test script batch command --- config/cmake/scripts/CTestScript.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 670196b..43cd48d 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -263,7 +263,11 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") if (NOT LOCAL_SKIP_TEST) if (NOT LOCAL_MEMCHECK_TEST) - ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) + if (NOT LOCAL_BATCH_TEST) + ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) + else () + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_NAME}) + endif () if (LOCAL_SUBMIT) ctest_submit (PARTS Test) endif () -- cgit v0.12 From 096279caf76a542306b840fb90e1e753e8bbf748 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 22 Oct 2018 16:08:52 -0500 Subject: HDFFV-10608 Move toolchain files into a subfolder --- MANIFEST | 4 ++-- config/GCC.cmake | 10 ---------- config/cmake/UserMacros/Windows_MT.cmake | 3 ++- config/cmake/scripts/HDF5options.cmake | 2 +- config/intel.cmake | 10 ---------- config/toolchain/GCC.cmake | 10 ++++++++++ config/toolchain/intel.cmake | 10 ++++++++++ 7 files changed, 25 insertions(+), 24 deletions(-) delete mode 100644 config/GCC.cmake delete mode 100644 config/intel.cmake create mode 100644 config/toolchain/GCC.cmake create mode 100644 config/toolchain/intel.cmake diff --git a/MANIFEST b/MANIFEST index a7df90c..d32e04d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3161,8 +3161,8 @@ ./java/lib/ext/slf4j-simple-1.7.25.jar # CMake-specific Files -./config/GCC.cmake -./config/intel.cmake +./config/toolchain/GCC.cmake +./config/toolchain/intel.cmake ./config/cmake/cacheinit.cmake ./config/cmake/CMakeFindJavaCommon.cmake diff --git a/config/GCC.cmake b/config/GCC.cmake deleted file mode 100644 index ddb1641..0000000 --- a/config/GCC.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# Uncomment the following to use cross-compiling -#set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_COMPILER_VENDOR "GCC") - -set(CMAKE_C_COMPILER cc) -set(CMAKE_CXX_COMPILER c++) -set(CMAKE_Fortran_COMPILER gfortran) - -# the following is used if cross-compiling -set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index b6cc513..78d8277 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -14,7 +14,8 @@ ######################################################## # To use this option, copy both the macro and option code -# into the root UserMacros.cmake file. +# into the root UserMacros.cmake file. Then enable the option, +# using the command line add "-DBUILD_STATIC_CRT_LIBS:BOOL=ON" # OR add an include to the root UserMacros.cmake file: # INCLUDE(path_to_file/WINDOWS_MT.cmake) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 440a3ae..629d277 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -98,6 +98,6 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") ############################################################################################# ### use a toolchain file -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/intel.cmake") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake") ############################################################################################# diff --git a/config/intel.cmake b/config/intel.cmake deleted file mode 100644 index f1a5734..0000000 --- a/config/intel.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# Uncomment the following to use cross-compiling -#set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_COMPILER_VENDOR "intel") - -set(CMAKE_C_COMPILER icc) -set(CMAKE_CXX_COMPILER icpc) -set(CMAKE_Fortran_COMPILER ifort) - -# the following is used if cross-compiling -set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/config/toolchain/GCC.cmake b/config/toolchain/GCC.cmake new file mode 100644 index 0000000..ddb1641 --- /dev/null +++ b/config/toolchain/GCC.cmake @@ -0,0 +1,10 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "GCC") + +set(CMAKE_C_COMPILER cc) +set(CMAKE_CXX_COMPILER c++) +set(CMAKE_Fortran_COMPILER gfortran) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/config/toolchain/intel.cmake b/config/toolchain/intel.cmake new file mode 100644 index 0000000..f1a5734 --- /dev/null +++ b/config/toolchain/intel.cmake @@ -0,0 +1,10 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "intel") + +set(CMAKE_C_COMPILER icc) +set(CMAKE_CXX_COMPILER icpc) +set(CMAKE_Fortran_COMPILER ifort) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") -- cgit v0.12